23 #include "Geant4/G4DynamicParticle.hh"
24 #include "Geant4/G4KaonZeroShort.hh"
25 #include "Geant4/G4LorentzVector.hh"
26 #include "Geant4/G4ParticleChange.hh"
27 #include "Geant4/G4String.hh"
28 #include "Geant4/G4ThreeVector.hh"
29 #include "Geant4/G4VParticleChange.hh"
30 #include "Geant4/G4Track.hh"
31 #include "Geant4/G4Step.hh"
32 #include "Geant4/G4ParticleDefinition.hh"
33 #include "Geant4/Randomize.hh"
34 #include "Geant4/G4KaonZeroLong.hh"
35 #include "Geant4/G4ios.hh"
37 #include "cetlib_except/exception.h"
48 G4VParticleChange* pChange = pRegProcess->PostStepDoIt( track, step );
49 pChange->SetVerboseLevel(0);
50 pChange->SetSecondaryWeightByProcess(
true);
52 G4double secWeight = 1.0;
54 std::vector<G4Track*> secondaries;
60 G4double
s = step.GetStepLength();
61 G4double
x = pRegProcess->GetCurrentInteractionLength();
62 nw = pChange->GetParentWeight();
67 if (
wc < 1.0
e-10)
wc = 1.0;
69 G4cout <<
" MNSPXSB.PostStepDoit(): original wt = " << pChange->GetParentWeight() <<
" eF = " <<
eFactor << G4endl;
70 G4cout <<
" MNSPXSB.PostStepDoit(): New weight = " << nw <<
" wc = " <<
wc <<
" s= " << s <<
" x = " << x << G4endl;
71 ((G4ParticleChange*)pChange)->ProposeParentWeight(nw) ;
76 ((G4ParticleChange*)pChange)->ProposeParentWeight(nw) ;
83 pChange->SetNumberOfSecondaries(pChange->GetNumberOfSecondaries()+1);
84 G4ThreeVector mDirection = track.GetDynamicParticle()->GetMomentumDirection();
85 G4DynamicParticle* aD =
new G4DynamicParticle((track.GetDynamicParticle())->GetDefinition(),
86 G4LorentzVector(mDirection,
87 (track.GetDynamicParticle())->GetKineticEnergy()+step.GetTotalEnergyDeposit()));
88 G4Track* secTrk =
new G4Track(aD,step.GetDeltaTime(),step.GetDeltaPosition());
89 pChange->AddSecondary(secTrk);
90 pChange->GetSecondary(pChange->GetNumberOfSecondaries()-1)->
95 nw = track.GetWeight();
96 pChange->ProposeParentWeight(nw);
100 secWeight = secWeight*nw;
106 G4VParticleChange* particleChange =
new G4VParticleChange();
108 for (
unsigned int ii=0; ii<(
unsigned int)
fNSplit; ii++) {
109 particleChange = pRegProcess->PostStepDoIt(track, step);
111 throw std::runtime_error(
"MuNuclearSplittingProcessXSecBias::PostStepDoIt(): no particle change");
113 G4int numSec(particleChange->GetNumberOfSecondaries());
115 for (j=0; j<numSec; j++)
117 G4Track* newSec =
new G4Track(*(particleChange->GetSecondary(j)));
118 G4String pdgstr = newSec->GetParticleDefinition()->GetParticleName();
120 G4int
pdg = newSec->GetParticleDefinition()->GetPDGEncoding();
121 if (
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
125 if (pdg==G4KaonZeroShort::KaonZeroShort()->GetPDGEncoding()&&G4UniformRand()<0.50)
127 pdg = G4KaonZeroLong::KaonZeroLong()->GetPDGEncoding();
128 pdgstr = G4KaonZeroLong::KaonZeroLong()->GetParticleName();
129 G4LorentzVector pK0L(newSec->GetMomentum(),
TMath::Sqrt(TMath::Power(G4KaonZeroLong::KaonZeroLong()->GetPDGMass(),2)+TMath::Power(newSec->GetMomentum().mag(),2)));
130 G4DynamicParticle *newK0L =
new G4DynamicParticle(G4KaonZeroLong::KaonZeroLong(),pK0L);
132 G4Track* newSecK0L =
new G4Track(newK0L,track.GetGlobalTime(),track.GetPosition());
133 secondaries.push_back(newSecK0L);
137 secondaries.push_back(newSec);
143 pChange->SetNumberOfSecondaries(secondaries.size());
144 pChange->SetSecondaryWeightByProcess(
true);
148 std::vector<G4Track*>::iterator iter = secondaries.begin();
149 while (iter != secondaries.end()) {
150 G4Track* myTrack = *iter;
151 G4String pdgstr = myTrack->GetParticleDefinition()->GetParticleName();
152 G4double ke = myTrack->GetKineticEnergy()/
CLHEP::GeV;
153 G4int
pdg = myTrack->GetParticleDefinition()->GetPDGEncoding();
154 if (
abs(pdg)==130 ||
abs(pdg)==310 ||
abs(pdg)==311 ||
abs(pdg)==3122 ||
abs(pdg)==2112)
157 std::cout <<
"MuNuclSplXSB(): Adding " << pdgstr <<
" of Kinetic Energy and weight " << ke <<
" GeV and " << secWeight <<
"." << std::endl;
159 myTrack->SetWeight(secWeight);
160 pChange->AddSecondary(myTrack);
169 const G4Track&
track,
183 G4VParticleChange* pC =
new G4VParticleChange();
184 pC->Initialize(track);
188 pC->ProposeParentWeight(nw) ;
189 for (G4int i = 0; i < pC->GetNumberOfSecondaries(); i++)
190 pC->GetSecondary(i)->SetWeight(nw);
194 pC->SetNumberOfSecondaries(pC->GetNumberOfSecondaries()+1);
195 G4ThreeVector mDirection = track.GetDynamicParticle()->GetMomentumDirection();
196 G4DynamicParticle* aD =
new G4DynamicParticle((track.GetDynamicParticle())->GetDefinition(),
197 G4LorentzVector(mDirection,
198 (track.GetDynamicParticle())->GetKineticEnergy()+step.GetTotalEnergyDeposit()));
199 G4Track* secTrk =
new G4Track(aD,track.GetGlobalTime(),track.GetPosition());
200 secTrk->SetGoodForTrackingFlag(
true);
201 pC->AddSecondary(secTrk);
211 G4double
s = step.GetStepLength();
212 G4double
x = pRegProcess->GetCurrentInteractionLength();
228 throw cet::exception(
"Incorrectly set Bias Mode. ")
229 <<
"Set XBiasMode to 0 or 1. " <<
xBiasMode <<
" not allowed!\n";
240 G4double biasedProbability = 1.-
std::exp(-nLTraversed);
242 result = (biasedProbability-realProbability)/biasedProbability;
258 -G4VProcess::theNumberOfInteractionLengthLeft;
263 G4double previousStepSize,
264 G4ForceCondition* condition )
271 G4double psgPIL = (1./
eFactor) * pRegProcess->PostStepGetPhysicalInteractionLength(
278 return pRegProcess->PostStepGetPhysicalInteractionLength(
287 G4double previousStepSize,
288 G4double currentMinimumStep,
289 G4double& proposedSafety,
290 G4GPILSelection* selection )
299 pRegProcess->AlongStepGetPhysicalInteractionLength( track,previousStepSize,
300 currentMinimumStep,proposedSafety,selection);
301 if (intLen<0)
return currentMinimumStep;
util::quantities::gigaelectronvolt GeV
G4VParticleChange fParticleChange
process_name opflash particleana ie x
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
process_name use argoneut_mc_hitfinder track
Check of Geant4 to run the LArSoft detector simulation.
G4double GetTotalNumberOfInteractionLengthTraversed()
G4double XBiasSurvivalProbability()
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
G4double XBiasSecondaryWeight()
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &step)
Var Sqrt(const Var &v)
Use to take sqrt of a var.
then echo File list $list not found else cat $list while read file do echo $file sed s
G4double theInitialNumberOfInteractionLength
BEGIN_PROLOG could also be cout
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step)