Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4tgrParameterMgr Class Reference

#include <G4tgrParameterMgr.hh>

Public Member Functions

void AddParameterNumber (const std::vector< G4String > &wl, G4bool mustBeNew=0)
 
void AddParameterString (const std::vector< G4String > &wl, G4bool mustBeNew=0)
 
void CheckIfNewParameter (const std::vector< G4String > &wl, G4bool mustBeNew)
 
G4String FindParameter (const G4String &name, G4bool exists=true)
 
void DumpList ()
 

Static Public Member Functions

static G4tgrParameterMgrGetInstance ()
 

Detailed Description

Definition at line 50 of file G4tgrParameterMgr.hh.

Member Function Documentation

void G4tgrParameterMgr::AddParameterNumber ( const std::vector< G4String > &  wl,
G4bool  mustBeNew = 0 
)

Definition at line 72 of file G4tgrParameterMgr.cc.

74 {
75  CheckIfNewParameter( wl, mustBeNew );
76 
77  //----- Convert third argument to double, but then store it as string
78  // for later use in CLHEP evaluator
79  G4float val = G4tgrUtils::GetDouble( wl[2] );
80  theParameterList[ wl[1] ] = G4UIcommand::ConvertToString( val );
81 
82 #ifdef G4VERBOSE
84  {
85  G4cout << " G4tgrParameterMgr::AddParameterNumber() -"
86  << " parameter added " << wl[1]
87  << " = " << theParameterList[ wl[1] ] << G4endl;
88  }
89 #endif
90 }
float G4float
Definition: G4Types.hh:77
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:205
void CheckIfNewParameter(const std::vector< G4String > &wl, G4bool mustBeNew)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgrParameterMgr::AddParameterString ( const std::vector< G4String > &  wl,
G4bool  mustBeNew = 0 
)

Definition at line 94 of file G4tgrParameterMgr.cc.

96 {
97  CheckIfNewParameter( wl, mustBeNew );
98 
99  //----- Store parameter as string
100  theParameterList[ wl[1] ] = wl[2];
101 
102 #ifdef G4VERBOSE
104  {
105  G4cout << " G4tgrParameterMgr::AddParameterString() -"
106  << " parameter added " << wl[1]
107  << " = " << theParameterList[ wl[1] ] << G4endl;
108  }
109 #endif
110 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void CheckIfNewParameter(const std::vector< G4String > &wl, G4bool mustBeNew)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgrParameterMgr::CheckIfNewParameter ( const std::vector< G4String > &  wl,
G4bool  mustBeNew 
)

Definition at line 113 of file G4tgrParameterMgr.cc.

115 {
116  //---------- Find first if it exists already
117  G4bool existsAlready;
118  G4mapss::iterator sdite = theParameterList.find( wl[1] );
119  if( sdite == theParameterList.end() )
120  {
121  existsAlready = false;
122  }
123  else
124  {
125  existsAlready = true;
126  }
127 
128  if(existsAlready)
129  {
130  if( mustBeNew )
131  {
132  G4String ErrMessage = "Parameter already exists... " + wl[1];
133  G4Exception("G4tgrParameterMgr::CheckParameter()",
134  "IllegalConstruct", FatalException, ErrMessage);
135  }
136  else
137  {
138  G4String WarMessage = "Parameter already exists... " + wl[1];
139  G4Exception("G4tgrParameterMgr::CheckParameter()",
140  "NotRecommended", JustWarning, WarMessage);
141  }
142  }
143 
144  //---------- Check for miminum number of words read
145  G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_EQ, "Parameter::AddParameter");
146 }
static void CheckWLsize(const std::vector< G4String > &wl, unsigned int nWCheck, WLSIZEtype st, const G4String &methodName)
Definition: G4tgrUtils.cc:475
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

void G4tgrParameterMgr::DumpList ( )

Definition at line 183 of file G4tgrParameterMgr.cc.

184 {
185  //---------- Dump number of objects of each class
186  G4cout << " @@@@@@@@@@@@@@@@@@ Dumping parameter list " << G4endl;
187  G4mapss::const_iterator cite;
188  for( cite = theParameterList.begin();cite != theParameterList.end(); cite++ )
189  {
190  G4cout << (*cite).first << " = " << (*cite).second << G4endl;
191  }
192 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

G4String G4tgrParameterMgr::FindParameter ( const G4String name,
G4bool  exists = true 
)

Definition at line 150 of file G4tgrParameterMgr.cc.

151 {
152  G4String par = "";
153 
154  G4mapss::iterator sdite = theParameterList.find( name );
155  if( sdite == theParameterList.end() )
156  {
157  if( exists )
158  {
159  DumpList();
160  G4String ErrMessage = "Parameter not found in list: " + name;
161  G4Exception("G4tgrParameterMgr::FindParameter()",
162  "InvalidSetup", FatalException, ErrMessage);
163  }
164  }
165  else
166  {
167  exists = 1;
168  par = ((*sdite).second);
169 #ifdef G4VERBOSE
171  {
172  G4cout << " G4tgrParameterMgr::FindParameter() -"
173  << " parameter found " << name << " = " << par << G4endl;
174  }
175 #endif
176  }
177 
178  return par;
179 }
const XML_Char * name
Definition: expat.h:151
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4tgrParameterMgr * G4tgrParameterMgr::GetInstance ( )
static

Definition at line 61 of file G4tgrParameterMgr.cc.

62 {
63  if( !theInstance )
64  {
65  theInstance = new G4tgrParameterMgr;
66  }
67  return theInstance;
68 }

Here is the caller graph for this function:


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