Geant4  10.02.p03
G4HadronicInteractionRegistry Class Reference

#include <G4HadronicInteractionRegistry.hh>

Collaboration diagram for G4HadronicInteractionRegistry:

Public Member Functions

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

Static Public Member Functions

static G4HadronicInteractionRegistryInstance ()
 

Private Member Functions

 G4HadronicInteractionRegistry ()
 

Private Attributes

std::vector< G4HadronicInteraction * > allModels
 

Static Private Attributes

static G4ThreadLocal G4HadronicInteractionRegistryinstance = 0
 

Friends

class G4ThreadLocalSingleton< G4HadronicInteractionRegistry >
 

Detailed Description

Definition at line 44 of file G4HadronicInteractionRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4HadronicInteractionRegistry()

G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry ( )

Definition at line 50 of file G4HadronicInteractionRegistry.cc.

Here is the call graph for this function:

◆ G4HadronicInteractionRegistry()

G4HadronicInteractionRegistry::G4HadronicInteractionRegistry ( )
private

Definition at line 45 of file G4HadronicInteractionRegistry.cc.

46 {
47  //std::cout << "G4HadronicInteractionRegistry " << this << std::endl;
48 }

Member Function Documentation

◆ Clean()

void G4HadronicInteractionRegistry::Clean ( )

Definition at line 55 of file G4HadronicInteractionRegistry.cc.

56 {
57  size_t nModels = allModels.size();
58  //std::cout << "G4HadronicInteractionRegistry::Clean() start " << nModels
59  // << " " << this << std::endl;
60  for (size_t i=0; i<nModels; ++i) {
61  if( allModels[i] ) {
62  const char* xxx = (allModels[i]->GetModelName()).c_str();
63  G4int len = (allModels[i]->GetModelName()).length();
64  len = std::min(len, 9);
65  const G4String mname = G4String(xxx, len);
66  //std::cout << "G4HadronicInteractionRegistry: delete " << i << " "
67  // << allModels[i] << " " << mname
68  // << " " << this << std::endl;
69  if(mname != "NeutronHP" && mname != "ParticleH") {
70  delete allModels[i];
71  }
72  // std::cout << "done " << this << std::endl;
73  }
74  }
75  allModels.clear();
76  //std::cout <<"G4HadronicInteractionRegistry::Clean() is done "<<std::endl;
77 }
std::vector< G4HadronicInteraction * > allModels
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ FindAllModels()

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

Definition at line 126 of file G4HadronicInteractionRegistry.cc.

127 {
128  std::vector<G4HadronicInteraction*> models;
129 
130  size_t nModels = allModels.size();
131  for (size_t i=0; i<nModels; ++i) {
133  if(p) {
134  if (p->GetModelName() == name) {
135  models.push_back(p);
136  }
137  }
138  }
139  return models;
140 }
G4String name
Definition: TRTMaterials.hh:40
std::vector< G4HadronicInteraction * > allModels
const G4String & GetModelName() const
Here is the call graph for this function:

◆ FindModel()

G4HadronicInteraction * G4HadronicInteractionRegistry::FindModel ( const G4String name)

Definition at line 108 of file G4HadronicInteractionRegistry.cc.

109 {
110  G4HadronicInteraction* model = 0;
111 
112  size_t nModels = allModels.size();
113  for (size_t i=0; i<nModels; ++i) {
115  if(p) {
116  if (p->GetModelName() == name) {
117  model = p;
118  break;
119  }
120  }
121  }
122  return model;
123 }
G4String name
Definition: TRTMaterials.hh:40
std::vector< G4HadronicInteraction * > allModels
const G4String & GetModelName() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

G4HadronicInteractionRegistry * G4HadronicInteractionRegistry::Instance ( void  )
static

Definition at line 36 of file G4HadronicInteractionRegistry.cc.

37 {
38  if(!instance) {
40  instance = inst.Instance();
41  }
42  return instance;
43 }
static G4ThreadLocal G4HadronicInteractionRegistry * instance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterMe()

void G4HadronicInteractionRegistry::RegisterMe ( G4HadronicInteraction aModel)

Definition at line 80 of file G4HadronicInteractionRegistry.cc.

81 {
82  if(!aModel) { return; }
83  size_t nModels = allModels.size();
84  for (size_t i=0; i<nModels; ++i) {
85  if( aModel == allModels[i] ) { return; }
86  }
87  //G4cout << "Register model <" << aModel->GetModelName()
88  // << "> " << nModels+1 << " " << aModel << G4endl;
89  allModels.push_back(aModel);
90 }
std::vector< G4HadronicInteraction * > allModels
Here is the caller graph for this function:

◆ RemoveMe()

void G4HadronicInteractionRegistry::RemoveMe ( G4HadronicInteraction aModel)

Definition at line 93 of file G4HadronicInteractionRegistry.cc.

94 {
95  if(!aModel) { return; }
96  size_t nModels = allModels.size();
97  for (size_t i=0; i<nModels; ++i) {
98  if( aModel == allModels[i] ) {
99  //std::cout << "DeRegister model <" << aModel
100  // << "> " << i << std::endl;
101  allModels[i] = 0;
102  return;
103  }
104  }
105 }
std::vector< G4HadronicInteraction * > allModels
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ G4ThreadLocalSingleton< G4HadronicInteractionRegistry >

Member Data Documentation

◆ allModels

std::vector<G4HadronicInteraction*> G4HadronicInteractionRegistry::allModels
private

Definition at line 76 of file G4HadronicInteractionRegistry.hh.

◆ instance

G4ThreadLocal G4HadronicInteractionRegistry * G4HadronicInteractionRegistry::instance = 0
staticprivate

Definition at line 74 of file G4HadronicInteractionRegistry.hh.


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