139 strtol(getenv(
"G4Hadronic_epReportLevel"),0,10) : 0;
141 epCheckLevels.first = getenv(
"G4Hadronic_epCheckRelativeLevel") ?
142 strtod(getenv(
"G4Hadronic_epCheckRelativeLevel"),0) :
DBL_MAX;
144 epCheckLevels.second = getenv(
"G4Hadronic_epCheckAbsoluteLevel") ?
145 strtod(getenv(
"G4Hadronic_epCheckAbsoluteLevel"),0) :
DBL_MAX;
176 <<
" because no material defined \n"
177 <<
" Please, specify material pointer or define simple material"
179 G4Exception(
"G4HadronicProcess::GetElementCrossSection",
"had066",
189 if(getenv(
"G4HadronicProcess_debug")) {
206 ed <<
" hadronic initialisation fails";
207 G4Exception(
"G4HadronicProcess::BuildPhysicsTable",
"had000",
229 ed <<
" Cross section is not available" <<
G4endl;
268 ed <<
" Cross section is not available" <<
G4endl;
288 ed <<
" PostStepDoIt failed on element selection" <<
G4endl;
301 ed <<
"G4HadronicProcess: track in unusable state - "
303 ed <<
"G4HadronicProcess: returning unchanged track " <<
G4endl;
323 ed <<
"Target element "<<anElement->
GetName()<<
" Z= "
326 DumpState(aTrack,
"ChooseHadronicInteraction",ed);
327 ed <<
" No HadronicInteraction found out" <<
G4endl;
333 G4int reentryCount = 0;
352 ed <<
"Target element "<<anElement->
GetName()<<
" Z= "
356 ed <<
" ApplyYourself failed" <<
G4endl;
364 if(reentryCount>100) {
367 ed <<
"Target element "<<anElement->
GetName()<<
" Z= "
371 ed <<
" ApplyYourself does not completed after 100 attempts" <<
G4endl;
385 for (
G4int i = 0; i < nSec; ++i ) {
394 dynamicParticle->
SetMass( dynamicMass );
423 outFile <<
"The description for this process has not been written yet.\n";
432 G4double result = (biasedProbability-realProbability)/biasedProbability;
453 if(efinal < 0.0) { efinal = 0.0; }
461 }
else if(0.0 == efinal) {
473 G4double newP = std::sqrt(efinal*(efinal + 2*mass));
476 newP4.
rotate(rotation, it);
479 newE = newP4.
e() - mass;
482 DumpState(aT,
"Primary has zero energy after interaction",ed);
485 if(newE < 0.0) { newE = 0.0; }
496 idxIC = -1 == idx ? -2 : idx;
503 for (
G4int i = 0; i < nSec; ++i) {
505 theM.
rotate(rotation, it);
514 if (time < 0.0) { time = 0.0; }
540 DumpState(aT,
"Secondary has zero energy",ed);
543 G4Exception(
"G4HadronicProcess::FillResults",
"had011",
561 ed <<
" Wrong biasing factor " << aScale <<
" for " <<
GetProcessName();
562 G4Exception(
"G4HadronicProcess::BiasCrossSectionByFactor",
"had010",
599 for (
G4int i = 0; i < nSec; i++) {
604 if ( std::abs(mass_pdg - mass_dyn) > 0.1*mass_pdg + 1.*
MeV){
608 desc <<
"Warning: Secondary with off-shell dynamic mass detected: "
611 <<
", PDG mass: " << mass_pdg <<
", dynamic mass: "
614 :
"re-sample the interaction") <<
G4endl
620 <<
", target nucleus (" << aNucleus.
GetZ_asInt() <<
", "
622 G4Exception(
"G4HadronicProcess:CheckResult()",
"had012",
630 std::pair<G4double, G4double> checkLevels =
632 if (std::abs(deltaE) > checkLevels.second &&
638 desc <<
"Warning: Bad energy non-conservation detected, will "
640 :
"re-sample the interaction") <<
G4endl
646 <<
", target nucleus (" << aNucleus.
GetZ_asInt() <<
", "
648 <<
" E(initial - final) = " << deltaE <<
" MeV." <<
G4endl;
649 G4Exception(
"G4HadronicProcess:CheckResult()",
"had012",
670 G4int initial_A = target_A + track_A;
677 G4int final_A(0), final_Z(0);
707 for (
G4int i = 0; i < nSec; i++) {
740 if ( std::abs(relative) > checkLevels.first
741 || std::abs(relative_mom) > checkLevels.first) {
743 relResult = checkRelative ?
"fail" :
"N/A";
748 if ( std::abs(absolute) > checkLevels.second
749 || std::abs(absolute_mom) > checkLevels.second ) {
756 if ( (initial_A-final_A)!=0
757 || (initial_Z-final_Z)!=0 ) {
758 chargePass = checkLevels.second <
DBL_MAX ?
false :
true;
759 chargeResult =
"fail";
762 G4bool conservationPass = (relPass || absPass) && chargePass;
764 std::stringstream Myout;
765 G4bool Myout_notempty(
false);
776 Myout <<
" Process: " << processName <<
" , Model: " << modelName <<
G4endl;
780 <<
", target nucleus (" << aNucleus.
GetZ_asInt() <<
","
786 || ! conservationPass ){
788 Myout <<
" "<< relResult <<
" relative, limit " << checkLevels.
first <<
", values E/T(0) = "
789 << relative <<
" p/p(0)= " << relative_mom <<
G4endl;
790 Myout <<
" "<< absResult <<
" absolute, limit (MeV) " << checkLevels.second/
MeV <<
", values E / p (MeV) = "
791 << absolute/
MeV <<
" / " << absolute_mom/
MeV <<
" 3mom: " << (diff.
vect())*1./
MeV << G4endl;
792 Myout <<
" "<< chargeResult <<
" charge/baryon number balance " << (initial_Z-final_Z) <<
" / " << (initial_A-final_A) <<
" "<<
G4endl;
797 if ( Myout_notempty ) {
807 ed <<
"Unrecoverable error in the method " << method <<
" of "
809 ed <<
"TrackID= "<< aTrack.
GetTrackID() <<
" ParentID= "
838 std::vector<G4HadronicInteraction*>&
void SetMass(G4double mass)
G4double GetKineticEnergy() const
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4ParticleChange * theTotalResult
void SetTrafoToLab(const G4LorentzRotation &aT)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4int GetCreatorModelType() const
static G4AntiKaonZero * Definition()
G4double GetWeight() const
G4int GetNumberOfSecondaries() const
G4LorentzRotation & GetTrafoToLab()
std::ostringstream G4ExceptionDescription
std::vector< ExP01TrackerHit * > a
const G4ThreeVector & GetMomentumChange() const
static constexpr double MeV
void SetWeight(G4double aValue)
G4CrossSectionDataStore * theCrossSectionDataStore
bool G4HadronicProcess_debug_flag
const G4String & GetName() const
G4HadSecondary * GetSecondary(size_t i)
void ProposeWeight(G4double finalWeight)
G4HadronicInteraction * GetHadronicInteraction() const
void SetCreatorModelIndex(G4int idx)
void RegisterMe(G4HadronicInteraction *a)
G4EnergyRangeManager theEnergyRangeManager
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
void DumpPhysicsTable(const G4ParticleDefinition &)
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Material *)
G4HadFinalStateStatus GetStatusChange() const
void RegisterParticle(G4HadronicProcess *, const G4ParticleDefinition *)
void Register(G4HadronicProcess *)
const G4String & GetParticleName() const
const G4TouchableHandle & GetTouchableHandle() const
G4double GetPDGCharge() const
void RegisterMe(G4HadronicInteraction *a)
void SetSecondaryWeightByProcess(G4bool)
static G4KaonZeroLong * Definition()
void RegisterInteraction(G4HadronicProcess *, G4HadronicInteraction *)
static void saveEngineStatus(const char filename[]="Config.conf")
const G4ParticleDefinition * GetParticleDefinition() const
void PreparePhysicsTable(const G4ParticleDefinition &) override
std::vector< G4HadronicInteraction * > & GetHadronicInteractionList()
void ProcessDescription(std::ostream &outFile) const override
G4double GetTotalEnergy() const
G4double XBiasSurvivalProbability()
G4ParticleDefinition * GetDefinition() const
G4double GetPDGMass() const
void AddSecondary(G4Track *aSecondary)
G4double GetElementCrossSection(const G4DynamicParticle *part, const G4Element *elm, const G4Material *mat=nullptr)
G4double GetWeight() const
G4HadronicProcessStore * theProcessStore
static G4int GetIndex(const G4String &)
const G4String & GetName() const
static G4KaonZero * Definition()
void Initialise(const G4Track &aT)
G4ThreeVector GetMomentum() const
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4double theInitialNumberOfInteractionLength
G4ParticleDefinition * GetDefinition() const
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *) override
G4double GetTotalNumberOfInteractionLengthTraversed() const
void GetEnergyMomentumCheckEnvvars()
G4bool levelsSetByProcess
virtual void Initialize(const G4Track &)
void DumpPhysicsTable(const G4ParticleDefinition &p)
G4int GetBaryonNumber() const
static constexpr double electron_mass_c2
std::pair< G4double, G4double > epCheckLevels
virtual std::pair< G4double, G4double > GetEnergyMomentumCheckLevels() const
const G4ThreeVector * GetMomentumDirection() const
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)=0
G4double GetGlobalTime() const
void Set4Momentum(const G4LorentzVector &momentum)
G4LorentzVector Get4Momentum() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4String & GetProcessName() const
const G4ThreeVector & GetPosition() const
G4HadFinalState * CheckResult(const G4HadProjectile &thePro, const G4Nucleus &targetNucleus, G4HadFinalState *result)
void BiasCrossSectionByFactor(G4double aScale)
static G4double GetNuclearMass(const G4double A, const G4double Z)
void SetKineticEnergy(const G4double aValue)
void ProposeEnergy(G4double finalEnergy)
void BuildPhysicsTable(const G4ParticleDefinition &)
void AddDataSet(G4VCrossSectionDataSet *)
void MultiplyCrossSectionBy(G4double factor)
G4Material * GetMaterial() const
void FillResult(G4HadFinalState *aR, const G4Track &aT)
G4GLOB_DLL std::ostream G4cerr
const G4LorentzVector & Get4Momentum() const
G4int GetNumberOfSecondaries() const
~G4HadronicProcess() override
void PrintInfo(const G4ParticleDefinition *)
static G4HadronicProcessStore * Instance()
G4double G4ParticleHPJENDLHEData::G4double result
G4double GetKineticEnergy() const
static constexpr double twopi
G4double GetLocalEnergyDeposit() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const G4ParticleDefinition * GetDefinition() const
void DumpState(const G4Track &, const G4String &, G4ExceptionDescription &)
void CheckEnergyMomentumConservation(const G4Track &, const G4Nucleus &)
void AddDataSet(G4VCrossSectionDataSet *aDataSet)
G4double theLastCrossSection
G4double XBiasSecondaryWeight()
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessManager * GetProcessManager() const
static G4KaonZeroShort * Definition()
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void BuildPhysicsTable(const G4ParticleDefinition &)
G4TrackStatus GetTrackStatus() const
G4DynamicParticle * GetParticle()
static constexpr double mm
void SetProcessSubType(G4int)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4int GetPDGEncoding() const
G4GLOB_DLL std::ostream G4cout
G4Track * GetSecondary(G4int anIndex) const
G4HadronicProcess(const G4String &processName="Hadronic", G4ProcessType procType=fHadronic)
void ClearNumberOfInteractionLengthLeft()
void DeRegister(G4HadronicProcess *)
virtual const std::pair< G4double, G4double > GetFatalEnergyCheckLevels() const
void Report(std::ostream &aS)
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
G4double GetTotalEnergy() const
G4double GetEnergy() const
const G4ParticleDefinition * GetParticleDefinition() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double GetEnergyChange() const
G4TrackStatus GetTrackStatus() const
const G4ThreeVector & GetMomentumDirection() const
G4HadronicInteraction * theInteraction
void ProposeTrackStatus(G4TrackStatus status)
const G4LorentzRotation & GetTrafoToLab() const
static constexpr double GeV
const G4DynamicParticle * GetDynamicParticle() const
G4HadronicInteraction * ChooseHadronicInteraction(const G4HadProjectile &aHadProjectile, G4Nucleus &aTargetNucleus, const G4Material *aMaterial, const G4Element *anElement)
void SetMomentumDirection(const G4ThreeVector &aValue)
static const char * G4Hadronic_Random_File
std::vector< G4HadronicInteraction * > & GetHadronicInteractionList()
const G4Element * SampleZandA(const G4DynamicParticle *, const G4Material *, G4Nucleus &target)
const G4String & GetName() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4VPhysicalVolume * GetVolume() const
G4int GetParentID() const
const G4String & GetModelName() const
HepLorentzVector & rotate(double, const Hep3Vector &)
void SetNumberOfSecondaries(G4int totSecondaries)