void analysis(){ // this is to extract the .root files and store them into a vector std::vector files; string str1 = "7_"; string str1a = "7_0"; string str2 = "mm.root"; for(int i = 4; i< 37; i++){ string s = to_string(i); string filename; if (i<10){ filename = str1a + s + str2; } else{ filename =str1 + s + str2; } files.push_back(filename); } // read the TTree named "tree" in all root files TChain *ch1 = new TChain("tree"); // Add them into the TChain for (int k = 0 ; k< files.size(); k++){ ch1->Add(files[k].c_str()); } int entries = ch1->GetEntries(); cout << entries << endl; // Set the address ch1->SetBranchAddress("signal",signal); // loop over all the root files //for (int i = 0 ; i< entries ; i++){ // ch->GetEntry(i); //} }