Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HadronicProcess Class Reference

#include <G4HadronicProcess.hh>

+ Inheritance diagram for G4HadronicProcess:

Public Member Functions

 G4HadronicProcess (const G4String &processName="Hadronic", G4ProcessType procType=fHadronic)
 
 G4HadronicProcess (const G4String &processName, G4HadronicProcessType subType)
 
 ~G4HadronicProcess () override
 
void RegisterMe (G4HadronicInteraction *a)
 
G4double GetElementCrossSection (const G4DynamicParticle *part, const G4Element *elm, const G4Material *mat=nullptr)
 
G4double GetMicroscopicCrossSection (const G4DynamicParticle *part, const G4Element *elm, const G4Material *mat=nullptr)
 
void StartTracking (G4Track *track) override
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double, G4ForceCondition *) override
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep) override
 
void PreparePhysicsTable (const G4ParticleDefinition &) override
 
void BuildPhysicsTable (const G4ParticleDefinition &) override
 
void DumpPhysicsTable (const G4ParticleDefinition &p)
 
void AddDataSet (G4VCrossSectionDataSet *aDataSet)
 
std::vector< G4HadronicInteraction * > & GetHadronicInteractionList ()
 
G4HadronicInteractionGetHadronicModel (const G4String &)
 
G4HadronicInteractionGetHadronicInteraction () const
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double, G4ForceCondition *) override
 
const G4NucleusGetTargetNucleus () const
 
G4NucleusGetTargetNucleusPointer ()
 
const G4IsotopeGetTargetIsotope ()
 
G4double ComputeCrossSection (const G4ParticleDefinition *, const G4Material *, const G4double kinEnergy)
 
G4HadXSType CrossSectionType () const
 
void SetCrossSectionType (G4HadXSType val)
 
void ProcessDescription (std::ostream &outFile) const override
 
void BiasCrossSectionByFactor (G4double aScale)
 
void MultiplyCrossSectionBy (G4double factor)
 
G4double CrossSectionFactor () const
 
void SetIntegral (G4bool val)
 
void SetEpReportLevel (G4int level)
 
void SetEnergyMomentumCheckLevels (G4double relativeLevel, G4double absoluteLevel)
 
std::pair< G4double, G4doubleGetEnergyMomentumCheckLevels () const
 
G4CrossSectionDataStoreGetCrossSectionDataStore ()
 
std::vector< G4TwoPeaksHadXS * > * TwoPeaksXS () const
 
std::vector< G4double > * EnergyOfCrossSectionMax () const
 
G4HadronicProcessoperator= (const G4HadronicProcess &right)=delete
 
 G4HadronicProcess (const G4HadronicProcess &)=delete
 
- Public Member Functions inherited from G4VDiscreteProcess
 G4VDiscreteProcess (const G4String &aName, G4ProcessType aType=fNotDefined)
 
 G4VDiscreteProcess (G4VDiscreteProcess &)
 
virtual ~G4VDiscreteProcess ()
 
G4VDiscreteProcessoperator= (const G4VDiscreteProcess &)=delete
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
virtual G4double GetCrossSection (const G4double, const G4MaterialCutsCouple *)
 
virtual G4double MinPrimaryEnergy (const G4ParticleDefinition *, const G4Material *)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4VProcessoperator= (const G4VProcess &)=delete
 
G4bool operator== (const G4VProcess &right) const
 
G4bool operator!= (const G4VProcess &right) const
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4bool IsApplicable (const G4ParticleDefinition &)
 
virtual G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
virtual G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual const G4VProcessGetCreatorProcess () const
 
virtual void EndTracking ()
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
virtual void DumpInfo () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 

Protected Member Functions

G4HadronicInteractionChooseHadronicInteraction (const G4HadProjectile &aHadProjectile, G4Nucleus &aTargetNucleus, const G4Material *aMaterial, const G4Element *anElement)
 
G4double GetLastCrossSection ()
 
void FillResult (G4HadFinalState *aR, const G4Track &aT)
 
void DumpState (const G4Track &, const G4String &, G4ExceptionDescription &)
 
G4HadFinalStateCheckResult (const G4HadProjectile &thePro, const G4Nucleus &targetNucleus, G4HadFinalState *result)
 
void CheckEnergyMomentumConservation (const G4Track &, const G4Nucleus &)
 
- Protected Member Functions inherited from G4VDiscreteProcess
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double prevStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 

Protected Attributes

G4HadProjectile thePro
 
G4ParticleChangetheTotalResult
 
G4CrossSectionDataStoretheCrossSectionDataStore
 
G4double fWeight = 1.0
 
G4double aScaleFactor = 1.0
 
G4double theLastCrossSection = 0.0
 
G4double mfpKinEnergy = DBL_MAX
 
G4int epReportLevel = 0
 
G4HadXSType fXSType = fHadNoIntegral
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager = nullptr
 
G4VParticleChangepParticleChange = nullptr
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft = -1.0
 
G4double currentInteractionLength = -1.0
 
G4double theInitialNumberOfInteractionLength = -1.0
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType = fNotDefined
 
G4int theProcessSubType = -1
 
G4double thePILfactor = 1.0
 
G4int verboseLevel = 0
 
G4bool enableAtRestDoIt = true
 
G4bool enableAlongStepDoIt = true
 
G4bool enablePostStepDoIt = true
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 

Detailed Description

Definition at line 73 of file G4HadronicProcess.hh.

Constructor & Destructor Documentation

◆ G4HadronicProcess() [1/3]

G4HadronicProcess::G4HadronicProcess ( const G4String & processName = "Hadronic",
G4ProcessType procType = fHadronic )

Definition at line 87 of file G4HadronicProcess.cc.

89 : G4VDiscreteProcess(processName, procType)
90{
91 SetProcessSubType(fHadronInelastic); // Default unless subclass changes
92 InitialiseLocal();
93}
@ fHadronInelastic
void SetProcessSubType(G4int)

◆ G4HadronicProcess() [2/3]

G4HadronicProcess::G4HadronicProcess ( const G4String & processName,
G4HadronicProcessType subType )

Definition at line 95 of file G4HadronicProcess.cc.

97 : G4VDiscreteProcess(processName, fHadronic)
98{
99 SetProcessSubType(aHadSubType);
100 InitialiseLocal();
101}
@ fHadronic

◆ ~G4HadronicProcess()

G4HadronicProcess::~G4HadronicProcess ( )
override

Definition at line 103 of file G4HadronicProcess.cc.

104{
105 theProcessStore->DeRegister(this);
106 delete theTotalResult;
108 if(isMaster) {
109 if (fXSpeaks != nullptr) {
110 for (auto const& e : *fXSpeaks ) {
111 delete e;
112 }
113 }
114 delete fXSpeaks;
115 delete theEnergyOfCrossSectionMax;
116 }
117}
void DeRegister(G4HadronicProcess *)
G4ParticleChange * theTotalResult
G4CrossSectionDataStore * theCrossSectionDataStore

◆ G4HadronicProcess() [3/3]

G4HadronicProcess::G4HadronicProcess ( const G4HadronicProcess & )
delete

Member Function Documentation

◆ AddDataSet()

void G4HadronicProcess::AddDataSet ( G4VCrossSectionDataSet * aDataSet)

Definition at line 874 of file G4HadronicProcess.cc.

875{
877}
void AddDataSet(G4VCrossSectionDataSet *)

