63 theBraggDirectEMModel =
new G4BraggModel(projectileDefinition);
73 DefineProjectileProperty();
84 G4bool IsScatProjToProjCase,
105 adjointPrimKinEnergy,
107 IsScatProjToProjCase);
116 G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
117 G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
124 if (IsScatProjToProjCase) {
127 G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
128 G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;
133 G4double P_parallel = (adjointPrimP*adjointPrimP + projectileP2 - companionP2)/(2.*adjointPrimP);
134 G4double P_perp = std::sqrt( projectileP2 - P_parallel*P_parallel);
138 projectileMomentum.
rotateUz(dir_parallel);
142 if (!IsScatProjToProjCase ){
160 G4bool IsScatProjToProjCase,
178 if (!IsScatProjToProjCase){
180 eEnergy=adjointPrimKinEnergy;
183 if (Emin>=Emax)
return;
186 newCS=newCS*(b-a)/eEnergy;
194 if (Emin>=Emax)
return;
195 G4double diff1=Emin-adjointPrimKinEnergy;
196 G4double diff2=Emax-adjointPrimKinEnergy;
198 G4double t1=adjointPrimKinEnergy*(1./diff1-1./diff2);
199 G4double t2=adjointPrimKinEnergy*(1./Emin-1./Emax);
204 newCS=newCS*sum_t/adjointPrimKinEnergy/adjointPrimKinEnergy;
208 projectileKinEnergy =adjointPrimKinEnergy +1./(1./diff1-q);
213 projectileKinEnergy =1./(1./Emin-q);
216 projectileKinEnergy=Emin*std::pow(Emax/Emin,
G4UniformRand());
219 eEnergy=projectileKinEnergy-adjointPrimKinEnergy;
226 G4double diffCS_perAtom_Used=twopi_mc2_rcl2*mass*adjointPrimKinEnergy/projectileKinEnergy/projectileKinEnergy/eEnergy/eEnergy;
242 w_corr*=diffCS/diffCS_perAtom_Used;
259 G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
260 G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
267 if (IsScatProjToProjCase) {
270 G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
271 G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;
276 G4double P_parallel = (adjointPrimP*adjointPrimP + projectileP2 - companionP2)/(2.*adjointPrimP);
277 G4double P_perp = std::sqrt( projectileP2 - P_parallel*P_parallel);
281 projectileMomentum.
rotateUz(dir_parallel);
285 if (!IsScatProjToProjCase ){
319 if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){
326 if (kinEnergyProj >2.*MeV){
336 dSigmadEprod=(sigma1-sigma2)/dE;
337 if (dSigmadEprod>1.) {
338 G4cout<<
"sigma1 "<<kinEnergyProj/MeV<<
'\t'<<kinEnergyProd/MeV<<
'\t'<<sigma1<<
G4endl;
339 G4cout<<
"sigma2 "<<kinEnergyProj/MeV<<
'\t'<<kinEnergyProd/MeV<<
'\t'<<sigma2<<
G4endl;
340 G4cout<<
"dsigma "<<kinEnergyProj/MeV<<
'\t'<<kinEnergyProd/MeV<<
'\t'<<dSigmadEprod<<
G4endl;
353 G4double deltaKinEnergy = kinEnergyProd;
362 G4double x = formfact*deltaKinEnergy;
366 G4double totEnergy = kinEnergyProj + mass;
367 G4double etot2 = totEnergy*totEnergy;
368 G4double beta2 = kinEnergyProj*(kinEnergyProj + 2.0*mass)/etot2;
371 f = 1.0 - beta2*deltaKinEnergy/Tmax;
373 f1 = 0.5*deltaKinEnergy*deltaKinEnergy/etot2;
379 G4double x2 = 0.5*electron_mass_c2*deltaKinEnergy/(mass*mass);
380 gg *= (1.0 + magMoment2*(x2 - f1/f)/(1.0 + x2));
383 G4cout <<
"### G4BetheBlochModel in Adjoint Sim WARNING: g= " << g
400void G4AdjointhIonisationModel::DefineProjectileProperty()
406 pname !=
"deuteron" && pname !=
"triton") {
415 ratio = electron_mass_c2/mass;
416 ratio2 = ratio*ratio;
417 one_plus_ratio_2=(1+ratio)*(1+ratio);
418 one_minus_ratio_2=(1-ratio)*(1-ratio);
420 *mass/(0.5*eplus*hbar_Planck*c_squared);
421 magMoment2 = magmom*magmom - 1.0;
425 if(spin == 0.0 && mass < GeV) {x = 0.736*GeV;}
426 else if(mass > GeV) {
430 formfact = 2.0*electron_mass_c2/(x*x);
431 tlimit = 2.0/formfact;
439 G4bool IsScatProjToProjCase)
447 if (!IsScatProjToProjCase ){
451 Cross*=(1./Emin_proj -1./Emax_proj)/primEnergy;
464 G4double diff1=Emin_proj-primEnergy;
465 G4double diff2=Emax_proj-primEnergy;
466 G4double t1=(1./diff1+1./Emin_proj-1./diff2-1./Emax_proj)/primEnergy;
468 G4double t2=2.*std::log(Emax_proj/Emin_proj)/primEnergy/primEnergy;
480 G4double Tmax=PrimAdjEnergy*one_plus_ratio_2/(one_minus_ratio_2-2.*ratio*PrimAdjEnergy/mass);
486{
return PrimAdjEnergy+Tcut;
496{
G4double Tmin= (2*PrimAdjEnergy-4*mass + std::sqrt(4.*PrimAdjEnergy*PrimAdjEnergy +16.*mass*mass + 8.*PrimAdjEnergy*mass*(1/ratio +ratio)))/4.;
double A(double temperature)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
G4double GetPostStepWeightCorrection()
static G4AdjointCSManager * GetAdjointCSManager()
static G4AdjointElectron * AdjointElectron()
static G4AdjointProton * AdjointProton()
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
G4AdjointhIonisationModel(G4ParticleDefinition *projectileDefinition)
virtual ~G4AdjointhIonisationModel()
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy, G4double Tcut=0)
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
virtual G4double DiffCrossSectionPerAtomPrimToSecond(G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.)
virtual void SampleSecondaries(const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
void RapidSampleSecondaries(const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4double GetTotalMomentum() const
G4double GetElectronDensity() const
G4double GetZ13(G4double Z) const
static G4NistManager * Instance()
void AddSecondary(G4Track *aSecondary)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double GetPDGMagneticMoment() const
const G4String & GetParticleType() const
G4double GetPDGMass() const
G4int GetLeptonNumber() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
G4double GetPDGSpin() const
static G4Proton * Proton()
G4double GetWeight() const
const G4DynamicParticle * GetDynamicParticle() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4VEmModel * theDirectEMModel
G4double mass_ratio_projectile
virtual void CorrectPostStepWeight(G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool IsScatProjToProjCase)
G4bool second_part_of_same_type
void DefineCurrentMaterial(const G4MaterialCutsCouple *couple)
G4ParticleDefinition * theDirectPrimaryPartDef
G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex, G4double prim_energy, G4bool IsScatProjToProjCase)
G4Material * currentMaterial
G4bool UseOnlyOneMatrixForAllElements
G4double CS_biasing_factor
G4double currentTcutForDirectSecond
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool IsScatProjToProjCase)
G4ParticleDefinition * theAdjEquivOfDirectSecondPartDef
G4bool UseMatrixPerElement
G4ParticleDefinition * theAdjEquivOfDirectPrimPartDef
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void ProposeTrackStatus(G4TrackStatus status)
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)