Hi,
I am trying to use TEventList into a class that deals with TTree. The class is instenciated for each TTree/sample that I used. The event list name have a different name for each sample.
The event list works well if I process each sample one after another, but if I first load them all then go and process them, it doesn’t pick the event list for the current sample, but from the last one.
Any idea what I am missing, that would allow me to first load each sample then process them.
Below is some snippets of the code & two examples.
In the 1st one when only 1 sample is loaded, the evt list get 4004 events, while in the 2nd when 2 samples are loaded, the sample event list gets 0 entries.
Thanks in advance,
Anyes
In the class used to load& process each samples:
.hh
.cc
char l1[200];
sprintf(l1,"elist_%s",sSample);
elist = new TEventList(l1);
printf("Creating EventList "); elist->Print();
//__________________________________________________________________________________
void XsClass::selEvt(TCut cut){
//-----------------------------------------------------------
// eventList name needs to be unique since this class is to be
// used working with few ntuples at the same time
//-----------------------------------------------------------
char l1[200];
ntup->SetEventList(0); //reset event list
sprintf(l1,">>elist_%s",sSample);
printf("===> Selecting events in %s passing ",l1);
cut.Print();
ntup->Draw(l1,cut,"GOFF");
printf("Directory listing \n");
gDirectory->ls("*elist*");
nEntriesSel = elist->GetN();
std::cout << "List #entries="<< nEntriesSel <<std>SetEventList(elist);
}
Example loading 1 ntuples & making an event list:
-----------------------------------------------------
LOADING ttopvl
--> Looking for dataset ttopvl in /data/uiuc08/b/anyes/TopAna1fb/TopAnaSLT/scripts/inputs/dataset_V533.txt
sample description !mc gen TL mass runlow runhigh alpgenV nSec
ttopvl ttbar_P_175 11 0 0 1 0 -1 175
-----------------------------------------------------
==> Attaching to file names
Running over the whole run range
MC sample, alpgen Version 0
==> Loading up big Toy ntuples
Loading mistags histograms from ttopvl-sec01_XsToy_big.root Add ttopvl-sec01_XsToy_big.root MC 1 Entries 120136
Loading mistags histograms from ttopvl-sec02_XsToy_big.root Add ttopvl-sec02_XsToy_big.root MC 1 Entries 240272
Loading mistags histograms from ttopvl-sec03_XsToy_big.root Add ttopvl-sec03_XsToy_big.root MC 1 Entries 367086
Loading mistags histograms from ttopvl-sec04_XsToy_big.root Add ttopvl-sec04_XsToy_big.root MC 1 Entries 486593
Loading mistags histograms from ttopvl-sec05_XsToy_big.root Add ttopvl-sec05_XsToy_big.root MC 1 Entries 614627
Loading mistags histograms from ttopvl-sec06_XsToy_big.root Add ttopvl-sec06_XsToy_big.root MC 1 Entries 738421
Loading mistags histograms from ttopvl-sec07_XsToy_big.root Add ttopvl-sec07_XsToy_big.root MC 1 Entries 856410
Loading mistags histograms from ttopvl-sec08_XsToy_big.root Add ttopvl-sec08_XsToy_big.root MC 1 Entries 981779
Loading mistags histograms from ttopvl-sec09_XsToy_big.root Add ttopvl-sec09_XsToy_big.root MC 1 Entries 1108772
Loading mistags histograms from ttopvl-sec10_XsToy_big.root Add ttopvl-sec10_XsToy_big.root MC 1 Entries 1230780
Loading mistags histograms from ttopvl-sec11_XsToy_big.root Add ttopvl-sec11_XsToy_big.root MC 1 Entries 1268817
Creating EventList EventList:elist_ttopvl/, number of entries =0, size=100
New xsHisto for sample ttopvl
-----------------------------------------------------
-----------------------------------------------------
==> Attaching to file names
Sample Name ttopvl
ttbar
==> ttbar 1 jet
===> Selecting events in >>elist_ttopvl passing OBJ: TCut CUT (((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscemtrig && evt.iscemgeom))&&(evt.iscemid))&&(evt.passmet))&&(evt.iscemiso))&&(!evt.isdilep))&&(!evt.isZ))&&(evt.iscemconv))&&(evt.iscemdz))&&(!evt.isdiele))&&(evt->isslttagg))||(((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscmuptrig && evt.iscmupgeom))&&(evt.iscmupid))&&(evt.passmet))&&(evt.iscmupiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmupcosmic))&&(evt.iscmupdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))||((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.run>=150145))&&(evt.iscmxtrig && evt.iscmxgeom))&&(evt.iscmxid))&&(evt.passmet))&&(evt.iscmxiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmxcosmic))&&(evt.iscmxdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))&&(evt.ntj==1)
Directory listing
TNetFile** root://fcdfdata050.fnal.gov//cdf/scratch/cdfdata/scratch/SLT/TopAna/pass05/ttopvl-sec11_XsToy_big.root test file
TNetFile* root://fcdfdata050.fnal.gov//cdf/scratch/cdfdata/scratch/SLT/TopAna/pass05/ttopvl-sec11_XsToy_big.root test file
OBJ: TEventList elist_ttopvl (((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscemtrig && evt.iscemgeom))&&(evt.iscemid))&&(evt.passmet))&&(evt.iscemiso))&&(!evt.isdilep))&&(!evt.isZ))&&(evt.iscemconv))&&(evt.iscemdz))&&(!evt.isdiele))&&(evt->isslttagg))||(((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscmuptrig && evt.iscmupgeom))&&(evt.iscmupid))&&(evt.passmet))&&(evt.iscmupiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmupcosmic))&&(evt.iscmupdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))||((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.run>=150145))&&(evt.iscmxtrig && evt.iscmxgeom))&&(evt.iscmxid))&&(evt.passmet))&&(evt.iscmxiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmxcosmic))&&(evt.iscmxdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))&&(evt.ntj==1) : 0 at: 0xb80b4e8
List #entries=4004
Example loading 2 samples then making the event list for the 1st one:
-----------------------------------------------------
LOADING ttopvl
--> Looking for dataset ttopvl in /data/uiuc08/b/anyes/TopAna1fb/TopAnaSLT/scripts/inputs/dataset_V533.txt
sample description !mc gen TL mass runlow runhigh alpgenV nSec
ttopvl ttbar_P_175 11 0 0 1 0 -1 175
-----------------------------------------------------
==> Attaching to file names
Running over the whole run range
MC sample, alpgen Version 0
==> Loading up big Toy ntuples
Loading mistags histograms from ttopvl-sec01_XsToy_big.root Add ttopvl-sec01_XsToy_big.root MC 1 Entries 120136
Loading mistags histograms from ttopvl-sec02_XsToy_big.root Add ttopvl-sec02_XsToy_big.root MC 1 Entries 240272
Loading mistags histograms from ttopvl-sec03_XsToy_big.root Add ttopvl-sec03_XsToy_big.root MC 1 Entries 367086
Loading mistags histograms from ttopvl-sec04_XsToy_big.root Add ttopvl-sec04_XsToy_big.root MC 1 Entries 486593
Loading mistags histograms from ttopvl-sec05_XsToy_big.root Add ttopvl-sec05_XsToy_big.root MC 1 Entries 614627
Loading mistags histograms from ttopvl-sec06_XsToy_big.root Add ttopvl-sec06_XsToy_big.root MC 1 Entries 738421
Loading mistags histograms from ttopvl-sec07_XsToy_big.root Add ttopvl-sec07_XsToy_big.root MC 1 Entries 856410
Loading mistags histograms from ttopvl-sec08_XsToy_big.root Add ttopvl-sec08_XsToy_big.root MC 1 Entries 981779
Loading mistags histograms from ttopvl-sec09_XsToy_big.root Add ttopvl-sec09_XsToy_big.root MC 1 Entries 1108772
Loading mistags histograms from ttopvl-sec10_XsToy_big.root Add ttopvl-sec10_XsToy_big.root MC 1 Entries 1230780
Loading mistags histograms from ttopvl-sec11_XsToy_big.root Add ttopvl-sec11_XsToy_big.root MC 1 Entries 1268817
Creating EventList EventList:elist_ttopvl/, number of entries =0, size=100
New xsHisto for sample ttopvl
-----------------------------------------------------
-----------------------------------------------------
==> Attaching to file names
Sample Name ttopvl
Reading ntuples from root://fcdfdata050.fnal.gov//cdf/scratch/cdfdata/scratch/SLT/TopAna/pass05
LOADING V533 from 48 to 48
-----------------------------------------------------
-----------------------------------------------------
LOADING ltop0n
--> Looking for dataset ltop0n in /data/uiuc08/b/anyes/TopAna1fb/TopAnaSLT/scripts/inputs/dataset_V533.txt
sample description !mc gen TL mass runlow runhigh alpgenV nSec
ltop0n Wev0p_V13 5 0 0 2 13 -1 0
-----------------------------------------------------
==> Attaching to file names
Running over the whole run range
MC sample, alpgen Version 13
==> Loading up big Toy ntuples
Loading mistags histograms from ltop0n-sec01_XsToy_big.root Add ltop0n-sec01_XsToy_big.root MC 1 Entries 68865
Loading mistags histograms from ltop0n-sec02_XsToy_big.root Add ltop0n-sec02_XsToy_big.root MC 1 Entries 137681
Loading mistags histograms from ltop0n-sec03_XsToy_big.root Add ltop0n-sec03_XsToy_big.root MC 1 Entries 209820
Loading mistags histograms from ltop0n-sec04_XsToy_big.root Add ltop0n-sec04_XsToy_big.root MC 1 Entries 279949
Loading mistags histograms from ltop0n-sec05_XsToy_big.root Add ltop0n-sec05_XsToy_big.root MC 1 Entries 317252
Creating EventList EventList:elist_ltop0n/, number of entries =0, size=100
New xsHisto for sample ltop0n
-----------------------------------------------------
-----------------------------------------------------
==> Attaching to file names
ttbar
==> ttbar 1 jet
===> Selecting events in >>elist_ttopvl passing OBJ: TCut CUT (((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscemtrig && evt.iscemgeom))&&(evt.iscemid))&&(evt.passmet))&&(evt.iscemiso))&&(!evt.isdilep))&&(!evt.isZ))&&(evt.iscemconv))&&(evt.iscemdz))&&(!evt.isdiele))&&(evt->isslttagg))||(((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscmuptrig && evt.iscmupgeom))&&(evt.iscmupid))&&(evt.passmet))&&(evt.iscmupiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmupcosmic))&&(evt.iscmupdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))||((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.run>=150145))&&(evt.iscmxtrig && evt.iscmxgeom))&&(evt.iscmxid))&&(evt.passmet))&&(evt.iscmxiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmxcosmic))&&(evt.iscmxdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))&&(evt.ntj==1)
Directory listing
TNetFile** root://fcdfdata050.fnal.gov//cdf/scratch/cdfdata/scratch/SLT/TopAna/pass05/ltop0n-sec05_XsToy_big.root test file
TNetFile* root://fcdfdata050.fnal.gov//cdf/scratch/cdfdata/scratch/SLT/TopAna/pass05/ltop0n-sec05_XsToy_big.root test file
OBJ: TEventList elist_ltop0n : 0 at: 0xde8eb38
OBJ: TEventList elist_ttopvl (((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscemtrig && evt.iscemgeom))&&(evt.iscemid))&&(evt.passmet))&&(evt.iscemiso))&&(!evt.isdilep))&&(!evt.isZ))&&(evt.iscemconv))&&(evt.iscemdz))&&(!evt.isdiele))&&(evt->isslttagg))||(((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.iscmuptrig && evt.iscmupgeom))&&(evt.iscmupid))&&(evt.passmet))&&(evt.iscmupiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmupcosmic))&&(evt.iscmupdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))||((((((((((((evt.isgoodrunsi && evt.iswinterreg)&&(evt.run>=150145))&&(evt.iscmxtrig && evt.iscmxgeom))&&(evt.iscmxid))&&(evt.passmet))&&(evt.iscmxiso))&&(!evt.isdilep))&&(!evt.isZ))&&(!evt.iscmxcosmic))&&(evt.iscmxdz))&&(!(evt.isdimuo||evt.isdimuo2)))&&(evt->isslttagg)))&&(evt.ntj==1) : 0 at: 0xb2681a0
List #entries=0