Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
G4CrossSectionDataSetRegistry Class Reference

#include <G4CrossSectionDataSetRegistry.hh>

Public Member Functions

void Clean ()
 
void DeleteComponent (G4VComponentCrossSection *)
 
void DeRegister (G4VComponentCrossSection *)
 
void DeRegister (G4VCrossSectionDataSet *)
 
G4VComponentCrossSectionGetComponentCrossSection (const G4String &name)
 
G4VCrossSectionDataSetGetCrossSectionDataSet (const G4String &name, G4bool warning=false)
 
void Register (G4VComponentCrossSection *)
 
void Register (G4VCrossSectionDataSet *)
 
 ~G4CrossSectionDataSetRegistry ()
 

Static Public Member Functions

static G4CrossSectionDataSetRegistryInstance ()
 

Private Member Functions

 G4CrossSectionDataSetRegistry ()
 

Private Attributes

std::vector< G4VComponentCrossSection * > xComponents
 
std::vector< G4VCrossSectionDataSet * > xSections
 

Static Private Attributes

static G4ThreadLocal G4CrossSectionDataSetRegistryinstance = nullptr
 

Friends

class G4ThreadLocalSingleton< G4CrossSectionDataSetRegistry >
 

Detailed Description

Definition at line 55 of file G4CrossSectionDataSetRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4CrossSectionDataSetRegistry()

G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry ( )

Definition at line 83 of file G4CrossSectionDataSetRegistry.cc.

References Clean().

◆ G4CrossSectionDataSetRegistry()

G4CrossSectionDataSetRegistry::G4CrossSectionDataSetRegistry ( )
private

Definition at line 80 of file G4CrossSectionDataSetRegistry.cc.

81{}

Member Function Documentation

◆ Clean()

void G4CrossSectionDataSetRegistry::Clean ( )

Definition at line 88 of file G4CrossSectionDataSetRegistry.cc.

89{
90 size_t n = xSections.size();
91 for (size_t i=0; i<n; ++i) {
93 if(p) {
94 //std::cout << "Clean x-section #" << i << std::endl;
95 //std::cout << " " << p->GetName() << std::endl;
96 delete p;
97 xSections[i] = nullptr;
98 }
99 }
100 n = xComponents.size();
101 for (size_t i=0; i<n; ++i) {
103 if(p) {
104 //std::cout << "Clean component #" << i << std::endl;
105 //std::cout << " " << p->GetName() << std::endl;
106 delete p;
107 xComponents[i] = nullptr;
108 }
109 }
110}
std::vector< G4VComponentCrossSection * > xComponents
std::vector< G4VCrossSectionDataSet * > xSections

References CLHEP::detail::n, xComponents, and xSections.

Referenced by ~G4CrossSectionDataSetRegistry().

◆ DeleteComponent()

void G4CrossSectionDataSetRegistry::DeleteComponent ( G4VComponentCrossSection p)

Definition at line 163 of file G4CrossSectionDataSetRegistry.cc.

164{
165 if(!p) { return; }
166 size_t n = xComponents.size();
167 for (size_t i=0; i<n; ++i) {
168 if(xComponents[i] == p) {
169 //std::cout << "Delete component #" << i << std::endl;
170 //std::cout << " " << p->GetName() << std::endl;
171 delete p;
172 return;
173 }
174 }
175}

References CLHEP::detail::n, and xComponents.

◆ DeRegister() [1/2]

void G4CrossSectionDataSetRegistry::DeRegister ( G4VComponentCrossSection p)

Definition at line 148 of file G4CrossSectionDataSetRegistry.cc.

149{
150 if(!p) { return; }
151 size_t n = xComponents.size();
152 for (size_t i=0; i<n; ++i) {
153 if(xComponents[i] == p) {
154 //std::cout << "DeRegister component #" << i << std::endl;
155 //std::cout << " " << p->GetName() << std::endl;
156 xComponents[i] = nullptr;
157 return;
158 }
159 }
160}

References CLHEP::detail::n, and xComponents.

◆ DeRegister() [2/2]

void G4CrossSectionDataSetRegistry::DeRegister ( G4VCrossSectionDataSet p)

Definition at line 123 of file G4CrossSectionDataSetRegistry.cc.

124{
125 if(nullptr == p) { return; }
126 size_t n = xSections.size();
127 for (size_t i=0; i<n; ++i) {
128 if(xSections[i] == p) {
129 //std::cout << "DeRegister x-section #" << i
130 // << " " << p->GetName() << " " << p << std::endl;
131 xSections[i] = nullptr;
132 return;
133 }
134 }
135}

References CLHEP::detail::n, and xSections.

Referenced by G4VComponentCrossSection::~G4VComponentCrossSection(), and G4VCrossSectionDataSet::~G4VCrossSectionDataSet().

◆ GetComponentCrossSection()

G4VComponentCrossSection * G4CrossSectionDataSetRegistry::GetComponentCrossSection ( const G4String name)

◆ GetCrossSectionDataSet()

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

Definition at line 178 of file G4CrossSectionDataSetRegistry.cc.

