1 #include "StarPythia8Decayer.h"
2 #include "TLorentzVector.h"
5 #include "StarGenerator/UTIL/StarRandom.h"
9 #include "ParticleData.h"
11 #ifndef Pythia8_version
12 #error "Pythia8_version is not defined"
15 using namespace Pythia8;
32 if ( mPythia )
return;
34 TString path =
"StRoot/StarGenerator/"; path+= Pythia8_version; path+=
"/xmldoc/";
37 if (!in.good()) { path =
"$(STAR)/"+path; }
38 path = gSystem->ExpandPathName(path.Data());
41 Info(GetName(),Form(
"MC version is %s data at %s",Pythia8_version,path.Data()));
42 Info(GetName(),Form(
"Configuration files at %s",path.Data()));
45 mPythia -> setRndmEnginePtr(
new PyRand() );
47 mPythia -> readString(
"ProcessLevel:all = off");
48 mPythia -> readString(
"Check:event = off");
56 mPythia->init( 2112, 2112, mRootS );
63 LOG_INFO <<
"Decay pdgid=" << pdgid << endm;
75 if ( mDebug ) mPythia->event.list();
82 TClonesArray &array = *_array;
87 for (
int i=0; i<mPythia->event.size();i++ )
90 new(array[nparts++]) TParticle (
91 mPythia->event[i].id(),
92 mPythia->event[i].status(),
93 mPythia->event[i].mother1(),
94 mPythia->event[i].mother2(),
95 mPythia->event[i].daughter1(),
96 mPythia->event[i].daughter2(),
97 mPythia->event[i].px(),
98 mPythia->event[i].py(),
99 mPythia->event[i].pz(),
100 mPythia->event[i].e(),
101 mPythia->event[i].xProd(),
102 mPythia->event[i].yProd(),
103 mPythia->event[i].zProd(),
104 mPythia->event[i].tProd());
110 void StarPythia8Decayer::SetForceDecay(
int type ){ assert(0); }
111 void StarPythia8Decayer::ForceDecay(){ assert(0); }
113 void StarPythia8Decayer::ReadDecayTable(){ assert(0); }
118 return (mPythia->particleData.tau0(pdg) * 3.3333e-12) ;
124 const int status = 23;
126 double pt2 = p->Perp2();
133 const auto* pde = mPythia->particleData.particleDataEntryPtr( pdg );
135 M2 = pde->m0() * pde->m0();
138 double E = TMath::Sqrt( pt2 + M2 + pz*pz );
140 mPythia->event.append(pdg, status, 0, 0, px, py, pz, E, TMath::Sqrt(M2) );
145 mPythia->event.reset();
150 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.