//
// Load a track on the stack
//
- // done 0 if the track has to be transported
- // 1 if not
+ // done 1 if the track has to be transported
+ // 0 if not
// parent identifier of the parent track. -1 for a primary
// pdg particle code
// pmom momentum GeV/c
//
// Load a track on the stack
//
- // done 0 if the track has to be transported
- // 1 if not
+ // done 1 if the track has to be transported
+ // 0 if not
// parent identifier of the parent track. -1 for a primary
// pdg particle code
// kS generation status code
particle->SetWeight(weight);
particle->SetUniqueID(mech);
- if(!done) particle->SetBit(kDoneBit);
+
+
+ if(!done) {
+ particle->SetBit(kDoneBit);
+ } else {
+ particle->SetBit(kTransportBit);
+ }
+
+
// Declare that the daughter information is valid
particle->SetBit(kDaughtersBit);
}
//_____________________________________________________________________________
-void AliStack::PurifyKine()
+Bool_t AliStack::PurifyKine()
{
//
// Compress kinematic tree keeping only flagged particles
//
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++) {
// 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++;
}
}
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 ?
//
// 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.
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
}
}
} // new particles poduced
+
+ return kTRUE;
}
Bool_t AliStack::KeepPhysics(TParticle* part)
//
Clean(size);
-
+ delete fParticleBuffer; fParticleBuffer = 0;
fTreeK = 0x0;
}
//
// Particle produced during transport
//
-// Check if this is a heavy flavor decay product
+
Int_t imo = p->GetFirstMother();
TParticle* pm = Particle(imo);
Int_t mpdg = TMath::Abs(pm->GetPdgCode());
+// Check if it comes from a pi0 decay
+//
+// What about the pi0 Dalitz ??
+// if ((mpdg == kPi0) && (imo < GetNprimary())) return kTRUE;
+
+// Check if this is a heavy flavor decay product
Int_t mfl = Int_t (mpdg / TMath::Power(10, Int_t(TMath::Log10(mpdg))));
//
// Light hadron
// To be sure that heavy flavor has not been produced in a secondary interaction
// Loop back to the generated mother
while (imo >= GetNprimary()) {
- imo = p->GetFirstMother();
+ imo = pm->GetFirstMother();
pm = Particle(imo);
}
mpdg = TMath::Abs(pm->GetPdgCode());
}
} // produced by generator ?
}
-