FairShip
Loading...
Searching...
No Matches
ShipStack Class Reference

#include <ShipStack.h>

Inheritance diagram for ShipStack:
[legend]
Collaboration diagram for ShipStack:
[legend]

Classes

struct  SplitInfo

Public Member Functions

 ShipStack (Int_t size=100)
 ~ShipStack () override
void PushTrack (Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is) override
void PushTrack (Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is, Int_t secondParentId) override
TParticle * PopNextTrack (Int_t &iTrack) override
TParticle * PopPrimaryForTracking (Int_t iPrim) override
void SetCurrentTrack (Int_t iTrack) override
Int_t GetNtrack () const override
Int_t GetNprimary () const override
TParticle * GetCurrentTrack () const override
Int_t GetCurrentTrackNumber () const override
Int_t GetCurrentParentTrackNumber () const override
void AddParticle (TParticle *part)
void FillTrackArray () override
void UpdateTrackIndex (TRefArray *detArray=nullptr) override
void Reset () override
void Register () override
virtual void Print (Int_t iVerbose=0) const
void StoreSecondaries (Bool_t choice=kTRUE)
void SetMinPoints (Int_t min)
void SetEnergyCut (Double_t eMin)
void StoreMothers (Bool_t choice=kTRUE)
void SetSplitting ()
void SetSplitSet (Int_t iTrack, Int_t splitSet, Int_t role, Double_t weight)
void AddPoint (DetectorId iDet)
void AddPoint (DetectorId iDet, Int_t iTrack)
TParticle * GetParticle (Int_t trackId) const
TClonesArray * GetListOfParticles () override

Private Member Functions

void SelectTracks ()
 ShipStack (const ShipStack &)=delete
ShipStack & operator= (const ShipStack &)=delete

Private Attributes

std::stack< TParticle * > fStack
TClonesArray * fParticles
std::vector< ShipMCTrack > * fTracks
std::vector< Bool_t > fStoreFlags
std::vector< Int_t > fIndexMap
std::vector< Int_t > fPointsPerTrack
std::vector< SplitInfo > fSplitSets
Int_t fCurrentTrack
Int_t fNPrimaries
 Index of current track.
Int_t fNParticles
 Number of primary particles.
Int_t fNTracks
 Number of entries in fParticles.
Int_t fIndex
 Number of entries in fTracks.
Bool_t fStoreSecondaries
 Used for merging.
Int_t fMinPoints
Double32_t fEnergyCut
Bool_t fStoreMothers
Bool_t fSplitting

Detailed Description

Definition at line 46 of file ShipStack.h.

Constructor & Destructor Documentation

◆ ShipStack() [1/2]

ShipStack::ShipStack ( Int_t size = 100)
explicit

Default constructor param size Estimated track number

Definition at line 31 of file ShipStack.cxx.

32 : FairGenericStack(),
33 fStack(),
34 fParticles(new TClonesArray("TParticle", size)),
35 fTracks(nullptr),
37 fIndexMap(),
39 fCurrentTrack(-1),
40 fNPrimaries(0),
41 fNParticles(0),
42 fNTracks(0),
43 fIndex(0),
44 fStoreSecondaries(kTRUE),
45 fMinPoints(1),
46 fEnergyCut(0.),
47 fStoreMothers(kTRUE),
48 fSplitting(kFALSE) {
49 fTracks = new std::vector<ShipMCTrack>();
50 fTracks->reserve(size);
51}
Int_t fMinPoints
Definition ShipStack.h:222
Bool_t fStoreMothers
Definition ShipStack.h:224
Int_t fNTracks
Number of entries in fParticles.
Definition ShipStack.h:217
Int_t fIndex
Number of entries in fTracks.
Definition ShipStack.h:218
std::vector< Int_t > fPointsPerTrack
Definition ShipStack.h:203
Double32_t fEnergyCut
Definition ShipStack.h:223
std::vector< Bool_t > fStoreFlags
Definition ShipStack.h:197
Bool_t fStoreSecondaries
Used for merging.
Definition ShipStack.h:221
Bool_t fSplitting
Definition ShipStack.h:225
Int_t fNParticles
Number of primary particles.
Definition ShipStack.h:216
std::vector< Int_t > fIndexMap
Definition ShipStack.h:200
Int_t fNPrimaries
Index of current track.
Definition ShipStack.h:215
std::stack< TParticle * > fStack
Definition ShipStack.h:186
TClonesArray * fParticles
Definition ShipStack.h:191
Int_t fCurrentTrack
Definition ShipStack.h:214
std::vector< ShipMCTrack > * fTracks
Definition ShipStack.h:194