Referenced by G4HadProcesses::AddCaptureCrossSection(), G4HadProcesses::AddElasticCrossSection(), G4HadProcesses::AddFissionCrossSection(), G4HadProcesses::AddInelasticCrossSection(), G4HadronElasticPhysics::AddXSection(), G4AlphaPHPBuilder::Build(), G4BertiniElectroNuclearBuilder::Build(), G4BertiniKaonBuilder::Build(), G4BertiniPiKBuilder::Build(), G4BertiniPionBuilder::Build(), G4BinaryPiKBuilder::Build(), G4BinaryPionBuilder::Build(), G4DeuteronPHPBuilder::Build(), G4FTFBinaryNeutronBuilder::Build(), G4FTFBinaryPiKBuilder::Build(), G4FTFBinaryPionBuilder::Build(), G4FTFBinaryProtonBuilder::Build(), G4FTFPAntiBarionBuilder::Build(), G4FTFPNeutronBuilder::Build(), G4FTFPPiKBuilder::Build(), G4FTFPPionBuilder::Build(), G4FTFPProtonBuilder::Build(), G4He3PHPBuilder::Build(), G4HyperonFTFPBuilder::Build(), G4HyperonQGSPBuilder::Build(), G4INCLXXNeutronBuilder::Build(), G4INCLXXPionBuilder::Build(), G4INCLXXProtonBuilder::Build(), G4LENDBertiniGammaElectroNuclearBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronPHPBuilder::Build(), G4NeutronPHPBuilder::Build(), G4NeutronPHPBuilder::Build(), G4NeutronPHPBuilder::Build(), G4PrecoNeutronBuilder::Build(), G4PrecoProtonBuilder::Build(), G4ProtonPHPBuilder::Build(), G4QGSBinaryNeutronBuilder::Build(), G4QGSBinaryPiKBuilder::Build(), G4QGSBinaryPionBuilder::Build(), G4QGSBinaryProtonBuilder::Build(), G4QGSPAntiBarionBuilder::Build(), G4QGSPLundStrFragmProtonBuilder::Build(), G4QGSPNeutronBuilder::Build(), G4QGSPPiKBuilder::Build(), G4QGSPPionBuilder::Build(), G4QGSPProtonBuilder::Build(), G4TritonPHPBuilder::Build(), G4HadProcesses::BuildNeutronElastic(), G4HadProcesses::BuildNeutronInelasticAndCapture(), LBE::ConstructHad(), G4HadronDElasticPhysics::ConstructProcess(), G4HadronElasticPhysics::ConstructProcess(), G4HadronElasticPhysicsHP::ConstructProcess(), G4HadronElasticPhysicsHPT::ConstructProcess(), G4HadronElasticPhysicsLEND::ConstructProcess(), G4HadronElasticPhysicsPHP::ConstructProcess(), G4HadronElasticPhysicsVI::ConstructProcess(), G4HadronHElasticPhysics::ConstructProcess(), G4HadronInelasticQBBC::ConstructProcess(), G4HadronInelasticQBBC_ABLA::ConstructProcess(), G4HadronPhysicsFTFQGSP_BERT::ConstructProcess(), G4IonElasticPhysics::ConstructProcess(), G4NeutronCrossSectionXS::ConstructProcess(), G4ThermalNeutrons::ConstructProcess(), G4ChargeExchangeProcess::G4ChargeExchangeProcess(), G4MuonNuclearProcess::G4MuonNuclearProcess(), G4NeutronCaptureProcess::G4NeutronCaptureProcess(), G4NeutronFissionProcess::G4NeutronFissionProcess(), G4HadronPhysicsFTF_BIC::Neutron(), G4HadronPhysicsFTFP_BERT::Neutron(), G4HadronPhysicsQGS_BIC::Neutron(), G4HadronPhysicsQGSP_BERT::Neutron(), G4HadronPhysicsQGSP_BIC::Neutron(), G4NeutronGeneralProcess::SetCaptureProcess(), G4NeutronGeneralProcess::SetElasticProcess(), and G4NeutronGeneralProcess::SetInelasticProcess().

◆ BiasCrossSectionByFactor()

void G4HadronicProcess::BiasCrossSectionByFactor ( G4double aScale)

Definition at line 596 of file G4HadronicProcess.cc.

597{
598 if (aScale <= 0.0) {
600 ed << " Wrong biasing factor " << aScale << " for " << GetProcessName();
601 G4Exception("G4HadronicProcess::BiasCrossSectionByFactor", "had010",
602 JustWarning, ed, "Cross-section bias is ignored");
603 } else {
604 aScaleFactor = aScale;
605 }
606}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4String & GetProcessName() const

Referenced by MultiplyCrossSectionBy().

◆ BuildPhysicsTable()

void G4HadronicProcess::BuildPhysicsTable ( const G4ParticleDefinition & p)
overridevirtual

Reimplemented from G4VProcess.

Reimplemented in G4HadronStoppingProcess, and G4NeutronGeneralProcess.

Definition at line 171 of file G4HadronicProcess.cc.

172{
173 if(firstParticle != &p) { return; }
174
176 theEnergyRangeManager.BuildPhysicsTable(p);
178
179 G4int subtype = GetProcessSubType();
180 if(useIntegralXS) {
181 if(subtype == fHadronInelastic) {
182 useIntegralXS = param->EnableIntegralInelasticXS();
183 } else if(subtype == fHadronElastic) {
184 useIntegralXS = param->EnableIntegralElasticXS();
185 }
186 }
188
189 if(nullptr == masterProcess) {
190 masterProcess = dynamic_cast<const G4HadronicProcess*>(GetMasterProcess());
191 }
192 if(nullptr == masterProcess) {
193 if(1 < param->GetVerboseLevel()) {
195 ed << "G4HadronicProcess::BuildPhysicsTable: for "
196 << GetProcessName() << " for " << p.GetParticleName()
197 << " fail due to undefined pointer to the master process \n"
198 << " ThreadID= " << G4Threading::G4GetThreadId()
199 << " initialisation of worker started before master initialisation";
200 G4Exception("G4HadronicProcess::BuildPhysicsTable", "had066",
201 JustWarning, ed);
202 }
203 }
204
205 // check particle for integral method
206 if(isMaster || nullptr == masterProcess) {
207 G4double charge = p.GetPDGCharge()/eplus;
208
209 // select cross section shape
210 if(charge != 0.0 && useIntegralXS) {
211 G4double tmax = param->GetMaxEnergy();
212 currentParticle = firstParticle;
213 // initialisation in the master thread
214 G4int pdg = p.GetPDGEncoding();
215 if (std::abs(pdg) == 211) {
217 } else if (pdg == 321) {
219 } else if (pdg == -321) {
221 } else if (pdg == 2212) {
223 } else if (pdg == -2212 || pdg == -1000010020 || pdg == -1000010030 ||
224 pdg == -1000020030 || pdg == -1000020040) {
226 } else if (charge > 0.0 || pdg == 11 || pdg == 13) {
228 }
229
230 delete theEnergyOfCrossSectionMax;
231 theEnergyOfCrossSectionMax = nullptr;
232 if(fXSType == fHadTwoPeaks) {
233 if (fXSpeaks != nullptr) {
234 for (auto const& e : *fXSpeaks ) {
235 delete e;
236 }
237 }
238 delete fXSpeaks;
239 fXSpeaks =
240 G4HadXSHelper::FillPeaksStructure(this, &p, minKinEnergy, tmax);
241 if(nullptr == fXSpeaks) {
243 }
244 }
245 if(fXSType == fHadOnePeak) {
246 theEnergyOfCrossSectionMax =
247 G4HadXSHelper::FindCrossSectionMax(this, &p, minKinEnergy, tmax);
248 if(nullptr == theEnergyOfCrossSectionMax) {
250 }
251 }
252 }
253 } else {
254 // initialisation in worker threads
255 fXSType = masterProcess->CrossSectionType();
256 fXSpeaks = masterProcess->TwoPeaksXS();
257 theEnergyOfCrossSectionMax = masterProcess->EnergyOfCrossSectionMax();
258 }
259 if(isMaster && 1 < param->GetVerboseLevel()) {
260 G4cout << "G4HadronicProcess::BuildPhysicsTable: for "
261 << GetProcessName() << " and " << p.GetParticleName()
262 << " typeXS=" << fXSType << G4endl;
263 }
265}
@ fHadTwoPeaks
@ fHadIncreasing
@ fHadDecreasing
@ fHadNoIntegral
@ fHadOnePeak
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
void BuildPhysicsTable(const G4ParticleDefinition &)
void BuildPhysicsTable(const G4ParticleDefinition &)
static std::vector< G4TwoPeaksHadXS * > * FillPeaksStructure(G4HadronicProcess *, const G4ParticleDefinition *, const G4double tmin, const G4double tmax)
static std::vector< G4double > * FindCrossSectionMax(G4HadronicProcess *, const G4ParticleDefinition *, const G4double tmin, const G4double tmax)
G4bool EnableIntegralInelasticXS() const
static G4HadronicParameters * Instance()
G4bool EnableIntegralElasticXS() const
static G4HadronicProcessStore * Instance()
void PrintInfo(const G4ParticleDefinition *)
std::vector< G4TwoPeaksHadXS * > * TwoPeaksXS() const
G4HadXSType CrossSectionType() const
std::vector< G4double > * EnergyOfCrossSectionMax() const
const G4String & GetParticleName() const
const G4VProcess * GetMasterProcess() const
G4int GetProcessSubType() const
G4int G4GetThreadId()

