19#include <TClonesArray.h>
23#include "Ex03MCStack.h"
33 : fParticles(0), fCurrentTrack(-1), fNPrimary(0)
38 fParticles =
new TClonesArray(
"TParticle", size);
62 Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy,
63 Double_t vz, Double_t tof, Double_t polx, Double_t poly, Double_t polz,
64 TMCProcess mech, Int_t& ntr, Double_t weight, Int_t is)
89 const Int_t kFirstDaughter = -1;
90 const Int_t kLastDaughter = -1;
94 TParticle* particle =
new (particlesRef[trackId]) TParticle(pdg, is, parent,
95 trackId, kFirstDaughter, kLastDaughter, px, py, pz, e, vx, vy, vz, tof);
97 particle->SetPolarisation(polx, poly, polz);
98 particle->SetWeight(weight);
99 particle->SetUniqueID(mech);
103 if (toBeDone)
fStack.push(particle);
116 if (
fStack.empty())
return 0;
118 TParticle* particle =
fStack.top();
121 if (!particle)
return 0;
137 Fatal(
"GetPrimaryForTracking",
"Index out of range");
147 cout <<
"Ex03MCStack Info " << endl;
148 cout <<
"Total number of particles: " <<
GetNtrack() << endl;
149 cout <<
"Number of primary particles: " <<
GetNprimary() << endl;
197 Warning(
"GetCurrentTrack",
"Current track not found in the stack");
218 return current->GetFirstMother();
229 if (id < 0 || id >=
fParticles->GetEntriesFast())
230 Fatal(
"GetParticle",
"Index out of range");
Implementation of the TVirtualMCStack interface.
virtual TParticle * PopNextTrack(Int_t &track)
virtual void SetCurrentTrack(Int_t track)
virtual TParticle * PopPrimaryForTracking(Int_t i)
virtual TParticle * GetCurrentTrack() const
virtual void PushTrack(Int_t toBeDone, Int_t parent, Int_t pdg, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t tof, Double_t polx, Double_t poly, Double_t polz, TMCProcess mech, Int_t &ntr, Double_t weight, Int_t is)
virtual Int_t GetNtrack() const
virtual Int_t GetCurrentTrackNumber() const
virtual void Print(Option_t *option="") const
Int_t fCurrentTrack
The current track number.
std::stack< TParticle * > fStack
The stack of particles (transient)
TClonesArray * fParticles
The array of particle (persistent)
virtual Int_t GetNprimary() const
virtual Int_t GetCurrentParentTrackNumber() const
TParticle * GetParticle(Int_t id) const
Int_t fNPrimary
The number of primaries.