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

#include <G4ITModelManager.hh>

Public Member Functions

 G4ITModelManager ()
 
 ~G4ITModelManager ()
 
void Initialize ()
 
 G4ITModelManager (const G4ITModelManager &other)
 
G4ITModelManageroperator= (const G4ITModelManager &rhs)
 
void SetModel (G4VITModel *aModel, G4double startingTime)
 
G4VITModelGetModel (const G4double globalTime)
 

Protected Types

typedef std::map< G4double, G4VITModel * > mapModels
 

Protected Attributes

mapModels fModels
 
G4bool fIsInitialized
 

Detailed Description

G4ITModelManager chooses which model to use according to the global simulation time.

Definition at line 50 of file G4ITModelManager.hh.

Member Typedef Documentation

◆ mapModels

typedef std::map<G4double , G4VITModel* > G4ITModelManager::mapModels
protected

Definition at line 63 of file G4ITModelManager.hh.

Constructor & Destructor Documentation

◆ G4ITModelManager() [1/2]

G4ITModelManager::G4ITModelManager ( )

Definition at line 42 of file G4ITModelManager.cc.

43{;}
#define FALSE
Definition: globals.hh:52

◆ ~G4ITModelManager()

G4ITModelManager::~G4ITModelManager ( )

Definition at line 45 of file G4ITModelManager.cc.

46{
47 //dtor
48 mapModels::iterator it ;
49
50 for(it = fModels.begin() ; it != fModels.end() ; it ++)
51 {
52 delete it->second;
53 }
54 fModels.clear();
55}

◆ G4ITModelManager() [2/2]

G4ITModelManager::G4ITModelManager ( const G4ITModelManager other)

Definition at line 57 of file G4ITModelManager.cc.

58{
59 mapModels::const_iterator it = right.fModels.begin();
60
61 for ( ; it != right.fModels.end() ; it++)
62 {
63 fModels[it->first] = it->second->Clone();
64 }
65
66 fIsInitialized = right.fIsInitialized;
67}

Member Function Documentation

◆ GetModel()

G4VITModel * G4ITModelManager::GetModel ( const G4double  globalTime)

Definition at line 103 of file G4ITModelManager.cc.

104{
105 if(!fModels.empty())
106 {
107 mapModels::reverse_iterator rit = fModels.rbegin();
108 if(rit != fModels.rend())
109 {
110 if(globalTime > rit->first)
111 {
112 return rit->second;
113 }
114 else
115 {
116 mapModels::iterator it = fModels.begin();
117
118 if(globalTime < it->first)
119 {
120 G4ExceptionDescription exceptionDescription ;
121 exceptionDescription << "No model was found at time ";
122 exceptionDescription << G4BestUnit(globalTime,"Time");
123 exceptionDescription << ". The first model is registered at time : ";
124 exceptionDescription << G4BestUnit(it->first,"Time") << ". ";
125 G4Exception("G4ITModelManager::GetModel","ITModelManager003",
126 FatalErrorInArgument,exceptionDescription);
127 }
128
129 it = fModels.lower_bound(globalTime);
130
131 if(it != fModels.end()) return it->second;
132 }
133 }
134 }
135
136 G4ExceptionDescription exceptionDescription ;
137 exceptionDescription << "No model was found.";
138 G4Exception("G4ITModelManager::GetModel","ITModelManager004",
139 FatalErrorInArgument,exceptionDescription);
140 return 0;
141}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

◆ Initialize()

void G4ITModelManager::Initialize ( )

Definition at line 76 of file G4ITModelManager.cc.

77{
78 mapModels::iterator it = fModels.begin();
79
80 for( ; it != fModels.end() ; it ++)
81 {
82 G4VITModel* model = it ->second;
83 if(model!=0)
84 {
85 model->Initialize();
86 }
87 }
88}
virtual void Initialize()
Definition: G4VITModel.cc:95

Referenced by G4ITModelHandler::Initialize().

◆ operator=()

G4ITModelManager & G4ITModelManager::operator= ( const G4ITModelManager rhs)

Definition at line 69 of file G4ITModelManager.cc.

70{
71 if (this == &rhs) return *this; // handle self assignment
72 //assignment operator
73 return *this;
74}

◆ SetModel()

void G4ITModelManager::SetModel ( G4VITModel aModel,
G4double  startingTime 
)

Definition at line 90 of file G4ITModelManager.cc.

91{
92 assert(fIsInitialized == FALSE);
93 if(fIsInitialized == true)
94 {
95 G4ExceptionDescription exceptionDescription ;
96 exceptionDescription << "You are trying to insert a new model after initialization of th model manager.";
97 G4Exception("G4ITModelManager::SetModel","ITModelManager001",
98 FatalErrorInArgument,exceptionDescription);
99 }
100 fModels[startingTime] = aModel;
101}

Member Data Documentation

◆ fIsInitialized

G4bool G4ITModelManager::fIsInitialized
protected

Definition at line 65 of file G4ITModelManager.hh.

Referenced by G4ITModelManager(), and SetModel().

◆ fModels

mapModels G4ITModelManager::fModels
protected

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