Referenced by G4ChargeExchangeProcess::BuildPhysicsTable(), G4GammaGeneralProcess::BuildPhysicsTable(), and G4NeutronGeneralProcess::BuildPhysicsTable().

◆ CheckEnergyMomentumConservation()

void G4HadronicProcess::CheckEnergyMomentumConservation ( const G4Track & aTrack,
const G4Nucleus & aNucleus )
protected

Definition at line 699 of file G4HadronicProcess.cc.

701{
702 G4int target_A=aNucleus.GetA_asInt();
703 G4int target_Z=aNucleus.GetZ_asInt();
704 G4double targetMass = G4NucleiProperties::GetNuclearMass(target_A,target_Z);
705 G4LorentzVector target4mom(0, 0, 0, targetMass
706 + nICelectrons*CLHEP::electron_mass_c2);
707
708 G4LorentzVector projectile4mom = aTrack.GetDynamicParticle()->Get4Momentum();
709 G4int track_A = aTrack.GetDefinition()->GetBaryonNumber();
710 G4int track_Z = G4lrint(aTrack.GetDefinition()->GetPDGCharge());
711
712 G4int initial_A = target_A + track_A;
713 G4int initial_Z = target_Z + track_Z - nICelectrons;
714
715 G4LorentzVector initial4mom = projectile4mom + target4mom;
716
717 // Compute final-state momentum for scattering and "do nothing" results
718 G4LorentzVector final4mom;
719 G4int final_A(0), final_Z(0);
720
722 if (theTotalResult->GetTrackStatus() != fStopAndKill) { // If it is Alive
723 // Either interaction didn't complete, returned "do nothing" state
724 // or the primary survived the interaction (e.g. electro-nucleus )
725
726 // Interaction didn't complete, returned "do nothing" state
727 // - or suppressed recoil (e.g. Neutron elastic )
728 final4mom = initial4mom;
729 final_A = initial_A;
730 final_Z = initial_Z;
731 if (nSec > 0) {
732 // The primary remains in final state (e.g. electro-nucleus )
733 // Use the final energy / momentum
736 G4double mass = aTrack.GetDefinition()->GetPDGMass();
737 G4double ptot = std::sqrt(ekin*(ekin + 2*mass));
738 final4mom.set(ptot*v.x(), ptot*v.y(), ptot*v.z(), mass + ekin);
739 final_A = track_A;
740 final_Z = track_Z;
741 // Expect that the target nucleus will have interacted,
742 // and its products, including recoil, will be included in secondaries.
743 }
744 }
745 if( nSec > 0 ) {
746 G4Track* sec;
747
748 for (G4int i = 0; i < nSec; i++) {
750 final4mom += sec->GetDynamicParticle()->Get4Momentum();
751 final_A += sec->GetDefinition()->GetBaryonNumber();
752 final_Z += G4lrint(sec->GetDefinition()->GetPDGCharge());
753 }
754 }
755
756 // Get level-checking information (used to cut-off relative checks)
757 G4String processName = GetProcessName();
759 G4String modelName("none");
760 if (theModel) modelName = theModel->GetModelName();
761 std::pair<G4double, G4double> checkLevels = epCheckLevels;
762 if (!levelsSetByProcess) {
763 if (theModel) checkLevels = theModel->GetEnergyMomentumCheckLevels();
764 checkLevels.first= std::min(checkLevels.first, epCheckLevels.first);
765 checkLevels.second=std::min(checkLevels.second, epCheckLevels.second);
766 }
767
768 // Compute absolute total-energy difference, and relative kinetic-energy
769 G4bool checkRelative = (aTrack.GetKineticEnergy() > checkLevels.second);
770
771 G4LorentzVector diff = initial4mom - final4mom;
772 G4double absolute = diff.e();
773 G4double relative = checkRelative ? absolute/aTrack.GetKineticEnergy() : 0.;
774
775 G4double absolute_mom = diff.vect().mag();
776 G4double relative_mom = checkRelative ? absolute_mom/aTrack.GetMomentum().mag() : 0.;
777
778 // Evaluate relative and absolute conservation
779 G4bool relPass = true;
780 G4String relResult = "pass";
781 if ( std::abs(relative) > checkLevels.first
782 || std::abs(relative_mom) > checkLevels.first) {
783 relPass = false;
784 relResult = checkRelative ? "fail" : "N/A";
785 }
786
787 G4bool absPass = true;
788 G4String absResult = "pass";
789 if ( std::abs(absolute) > checkLevels.second
790 || std::abs(absolute_mom) > checkLevels.second ) {
791 absPass = false ;
792 absResult = "fail";
793 }
794
795 G4bool chargePass = true;
796 G4String chargeResult = "pass";
797 if ( (initial_A-final_A)!=0
798 || (initial_Z-final_Z)!=0 ) {
799 chargePass = checkLevels.second < DBL_MAX ? false : true;
800 chargeResult = "fail";
801 }
802
803 G4bool conservationPass = (relPass || absPass) && chargePass;
804
805 std::stringstream Myout;
806 G4bool Myout_notempty(false);
807 // Options for level of reporting detail:
808 // 0. off
809 // 1. report only when E/p not conserved
810 // 2. report regardless of E/p conservation
811 // 3. report only when E/p not conserved, with model names, process names, and limits
812 // 4. report regardless of E/p conservation, with model names, process names, and limits
813 // negative -1.., as above, but send output to stderr
814
815 if( std::abs(epReportLevel) == 4
816 || ( std::abs(epReportLevel) == 3 && ! conservationPass ) ){
817 Myout << " Process: " << processName << " , Model: " << modelName << G4endl;
818 Myout << " Primary: " << aTrack.GetParticleDefinition()->GetParticleName()
819 << " (" << aTrack.GetParticleDefinition()->GetPDGEncoding() << "),"
820 << " E= " << aTrack.GetDynamicParticle()->Get4Momentum().e()
821 << ", target nucleus (" << aNucleus.GetZ_asInt() << ","
822 << aNucleus.GetA_asInt() << ")" << G4endl;
823 Myout_notempty=true;
824 }
825 if ( std::abs(epReportLevel) == 4
826 || std::abs(epReportLevel) == 2
827 || ! conservationPass ){
828
829 Myout << " "<< relResult <<" relative, limit " << checkLevels.first << ", values E/T(0) = "
830 << relative << " p/p(0)= " << relative_mom << G4endl;
831 Myout << " "<< absResult << " absolute, limit (MeV) " << checkLevels.second/MeV << ", values E / p (MeV) = "
832 << absolute/MeV << " / " << absolute_mom/MeV << " 3mom: " << (diff.vect())*1./MeV << G4endl;
833 Myout << " "<< chargeResult << " charge/baryon number balance " << (initial_Z-final_Z) << " / " << (initial_A-final_A) << " "<< G4endl;
834 Myout_notempty=true;
835
836 }
837 Myout.flush();
838 if ( Myout_notempty ) {
839 if (epReportLevel > 0) G4cout << Myout.str()<< G4endl;
840 else if (epReportLevel < 0) G4cerr << Myout.str()<< G4endl;
841 }
842}
@ fStopAndKill
bool G4bool
Definition G4Types.hh:86
G4GLOB_DLL std::ostream G4cerr
double z() const
double x() const
double y() const
double mag() const
Hep3Vector vect() const
void set(double x, double y, double z, double t)
G4LorentzVector Get4Momentum() const
virtual std::pair< G4double, G4double > GetEnergyMomentumCheckLevels() const
const G4String & GetModelName() const
G4HadronicInteraction * GetHadronicInteraction() const
static G4double GetNuclearMass(const G4double A, const G4double Z)
G4int GetA_asInt() const
Definition G4Nucleus.hh:99
G4int GetZ_asInt() const
Definition G4Nucleus.hh:105
G4double GetEnergy() const
const G4ThreeVector * GetMomentumDirection() const
const G4ParticleDefinition * GetParticleDefinition() const
G4ThreeVector GetMomentum() const
G4ParticleDefinition * GetDefinition() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
G4int GetNumberOfSecondaries() const
G4Track * GetSecondary(G4int anIndex) const
G4TrackStatus GetTrackStatus() const
int G4lrint(double ad)
Definition templates.hh:134
#define DBL_MAX
Definition templates.hh:62

