Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
G4HadronicInteractionRegistry
Instance ()
 

Friends

class G4ThreadLocalSingleton< G4HadronicInteractionRegistry >
 

Detailed Description

Definition at line 44 of file G4HadronicInteractionRegistry.hh.

Constructor & Destructor Documentation

G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry ( )

Definition at line 51 of file G4HadronicInteractionRegistry.cc.

Here is the call graph for this function:

Member Function Documentation

void G4HadronicInteractionRegistry::Clean ( )

Definition at line 56 of file G4HadronicInteractionRegistry.cc.

57 {
58  size_t nModels = allModels.size();
59  //G4cout << "G4HadronicInteractionRegistry::Clean() start " << nModels
60  // << " " << this << G4endl;
61  for (size_t i=0; i<nModels; ++i) {
62  if( allModels[i] ) {
63  const char* xxx = (allModels[i]->GetModelName()).c_str();
64  G4int len = (allModels[i]->GetModelName()).length();
65  len = std::min(len, 9);
66  const G4String mname = G4String(xxx, len);
67  //G4cout << "G4HadronicInteractionRegistry: delete " << i << " "
68  // << allModels[i] << " " << mname
69  // << " " << this << G4endl;
70  if(mname != "NeutronHP" && mname != "ParticleH") {
71  delete allModels[i];
72  }
73  // G4cout << "done " << this << G4endl;
74  }
75  }
76  allModels.clear();
77  //G4cout <<"G4HadronicInteractionRegistry::Clean() is done "<<G4endl;
78 }
const XML_Char int len
Definition: expat.h:262
int G4int
Definition: G4Types.hh:78
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 135 of file G4HadronicInteractionRegistry.cc.

136 {
137  std::vector<G4HadronicInteraction*> models;
138 
139  size_t nModels = allModels.size();
140  for (size_t i=0; i<nModels; ++i) {
141  G4HadronicInteraction* p = allModels[i];
142  if(p) {
143  if (p->GetModelName() == name) {
144  models.push_back(p);
145  }
146  }
147  }
148  return models;
149 }
const XML_Char * name
Definition: expat.h:151
const char * p
Definition: xmltok.h:285
const G4String & GetModelName() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4HadronicInteraction * G4HadronicInteractionRegistry::FindModel ( const G4String name)

Definition at line 117 of file G4HadronicInteractionRegistry.cc.

118 {
120 
121  size_t nModels = allModels.size();
122  for (size_t i=0; i<nModels; ++i) {
123  G4HadronicInteraction* p = allModels[i];
124  if(p) {
125  if (p->GetModelName() == name) {
126  model = p;
127  break;
128  }
129  }
130  }
131  return model;
132 }
const XML_Char * name
Definition: expat.h:151
const char * p
Definition: xmltok.h:285
const G4String & GetModelName() const
const XML_Char XML_Content * model
Definition: expat.h:151

Here is the call graph for this function:

Here is the caller graph for this function:

void G4HadronicInteractionRegistry::InitialiseModels ( )

Definition at line 80 of file G4HadronicInteractionRegistry.cc.

81 {
82  size_t nModels = allModels.size();
83  for (size_t i=0; i<nModels; ++i) {
84  if( allModels[i] ) { allModels[i]->InitialiseModel(); }
85  }
86 }

Here is the caller graph for this function:

G4HadronicInteractionRegistry * G4HadronicInteractionRegistry::Instance ( void  )
static

Definition at line 36 of file G4HadronicInteractionRegistry.cc.

37 {
38  if(nullptr == instance) {
40  instance = inst.Instance();
41  }
42  return instance;
43 }

Here is the call graph for this function:

Here is the caller graph for this function:

void G4HadronicInteractionRegistry::RegisterMe ( G4HadronicInteraction aModel)

Definition at line 89 of file G4HadronicInteractionRegistry.cc.

90 {
91  if(!aModel) { return; }
92  size_t nModels = allModels.size();
93  for (size_t i=0; i<nModels; ++i) {
94  if( aModel == allModels[i] ) { return; }
95  }
96  //G4cout << "Register model <" << aModel->GetModelName()
97  // << "> " << nModels+1 << " " << aModel << G4endl;
98  allModels.push_back(aModel);
99 }

Here is the caller graph for this function:

void G4HadronicInteractionRegistry::RemoveMe ( G4HadronicInteraction aModel)

Definition at line 102 of file G4HadronicInteractionRegistry.cc.

103 {
104  if(!aModel) { return; }
105  size_t nModels = allModels.size();
106  for (size_t i=0; i<nModels; ++i) {
107  if( aModel == allModels[i] ) {
108  //G4cout << "DeRegister model <" << aModel
109  // << "> " << i << G4endl;
110  allModels[i] = 0;
111  return;
112  }
113  }
114 }

Here is the caller graph for this function:

Friends And Related Function Documentation


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