void read_SyntBranch() { gSystem->Load("libCintex"); Cintex::Enable(); gSystem->Load("libPoolTestsPoolTreeTests"); TFile f("T1.root"); TTree * t = (TTree*)f.Get("Syn"); t->Show(7); t->Scan("m_2:m_3","id<10"); t->Scan("","id<5"); }
void Enum() { TTree *t = new TTree; WithEnum *e = new WithEnum; t->Branch("test",&e); t->Fill(); t->Fill(); #ifdef ClingWorkAroundCallfuncAndInline2 t->Scan("test.val"); #else t->Scan("test.val:test.GetVal()"); #endif }
int rundeepClass() #endif { TFile OriginalFile("ver_40200.root"); TFile CopyFile("CopyTree.root"); TTree* OriginalTree = (TTree*) OriginalFile.Get("NtpSt"); TTree* CopyTree = (TTree*) CopyFile.Get("NtpSt"); OriginalTree->Scan("fHeader.fVldContext.fDetector:fHeader.fVldContext.fSimFlag:fHeader.fVldContext.fTimeStamp.fSec","","colsize=20",10); CopyTree->Scan("fHeader.fVldContext.fDetector:fHeader.fVldContext.fSimFlag:fHeader.fVldContext.fTimeStamp.fSec","","colsize=20",10); return 0; }
void dumpSome(string infile, string field, string obj = "lb", string addCut = "") { TFile* tfIn = TFile::Open(infile.c_str(), "READ"); if (tfIn == 0) { cout << "Problem opening infile \"" << infile << "\" - exting"; return; } TTree* intree = (TTree*) tfIn->Get("events"); // cut selection Cuts cut; if (obj == "lb") cut.selectCut("acc03","lb07"); if (obj == "B0") cut.selectCut("acc03B0","B001"); //if (obj == "B0") cut.selectCut("acc03B0","B001exp"); if (addCut.size() > 0) intree->Draw(">>lst", (cut.getCut()+"&&"+addCut).c_str()); else intree->Draw(">>lst", cut.getCut().c_str()); TEventList *lst = (TEventList*)gDirectory->Get("lst"); intree->SetEventList(lst); intree->SetScanField(-1); intree->Scan(field.c_str()); }
void tscan(const char *input) { TFile* tf = new TFile(input); TTree* tree = (TTree*)tf->Get("tree"); tree->Draw("aa[][]"); tree->SetScanField(0); tree->Scan("aa"); }
void runstring() { TString *sone = new TString("topsone"); string *stwo = new string("topstwo"); vector<TString> *sthree = new vector<TString>; vector<string> *sfour = new vector<string>; vector<bool> sfive; vector<int> ssix; sthree->push_back("sthree_1"); sthree->push_back("sthree_2"); sfour->push_back("sfour_1"); sfour->push_back("sfour_2"); sfive.push_back(false); sfive.push_back(true); sfive.push_back(false); ssix.push_back(33); myclass *m = new myclass(1); TFile *f = new TFile("string.root","RECREATE"); TTree *t = new TTree("T","T"); t->Branch("sone",&sone,32000,0); t->Branch("stwo",&stwo,32000,0); t->Branch("sthree",&sthree,32000,0); t->Branch("sfour",&sfour,32000,0); t->Branch("obj.",&m); t->Branch("sfive",&sfive); t->Branch("ssix",&ssix); t->Fill(); f->Write(); t->Show(0); t->Scan("*"); t->Scan("sone"); t->Scan("stwo"); t->Scan("sthree.Data()"); t->Scan("sfour.c_str()"); }
void DrawFriend() { // Draw a scatter plot of variable x in the parent TTree versus // the same variable in the subtree. // This should produce points along a straight line. TFile *f = TFile::Open("treeparent.root"); TTree *T = (TTree*)f->Get("T"); T->AddFriend("TF","treefriend.root"); T->SetScanField(0); T->Scan("x:TF.x","","",20); }
TTree* modulo() { TTree *tree = new TTree("T","T"); UInt_t i = 1<<31; Int_t k = 1<<20; tree->Branch("unsignedInt",&i,"unsignedInt/i"); tree->Branch("signedInt",&k,"signedInt/I"); for(int j=0;j<2;++j) { tree->Fill(); k = -k; } i = 2763; k = 11*i; tree->Fill(); tree->Scan("signedInt:signedInt%235"); tree->Scan("unsignedInt:unsignedInt%235","","colsize=15"); tree->Scan("(signedInt/unsignedInt):(signedInt/unsignedInt)%10"); return tree; }
void make_run_table(const char * infile="rtree.root") { TFile * tf = new TFile(infile,"READ"); TTree * tr = (TTree*) tf->Get("rellum"); tr->SetScanField(0); char outfile[64]; strcpy(outfile,"run_table.txt"); gSystem->RedirectOutput(outfile,"w"); tr->Scan("i:runnum:fi:fill"); gSystem->RedirectOutput(0); printf("%s created\n",outfile); };
int runprova() { TChain *chain_null = new TChain("Eventi"); chain_null->Add("prova1.root"); chain_null->Add("prova2.root"); chain_null->Draw("br.n_run"); chain_null->Merge("merge.root"); TFile *f = new TFile("merge.root"); TTree *t; f->GetObject("Eventi",t); t->Scan("br.n_ev"); return 0; }
void runmixing(bool scan = false) { int len = 5; std::vector<MyClass> *p = new std::vector<MyClass>; TTree *t = new TTree("tree","bad vector"); t->Branch("checked_value", "vector<MyClass>", &p); t->Branch("value", "vector<MyClass>", (void*)&p); for(int i = 0; i<len; ++i) { p->push_back( MyClass( i*12 ) ); if (scan) t->Fill(); } t->SetBranchAddress("value",&p); if (scan) { //t->Print(); t->Scan("*"); } }
int runnestedind() { TTree *t = create(); t->SetScanField(0); t->Scan("type[]:type[sonind[]]","type[]==3"); TH1I* hgood = new TH1I("hgood","works",10,0,10); TH1I* hbad = new TH1I("hbad","used to fail",10,0,10); TCanvas *c = new TCanvas("c1"); c->Divide(1,2); c->cd(1); t->Draw("type[sonind[]]>>hbad","type[]==3"); c->cd(2); t->Draw("type[sonind[]]>>hgood","type[]==3 && sonind[]>=0"); if (hgood->GetMean()!=hbad->GetMean()) { cout << "Drawing \"type[sonind[]]>>hbad\",\"type[]==3\" failed!\n"; return 1; } #ifdef ClingWorkAroundErracticValuePrinter printf("(int)0\n"); #endif return 0; }
void dumpTrees(TString dir = "zz4lTree", const char *cut="", int maxEvents = 200, const char *process=0) { TTree *Events = (TTree *) gFile->Get(dir+"/probe_tree"); if (Events == 0) { std::cerr << "Didn't find " << dir << " in file " << gFile->GetName() << std::endl; return; } Events->SetScanField(0); if (dir.Contains("4l") || dir.Contains("4L")) { Events->Scan("event:mass:m4l:z1mass:z2mass:l1pdgId:l1pt:l1eta:l2pt:l2eta:l3pdgId:l3pt:l3eta:l4pt:l4eta:massErr:melaLD:pho1pt:pho1eta:pho2pt:pho2eta:jet1pt:jet1eta:jet2pt:jet2eta:mjj:njets30",cut,"",maxEvents); //} else if (dir.Contains("anyZllTree")) { // Events->Scan("event:zmass:l1pdgId:l1pt:l1eta:l2pt:l2eta:l1pfIsoComb04EACorr/l1pt:l2pfIsoComb04EACorr/l2pt:l1sip:l2sip",cut,"",maxEvents); } else if (dir.Contains("muonTree")) { Events->Scan("event:pt:eta:phi:looseID:newID:prlID:mvaISO:sip:pfIsoComb04EACorr:bdtIso:mvaISO:pfIsoChHad04:pfIsoNHad04_NoEA:pfIsoPhot04_NoEA:pfIsoEAtot:rho:rhoAA",cut,"",maxEvents); } else if (dir.Contains("electronTree")) { Events->Scan("event:pt:eta:phi:looseID:newID:prlID:sip:pfIsoComb04EACorr:bdtIso:bdtID:mvaISO:mvaID:pfIsoChHad04:pfIsoNHad04_NoEA:pfIsoPhot04_NoEA:pfIsoEAtot:rho:rhoAA",cut,"",maxEvents); } else if (dir.Contains("jetTree")) { Events->Scan("event:pt:eta:phi:passID:passPUID:puJetIDMask:jetIDMVA",cut,"",maxEvents); } else if (dir.Contains("photonTree")) { Events->Scan("event:pt:eta:phi:deltaR:eleMatch:lepMatchNoIso:lepMatch:pfIsoChHad03pt02:pfIsoNHad03:pfIsoPhot03:pfIsoChHadPU03pt02",cut,"",maxEvents); } else if (dir.Contains("zeetree")) { Events->Scan("event:zmass:zmll:l1pt:l1eta:l1phi:l2pt:l2eta:l2phi:fsr:phopt:phoeta:phophi",cut,"",maxEvents); } else if (dir.Contains("zmmtree")) { Events->Scan("event:zmass:zmll:l1pt:l1eta:l1phi:l2pt:l2eta:l2phi:fsr:phopt:phoeta:phophi",cut,"",maxEvents); } }
void checkFit3sigma(const char* filename) { TFile *f = new TFile(filename); if (!f) return; TTree *tr = (TTree*) f->Get("fitresults"); if (!tr) {delete f; return;} TString thePoiNames="N_Jpsi,b_Jpsi,f_Jpsi,m_Jpsi,sigma1_Jpsi,alpha_Jpsi,n_Jpsi,sigma2_Jpsi,MassRatio,rSigma21_Jpsi," "lambda1_Bkg,lambda2_Bkg,lambda3_Bkg,lambda4_Bkg,lambda5_Bkg,N_Bkg,b_Bkg," "ctau1_CtauRes,ctau2_CtauRes,f_CtauRes,rSigma21_CtauRes,s1_CtauRes," "fDFSS_BkgNoPR,fDLIV_BkgNoPR,lambdaDDS_BkgNoPR,lambdaDF_BkgNoPR,lambdaDSS_BkgNoPR,lambdaDSS_JpsiNoPR," "eff,effnp,lumi,taa,ncoll,npart,correl_N_Jpsi_vs_b_Jpsi"; TString t; Int_t from = 0; while (thePoiNames.Tokenize(t, from , ",")) { TString cutstr = t + "_err>0 && " + t + "_min!=" + t + "_max && ((" + t + "_val - " + t + "_min)/" + t + "_err<3 || (" + t + "_max - " + t + "_val)/" + t + "_err<3)"; TString colstr = "collSystem:ymin:ymax:ptmin:ptmax:centmin:centmax:" + t + "_val:" + t + "_err:" + t + "_min:" + t + "_max"; cout << cutstr.Data() << endl; tr->Scan(colstr,cutstr); } f->Close(); delete f; }
bool check(int n = 2) { TFile *file = TFile::Open(TString::Format("merged%d.root",n)); bool result = true; TH1F *h; file->GetObject("h1",h); if (!h) { Error("execFileMerger","h1 is missing\n"); result = false; } if (h->GetBinContent(2) != n || h->GetBinContent(3) != n) { Error("execFileMerger","h1 not added properly"); result = false; } THnSparseF *sparse; file->GetObject("sparse",sparse); if (!sparse) { Error("execFileMerger","sparse is missing\n"); result = false; } else { Int_t coordIdx[5] = {1, 2, 3, 4, 5}; Double_t cont = sparse->GetBinContent(coordIdx); if (cont > n + 0.4 || cont < n - 0.4) { Error("execFileMerger","sparse merge failed: expected bin content %g, read %g\n", (Double_t)n, cont); result = false; } Double_t entries = sparse->GetEntries(); if (entries > n + 0.4 || entries < n - 0.4) { Error("execFileMerger","sparse merge failed: expected %g entries, read %g\n", (Double_t)n, entries); result = false; } } THStack *stack; file->GetObject("stack",stack); if (!stack) { Error("execFileMerger","stack is missing\n"); result = false; } h = (TH1F*)stack->GetHists()->FindObject("hs_1"); if (!h) { Error("execFileMerger","hs_1 is missing\n"); result = false; } if (h->GetBinContent(2) != n || h->GetBinContent(3) != n) { Error("execFileMerger","hs_1 not added properly"); result = false; } h = (TH1F*)stack->GetHists()->FindObject("hs_2"); if (!h) { Error("execFileMerger","hs_2 is missing\n"); result = false; } if (h->GetBinContent(4) != n || h->GetBinContent(5) != n) { Error("execFileMerger","hs_2 not added properly"); result = false; } TGraph *gr; file->GetObject("exgraph",gr); if (!gr) { Error("execFileMerger","exgraph is missing\n"); result = false; } if (gr->GetN() != ( n * 3)) { Error("execFileMerger","exgraph not added properly n=%d rather than %d",gr->GetN(),n*3); result = false; } else { for(Int_t k = 0; k < gr->GetN(); ++k) { double x,y; gr->GetPoint(k,x,y); if ( x != ( (k%3)+1 ) || y != ( (k%3)+1 ) ) { Error("execFileMerger","exgraph not added properly"); result = false; } } } TTree *tree; file->GetObject("tree",tree); if (!tree) { Error("execFileMerger","tree is missing\n"); result = false; } if (tree->GetEntries() != n*2) { Error("execFileMerger","tree does not have the expected number of entries: %lld rather than %d",tree->GetEntries(),n*2); result = false; } else { if ( tree->GetEntries("data==1") != n ) { Error("execFileMerger","tree does not have the expected data. We got %lld entries with 'data==1' rather than %d",tree->GetEntries("data==1"),n); tree->Scan(); result = false; } } return result; }
forSync_ee() { ofstream fout; TString decay="ElEl"; // TString sample="ZJets"; TString sample="TTbarTuneZ2"; fout.open(decay+"_"+sample+".txt"); // fout.open(decay+"_"+sample+"_ALL.txt"); TFile* f = TFile::Open("./"+decay+"/vallot_"+sample+".root"); // TFile* f = TFile::Open("./"+decay+"/vallot_"+sample+"_ALL.root"); TTree* tree = (TTree*)f->Get("ElEl/tree"); bool scan=true; double step0, step1, step2, step3, step4, step5; TCut cut0 = ""; TCut cut1 = "ZMass > 12 && relIso1 < 0.17 && relIso2 < 0.17 && PairSign < 0 && pt1 > 20 && pt2 > 20"; TCut cut2 = cut1 && "abs(ZMass - 91.2) > 15"; TCut cut3 = cut2 && "@jetspt30.size() >= 2"; TCut cut4 = cut3 && "MET > 30"; TCut cut5 = cut4 && "nbjets_CSVL >= 1"; /* step0=tree->GetEntries(); step1=tree->GetEntries("ZMass > 12 && relIso1 < 0.2 && relIso2 < 0.2 && PairSign < 0 && pt1 > 20 && pt2 > 20"); step2=tree->GetEntries("ZMass > 12 && relIso1 < 0.2 && relIso2 < 0.2 && PairSign < 0 && pt1 > 20 && pt2 > 20 && abs(ZMass - 91.2) > 15"); step3=tree->GetEntries("ZMass > 12 && relIso1 < 0.2 && relIso2 < 0.2 && PairSign < 0 && pt1 > 20 && pt2 > 20 && abs(ZMass - 91.2) > 15 && @jetspt30.size() >= 2"); step4=tree->GetEntries("ZMass > 12 && relIso1 < 0.2 && relIso2 < 0.2 && PairSign < 0 && pt1 > 20 && pt2 > 20 && abs(ZMass - 91.2) > 15 && @jetspt30.size() >= 2 && MET > 30"); step5=tree->GetEntries("ZMass > 12 && relIso1 < 0.2 && relIso2 < 0.2 && PairSign < 0 && pt1 > 20 && pt2 > 20 && abs(ZMass - 91.2) > 15 && @jetspt30.size() >= 2 && MET > 30 && nbjets_CSVL >= 1"); */ step0=tree->GetEntries(); step1=tree->GetEntries(cut1); step2=tree->GetEntries(cut2); step3=tree->GetEntries(cut3); step4=tree->GetEntries(cut4); step5=tree->GetEntries(cut5); cout << "===================================================================================" << endl; cout << "Synchronization Exercise with MC (Decay channel = "+decay+", Sample = "+sample+") " << endl; cout << "===================================================================================" << endl; cout << "Cut at step1 ; " << "ZMass > 12 && relIso1 < 0.17 && relIso2 < 0.17 && PairSign < 0 && pt1 > 20 && pt2 > 20" << endl; cout << "Cut at step2 ; " << "Cut at step1 + && abs(ZMass - 91.2) > 15" << endl; cout << "Cut at step3 ; " << "Cut at step2 + && @jetspt30.size() >= 2 " << endl; cout << "Cut at step4 ; " << "Cut at step3 + && MET > 30" << endl; cout << "Cut at step5 ; " << "Cut at step4 + && nbjets_CSVL >= 1" << endl; cout << "===================================================================================" << endl; cout << "Step0 = " << step0 << endl; cout << "Step1 = " << step1 << endl; cout << "Step2 = " << step2 << endl; cout << "Step3 = " << step3 << endl; cout << "Step4 = " << step4 << endl; cout << "Step5 = " << step5 << endl; cout << "===================================================================================" << endl; if (scan==true) { cout << tree->Scan("RUN:LUMI:EVENT:ZMass:@jetspt30.size():MET:nbjets_CSVL",cut4) << endl; } fout << "===================================================================================" << endl; fout << "Synchronization Exercise with MC (Decay channel = "+decay+", Sample = "+sample+") " << endl; fout << "===================================================================================" << endl; fout << "Cut at step1 ; " << "ZMass > 12 && relIso1 < 0.17 && relIso2 < 0.17 && PairSign < 0 && pt1 > 20 && pt2 > 20" << endl; fout << "Cut at step2 ; " << "Cut at step1 + && abs(ZMass - 91.2) > 15" << endl; fout << "Cut at step3 ; " << "Cut at step2 + && @jetspt30.size() >= 2 " << endl; fout << "Cut at step4 ; " << "Cut at step3 + && MET > 30" << endl; fout << "Cut at step5 ; " << "Cut at step4 + && nbjets_CSVL >= 1" << endl; fout << "===================================================================================" << endl; fout << "Step0 = " << step0 << endl; fout << "Step1 = " << step1 << endl; fout << "Step2 = " << step2 << endl; fout << "Step3 = " << step3 << endl; fout << "Step4 = " << step4 << endl; fout << "Step5 = " << step5 << endl; fout << "===================================================================================" << endl; fout << "" << endl; fout << "" << endl; if (scan==true) { const string tmpFileName = decay+"_"+sample+"_tmp.txt"; ((TTreePlayer*)(tree->GetPlayer()))->SetScanRedirect(true); ((TTreePlayer*)(tree->GetPlayer()))->SetScanFileName(tmpFileName.c_str()); tree->Scan("RUN:LUMI:EVENT:ZMass:@jetspt30.size():MET:pt1:pt2",cut1); ((TTreePlayer*)(tree->GetPlayer()))->SetScanRedirect(false); } fout.close(); }
void UnitTestAliTPCcalibAlignStreamer(const char *fname="/hera/alice/local/benchmark/vAN-20140518/000128503/cpass1/CalibObjects.root"){ // // test streamer of the AliTPCcalibAlign::Streamer // 0.) Read old data part // 1.) Fill part // 2.) Write part // 3.) Read back - consistency check // 4.) Destructor check // 5.) Memory usage print // AliLog::SetClassDebugLevel("AliTPCcalibAlign",1); AliTPCcalibAlign * align=0; Int_t nPoints=1000000; // // 0.) Read old data part // TFile *fin= TFile::Open(fname); if (fin){ AliSysInfo::AddStamp("LoadFile"); align = (AliTPCcalibAlign * )fin->Get("TPCAlign/alignTPC"); AliSysInfo::AddStamp("LoadAlign"); fin->Close(); delete fin; if (align->GetClusterDelta(0)==NULL){ ::Error("UnitTestAliTPCcalibAlignStreamer","Not back compatible class- GetClusterDelta"); align->MakeResidualHistos(); } if (align->GetTrackletDelta(0)==NULL){ ::Error("UnitTestAliTPCcalibAlignStreamer","Not back compatible class- GetTrackletDelta"); align->MakeResidualHistosTracklet(); } }else{ } // // 1.) Fill part test // for (Int_t ipoint=0; ipoint<nPoints; ipoint++){ Double_t xxx[10]={0}; for (Int_t ihis=0; ihis<2; ihis++){ THn* his = align->GetClusterDelta(ihis); for (Int_t iaxis=0; iaxis<his->GetNdimensions(); iaxis++) { xxx[iaxis]=his->GetAxis(iaxis)->GetXmin()+gRandom->Rndm()*(his->GetAxis(iaxis)->GetXmax()-his->GetAxis(iaxis)->GetXmin()); } his->Fill(xxx); } for (Int_t ihis=0; ihis<4; ihis++){ THnSparse* his = align->GetTrackletDelta(ihis); for (Int_t iaxis=0; iaxis<his->GetNdimensions(); iaxis++) { xxx[iaxis]=his->GetAxis(iaxis)->GetXmin()+gRandom->Rndm()*(his->GetAxis(iaxis)->GetXmax()-his->GetAxis(iaxis)->GetXmin()); } his->Fill(xxx); } } AliSysInfo::AddStamp("FillTrees"); // // 2.) Write part // TFile * fout=new TFile("testAliTPCcalibAlignStreamer.root","recreate"); AliSysInfo::AddStamp("WriteAlignStart"); align->Write("alignTPC"); AliSysInfo::AddStamp("WriteAlignEnd"); fout->ls(); fout->Close(); delete fout; // // 3.) Read back - consistency check // fin=new TFile("testAliTPCcalibAlignStreamer.root"); AliTPCcalibAlign * align2 = (AliTPCcalibAlign *)fin->Get("alignTPC"); AliSysInfo::AddStamp("ReadAlign2"); if (align2==NULL){ ::Fatal("UnitTestAliTPCcalibAlignStreamer","Alignemnt not read"); }else{ ::Info("UnitTestAliTPCcalibAlignStreamer","Alignemnt read-OK"); } if (align2->GetClusterDelta(0)==NULL){ ::Fatal("UnitTestAliTPCcalibAlignStreamer","histogram GetClusterDelta(0) not read"); }else{ ::Info("UnitTestAliTPCcalibAlignStreamer","histogram read GetClusterDelta(0) -OK"); } if (align2->GetTrackletDelta(0)==NULL){ ::Fatal("UnitTestAliTPCcalibAlignStreamer","histogram GetTrackletDelta(0)not read"); }else{ ::Info("UnitTestAliTPCcalibAlignStreamer","histogram read GetTrackletDelta(0) -OK"); } if (align2->GetClusterDelta(0)->GetEntries()!=align->GetClusterDelta(0)->GetEntries()){ ::Fatal("UnitTestAliTPCcalibAlignStreamer","histogram with different entries"); }else{ ::Info("UnitTestAliTPCcalibAlignStreamer","histogram cont. GettrackletDelta(0) -OK"); } if (align2->GetTrackletDelta(0)->GetEntries()!=align->GetTrackletDelta(0)->GetEntries()){ ::Fatal("UnitTestAliTPCcalibAlignStreamer","histogram with different entries"); } // // 4.) Destructor check // delete align2; AliSysInfo::AddStamp("deleteAlign2"); delete align; AliSysInfo::AddStamp("deleteAlign"); // // 5.) Memory usage print // TTree * treeSys =AliSysInfo::MakeTree("syswatch.log"); treeSys->Scan("sname:deltaVM:VM:pI.fMemResident","","colsize=30:15:15:20"); }
int main( int argc, char* argv[] ) { ParseCommandLine(argc, argv); ifstream file(geometry_filepath.c_str(), ios::in); if (!file.is_open()) { throw "Couldn't open geometry file!"; } Geometry geom(file); TFile input_file(input_filepath.c_str()); TTree *info = (TTree*)input_file.FindObjectAny("info"); TTree *events = (TTree*)input_file.FindObjectAny("events"); TTree *cycle_efficiency = (TTree*)input_file.FindObjectAny("cycle_efficiency"); // Now check that all branches in all tress have the same count of entries Long_t prev_entries; bool first = true; bool result = true; result &= is_same_size_tree(events, &prev_entries, &first); result &= is_same_size_tree(cycle_efficiency, &prev_entries, &first); if (!result) { throw "Unbalanced input tree"; } if (!info) { throw "Missing info tree!"; } info->Scan("key:value", "", "colsize=30"); map<string, string> info_hash = get_info_hash(info); string file_commit_id = info_hash["GIT_COMMIT_ID"]; if (file_commit_id != GIT_COMMIT_ID) { cerr << endl << "Warning: Commit id mismatch" << endl << "File created by: " << file_commit_id << endl << "Current software is: " << GIT_COMMIT_ID << endl; } string original_filename = gSystem->BaseName(info_hash["INPUT_FILE"].c_str()); cerr << "original_filename\t" << original_filename << endl; try { TFile output_file(output_filepath.c_str(), "RECREATE"); TTree *events_new; TTree *efficiency_tree; TTree *info_new = info->CloneTree(); add_info_value(info_new, "PROCESS_GIT_COMMIT_ID", GIT_COMMIT_ID); intersection_set_t s; events_new = Process(events, cycle_efficiency, geom, central_momentum, &s); efficiency_tree = Process2ndPass(events_new); // Now check that all branches in all tress have the same count of entries Long_t prev_entries; bool first = true; bool result = true; result &= is_same_size_tree(events_new, &prev_entries, &first); result &= is_same_size_tree(efficiency_tree, &prev_entries, &first); if (!result) { throw "Unbalanced output tree"; } output_file.Write(); } catch(const char *e) { cerr << "Exception: " << e << endl; cerr << "Removing output file \"" << output_filepath << "\"." << endl; gSystem->Unlink(output_filepath.c_str()); return EXIT_FAILURE; } return 0; }