Referenced by G4HadronStoppingProcess::AtRestDoIt(), G4HadronElasticProcess::PostStepDoIt(), and PostStepDoIt().

◆ CheckResult()

G4HadFinalState * G4HadronicProcess::CheckResult ( const G4HadProjectile & thePro,
const G4Nucleus & targetNucleus,
G4HadFinalState * result )
protected

Definition at line 608 of file G4HadronicProcess.cc.

611{
612 // check for catastrophic energy non-conservation
613 // to re-sample the interaction
615 G4double nuclearMass(0);
616 if (nullptr != theModel) {
617
618 // Compute final-state total energy
619 G4double finalE(0.);
620 G4int nSec = (G4int)result->GetNumberOfSecondaries();
621
622 nuclearMass = G4NucleiProperties::GetNuclearMass(aNucleus.GetA_asInt(),
623 aNucleus.GetZ_asInt());
624 if (result->GetStatusChange() != stopAndKill) {
625 // Interaction didn't complete, returned "do nothing" state
626 // and reset nucleus or the primary survived the interaction
627 // (e.g. electro-nuclear ) => keep nucleus
628 finalE=result->GetLocalEnergyDeposit() +
629 aPro.GetDefinition()->GetPDGMass() + result->GetEnergyChange();
630 if( nSec == 0 ){
631 // Since there are no secondaries, there is no recoil nucleus.
632 // To check energy balance we must neglect the initial nucleus too.
633 nuclearMass=0.0;
634 }
635 }
636 for (G4int i = 0; i < nSec; ++i) {
637 G4DynamicParticle *pdyn=result->GetSecondary(i)->GetParticle();
638 finalE += pdyn->GetTotalEnergy();
639 G4double mass_pdg=pdyn->GetDefinition()->GetPDGMass();
640 G4double mass_dyn=pdyn->GetMass();
641 if ( std::abs(mass_pdg - mass_dyn) > 0.1*mass_pdg + 1.*MeV ) {
642 // If it is shortlived, then a difference less than 3 times the width is acceptable
643 if ( pdyn->GetDefinition()->IsShortLived() &&
644 std::abs(mass_pdg - mass_dyn) < 3.0*pdyn->GetDefinition()->GetPDGWidth() ) {
645 continue;
646 }
647 result->Clear();
648 result = nullptr;
650 desc << "Warning: Secondary with off-shell dynamic mass detected: "
651 << G4endl
652 << " " << pdyn->GetDefinition()->GetParticleName()
653 << ", PDG mass: " << mass_pdg << ", dynamic mass: "
654 << mass_dyn << G4endl
655 << (epReportLevel<0 ? "abort the event"
656 : "re-sample the interaction") << G4endl
657 << " Process / Model: " << GetProcessName()<< " / "
658 << theModel->GetModelName() << G4endl
659 << " Primary: " << aPro.GetDefinition()->GetParticleName()
660 << " (" << aPro.GetDefinition()->GetPDGEncoding() << "), "
661 << " E= " << aPro.Get4Momentum().e()
662 << ", target nucleus (" << aNucleus.GetZ_asInt() << ", "
663 << aNucleus.GetA_asInt() << ")" << G4endl;
664 G4Exception("G4HadronicProcess:CheckResult()", "had012",
666 // must return here.....
667 return result;
668 }
669 }
670 G4double deltaE= nuclearMass + aPro.GetTotalEnergy() - finalE;
671
672 std::pair<G4double, G4double> checkLevels =
673 theModel->GetFatalEnergyCheckLevels(); // (relative, absolute)
674 if (std::abs(deltaE) > checkLevels.second &&
675 std::abs(deltaE) > checkLevels.first*aPro.GetKineticEnergy()){
676 // do not delete result, this is a pointer to a data member;
677 result->Clear();
678 result = nullptr;
680 desc << "Warning: Bad energy non-conservation detected, will "
681 << (epReportLevel<0 ? "abort the event"
682 : "re-sample the interaction") << G4endl
683 << " Process / Model: " << GetProcessName()<< " / "
684 << theModel->GetModelName() << G4endl
685 << " Primary: " << aPro.GetDefinition()->GetParticleName()
686 << " (" << aPro.GetDefinition()->GetPDGEncoding() << "), "
687 << " E= " << aPro.Get4Momentum().e()
688 << ", target nucleus (" << aNucleus.GetZ_asInt() << ", "
689 << aNucleus.GetA_asInt() << ")" << G4endl
690 << " E(initial - final) = " << deltaE << " MeV." << G4endl;
691 G4Exception("G4HadronicProcess:CheckResult()", "had012",
693 }
694 }
695 return result;
696}
@ EventMustBeAborted
@ stopAndKill
G4double GetMass() const
G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
G4double GetEnergyChange() const
G4HadFinalStateStatus GetStatusChange() const
G4double GetLocalEnergyDeposit() const
std::size_t GetNumberOfSecondaries() const
G4HadSecondary * GetSecondary(size_t i)
G4DynamicParticle * GetParticle()
virtual const std::pair< G4double, G4double > GetFatalEnergyCheckLevels() const

Referenced by G4HadronStoppingProcess::AtRestDoIt(), G4HadronElasticProcess::PostStepDoIt(), and PostStepDoIt().

◆ ChooseHadronicInteraction()

G4HadronicInteraction * G4HadronicProcess::ChooseHadronicInteraction ( const G4HadProjectile & aHadProjectile,
G4Nucleus & aTargetNucleus,
const G4Material * aMaterial,
const G4Element * anElement )
inlineprotected

Definition at line 350 of file G4HadronicProcess.hh.

355{
356 return theEnergyRangeManager.GetHadronicInteraction(aHadProjectile,
357 aTargetNucleus,
358 aMaterial,anElement);
359}
G4HadronicInteraction * GetHadronicInteraction(const G4HadProjectile &aHadProjectile, G4Nucleus &aTargetNucleus, const G4Material *aMaterial, const G4Element *anElement) const

Referenced by G4HadronStoppingProcess::AtRestDoIt(), G4HadronElasticProcess::PostStepDoIt(), and PostStepDoIt().

◆ ComputeCrossSection()

G4double G4HadronicProcess::ComputeCrossSection ( const G4ParticleDefinition * part,
const G4Material * mat,
const G4double kinEnergy )

Definition at line 897 of file G4HadronicProcess.cc.

900{
901 auto dp = new G4DynamicParticle(part, unitVector, kinEnergy);
903 delete dp;
904 return xs;
905}
G4double ComputeCrossSection(const G4DynamicParticle *, const G4Material *)

Referenced by G4HadXSHelper::FillPeaksStructure(), and G4HadXSHelper::FindCrossSectionMax().

◆ CrossSectionFactor()

G4double G4HadronicProcess::CrossSectionFactor ( ) const
inline

Definition at line 302 of file G4HadronicProcess.hh.

303{
304 return aScaleFactor;
305}

◆ CrossSectionType()

G4HadXSType G4HadronicProcess::CrossSectionType ( ) const
inline

Definition at line 291 of file G4HadronicProcess.hh.

292{
293 return fXSType;
294}

Referenced by BuildPhysicsTable().

◆ DumpPhysicsTable()

void G4HadronicProcess::DumpPhysicsTable ( const G4ParticleDefinition & p)

Definition at line 869 of file G4HadronicProcess.cc.

870{
872}
void DumpPhysicsTable(const G4ParticleDefinition &)

◆ DumpState()

void G4HadronicProcess::DumpState ( const G4Track & aTrack,
const G4String & method,
G4ExceptionDescription & ed )
protected

Definition at line 844 of file G4HadronicProcess.cc.

847{
848 ed << "Unrecoverable error in the method " << method << " of "
849 << GetProcessName() << G4endl;
850 ed << "TrackID= "<< aTrack.GetTrackID() << " ParentID= "
851 << aTrack.GetParentID()
852 << " " << aTrack.GetParticleDefinition()->GetParticleName()
853 << G4endl;
854 ed << "Ekin(GeV)= " << aTrack.GetKineticEnergy()/CLHEP::GeV
855 << "; direction= " << aTrack.GetMomentumDirection() << G4endl;
856 ed << "Position(mm)= " << aTrack.GetPosition()/CLHEP::mm << ";";
857
858 if (aTrack.GetMaterial()) {
859 ed << " material " << aTrack.GetMaterial()->GetName();
860 }
861 ed << G4endl;
862
863 if (aTrack.GetVolume()) {
864 ed << "PhysicalVolume <" << aTrack.GetVolume()->GetName()
865 << ">" << G4endl;
866 }
867}
const G4String & GetName() const
G4int GetTrackID() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
G4Material * GetMaterial() const
const G4ThreeVector & GetMomentumDirection() const
G4int GetParentID() const
const G4String & GetName() const

Referenced by G4HadronStoppingProcess::AtRestDoIt(), G4ElNeutrinoNucleusProcess::PostStepDoIt(), G4HadronElasticProcess::PostStepDoIt(), PostStepDoIt(), G4MuNeutrinoNucleusProcess::PostStepDoIt(), G4NeutrinoElectronProcess::PostStepDoIt(), and G4TauNeutrinoNucleusProcess::PostStepDoIt().

◆ EnergyOfCrossSectionMax()

std::vector< G4double > * G4HadronicProcess::EnergyOfCrossSectionMax ( ) const
inline

Definition at line 345 of file G4HadronicProcess.hh.

346{
347 return theEnergyOfCrossSectionMax;
348}

Referenced by BuildPhysicsTable().

◆ FillResult()

void G4HadronicProcess::FillResult ( G4HadFinalState * aR,
const G4Track & aT )
protected

Definition at line 502 of file G4HadronicProcess.cc.

503{
505 const G4ThreeVector& dir = aT.GetMomentumDirection();
506
507 G4double efinal = std::max(aR->GetEnergyChange(), 0.0);
508
509 // check status of primary
510 if(aR->GetStatusChange() == stopAndKill) {
513
514 // check its final energy
515 } else if(0.0 == efinal) {
518 ->GetAtRestProcessVector()->size() > 0)
521
522 // primary is not killed apply rotation and Lorentz transformation
523 } else {
525 G4ThreeVector newDir = aR->GetMomentumChange();
526 newDir.rotateUz(dir);
529 }
530 //G4cout << "FillResult: Efinal= " << efinal << " status= "
531 // << theTotalResult->GetTrackStatus()
532 // << " fKill= " << fStopAndKill << G4endl;
533
534 // check secondaries
535 nICelectrons = 0;
536 G4int nSec = (G4int)aR->GetNumberOfSecondaries();
538 G4double time0 = aT.GetGlobalTime();
539
540 for (G4int i = 0; i < nSec; ++i) {
541 G4DynamicParticle* dynParticle = aR->GetSecondary(i)->GetParticle();
542
543 // apply rotation
544 G4ThreeVector newDir = dynParticle->GetMomentumDirection();
545 newDir.rotateUz(dir);
546 dynParticle->SetMomentumDirection(newDir);
547
548 // check if secondary is on the mass shell
549 const G4ParticleDefinition* part = dynParticle->GetDefinition();
550 G4double mass = part->GetPDGMass();
551 G4double dmass= dynParticle->GetMass();
552 const G4double delta_mass_lim = 1.0*CLHEP::keV;
553 const G4double delta_ekin = 0.001*CLHEP::eV;
554 if(std::abs(dmass - mass) > delta_mass_lim) {
555 G4double e =
556 std::max(dynParticle->GetKineticEnergy() + dmass - mass, delta_ekin);
557 if(verboseLevel > 1) {
559 ed << "TrackID= "<< aT.GetTrackID()
560 << " " << aT.GetParticleDefinition()->GetParticleName()
561 << " Target Z= " << targetNucleus.GetZ_asInt() << " A= "
562 << targetNucleus.GetA_asInt()
563 << " Ekin(GeV)= " << aT.GetKineticEnergy()/CLHEP::GeV
564 << "\n Secondary is out of mass shell: " << part->GetParticleName()
565 << " EkinNew(MeV)= " << e
566 << " DeltaMass(MeV)= " << dmass - mass << G4endl;
567 G4Exception("G4HadronicProcess::FillResults", "had012", JustWarning, ed);
568 }
569 dynParticle->SetKineticEnergy(e);
570 dynParticle->SetMass(mass);
571 }
572 G4int idModel = aR->GetSecondary(i)->GetCreatorModelID();
573 if(part->GetPDGEncoding() == 11) { ++nICelectrons; }
574
575 // time of interaction starts from zero + global time
576 G4double time = std::max(aR->GetSecondary(i)->GetTime(), 0.0) + time0;
577
578 G4Track* track = new G4Track(dynParticle, time, aT.GetPosition());
579 track->SetCreatorModelID(idModel);
582 G4double newWeight = fWeight*aR->GetSecondary(i)->GetWeight();
583 track->SetWeight(newWeight);
586 }
587 aR->Clear();
588 // G4cout << "FillResults done nICe= " << nICelectrons << G4endl;
589}
@ fAlive
@ fStopButAlive
Hep3Vector & rotateUz(const Hep3Vector &)
void SetMomentumDirection(const G4ThreeVector &aDirection)
const G4ThreeVector & GetMomentumDirection() const
void SetMass(G4double mass)
G4double GetKineticEnergy() const
void SetKineticEnergy(G4double aEnergy)
const G4ThreeVector & GetMomentumChange() const
G4int GetParentResonanceID() const
G4double GetWeight() const
const G4ParticleDefinition * GetParentResonanceDef() const
G4double GetTime() const
G4int GetCreatorModelID() const
void AddSecondary(G4Track *aSecondary)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4ProcessManager * GetProcessManager() const
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
std::size_t size() const
void SetWeight(G4double aValue)
void SetParentResonanceID(const G4int parentID)
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4double GetGlobalTime() const
const G4TouchableHandle & GetTouchableHandle() const
void SetCreatorModelID(const G4int id)
void SetParentResonanceDef(const G4ParticleDefinition *parent)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetNumberOfSecondaries(G4int totSecondaries)
G4int verboseLevel

Referenced by G4ElNeutrinoNucleusProcess::PostStepDoIt(), G4HadronElasticProcess::PostStepDoIt(), PostStepDoIt(), G4MuNeutrinoNucleusProcess::PostStepDoIt(), G4NeutrinoElectronProcess::PostStepDoIt(), and G4TauNeutrinoNucleusProcess::PostStepDoIt().

◆ GetCrossSectionDataStore()

◆ GetElementCrossSection()

G4double G4HadronicProcess::GetElementCrossSection ( const G4DynamicParticle * part,
const G4Element * elm,
const G4Material * mat = nullptr )

Definition at line 144 of file G4HadronicProcess.cc.

147{
148 if(nullptr == mat)
149 {
150 static const G4int nmax = 5;
151 if(nMatWarn < nmax) {
152 ++nMatWarn;
154 ed << "Cannot compute Element x-section for " << GetProcessName()
155 << " because no material defined \n"
156 << " Please, specify material pointer or define simple material"
157 << " for Z= " << elm->GetZasInt();
158 G4Exception("G4HadronicProcess::GetElementCrossSection", "had066",
159 JustWarning, ed);
160 }
161 }
162 return theCrossSectionDataStore->GetCrossSection(dp, elm, mat);
163}
G4double GetCrossSection(const G4DynamicParticle *, const G4Material *)
G4int GetZasInt() const
Definition G4Element.hh:120

Referenced by G4HadronicProcessStore::GetCaptureCrossSectionPerAtom(), G4HadronicProcessStore::GetChargeExchangeCrossSectionPerAtom(), G4HadronicProcessStore::GetElasticCrossSectionPerAtom(), G4HadronicProcessStore::GetFissionCrossSectionPerAtom(), G4HadronicProcessStore::GetInelasticCrossSectionPerAtom(), and GetMicroscopicCrossSection().

◆ GetEnergyMomentumCheckLevels()

std::pair< G4double, G4double > G4HadronicProcess::GetEnergyMomentumCheckLevels ( ) const
inline

Definition at line 327 of file G4HadronicProcess.hh.

328{
329 return epCheckLevels;
330}

◆ GetHadronicInteraction()

G4HadronicInteraction * G4HadronicProcess::GetHadronicInteraction ( ) const
inline

Definition at line 274 of file G4HadronicProcess.hh.

275{
276 return theInteraction;
277}

Referenced by CheckEnergyMomentumConservation(), and CheckResult().

◆ GetHadronicInteractionList()

◆ GetHadronicModel()

G4HadronicInteraction * G4HadronicProcess::GetHadronicModel ( const G4String & modelName)

Definition at line 886 of file G4HadronicProcess.cc.

887{
888 std::vector<G4HadronicInteraction*>& list
889 = theEnergyRangeManager.GetHadronicInteractionList();
890 for (auto & mod : list) {
891 if (mod->GetModelName() == modelName) return mod;
892 }
893 return nullptr;
894}

◆ GetLastCrossSection()

G4double G4HadronicProcess::GetLastCrossSection ( )
inlineprotected

Definition at line 366 of file G4HadronicProcess.hh.

367{
368 return theLastCrossSection;
369}

◆ GetMeanFreePath()

G4double G4HadronicProcess::GetMeanFreePath ( const G4Track & aTrack,
G4double ,
G4ForceCondition *  )
overridevirtual

◆ GetMicroscopicCrossSection()

G4double G4HadronicProcess::GetMicroscopicCrossSection ( const G4DynamicParticle * part,
const G4Element * elm,
const G4Material * mat = nullptr )
inline

Definition at line 265 of file G4HadronicProcess.hh.

269{
270 return GetElementCrossSection(part, elm, mat);
271}
G4double GetElementCrossSection(const G4DynamicParticle *part, const G4Element *elm, const G4Material *mat=nullptr)

◆ GetTargetIsotope()

const G4Isotope * G4HadronicProcess::GetTargetIsotope ( )
inline

Definition at line 285 of file G4HadronicProcess.hh.

286{
287 return targetNucleus.GetIsotope();
288}
const G4Isotope * GetIsotope()
Definition G4Nucleus.hh:111

◆ GetTargetNucleus()

const G4Nucleus * G4HadronicProcess::GetTargetNucleus ( ) const
inline

Definition at line 280 of file G4HadronicProcess.hh.

281{
282 return &targetNucleus;
283}

◆ GetTargetNucleusPointer()

◆ MultiplyCrossSectionBy()

void G4HadronicProcess::MultiplyCrossSectionBy ( G4double factor)

Definition at line 591 of file G4HadronicProcess.cc.

592{
594}
void BiasCrossSectionByFactor(G4double aScale)

Referenced by G4HadProcesses::BuildNeutronElastic(), G4HadProcesses::BuildNeutronInelasticAndCapture(), G4HadronDElasticPhysics::ConstructProcess(), G4HadronElasticPhysics::ConstructProcess(), G4HadronHElasticPhysics::ConstructProcess(), G4HadronInelasticQBBC::ConstructProcess(), G4HadronInelasticQBBC_ABLA::ConstructProcess(), G4HadronPhysicsFTFQGSP_BERT::ConstructProcess(), G4HadronPhysicsFTF_BIC::Kaon(), G4HadronPhysicsFTFP_BERT::Kaon(), G4HadronPhysicsINCLXX::Kaon(), G4HadronPhysicsFTF_BIC::Neutron(), G4HadronPhysicsFTFP_BERT::Neutron(), G4HadronPhysicsFTFP_BERT_HP::Neutron(), G4HadronPhysicsINCLXX::Neutron(), G4HadronPhysicsQGS_BIC::Neutron(), G4HadronPhysicsQGSP_BERT::Neutron(), G4HadronPhysicsQGSP_BIC::Neutron(), G4HadronPhysicsQGSP_BIC_HP::Neutron(), G4HadronPhysicsShielding::Neutron(), G4HadronPhysicsFTF_BIC::Pion(), G4HadronPhysicsFTFP_BERT::Pion(), G4HadronPhysicsINCLXX::Pion(), G4HadronPhysicsQGS_BIC::Pion(), G4HadronPhysicsQGSP_BERT::Pion(), G4HadronPhysicsQGSP_BIC::Pion(), G4HadronPhysicsFTF_BIC::Proton(), G4HadronPhysicsFTFP_BERT::Proton(), G4HadronPhysicsINCLXX::Proton(), G4HadronPhysicsNuBeam::Proton(), G4HadronPhysicsQGS_BIC::Proton(), G4HadronPhysicsQGSP_BERT::Proton(), G4HadronPhysicsQGSP_BIC::Proton(), and G4HadronPhysicsQGSP_BIC_AllHP::Proton().

◆ operator=()

G4HadronicProcess & G4HadronicProcess::operator= ( const G4HadronicProcess & right)
delete

◆ PostStepDoIt()

G4VParticleChange * G4HadronicProcess::PostStepDoIt ( const G4Track & aTrack,
const G4Step & aStep )
overridevirtual

Reimplemented from G4VDiscreteProcess.

Reimplemented in G4MuNeutrinoNucleusProcess, G4NeutrinoElectronProcess, G4NeutronGeneralProcess, and G4TauNeutrinoNucleusProcess.

Definition at line 321 of file G4HadronicProcess.cc.

322{
324
325 //G4cout << "PostStepDoIt " << aTrack.GetDefinition()->GetParticleName()
326 // << " Ekin= " << aTrack.GetKineticEnergy() << G4endl;
327 // if primary is not Alive then do nothing
329 theTotalResult->Initialize(aTrack);
330 fWeight = aTrack.GetWeight();
332 if(aTrack.GetTrackStatus() != fAlive) { return theTotalResult; }
333
334 // Find cross section at end of step and check if <= 0
335 //
336 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
337 const G4Material* aMaterial = aTrack.GetMaterial();
338
339 // check only for charged particles
340 if(fXSType != fHadNoIntegral) {
343 theCrossSectionDataStore->ComputeCrossSection(aParticle,aMaterial);
344 //G4cout << "xs=" << xs << " xs0=" << theLastCrossSection
345 // << " " << aMaterial->GetName() << G4endl;
347 // No interaction
348 return theTotalResult;
349 }
350 }
351
352 const G4Element* anElement =
353 theCrossSectionDataStore->SampleZandA(aParticle,aMaterial,targetNucleus);
354
355 // Next check for illegal track status
356 //
357 if (aTrack.GetTrackStatus() != fAlive &&
358 aTrack.GetTrackStatus() != fSuspend) {
359 if (aTrack.GetTrackStatus() == fStopAndKill ||
363 ed << "G4HadronicProcess: track in unusable state - "
364 << aTrack.GetTrackStatus() << G4endl;
365 ed << "G4HadronicProcess: returning unchanged track " << G4endl;
366 DumpState(aTrack,"PostStepDoIt",ed);
367 G4Exception("G4HadronicProcess::PostStepDoIt", "had004", JustWarning, ed);
368 }
369 // No warning for fStopButAlive which is a legal status here
370 return theTotalResult;
371 }
372
373 // Initialize the hadronic projectile from the track
374 thePro.Initialise(aTrack);
375
376 theInteraction = ChooseHadronicInteraction(thePro, targetNucleus,
377 aMaterial, anElement);
378 if(nullptr == theInteraction) {
380 ed << "Target element "<<anElement->GetName()<<" Z= "
381 << targetNucleus.GetZ_asInt() << " A= "
382 << targetNucleus.GetA_asInt() << G4endl;
383 DumpState(aTrack,"ChooseHadronicInteraction",ed);
384 ed << " No HadronicInteraction found out" << G4endl;
385 G4Exception("G4HadronicProcess::PostStepDoIt", "had005",
386 FatalException, ed);
387 return theTotalResult;
388 }
389
390 G4HadFinalState* result = nullptr;
391 G4int reentryCount = 0;
392 /*
393 G4cout << "### " << aParticle->GetDefinition()->GetParticleName()
394 << " Ekin(MeV)= " << aParticle->GetKineticEnergy()
395 << " Z= " << targetNucleus.GetZ_asInt()
396 << " A= " << targetNucleus.GetA_asInt()
397 << " by " << theInteraction->GetModelName()
398 << G4endl;
399 */
400 do
401 {
402 try
403 {
404 // Call the interaction
405 result = theInteraction->ApplyYourself( thePro, targetNucleus);
406 ++reentryCount;
407 }
408 catch(G4HadronicException & aR)
409 {
411 aR.Report(ed);
412 ed << "Call for " << theInteraction->GetModelName() << G4endl;
413 ed << "Target element "<<anElement->GetName()<<" Z= "
414 << targetNucleus.GetZ_asInt()
415 << " A= " << targetNucleus.GetA_asInt() << G4endl;
416 DumpState(aTrack,"ApplyYourself",ed);
417 ed << " ApplyYourself failed" << G4endl;
418 G4Exception("G4HadronicProcess::PostStepDoIt", "had006", FatalException,
419 ed);
420 }
421
422 // Check the result for catastrophic energy non-conservation
423 result = CheckResult(thePro, targetNucleus, result);
424
425 if(reentryCount>100) {
427 ed << "Call for " << theInteraction->GetModelName() << G4endl;
428 ed << "Target element "<<anElement->GetName()<<" Z= "
429 << targetNucleus.GetZ_asInt()
430 << " A= " << targetNucleus.GetA_asInt() << G4endl;
431 DumpState(aTrack,"ApplyYourself",ed);
432 ed << " ApplyYourself does not completed after 100 attempts" << G4endl;
433 G4Exception("G4HadronicProcess::PostStepDoIt", "had006", FatalException,
434 ed);
435 }
436 }
437 while(!result); /* Loop checking, 30-Oct-2015, G.Folger */
438
439 // Check whether kaon0 or anti_kaon0 are present between the secondaries:
440 // if this is the case, transform them into either kaon0S or kaon0L,
441 // with equal, 50% probability, keeping their dynamical masses (and
442 // the other kinematical properties).
443 // When this happens - very rarely - a "JustWarning" exception is thrown.
444 // Because Fluka-Cern produces kaon0 and anti_kaon0, we reduce the number
445 // of warnings to max 1 per thread.
446 G4int nSec = (G4int)result->GetNumberOfSecondaries();
447 if ( nSec > 0 ) {
448 for ( G4int i = 0; i < nSec; ++i ) {
449 auto dynamicParticle = result->GetSecondary(i)->GetParticle();
450 auto part = dynamicParticle->GetParticleDefinition();
451 if ( part == G4KaonZero::Definition() ||
452 part == G4AntiKaonZero::Definition() ) {
453 G4ParticleDefinition* newPart;
454 if ( G4UniformRand() > 0.5 ) { newPart = G4KaonZeroShort::Definition(); }
455 else { newPart = G4KaonZeroLong::Definition(); }
456 dynamicParticle->SetDefinition( newPart );
457 if ( nKaonWarn < 1 ) {
458 ++nKaonWarn;
460 ed << " Hadronic model " << theInteraction->GetModelName() << G4endl;
461 ed << " created " << part->GetParticleName() << G4endl;
462 ed << " -> forced to be " << newPart->GetParticleName() << G4endl;
463 G4Exception( "G4HadronicProcess::PostStepDoIt", "had007", JustWarning, ed );
464 }
465 }
466 }
467 }
468
470 FillResult(result, aTrack);
471
472 if (epReportLevel != 0) {
473 CheckEnergyMomentumConservation(aTrack, targetNucleus);
474 }
475 //G4cout << "PostStepDoIt done nICelectrons= " << nICelectrons << G4endl;
476 return theTotalResult;
477}
@ FatalException
@ fKillTrackAndSecondaries
@ fSuspend
@ fPostponeToNextEvent
#define G4UniformRand()
Definition Randomize.hh:52
static G4AntiKaonZero * Definition()
const G4Element * SampleZandA(const G4DynamicParticle *, const G4Material *, G4Nucleus &target)
const G4ParticleDefinition * GetParticleDefinition() const
const G4String & GetName() const
Definition G4Element.hh:115
void SetTrafoToLab(const G4LorentzRotation &aT)
void Initialise(const G4Track &aT)
G4LorentzRotation & GetTrafoToLab()
void Report(std::ostream &aS) const
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
void FillResult(G4HadFinalState *aR, const G4Track &aT)
G4HadProjectile thePro
G4HadFinalState * CheckResult(const G4HadProjectile &thePro, const G4Nucleus &targetNucleus, G4HadFinalState *result)
G4HadronicInteraction * ChooseHadronicInteraction(const G4HadProjectile &aHadProjectile, G4Nucleus &aTargetNucleus, const G4Material *aMaterial, const G4Element *anElement)
void CheckEnergyMomentumConservation(const G4Track &, const G4Nucleus &)
void DumpState(const G4Track &, const G4String &, G4ExceptionDescription &)
static G4KaonZeroLong * Definition()
static G4KaonZeroShort * Definition()
static G4KaonZero * Definition()
Definition G4KaonZero.cc:48
void Initialize(const G4Track &) override
G4TrackStatus GetTrackStatus() const
G4double GetWeight() const
void ProposeWeight(G4double finalWeight)
G4double theNumberOfInteractionLengthLeft

