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 (  ) 

Definition at line 86 of file G4CrossSectionDataSetRegistry.cc.

References Clean().

00087 {
00088   Clean();
00089 }


Member Function Documentation

void G4CrossSectionDataSetRegistry::AddFactory ( G4String  ,
G4VBaseXSFactory  
)

Definition at line 132 of file G4CrossSectionDataSetRegistry.cc.

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

00133 {
00134   factories[name] = factory;
00135 }

void G4CrossSectionDataSetRegistry::Clean (  ) 

Definition at line 91 of file G4CrossSectionDataSetRegistry.cc.

References CLHEP::detail::n.

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

00092 {
00093   size_t n = xSections.size(); 
00094   if(n > 0) {
00095     for (size_t i=0; i<n; ++i) {
00096       if(xSections[i]) {
00097         G4VCrossSectionDataSet* p = xSections[i];
00098         xSections[i] = 0;
00099         delete p;
00100       }
00101     }
00102     xSections.clear();
00103   }
00104 }

void G4CrossSectionDataSetRegistry::DeRegister ( G4VCrossSectionDataSet  ) 

Definition at line 118 of file G4CrossSectionDataSetRegistry.cc.

References CLHEP::detail::n.

Referenced by G4VCrossSectionDataSet::~G4VCrossSectionDataSet().

00119 {
00120   if(!p) return;
00121   size_t n = xSections.size(); 
00122   if(n > 0) {
00123     for (size_t i=0; i<n; ++i) {
00124       if(xSections[i] == p) {
00125         xSections[i] = 0;
00126         return;
00127       }
00128     }
00129   }
00130 }

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

Definition at line 137 of file G4CrossSectionDataSetRegistry.cc.

References FatalException, G4endl, G4Exception(), and CLHEP::detail::n.

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

00138 {
00139   size_t n = xSections.size(); 
00140  
00141   for (size_t i=0; i<n; ++i) 
00142     {
00143       if(xSections[i]) 
00144         {
00145           G4VCrossSectionDataSet* p = xSections[i];
00146           if (p->GetName() == name) return p;
00147         }
00148     }
00149   // check if factory exists...
00150   //
00151   if (factories.find(name)!=factories.end())
00152     {
00153       return factories[name]->Instantiate();
00154     }
00155   else
00156     {
00157         if(warning)
00158         {
00159          G4ExceptionDescription ED;
00160          ED << "Factory for ["<< name << "] cross section data set not found." << G4endl;
00161          G4Exception("G4CrossSectionDataSetRegistry::GetCrossSectionDataSet", "CrossSection001", FatalException, ED);
00162         }
00163       return 0;
00164     }
00165 }

G4CrossSectionDataSetRegistry * G4CrossSectionDataSetRegistry::Instance (  )  [static]

Definition at line 74 of file G4CrossSectionDataSetRegistry.cc.

Referenced by G4QGSPPiKBuilder::Build(), G4QGSBinaryPiKBuilder::Build(), G4MiscBuilder::Build(), G4FTFBinaryKaonBuilder::Build(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4BGGNucleonElasticXS::BuildPhysicsTable(), HadronPhysicsShielding::ConstructProcess(), HadronPhysicsQGSP_FTFP_BERT_95::ConstructProcess(), HadronPhysicsFTFP_BERT_TRV::ConstructProcess(), HadronPhysicsFTFP_BERT_HP::ConstructProcess(), HadronPhysicsFTFP_BERT::ConstructProcess(), G4IonPhysics::ConstructProcess(), G4HadronInelasticQBBC::ConstructProcess(), G4HadronElasticPhysics::ConstructProcess(), G4HadronDElasticPhysics::ConstructProcess(), G4ChipsComponentXS::G4ChipsComponentXS(), G4ChipsElasticModel::G4ChipsElasticModel(), G4ChipsKaonZeroElasticXS::G4ChipsKaonZeroElasticXS(), G4ChipsKaonZeroInelasticXS::G4ChipsKaonZeroInelasticXS(), G4CrossSectionFactory< T >::G4CrossSectionFactory(), G4HyperonFTFPBuilder::G4HyperonFTFPBuilder(), G4QuasiElRatios::G4QuasiElRatios(), G4VCrossSectionDataSet::G4VCrossSectionDataSet(), G4HadronicProcessStore::~G4HadronicProcessStore(), and G4VCrossSectionDataSet::~G4VCrossSectionDataSet().

00075 {
00076   if(0 == theInstance) {
00077     static G4CrossSectionDataSetRegistry manager;
00078     theInstance = &manager;
00079   }
00080   return theInstance;
00081 }

void G4CrossSectionDataSetRegistry::Register ( G4VCrossSectionDataSet  ) 

Definition at line 106 of file G4CrossSectionDataSetRegistry.cc.

References CLHEP::detail::n.

Referenced by G4VCrossSectionDataSet::G4VCrossSectionDataSet().

00107 {
00108   if(!p) return;
00109   size_t n = xSections.size(); 
00110   if(n > 0) {
00111     for (size_t i=0; i<n; ++i) {
00112       if(xSections[i] == p) { return; }
00113     }
00114   }
00115   xSections.push_back(p);
00116 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:43 2013 for Geant4 by  doxygen 1.4.7