◆ ~ShipStack()

ShipStack::~ShipStack ( )
override

Destructor

Definition at line 56 of file ShipStack.cxx.

56 {
57 if (fParticles) {
58 fParticles->Delete();
59 delete fParticles;
60 }
61 if (fTracks) {
62 delete fTracks;
63 }
64}

◆ ShipStack() [2/2]

ShipStack::ShipStack ( const ShipStack & )
privatedelete

Member Function Documentation

◆ AddParticle()

void ShipStack::AddParticle ( TParticle * part)

Add a TParticle to the fParticles array

Definition at line 206 of file ShipStack.cxx.

206 {
207 TClonesArray& array = *fParticles;
208 TParticle* newPart = new (array[fIndex]) TParticle(*oldPart);
209 newPart->SetWeight(oldPart->GetWeight());
210 newPart->SetUniqueID(oldPart->GetUniqueID());
211 fIndex++;
212}

◆ AddPoint() [1/2]

void ShipStack::AddPoint ( DetectorId iDet)

Increment the point total for the current track. The count is per track, aggregated across all detectors; iDet is retained for call-site compatibility but ignored for counting.

Parameters
iDetDetector unique identifier (ignored)

Definition at line 361 of file ShipStack.cxx.

361{ AddPoint(detId, fCurrentTrack); }
void AddPoint(DetectorId iDet)

◆ AddPoint() [2/2]

void ShipStack::AddPoint ( DetectorId iDet,
Int_t iTrack )

Increment the point total for an arbitrary track. The count is per track, aggregated across all detectors; iDet is retained for call-site compatibility but ignored for counting.

Parameters
iDetDetector unique identifier (ignored)
iTrackTrack number

Definition at line 365 of file ShipStack.cxx.

365 {
366 if (iTrack < 0) {
367 return;
368 }
369 if (iTrack >= static_cast<Int_t>(fPointsPerTrack.size())) {
370 fPointsPerTrack.resize(iTrack + 1, 0);
371 }
372 ++fPointsPerTrack[iTrack];
373}

◆ FillTrackArray()

void ShipStack::FillTrackArray ( )
override

Fill the MCTrack output array, applying filter criteria

Definition at line 216 of file ShipStack.cxx.

216 {
217 LOG(debug) << "ShipStack: Filling MCTrack array...";
218
219 // Some safeties to make sure everything exists
220 if (!gMC) return;
221 if (gMC->GetStack() == nullptr) return;
222
223 Int_t evtNo = -1;
224
225 // --> Reset index map (-2 = not stored) and number of output tracks
226 fIndexMap.assign(fNParticles, -2);
227 fNTracks = 0;
228
229 // --> Check tracks for selection criteria
230 SelectTracks();
231
232 if (fNParticles > 0) evtNo = gMC->CurrentEvent();
233
234 // --> Loop over fParticles array and copy selected tracks
235 for (Int_t iPart = 0; iPart < fNParticles; iPart++) {
236 if (fStoreFlags[iPart]) {
237 fTracks->emplace_back(dynamic_cast<TParticle*>(GetParticle(iPart)));
238 ShipMCTrack& track = fTracks->back();
239 if (iPart < static_cast<Int_t>(fSplitSets.size())) {
240 const SplitInfo& info = fSplitSets[iPart];
241 track.SetSplitSet(info.splitSet, info.role, info.weight);
242 }
243 fIndexMap[iPart] = fNTracks;
244 track.SetTrackID(fNTracks);
245 track.SetEventID(evtNo);
246 fNTracks++;
247 }
248 }
249
250 // --> Screen output
251 // Print(1);
252}
const Int_t debug
void SetSplitSet(Int_t splitSet, Int_t role, Double_t splitWeight)
void SetTrackID(const Int_t &trackID)
void SetEventID(const Int_t &eventID)
TParticle * GetParticle(Int_t trackId) const
std::vector< SplitInfo > fSplitSets
Definition ShipStack.h:211
void SelectTracks()

