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