I see that there is a missing function in TEntryList to loop the way you
intend to do it.
So,instead of:
CollectionTree->Draw(">>seltrackevents",cut,"entrylist");
TEntryList *seltrackevents =
(TEntryList*)gDirectory->Get("seltrackevents");
Int_t jj = -1;
seltrackevents->GetEntry(0);
do {
jj = seltrackevents->Next();
cout << "jj = " << jj << endl;
CollectionTree->GetEntry(jj);
//
.....
.......
} while(jj != -1);
I suggest to do:
CollectionTree->Draw(">>seltrackevents",cut);
TEventList *seltrackevents =
(TEventList*)gDirectory->Get("seltrackevents");
int nentries = seltrackevents->GetN(); for (int jj = 0;jj<nentries;jj++) {
Long64_t entry = seltrackevents->GetEntry(jj); cout << "jj = " << jj <<" entry= " <<entry << endl; CollectionTree->GetEntry(entry); // ..... .......
Rene Brun
Hovhannes Khandanyan wrote:
> > Dear ROOTers, > > I have a chain of ROOT trees: > > TChain* CollectionTree = new TChain("CollectionTree"); > CollectionTree->Add("many files *.root"); > > for which I create an entrylist > > CollectionTree->Draw(">>seltrackevents",cut,"entrylist"); > TEntryList *seltrackevents = > (TEntryList*)gDirectory->Get("seltrackevents"); > > Then I try to look through my entrylist in the following way: > > Int_t jj = -1; > seltrackevents->GetEntry(0); > do { > > jj = seltrackevents->Next(); > cout << "jj = " << jj << endl; > > CollectionTree->GetEntry(jj); > // > ..... > ....... > > } while(jj != -1); > > This works correctly only for the 1st file of the chain, since jj is > always the event number within the given file 'local event number' as > opposed 'global event number' for the whole chain. Please let me know > what I should use instead/on top of jj = seltrackevents->Next(); to > make sure that I get the event from the correct chain file. > > Thanks for any help, > Hovhannes >Received on Wed Jun 23 2010 - 10:28:44 CEST
This archive was generated by hypermail 2.2.0 : Wed Jun 23 2010 - 11:50:01 CEST