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

#include <G4CrossSectionDataSetRegistry.hh>

Public Member Functions

 ~G4CrossSectionDataSetRegistry ()
 
void Register (G4VCrossSectionDataSet *)
 
void DeRegister (G4VCrossSectionDataSet *)
 
void Clean ()
 
void AddFactory (G4String, G4VBaseXSFactory *)
 
G4VCrossSectionDataSetGetCrossSectionDataSet (const G4String &name, G4bool warning=true)
 

Static Public Member Functions

static G4CrossSectionDataSetRegistryInstance ()
 

Detailed Description

Definition at line 56 of file G4CrossSectionDataSetRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4CrossSectionDataSetRegistry()

G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry ( )

Member Function Documentation

◆ AddFactory()

void G4CrossSectionDataSetRegistry::AddFactory ( G4String  name,
G4VBaseXSFactory factory 
)

Definition at line 132 of file G4CrossSectionDataSetRegistry.cc.

133{
134 factories[name] = factory;
135}

Referenced by G4CrossSectionFactory< T >::G4CrossSectionFactory().

◆ Clean()

void G4CrossSectionDataSetRegistry::Clean ( )

Definition at line 91 of file G4CrossSectionDataSetRegistry.cc.

92{
93 size_t n = xSections.size();
94 if(n > 0) {
95 for (size_t i=0; i<n; ++i) {
96 if(xSections[i]) {
97 G4VCrossSectionDataSet* p = xSections[i];
98 xSections[i] = 0;
99 delete p;
100 }
101 }
102 xSections.clear();
103 }
104}

Referenced by ~G4CrossSectionDataSetRegistry(), and G4HadronicProcessStore::~G4HadronicProcessStore().

◆ DeRegister()

void G4CrossSectionDataSetRegistry::DeRegister ( G4VCrossSectionDataSet p)

Definition at line 118 of file G4CrossSectionDataSetRegistry.cc.

119{
120 if(!p) return;
121 size_t n = xSections.size();
122 if(n > 0) {
123 for (size_t i=0; i<n; ++i) {
124 if(xSections[i] == p) {
125 xSections[i] = 0;
126 return;
127 }
128 }
129 }
130}

Referenced by G4VCrossSectionDataSet::~G4VCrossSectionDataSet().

◆ GetCrossSectionDataSet()

G4VCrossSectionDataSet * G4CrossSectionDataSetRegistry::GetCrossSectionDataSet ( const G4String name,
G4bool  warning = true 
)

Definition at line 137 of file G4CrossSectionDataSetRegistry.cc.

138{
139 size_t n = xSections.size();
140
141 for (size_t i=0; i<n; ++i)
142 {
143 if(xSections[i])
144 {
145 G4VCrossSectionDataSet* p = xSections[i];
146 if (p->GetName() == name) return p;
147 }
148 }
149 // check if factory exists...
150 //
151 if (factories.find(name)!=factories.end())
152 {
153 return factories[name]->Instantiate();
154 }
155 else
156 {
157 if(warning)
158 {
160 ED << "Factory for ["<< name << "] cross section data set not found." << G4endl;
161 G4Exception("G4CrossSectionDataSetRegistry::GetCrossSectionDataSet", "CrossSection001", FatalException, ED);
162 }
163 return 0;
164 }
165}
@ FatalException
#define G4endl
Definition: G4ios.hh:52
const G4String & GetName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

Referenced by G4MiscBuilder::Build(), G4BGGNucleonElasticXS::BuildPhysicsTable(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4IonPhysics::ConstructProcess(), HadronPhysicsFTFP_BERT::ConstructProcess(), HadronPhysicsFTFP_BERT_HP::ConstructProcess(), HadronPhysicsFTFP_BERT_TRV::ConstructProcess(), HadronPhysicsQGSP_FTFP_BERT_95::ConstructProcess(), HadronPhysicsShielding::ConstructProcess(), G4ChipsComponentXS::G4ChipsComponentXS(), G4ChipsElasticModel::G4ChipsElasticModel(), G4ChipsKaonZeroElasticXS::G4ChipsKaonZeroElasticXS(), G4ChipsKaonZeroInelasticXS::G4ChipsKaonZeroInelasticXS(), G4HyperonFTFPBuilder::G4HyperonFTFPBuilder(), and G4QuasiElRatios::G4QuasiElRatios().

◆ Instance()

◆ Register()

void G4CrossSectionDataSetRegistry::Register ( G4VCrossSectionDataSet p)

Definition at line 106 of file G4CrossSectionDataSetRegistry.cc.

107{
108 if(!p) return;
109 size_t n = xSections.size();
110 if(n > 0) {
111 for (size_t i=0; i<n; ++i) {
112 if(xSections[i] == p) { return; }
113 }
114 }
115 xSections.push_back(p);
116}

Referenced by G4VCrossSectionDataSet::G4VCrossSectionDataSet().


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