AliRoot Core  3dc7879 (3dc7879)
AliStack.h
Go to the documentation of this file.
1 
2 #ifndef ALI_STACK_H
3 #define ALI_STACK_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice */
6 
7 /* $Id$ */
8 
9 // Particles stack class
10 // Implements the TMCVirtualStack of the Virtual Monte Carlo
11 // Author A.Morsch
12 
13 class TClonesArray;
14 class TFile;
15 class TObjArray;
16 class TParticle;
17 class TString;
18 class TTree;
19 #include <TClonesArray.h>
20 #include <TArrayI.h>
21 #include <TVirtualMCStack.h>
22 
23 class AliHeader;
24 
25 enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4, kTransportBit=BIT(14)};
26 
27 class AliStack : public TVirtualMCStack
28 {
29  public:
30  // creators, destructors
31  AliStack(Int_t size, const char* name = "");
32  AliStack();
33  AliStack(const AliStack& st);
34  virtual ~AliStack();
36  {st.Copy(*this); return(*this);}
37 
38  // methods
39 
40  virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
41  const Float_t *pmom, const Float_t *vpos, const Float_t *polar,
42  Float_t tof, TMCProcess mech, Int_t &ntr,
43  Float_t weight, Int_t is);
44 
45  virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
46  Double_t px, Double_t py, Double_t pz, Double_t e,
47  Double_t vx, Double_t vy, Double_t vz, Double_t tof,
48  Double_t polx, Double_t poly, Double_t polz,
49  TMCProcess mech, Int_t &ntr, Double_t weight,
50  Int_t is);
51 
52  virtual TParticle* PopNextTrack(Int_t& track);
53  virtual TParticle* GetCurrentTrack() const {return fCurrentTrack;}
54  virtual TParticle* PopPrimaryForTracking(Int_t i);
55 
56  void ConnectTree(TTree* tree);
57  Bool_t GetEvent();
58  Bool_t PurifyKine(Float_t rmax = -1., Float_t zmax = -1.);
59  Bool_t ReorderKine();
60  void FinishEvent();
61  void FlagTrack(Int_t track);
62  void KeepTrack(Int_t itrack);
63  void Clean(Int_t size = 0);
64  void Reset(Int_t size = 0);
65  void DumpPart(Int_t i) const;
66  void DumpPStack ();
67  void DumpLoadedStack () const;
68 
69  // set methods
70  void SetNtrack(Int_t ntrack);
71  virtual void SetCurrentTrack(Int_t track);
72  void SetHighWaterMark(Int_t hgwmk);
73  // get methods
74  virtual Int_t GetNtrack() const;
75  Int_t GetNprimary() const;
76  Int_t GetNtransported() const;
77  virtual Int_t GetCurrentTrackNumber() const;
78  virtual Int_t GetCurrentParentTrackNumber() const;
79  TParticle* Particle(Int_t id, Bool_t useInEmbedding=kFALSE);
80  Int_t GetPrimary(Int_t id, Bool_t useInEmbedding=kFALSE);
81  TTree* TreeK() const {return fTreeK;}
82  TParticle* ParticleFromTreeK(Int_t id, Bool_t useInEmbedding=kFALSE) const;
83  Int_t TreeKEntry(Int_t id, Bool_t useInEmbedding=kFALSE) const;
84  Bool_t IsPhysicalPrimary(Int_t i, Bool_t useInEmbedding=kFALSE);
85  Bool_t IsSecondaryFromWeakDecay(Int_t index, Bool_t useInEmbedding=kFALSE);
86  Bool_t IsSecondaryFromMaterial (Int_t index, Bool_t useInEmbedding=kFALSE);
87  Int_t TrackLabel(Int_t label) const {return fTrackLabelMap[label];}
88  Int_t* TrackLabelMap() {return fTrackLabelMap.GetArray();}
89  const TObjArray* Particles() const;
90 
91  void SetMCEmbeddingFlag(Bool_t v=kTRUE) {fMCEmbeddingFlag = v;}
92  Bool_t GetMCEmbeddingFlag() const {return fMCEmbeddingFlag;}
93  static const char* GetEmbeddingBKGPathsKey() {return fgkEmbedPathsKey;}
94  static TParticle* GetDummyParticle();
95 
96  protected:
97  // methods
98  void CleanParents();
99  void ResetArrays(Int_t size);
100  TParticle* GetParticleMapEntry(Int_t id) const;
101  TParticle* GetNextParticle();
102  Bool_t KeepPhysics(const TParticle* part, Float_t rmax = -1, Float_t zmax = -1.);
103  Bool_t IsStable(Int_t pdg) const;
104  private:
105  void Copy(TObject &st) const;
106 
107  // data members
108  TClonesArray fParticles;
110  TArrayI fParticleFileMap; // Map for particle ids
111  TParticle *fParticleBuffer;
112  TParticle *fCurrentTrack;
113  TTree *fTreeK;
114  Int_t fNtrack; // Number of tracks
115  Int_t fNprimary; // Number of primaries
116  Int_t fNtransported; // Number of particles to be transported
117  Int_t fCurrent;
119  Int_t fHgwmk;
120  Int_t fLoadPoint;
121  TArrayI fTrackLabelMap;
123 
124  static const Char_t *fgkEmbedPathsKey; // keyword for embedding paths
125 
126  ClassDef(AliStack,6) //Particles stack
127 };
128 
129 // inline
130 
131 inline void AliStack::SetNtrack(Int_t ntrack)
132 { fNtrack = ntrack; }
133 
134 inline Int_t AliStack::GetNtrack() const
135 { return fNtrack; }
136 
137 inline Int_t AliStack::GetNprimary() const
138 { return fNprimary; }
139 
140 inline Int_t AliStack::GetNtransported() const
141 { return fNtransported; }
142 
143 inline Int_t AliStack::GetCurrentTrackNumber() const
144 { return fCurrent; }
145 
146 inline const TObjArray* AliStack::Particles() const
147 { return &fParticleMap; }
148 
149 // inline protected
150 
151 inline TParticle* AliStack::GetParticleMapEntry(Int_t id) const
152 { return (TParticle*) fParticleMap.At(id); }
153 
154 #endif //ALI_STACK_H
virtual Int_t GetCurrentParentTrackNumber() const
Definition: AliStack.cxx:769
void SetHighWaterMark(Int_t hgwmk)
Definition: AliStack.cxx:676
TArrayI fParticleFileMap
Map of particles in the supporting TClonesArray.
Definition: AliStack.h:110
Int_t fNtrack
Particle stack.
Definition: AliStack.h:114
Bool_t GetEvent()
Definition: AliStack.cxx:988
Bool_t KeepPhysics(const TParticle *part, Float_t rmax=-1, Float_t zmax=-1.)
Definition: AliStack.cxx:499
AliStack & operator=(const AliStack &st)
Definition: AliStack.h:35
virtual Int_t GetCurrentTrackNumber() const
Definition: AliStack.h:143
static TParticle * GetDummyParticle()
Definition: AliStack.cxx:1171
TArrayI fTrackLabelMap
Next free position in the particle buffer.
Definition: AliStack.h:121
TParticle * fCurrentTrack
Pointer to current particle for writing.
Definition: AliStack.h:112
#define TObjArray
static const Char_t * fgkEmbedPathsKey
Flag that this is a top stack of embedded MC.
Definition: AliStack.h:124
AliStack()
Definition: AliStack.cxx:50
void CleanParents()
Definition: AliStack.cxx:881
Int_t fNtransported
Definition: AliStack.h:116
Int_t fCurrent
Definition: AliStack.h:117
Bool_t IsSecondaryFromWeakDecay(Int_t index, Bool_t useInEmbedding=kFALSE)
Definition: AliStack.cxx:1125
virtual TParticle * PopPrimaryForTracking(Int_t i)
Definition: AliStack.cxx:286
Int_t fHgwmk
Last primary track returned from the stack.
Definition: AliStack.h:119
AliTPCfastTrack * track
void DumpPStack()
Definition: AliStack.cxx:812
TVectorD vz
Definition: driftITSTPC.C:87
void ResetArrays(Int_t size)
Definition: AliStack.cxx:665
Int_t * TrackLabelMap()
Definition: AliStack.h:88
static const char * GetEmbeddingBKGPathsKey()
Definition: AliStack.h:93
Bool_t ReorderKine()
Definition: AliStack.cxx:398
TTree * fTreeK
Pointer to particle currently transported.
Definition: AliStack.h:113
Int_t GetNprimary() const
Definition: AliStack.h:137
Bool_t fMCEmbeddingFlag
Map of track labels.
Definition: AliStack.h:122
void SetNtrack(Int_t ntrack)
Definition: AliStack.h:131
TTree * tree
Bool_t IsPhysicalPrimary(Int_t i, Bool_t useInEmbedding=kFALSE)
Definition: AliStack.cxx:1047
virtual Int_t GetNtrack() const
Definition: AliStack.h:134
virtual ~AliStack()
Definition: AliStack.cxx:124
Int_t TreeKEntry(Int_t id, Bool_t useInEmbedding=kFALSE) const
Definition: AliStack.cxx:739
void ConnectTree(TTree *tree)
Definition: AliStack.cxx:935
void Copy(TObject &st) const
Definition: AliStack.cxx:118
virtual void SetCurrentTrack(Int_t track)
Definition: AliStack.cxx:868
virtual TParticle * PopNextTrack(Int_t &track)
Definition: AliStack.cxx:265
void polar()
Definition: polar.C:2
Int_t GetPrimary(Int_t id, Bool_t useInEmbedding=kFALSE)
Definition: AliStack.cxx:786
Int_t GetNtransported() const
Definition: AliStack.h:140
const TObjArray * Particles() const
Definition: AliStack.h:146
virtual TParticle * GetCurrentTrack() const
Definition: AliStack.h:53
void KeepTrack(Int_t itrack)
Definition: AliStack.cxx:627
TParticle * fParticleBuffer
Definition: AliStack.h:111
Int_t TrackLabel(Int_t label) const
Definition: AliStack.h:87
Bool_t IsSecondaryFromMaterial(Int_t index, Bool_t useInEmbedding=kFALSE)
Definition: AliStack.cxx:1156
void Clean(Int_t size=0)
Definition: AliStack.cxx:637
virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, const Float_t *pmom, const Float_t *vpos, const Float_t *polar, Float_t tof, TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
Definition: AliStack.cxx:138
void DumpLoadedStack() const
Definition: AliStack.cxx:842
Int_t fNprimary
Definition: AliStack.h:115
TParticle * Particle(Int_t id, Bool_t useInEmbedding=kFALSE)
Definition: AliStack.cxx:689
Bool_t IsStable(Int_t pdg) const
Definition: AliStack.cxx:1000
void Reset(Int_t size=0)
Definition: AliStack.cxx:653
TParticle * GetParticleMapEntry(Int_t id) const
Definition: AliStack.h:151
void FinishEvent()
Definition: AliStack.cxx:555
Int_t fLoadPoint
Last track purified.
Definition: AliStack.h:120
Int_t fCurrentPrimary
Last track returned from the stack.
Definition: AliStack.h:118
Bool_t PurifyKine(Float_t rmax=-1., Float_t zmax=-1.)
Definition: AliStack.cxx:304
void SetMCEmbeddingFlag(Bool_t v=kTRUE)
Definition: AliStack.h:91
void FlagTrack(Int_t track)
Definition: AliStack.cxx:603
TObjArray fParticleMap
Pointer to list of particles.
Definition: AliStack.h:109
void DumpPart(Int_t i) const
Definition: AliStack.cxx:803
TClonesArray fParticles
Definition: AliStack.h:108
TParticle * ParticleFromTreeK(Int_t id, Bool_t useInEmbedding=kFALSE) const
Definition: AliStack.cxx:723
TParticle * GetNextParticle()
Definition: AliStack.cxx:900
TTree * TreeK() const
Definition: AliStack.h:81
Bool_t GetMCEmbeddingFlag() const
Definition: AliStack.h:92