/* The purpose of this script is to * add analysed root files. The best way * is to split a single run into several * parts (each part contains several segments */ #include #include using namespace std; #include "TH1.h" #include "TH2.h" #include "TList.h" #include "TFile.h" void AddRootFiles(TChain *chain, string fileNameIn) { ///////////////////////////////////////////// // // change locations of analyzed files here!!! // ///////////////////////////////////////////// string dir = "/scratch4/yxiao/rootanalysis/analysis/"; string fileName = Form("%s_DD.root", fileNameIn.c_str()); // check if the file exists std::ifstream infile(Form("%s%s", dir.c_str(), fileName.c_str() ) ); if(!infile.good()) { cout << ":(((((( CANNOT FIND FILE: " << (dir+fileName).c_str() << endl; } else { chain->AddFile((dir+fileName).c_str()); cout << "File " << (dir+fileName).c_str() << " loaded!" << endl; } }