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" 42 G4VParticleChange* particleChange =
new G4VParticleChange();
44 std::vector<G4Track*> secondaries;
50 for (
unsigned int ii=0; ii<(
unsigned int)
fNSplit; ii++) {
51 particleChange = pRegProcess->PostStepDoIt(track, step);
53 throw std::runtime_error(
"MuNuclearSplittingProcess::PostStepDoIt(): no particle change");
55 G4int numSec(particleChange->GetNumberOfSecondaries());
56 for (j=0; j<numSec; j++)
58 G4Track* newSec =
new G4Track(*(particleChange->GetSecondary(j)));
59 G4String pdgstr = newSec->GetParticleDefinition()->GetParticleName();
60 G4double ke = newSec->GetKineticEnergy()/CLHEP::GeV;
61 G4int pdg = newSec->GetParticleDefinition()->GetPDGEncoding();
62 if (abs(pdg)==310 ||abs(pdg)==311 || abs(pdg)==3122 || abs(pdg)==2112)
66 if (pdg==G4KaonZeroShort::KaonZeroShort()->GetPDGEncoding()&&G4UniformRand()<0.50)
68 pdg = G4KaonZeroLong::KaonZeroLong()->GetPDGEncoding();
69 pdgstr = G4KaonZeroLong::KaonZeroLong()->GetParticleName();
70 G4LorentzVector pK0L(newSec->GetMomentum(),TMath::Sqrt(TMath::Power(G4KaonZeroLong::KaonZeroLong()->GetPDGMass(),2)+TMath::Power(newSec->GetMomentum().mag(),2)));
71 G4DynamicParticle *newK0L =
new G4DynamicParticle(G4KaonZeroLong::KaonZeroLong(),pK0L);
73 G4Track* newSecK0L =
new G4Track(newK0L,track.GetGlobalTime(),track.GetPosition());
74 secondaries.push_back(newSecK0L);
78 secondaries.push_back(newSec);
81 if (abs(pdg)==130 ||abs(pdg)==310 ||abs(pdg)==311 || abs(pdg)==3122)
85 std::cout <<
"MuNuclSplProc: Creating " << pdgstr <<
" of Kinetic Energy " << ke <<
" GeV. numSec is " << j << std::endl;
92 particleChange->SetNumberOfSecondaries(secondaries.size());
93 particleChange->SetSecondaryWeightByProcess(
true);
96 while (iter != secondaries.end()) {
97 G4Track* myTrack = *iter;
98 G4String pdgstr = myTrack->GetParticleDefinition()->GetParticleName();
100 G4int pdg = myTrack->GetParticleDefinition()->GetPDGEncoding();
101 if (abs(pdg)==130 ||abs(pdg)==310 ||abs(pdg)==311 || abs(pdg)==3122 || abs(pdg)==2112)
104 myTrack->SetWeight(weight);
105 particleChange->AddSecondary(myTrack);
108 return particleChange;
Check of Geant4 to run the LArSoft detector simulation.
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)