{ gROOT->Reset(); gStyle->SetPalette(1); ifstream infile; infile.open("/home/nppatt/bin/files.dat"); if (!infile) { cout << "Can't load files" << endl; } Int_t i; i=1; char filename[100]; char name[100]; UShort_t channel19; TCanvas c1("CHIO:TTRI_PL"); TCanvas c2("NAI19"); TH1F *na19 = new TH1F("na19","Na19",16000,0,16000); while (!infile.eof()) { infile.getline(filename,100); if (filename[0] == '*') { cout << "Break" << endl; break; } else { cout << filename << endl; TFile* f = new TFile(filename); TTree* tt = (TTree*) f->Get("AutoTree"); tt->SetBranchAddress("NAI_19_E",&channel19); cout << tt << endl; sprintf(name,"Mg%d",i); cout << name << endl; c1.cd(); // tt.Draw("CHIO:TTRI_PL>>hsqrt(1000,6000,7200,1000,1500,10000)","","colz"); tt.Draw("CHIO:TTRI_PL>>hsqrt(500,0,10000,500,0,9000)","","colz"); c1.WaitPrimitive(name,"CutG"); tt->Draw(">> list",name); TEventList* list = (TEventList*) gDirectory->Get("list"); tt->SetEventList(list); Int_t nentry = list->GetN(); cout << nentry << endl; for (Int_t j=0;jGetEntry(list->GetEntry(j)); na19->Fill(channel19); } f.Close(); c2.cd(); na19.Draw(); i++; } } }