]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliStack.cxx
Restored functionality
[u/mrichter/AliRoot.git] / STEER / AliStack.cxx
index d6e4f9a0b0a317b9cc770bdcc51a5c4a2214e02b..b426c77cd985caf62abb00720cd3b34802e70500 100644 (file)
@@ -292,7 +292,7 @@ TParticle*  AliStack::PopPrimaryForTracking(Int_t i)
 }      
 
 //_____________________________________________________________________________
-void AliStack::PurifyKine()
+Bool_t AliStack::PurifyKine()
 {
   //
   // Compress kinematic tree keeping only flagged particles
@@ -300,13 +300,13 @@ void AliStack::PurifyKine()
   //
 
   TObjArray &particles = *fParticleMap;
-  int nkeep=fHgwmk+1, parent, i;
+  int nkeep = fHgwmk + 1, parent, i;
   TParticle *part, *father;
   fTrackLabelMap.Set(particles.GetLast()+1);
 
   // Save in Header total number of tracks before compression
   // If no tracks generated return now
-  if(fHgwmk+1 == fNtrack) return;
+  if(fHgwmk+1 == fNtrack) return kFALSE;
 
   // First pass, invalid Daughter information
   for(i=0; i<fNtrack; i++) {
@@ -333,19 +333,16 @@ void AliStack::PurifyKine()
   // Second pass, build map between old and new numbering
   for(i=fHgwmk+1; i<fNtrack; i++) {
       if(particles.At(i)->TestBit(kKeepBit)) {
-         
          // This particle has to be kept
          fTrackLabelMap[i]=nkeep;
          // If old and new are different, have to move the pointer
          if(i!=nkeep) particles[nkeep]=particles.At(i);
          part = dynamic_cast<TParticle*>(particles.At(nkeep));
-         
          // as the parent is always *before*, it must be already
          // in place. This is what we are checking anyway!
          if((parent=part->GetFirstMother())>fHgwmk) 
              if(fTrackLabelMap[parent]==-99) Fatal("PurifyKine","fTrackLabelMap[%d] = -99!\n",parent);
              else part->SetFirstMother(fTrackLabelMap[parent]);
-         
          nkeep++;
       }
   }
@@ -378,25 +375,26 @@ void AliStack::PurifyKine()
       particles[i]=fParticleBuffer=0;
   }
   
-  for (i=nkeep; i<fNtrack; ++i) particles[i]=0;
+  for (i = nkeep; i < fNtrack; ++i) particles[i]=0;
   
   Int_t toshrink = fNtrack-fHgwmk-1;
   fLoadPoint-=toshrink;
   
-  
   for(i=fLoadPoint; i<fLoadPoint+toshrink; ++i) fParticles->RemoveAt(i);
   fNtrack=nkeep;
   fHgwmk=nkeep-1;
+  return kTRUE;
 }
 
-void AliStack::ReorderKine()
+
+Bool_t AliStack::ReorderKine()
 {
 //
 // In some transport code children might not come in a continuous sequence.
 // In this case the stack  has  to  be reordered in order to establish the 
 // mother daughter relation using index ranges.
 //    
-  if(fHgwmk+1 == fNtrack) return;
+  if(fHgwmk+1 == fNtrack) return kFALSE;
 
   //
   // Howmany secondaries have been produced ?
@@ -423,7 +421,7 @@ void AliStack::ReorderKine()
       //
       // Reset  LoadPoint 
       // 
-      fLoadPoint = fHgwmk + 1;
+      Int_t loadPoint = fHgwmk + 1;
       //
       // Re-Push particles into stack 
       // The outer loop is over parents, the inner over children.
@@ -457,18 +455,18 @@ void AliStack::ReorderKine()
              Int_t jpa = tmp[j]->GetFirstMother();
               // Check if daughter of current parent
              if (jpa == ipa) {
-                 particles[fLoadPoint] = tmp[j];
+                 particles[loadPoint] = tmp[j];
                  // Re-establish daughter information
-                 parP->SetLastDaughter(fLoadPoint);
-                 if (parP->GetFirstDaughter() == -1) parP->SetFirstDaughter(fLoadPoint);
+                 parP->SetLastDaughter(loadPoint);
+                 if (parP->GetFirstDaughter() == -1) parP->SetFirstDaughter(loadPoint);
                  // Set Mother information
                  if (i != -1) {
                      tmp[j]->SetFirstMother(map1[i]);
                  } 
                  // Build the map
-                 map1[j] = fLoadPoint;
+                 map1[j] = loadPoint;
                  // Increase load point
-                 fLoadPoint++;
+                 loadPoint++;
              }
          } // children
       } // parents
@@ -487,6 +485,8 @@ void AliStack::ReorderKine()
          }
       }
   } // new particles poduced
+  
+  return kTRUE;
 }
 
 Bool_t AliStack::KeepPhysics(TParticle* part)
@@ -620,7 +620,7 @@ void  AliStack::Reset(Int_t size)
   //
 
   Clean(size);
-  
+  delete fParticleBuffer; fParticleBuffer = 0;
   fTreeK = 0x0;
 }