8 #include "FairDetector.h" 9 #include "FairMCPoint.h" 10 #include "FairRootManager.h" 12 #include "TLorentzVector.h" 13 #include "TClonesArray.h" 14 #include "TParticle.h" 15 #include "TRefArray.h" 29 fParticles(new TClonesArray(
"TParticle", size)),
30 fTracks(new TClonesArray(
"ERMCTrack", size)),
41 fStoreSecondaries(kTRUE),
67 void ERStack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode,
68 Double_t px, Double_t py, Double_t pz,
69 Double_t e, Double_t vx, Double_t vy, Double_t vz,
70 Double_t time, Double_t polx, Double_t poly,
71 Double_t polz, TMCProcess proc, Int_t& ntr,
72 Double_t weight, Int_t is)
75 PushTrack( toBeDone, parentId, pdgCode,
85 void ERStack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode,
86 Double_t px, Double_t py, Double_t pz,
87 Double_t e, Double_t vx, Double_t vy, Double_t vz,
88 Double_t time, Double_t polx, Double_t poly,
89 Double_t polz, TMCProcess proc, Int_t& ntr,
90 Double_t weight, Int_t is,Int_t secondparentID)
100 Int_t daughter1Id = -1;
101 Int_t daughter2Id = -1;
102 TParticle* particle =
103 new(partArray[
fNParticles++]) TParticle(pdgCode, trackId, parentId,
104 nPoints, daughter1Id,
105 daughter2Id, px, py, pz, e,
107 particle->SetPolarisation(polx, poly, polz);
108 particle->SetWeight(weight);
109 particle->SetUniqueID(proc);
140 TParticle* thisParticle =
fStack.top();
143 if ( !thisParticle) {
167 LOG(FATAL) <<
"Primary index out of range! " << iPrim << std::endl;
172 TParticle* part = (TParticle*)
fParticles->At(iPrim);
173 if ( ! (part->GetMother(0) < 0) ) {
174 LOG(FATAL) <<
"Not a primary track! " << iPrim << std::endl;
190 if ( ! currentPart) {
191 LOG(WARNING) <<
"Current track not found in stack!" << std::endl;
204 TParticle* newPart =
new(array[
fIndex]) TParticle(*oldPart);
205 newPart->SetWeight(oldPart->GetWeight());
206 newPart->SetUniqueID(oldPart->GetUniqueID());
230 LOG(FATAL) <<
"Particle " << iPart
231 <<
" not found in storage map!" << std::endl;
233 Bool_t store = (*fStoreIter).second;
270 Int_t iMotherOld = track->GetMotherId();
273 LOG(FATAL) <<
"Particle index " << iMotherOld
274 <<
" not found in dex map! " << std::endl;
280 TIterator* detIter = detList->MakeIterator();
282 FairDetector* det = NULL;
283 while( (det = (FairDetector*)detIter->Next() ) ) {
288 TClonesArray* hitArray;
289 while ( (hitArray = det->GetCollection(iColl++)) ) {
291 Int_t nPoints = hitArray->GetEntriesFast();
294 for (Int_t iPoint=0; iPoint<nPoints; iPoint++) {
295 FairMCPoint* point = (FairMCPoint*)hitArray->At(iPoint);
296 Int_t iTrack = point->GetTrackID();
300 LOG(FATAL) <<
"Particle index " << iTrack
301 <<
" not found in index map! " << std::endl;
303 point->SetTrackID((*fIndexIter).second);
304 point->SetLink(FairLink(
"MCTrack", (*fIndexIter).second));
336 FairRootManager::Instance()->Register(
"MCTrack",
"Stack",
fTracks,kTRUE);
374 if ( iTrack < 0 ) {
return; }
376 pair<Int_t, Int_t> a(iTrack, iDet);
390 if ( currentPart ) {
return currentPart->GetFirstMother(); }
402 LOG(FATAL) <<
"Particle index " << trackID
403 <<
" out of range." << std::endl;
424 Bool_t store = kTRUE;
427 Int_t iMother = thisPart->GetMother(0);
429 thisPart->Momentum(p);
430 Double_t energy = p.E();
431 Double_t mass = p.M();
433 Double_t eKin = energy - mass;
434 if(eKin < 0.0) { eKin=0.0; }
446 if (iMother < 0) { store = kTRUE; }
449 if (nPoints < fMinPoints) { store = kFALSE; }
450 if (eKin < fEnergyCut) { store = kFALSE; }
461 while(iMother >= 0) {
std::map< Int_t, Int_t > fIndexMap
void AddPoint(DetectorId iDet)
virtual void Print(Int_t iVerbose=0) const
TClonesArray * fParticles
Int_t fNPrimaries
Index of current track.
std::map< std::pair< Int_t, Int_t >, Int_t > fPointsMap
virtual TParticle * PopNextTrack(Int_t &iTrack)
virtual void AddParticle(TParticle *part)
virtual TParticle * GetCurrentTrack() const
std::map< Int_t, Bool_t > fStoreMap
virtual void UpdateTrackIndex(TRefArray *detArray)
virtual TParticle * PopPrimaryForTracking(Int_t iPrim)
Int_t fIndex
Number of entries in fTracks.
TParticle * GetParticle(Int_t trackId) const
std::stack< TParticle * > fStack
Int_t fNParticles
Number of primary particles.
virtual void FillTrackArray()
virtual Int_t GetCurrentParentTrackNumber() const
void SetMotherId(Int_t id)
Int_t fNTracks
Number of entries in fParticles.