Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -14,6 +14,38 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
8 June 2018 J. Yarba (hadr-man-V10-04-04)
---------------------------------------------------
- G4HadronicProcess - use correct return type when calling CheckResult
(from PostStepDoIt); otherwise the value of pointer 'result' does not
get properly reset to NULL in case a non-conservation is detected,
thus "bad" interaction does not get re-sampled
31 May 2017 V. Ivanchenko (hadr-man-V10-04-03)
---------------------------------------------------
- G4HadronicProcess, G4HadronInelasticProcess - added keyword
"override", cleanup cross section scale factor and weights
- G4HadronicProcessStore - use "nullptr", added flag buildXSTable
and get/set methods
30 May 2017 V. Ivanchenko (hadr-man-V10-04-02)
---------------------------------------------------
- G4HadronicProcess, G4VLeadingParticleBiasing, G4HadLeadBias
fixed compilation warning of CMSSW at gcc7.0.0
29 May 2017 V. Ivanchenko (hadr-man-V10-04-01)
---------------------------------------------------
- G4HadronicProcess - use const pointers and "nullptr" for
G4Material and G4Element, use ComputeCrossSection(...) method,
remove creation of new materials in run time inside
GetElementCrossSection(..) method, all materials should
be created in user code
09 May 2018 Alberto Ribon (hadr-man-V10-04-00)
---------------------------------------------------
- G4HadronicProcess : fixed warnings in gcc 8 regarding catching
polymorphic type by value, instead of by reference.
12 September 2017 Krzysztof Genser (hadr-man-V10-03-06)
---------------------------------------------------
- G4HadronicProcessType.hh added fMuAtomicCapture
@@ -29,12 +29,10 @@
#define G4HadLeadBias_h
#include "G4VLeadingParticleBiasing.hh"
#include <vector>
#include "G4HadFinalState.hh"
class G4HadLeadBias : public G4VLeadingParticleBiasing
{
public:
public:
virtual G4HadFinalState * Bias(G4HadFinalState * result);
virtual ~G4HadLeadBias() {};
};
@@ -50,17 +50,19 @@ class G4HadronInelasticProcess : public G4HadronicProcess
public:
G4HadronInelasticProcess(const G4String &processName,
G4ParticleDefinition *aParticle );
G4ParticleDefinition*);
virtual ~G4HadronInelasticProcess();
~G4HadronInelasticProcess() override;
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
G4bool IsApplicable(const G4ParticleDefinition&) override;
private:
G4ParticleDefinition* theParticle;
// hide assignment operator as private
G4HadronInelasticProcess& operator=
(const G4HadronInelasticProcess& right) = delete;
G4HadronInelasticProcess(const G4HadronInelasticProcess&) = delete;
};
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicProcess.hh 104121 2017-05-11 13:49:37Z gcosmo $
// $Id: G4HadronicProcess.hh 110586 2018-05-31 12:01:42Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -53,18 +53,18 @@
#include "G4EnergyRangeManager.hh"
#include "G4Nucleus.hh"
#include "G4ReactionProduct.hh"
#include <vector>
#include "G4VCrossSectionDataSet.hh"
#include "G4VLeadingParticleBiasing.hh"
#include "G4CrossSectionDataStore.hh"
#include "G4HadronicProcessType.hh"
#include "G4CrossSectionDataStore.hh"
#include <vector>
class G4Track;
class G4Step;
class G4Element;
class G4ParticleChange;
class G4HadronicInteraction;
class G4HadronicProcessStore;
class G4VCrossSectionDataSet;
class G4VLeadingParticleBiasing;
class G4HadronicProcess : public G4VDiscreteProcess
{
@@ -76,7 +76,7 @@ public:
G4HadronicProcess(const G4String& processName,
G4HadronicProcessType subType);
virtual ~G4HadronicProcess();
~G4HadronicProcess() override;
// register generator of secondaries
void RegisterMe(G4HadronicInteraction* a);
@@ -94,30 +94,27 @@ public:
{ return GetElementCrossSection(part, elm, mat); }
// generic PostStepDoIt recommended for all derived classes
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep);
G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep) override;
// initialisation of physics tables and G4HadronicProcessStore
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
void PreparePhysicsTable(const G4ParticleDefinition&) override;
// build physics tables and print out the configuration of the process
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&) override;
// dump physics tables
inline void DumpPhysicsTable(const G4ParticleDefinition& p)
{ theCrossSectionDataStore->DumpPhysicsTable(p); }
void DumpPhysicsTable(const G4ParticleDefinition& p);
// add cross section data set
inline void AddDataSet(G4VCrossSectionDataSet * aDataSet)
{ theCrossSectionDataStore->AddDataSet(aDataSet);}
void AddDataSet(G4VCrossSectionDataSet * aDataSet);
// access to the list of hadronic interactions
std::vector<G4HadronicInteraction*>& GetHadronicInteractionList()
{ return theEnergyRangeManager.GetHadronicInteractionList(); }
std::vector<G4HadronicInteraction*>& GetHadronicInteractionList();
// get inverse cross section per volume
G4double GetMeanFreePath(const G4Track &aTrack, G4double,
G4ForceCondition *);
G4ForceCondition *) override;
// access to the target nucleus
inline const G4Nucleus* GetTargetNucleus() const
@@ -127,15 +124,15 @@ public:
inline const G4Isotope* GetTargetIsotope()
{ return targetNucleus.GetIsotope(); }
virtual void ProcessDescription(std::ostream& outFile) const;
void ProcessDescription(std::ostream& outFile) const override;
protected:
// generic method to choose secondary generator
// recommended for all derived classes
inline G4HadronicInteraction* ChooseHadronicInteraction(
const G4HadProjectile & aHadProjectile, G4Nucleus & aTargetNucleus,
G4Material* aMaterial, G4Element* anElement)
const G4HadProjectile & aHadProjectile, G4Nucleus& aTargetNucleus,
const G4Material* aMaterial, const G4Element* anElement)
{ return theEnergyRangeManager.GetHadronicInteraction(aHadProjectile,
aTargetNucleus,
aMaterial,anElement);
@@ -147,7 +144,11 @@ protected:
public:
// scale cross section
void BiasCrossSectionByFactor(G4double aScale);
void MultiplyCrossSectionBy(G4double factor);
inline G4double CrossSectionFactor() const
{ return aScaleFactor; }
// Integral option
inline void SetIntegral(G4bool val)
@@ -170,9 +171,6 @@ public:
inline G4CrossSectionDataStore* GetCrossSectionDataStore()
{return theCrossSectionDataStore;}
inline void MultiplyCrossSectionBy(G4double factor)
{ aScaleFactor = factor; }
protected:
void DumpState(const G4Track&, const G4String&, G4ExceptionDescription&);
@@ -216,6 +214,8 @@ protected:
G4ParticleChange* theTotalResult;
G4double fWeight;
G4int epReportLevel;
private:
@@ -244,7 +244,7 @@ private:
std::pair<G4double, G4double> epCheckLevels;
G4bool levelsSetByProcess;
std::vector<G4VLeadingParticleBiasing *> theBias;
std::vector<G4VLeadingParticleBiasing*> theBias;
G4double theInitialNumberOfInteractionLength;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicProcessStore.hh 90394 2015-05-27 12:14:48Z gcosmo $
// $Id: G4HadronicProcessStore.hh 110586 2018-05-31 12:01:42Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -82,7 +82,7 @@ public:
G4double kineticEnergy,
const G4VProcess* process,
const G4Element* element,
const G4Material* material=0);
const G4Material* material=nullptr);
G4double GetCrossSectionPerVolume(
const G4ParticleDefinition* particle,
@@ -98,7 +98,8 @@ public:
G4double GetInelasticCrossSectionPerAtom(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Element *anElement, const G4Material* mat=0);
const G4Element *anElement,
const G4Material* mat=nullptr);
G4double GetInelasticCrossSectionPerIsotope(
const G4ParticleDefinition *aParticle,
@@ -128,7 +129,8 @@ public:
G4double GetCaptureCrossSectionPerAtom(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Element *anElement, const G4Material* mat=0);
const G4Element *anElement,
const G4Material* mat=nullptr);
G4double GetCaptureCrossSectionPerIsotope(
const G4ParticleDefinition *aParticle,
@@ -143,7 +145,8 @@ public:
G4double GetFissionCrossSectionPerAtom(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Element *anElement, const G4Material* mat=0);
const G4Element *anElement,
const G4Material* mat=nullptr);
G4double GetFissionCrossSectionPerIsotope(
const G4ParticleDefinition *aParticle,
@@ -158,7 +161,8 @@ public:
G4double GetChargeExchangeCrossSectionPerAtom(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4Element *anElement, const G4Material* mat=0);
const G4Element *anElement,
const G4Material* mat=nullptr);
G4double GetChargeExchangeCrossSectionPerIsotope(
const G4ParticleDefinition *aParticle,
@@ -184,6 +188,10 @@ public:
void DeRegisterExtraProcess(G4VProcess*);
void SetBuildXSTable(G4bool val);
G4bool GetBuildXSTable() const;
void PrintInfo(const G4ParticleDefinition*);
void Dump(G4int level);
@@ -243,6 +251,7 @@ private:
G4int verbose;
G4bool buildTableStart;
G4bool buildXSTable;
// cache
HP currentProcess;
@@ -23,18 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VLeadingParticleBiasing.hh 67989 2013-03-13 10:54:03Z gcosmo $
// $Id: G4VLeadingParticleBiasing.hh 110579 2018-05-30 15:03:30Z gcosmo $
//
// --------------------------------------------------------------------
#ifndef G4VLeadingParticleBiasing_h
#define G4VLeadingParticleBiasing_h
class G4HadFinalState;
#include "G4HadFinalState.hh"
class G4VLeadingParticleBiasing
{
public:
public:
explicit G4VLeadingParticleBiasing() {};
virtual ~G4VLeadingParticleBiasing() {};
virtual G4HadFinalState * Bias(G4HadFinalState * result) = 0;
};
@@ -44,17 +44,16 @@
#include "G4ParticleDefinition.hh"
G4HadronInelasticProcess::G4HadronInelasticProcess(const G4String& processName,
G4ParticleDefinition* aParticle):
G4ParticleDefinition*):
G4HadronicProcess(processName,fHadronInelastic)
{
AddDataSet(new G4HadronInelasticDataSet());
theParticle = aParticle;
}
G4HadronInelasticProcess::~G4HadronInelasticProcess()
{}
G4bool G4HadronInelasticProcess::IsApplicable(const G4ParticleDefinition& aP)
G4bool G4HadronInelasticProcess::IsApplicable(const G4ParticleDefinition&)
{
return theParticle == &aP || theParticle == G4GenericIon::GenericIon();
return true;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicProcess.cc 104121 2017-05-11 13:49:37Z gcosmo $
// $Id: G4HadronicProcess.cc 110727 2018-06-11 06:08:11Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -67,10 +67,13 @@
#include "G4HadronicException.hh"
#include "G4HadronicProcessStore.hh"
#include "G4VCrossSectionDataSet.hh"
#include "G4AutoLock.hh"
#include "G4NistManager.hh"
#include "G4PhysicsModelCatalog.hh"
#include "G4VLeadingParticleBiasing.hh"
#include "G4Exp.hh"
#include <typeinfo>
#include <sstream>
@@ -89,7 +92,6 @@ G4HadronicProcess::G4HadronicProcess(const G4String& processName,
: G4VDiscreteProcess(processName, procType)
{
SetProcessSubType(fHadronInelastic); // Default unless subclass changes
InitialiseLocal();
}
@@ -100,7 +102,6 @@ G4HadronicProcess::G4HadronicProcess(const G4String& processName,
: G4VDiscreteProcess(processName, fHadronic)
{
SetProcessSubType(aHadSubType);
InitialiseLocal();
}
@@ -119,7 +120,8 @@ void G4HadronicProcess::InitialiseLocal() {
theProcessStore = G4HadronicProcessStore::Instance();
theProcessStore->Register(this);
theInitialNumberOfInteractionLength = 0.0;
aScaleFactor = 1;
aScaleFactor = 1.0;
fWeight = 1.0;
xBiasOn = false;
nMatWarn = 0;
useIntegralXS = true;
@@ -164,31 +166,22 @@ G4HadronicProcess::GetElementCrossSection(const G4DynamicParticle * part,
const G4Element * elm,
const G4Material* mat)
{
G4Material* aMaterial = const_cast<G4Material*>(mat);
if(!aMaterial)
if(!mat)
{
// Because NeutronHP needs a material pointer (for instance to get the
// temperature), we ask the Nist manager to find a simple material
// from the (integer) Z of the element.
aMaterial =
G4NistManager::Instance()->FindSimpleMaterial(elm->GetZasInt());
if(!aMaterial) {
++nMatWarn;
static const G4int nmax = 5;
if(nMatWarn < nmax) {
G4ExceptionDescription ed;
ed << "Cannot compute Element x-section for " << GetProcessName()
<< " because no material defined \n"
<< " Please, specify material pointer or define simple material"
<< " for Z= " << elm->GetZasInt();
G4Exception("G4HadronicProcess::GetElementCrossSection", "had066", JustWarning,
ed);
}
++nMatWarn;
static const G4int nmax = 5;
if(nMatWarn < nmax) {
G4ExceptionDescription ed;
ed << "Cannot compute Element x-section for " << GetProcessName()
<< " because no material defined \n"
<< " Please, specify material pointer or define simple material"
<< " for Z= " << elm->GetZasInt();
G4Exception("G4HadronicProcess::GetElementCrossSection", "had066",
JustWarning, ed);
}
}
G4double x =
std::max(theCrossSectionDataStore->GetCrossSection(part, elm, aMaterial),0.0);
return x;
return
std::max(theCrossSectionDataStore->GetCrossSection(part, elm, mat),0.0);
}
void G4HadronicProcess::PreparePhysicsTable(const G4ParticleDefinition& p)
@@ -206,7 +199,7 @@ void G4HadronicProcess::BuildPhysicsTable(const G4ParticleDefinition& p)
theCrossSectionDataStore->BuildPhysicsTable(p);
theEnergyRangeManager.BuildPhysicsTable(p);
}
catch(G4HadronicException aR)
catch(G4HadronicException & aR)
{
G4ExceptionDescription ed;
aR.Report(ed);
@@ -225,10 +218,10 @@ GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
try
{
theLastCrossSection = aScaleFactor*
theCrossSectionDataStore->GetCrossSection(aTrack.GetDynamicParticle(),
aTrack.GetMaterial());
theCrossSectionDataStore->ComputeCrossSection(aTrack.GetDynamicParticle(),
aTrack.GetMaterial());
}
catch(G4HadronicException aR)
catch(G4HadronicException & aR)
{
G4ExceptionDescription ed;
aR.Report(ed);
@@ -237,8 +230,8 @@ GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
G4Exception("G4HadronicProcess::GetMeanFreePath", "had002", FatalException,
ed);
}
G4double res = (theLastCrossSection > 0.0) ? 1.0/theLastCrossSection : DBL_MAX;
//G4cout << " xsection= " << res << G4endl;
G4double res = (theLastCrossSection>0.0) ? 1.0/theLastCrossSection : DBL_MAX;
//G4cout << " xsection= " << theLastCrossSection << G4endl;
return res;
}
@@ -250,41 +243,42 @@ G4HadronicProcess::PostStepDoIt(const G4Track& aTrack, const G4Step&)
// if primary is not Alive then do nothing
theTotalResult->Clear();
theTotalResult->Initialize(aTrack);
theTotalResult->ProposeWeight(aTrack.GetWeight());
fWeight = aTrack.GetWeight();
theTotalResult->ProposeWeight(fWeight);
if(aTrack.GetTrackStatus() != fAlive) { return theTotalResult; }
// Find cross section at end of step and check if <= 0
//
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
G4Material* aMaterial = aTrack.GetMaterial();
const G4Material* aMaterial = aTrack.GetMaterial();
// check only for charged particles
if(aParticle->GetDefinition()->GetPDGCharge() != 0.0) {
G4double xs = 0.0;
try
{
xs = aScaleFactor*theCrossSectionDataStore->GetCrossSection(aParticle,aMaterial);
xs = aScaleFactor*
theCrossSectionDataStore->ComputeCrossSection(aParticle,aMaterial);
}
catch(G4HadronicException aR)
catch(G4HadronicException & aR)
{
G4ExceptionDescription ed;
aR.Report(ed);
DumpState(aTrack,"PostStepDoIt",ed);
ed << " Cross section is not available" << G4endl;
G4Exception("G4HadronicProcess::PostStepDoIt", "had002", FatalException,ed);
G4Exception("G4HadronicProcess::PostStepDoIt","had002",FatalException,ed);
}
if(xs <= 0.0 || (useIntegralXS && xs < theLastCrossSection*G4UniformRand())) {
if(xs <= 0.0 || xs < theLastCrossSection*G4UniformRand()) {
// No interaction
return theTotalResult;
}
}
G4Element* anElement = nullptr;
const G4Element* anElement = nullptr;
try
{
anElement = theCrossSectionDataStore->SampleZandA(aParticle,
aMaterial,
targetNucleus);
anElement = theCrossSectionDataStore->SampleZandA(aParticle, aMaterial,
targetNucleus);
}
catch(G4HadronicException & aR)
{
@@ -350,7 +344,7 @@ G4HadronicProcess::PostStepDoIt(const G4Track& aTrack, const G4Step&)
result = theInteraction->ApplyYourself( thePro, targetNucleus);
++reentryCount;
}
catch(G4HadronicException aR)
catch(G4HadronicException & aR)
{
G4ExceptionDescription ed;
aR.Report(ed);
@@ -365,7 +359,7 @@ G4HadronicProcess::PostStepDoIt(const G4Track& aTrack, const G4Step&)
}
// Check the result for catastrophic energy non-conservation
CheckResult(thePro, targetNucleus, result);
result = CheckResult(thePro, targetNucleus, result);
if(reentryCount>100) {
G4ExceptionDescription ed;
@@ -432,20 +426,18 @@ void G4HadronicProcess::ProcessDescription(std::ostream& outFile) const
G4double G4HadronicProcess::XBiasSurvivalProbability()
{
G4double result = 0;
G4double nLTraversed = GetTotalNumberOfInteractionLengthTraversed();
G4double biasedProbability = 1.-std::exp(-nLTraversed);
G4double realProbability = 1-std::exp(-nLTraversed/aScaleFactor);
result = (biasedProbability-realProbability)/biasedProbability;
G4double biasedProbability = 1.-G4Exp(-nLTraversed);
G4double realProbability = 1-G4Exp(-nLTraversed/aScaleFactor);
G4double result = (biasedProbability-realProbability)/biasedProbability;
return result;
}
G4double G4HadronicProcess::XBiasSecondaryWeight()
{
G4double result = 0;
G4double nLTraversed = GetTotalNumberOfInteractionLengthTraversed();
result =
1./aScaleFactor*std::exp(-nLTraversed/aScaleFactor*(1-1./aScaleFactor));
G4double result =
1./aScaleFactor*G4Exp(-nLTraversed/aScaleFactor*(1-1./aScaleFactor));
return result;
}
@@ -505,7 +497,6 @@ G4HadronicProcess::FillResult(G4HadFinalState * aR, const G4Track & aT)
}
G4int nSec = aR->GetNumberOfSecondaries();
theTotalResult->SetNumberOfSecondaries(nSec);
G4double weight = aT.GetWeight();
if (nSec > 0) {
G4double time0 = aT.GetGlobalTime();
@@ -528,17 +519,17 @@ G4HadronicProcess::FillResult(G4HadFinalState * aR, const G4Track & aT)
G4Track* track = new G4Track(aR->GetSecondary(i)->GetParticle(),
time, aT.GetPosition());
track->SetCreatorModelIndex(aR->GetSecondary(i)->GetCreatorModelType());
G4double newWeight = weight*aR->GetSecondary(i)->GetWeight();
// G4cout << "#### ParticleDebug "
// <<GetProcessName()<<" "
//<<aR->GetSecondary(i)->GetParticle()->GetDefinition()->GetParticleName()<<" "
// <<aScaleFactor<<" "
// <<XBiasSurvivalProbability()<<" "
// <<XBiasSecondaryWeight()<<" "
// <<aT.GetWeight()<<" "
// <<aR->GetSecondary(i)->GetWeight()<<" "
// <<aR->GetSecondary(i)->GetParticle()->Get4Momentum()<<" "
// <<G4endl;
G4double newWeight = fWeight*aR->GetSecondary(i)->GetWeight();
// G4cout << "#### ParticleDebug "
// <<GetProcessName()<<" "
//<<aR->GetSecondary(i)->GetParticle()->GetDefinition()->GetParticleName()
//<<" "<<aScaleFactor<<" "
// <<XBiasSurvivalProbability()<<" "
// <<XBiasSecondaryWeight()<<" "
// <<aT.GetWeight()<<" "
// <<aR->GetSecondary(i)->GetWeight()<<" "
// <<aR->GetSecondary(i)->GetParticle()->Get4Momentum()<<" "
// <<G4endl;
track->SetWeight(newWeight);
track->SetTouchableHandle(aT.GetTouchableHandle());
theTotalResult->AddSecondary(track);
@@ -555,29 +546,24 @@ G4HadronicProcess::FillResult(G4HadFinalState * aR, const G4Track & aT)
}
}
}
aR->Clear();
}
void G4HadronicProcess::MultiplyCrossSectionBy(G4double factor)
{
BiasCrossSectionByFactor(factor);
}
void G4HadronicProcess::BiasCrossSectionByFactor(G4double aScale)
{
xBiasOn = true;
aScaleFactor = aScale;
G4String it = GetProcessName();
if ((it != "photonNuclear") &&
(it != "electronNuclear") &&
(it != "positronNuclear") ) {
if (aScale <= 0.0) {
G4ExceptionDescription ed;
G4Exception("G4HadronicProcess::BiasCrossSectionByFactor", "had009",
FatalException, ed,
"Cross-section biasing available only for gamma and electro nuclear reactions.");
}
if (aScale < 100) {
G4ExceptionDescription ed;
G4Exception("G4HadronicProcess::BiasCrossSectionByFactor", "had010", JustWarning,ed,
"Cross-section bias readjusted to be above safe limit. New value is 100");
aScaleFactor = 100.;
ed << " Wrong biasing factor " << aScale << " for " << GetProcessName();
G4Exception("G4HadronicProcess::BiasCrossSectionByFactor", "had010",
JustWarning, ed, "Cross-section bias is ignored");
} else {
xBiasOn = true;
aScaleFactor = aScale;
}
}
@@ -616,24 +602,27 @@ G4HadFinalState* G4HadronicProcess::CheckResult(const G4HadProjectile & aPro,
G4double mass_pdg=pdyn->GetDefinition()->GetPDGMass();
G4double mass_dyn=pdyn->GetMass();
if ( std::abs(mass_pdg - mass_dyn) > 0.1*mass_pdg + 1.*MeV){
result->Clear();
result = 0;
G4ExceptionDescription desc;
desc << "Warning: Secondary with off-shell dynamic mass detected: " << G4endl
<< " " << pdyn->GetDefinition()->GetParticleName()
<< ", PDG mass: " << mass_pdg << ", dynamic mass: "<< mass_dyn << G4endl
<< (epReportLevel<0 ? "abort the event" : "re-sample the interaction") << G4endl
<< " Process / Model: " << GetProcessName()<< " / "
<< theModel->GetModelName() << G4endl
<< " Primary: " << aPro.GetDefinition()->GetParticleName()
<< " (" << aPro.GetDefinition()->GetPDGEncoding() << "), "
<< " E= " << aPro.Get4Momentum().e()
<< ", target nucleus (" << aNucleus.GetZ_asInt() << ", "
<< aNucleus.GetA_asInt() << ")" << G4endl;
G4Exception("G4HadronicProcess:CheckResult()", "had012",
epReportLevel<0 ? EventMustBeAborted : JustWarning,desc);
// must return here.....
return result;
result->Clear();
result = nullptr;
G4ExceptionDescription desc;
desc << "Warning: Secondary with off-shell dynamic mass detected: "
<< G4endl
<< " " << pdyn->GetDefinition()->GetParticleName()
<< ", PDG mass: " << mass_pdg << ", dynamic mass: "
<< mass_dyn << G4endl
<< (epReportLevel<0 ? "abort the event"
: "re-sample the interaction") << G4endl
<< " Process / Model: " << GetProcessName()<< " / "
<< theModel->GetModelName() << G4endl
<< " Primary: " << aPro.GetDefinition()->GetParticleName()
<< " (" << aPro.GetDefinition()->GetPDGEncoding() << "), "
<< " E= " << aPro.Get4Momentum().e()
<< ", target nucleus (" << aNucleus.GetZ_asInt() << ", "
<< aNucleus.GetA_asInt() << ")" << G4endl;
G4Exception("G4HadronicProcess:CheckResult()", "had012",
epReportLevel<0 ? EventMustBeAborted : JustWarning,desc);
// must return here.....
return result;
}
}
G4double deltaE= nuclearMass + aPro.GetTotalEnergy() - finalE;
@@ -644,10 +633,11 @@ G4HadFinalState* G4HadronicProcess::CheckResult(const G4HadProjectile & aPro,
std::abs(deltaE) > checkLevels.first*aPro.GetKineticEnergy()){
// do not delete result, this is a pointer to a data member;
result->Clear();
result = 0;
result = nullptr;
G4ExceptionDescription desc;
desc << "Warning: Bad energy non-conservation detected, will "
<< (epReportLevel<0 ? "abort the event" : "re-sample the interaction") << G4endl
<< (epReportLevel<0 ? "abort the event"
: "re-sample the interaction") << G4endl
<< " Process / Model: " << GetProcessName()<< " / "
<< theModel->GetModelName() << G4endl
<< " Primary: " << aPro.GetDefinition()->GetParticleName()
@@ -810,7 +800,6 @@ G4HadronicProcess::CheckEnergyMomentumConservation(const G4Track& aTrack,
}
}
void G4HadronicProcess::DumpState(const G4Track& aTrack,
const G4String& method,
G4ExceptionDescription& ed)
@@ -835,3 +824,19 @@ void G4HadronicProcess::DumpState(const G4Track& aTrack,
<< ">" << G4endl;
}
}
void G4HadronicProcess::DumpPhysicsTable(const G4ParticleDefinition& p)
{
theCrossSectionDataStore->DumpPhysicsTable(p);
}
void G4HadronicProcess::AddDataSet(G4VCrossSectionDataSet * aDataSet)
{
theCrossSectionDataStore->AddDataSet(aDataSet);
}
std::vector<G4HadronicInteraction*>&
G4HadronicProcess::GetHadronicInteractionList()
{
return theEnergyRangeManager.GetHadronicInteractionList();
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronicProcessStore.cc 105940 2017-09-01 07:33:44Z gcosmo $
// $Id: G4HadronicProcessStore.cc 110586 2018-05-31 12:01:42Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -59,12 +59,11 @@
#include "G4HadronicInteractionRegistry.hh"
#include "G4CrossSectionDataSetRegistry.hh"
#include "G4HadronicEPTestMessenger.hh"
#ifdef G4USE_STD11
#include <algorithm> //transform
#endif
#include <algorithm>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4ThreadLocal G4HadronicProcessStore* G4HadronicProcessStore::instance = 0;
G4ThreadLocal G4HadronicProcessStore* G4HadronicProcessStore::instance = nullptr;
G4HadronicProcessStore* G4HadronicProcessStore::Instance()
{
@@ -95,6 +94,7 @@ void G4HadronicProcessStore::Clean()
//G4cout << "G4HadronicProcessStore::Clean() delete hadronic "
// << i << " " << process[i]->GetProcessName() << G4endl;
delete process[i];
process[i] = nullptr;
}
}
for(i=0; i<n_extra; ++i) {
@@ -102,7 +102,7 @@ void G4HadronicProcessStore::Clean()
// G4cout << "G4HadronicProcessStore::Clean() delete extra proc "
//<< i << " " << extraProcess[i]->GetProcessName() << G4endl;
delete extraProcess[i];
extraProcess[i] = 0;
extraProcess[i] = nullptr;
}
}
//std::cout << "G4HadronicProcessStore::Clean() done" << std::endl;
@@ -118,14 +118,16 @@ G4HadronicProcessStore::G4HadronicProcessStore()
n_part = 0;
n_model= 0;
n_extra= 0;
currentProcess = 0;
currentParticle = 0;
currentProcess = nullptr;
currentParticle = nullptr;
theGenericIon =
G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
verbose = 1;
buildTableStart = true;
buildXSTable = false;
theEPTestMessenger = new G4HadronicEPTestMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4double G4HadronicProcessStore::GetCrossSectionPerAtom(
@@ -478,7 +480,7 @@ void G4HadronicProcessStore::DeRegister(G4HadronicProcess* proc)
{
for(G4int i=0; i<n_proc; ++i) {
if(process[i] == proc) {
process[i] = 0;
process[i] = nullptr;
DeRegisterExtraProcess((G4VProcess*)proc);
return;
}
@@ -543,7 +545,7 @@ void G4HadronicProcessStore::DeRegisterExtraProcess(G4VProcess* proc)
{
for(G4int i=0; i<n_extra; ++i) {
if(extraProcess[i] == proc) {
extraProcess[i] = 0;
extraProcess[i] = nullptr;
if(1 < verbose) {
G4cout << "Extra Process: " << i << " "
<<proc->GetProcessName()<< " is deregisted " << G4endl;
@@ -555,6 +557,20 @@ void G4HadronicProcessStore::DeRegisterExtraProcess(G4VProcess* proc)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4HadronicProcessStore::SetBuildXSTable(G4bool val)
{
buildXSTable = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4HadronicProcessStore::GetBuildXSTable() const
{
return buildXSTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4HadronicProcessStore::PrintInfo(const G4ParticleDefinition* part)
{
// Trigger particle/process/model printout only when last particle is