Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HadronicInteractionRegistry Class Reference

#include <G4HadronicInteractionRegistry.hh>

Public Member Functions

 ~G4HadronicInteractionRegistry ()
 
void RegisterMe (G4HadronicInteraction *aModel)
 
void RemoveMe (G4HadronicInteraction *aModel)
 
void Clean ()
 
void InitialiseModels ()
 
G4HadronicInteractionFindModel (const G4String &name)
 
std::vector< G4HadronicInteraction * > FindAllModels (const G4String &name)
 

Static Public Member Functions

static G4HadronicInteractionRegistryInstance ()
 

Friends

class G4ThreadLocalSingleton< G4HadronicInteractionRegistry >
 

Detailed Description

Definition at line 43 of file G4HadronicInteractionRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4HadronicInteractionRegistry()

G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry ( )

Member Function Documentation

◆ Clean()

void G4HadronicInteractionRegistry::Clean ( )

Definition at line 53 of file G4HadronicInteractionRegistry.cc.

54{
55 size_t nModels = allModels.size();
56 //G4cout << "G4HadronicInteractionRegistry::Clean() start " << nModels
57 // << " " << this << G4endl;
58 for (size_t i=0; i<nModels; ++i) {
59 if( allModels[i] ) {
60 //const char* xxx = (allModels[i]->GetModelName()).c_str();
61 //G4int len = (allModels[i]->GetModelName()).length();
62 //len = std::min(len, 9);
63 //const G4String mname = G4String(xxx, len);
64 //G4cout << "G4HadronicInteractionRegistry: delete " << i << " "
65 // << allModels[i] << " " << mname
66 // << " " << this << G4endl;
67 //if(mname != "NeutronHP" && mname != "ParticleH")
68 delete allModels[i];
69 // G4cout << "done " << this << G4endl;
70 }
71 }
72 allModels.clear();
73 //G4cout <<"G4HadronicInteractionRegistry::Clean() is done "<<G4endl;
74}

Referenced by ~G4HadronicInteractionRegistry().

◆ FindAllModels()

std::vector< G4HadronicInteraction * > G4HadronicInteractionRegistry::FindAllModels ( const G4String name)

Definition at line 123 of file G4HadronicInteractionRegistry.cc.

124{
125 std::vector<G4HadronicInteraction*> models;
126 for (auto & mod : allModels) {
127 if(mod && mod->GetModelName() == name) {
128 models.push_back(mod);
129 }
130 }
131 return models;
132}

Referenced by G4INCLXXInterfaceStore::UseAblaDeExcitation().

◆ FindModel()

◆ InitialiseModels()

void G4HadronicInteractionRegistry::InitialiseModels ( )

Definition at line 76 of file G4HadronicInteractionRegistry.cc.

77{
78 for (auto & mod : allModels) {
79 if( mod ) { mod->InitialiseModel(); }
80 }
81}

Referenced by G4HadronicProcessStore::PrintInfo().

◆ Instance()

G4HadronicInteractionRegistry * G4HadronicInteractionRegistry::Instance ( )
static

◆ RegisterMe()

void G4HadronicInteractionRegistry::RegisterMe ( G4HadronicInteraction aModel)

Definition at line 84 of file G4HadronicInteractionRegistry.cc.

85{
86 if(!aModel) { return; }
87 for (auto & mod : allModels) {
88 if( aModel == mod ) { return; }
89 }
90 //G4cout << "Register model <" << aModel->GetModelName()
91 // << "> " << nModels+1 << " " << aModel << G4endl;
92 allModels.push_back(aModel);
93}

Referenced by G4HadronicInteraction::G4HadronicInteraction().

◆ RemoveMe()

void G4HadronicInteractionRegistry::RemoveMe ( G4HadronicInteraction aModel)

Definition at line 96 of file G4HadronicInteractionRegistry.cc.

97{
98 if(!aModel) { return; }
99 for (size_t i=0; i<allModels.size(); ++i) {
100 if( aModel == allModels[i] ) {
101 //G4cout << "DeRegister model <" << aModel
102 // << "> " << i << G4endl;
103 allModels[i] = nullptr;
104 return;
105 }
106 }
107}

Referenced by G4HadronicInteraction::~G4HadronicInteraction().

Friends And Related Function Documentation

◆ G4ThreadLocalSingleton< G4HadronicInteractionRegistry >

Definition at line 1 of file G4HadronicInteractionRegistry.hh.


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