Hello,
I am reading a root tree. I want to do
only when a criteria is satisfied (in my case if 2 electrons are found)
To check if doing GetEntry twice doesn’t create any problem, I do the following
in the code:
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
cout<<"==============NEW============="<<endl;
cout<<"jentry "<<jentry<<endl;
b_patelesize->GetEntry(jentry);
cout<<"patelesize "<<patelesize<<endl;
nb = fChain->GetEntry(jentry); nbytes += nb;
cout<<"after second round patelesize "<<patelesize<<endl;
For some events I do not find any problem. But for the events listed below I find this problem:
==============NEW=============
jentry 39380
patelesize 0
after second round patelesize 1
==============NEW=============
jentry 39381
patelesize 1
after second round patelesize 0
==============NEW=============
jentry 39382
patelesize 0
after second round patelesize 1
==============NEW=============
jentry 39383
patelesize 1
after second round patelesize 0
==============NEW=============
jentry 39384
patelesize 0
after second round patelesize 0
==============NEW=============
jentry 39385
patelesize 0
after second round patelesize 1
==============NEW=============
So number of electrons before fChain->GetEntry() and number of electrons
after doing if are different.
Is doing this way in the code not advisable?
If not then is there any other way of achieving the same?
Thanks & Regards,
Shilpi