39 G4VParticleChange* particleChange =
new G4VParticleChange();
41 std::vector<G4Track*> secondaries;
47 for (
unsigned int ii=0; ii<(
unsigned int)
fNSplit; ii++) {
48 particleChange = pRegProcess->PostStepDoIt(
track, step);
50 throw std::runtime_error(
"MuNuclearSplittingProcess::PostStepDoIt(): no particle change");
52 G4int numSec(particleChange->GetNumberOfSecondaries());
53 for (j=0; j<numSec; j++)
55 G4Track* newSec =
new G4Track(*(particleChange->GetSecondary(j)));
56 G4String pdgstr = newSec->GetParticleDefinition()->GetParticleName();
57 G4double ke = newSec->GetKineticEnergy()/
CLHEP::GeV;
58 G4int
pdg = newSec->GetParticleDefinition()->GetPDGEncoding();
59 if (
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
63 if (pdg==G4KaonZeroShort::KaonZeroShort()->GetPDGEncoding()&&G4UniformRand()<0.50)
65 pdg = G4KaonZeroLong::KaonZeroLong()->GetPDGEncoding();
66 pdgstr = G4KaonZeroLong::KaonZeroLong()->GetParticleName();
67 G4LorentzVector pK0L(newSec->GetMomentum(),
TMath::Sqrt(TMath::Power(G4KaonZeroLong::KaonZeroLong()->GetPDGMass(),2)+TMath::Power(newSec->GetMomentum().mag(),2)));
68 G4DynamicParticle *newK0L =
new G4DynamicParticle(G4KaonZeroLong::KaonZeroLong(),pK0L);
70 G4Track* newSecK0L =
new G4Track(newK0L,
track.GetGlobalTime(),
track.GetPosition());
71 secondaries.push_back(newSecK0L);
75 secondaries.push_back(newSec);
78 if (
abs(pdg)==130 ||
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122)
82 std::cout <<
"MuNuclSplProc: Creating " << pdgstr <<
" of Kinetic Energy " << ke <<
" GeV. numSec is " << j << std::endl;
89 particleChange->SetNumberOfSecondaries(secondaries.size());
90 particleChange->SetSecondaryWeightByProcess(
true);
92 std::vector<G4Track*>::iterator iter = secondaries.begin();
93 while (iter != secondaries.end()) {
94 G4Track* myTrack = *iter;
95 G4String pdgstr = myTrack->GetParticleDefinition()->GetParticleName();
97 G4int pdg = myTrack->GetParticleDefinition()->GetPDGEncoding();
98 if (
abs(pdg)==130 ||
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
101 myTrack->SetWeight(weight);
102 particleChange->AddSecondary(myTrack);
105 return particleChange;
util::quantities::gigaelectronvolt GeV
process_name use argoneut_mc_hitfinder track
Var Sqrt(const Var &v)
Use to take sqrt of a var.
BEGIN_PROLOG could also be cout