1 #include "StarPythia8Decayer.h"
2 #include "TLorentzVector.h"
5 #include "StarGenerator/UTIL/StarRandom.h"
8 #include "ParticleData.h"
10 #ifndef Pythia8_version
11 #error "Pythia8_version is not defined"
32 TString path =
"StRoot/StarGenerator/"; path+= Pythia8_version; path+=
"/xmldoc/";
35 if (!in.good()) { path =
"$(STAR)/"+path; }
36 path = gSystem->ExpandPathName(path.Data());
39 Info(GetName(),Form(
"MC version is %s data at %s",Pythia8_version,path.Data()));
40 Info(GetName(),Form(
"Configuration files at %s",path.Data()));
43 mPythia -> setRndmEnginePtr(
new PyRand() );
44 mPythia->readString(
"SoftQCD:elastic = on");
47 mPythia->init( 2212, 2212, 510.0 );
59 LOG_INFO <<
"Decay pdgid=" << pdgid << endm;
66 int id = mPythia ->
event[0].id();
67 mPythia->particleData.mayDecay(
id,
true );
68 mPythia->moreDecays();
70 if ( mDebug ) mPythia->event.list();
77 TClonesArray &array = *_array;
82 for (
int i=0; i<mPythia->event.size();i++ )
85 new(array[nparts++]) TParticle (
86 mPythia->event[i].id(),
87 mPythia->event[i].status(),
88 mPythia->event[i].mother1(),
89 mPythia->event[i].mother2(),
90 mPythia->event[i].daughter1(),
91 mPythia->event[i].daughter2(),
92 mPythia->event[i].px(),
93 mPythia->event[i].py(),
94 mPythia->event[i].pz(),
95 mPythia->event[i].e(),
96 mPythia->event[i].xProd(),
97 mPythia->event[i].yProd(),
98 mPythia->event[i].zProd(),
99 mPythia->event[i].tProd());
105 void StarPythia8Decayer::SetForceDecay(
int type ){ assert(0); }
106 void StarPythia8Decayer::ForceDecay(){ assert(0); }
108 void StarPythia8Decayer::ReadDecayTable(){ assert(0); }
113 return (mPythia->particleData.tau0(pdg) * 3.3333e-12) ;
119 const int status = 11;
121 double pt2 = p->Perp2();
128 const auto* pde = mPythia->particleData.particleDataEntryPtr( pdg );
130 M2 = pde->m0() * pde->m0();
133 double E = TMath::Sqrt( pt2 + M2 + pz*pz );
135 mPythia->event.append(pdg, status, 0, 0, px, py, pz, E, TMath::Sqrt(M2) );
140 mPythia->event.clear();
145 if (mPythia)
delete mPythia;
static StarRandom & Instance()
Obtain the single instance of the random number generator.
float GetPartialBranchingRatio(int pdgid)
Return the branching ratio for the spdcified PDG ID.
~StarPythia8Decayer()
Class destructor.
int ImportParticles(TClonesArray *array=0)
Returns the decay products in a TClonesArray of TParticle.
Double_t flat() const
Return a random number uniformly distributed between 0 and 1.
void Init()
Initializes the decayer.
StarPythia8Decayer()
Class constructor.
void AppendParticle(int pdgid, TLorentzVector *p=0)
Add a particle with specified PDG ID to the stack.
void ClearEvent()
Clear the event.
float GetLifetime(int pdgid)
Return teh lifetime in seconds for the specified particle.
void Decay(int pdg, TLorentzVector *p=0)
Decays the particle specified by PDG id and lorentz vector.