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#pragma once
42
43#include "FairGenericStack.h"
44#include "R3BDetectorList.h"
45
46#include "TClonesArray.h"
47#include "TVirtualMCStack.h"
48
49#include <array>
50#include <map>
51#include <stack>
52
53class R3BStack : public FairGenericStack
54{
55 public:
59 R3BStack(Int_t size = 100);
60
62 virtual ~R3BStack();
63
79 virtual void PushTrack(Int_t toBeDone,
80 Int_t parentID,
81 Int_t pdgCode,
82 Double_t px,
83 Double_t py,
84 Double_t pz,
85 Double_t e,
86 Double_t vx,
87 Double_t vy,
88 Double_t vz,
89 Double_t time,
90 Double_t polx,
91 Double_t poly,
92 Double_t polz,
93 TMCProcess proc,
94 Int_t& ntr,
95 Double_t weight,
96 Int_t is);
97
98 virtual void PushTrack(Int_t toBeDone,
99 Int_t parentID,
100 Int_t pdgCode,
101 Double_t px,
102 Double_t py,
103 Double_t pz,
104 Double_t e,
105 Double_t vx,
106 Double_t vy,
107 Double_t vz,
108 Double_t time,
109 Double_t polx,
110 Double_t poly,
111 Double_t polz,
112 TMCProcess proc,
113 Int_t& ntr,
114 Double_t weight,
115 Int_t is,
116 Int_t secondParentId);
117
123 virtual TParticle* PopNextTrack(Int_t& iTrack);
124
130 virtual TParticle* PopPrimaryForTracking(Int_t iPrim);
131
136 virtual void SetCurrentTrack(Int_t iTrack) { fCurrentTrack = iTrack; }
137
141 virtual Int_t GetNtrack() const { return fNParticles; }
142
146 virtual Int_t GetNprimary() const { return fNPrimaries; }
147
151 virtual TParticle* GetCurrentTrack() const;
152
156 virtual Int_t GetCurrentTrackNumber() const { return fCurrentTrack; }
157
161 virtual Int_t GetCurrentParentTrackNumber() const;
162
164 virtual void AddParticle(TParticle* part);
165
167 virtual void FillTrackArray();
168
170 virtual void UpdateTrackIndex(TRefArray* detArray);
171
173 virtual void Reset();
174
176 virtual void Register();
177
181 virtual void PrintStack(Int_t iVerbose) const;
182
184 void StoreSecondaries(Bool_t choice = kTRUE) { fStoreSecondaries = choice; }
185 void SetMinPoints(Int_t min) { fMinPoints = min; }
186 void SetEnergyCut(Double_t eMin) { fEnergyCut = eMin; }
187 void StoreMothers(Bool_t choice = kTRUE) { fStoreMothers = choice; }
188
192 void AddPoint(DetectorId iDet);
193
198 void AddPoint(DetectorId iDet, Int_t iTrack);
199
201 TParticle* GetParticle(Int_t trackId) const;
202 TClonesArray* GetListOfParticles() { return fParticles; }
203
204 void SetDebug(Bool_t t) { fDebug = t; }
205
206 private:
208 R3BStack& operator=(const R3BStack&) { return *this; }
209
211 std::stack<TParticle*> fStack;
212
216 TClonesArray* fParticles;
217
219 TClonesArray* fTracks;
220
222 std::map<Int_t, Bool_t> fStoreMap;
223 std::map<Int_t, Bool_t>::iterator fStoreIter;
224
226 std::map<Int_t, Int_t> fIndexMap;
227 std::map<Int_t, Int_t>::iterator fIndexIter;
228
230 std::map<int, std::array<int, kLAST + 1>> fPointsMap;
231
236 Int_t fNTracks;
237 Int_t fIndex;
238 Int_t fMC;
239
243 Double32_t fEnergyCut;
245 Bool_t fDebug;
246
248 void SelectTracks();
249
250 public:
252};
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:230
virtual Int_t GetCurrentTrackNumber() const
Get the number of the current track Declared in TVirtualMCStack.
Definition R3BMCStack.h:156
ClassDef(R3BStack, 1)
Int_t fIndex
Number of entries in fTracks.
Definition R3BMCStack.h:237
Bool_t fStoreMothers
Definition R3BMCStack.h:244
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:216
virtual void Register()
Register the MCTrack array to the Root Manager.
R3BStack & operator=(const R3BStack &)
Definition R3BMCStack.h:208
Int_t fNParticles
Number of primary particles.
Definition R3BMCStack.h:235
virtual void AddParticle(TParticle *part)
Add a TParticle to the fParticles array.
Double32_t fEnergyCut
Definition R3BMCStack.h:243
void SetMinPoints(Int_t min)
Definition R3BMCStack.h:185
void SetDebug(Bool_t t)
Definition R3BMCStack.h:204
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:223
std::map< Int_t, Bool_t > fStoreMap
STL map from particle index to storage flag.
Definition R3BMCStack.h:222
Bool_t fStoreSecondaries
index for MC units testing
Definition R3BMCStack.h:241
TClonesArray * GetListOfParticles()
Definition R3BMCStack.h:202
std::stack< TParticle * > fStack
STL stack (FILO) used to handle the TParticles for tracking.
Definition R3BMCStack.h:211
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:141
std::map< Int_t, Int_t >::iterator fIndexIter
Definition R3BMCStack.h:227
void StoreSecondaries(Bool_t choice=kTRUE)
Modifiers.
Definition R3BMCStack.h:184
Int_t fCurrentTrack
Some indizes and counters.
Definition R3BMCStack.h:233
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:226
void StoreMothers(Bool_t choice=kTRUE)
Definition R3BMCStack.h:187
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:136
Int_t fMC
Used for merging.
Definition R3BMCStack.h:238
void SetEnergyCut(Double_t eMin)
Definition R3BMCStack.h:186
Int_t fNTracks
Number of entries in fParticles.
Definition R3BMCStack.h:236
Int_t fNPrimaries
Index of current track.
Definition R3BMCStack.h:234
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:242
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:146
Bool_t fDebug
Definition R3BMCStack.h:245
TClonesArray * fTracks
Array of R3BMCTracks containing the tracks written to the output.
Definition R3BMCStack.h:219
R3BStack(const R3BStack &)