Geant4 11.1.1
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 Register (G4VComponentCrossSection *)
 
void DeRegister (G4VComponentCrossSection *)
 
void DeleteComponent (G4VComponentCrossSection *)
 
void Clean ()
 
G4VCrossSectionDataSetGetCrossSectionDataSet (const G4String &name, G4bool warning=false)
 
G4VComponentCrossSectionGetComponentCrossSection (const G4String &name)
 

Static Public Member Functions

static G4CrossSectionDataSetRegistryInstance ()
 

Friends

class G4ThreadLocalSingleton< G4CrossSectionDataSetRegistry >
 

Detailed Description

Definition at line 55 of file G4CrossSectionDataSetRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4CrossSectionDataSetRegistry()

G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry ( )

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) {
92 G4VCrossSectionDataSet* p = xSections[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) {
102 G4VComponentCrossSection* p = xComponents[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}

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}

◆ 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}

◆ 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}

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

◆ GetComponentCrossSection()

◆ 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
virtual G4VCrossSectionDataSet * Instantiate()=0

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

◆ Instance()

◆ 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}

◆ 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}

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

Friends And Related Function Documentation

◆ G4ThreadLocalSingleton< G4CrossSectionDataSetRegistry >

Definition at line 1 of file G4CrossSectionDataSetRegistry.hh.


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