Thanks
Now I’ve created MySelector and modified Analys.C as follows
[code]#include <TChain.h>
#include <TTree.h>
#include <TString.h>
#include <TTimeStamp.h>
#include <TEnv.h>
#include <TCanvas.h>
#include <TProofLite.h>
#include
#include
#include
#include
using namespace std;
#include “MySelector.h”
int Analys(TString list_of_files, TString naming) {
// char *list_of_files = new char[strlen(argv[2]) + 1];
// strcpy(list_of_files, argv[2]);
TChain *tree = new TChain(“ETAPPG/h1”);
// reading list of ROOT files from the file list
// files can be commented with ‘!’
string line;
ifstream filelist(list_of_files);
// ifstream filelist(“filelist.txt”);
if (filelist.is_open()) {
while (!filelist.eof()) {
if (getline(filelist, line, ‘\n’))
if (line[0] != ‘!’) {
tree->Add(line.data());
cout << “Adding file: " << line << " to the chain of files” << endl;
}
}
filelist.close();
} else {
cout << “Unable to open filelist” << endl;
return 0;
}
// //MC del, kommentera bort för att köra data
// //open histrogram file here
TFile *myfile;
myfile = new TFile(naming+".root",“RECREATE”);
TProof *proof = TProof::Open("");
proof->Load(“MySelector.C+”);
MySelector *analysis = new MySelector();
tree->SetProof(proof);
tree->Process((TSelector *)analysis);
//saving and closing histogram file
myfile->Write();
myfile->Close();
delete analysis;
return 0;
}[/code]
and I get some output looks like
[code]root [3] .L MySelector.C+
Info in : unmodified script has already been compiled and loaded
*** Interpreter error recovered ***
root [4] .L Analys.C+
Info in : unmodified script has already been compiled and loaded
root [5] Analys(“mckslpath”,“mcksl”);
Adding file: ./data/mcksl30300.root to the chain of files
Adding file: ./data/mcksl30301.root to the chain of files
Adding file: ./data/mcksl30302.root to the chain of files
Adding file: ./data/mcksl30303.root to the chain of files
Adding file: ./data/mcksl30304.root to the chain of files
Adding file: ./data/mcksl30313.root to the chain of files
Adding file: ./data/mcksl30314.root to the chain of files
Adding file: ./data/mcksl30315.root to the chain of files
Info in : unmodified script has already been compiled and loaded
19:04:04 12021 Wrk-0.3 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12021 Wrk-0.3 | Info in : unmodified script has already been compiled and loaded
19:04:04 12019 Wrk-0.2 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12019 Wrk-0.2 | Info in : unmodified script has already been compiled and loaded
19:04:04 12017 Wrk-0.1 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12017 Wrk-0.1 | Info in : unmodified script has already been compiled and loaded
19:04:04 12027 Wrk-0.6 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12027 Wrk-0.6 | Info in : unmodified script has already been compiled and loaded
19:04:04 12023 Wrk-0.4 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12023 Wrk-0.4 | Info in : unmodified script has already been compiled and loaded
19:04:04 12029 Wrk-0.7 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12029 Wrk-0.7 | Info in : unmodified script has already been compiled and loaded
19:04:04 12025 Wrk-0.5 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12025 Wrk-0.5 | Info in : unmodified script has already been compiled and loaded
19:04:04 12015 Wrk-0.0 | Info in TProofServLite::HandleCache: loading macro MySelector.C+ …
19:04:04 12015 Wrk-0.0 | Info in : unmodified script has already been compiled and loaded
Info in TProofLite::SetQueryRunning: starting query: 2
Info in TProofQueryResult::SetRunning: nwrks: 8
Looking up for exact location of files: OK (8 files)
Looking up for exact location of files: OK (8 files)
Info in TPacketizerAdaptive::TPacketizerAdaptive: Setting max number of workers per node to 8
Validating files: OK (8 files)
Info in TPacketizerAdaptive::InitStats: fraction of remote files 0.000000
Lite-0: all output objects have been merged[/code]
It seems worked, however, In Myselector.C I defined function Main() which suppose to do the analysis doesn’t print out the speed of light and total number of entries as I wanted, why? and how should I do then.
MySelector.C (2.5 KB)