void Read_Files() { gROOT->Reset(); gROOT->ProcessLine(".L Track.cxx+"); gROOT->ProcessLine(".L Event.cxx+"); // loop over root files Char_t InputFile[200]; Int_t nFiles = 20; Int_t iEvent_nocut = 0; for(Int_t iFile = 1; iFile<=nFiles; iFile++) { sprintf(InputFile ,"pp_14TeV_%i.root",iFile); TFile *fTreeFile = new TFile(InputFile); TTree *treeEvents = (TTree *) fTreeFile->Get("LHC"); Event *event = new Event(); treeEvents->SetBranchAddress("LHC",&event); printf(" Open file \n%s\n",InputFile); for(Int_t iEvent =0; iEvent < treeEvents->GetEntries(); iEvent++) { treeEvents->GetEntry(iEvent); if(!(iEvent_nocut % 100 && (iEvent_nocut))) { printf("Processed Events: %i\n",iEvent_nocut); } iEvent_nocut++; } } printf("---------------------\n"); printf("No. of Events = %f\n",iEvent_nocut); printf("---------------------\n"); }