471 G4int iMat, jMat, iTkin, iPlace, numOfTR, iTR, iTransfer;
473 G4double energyPos, anglePos, energyTR, theta, phi, dirX, dirY, dirZ;
491 GetLogicalVolume()->GetMaterialCutsCouple();
493 GetLogicalVolume()->GetMaterialCutsCouple();
528 G4double TkinScaled = kinEnergy*massRatio;
529 for(iTkin=0;iTkin<
fTotBin;iTkin++)
531 if(TkinScaled < fProtonEnergyVector->GetLowEdgeEnergy(iTkin))
538 iPlace = fTotBin + iTkin - 1;
571 for(iTR=0;iTR<numOfTR;iTR++)
573 energyPos = (*(*fEnergyDistrTable)(iPlace))(0)*
G4UniformRand();
574 for(iTransfer=0;iTransfer<
fBinTR-1;iTransfer++)
578 energyTR = (*fEnergyDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
582 kinEnergy -= energyTR;
585 anglePos = (*(*fAngleDistrTable)(iPlace))(0)*
G4UniformRand();
586 for(iTransfer=0;iTransfer<fBinTR-1;iTransfer++)
590 theta = std::sqrt((*
fAngleDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer-1));
595 dirX = std::sin(theta)*std::cos(phi) ;
596 dirY = std::sin(theta)*std::sin(phi) ;
597 dirZ = std::cos(theta) ;
599 directionTR.rotateUz(particleDir);
618 W1 = (E2 - TkinScaled)*W;
619 W2 = (TkinScaled - E1)*W;
641 for(iTR=0;iTR<numOfTR;iTR++)
643 energyPos = ((*(*fEnergyDistrTable)(iPlace))(0)*W1+
645 for(iTransfer=0;iTransfer<fBinTR-1;iTransfer++)
650 energyTR = ((*fEnergyDistrTable)(iPlace)->GetLowEdgeEnergy(iTransfer))*W1+
655 kinEnergy -= energyTR;
658 anglePos = ((*(*fAngleDistrTable)(iPlace))(0)*W1+
660 for(iTransfer=0;iTransfer<fBinTR-1;iTransfer++)
666 GetLowEdgeEnergy(iTransfer-1))*W1+
668 GetLowEdgeEnergy(iTransfer-1))*W2);
673 dirX = std::sin(theta)*std::cos(phi) ;
674 dirY = std::sin(theta)*std::sin(phi) ;
675 dirZ = std::cos(theta) ;
677 directionTR.rotateUz(particleDir);
G4long G4Poisson(G4double mean)
static constexpr double proton_mass_c2
G4double GetKineticEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4StepStatus GetStepStatus() const
G4double GetSurfaceTolerance() const
G4ParticleDefinition * GetDefinition() const
G4double GetLowEdgeEnergy(size_t binNumber) const
G4PhysicsTable * fAngleDistrTable
static constexpr double twopi
G4StepPoint * GetPreStepPoint() const
G4VPhysicalVolume * GetPhysicalVolume() const
const G4ThreeVector & GetMomentumDirection() const
G4PhysicsTable * fEnergyDistrTable
virtual void Initialize(const G4Track &)
G4double GetPDGMass() const
void SetNumberOfSecondaries(G4int totSecondaries)
G4StepPoint * GetPostStepPoint() const
void ProposeEnergy(G4double finalEnergy)
G4ParticleChange aParticleChange
void AddSecondary(G4Track *aSecondary)
G4double GetPDGCharge() const
G4PhysicsLogVector * fProtonEnergyVector
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4double GetStepLength() const
static G4GeometryTolerance * GetInstance()
const G4Material * GetMaterial() const