Geant4 10.7.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 Register (G4VComponentCrossSection *)
 
void DeRegister (G4VComponentCrossSection *)
 
void DeleteComponent (G4VComponentCrossSection *)
 
void Clean ()
 
G4VCrossSectionDataSetGetCrossSectionDataSet (const G4String &name, G4bool warning=true)
 
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 94 of file G4CrossSectionDataSetRegistry.cc.

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

Referenced by ~G4CrossSectionDataSetRegistry().

◆ DeleteComponent()

void G4CrossSectionDataSetRegistry::DeleteComponent ( G4VComponentCrossSection p)

Definition at line 169 of file G4CrossSectionDataSetRegistry.cc.

170{
171 if(!p) { return; }
172 size_t n = xComponents.size();
173 for (size_t i=0; i<n; ++i) {
174 if(xComponents[i] == p) {
175 //std::cout << "Delete component #" << i << std::endl;
176 //std::cout << " " << p->GetName() << std::endl;
177 delete p;
178 return;
179 }
180 }
181}

◆ DeRegister() [1/2]

void G4CrossSectionDataSetRegistry::DeRegister ( G4VComponentCrossSection p)

Definition at line 154 of file G4CrossSectionDataSetRegistry.cc.

155{
156 if(!p) { return; }
157 size_t n = xComponents.size();
158 for (size_t i=0; i<n; ++i) {
159 if(xComponents[i] == p) {
160 //std::cout << "DeRegister component #" << i << std::endl;
161 //std::cout << " " << p->GetName() << std::endl;
162 xComponents[i] = nullptr;
163 return;
164 }
165 }
166}

◆ DeRegister() [2/2]

void G4CrossSectionDataSetRegistry::DeRegister ( G4VCrossSectionDataSet p)

Definition at line 129 of file G4CrossSectionDataSetRegistry.cc.

130{
131 if(!p) { return; }
132 size_t n = xSections.size();
133 for (size_t i=0; i<n; ++i) {
134 if(xSections[i] == p) {
135 //std::cout << "DeRegister x-section #" << i << std::endl;
136 //std:: cout << " " << p->GetName() << std::endl;
137 xSections[i] = nullptr;
138 return;
139 }
140 }
141}

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

◆ GetComponentCrossSection()

◆ GetCrossSectionDataSet()

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

Definition at line 184 of file G4CrossSectionDataSetRegistry.cc.

186{
187 for (auto xsec : xSections) {
188 if(xsec && xsec->GetName() == name) { return xsec; }
189 }
190 // check if factory exists...
191 //
194 // This throws if factory is not found, add second parameter
195 // to false to avoid this
196 G4VBaseXSFactory* factory = factories->GetFactory(name, warning );
197 if ( factory ) {
198 return factory->Instantiate();
199 } else {
200 G4VCrossSectionDataSet* ptr = nullptr;
201 return ptr;
202 }
203}
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 143 of file G4CrossSectionDataSetRegistry.cc.

144{
145 if(!p) { return; }
146 for (auto xsec : xComponents) {
147 if(xsec == p) { return; }
148 }
149 //G4cout << "Register component #" << xComponents.size()
150 //<< " " << p->GetName() << G4endl;
151 xComponents.push_back(p);
152}

◆ Register() [2/2]

void G4CrossSectionDataSetRegistry::Register ( G4VCrossSectionDataSet p)

Definition at line 118 of file G4CrossSectionDataSetRegistry.cc.

119{
120 if(!p) { return; }
121 for (auto xsec : xSections) {
122 if(xsec == p) { return; }
123 }
124 //G4cout << "Register x-section #" << xSections.size()
125 //<< " " << p->GetName() << G4endl;
126 xSections.push_back(p);
127}

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: