40 #include <Geant4/G4DecayProducts.hh>
41 #include <Geant4/G4DynamicParticle.hh>
42 #include <Geant4/G4ParticleDefinition.hh>
43 #include <Geant4/G4ParticleTable.hh>
44 #include <Geant4/G4String.hh>
45 #include <Geant4/G4SystemOfUnits.hh>
46 #include <Geant4/G4ThreeVector.hh>
47 #include <Geant4/G4Track.hh>
48 #include <Geant4/G4Types.hh>
49 #include <Geant4/G4VExtDecayer.hh>
51 #include <CLHEP/Vector/LorentzVector.h>
62 : G4VExtDecayer(
"G4Pythia6Decayer")
65 , fDecayType(fgkDefaultDecayType)
66 , fDecayProductsArray(nullptr)
96 G4int pdgEncoding = particle->
fKF;
97 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
98 G4ParticleDefinition* particleDefinition =
nullptr;
101 particleDefinition = particleTable->FindParticle(pdgEncoding);
104 if (particleDefinition ==
nullptr && warn)
107 <<
"G4Pythia6Decayer: GetParticleDefinition: " << std::endl
108 <<
"G4ParticleTable::FindParticle() for particle with PDG = "
110 <<
" failed." << std::endl;
113 return particleDefinition;
125 if (!particleDefinition)
133 G4DynamicParticle* dynamicParticle =
new G4DynamicParticle(particleDefinition, momentum);
135 return dynamicParticle;
171 for (G4int
i = 1;
i <= 5;
i++)
189 G4int kc = pythia6->
Pycomp(particle);
192 G4int ifirst = pythia6->
GetMDCY(kc, 2);
193 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
213 G4int* mult, G4int
npart)
219 G4int kc = pythia6->
Pycomp(particle);
221 G4int ifirst = pythia6->
GetMDCY(kc, 2);
222 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
249 const G4int kNHadrons = 4;
251 G4int hadron[kNHadrons] = {411, 421, 431, 4112};
255 G4int iKstarbar0 = -313;
257 G4int iKMinus = -321;
259 G4int iPiMinus = -211;
261 G4int products[2] = {iKPlus, iPiMinus}, mult[2] = {1, 1};
268 G4int decayP1[kNHadrons][3] = {
269 {iKMinus, iPiPlus, iPiPlus},
270 {iKMinus, iPiPlus, 0},
271 {iKPlus, iKstarbar0, 0},
273 G4int decayP2[kNHadrons][3] = {
274 {iKstarbar0, iPiPlus, 0},
280 for (G4int ihadron = 0; ihadron < kNHadrons; ihadron++)
282 G4int kc = pythia6->
Pycomp(hadron[ihadron]);
284 G4int ifirst = pythia6->
GetMDCY(kc, 2);
285 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
287 for (channel = ifirst; channel <= ilast; channel++)
289 if ((pythia6->
GetKFDP(channel, 1) == decayP1[ihadron][0] &&
290 pythia6->
GetKFDP(channel, 2) == decayP1[ihadron][1] &&
291 pythia6->
GetKFDP(channel, 3) == decayP1[ihadron][2] &&
292 pythia6->
GetKFDP(channel, 4) == 0) ||
293 (pythia6->
GetKFDP(channel, 1) == decayP2[ihadron][0] &&
294 pythia6->
GetKFDP(channel, 2) == decayP2[ihadron][1] &&
295 pythia6->
GetKFDP(channel, 3) == decayP2[ihadron][2] &&
296 pythia6->
GetKFDP(channel, 4) == 0))
298 pythia6->
SetMDME(channel, 1, 1);
302 pythia6->
SetMDME(channel, 1, 0);
316 G4int iLambda0 = 3122;
317 G4int iKMinus = -321;
319 G4int kc = pythia6->
Pycomp(3334);
321 G4int ifirst = pythia6->
GetMDCY(kc, 2);
322 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
363 products[2] = 100443;
447 products[1] = 100443;
576 G4ThreeVector
momentum = track.GetMomentum();
577 G4double etot = track.GetDynamicParticle()->GetTotalEnergy();
579 CLHEP::HepLorentzVector
p;
580 p[0] = momentum.x() /
GeV;
581 p[1] = momentum.y() /
GeV;
582 p[2] = momentum.z() /
GeV;
589 G4ParticleDefinition* particleDef = track.GetDefinition();
590 G4int pdgEncoding = particleDef->GetPDGEncoding();
594 Decay(pdgEncoding, p);
599 std::cout <<
"nofParticles: " << nofParticles << std::endl;
604 G4DecayProducts* decayProducts =
new G4DecayProducts(*(track.GetDynamicParticle()));
607 for (G4int
i = 0;
i < nofParticles;
i++)
613 G4int
pdg = particle->
fKF;
614 if (status > 0 && status < 11 &&
615 std::abs(pdg) != 12 && std::abs(pdg) != 14 && std::abs(pdg) != 16)
622 std::cout <<
" " <<
i <<
"th particle PDG: " << pdg <<
" ";
632 std::cout <<
" G4 particle name: "
633 << dynamicParticle->GetDefinition()->GetParticleName()
638 decayProducts->PushProducts(dynamicParticle);
646 std::cout <<
"nofParticles for tracking: " << counter << std::endl;
649 return decayProducts;