3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 // Particles stack class
9 // Implements the TMCVirtualStack of the Virtual Monte Carlo
18 #include <TClonesArray.h>
20 #include <TVirtualMCStack.h>
24 enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4, kTransportBit=BIT(14)};
26 class AliStack : public TVirtualMCStack
29 // creators, destructors
30 AliStack(Int_t size, const char* name = "");
32 AliStack(const AliStack& st);
34 AliStack& operator=(const AliStack& st)
35 {st.Copy(*this); return(*this);}
39 virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
40 const Float_t *pmom, const Float_t *vpos, const Float_t *polar,
41 Float_t tof, TMCProcess mech, Int_t &ntr,
42 Float_t weight, Int_t is);
44 virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
45 Double_t px, Double_t py, Double_t pz, Double_t e,
46 Double_t vx, Double_t vy, Double_t vz, Double_t tof,
47 Double_t polx, Double_t poly, Double_t polz,
48 TMCProcess mech, Int_t &ntr, Double_t weight,
51 virtual TParticle* PopNextTrack(Int_t& track);
52 virtual TParticle* GetCurrentTrack() const {return fCurrentTrack;}
53 virtual TParticle* PopPrimaryForTracking(Int_t i);
55 void ConnectTree(TTree* tree);
60 void FlagTrack(Int_t track);
61 void KeepTrack(Int_t itrack);
62 void Clean(Int_t size = 0);
63 void Reset(Int_t size = 0);
64 void DumpPart(Int_t i) const;
66 void DumpLoadedStack () const;
69 void SetNtrack(Int_t ntrack);
70 virtual void SetCurrentTrack(Int_t track);
71 void SetHighWaterMark(Int_t hgwmk);
73 virtual Int_t GetNtrack() const;
74 Int_t GetNprimary() const;
75 virtual Int_t GetCurrentTrackNumber() const;
76 virtual Int_t GetCurrentParentTrackNumber() const;
77 TParticle* Particle(Int_t id);
78 Int_t GetPrimary(Int_t id);
79 TTree* TreeK() const {return fTreeK;}
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) const {return fTrackLabelMap[label];}
84 Int_t* TrackLabelMap() {return fTrackLabelMap.GetArray();}
85 const TObjArray* Particles() const;
90 void ResetArrays(Int_t size);
91 TParticle* GetParticleMapEntry(Int_t id) const;
92 TParticle* GetNextParticle();
93 Bool_t KeepPhysics(const TParticle* part);
94 Bool_t IsStable(Int_t pdg) const;
96 void Copy(TObject &st) const;
99 TClonesArray fParticles; //! Pointer to list of particles
100 TObjArray fParticleMap; //! Map of particles in the supporting TClonesArray
101 TArrayI fParticleFileMap; // Map for particle ids
102 TParticle *fParticleBuffer; //! Pointer to current particle for writing
103 TParticle *fCurrentTrack; //! Pointer to particle currently transported
104 TTree *fTreeK; //! Particle stack
105 Int_t fNtrack; // Number of tracks
106 Int_t fNprimary; // Number of primaries
107 Int_t fCurrent; //! Last track returned from the stack
108 Int_t fCurrentPrimary; //! Last primary track returned from the stack
109 Int_t fHgwmk; //! Last track purified
110 Int_t fLoadPoint; //! Next free position in the particle buffer
111 TArrayI fTrackLabelMap; //! Map of track labels
112 ClassDef(AliStack,5) //Particles stack
117 inline void AliStack::SetNtrack(Int_t ntrack)
118 { fNtrack = ntrack; }
120 inline Int_t AliStack::GetNtrack() const
123 inline Int_t AliStack::GetNprimary() const
124 { return fNprimary; }
126 inline Int_t AliStack::GetCurrentTrackNumber() const
129 inline const TObjArray* AliStack::Particles() const
130 { return &fParticleMap; }
134 inline TParticle* AliStack::GetParticleMapEntry(Int_t id) const
135 { return (TParticle*) fParticleMap.At(id); }