180{
181 for (auto xsec : xSections) {
182 if(xsec && xsec->GetName() == name) { return xsec; }
183 }
184 // check if factory exists...
185 //
188 // This throws if factory is not found, add second parameter
189 // to false to avoid this
190 G4VBaseXSFactory* factory = factories->GetFactory(name, warning );
191 if ( factory ) {
192 return factory->Instantiate();
193 } else {
194 G4VCrossSectionDataSet* ptr = nullptr;
195 return ptr;
196 }
197}
static G4CrossSectionFactoryRegistry * Instance()
G4VBaseXSFactory * GetFactory(const G4String &name, G4bool abortIfNotFound=true) const
factory
Definition: test.py:55

References test::factory, G4CrossSectionFactoryRegistry::GetFactory(), G4CrossSectionFactoryRegistry::Instance(), G4InuclParticleNames::name(), and xSections.

Referenced by G4NeutronCrossSectionXS::ConstructProcess(), G4ChipsComponentXS::G4ChipsComponentXS(), G4ChipsElasticModel::G4ChipsElasticModel(), G4ChipsKaonZeroElasticXS::G4ChipsKaonZeroElasticXS(), G4ChipsKaonZeroInelasticXS::G4ChipsKaonZeroInelasticXS(), G4GammaNuclearXS::G4GammaNuclearXS(), and G4QuasiElRatios::G4QuasiElRatios().

◆ Instance()

G4CrossSectionDataSetRegistry * G4CrossSectionDataSetRegistry::Instance ( void  )
static

Definition at line 71 of file G4CrossSectionDataSetRegistry.cc.

72{
73 if(nullptr == instance) {
75 instance = inst.Instance();
76 }
77 return instance;
78}
static G4ThreadLocal G4CrossSectionDataSetRegistry * instance

References G4ThreadLocalSingleton< T >::Instance(), and instance.

Referenced by G4INCLXXNeutronBuilder::Build(), G4EmExtraPhysics::ConstructGammaElectroNuclear(), LBE::ConstructHad(), G4NeutronCrossSectionXS::ConstructProcess(), G4HadProcesses::ElasticXS(), G4AntiNuclElastic::G4AntiNuclElastic(), G4ChipsComponentXS::G4ChipsComponentXS(), G4ChipsElasticModel::G4ChipsElasticModel(), G4ChipsKaonZeroElasticXS::G4ChipsKaonZeroElasticXS(), G4ChipsKaonZeroInelasticXS::G4ChipsKaonZeroInelasticXS(), G4ElectroVDNuclearModel::G4ElectroVDNuclearModel(), G4FTFPAntiBarionBuilder::G4FTFPAntiBarionBuilder(), G4FTFParameters::G4FTFParameters(), G4GammaNuclearXS::G4GammaNuclearXS(), G4MuonVDNuclearModel::G4MuonVDNuclearModel(), G4NeutronElasticXS::G4NeutronElasticXS(), G4NeutronInelasticXS::G4NeutronInelasticXS(), G4ParticleInelasticXS::G4ParticleInelasticXS(), G4QGSPAntiBarionBuilder::G4QGSPAntiBarionBuilder(), G4QuasiElRatios::G4QuasiElRatios(), G4VComponentCrossSection::G4VComponentCrossSection(), G4VCrossSectionDataSet::G4VCrossSectionDataSet(), and G4HadProcesses::InelasticXS().

◆ Register() [1/2]

void G4CrossSectionDataSetRegistry::Register ( G4VComponentCrossSection p)

Definition at line 137 of file G4CrossSectionDataSetRegistry.cc.

138{
139 if(!p) { return; }
140 for (auto xsec : xComponents) {
141 if(xsec == p) { return; }
142 }
143 //G4cout << "Register component #" << xComponents.size()
144 //<< " " << p->GetName() << G4endl;
145 xComponents.push_back(p);
146}

References xComponents.

◆ Register() [2/2]

void G4CrossSectionDataSetRegistry::Register ( G4VCrossSectionDataSet p)

Definition at line 112 of file G4CrossSectionDataSetRegistry.cc.

113{
114 if(nullptr == p) { return; }
115 for (auto xsec : xSections) {
116 if(xsec == p) { return; }
117 }
118 //G4cout << "Register x-section #" << xSections.size()
119 // << " " << p->GetName() << " " << p << G4endl;
120 xSections.push_back(p);
121}

References xSections.

Referenced by G4VComponentCrossSection::G4VComponentCrossSection(), and G4VCrossSectionDataSet::G4VCrossSectionDataSet().

Friends And Related Function Documentation

◆ G4ThreadLocalSingleton< G4CrossSectionDataSetRegistry >

Definition at line 1 of file G4CrossSectionDataSetRegistry.hh.

Field Documentation

◆ instance

G4ThreadLocal G4CrossSectionDataSetRegistry * G4CrossSectionDataSetRegistry::instance = nullptr
staticprivate

Definition at line 93 of file G4CrossSectionDataSetRegistry.hh.

Referenced by Instance().

◆ xComponents

std::vector<G4VComponentCrossSection*> G4CrossSectionDataSetRegistry::xComponents
private

◆ xSections

std::vector<G4VCrossSectionDataSet*> G4CrossSectionDataSetRegistry::xSections
private

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