Referenced by G4NeutronGeneralProcess::PostStepDoIt().

◆ PostStepGetPhysicalInteractionLength()

G4double G4HadronicProcess::PostStepGetPhysicalInteractionLength ( const G4Track & track,
G4double previousStepSize,
G4ForceCondition * condition )
overridevirtual

Reimplemented from G4VDiscreteProcess.

Reimplemented in G4HadronStoppingProcess, G4MuNeutrinoNucleusProcess, G4NeutrinoElectronProcess, G4NeutronGeneralProcess, and G4TauNeutrinoNucleusProcess.

Definition at line 275 of file G4HadronicProcess.cc.

279{
281
282 const G4Material* mat = track.GetMaterial();
283 if(mat != currentMat) {
284 currentMat = mat;
286 matIdx = (G4int)track.GetMaterial()->GetIndex();
287 }
288 UpdateCrossSectionAndMFP(track.GetKineticEnergy());
289
290 // zero cross section
291 if(theLastCrossSection <= 0.0) {
294 return DBL_MAX;
295 }
296
297 // non-zero cross section
301 } else {
303 previousStepSize/currentInteractionLength;
306 }
309}
G4double condition(const G4ErrorSymMatrix &m)
@ NotForced
G4double G4Log(G4double x)
Definition G4Log.hh:227
std::size_t GetIndex() const
G4double currentInteractionLength
G4double theInitialNumberOfInteractionLength

