34 #include "Geant4/G4DynamicParticle.hh" 35 #include "Geant4/G4ParticleTable.hh" 36 #include "Geant4/G4Track.hh" 37 #include "Geant4/G4SystemOfUnits.hh" 47 : G4VExtDecayer(
"Py8Decayer"),
53 fDecayer =
new Pythia(
"../share/Pythia8/xmldoc",
false );
57 fDecayer->readString(
"ProcessLevel:all = off");
59 fDecayer->readString(
"ProcessLevel:resonanceDecays=on");
63 fDecayer->readString(
"Init:showAllSettings=false");
64 fDecayer->readString(
"Init:showChangedSettings=false");
65 fDecayer->readString(
"Init:showAllParticleData=false");
66 fDecayer->readString(
"Init:showChangedParticleData=false");
72 fDecayer->readString(
"Next:numberShowProcess = 0" );
78 if (
const char* env_nShowEvent = std::getenv(
"PY8_NSHOWEVENT")) {
79 nShowEvent = std::atoi(env_nShowEvent);
80 G4cout <<
"=====> set pythia8 Next:numberShowEvent to " 81 << nShowEvent <<
" (" << env_nShowEvent <<
")" << G4endl;
85 s <<
"Next:numberShowEvent = " << nShowEvent;
87 fDecayer->readString( s.str().c_str() );
96 fDecayer->readString(
"111:onMode = off");
115 G4DecayProducts* dproducts =
nullptr;
117 G4ParticleDefinition* pd = track.GetDefinition();
118 int pdgid = pd->GetPDGEncoding();
122 if ( !
fDecayer->particleData.findParticle( pdgid ) )
124 G4cout <<
" can NOT find pdgid = " << pdgid
125 <<
" in Pythia8::ParticleData" << G4endl;
129 if ( !
fDecayer->particleData.canDecay(pdgid) )
131 G4cout <<
" Particle of pdgid = " << pdgid
132 <<
" can NOT be decayed by Pythia8" << G4endl;
138 fDecayer->event.append( pdgid, 1, 0, 0,
139 track.GetMomentum().x() / CLHEP::GeV,
140 track.GetMomentum().y() / CLHEP::GeV,
141 track.GetMomentum().z() / CLHEP::GeV,
142 track.GetDynamicParticle()->GetTotalEnergy() / CLHEP::GeV,
143 pd->GetPDGMass() / CLHEP::GeV );
153 round( std::cos( track.GetPolarization().angle( track.GetMomentumDirection() ) )
157 int npart_before_decay =
fDecayer->event.size();
161 int npart_after_decay =
fDecayer->event.size();
165 dproducts =
new G4DecayProducts(*(track.GetDynamicParticle()));
170 for (
int ip=npart_before_decay; ip<npart_after_decay; ++ip )
180 if (
fDecayer->event[ip].status() < 0 )
continue;
185 G4ParticleDefinition* pddec =
186 G4ParticleTable::GetParticleTable()->FindParticle(
fDecayer->event[ip].id() );
187 if ( !pddec )
continue;
188 G4ThreeVector momentum = G4ThreeVector(
fDecayer->event[ip].px() * CLHEP::GeV,
189 fDecayer->event[ip].py() * CLHEP::GeV,
190 fDecayer->event[ip].pz() * CLHEP::GeV );
191 dproducts->PushProducts(
new G4DynamicParticle( pddec, momentum) );
virtual G4DecayProducts * ImportDecayProducts(const G4Track &)
Pythia8::Pythia * fDecayer