21#include <TClonesArray.h>
25#include "Ex03MCStack.h"
35 : fParticles(0), fCurrentTrack(-1), fNPrimary(0)
40 fParticles =
new TClonesArray(
"TParticle", size);
64 Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy,
65 Double_t vz, Double_t tof, Double_t polx, Double_t poly, Double_t polz,
66 TMCProcess mech, Int_t& ntr, Double_t weight, Int_t is)
91 const Int_t kFirstDaughter = -1;
92 const Int_t kLastDaughter = -1;
96 TParticle* particle =
new (particlesRef[trackId]) TParticle(pdg, is, parent,
97 trackId, kFirstDaughter, kLastDaughter, px, py, pz, e, vx, vy, vz, tof);
99 particle->SetPolarisation(polx, poly, polz);
100 particle->SetWeight(weight);
101 particle->SetUniqueID(mech);
105 if (toBeDone)
fStack.push(particle);
118 if (
fStack.empty())
return 0;
120 TParticle* particle =
fStack.top();
123 if (!particle)
return 0;
139 Fatal(
"GetPrimaryForTracking",
"Index out of range");
149 cout <<
"Ex03MCStack Info " << endl;
150 cout <<
"Total number of particles: " <<
GetNtrack() << endl;
151 cout <<
"Number of primary particles: " <<
GetNprimary() << endl;
199 Warning(
"GetCurrentTrack",
"Current track not found in the stack");
220 return current->GetFirstMother();
231 if (id < 0 || id >=
fParticles->GetEntriesFast())
232 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.