Hi Everyone,
My code works for one file root, so I put all the .root file inside a .tex and use TChain and a while loop to process all the .root file. But only the first .root file one the .tex file is taken into account.
Also I can’t have the outdirectory I set, instead I get this error:
Error in <TFile::Open>: no url specified
Here is my code:
// main program starts here
int main(int argc, char **argv) {
TString reader;
ifstream fileReader(argv[1]);
TString dirout = argv[2];
gSystem->Exec("mkdir -p " + dirout );
TFile* outputFile = TFile::Open(TString::Format("%s/%s.root",argv[2],argv[3]), "recreate");
SetAtlasStyle(1);
gStyle->SetPadColor (0);
gStyle->SetPadBorderSize (10);
gStyle->SetPadBorderMode (0);
gStyle->SetPadBottomMargin(0.18);
gStyle->SetPadTopMargin (0.06);
gStyle->SetPadLeftMargin (0.10);
gStyle->SetPadRightMargin (0.04);
gStyle->SetPadGridX (0);
gStyle->SetPadGridY (0);
gStyle->SetPadTickX (1);
gStyle->SetPadTickY (1);
gStyle->SetTitleYOffset(1.0);
gStyle->SetCanvasColor(0);
gStyle->SetOptStat(0);
gStyle->SetOptFit(1);
gStyle->SetStatColor(0);
TLatex *atexl=new TLatex(0.65,0.85,"ATLAS Internal");atexl->SetNDC();
new TApplication("ATLAS Week analisys",&argc,argv);
canv_1 = new TCanvas("canv_1","RAW",10,10,800,800); //canvas instantiated
canv_1->Divide(3,2);
TChain *treeHandle = new TChain("Nominal/llllTree");
while (!fileReader.eof()) {
reader.ReadLine(fileReader);
if( reader.Length() < 2 ) continue;
cout << " Adding " << reader << endl;
treeHandle->Add( reader );
}
llllTree2* m = new llllTree2(treeHandle);
m->Loop();
// pause so that you can zoom graphs etc .... then double click to continue
Int_t n=1;
while (n>0) {
obj = gPad->WaitPrimitive();
if (!obj) break; // leave this endless loop on a double click
printf("Mouse Action : Loop i=%d, found objIsA=%s, name=%s\n", n,obj->ClassName(),obj->GetName());
}
delete canv_1;
delete obj;
return 0;
outputFile->cd();
outputFile->Close();
}
I would really appreciate if someone could help.
Thanks in advance.
Cheers