R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BMCStack.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14// -------------------------------------------------------------------------
15// ----- R3BStack header file -----
16// ----- Created 10/08/04 by D. Bertini / V. Friese -----
17// -------------------------------------------------------------------------
18
40
41#ifndef R3BSTACK_H
42#define R3BSTACK_H
43
44#include "FairGenericStack.h"
45#include "R3BDetectorList.h"
46
47#include "TClonesArray.h"
48#include "TVirtualMCStack.h"
49
50#include <array>
51#include <map>
52#include <stack>
53
54class R3BStack : public FairGenericStack
55{
56
57 public:
61 R3BStack(Int_t size = 100);
62
64 virtual ~R3BStack();
65
81 virtual void PushTrack(Int_t toBeDone,
82 Int_t parentID,
83 Int_t pdgCode,
84 Double_t px,
85 Double_t py,
86 Double_t pz,
87 Double_t e,
88 Double_t vx,
89 Double_t vy,
90 Double_t vz,
91 Double_t time,
92 Double_t polx,
93 Double_t poly,
94 Double_t polz,
95 TMCProcess proc,
96 Int_t& ntr,
97 Double_t weight,
98 Int_t is);
99
100 virtual void PushTrack(Int_t toBeDone,
101 Int_t parentID,
102 Int_t pdgCode,
103 Double_t px,
104 Double_t py,
105 Double_t pz,
106 Double_t e,
107 Double_t vx,
108 Double_t vy,
109 Double_t vz,
110 Double_t time,
111 Double_t polx,
112 Double_t poly,
113 Double_t polz,
114 TMCProcess proc,
115 Int_t& ntr,
116 Double_t weight,
117 Int_t is,
118 Int_t secondParentId);
119
125 virtual TParticle* PopNextTrack(Int_t& iTrack);
126
132 virtual TParticle* PopPrimaryForTracking(Int_t iPrim);
133
138 virtual void SetCurrentTrack(Int_t iTrack) { fCurrentTrack = iTrack; }
139
143 virtual Int_t GetNtrack() const { return fNParticles; }
144
148 virtual Int_t GetNprimary() const { return fNPrimaries; }
149
153 virtual TParticle* GetCurrentTrack() const;
154
158 virtual Int_t GetCurrentTrackNumber() const { return fCurrentTrack; }
159
163 virtual Int_t GetCurrentParentTrackNumber() const;
164
166 virtual void AddParticle(TParticle* part);
167
169 virtual void FillTrackArray();
170
172 virtual void UpdateTrackIndex(TRefArray* detArray);
173
175 virtual void Reset();
176
178 virtual void Register();
179
183 virtual void PrintStack(Int_t iVerbose) const;
184
186 void StoreSecondaries(Bool_t choice = kTRUE) { fStoreSecondaries = choice; }
187 void SetMinPoints(Int_t min) { fMinPoints = min; }
188 void SetEnergyCut(Double_t eMin) { fEnergyCut = eMin; }
189 void StoreMothers(Bool_t choice = kTRUE) { fStoreMothers = choice; }
190
194 void AddPoint(DetectorId iDet);
195
200 void AddPoint(DetectorId iDet, Int_t iTrack);
201
203 TParticle* GetParticle(Int_t trackId) const;
204 TClonesArray* GetListOfParticles() { return fParticles; }
205
206 void SetDebug(Bool_t t) { fDebug = t; }
207
208 private:
210 R3BStack& operator=(const R3BStack&) { return *this; }
211
213 std::stack<TParticle*> fStack;
214
218 TClonesArray* fParticles;
219
221 TClonesArray* fTracks;
222
224 std::map<Int_t, Bool_t> fStoreMap;
225 std::map<Int_t, Bool_t>::iterator fStoreIter;
226
228 std::map<Int_t, Int_t> fIndexMap;
229 std::map<Int_t, Int_t>::iterator fIndexIter;
230
232 std::map<int, std::array<int, kLAST + 1>> fPointsMap;
233
238 Int_t fNTracks;
239 Int_t fIndex;
240 Int_t fMC;
241
245 Double32_t fEnergyCut;
247 Bool_t fDebug;
248
250 void SelectTracks();
251
252 ClassDef(R3BStack, 1)
253};
254
255#endif
DetectorId
Unique identifier for all R3B detector systems.
virtual void PrintStack(Int_t iVerbose) const
Output to screen.
virtual void UpdateTrackIndex(TRefArray *detArray)
Update the track index in the MCTracks and MCPoints.
std::map< int, std::array< int, kLAST+1 > > fPointsMap
STL map from track index and detector ID to number of MCPoints.
Definition R3BMCStack.h:232
virtual Int_t GetCurrentTrackNumber() const
Get the number of the current track Declared in TVirtualMCStack.
Definition R3BMCStack.h:158
Int_t fIndex
Number of entries in fTracks.
Definition R3BMCStack.h:239
Bool_t fStoreMothers
Definition R3BMCStack.h:246
void SelectTracks()
Mark tracks for output using selection criteria.
virtual 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)
Add a TParticle to the stack.
virtual Int_t GetCurrentParentTrackNumber() const
Get the track number of the parent of the current track Declared in TVirtualMCStack.
TClonesArray * fParticles
Array of TParticles (contains all TParticles put into or created by the transport.
Definition R3BMCStack.h:218
virtual void Register()
Register the MCTrack array to the Root Manager.
R3BStack & operator=(const R3BStack &)
Definition R3BMCStack.h:210
Int_t fNParticles
Number of primary particles.
Definition R3BMCStack.h:237
virtual void AddParticle(TParticle *part)
Add a TParticle to the fParticles array.
Double32_t fEnergyCut
Definition R3BMCStack.h:245
void SetMinPoints(Int_t min)
Definition R3BMCStack.h:187
void SetDebug(Bool_t t)
Definition R3BMCStack.h:206
virtual TParticle * PopPrimaryForTracking(Int_t iPrim)
Get primary particle by index for tracking from stack Declared in TVirtualMCStack.
std::map< Int_t, Bool_t >::iterator fStoreIter
Definition R3BMCStack.h:225
std::map< Int_t, Bool_t > fStoreMap
STL map from particle index to storage flag.
Definition R3BMCStack.h:224
Bool_t fStoreSecondaries
index for MC units testing
Definition R3BMCStack.h:243
TClonesArray * GetListOfParticles()
Definition R3BMCStack.h:204
std::stack< TParticle * > fStack
STL stack (FILO) used to handle the TParticles for tracking.
Definition R3BMCStack.h:213
virtual void Reset()
Resets arrays and stack and deletes particles and tracks.
virtual Int_t GetNtrack() const
Get total number of tracks Declared in TVirtualMCStack.
Definition R3BMCStack.h:143
std::map< Int_t, Int_t >::iterator fIndexIter
Definition R3BMCStack.h:229
void StoreSecondaries(Bool_t choice=kTRUE)
Modifiers.
Definition R3BMCStack.h:186
Int_t fCurrentTrack
Some indizes and counters.
Definition R3BMCStack.h:235
virtual TParticle * GetCurrentTrack() const
Get the current track's particle Declared in TVirtualMCStack.
std::map< Int_t, Int_t > fIndexMap
STL map from particle index to track index.
Definition R3BMCStack.h:228
void StoreMothers(Bool_t choice=kTRUE)
Definition R3BMCStack.h:189
virtual TParticle * PopNextTrack(Int_t &iTrack)
Get next particle for tracking from the stack.
void AddPoint(DetectorId iDet)
Increment number of points for the current track in a given detector.
virtual void SetCurrentTrack(Int_t iTrack)
Set the current track number Declared in TVirtualMCStack.
Definition R3BMCStack.h:138
Int_t fMC
Used for merging.
Definition R3BMCStack.h:240
void SetEnergyCut(Double_t eMin)
Definition R3BMCStack.h:188
Int_t fNTracks
Number of entries in fParticles.
Definition R3BMCStack.h:238
Int_t fNPrimaries
Index of current track.
Definition R3BMCStack.h:236
virtual ~R3BStack()
Destructor.
TParticle * GetParticle(Int_t trackId) const
Accessors.
R3BStack(Int_t size=100)
Default constructor param size Estimated track number.
Int_t fMinPoints
Definition R3BMCStack.h:244
virtual void FillTrackArray()
Fill the MCTrack output array, applying filter criteria.
virtual Int_t GetNprimary() const
Get number of primary tracks Declared in TVirtualMCStack.
Definition R3BMCStack.h:148
Bool_t fDebug
Definition R3BMCStack.h:247
TClonesArray * fTracks
Array of R3BMCTracks containg the tracks written to the output.
Definition R3BMCStack.h:221
R3BStack(const R3BStack &)