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