GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Analysis » How to remove a candidate
How to remove a candidate [message #14550] Wed, 27 March 2013 17:38 Go to previous message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
Dear analysis experts,
if I check the macros in tutorials/feb12 I can see that in order to remove a candidate from a list, it is suggested to use something like:

	for (int ii=0;ii<l.GetLength();++ii)
	{
		if (!mcm.MctMatch(l[ii],mct))
		{
			l.Remove(l[ii]);
			removed++;
		}
	}


You remove the ii element.

But if I check the old macro/run/tdrct/ macros, in the analysis it is used the following:

    int n_removed=0;
    int ii=0;    
    for (Int_t l=0;l<pp.GetLength();l++){
      ii=l-n_removed;
      if((pp[ii].GetMicroCandidate()->GetSttHits())==0){
	pp.Remove(pp[ii]);
        n_removed++;
      }
    }


Here you remove the ii=l-n_removed element.

It is not clear to me which is the correct way to remove elements in the candidate list. In particolar, once one element is removed, I would presume that the TCandList has 1 element less and the length decreases. If I remove the element 0, the "old" element 1 will become the new element "0", but in the for the index increases then I will analyse the "new" element 1 (old element 2) forgetting the "old" element 1 which now is 0.

Which is the correct way? or maybe it is better to create a new empty list and to fill it with the relevant candidates?
I am also wodering if the old analyses were bugged or not.

Thanks in advance.
 
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: Sun Mar 24 07:51:21 CET 2019

Total time taken to generate the page: 0.02516 seconds