◆ PreparePhysicsTable()

void G4HadronicProcess::PreparePhysicsTable ( const G4ParticleDefinition & p)
overridevirtual

Reimplemented from G4VProcess.

Reimplemented in G4HadronStoppingProcess, and G4NeutronGeneralProcess.

Definition at line 165 of file G4HadronicProcess.cc.

166{
167 if(nullptr == firstParticle) { firstParticle = &p; }
168 theProcessStore->RegisterParticle(this, &p);
169}
void RegisterParticle(G4HadronicProcess *, const G4ParticleDefinition *)

Referenced by G4GammaGeneralProcess::PreparePhysicsTable(), and G4NeutronGeneralProcess::PreparePhysicsTable().

◆ ProcessDescription()

void G4HadronicProcess::ProcessDescription ( std::ostream & outFile) const
overridevirtual

◆ RegisterMe()

void G4HadronicProcess::RegisterMe ( G4HadronicInteraction * a)

Definition at line 136 of file G4HadronicProcess.cc.

137{
138 if(nullptr == a) { return; }
139 theEnergyRangeManager.RegisterMe( a );
141}
void RegisterMe(G4HadronicInteraction *a)
void RegisterInteraction(G4HadronicProcess *, G4HadronicInteraction *)

Referenced by G4AlphaPHPBuilder::Build(), G4BertiniElectroNuclearBuilder::Build(), G4BertiniKaonBuilder::Build(), G4BertiniNeutronBuilder::Build(), G4BertiniPiKBuilder::Build(), G4BertiniPionBuilder::Build(), G4BertiniProtonBuilder::Build(), G4BinaryAlphaBuilder::Build(), G4BinaryDeuteronBuilder::Build(), G4BinaryHe3Builder::Build(), G4BinaryNeutronBuilder::Build(), G4BinaryPiKBuilder::Build(), G4BinaryPionBuilder::Build(), G4BinaryProtonBuilder::Build(), G4BinaryTritonBuilder::Build(), G4DeuteronPHPBuilder::Build(), G4FTFBinaryKaonBuilder::Build(), G4FTFBinaryNeutronBuilder::Build(), G4FTFBinaryPiKBuilder::Build(), G4FTFBinaryPionBuilder::Build(), G4FTFBinaryProtonBuilder::Build(), G4FTFPAntiBarionBuilder::Build(), G4FTFPKaonBuilder::Build(), G4FTFPNeutronBuilder::Build(), G4FTFPPiKBuilder::Build(), G4FTFPPionBuilder::Build(), G4FTFPProtonBuilder::Build(), G4He3PHPBuilder::Build(), G4HyperonFTFPBuilder::Build(), G4HyperonQGSPBuilder::Build(), G4INCLXXNeutronBuilder::Build(), G4INCLXXPionBuilder::Build(), G4INCLXXProtonBuilder::Build(), G4LENDBertiniGammaElectroNuclearBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronLENDBuilder::Build(), G4NeutronPHPBuilder::Build(), G4NeutronPHPBuilder::Build(), G4NeutronPHPBuilder::Build(), G4NeutronPHPBuilder::Build(), G4PrecoNeutronBuilder::Build(), G4PrecoProtonBuilder::Build(), G4ProtonPHPBuilder::Build(), G4QGSBinaryKaonBuilder::Build(), G4QGSBinaryNeutronBuilder::Build(), G4QGSBinaryPiKBuilder::Build(), G4QGSBinaryPionBuilder::Build(), G4QGSBinaryProtonBuilder::Build(), G4QGSPAntiBarionBuilder::Build(), G4QGSPKaonBuilder::Build(), G4QGSPLundStrFragmProtonBuilder::Build(), G4QGSPNeutronBuilder::Build(), G4QGSPPiKBuilder::Build(), G4QGSPPionBuilder::Build(), G4QGSPProtonBuilder::Build(), G4TritonPHPBuilder::Build(), G4HadProcesses::BuildNeutronInelasticAndCapture(), LBE::ConstructHad(), G4EmExtraPhysics::ConstructProcess(), G4HadronDElasticPhysics::ConstructProcess(), G4HadronElasticPhysics::ConstructProcess(), G4HadronElasticPhysicsHP::ConstructProcess(), G4HadronElasticPhysicsHPT::ConstructProcess(), G4HadronElasticPhysicsLEND::ConstructProcess(), G4HadronElasticPhysicsPHP::ConstructProcess(), G4HadronElasticPhysicsVI::ConstructProcess(), G4HadronHElasticPhysics::ConstructProcess(), G4HadronInelasticQBBC::ConstructProcess(), G4HadronInelasticQBBC_ABLA::ConstructProcess(), G4HadronPhysicsFTFQGSP_BERT::ConstructProcess(), G4IonElasticPhysics::ConstructProcess(), G4ThermalNeutrons::ConstructProcess(), G4HadronicAbsorptionBertini::G4HadronicAbsorptionBertini(), G4HadronicAbsorptionFritiof::G4HadronicAbsorptionFritiof(), G4HadronicAbsorptionFritiofWithBinaryCascade::G4HadronicAbsorptionFritiofWithBinaryCascade(), G4HadronicAbsorptionINCLXX::G4HadronicAbsorptionINCLXX(), G4MuonMinusCapture::G4MuonMinusCapture(), G4HadronPhysicsFTF_BIC::Neutron(), G4HadronPhysicsFTFP_BERT::Neutron(), G4HadronPhysicsFTFP_BERT_HP::Neutron(), G4HadronPhysicsINCLXX::Neutron(), G4HadronPhysicsQGS_BIC::Neutron(), G4HadronPhysicsQGSP_BERT::Neutron(), G4HadronPhysicsQGSP_BIC::Neutron(), G4HadronPhysicsQGSP_BIC_HP::Neutron(), and G4HadronPhysicsShielding::Neutron().

