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