FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairGenericStack.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 // -------------------------------------------------------------------------
9 // ----- FairGenericStack header file -----
10 // ----- Created 10/08/04 by D. Bertini -----
11 // -------------------------------------------------------------------------
12 
18 #ifndef FAIRGENERICSTACK_H
19 #define FAIRGENERICSTACK_H
20 
21 #include <Rtypes.h> // for Double_t, Int_t, etc
22 #include <TClonesArray.h>
23 #include <TMCProcess.h> // for TMCProcess
24 #include <TVirtualMCStack.h> // for TVirtualMCStack
25 #include <map>
26 #include <tuple>
27 
28 class FairLogger;
29 class TParticle;
30 class TRefArray;
31 class TIterator;
32 
33 class FairGenericStack : public TVirtualMCStack
34 {
35  public:
38 
40  FairGenericStack(Int_t size);
41 
43  virtual ~FairGenericStack();
44 
62  virtual void PushTrack(Int_t toBeDone,
63  Int_t parentID,
64  Int_t pdgCode,
65  Double_t px,
66  Double_t py,
67  Double_t pz,
68  Double_t e,
69  Double_t vx,
70  Double_t vy,
71  Double_t vz,
72  Double_t time,
73  Double_t polx,
74  Double_t poly,
75  Double_t polz,
76  TMCProcess proc,
77  Int_t& ntr,
78  Double_t weight,
79  Int_t is,
80  Int_t secondparentID) = 0;
81 
83  virtual void FillTrackArray() {}
84 
86  virtual void UpdateTrackIndex(TRefArray* /* detArray=0 */) {}
87 
89  void SetDetArrayList(TRefArray* detArray);
90 
92  virtual void FinishPrimary() {}
93 
95  virtual void Reset() {}
96 
98  virtual void Register() {}
99 
100  virtual TClonesArray* GetListOfParticles() { return 0; }
101  virtual void SetParticleArray(__attribute__((unused)) TClonesArray* partArray) {}
102  virtual void SetParticleArray(__attribute__((unused)) TClonesArray* partArray,
103  __attribute__((unused)) Int_t partFrom,
104  __attribute__((unused)) Int_t partTo)
105  {}
106 
108  virtual FairGenericStack* CloneStack() const;
109 
119  virtual void FastSimMoveParticleTo(Double_t xx,
120  Double_t yy,
121  Double_t zz,
122  Double_t tt,
123  Double_t px,
124  Double_t py,
125  Double_t pz,
126  Double_t en);
128  virtual void FastSimStopParticle();
135  virtual void FastSimPushSecondary(Int_t parentID,
136  Int_t pdgCode,
137  Double_t xx,
138  Double_t yy,
139  Double_t zz,
140  Double_t tt,
141  Double_t px,
142  Double_t py,
143  Double_t pz,
144  Double_t en,
145  Double_t polx,
146  Double_t poly,
147  Double_t polz,
148  TMCProcess proc,
149  Double_t weight,
150  Int_t is);
152  virtual std::tuple<Int_t, Int_t, Int_t> FastSimGetMovedIndex()
153  {
154  return std::make_tuple(fFSMovedIndex, fFSFirstSecondary, fFSNofSecondaries);
155  }
156  virtual void FastSimClearMovedIndex()
157  {
158  fFSMovedIndex = -2;
159  fFSFirstSecondary = -2;
160  fFSNofSecondaries = 0;
161  }
162 
163  template<typename T>
164  void FastSimUpdateTrackIndex(T* point, Int_t& iTrack);
165 
166  protected:
171 
174 
176  TRefArray* fDetList;
177 
179  TIterator* fDetIter;
180 
182  Int_t fVerbose;
183 
185  std::map<Int_t, Int_t> fFSTrackMap;
186  std::map<Int_t, Int_t>::iterator fFSTrackIter;
190 
192 };
193 
194 template<typename T>
195 void FairGenericStack::FastSimUpdateTrackIndex(T* point, Int_t& iTrack)
196 {
197  fFSTrackIter = fFSTrackMap.find(iTrack); // check if point created by FastSimulation
198  if (fFSTrackIter != fFSTrackMap.end()) { // indeed the point has been created by the FastSimulation mechanism
199  iTrack = fFSTrackIter->second;
200  point->SetTrackID(iTrack); // set proper TrackID
201  }
202 }
203 
204 #endif
virtual std::tuple< Int_t, Int_t, Int_t > FastSimGetMovedIndex()
virtual FairGenericStack * CloneStack() const
TIterator * fDetIter
std::map< Int_t, Int_t >::iterator fFSTrackIter
virtual void FastSimPushSecondary(Int_t parentID, Int_t pdgCode, Double_t xx, Double_t yy, Double_t zz, Double_t tt, Double_t px, Double_t py, Double_t pz, Double_t en, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Double_t weight, Int_t is)
FairGenericStack & operator=(const FairGenericStack &)
void SetDetArrayList(TRefArray *detArray)
virtual void UpdateTrackIndex(TRefArray *)
virtual void SetParticleArray(__attribute__((unused)) TClonesArray *partArray)
FairLogger * fLogger
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, Int_t secondparentID)=0
ClassDef(FairGenericStack, 1)
virtual void FillTrackArray()
virtual void FastSimClearMovedIndex()
virtual void Reset()
virtual TClonesArray * GetListOfParticles()
virtual ~FairGenericStack()
void FastSimUpdateTrackIndex(T *point, Int_t &iTrack)
std::map< Int_t, Int_t > fFSTrackMap
virtual void Register()
virtual void FastSimStopParticle()
TRefArray * fDetList
virtual void FinishPrimary()
virtual void FastSimMoveParticleTo(Double_t xx, Double_t yy, Double_t zz, Double_t tt, Double_t px, Double_t py, Double_t pz, Double_t en)
virtual void SetParticleArray(__attribute__((unused)) TClonesArray *partArray, __attribute__((unused)) Int_t partFrom, __attribute__((unused)) Int_t partTo)