◆ GetCurrentParentTrackNumber()

Int_t ShipStack::GetCurrentParentTrackNumber ( ) const
override

Get the track number of the parent of the current track Declared in TVirtualMCStack

Definition at line 377 of file ShipStack.cxx.

377 {
378 TParticle* currentPart = GetCurrentTrack();
379 if (currentPart) {
380 return currentPart->GetFirstMother();
381 } else {
382 return -1;
383 }
384}
TParticle * GetCurrentTrack() const override

◆ GetCurrentTrack()

TParticle * ShipStack::GetCurrentTrack ( ) const
override

Get the current track's particle Declared in TVirtualMCStack

Definition at line 196 of file ShipStack.cxx.

196 {
197 TParticle* currentPart = GetParticle(fCurrentTrack);
198 if (!currentPart) {
199 LOG(warning) << "ShipStack: Current track not found in stack!";
200 }
201 return currentPart;
202}

◆ GetCurrentTrackNumber()

Int_t ShipStack::GetCurrentTrackNumber ( ) const
inlineoverride

Get the number of the current track Declared in TVirtualMCStack

Definition at line 121 of file ShipStack.h.

121{ return fCurrentTrack; }

◆ GetListOfParticles()

TClonesArray * ShipStack::GetListOfParticles ( )
inlineoverride

Definition at line 182 of file ShipStack.h.

182{ return fParticles; }

◆ GetNprimary()

Int_t ShipStack::GetNprimary ( ) const
inlineoverride

Get number of primary tracks Declared in TVirtualMCStack

Definition at line 111 of file ShipStack.h.

111{ return fNPrimaries; }

◆ GetNtrack()

Int_t ShipStack::GetNtrack ( ) const
inlineoverride

Get total number of tracks Declared in TVirtualMCStack

Definition at line 106 of file ShipStack.h.

106{ return fNParticles; }

◆ GetParticle()

TParticle * ShipStack::GetParticle ( Int_t trackId) const

Accessors

Definition at line 388 of file ShipStack.cxx.

