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