]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliStack.h
AliStack dependences minimized.
[u/mrichter/AliRoot.git] / STEER / AliStack.h
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 <TArrayI.h>
19 #include <TVirtualMCStack.h>
20
21 class AliHeader;
22 #include "AliConfig.h"
23
24 enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4};
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       {st.Copy(*this); return(*this);}
36
37     // methods
38
39     virtual void  PushTrack(Int_t done, Int_t parent, Int_t pdg, 
40                            Float_t *pmom, Float_t *vpos, 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     virtual TParticle* GetCurrentTrack() const {return fCurrentTrack;}
53     virtual TParticle* PopPrimaryForTracking(Int_t i);    
54
55     void   ConnectTree(TTree* tree);
56     void   BeginEvent();
57     void   FinishRun();
58     Bool_t GetEvent();
59     void   PurifyKine();
60     void   ReorderKine();
61     void   FinishEvent();
62     void   FlagTrack(Int_t track);
63     void   KeepTrack(Int_t itrack); 
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     virtual Int_t GetCurrentTrackNumber() const;
77     virtual Int_t GetCurrentParentTrackNumber() const;
78     TObjArray*  Particles() const;
79     TParticle*  Particle(Int_t id);
80     Int_t       GetPrimary(Int_t id);
81     TTree*      TreeK();
82     TParticle*  ParticleFromTreeK(Int_t id) const;
83     Int_t       TreeKEntry(Int_t id) const;
84     Bool_t      IsPhysicalPrimary(Int_t i);
85     Int_t       TrackLabel(Int_t label) {return fTrackLabelMap[label];}
86     Int_t*      TrackLabelMap() {return fTrackLabelMap.GetArray();}
87             
88   protected:
89     // methods
90     void  CleanParents();
91     void  ResetArrays(Int_t size);
92     TParticle* GetNextParticle();
93     Bool_t KeepPhysics(TParticle* part);
94     Bool_t IsStable(Int_t pdg) const;
95   private:
96     void Copy(TObject &st) const;
97
98     // data members
99     TClonesArray  *fParticles;         //! Pointer to list of particles
100     TObjArray     *fParticleMap;       //! Map of particles in the supporting TClonesArray
101     TArrayI        fParticleFileMap;   //  Map for particle ids 
102     TParticle     *fParticleBuffer;    //! Pointer to current particle for writing
103     TParticle     *fCurrentTrack;      //! Pointer to particle currently transported
104     TTree         *fTreeK;             //! Particle stack  
105     Int_t          fNtrack;            //  Number of tracks
106     Int_t          fNprimary;          //  Number of primaries
107     Int_t          fCurrent;           //! Last track returned from the stack
108     Int_t          fCurrentPrimary;    //! Last primary track returned from the stack
109     Int_t          fHgwmk;             //! Last track purified
110     Int_t          fLoadPoint;         //! Next free position in the particle buffer
111     TArrayI        fTrackLabelMap;     //! Map of track labels
112     ClassDef(AliStack,5) //Particles stack
113 };
114
115 // inline
116
117 inline void  AliStack::SetNtrack(Int_t ntrack)
118 { fNtrack = ntrack; }
119
120 inline void  AliStack::SetCurrentTrack(Int_t track)
121 { fCurrent = track; }
122
123 inline Int_t AliStack::GetNtrack() const
124 { return fNtrack; }
125
126 inline Int_t AliStack::GetNprimary() const
127 { return fNprimary; }
128
129 inline Int_t AliStack::GetCurrentTrackNumber() const 
130 { return fCurrent; }
131
132 inline TObjArray* AliStack::Particles() const
133 { return fParticleMap; }
134
135 #endif //ALI_STACK_H