{ ifstream filelist("filelist.txt"); std::string filename,filename1; TCanvas c1; TFile histofile("track_hists.root","RECREATE"); TH1F* pttr = new TH1F("pttr","Track pT (GeV)",100,8.0,12.0); while(!filelist.eof()) { filelist >> filename; filename1= "rfio:/castor/cern.ch/cms" + filename; TFile *f =TFile::Open(filename1.c_str()); TTree *events = (TTree*)f->Get("Events"); events->GetEntry(); std::vector trackCollection; TBranch *branch = events->GetBranch("recoTracks_ctfWithMaterialTracksP5__Rec.obj"); branch->SetAddress(&trackCollection); for( unsigned int index = 0; index < events.GetEntries(); ++index) { branch->GetEntry(index); if(trackCollection.size()>0)std::cout << "Event = " << index << " " << trackCollection.size()<pt() << std::endl; pttr->Fill(track->pt()); } } f->Close(); pttr->Draw(); histofile.Write(); } histofile.Close(); }