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 TString path =
"StRoot/StarGenerator/"; path+= Pythia8_version; path+=
"/share/Pythia8/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() );
45 mPythia -> readString(
"ProcessLevel:all = off");
46 mPythia -> readString(
"Check:event = off");
53 #define Set(x) mPythia -> readString(x)
54 Set(
"Beams:idA=2112");
55 Set(
"Beams:idB=2112");
56 Set(
"Beams:frameType=1");
57 Set(Form(
"Beams:eCM=%f",mRootS));
65 LOG_INFO <<
"Decay pdgid=" << pdgid << endm;
77 if ( mDebug ) mPythia->event.list();
84 TClonesArray &array = *_array;
89 for (
int i=0; i<mPythia->event.size();i++ )
92 new(array[nparts++]) TParticle (
93 mPythia->event[i].id(),
94 mPythia->event[i].status(),
95 mPythia->event[i].mother1(),
96 mPythia->event[i].mother2(),
97 mPythia->event[i].daughter1(),
98 mPythia->event[i].daughter2(),
99 mPythia->event[i].px(),
100 mPythia->event[i].py(),
101 mPythia->event[i].pz(),
102 mPythia->event[i].e(),
103 mPythia->event[i].xProd(),
104 mPythia->event[i].yProd(),
105 mPythia->event[i].zProd(),
106 mPythia->event[i].tProd());
112 void StarPythia8Decayer::SetForceDecay(
int type ){ assert(0); }
113 void StarPythia8Decayer::ForceDecay(){ assert(0); }
115 void StarPythia8Decayer::ReadDecayTable(){ assert(0); }
120 return (mPythia->particleData.tau0(pdg) * 3.3333e-12) ;
126 const int status = 23;
128 double pt2 = p->Perp2();
135 const auto* pde = mPythia->particleData.particleDataEntryPtr( pdg );
137 M2 = pde->m0() * pde->m0();
140 double E = TMath::Sqrt( pt2 + M2 + pz*pz );
142 mPythia->event.append(pdg, status, 0, 0, px, py, pz, E, TMath::Sqrt(M2) );
147 mPythia->event.reset();
152 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 Set(const char *cmd)
Modify pythia8 behavior.
void Decay(int pdg, TLorentzVector *p=0)
Decays the particle specified by PDG id and lorentz vector.