#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 G4tgrParameterMgr * | GetInstance () |
Definition at line 50 of file G4tgrParameterMgr.hh.
void G4tgrParameterMgr::AddParameterNumber | ( | const std::vector< G4String > & | wl, | |
G4bool | mustBeNew = 0 | |||
) |
Definition at line 72 of file G4tgrParameterMgr.cc.
References CheckIfNewParameter(), G4UIcommand::ConvertToString(), G4cout, G4endl, G4tgrUtils::GetDouble(), and G4tgrMessenger::GetVerboseLevel().
Referenced by G4tgrLineProcessor::ProcessLine().
00074 { 00075 CheckIfNewParameter( wl, mustBeNew ); 00076 00077 //----- Convert third argument to double, but then store it as string 00078 // for later use in CLHEP evaluator 00079 G4float val = G4tgrUtils::GetDouble( wl[2] ); 00080 theParameterList[ wl[1] ] = G4UIcommand::ConvertToString( val ); 00081 00082 #ifdef G4VERBOSE 00083 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00084 { 00085 G4cout << " G4tgrParameterMgr::AddParameterNumber() -" 00086 << " parameter added " << wl[1] 00087 << " = " << theParameterList[ wl[1] ] << G4endl; 00088 } 00089 #endif 00090 }
void G4tgrParameterMgr::AddParameterString | ( | const std::vector< G4String > & | wl, | |
G4bool | mustBeNew = 0 | |||
) |
Definition at line 94 of file G4tgrParameterMgr.cc.
References CheckIfNewParameter(), G4cout, G4endl, and G4tgrMessenger::GetVerboseLevel().
Referenced by G4tgrLineProcessor::ProcessLine().
00096 { 00097 CheckIfNewParameter( wl, mustBeNew ); 00098 00099 //----- Store parameter as string 00100 theParameterList[ wl[1] ] = wl[2]; 00101 00102 #ifdef G4VERBOSE 00103 if( G4tgrMessenger::GetVerboseLevel() >= 2 ) 00104 { 00105 G4cout << " G4tgrParameterMgr::AddParameterString() -" 00106 << " parameter added " << wl[1] 00107 << " = " << theParameterList[ wl[1] ] << G4endl; 00108 } 00109 #endif 00110 }
void G4tgrParameterMgr::CheckIfNewParameter | ( | const std::vector< G4String > & | wl, | |
G4bool | mustBeNew | |||
) |
Definition at line 113 of file G4tgrParameterMgr.cc.
References G4tgrUtils::CheckWLsize(), FatalException, G4Exception(), JustWarning, and WLSIZE_EQ.
Referenced by AddParameterNumber(), and AddParameterString().
00115 { 00116 //---------- Find first if it exists already 00117 G4bool existsAlready; 00118 G4mapss::iterator sdite = theParameterList.find( wl[1] ); 00119 if( sdite == theParameterList.end() ) 00120 { 00121 existsAlready = false; 00122 } 00123 else 00124 { 00125 existsAlready = true; 00126 } 00127 00128 if(existsAlready) 00129 { 00130 if( mustBeNew ) 00131 { 00132 G4String ErrMessage = "Parameter already exists... " + wl[1]; 00133 G4Exception("G4tgrParameterMgr::CheckParameter()", 00134 "IllegalConstruct", FatalException, ErrMessage); 00135 } 00136 else 00137 { 00138 G4String WarMessage = "Parameter already exists... " + wl[1]; 00139 G4Exception("G4tgrParameterMgr::CheckParameter()", 00140 "NotRecommended", JustWarning, WarMessage); 00141 } 00142 } 00143 00144 //---------- Check for miminum number of words read 00145 G4tgrUtils::CheckWLsize( wl, 3, WLSIZE_EQ, "Parameter::AddParameter"); 00146 }
void G4tgrParameterMgr::DumpList | ( | ) |
Definition at line 183 of file G4tgrParameterMgr.cc.
References G4cout, and G4endl.
Referenced by FindParameter().
00184 { 00185 //---------- Dump number of objects of each class 00186 G4cout << " @@@@@@@@@@@@@@@@@@ Dumping parameter list " << G4endl; 00187 G4mapss::const_iterator cite; 00188 for( cite = theParameterList.begin();cite != theParameterList.end(); cite++ ) 00189 { 00190 G4cout << (*cite).first << " = " << (*cite).second << G4endl; 00191 } 00192 }
Definition at line 150 of file G4tgrParameterMgr.cc.
References DumpList(), FatalException, G4cout, G4endl, G4Exception(), and G4tgrMessenger::GetVerboseLevel().
Referenced by G4tgrUtils::GetDouble(), and G4tgrUtils::GetString().
00151 { 00152 G4String par = ""; 00153 00154 G4mapss::iterator sdite = theParameterList.find( name ); 00155 if( sdite == theParameterList.end() ) 00156 { 00157 if( exists ) 00158 { 00159 DumpList(); 00160 G4String ErrMessage = "Parameter not found in list: " + name; 00161 G4Exception("G4tgrParameterMgr::FindParameter()", 00162 "InvalidSetup", FatalException, ErrMessage); 00163 } 00164 } 00165 else 00166 { 00167 exists = 1; 00168 par = ((*sdite).second); 00169 #ifdef G4VERBOSE 00170 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 00171 { 00172 G4cout << " G4tgrParameterMgr::FindParameter() -" 00173 << " parameter found " << name << " = " << par << G4endl; 00174 } 00175 #endif 00176 } 00177 00178 return par; 00179 }
G4tgrParameterMgr * G4tgrParameterMgr::GetInstance | ( | ) | [static] |
Definition at line 61 of file G4tgrParameterMgr.cc.
Referenced by G4tgrUtils::GetDouble(), G4tgrUtils::GetString(), and G4tgrLineProcessor::ProcessLine().
00062 { 00063 if( !theInstance ) 00064 { 00065 theInstance = new G4tgrParameterMgr; 00066 } 00067 return theInstance; 00068 }