19 #include "Geant4/G4WrapperProcess.hh" 20 #include "Geant4/G4VParticleChange.hh" 22 #include "Geant4/G4SDManager.hh" 23 #include "Geant4/G4RunManager.hh" 24 #include "Geant4/G4Event.hh" 25 #include "Geant4/G4HCofThisEvent.hh" 26 #include "Geant4/G4Track.hh" 27 #include "Geant4/G4Step.hh" 28 #include "Geant4/G4TrackStatus.hh" 29 #include "Geant4/G4ParticleDefinition.hh" 30 #include "Geant4/G4ParticleTypes.hh" 31 #include "Geant4/Randomize.hh" 32 #include "Geant4/G4KaonZeroLong.hh" 33 #include "Geant4/G4ios.hh" 43 G4VParticleChange* particleChange =
new G4VParticleChange();
45 std::vector<G4Track*> secondaries;
51 for (
unsigned int ii=0; ii<(
unsigned int)
fNSplit; ii++) {
52 particleChange = pRegProcess->PostStepDoIt(track, step);
54 throw std::runtime_error(
"MuNuclearSplittingProcess::PostStepDoIt(): no particle change");
56 G4int numSec(particleChange->GetNumberOfSecondaries());
57 for (j=0; j<numSec; j++)
59 G4Track* newSec =
new G4Track(*(particleChange->GetSecondary(j)));
60 G4String pdgstr = newSec->GetParticleDefinition()->GetParticleName();
61 G4double ke = newSec->GetKineticEnergy()/
CLHEP::GeV;
62 G4int
pdg = newSec->GetParticleDefinition()->GetPDGEncoding();
63 if (
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
67 if (pdg==G4KaonZeroShort::KaonZeroShort()->GetPDGEncoding()&&G4UniformRand()<0.50)
69 pdg = G4KaonZeroLong::KaonZeroLong()->GetPDGEncoding();
70 pdgstr = G4KaonZeroLong::KaonZeroLong()->GetParticleName();
71 G4LorentzVector pK0L(newSec->GetMomentum(),TMath::Sqrt(TMath::Power(G4KaonZeroLong::KaonZeroLong()->GetPDGMass(),2)+TMath::Power(newSec->GetMomentum().mag(),2)));
72 G4DynamicParticle *newK0L =
new G4DynamicParticle(G4KaonZeroLong::KaonZeroLong(),pK0L);
74 G4Track* newSecK0L =
new G4Track(newK0L,track.GetGlobalTime(),track.GetPosition());
75 secondaries.push_back(newSecK0L);
79 secondaries.push_back(newSec);
82 if (
abs(pdg)==130 ||
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122)
86 std::cout <<
"MuNuclSplProc: Creating " << pdgstr <<
" of Kinetic Energy " << ke <<
" GeV. numSec is " << j <<
std::endl;
93 particleChange->SetNumberOfSecondaries(secondaries.size());
94 particleChange->SetSecondaryWeightByProcess(
true);
97 while (iter != secondaries.end()) {
98 G4Track* myTrack = *iter;
99 G4String pdgstr = myTrack->GetParticleDefinition()->GetParticleName();
101 G4int
pdg = myTrack->GetParticleDefinition()->GetPDGEncoding();
102 if (
abs(pdg)==130 ||
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
105 myTrack->SetWeight(weight);
106 particleChange->AddSecondary(myTrack);
109 return particleChange;
static constexpr double GeV
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)
General GArSoft Utilities.
QTextStream & endl(QTextStream &s)