GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Analysis » How to remove a candidate
Re: How to remove a candidate [message #14552 is a reply to message #14551] Thu, 28 March 2013 12:03 Go to previous messageGo to previous message
donghee is currently offline  donghee
Messages: 385
Registered: January 2009
Location: Germnay
first-grade participant
From: *dip.t-dialin.net
Dear PANDAroot users,

I would like to confirm Klaus's suggestion and report to get better understanding of our example code in analysis macro directory (macro/run/tdrct/).

I have tested a function, which will remove low energetic photon in the "Neutral candidate" by EMC energy cut as an example.
This function has a bug as people mentioned because it does not look all contents inside the candidate list,
they stop before arriving end of list due to wrong count in the part of "ii=l-n_removed".
So simpy you could not reach to the end of list because will skip last part according to reduced counts during remove process.

Quote:


------------------------------------------------------------------------ --------------------------------------

//this method is wrong!!!
int n_removed=0; int ii=0;
for (l=0;l<neutral2.GetLength();++l) {
ii=l-n_removed;
if(neutral2[ii].GetMicroCandidate().GetEmcRawEnergy() < 0.01 ){
neutral2.Remove(neutral2[ii]);
n_removed++;
}
}
------------------------------------------------------------------------ --------------------------------------



So change the length as total = neutral2.Getlength(), works fine.
Quote:


------------------------------------------------------------------------ --------------------------------------

//this method works
int total = neutral2.Getlength();
int n_removed=0; int ii=0;
for (l=0;l<total;++l) {
ii=l-n_removed;
if(neutral2[ii].GetMicroCandidate().GetEmcRawEnergy() < 0.01 ){
neutral2.Remove(neutral2[ii]);
n_removed++;
}
}
------------------------------------------------------------------------ --------------------------------------



In order to correct example macros in tutorials/feb12/,
one should alterantively change from [ii] to [ii--] and here you don't need to use n_removed++ any more.
This function will check all contents in the list and reach end of the list as we want.
Quote:


------------------------------------------------------------------------ --------------------------------------

//this method is correct!!!
for (ii=0;ii<neutral3.GetLength();++ii) {
if(neutral3[ii].GetMicroCandidate().GetEmcRawEnergy() < 0.01 ){
neutral3.Remove(neutral3[ii--]);

}
}

------------------------------------------------------------------------ --------------------------------------



Many of analyzer looks and use our example macros without any doubt at the beginnig.
I think that some example codes must to be fixed at least in the pandaroot/macro/


Best wishes,


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: analysis performance and PID criteria
Next Topic: Problem with 4C-fit
Goto Forum:
  


Current Time: Fri Apr 19 08:13:41 CEST 2024

Total time taken to generate the page: 0.00973 seconds