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