11 #include "G4ParticleDefinition.hh" 12 #include "G4ParticleTypes.hh" 13 #include "G4RunManager.hh" 15 #include "G4TrajectoryContainer.hh" 16 #include "Randomize.hh" 36 if (aTrack->GetTrackID()==1) {
40 G4int IMPWEIGHT_NBINS=40;
42 G4ParticleDefinition * particleType = aTrack->GetDefinition();
43 G4double totE=aTrack->GetTotalEnergy()/CLHEP::GeV;
46 G4TrajectoryContainer* container =
47 pRunManager->GetCurrentEvent()->GetTrajectoryContainer();
49 TrajectoryVector* vect = container->GetVector();
52 while (ii<G4int(vect->size())){
61 G4cout <<
"LBNEImpWeight::Not a primary and no particle info"<<G4endl;
64 if (particleType==G4NeutrinoE::NeutrinoEDefinition()||
65 particleType==G4AntiNeutrinoE::AntiNeutrinoEDefinition()||
66 particleType==G4NeutrinoMu::NeutrinoMuDefinition()||
67 particleType==G4AntiNeutrinoMu::AntiNeutrinoMuDefinition()||
68 particleType==G4NeutrinoTau::NeutrinoTauDefinition()||
69 particleType==G4AntiNeutrinoTau::AntiNeutrinoTauDefinition())
74 G4int indx = (G4int)(totE+0.5);
76 else if (indx>IMPWEIGHT_NBINS) indx = IMPWEIGHT_NBINS;
79 G4double wHad = (G4double)(indx)/30.0;
80 if (wHad>1.) wHad = 1.000;
81 if (wHad<0.001) wHad = 0.001;
85 if (particleType==G4Gamma::GammaDefinition()) psave = wEM;
86 else if (particleType==G4Electron::ElectronDefinition()) psave = wEM;
87 else if (particleType==G4Positron::PositronDefinition()) psave = wEM;
88 else if (particleType==G4MuonPlus::MuonPlusDefinition()) psave = 1.;
89 else if (particleType==G4MuonMinus::MuonMinusDefinition()) psave = 1.;
90 else if (particleType==G4PionZero::PionZeroDefinition()) psave = wHad;
91 else if (particleType==G4PionPlus::PionPlusDefinition()) psave = wHad;
92 else if (particleType==G4PionMinus::PionMinusDefinition()) psave = wHad;
93 else if (particleType==G4KaonZero::KaonZeroDefinition()) psave = wHad;
94 else if (particleType==G4KaonPlus::KaonPlusDefinition()) psave = wHad;
95 else if (particleType==G4KaonMinus::KaonMinusDefinition()) psave = wHad;
96 else if (particleType==G4Neutron::NeutronDefinition()) psave = wHad;
97 else if (particleType==G4Proton::ProtonDefinition()) psave = wHad;
98 else if (particleType==G4AntiProton::AntiProtonDefinition()) psave = wHad;
99 else if (particleType==G4KaonZeroShort::KaonZeroShortDefinition()) psave = wHad;
102 if (psave > 1. || impwt/psave>100.) psave = 1.0;
106 if (G4UniformRand()<psave) {
110 return impwt*1.0/psave;
virtual G4double GetNImpWt() const
static G4double CalculateImpWeight(const G4Track *aTrack)