Geant4  10.02.p03
G4CrossSectionDataSetRegistry Class Reference

#include <G4CrossSectionDataSetRegistry.hh>

Collaboration diagram for G4CrossSectionDataSetRegistry:

Public Member Functions

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

Static Public Member Functions

static G4CrossSectionDataSetRegistryInstance ()
 

Private Member Functions

 G4CrossSectionDataSetRegistry ()
 

Private Attributes

std::vector< G4VCrossSectionDataSet * > xSections
 

Static Private Attributes

static G4ThreadLocal G4CrossSectionDataSetRegistryinstance = 0
 

Friends

class G4ThreadLocalSingleton< G4CrossSectionDataSetRegistry >
 

Detailed Description

Definition at line 56 of file G4CrossSectionDataSetRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4CrossSectionDataSetRegistry()

G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry ( )

Definition at line 91 of file G4CrossSectionDataSetRegistry.cc.

Here is the call graph for this function:

◆ G4CrossSectionDataSetRegistry()

G4CrossSectionDataSetRegistry::G4CrossSectionDataSetRegistry ( )
private

Definition at line 88 of file G4CrossSectionDataSetRegistry.cc.

89 {}

Member Function Documentation

◆ Clean()

void G4CrossSectionDataSetRegistry::Clean ( )

Definition at line 96 of file G4CrossSectionDataSetRegistry.cc.

97 {
98  size_t n = xSections.size();
99  for (size_t i=0; i<n; ++i) {
100  if(xSections[i]) {
101  const char* xxx = (xSections[i]->GetName()).c_str();
102  G4int len = (xSections[i]->GetName()).length();
103  len = std::min(len, 9);
104  const G4String xname = G4String(xxx, len);
105  //std::cout << "G4CrossSectionDataSetRegistry::Clean " << xname
106  // << " " << xSections[i] << " " << this << std::endl;
107  if( (xname != "NeutronHP") && (xname != "ParticleH") ) {
108  delete xSections[i];
109  }
110  //std::cout << " done" << " " << this << std::endl;
111  }
112  }
113  xSections.clear();
114 }
int G4int
Definition: G4Types.hh:78
Char_t n[5]
std::vector< G4VCrossSectionDataSet * > xSections
Here is the caller graph for this function:

◆ DeRegister()

void G4CrossSectionDataSetRegistry::DeRegister ( G4VCrossSectionDataSet p)

Definition at line 128 of file G4CrossSectionDataSetRegistry.cc.

129 {
130  if(!p) return;
131  size_t n = xSections.size();
132  for (size_t i=0; i<n; ++i) {
133  if(xSections[i] == p) {
134  xSections[i] = 0;
135  return;
136  }
137  }
138 }
Char_t n[5]
std::vector< G4VCrossSectionDataSet * > xSections
Here is the caller graph for this function:

◆ GetCrossSectionDataSet()

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

Definition at line 145 of file G4CrossSectionDataSetRegistry.cc.

146 {
147  size_t n = xSections.size();
148 
149  for (size_t i=0; i<n; ++i)
150  {
151  if(xSections[i])
152  {
154  if (p->GetName() == name) return p;
155  }
156  }
157  // check if factory exists...
158  //
160  //This thorws if factory is not found, add second parameter to false to avoid this
161  G4VBaseXSFactory* factory = factories->GetFactory(name, warning );
162  if ( factory )
163  return factory->Instantiate();
164  else
165  return static_cast<G4VCrossSectionDataSet*>(0);
166 }
G4String name
Definition: TRTMaterials.hh:40
virtual G4VCrossSectionDataSet * Instantiate()=0
Char_t n[5]
G4VBaseXSFactory * GetFactory(const G4String &name, G4bool abortIfNotFound=true) const
std::vector< G4VCrossSectionDataSet * > xSections
static G4CrossSectionFactoryRegistry * Instance()
const G4String & GetName() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

G4CrossSectionDataSetRegistry * G4CrossSectionDataSetRegistry::Instance ( void  )
static

Definition at line 79 of file G4CrossSectionDataSetRegistry.cc.

80 {
81  if(0 == instance) {
83  instance = inst.Instance();
84  }
85  return instance;
86 }
static G4ThreadLocal G4CrossSectionDataSetRegistry * instance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Register()

void G4CrossSectionDataSetRegistry::Register ( G4VCrossSectionDataSet p)

Definition at line 116 of file G4CrossSectionDataSetRegistry.cc.

117 {
118  if(!p) return;
119  size_t n = xSections.size();
120  for (size_t i=0; i<n; ++i) {
121  if(xSections[i] == p) { return; }
122  }
123  //G4cout << "Register x-section: " << p->GetName() << " " << p
124  // << " " << this << G4endl;
125  xSections.push_back(p);
126 }
Char_t n[5]
std::vector< G4VCrossSectionDataSet * > xSections
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ G4ThreadLocalSingleton< G4CrossSectionDataSetRegistry >

Member Data Documentation

◆ instance

G4ThreadLocal G4CrossSectionDataSetRegistry * G4CrossSectionDataSetRegistry::instance = 0
staticprivate

Definition at line 85 of file G4CrossSectionDataSetRegistry.hh.

◆ xSections

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

Definition at line 87 of file G4CrossSectionDataSetRegistry.hh.


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