]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliStack.h
New methods for more effective access of particles from TreeK (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 <TObject.h>
9 #include <TArrayI.h>
10 #include <TStopwatch.h>
11 #include <TVirtualMCStack.h>
12 #include <TMCProcess.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 TVirtualMCStack
24 {
25   public:
26     // creators, destructors
27     AliStack(Int_t size);
28     AliStack();
29     virtual ~AliStack();
30
31     // methods
32     virtual void  SetTrack(Int_t done, Int_t parent, Int_t pdg, 
33                       Float_t *pmom, Float_t *vpos, Float_t *polar, 
34                       Float_t tof, TMCProcess mech, Int_t &ntr,
35                       Float_t weight, Int_t is);
36     virtual void  SetTrack(Int_t done, Int_t parent, Int_t pdg,
37                       Double_t px, Double_t py, Double_t pz, Double_t e,
38                       Double_t vx, Double_t vy, Double_t vz, Double_t tof,
39                       Double_t polx, Double_t poly, Double_t polz,
40                       TMCProcess mech, Int_t &ntr, Double_t weight,
41                       Int_t is);
42     virtual TParticle* GetNextTrack(Int_t& track);
43     virtual TParticle* GetPrimaryForTracking(Int_t i);    
44
45     void  MakeTree(Int_t event, const char *file);
46     void  BeginEvent(Int_t event);
47     void  FinishRun();
48     Bool_t GetEvent(Int_t nevent);
49     void  PurifyKine();
50     void  FinishEvent();
51     void  FlagTrack(Int_t track);
52     void  KeepTrack(Int_t itrack); 
53     void  Reset(Int_t size = 0);
54     void  DumpPart(Int_t i) const;
55     void  DumpPStack ();
56     void  DumpLoadedStack () const;
57
58     // set methods
59     void  SetNtrack(Int_t ntrack);
60     virtual void  SetCurrentTrack(Int_t track);                           
61     void  SetHighWaterMark(Int_t hgwmk);    
62     // get methods
63     virtual Int_t GetNtrack() const;
64     Int_t       GetNprimary() const;
65     virtual Int_t CurrentTrack() const;
66     TObjArray*  Particles() const;
67     TParticle*  Particle(Int_t id);
68     Int_t       GetPrimary(Int_t id);
69     TTree*      TreeK() const {return fTreeK;}
70     TParticle*  ParticleFromTreeK(Int_t id) const;
71     Int_t       TreeKEntry(Int_t id) const;
72     
73   protected:
74     // methods
75     void  CleanParents();
76     void  ResetArrays(Int_t size);
77     TParticle* GetNextParticle();
78     Bool_t KeepPhysics(TParticle* part);
79     
80   private:
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