388 {
389 if (trackID < 0 || trackID >= fNParticles) {
390 LOGF(fatal, "ShipStack: Particle index %i out of range. Max=%i", trackID,
392 }
393 return dynamic_cast<TParticle*>(fParticles->At(trackID));
394}

◆ operator=()

ShipStack & ShipStack::operator= ( const ShipStack & )
privatedelete

◆ PopNextTrack()

TParticle * ShipStack::PopNextTrack ( Int_t & iTrack)
override

Get next particle for tracking from the stack. Declared in TVirtualMCStack

Parameters
iTrackindex of popped track (return)
Returns
Pointer to the TParticle of the track

Definition at line 147 of file ShipStack.cxx.

147 {
148 // If end of stack: Return empty pointer
149 if (fStack.empty()) {
150 iTrack = -1;
151 return nullptr;
152 }
153
154 // If not, get next particle from stack
155 TParticle* thisParticle = fStack.top();
156 fStack.pop();
157
158 if (!thisParticle) {
159 iTrack = 0;
160 return nullptr;
161 }
162
163 fCurrentTrack = thisParticle->GetStatusCode();
164 iTrack = fCurrentTrack;
165
166 return thisParticle;
167}

◆ PopPrimaryForTracking()

TParticle * ShipStack::PopPrimaryForTracking ( Int_t iPrim)
override

Get primary particle by index for tracking from stack Declared in TVirtualMCStack

Parameters
iPrimindex of primary particle
Returns
Pointer to the TParticle of the track

Definition at line 171 of file ShipStack.cxx.

171 {
172 // Get the iPrimth particle from the fStack TClonesArray. This
173 // should be a primary (if the index is correct).
174
175 // Test for index
176 if (iPrim < 0 || iPrim >= fNPrimaries) {
177 LOGF(fatal, "ShipStack: Primary index out of range! %i ", iPrim);
178 }
179
180 // Return the iPrim-th TParticle from the fParticle array. This should be
181 // a primary.
182 TParticle* part = dynamic_cast<TParticle*>(fParticles->At(iPrim));
183 /* do not understand the logic behind this !!! TR July 2014
184 if ( ! (part->GetMother(0) < 0) ) {
185 fLogger->Fatal(MESSAGE_ORIGIN, "ShipStack:: Not a primary track! %i
186 ",iPrim); Fatal("ShipStack::PopPrimaryForTracking", "Not a primary track");
187 }*/
188 if (!part->TestBit(kDoneBit))
189 return nullptr;
190 else
191 return part;
192}
@ kDoneBit
Definition ShipStack.h:44

◆ Print()

void ShipStack::Print ( Int_t iVerbose = 0) const
virtual

Definition at line 348 of file ShipStack.cxx.

348 {
349 cout << "-I- ShipStack: Number of primaries = " << fNPrimaries << endl;
350 cout << " Total number of particles = " << fNParticles << endl;
351 cout << " Number of tracks in output = " << fNTracks << endl;
352 if (iVerbose) {
353 for (Int_t iTrack = 0; iTrack < fNTracks; iTrack++) {
354 (*fTracks)[iTrack].Print(iTrack);
355 }
356 }
357}

◆ PushTrack() [1/2]

void ShipStack::PushTrack ( Int_t toBeDone,
Int_t parentID,
Int_t pdgCode,
Double_t px,
Double_t py,
Double_t pz,
Double_t e,
Double_t vx,
Double_t vy,
Double_t vz,
Double_t time,
Double_t polx,
Double_t poly,
Double_t polz,
TMCProcess proc,
Int_t & ntr,
Double_t weight,
Int_t is )
override

Add a TParticle to the stack. Declared in TVirtualMCStack

Parameters
toBeDoneFlag for tracking
parentIDIndex of mother particle
pdgCodeParticle type (PDG encoding)
px,py,pzMomentum components at start vertex [GeV]
eTotal energy at start vertex [GeV]
vx,vy,vzCoordinates of start vertex [cm]
timeStart time of track [s]
polx,poly,polzPolarisation vector
procProduction mechanism (VMC encoding)
ntrTrack number (filled by the stack)
weightParticle weight
isGeneration status code (whatever that means)

Definition at line 67 of file ShipStack.cxx.

72 {
73 PushTrack(toBeDone, parentId, pdgCode, px, py, pz, e, vx, vy, vz, time, polx,
74 poly, polz, proc, ntr, weight, is, -1);
75}
void PushTrack(Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is) override
Definition ShipStack.cxx:67

◆ PushTrack() [2/2]

void ShipStack::PushTrack ( Int_t toBeDone,
Int_t parentID,
Int_t pdgCode,
Double_t px,
Double_t py,
Double_t pz,
Double_t e,
Double_t vx,
Double_t vy,
Double_t vz,
Double_t time,
Double_t polx,
Double_t poly,
Double_t polz,
TMCProcess proc,
Int_t & ntr,
Double_t weight,
Int_t is,
Int_t secondParentId )
override

Definition at line 78 of file ShipStack.cxx.

83 {
84 // cout << "ShipStack: " << fNParticles << " " << pdgCode << " " << parentId
85 // << " " << secondparentID<<" "<<proc<< endl;
86
87 // update weight to correspond to parentWeight * weight for splitting cases
88 if (fSplitting) {
89 if (parentId >= 0) {
90 if (parentId < fParticles->GetEntriesFast()) {
91 TParticle* parentPart =
92 dynamic_cast<TParticle*>(fParticles->At(parentId));
93 if (parentPart) {
94 Double_t parentWeight = parentPart->GetWeight();
95 weight = weight * parentWeight;
96 }
97 }
98 }
99 }
100
101 Int_t trackId = fNParticles;
102
103 // --> Get TParticle array
104 TClonesArray& partArray = *fParticles;
105
106 // --> Set argument variable
107 ntr = trackId;
108
109 Int_t nPoints = 0;
110 Int_t daughter1Id = -1;
111 Int_t daughter2Id = -1;
112
113 // --> Create new TParticle and add it to the TParticle array
114 TParticle* particle = new (partArray[fNParticles++])
115 TParticle(pdgCode, trackId, parentId, nPoints, daughter1Id, daughter2Id,
116 px, py, pz, e, vx, vy, vz, time);
117 // from root, how does this fit ? misuse of status and mother2 ??? status is
118 // used for trackID definitely TParticle(Int_t pdg, Int_t status, Int_t
119 // mother1, Int_t mother2,
120 // Int_t daughter1, Int_t daughter2, Double_t px, Double_t py, Double_t pz,
121 // Double_t etot, Double_t vx, Double_t vy, Double_t vz, Double_t time)
122 particle->SetPolarisation(polx, poly, polz);
123 particle->SetWeight(weight);
124 particle->SetUniqueID(proc);
125 // TR August 2014, still trying to understand the logic of FairRoot, due to
126 // misuse of secondparentID, all is a big mess
127 if (parentId < 0) {
128 particle->SetFirstMother(secondparentID);
129 particle->SetLastMother(secondparentID);
130 } else {
131 particle->SetFirstMother(parentId);
132 particle->SetLastMother(parentId);
133 }
134 // --> Increment counter
135 if (parentId < 0) {
136 fNPrimaries++;
137 }
138 if (toBeDone == 1) {
139 // --> Push particle on the stack if toBeDone is set
140 particle->SetBit(kDoneBit);
141 fStack.push(particle);
142 }
143}

◆ Register()

void ShipStack::Register ( )
override

Register the MCTrack array to the Root Manager

Definition at line 342 of file ShipStack.cxx.

342 {
343 FairRootManager::Instance()->RegisterAny("MCTrack", fTracks, kTRUE);
344}

◆ Reset()

void ShipStack::Reset ( )
override

Resets arrays and stack and deletes particles and tracks

Definition at line 315 of file ShipStack.cxx.

315 {
316 fIndex = 0;
317 fCurrentTrack = -1;
319 while (!fStack.empty()) {
320 fStack.pop();
321 }
322 fParticles->Clear();
323 fTracks->clear();
324 fPointsPerTrack.clear();
325 fSplitSets.clear();
326}

◆ SelectTracks()

void ShipStack::SelectTracks ( )
private

Mark tracks for output using selection criteria

Definition at line 398 of file ShipStack.cxx.

398 {
399 // --> Reset storage flags
400 fStoreFlags.assign(fNParticles, kFALSE);
401
402 // --> Check particles in the fParticle array
403 for (Int_t i = 0; i < fNParticles; i++) {
404 TParticle* thisPart = GetParticle(i);
405 Bool_t store = kTRUE;
406
407 // --> Get track parameters
408 Int_t iMother = thisPart->GetMother(0);
409 TLorentzVector p;
410 thisPart->Momentum(p);
411 Double_t energy = p.E();
412 Double_t mass = p.M();
413 // Double_t mass = thisPart->GetMass();
414 Double_t eKin = energy - mass;
415
416 // --> Get number of points
417 Int_t nPoints =
418 i < static_cast<Int_t>(fPointsPerTrack.size()) ? fPointsPerTrack[i] : 0;
419
420 // --> Check for cuts (store primaries in any case)
421 if (iMother < 0) {
422 store = kTRUE;
423 } else {
424 if (!fStoreSecondaries) {
425 store = kFALSE;
426 }
427 if (nPoints < fMinPoints) {
428 store = kFALSE;
429 }
430 if (eKin < fEnergyCut) {
431 store = kFALSE;
432 }
433 if ((nPoints >= fMinPoints && fMinPoints > 0) ||
434 (eKin >= fEnergyCut && fEnergyCut > 0)) {
435 store = kTRUE;
436 }
437 }
438 // --> Set storage flag
439 fStoreFlags[i] = store;
440 }
441 // --> If flag is set, flag recursively mothers of selected tracks.
442 // An already-flagged mother implies its whole ancestor chain is flagged,
443 // so the walk can stop there.
444 if (fStoreMothers) {
445 for (Int_t i = 0; i < fNParticles; i++) {
446 if (fStoreFlags[i]) {
447 Int_t iMother = GetParticle(i)->GetMother(0);
448 while (iMother >= 0 && !fStoreFlags[iMother]) {
449 fStoreFlags[iMother] = kTRUE;
450 iMother = GetParticle(iMother)->GetMother(0);
451 }
452 }
453 }
454 }
455}
int i
Definition ShipAna.py:108

◆ SetCurrentTrack()

void ShipStack::SetCurrentTrack ( Int_t iTrack)
inlineoverride

Set the current track number Declared in TVirtualMCStack

Parameters
iTracktrack number

Definition at line 101 of file ShipStack.h.

101{ fCurrentTrack = iTrack; }

◆ SetEnergyCut()

void ShipStack::SetEnergyCut ( Double_t eMin)
inline

Definition at line 152 of file ShipStack.h.

152{ fEnergyCut = eMin; }

◆ SetMinPoints()

void ShipStack::SetMinPoints ( Int_t min)
inline

Definition at line 151 of file ShipStack.h.

151{ fMinPoints = min; }

◆ SetSplitSet()

void ShipStack::SetSplitSet ( Int_t iTrack,
Int_t splitSet,
Int_t role,
Double_t weight )

Record that a track belongs to a split set, with its role (see ShipMCTrack::GetSplitSet()). Copied to the stored ShipMCTrack.

Parameters
iTrackParticle index on the stack
splitSetSplit set ID, unique within the event
roleShipMCTrack::SplitRole
weightWeight of the split track before splitting

Definition at line 328 of file ShipStack.cxx.

329 {
330 if (iTrack < 0 || iTrack >= fNParticles) {
331 LOG(error) << "ShipStack::SetSplitSet: no particle with index " << iTrack;
332 return;
333 }
334 if (iTrack >= static_cast<Int_t>(fSplitSets.size())) {
335 fSplitSets.resize(fNParticles);
336 }
337 fSplitSets[iTrack] = {splitSet, role, weight};
338}

◆ SetSplitting()

void ShipStack::SetSplitting ( )
inline

Definition at line 154 of file ShipStack.h.

154{ fSplitting = kTRUE; }

◆ StoreMothers()

void ShipStack::StoreMothers ( Bool_t choice = kTRUE)
inline

Definition at line 153 of file ShipStack.h.

153{ fStoreMothers = choice; }

◆ StoreSecondaries()

void ShipStack::StoreSecondaries ( Bool_t choice = kTRUE)
inline

Modifiers

Definition at line 150 of file ShipStack.h.

150{ fStoreSecondaries = choice; }

◆ UpdateTrackIndex()

void ShipStack::UpdateTrackIndex ( TRefArray * detArray = nullptr)
override

Update the track index in the MCTracks and MCPoints

Definition at line 256 of file ShipStack.cxx.

256 {
257 LOG(debug) << "ShipStack: Updating track indizes...";
258 Int_t nColl = 0;
259
260 // First update mother ID in MCTracks
261 for (Int_t i = 0; i < fNTracks; i++) {
262 ShipMCTrack& track = (*fTracks)[i];
263 Int_t iMotherOld = track.GetMotherId();
264 if (iMotherOld >= static_cast<Int_t>(fIndexMap.size())) {
265 LOGF(fatal, "ShipStack: Particle index %i not found in dex map! ",
266 iMotherOld);
267 }
268 track.SetMotherId(iMotherOld < 0 ? -1 : fIndexMap[iMotherOld]);
269 }
270
271 if (fDetList == nullptr) {
272 // Now iterate through all active detectors
273 fDetList = detList;
274 fDetIter = detList->MakeIterator();
275 fDetIter->Reset();
276 } else {
277 fDetIter->Reset();
278 }
279
280 FairDetector* det = nullptr;
281 while ((det = dynamic_cast<FairDetector*>(fDetIter->Next()))) {
282 // --> Check if detector uses STL containers (std::vector)
283 if (auto* stlDet = dynamic_cast<ISTLPointContainer*>(det)) {
284 // Use new interface for STL-based detectors
285 stlDet->UpdatePointTrackIndices(fIndexMap);
286 nColl++;
287 } else {
288 // --> Get hit collections from detector (legacy TClonesArray approach)
289 Int_t iColl = 0;
290 TClonesArray* hitArray;
291 while ((hitArray = det->GetCollection(iColl++))) {
292 nColl++;
293 Int_t nPoints = hitArray->GetEntriesFast();
294
295 // --> Update track index for all MCPoints in the collection
296 for (Int_t iPoint = 0; iPoint < nPoints; iPoint++) {
297 FairMCPoint* point = dynamic_cast<FairMCPoint*>(hitArray->At(iPoint));
298 Int_t iTrack = point->GetTrackID();
299
300 if (iTrack < -1 || iTrack >= static_cast<Int_t>(fIndexMap.size())) {
301 LOGF(fatal, "ShipStack: Particle index %i not found in index map! ",
302 iTrack);
303 }
304 point->SetTrackID(iTrack < 0 ? -1 : fIndexMap[iTrack]);
305 }
306
307 } // Collections of this detector
308 }
309 } // List of active detectors
310 LOGF(debug, "...stack and %i collections updated.", nColl);
311}
Int_t GetMotherId() const
Definition ShipMCTrack.h:61
void SetMotherId(Int_t id)

Member Data Documentation

◆ fCurrentTrack

Int_t ShipStack::fCurrentTrack
private

Some indizes and counters

Definition at line 214 of file ShipStack.h.

◆ fEnergyCut

Double32_t ShipStack::fEnergyCut
private

Definition at line 223 of file ShipStack.h.

◆ fIndex

Int_t ShipStack::fIndex
private

Number of entries in fTracks.

Definition at line 218 of file ShipStack.h.

◆ fIndexMap

std::vector<Int_t> ShipStack::fIndexMap
private

Output track index per particle index (-2 if not stored)

Definition at line 200 of file ShipStack.h.

◆ fMinPoints

Int_t ShipStack::fMinPoints
private

Definition at line 222 of file ShipStack.h.

◆ fNParticles

Int_t ShipStack::fNParticles
private

Number of primary particles.

Definition at line 216 of file ShipStack.h.

◆ fNPrimaries

Int_t ShipStack::fNPrimaries
private

Index of current track.

Definition at line 215 of file ShipStack.h.

◆ fNTracks

Int_t ShipStack::fNTracks
private

Number of entries in fParticles.

Definition at line 217 of file ShipStack.h.

◆ fParticles

TClonesArray* ShipStack::fParticles
private

Array of TParticles (contains all TParticles put into or created by the transport

Definition at line 191 of file ShipStack.h.

◆ fPointsPerTrack

std::vector<Int_t> ShipStack::fPointsPerTrack
private

Number of MCPoints per track index, summed over all detectors

Definition at line 203 of file ShipStack.h.

◆ fSplitSets

std::vector<SplitInfo> ShipStack::fSplitSets
private

Definition at line 211 of file ShipStack.h.

◆ fSplitting

Bool_t ShipStack::fSplitting
private

Definition at line 225 of file ShipStack.h.

◆ fStack

std::stack<TParticle*> ShipStack::fStack
private

STL stack (FILO) used to handle the TParticles for tracking

Definition at line 186 of file ShipStack.h.

◆ fStoreFlags

std::vector<Bool_t> ShipStack::fStoreFlags
private

Storage flag per particle index

Definition at line 197 of file ShipStack.h.

◆ fStoreMothers

Bool_t ShipStack::fStoreMothers
private

Definition at line 224 of file ShipStack.h.

◆ fStoreSecondaries

Bool_t ShipStack::fStoreSecondaries
private

Used for merging.

Variables defining the criteria for output selection

Definition at line 221 of file ShipStack.h.

◆ fTracks

std::vector<ShipMCTrack>* ShipStack::fTracks
private

Array of FairMCTracks containing the tracks written to the output

Definition at line 194 of file ShipStack.h.


The documentation for this class was generated from the following files: