GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Analysis » How to remove a candidate
Re: How to remove a candidate [message #14551 is a reply to message #14550] Wed, 27 March 2013 18:02 Go to previous messageGo to previous message
Klaus Götzen is currently offline  Klaus Götzen
Messages: 293
Registered: June 2006
Location: GSI
first-grade participant
From: *adsl.alicedsl.de
Hi Stefano,


your concern ist correct. The removal process will be bugged. Let me point you to a forum message I wrote some time ago exactly concerning that topic

https://forum.gsi.de/index.php?t=tree&th=3737

To do it correctly you can either store the length of the list beforehand like

  Int_t n=l.GetLength();
  for (l=0; l<n; ++l)  
  {
    i = l-n_removed;
    if( ... Some criterion ...)
    {
      list.Remove( list[i] );
      n_removed++;
    }
  }


or (suggested by Radek) loop reversely through the list with

  for (ii=l.GetLength()-1 ; ii>=0; --ii)


Or, as you mention, fill a new empty list with the non-removed candidates.


Best,
Klaus
 
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: Mon Dec 02 21:55:19 CET 2024

Total time taken to generate the page: 0.00643 seconds