◆ SetCrossSectionType()

void G4HadronicProcess::SetCrossSectionType ( G4HadXSType val)
inline

Definition at line 297 of file G4HadronicProcess.hh.

298{
299 fXSType = val;
300}

◆ SetEnergyMomentumCheckLevels()

void G4HadronicProcess::SetEnergyMomentumCheckLevels ( G4double relativeLevel,
G4double absoluteLevel )
inline

Definition at line 318 of file G4HadronicProcess.hh.

320{
321 epCheckLevels.first = relativeLevel;
322 epCheckLevels.second = absoluteLevel;
323 levelsSetByProcess = true;
324}

◆ SetEpReportLevel()

void G4HadronicProcess::SetEpReportLevel ( G4int level)
inline

Definition at line 312 of file G4HadronicProcess.hh.

313{
314 epReportLevel = level;
315}

◆ SetIntegral()

void G4HadronicProcess::SetIntegral ( G4bool val)
inline

Definition at line 307 of file G4HadronicProcess.hh.

308{
309 useIntegralXS = val;
310}

◆ StartTracking()

void G4HadronicProcess::StartTracking ( G4Track * track)
overridevirtual

Reimplemented from G4VProcess.

Reimplemented in G4NeutronGeneralProcess.

Definition at line 267 of file G4HadronicProcess.cc.

268{
269 currentMat = nullptr;
270 currentParticle = track->GetDefinition();
271 fDynParticle = track->GetDynamicParticle();
273}

◆ TwoPeaksXS()

std::vector< G4TwoPeaksHadXS * > * G4HadronicProcess::TwoPeaksXS ( ) const
inline

Definition at line 339 of file G4HadronicProcess.hh.

340{
341 return fXSpeaks;
342}

Referenced by BuildPhysicsTable().

Member Data Documentation

◆ aScaleFactor

G4double G4HadronicProcess::aScaleFactor = 1.0
protected

◆ epReportLevel

◆ fWeight

G4double G4HadronicProcess::fWeight = 1.0
protected

Definition at line 220 of file G4HadronicProcess.hh.

Referenced by FillResult(), and PostStepDoIt().

◆ fXSType

◆ mfpKinEnergy

G4double G4HadronicProcess::mfpKinEnergy = DBL_MAX
protected

◆ theCrossSectionDataStore

◆ theLastCrossSection

G4double G4HadronicProcess::theLastCrossSection = 0.0
protected

◆ thePro

◆ theTotalResult


The documentation for this class was generated from the following files: