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/G4Track.hh>
47 #include <Geant4/G4VExtDecayer.hh>
49 #include <CLHEP/Vector/LorentzVector.h>
60 : G4VExtDecayer(
"G4Pythia6Decayer")
63 , fDecayType(fgkDefaultDecayType)
64 , fDecayProductsArray(0)
94 G4int pdgEncoding = particle->
fKF;
95 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
96 G4ParticleDefinition* particleDefinition = 0;
98 particleDefinition = particleTable->FindParticle(pdgEncoding);
100 if (particleDefinition == 0 && warn)
103 <<
"G4Pythia6Decayer: GetParticleDefinition: " << std::endl
104 <<
"G4ParticleTable::FindParticle() for particle with PDG = "
106 <<
" failed." << std::endl;
109 return particleDefinition;
121 if (!particleDefinition)
return 0;
126 G4DynamicParticle* dynamicParticle =
new G4DynamicParticle(particleDefinition, momentum);
128 return dynamicParticle;
164 for (G4int i = 1; i <= 5; i++)
178 G4int kc = pythia6->
Pycomp(particle);
181 G4int ifirst = pythia6->
GetMDCY(kc, 2);
182 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
186 for (G4int channel = ifirst; channel <= ilast; channel++)
190 pythia6->
SetMDME(channel, 1, 1);
194 pythia6->
SetMDME(channel, 1, 0);
202 G4int* mult, G4int
npart)
208 G4int kc = pythia6->
Pycomp(particle);
210 G4int ifirst = pythia6->
GetMDCY(kc, 2);
211 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
214 for (G4int channel = ifirst; channel <= ilast; channel++)
217 for (G4int i = 0; i <
npart; i++)
220 pythia6->
SetMDME(channel, 1, 1);
223 pythia6->
SetMDME(channel, 1, 0);
234 const G4int kNHadrons = 4;
236 G4int hadron[kNHadrons] = {411, 421, 431, 4112};
240 G4int iKstarbar0 = -313;
242 G4int iKMinus = -321;
244 G4int iPiMinus = -211;
246 G4int products[2] = {iKPlus, iPiMinus}, mult[2] = {1, 1};
253 G4int decayP1[kNHadrons][3] = {
254 {iKMinus, iPiPlus, iPiPlus},
255 {iKMinus, iPiPlus, 0},
256 {iKPlus, iKstarbar0, 0},
258 G4int decayP2[kNHadrons][3] = {
259 {iKstarbar0, iPiPlus, 0},
265 for (G4int ihadron = 0; ihadron < kNHadrons; ihadron++)
267 G4int kc = pythia6->
Pycomp(hadron[ihadron]);
269 G4int ifirst = pythia6->
GetMDCY(kc, 2);
270 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
272 for (channel = ifirst; channel <= ilast; channel++)
274 if ((pythia6->
GetKFDP(channel, 1) == decayP1[ihadron][0] &&
275 pythia6->
GetKFDP(channel, 2) == decayP1[ihadron][1] &&
276 pythia6->
GetKFDP(channel, 3) == decayP1[ihadron][2] &&
277 pythia6->
GetKFDP(channel, 4) == 0) ||
278 (pythia6->
GetKFDP(channel, 1) == decayP2[ihadron][0] &&
279 pythia6->
GetKFDP(channel, 2) == decayP2[ihadron][1] &&
280 pythia6->
GetKFDP(channel, 3) == decayP2[ihadron][2] &&
281 pythia6->
GetKFDP(channel, 4) == 0))
283 pythia6->
SetMDME(channel, 1, 1);
287 pythia6->
SetMDME(channel, 1, 0);
301 G4int iLambda0 = 3122;
302 G4int iKMinus = -321;
304 G4int kc = pythia6->
Pycomp(3334);
306 G4int ifirst = pythia6->
GetMDCY(kc, 2);
307 G4int ilast = ifirst + pythia6->
GetMDCY(kc, 3) - 1;
309 for (G4int channel = ifirst; channel <= ilast; channel++)
311 if (pythia6->
GetKFDP(channel, 1) == iLambda0 &&
312 pythia6->
GetKFDP(channel, 2) == iKMinus &&
313 pythia6->
GetKFDP(channel, 3) == 0)
314 pythia6->
SetMDME(channel, 1, 1);
316 pythia6->
SetMDME(channel, 1, 0);
341 products[2] = 100443;
425 products[1] = 100443;
554 G4ThreeVector
momentum = track.GetMomentum();
555 G4double etot = track.GetDynamicParticle()->GetTotalEnergy();
557 CLHEP::HepLorentzVector
p;
558 p[0] = momentum.x() /
GeV;
559 p[1] = momentum.y() /
GeV;
560 p[2] = momentum.z() /
GeV;
567 G4ParticleDefinition* particleDef = track.GetDefinition();
568 G4int pdgEncoding = particleDef->GetPDGEncoding();
572 Decay(pdgEncoding, p);
577 std::cout <<
"nofParticles: " << nofParticles << std::endl;
582 G4DecayProducts* decayProducts =
new G4DecayProducts(*(track.GetDynamicParticle()));
585 for (G4int i = 0; i < nofParticles; i++)
590 G4int status = particle->
fKS;
591 G4int
pdg = particle->
fKF;
592 if (status > 0 && status < 11 &&
600 std::cout <<
" " << i <<
"th particle PDG: " << pdg <<
" ";
610 std::cout <<
" G4 particle name: "
611 << dynamicParticle->GetDefinition()->GetParticleName()
616 decayProducts->PushProducts(dynamicParticle);
624 std::cout <<
"nofParticles for tracking: " << counter << std::endl;
627 return decayProducts;