]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliStack.h
new files for merging/digitization
[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);
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     void  GetNextTrack(Int_t &mtrack, Int_t &ipart, Float_t *pmom,
46                    Float_t &e, Float_t *vpos, Float_t *polar, Float_t &tof);
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     void  SetCurrentTrack(Int_t track);                           
59     void  SetHighWaterMark(Int_t hgwmk);    
60     // get methods
61     Int_t       GetNtrack() const;
62     Int_t       GetNprimary() const;
63     Int_t       CurrentTrack() const;
64     TObjArray*  Particles() const;
65     TParticle*  Particle(Int_t id);
66     Int_t       GetPrimary(Int_t id) const;
67     TTree*      TreeK() const {return fTreeK;}
68     
69   protected:
70     // methods
71     void  CleanParents();
72     void  ResetArrays(Int_t size);
73     TParticle* GetNextParticle();
74     
75   private:
76     // data members
77     TClonesArray  *fParticles;         //! Pointer to list of particles
78     TObjArray     *fParticleMap;       //! Map of particles in the supporting TClonesArray
79     TArrayI        fParticleFileMap;   //  Map for particle ids 
80     TParticle     *fParticleBuffer;    //! Pointer to current particle for writing
81     TTree         *fTreeK;             //! Particle stack  
82     Int_t          fNtrack;            //  Number of tracks
83     Int_t          fNprimary;          //  Number of primaries
84     Int_t          fCurrent;           //! Last track returned from the stack
85     Int_t          fCurrentPrimary;    //! Last primary track returned from the stack
86     Int_t          fHgwmk;             //! Last track purified
87     Int_t          fLoadPoint;         //! Next free position in the particle buffer
88     TStopwatch     fTimer;             //! Timer object
89     ClassDef(AliStack,2) //Particles stack
90 };
91
92 // inline
93
94 inline void  AliStack::SetNtrack(Int_t ntrack)
95 { fNtrack = ntrack; }
96
97 inline void  AliStack::SetCurrentTrack(Int_t track)
98 { fCurrent = track; }
99
100 inline Int_t AliStack::GetNtrack() const
101 { return fNtrack; }
102
103 inline Int_t AliStack::GetNprimary() const
104 { return fNprimary; }
105
106 inline Int_t AliStack::CurrentTrack() const 
107 { return fCurrent; }
108
109 inline TObjArray* AliStack::Particles() const
110 { return fParticleMap; }
111
112 #endif //ALI_STACK_H