]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliStack.h
729ff171df63b2b73c4733f2a356ee63c67fbb21
[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 #include <TArrayI.h>
9 #include <TVirtualMCStack.h>
10
11 #include "AliConfig.h"
12
13 class AliHeader;
14 class TClonesArray;
15 class TFile;
16 class TObjArray;
17 class TParticle;
18 class TTree;
19 class TString;
20
21 class AliStack : public TVirtualMCStack
22 {
23   public:
24     // creators, destructors
25     AliStack(Int_t size, const char* evfoldname = AliConfig::fgkDefaultEventFolderName);
26     AliStack();
27     AliStack(const AliStack& st);
28     virtual ~AliStack();
29     AliStack& operator=(const AliStack& st)
30       {st.Copy(*this); return(*this);}
31
32     // methods
33
34     virtual void  SetTrack(Int_t done, Int_t parent, Int_t pdg, 
35                            Float_t *pmom, Float_t *vpos, Float_t *polar, 
36                            Float_t tof, TMCProcess mech, Int_t &ntr,
37                            Float_t weight, Int_t is);
38
39     virtual void  SetTrack(Int_t done, Int_t parent, Int_t pdg,
40                            Double_t px, Double_t py, Double_t pz, Double_t e,
41                            Double_t vx, Double_t vy, Double_t vz, Double_t tof,
42                            Double_t polx, Double_t poly, Double_t polz,
43                            TMCProcess mech, Int_t &ntr, Double_t weight,
44                            Int_t is);
45
46     virtual TParticle* GetNextTrack(Int_t& track);
47     virtual TParticle* GetCurrentTrack() {return fCurrentTrack;}
48     virtual TParticle* GetPrimaryForTracking(Int_t i);    
49
50     void  ConnectTree();
51     void  BeginEvent();
52     void  FinishRun();
53     Bool_t GetEvent();
54     void  PurifyKine();
55     void  FinishEvent();
56     void  FlagTrack(Int_t track);
57     void  KeepTrack(Int_t itrack); 
58     void  Reset(Int_t size = 0);
59     void  DumpPart(Int_t i) const;
60     void  DumpPStack ();
61     void  DumpLoadedStack () const;
62
63     // set methods
64     void  SetNtrack(Int_t ntrack);
65     virtual void  SetCurrentTrack(Int_t track);                           
66     void  SetHighWaterMark(Int_t hgwmk);    
67     // get methods
68     virtual Int_t GetNtrack() const;
69     Int_t       GetNprimary() const;
70     virtual Int_t CurrentTrack() const;
71     virtual Int_t CurrentTrackParent() const;
72     TObjArray*  Particles() const;
73     TParticle*  Particle(Int_t id);
74     Int_t       GetPrimary(Int_t id);
75     TTree*      TreeK();
76     void        SetEventFolderName(const char* foldname);
77     TParticle*  ParticleFromTreeK(Int_t id) const;
78     Int_t       TreeKEntry(Int_t id) const;
79     
80   protected:
81     // methods
82     void  CleanParents();
83     void  ResetArrays(Int_t size);
84     TParticle* GetNextParticle();
85     Bool_t KeepPhysics(TParticle* part);
86     
87   private:
88     void Copy(AliStack &st) const;
89
90     // data members
91     TClonesArray  *fParticles;         //! Pointer to list of particles
92     TObjArray     *fParticleMap;       //! Map of particles in the supporting TClonesArray
93     TArrayI        fParticleFileMap;   //  Map for particle ids 
94     TParticle     *fParticleBuffer;    //! Pointer to current particle for writing
95     TParticle     *fCurrentTrack;      //! Pointer to particle currently transported
96     TTree         *fTreeK;             //! Particle stack  
97     Int_t          fNtrack;            //  Number of tracks
98     Int_t          fNprimary;          //  Number of primaries
99     Int_t          fCurrent;           //! Last track returned from the stack
100     Int_t          fCurrentPrimary;    //! Last primary track returned from the stack
101     Int_t          fHgwmk;             //! Last track purified
102     Int_t          fLoadPoint;         //! Next free position in the particle buffer
103     
104     TString        fEventFolderName;   //! Folder name where event is mounted
105     ClassDef(AliStack,4) //Particles stack
106 };
107
108 // inline
109
110 inline void  AliStack::SetNtrack(Int_t ntrack)
111 { fNtrack = ntrack; }
112
113 inline void  AliStack::SetCurrentTrack(Int_t track)
114 { fCurrent = track; }
115
116 inline Int_t AliStack::GetNtrack() const
117 { return fNtrack; }
118
119 inline Int_t AliStack::GetNprimary() const
120 { return fNprimary; }
121
122 inline Int_t AliStack::CurrentTrack() const 
123 { return fCurrent; }
124
125 inline TObjArray* AliStack::Particles() const
126 { return fParticleMap; }
127
128 #endif //ALI_STACK_H