Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
G4HadronicDeveloperParameters Class Reference

#include <G4HadronicDeveloperParameters.hh>

Public Member Functions

G4bool DeveloperGet (const std::string name, G4bool &value)
 
G4bool DeveloperGet (const std::string name, G4double &value)
 
G4bool DeveloperGet (const std::string name, G4int &value)
 
void Dump (const std::string name)
 
G4bool Get (const std::string name, G4bool &value)
 
G4bool Get (const std::string name, G4double &value)
 
G4bool Get (const std::string name, G4int &value)
 
G4bool GetDefault (const std::string name, G4bool &value)
 
G4bool GetDefault (const std::string name, G4double &value)
 
G4bool GetDefault (const std::string name, G4int &value)
 
G4bool Set (const std::string name, const G4bool)
 
G4bool Set (const std::string name, const G4double)
 
G4bool Set (const std::string name, const G4int)
 
G4bool SetDefault (const std::string name, const G4bool value)
 
G4bool SetDefault (const std::string name, const G4double value, G4double lower_limit=-DBL_MAX, G4double upper_limit=DBL_MAX)
 
G4bool SetDefault (const std::string name, const G4int value, G4int lower_limit=-INT_MAX, G4int upper_limit=INT_MAX)
 

Static Public Member Functions

static G4HadronicDeveloperParametersGetInstance ()
 

Private Member Functions

G4bool check_value_within_limits (std::pair< const G4double, const G4double > &, G4double)
 
G4bool check_value_within_limits (std::pair< const G4int, const G4int > &, G4int)
 
 G4HadronicDeveloperParameters ()
 
 G4HadronicDeveloperParameters (const G4HadronicDeveloperParameters &)
 
G4bool get (const std::string name, G4bool &value, G4bool check_change=false)
 
G4bool get (const std::string name, G4double &value, G4bool check_change=false)
 
G4bool get (const std::string name, G4int &value, G4bool check_change=false)
 
void issue_has_changed (const std::string &name)
 
void issue_is_already_defined (const std::string &name)
 
void issue_is_modified (const std::string &name)
 
void issue_no_param (const std::string &name)
 
void issue_non_eligible_value (const std::string &name)
 
G4HadronicDeveloperParametersoperator= (const G4HadronicDeveloperParameters &)
 

Private Attributes

std::map< std::string, const G4boolb_defaults
 
std::map< std::string, G4boolb_values
 
std::map< std::string, const G4doubledefaults
 
std::map< std::string, const G4inti_defaults
 
std::map< std::string, std::pair< const G4int, const G4int > > i_limits
 
std::map< std::string, G4inti_values
 
std::map< std::string, std::pair< const G4double, const G4double > > limits
 
std::map< std::string, G4doublevalues
 

Detailed Description

Definition at line 36 of file G4HadronicDeveloperParameters.hh.

Constructor & Destructor Documentation

◆ G4HadronicDeveloperParameters() [1/2]

G4HadronicDeveloperParameters::G4HadronicDeveloperParameters ( )
private

Definition at line 33 of file G4HadronicDeveloperParameters.cc.

33 {
34}

◆ G4HadronicDeveloperParameters() [2/2]

G4HadronicDeveloperParameters::G4HadronicDeveloperParameters ( const G4HadronicDeveloperParameters )
private

Definition at line 36 of file G4HadronicDeveloperParameters.cc.

36 {
37}

Member Function Documentation

◆ check_value_within_limits() [1/2]

G4bool G4HadronicDeveloperParameters::check_value_within_limits ( std::pair< const G4double, const G4double > &  alimits,
G4double  value 
)
private

Definition at line 293 of file G4HadronicDeveloperParameters.cc.

293 {
294 if ( alimits.first <= value && value <= alimits.second ) {
295 return true;
296 } else {
297 return false;
298 }
299}

Referenced by Set().

◆ check_value_within_limits() [2/2]

G4bool G4HadronicDeveloperParameters::check_value_within_limits ( std::pair< const G4int, const G4int > &  alimits,
G4int  value 
)
private

Definition at line 301 of file G4HadronicDeveloperParameters.cc.

301 {
302 if ( alimits.first <= value && value <= alimits.second ) {
303 return true;
304 } else {
305 return false;
306 }
307}

◆ DeveloperGet() [1/3]

G4bool G4HadronicDeveloperParameters::DeveloperGet ( const std::string  name,
G4bool value 
)

◆ DeveloperGet() [2/3]

G4bool G4HadronicDeveloperParameters::DeveloperGet ( const std::string  name,
G4double value 
)

Definition at line 192 of file G4HadronicDeveloperParameters.cc.

192 {
193 return get( name , value , true );
194}

References get(), and G4InuclParticleNames::name().

◆ DeveloperGet() [3/3]

G4bool G4HadronicDeveloperParameters::DeveloperGet ( const std::string  name,
G4int value 
)

Definition at line 217 of file G4HadronicDeveloperParameters.cc.

217 {
218 return get( name , value , true );
219}

References get(), and G4InuclParticleNames::name().

◆ Dump()

void G4HadronicDeveloperParameters::Dump ( const std::string  name)

Definition at line 263 of file G4HadronicDeveloperParameters.cc.

263 {
264 //const std::map<std::string,G4double>::iterator it = values.find( name );
265 if ( b_values.find( name ) != b_values.end() ) {
266 G4cout << "G4HadronicDeveloperParameters: "
267 << "name = " << name
268 << ", default value = " << b_defaults.find( name )->second
269 << ", current value = " << b_values.find( name )->second
270 << "." << G4endl;
271 } else if ( i_values.find( name ) != i_values.end() ) {
272 G4cout << "G4HadronicDeveloperParameters: "
273 << "name = " << name
274 << ", default value = " << i_defaults.find( name )->second
275 << ", lower limit = " << i_limits.find( name )->second.first
276 << ", upper limit = " << i_limits.find( name )->second.second
277 << ", current value = " << i_values.find( name )->second
278 << "." << G4endl;
279 } else if ( values.find( name ) != values.end() ) {
280 G4cout << "G4HadronicDeveloperParameters: "
281 << "name = " << name
282 << ", default value = " << defaults.find( name )->second
283 << ", lower limit = " << limits.find( name )->second.first
284 << ", upper limit = " << limits.find( name )->second.second
285 << ", current value = " << values.find( name )->second
286 << "." << G4endl;
287 } else {
288 /*Parameter of "name" does not exist*/
290 }
291}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
std::map< std::string, std::pair< const G4double, const G4double > > limits
std::map< std::string, const G4double > defaults
std::map< std::string, G4int > i_values
std::map< std::string, G4bool > b_values
std::map< std::string, const G4bool > b_defaults
void issue_no_param(const std::string &name)
std::map< std::string, G4double > values
std::map< std::string, std::pair< const G4int, const G4int > > i_limits
std::map< std::string, const G4int > i_defaults

References b_defaults, b_values, defaults, G4cout, G4endl, i_defaults, i_limits, i_values, issue_no_param(), limits, G4InuclParticleNames::name(), and values.

◆ Get() [1/3]

G4bool G4HadronicDeveloperParameters::Get ( const std::string  name,
G4bool value 
)

Definition at line 238 of file G4HadronicDeveloperParameters.cc.

238 {
239 return get( name , value );
240}

References get(), and G4InuclParticleNames::name().

◆ get() [1/3]

G4bool G4HadronicDeveloperParameters::get ( const std::string  name,
G4bool value,
G4bool  check_change = false 
)
private

Definition at line 196 of file G4HadronicDeveloperParameters.cc.

196 {
197 G4bool status = false;
198 const std::map<std::string,G4bool>::iterator it = b_values.find( name );
199 if ( it != b_values.end() ) {
200 status = true;
201 value = it->second;
202 if ( check_change && value != b_defaults.find(name)->second ) {
203 //Parameter "name" has changed from default
205 }
206 } else {
207 //Parameter of "name" does not exist
209 }
210 return status;
211}
bool G4bool
Definition: G4Types.hh:86
void issue_is_modified(const std::string &name)

References b_defaults, b_values, issue_is_modified(), issue_no_param(), and G4InuclParticleNames::name().

Referenced by DeveloperGet(), and Get().

◆ Get() [2/3]

G4bool G4HadronicDeveloperParameters::Get ( const std::string  name,
G4double value 
)

Definition at line 188 of file G4HadronicDeveloperParameters.cc.

188 {
189 return get( name , value );
190}

References get(), and G4InuclParticleNames::name().

◆ get() [2/3]

G4bool G4HadronicDeveloperParameters::get ( const std::string  name,
G4double value,
G4bool  check_change = false 
)
private

Definition at line 246 of file G4HadronicDeveloperParameters.cc.

246 {
247 G4bool status = false;
248 const std::map<std::string,G4double>::iterator it = values.find( name );
249 if ( it != values.end() ) {
250 status = true;
251 value = it->second;
252 if ( check_change && value != defaults.find(name)->second ) {
253 /*Parameter "name" has changed from default*/
255 }
256 } else {
257 /*Parameter of "name" does not exist*/
259 }
260 return status;
261}

References defaults, issue_is_modified(), issue_no_param(), G4InuclParticleNames::name(), and values.

◆ Get() [3/3]

G4bool G4HadronicDeveloperParameters::Get ( const std::string  name,
G4int value 
)

Definition at line 213 of file G4HadronicDeveloperParameters.cc.

213 {
214 return get( name , value );
215}

References get(), and G4InuclParticleNames::name().

◆ get() [3/3]

G4bool G4HadronicDeveloperParameters::get ( const std::string  name,
G4int value,
G4bool  check_change = false 
)
private

Definition at line 221 of file G4HadronicDeveloperParameters.cc.

221 {
222 G4bool status = false;
223 const std::map<std::string,G4int>::iterator it = i_values.find( name );
224 if ( it != i_values.end() ) {
225 status = true;
226 value = it->second;
227 if ( check_change && value != i_defaults.find(name)->second ) {
228 //Parameter "name" has changed from default
230 }
231 } else {
232 //Parameter of "name" does not exist
234 }
235 return status;
236}

References i_defaults, i_values, issue_is_modified(), issue_no_param(), and G4InuclParticleNames::name().

◆ GetDefault() [1/3]

G4bool G4HadronicDeveloperParameters::GetDefault ( const std::string  name,
G4bool value 
)

Definition at line 149 of file G4HadronicDeveloperParameters.cc.

149 {
150 G4bool status = false;
151 const std::map<std::string,const G4bool>::iterator it = b_defaults.find( name );
152 if ( it != b_defaults.end() ) {
153 status = true;
154 value = it->second;
155 } else {
156 /*Parameter of "name" does not exist*/
158 }
159 return status;
160}

References b_defaults, issue_no_param(), and G4InuclParticleNames::name().

◆ GetDefault() [2/3]

G4bool G4HadronicDeveloperParameters::GetDefault ( const std::string  name,
G4double value 
)

Definition at line 175 of file G4HadronicDeveloperParameters.cc.

175 {
176 G4bool status = false;
177 const std::map<std::string,const G4double>::iterator it = defaults.find( name );
178 if ( it != defaults.end() ) {
179 status = true;
180 value = it->second;
181 } else {
182 /*Parameter of "name" does not exist*/
184 }
185 return status;
186}

References defaults, issue_no_param(), and G4InuclParticleNames::name().

◆ GetDefault() [3/3]

G4bool G4HadronicDeveloperParameters::GetDefault ( const std::string  name,
G4int value 
)

Definition at line 162 of file G4HadronicDeveloperParameters.cc.

162 {
163 G4bool status = false;
164 const std::map<std::string,const G4int>::iterator it = i_defaults.find( name );
165 if ( it != i_defaults.end() ) {
166 status = true;
167 value = it->second;
168 } else {
169 /*Parameter of "name" does not exist*/
171 }
172 return status;
173}

References i_defaults, issue_no_param(), and G4InuclParticleNames::name().

◆ GetInstance()

G4HadronicDeveloperParameters & G4HadronicDeveloperParameters::GetInstance ( )
static

Definition at line 28 of file G4HadronicDeveloperParameters.cc.

28 {
29 static G4HadronicDeveloperParameters instance;
30 return instance;
31}

◆ issue_has_changed()

void G4HadronicDeveloperParameters::issue_has_changed ( const std::string &  name)
private

Definition at line 316 of file G4HadronicDeveloperParameters.cc.

316 {
317 std::string text("Parameter ");
318 text += name;
319 text += " has already been changed once.";
320 G4Exception( "G4HadronicDeveloperParameters" , "HadDevPara_002", FatalException , text.c_str() );
321}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

References FatalException, G4Exception(), and G4InuclParticleNames::name().

Referenced by Set().

◆ issue_is_already_defined()

void G4HadronicDeveloperParameters::issue_is_already_defined ( const std::string &  name)
private

Definition at line 328 of file G4HadronicDeveloperParameters.cc.

328 {
329 std::string text("Parameter ");
330 text += name;
331 text += " is already defined.";
332 G4Exception( "G4HadronicDeveloperParameters" , "HadDevPara_004", FatalException , text.c_str() );
333}

References FatalException, G4Exception(), and G4InuclParticleNames::name().

Referenced by SetDefault().

◆ issue_is_modified()

void G4HadronicDeveloperParameters::issue_is_modified ( const std::string &  name)
private

Definition at line 334 of file G4HadronicDeveloperParameters.cc.

334 {
335 std::string text("Parameter ");
336 text += name;
337 text += " has changed from default value.";
338 G4Exception( "G4HadronicDeveloperParameters" , "HadDevPara_005", JustWarning , text.c_str() );
339}
@ JustWarning

References G4Exception(), JustWarning, and G4InuclParticleNames::name().

Referenced by get().

◆ issue_no_param()

void G4HadronicDeveloperParameters::issue_no_param ( const std::string &  name)
private

Definition at line 309 of file G4HadronicDeveloperParameters.cc.

309 {
310 std::string text("Parameter ");
311 text += name;
312 text += " does not exist.";
313 G4Exception( "G4HadronicDeveloperParameters" , "HadDevPara_001", FatalException , text.c_str() );
314}

References FatalException, G4Exception(), and G4InuclParticleNames::name().

Referenced by Dump(), get(), GetDefault(), and Set().

◆ issue_non_eligible_value()

void G4HadronicDeveloperParameters::issue_non_eligible_value ( const std::string &  name)
private

Definition at line 322 of file G4HadronicDeveloperParameters.cc.

322 {
323 std::string text("The value of the parameter ");
324 text += name;
325 text += " is outside the allowable range.";
326 G4Exception( "G4HadronicDeveloperParameters" , "HadDevPara_003", FatalException , text.c_str() );
327}

References FatalException, G4Exception(), and G4InuclParticleNames::name().

Referenced by Set().

◆ operator=()

G4HadronicDeveloperParameters & G4HadronicDeveloperParameters::operator= ( const G4HadronicDeveloperParameters )
private

◆ Set() [1/3]

G4bool G4HadronicDeveloperParameters::Set ( const std::string  name,
const G4bool  value 
)

Definition at line 83 of file G4HadronicDeveloperParameters.cc.

83 {
84 G4bool status = false;
85 const std::map<std::string,G4bool>::iterator it = b_values.find( name );
86 if ( it != b_values.end() ) {
87 if ( it->second == b_defaults.find(name)->second ) {
88 status = true;
89 it->second = value;
90 } else {
91 /*change more than once*/
93 }
94 } else {
95 /*Parameter of "name" does not exist*/
97 }
98 return status;
99}
void issue_has_changed(const std::string &name)

References b_defaults, b_values, issue_has_changed(), issue_no_param(), and G4InuclParticleNames::name().

◆ Set() [2/3]

G4bool G4HadronicDeveloperParameters::Set ( const std::string  name,
const G4double  value 
)

Definition at line 125 of file G4HadronicDeveloperParameters.cc.

125 {
126 G4bool status = false;
127 const std::map<std::string,G4double>::iterator it = values.find( name );
128 if ( it != values.end() ) {
129 if ( it->second == defaults.find(name)->second ) {
130 if ( check_value_within_limits( limits.find(name)->second , value ) ) {
131 /*value is OK*/
132 status = true;
133 it->second = value;
134 } else {
135 /*Value is outside of valid range*/
137 }
138 } else {
139 /*change more than once*/
141 }
142 } else {
143 /*Parameter of "name" does not exist*/
145 }
146 return status;
147}
G4bool check_value_within_limits(std::pair< const G4double, const G4double > &, G4double)
void issue_non_eligible_value(const std::string &name)

References check_value_within_limits(), defaults, issue_has_changed(), issue_no_param(), issue_non_eligible_value(), limits, G4InuclParticleNames::name(), and values.

◆ Set() [3/3]

G4bool G4HadronicDeveloperParameters::Set ( const std::string  name,
const G4int  value 
)

Definition at line 101 of file G4HadronicDeveloperParameters.cc.

101 {
102 G4bool status = false;
103 const std::map<std::string,G4int>::iterator it = i_values.find( name );
104 if ( it != i_values.end() ) {
105 if ( it->second == i_defaults.find(name)->second ) {
106 if ( check_value_within_limits( i_limits.find(name)->second , value ) ) {
107 /*value is OK*/
108 status = true;
109 it->second = value;
110 } else {
111 /*Value is outside of valid range*/
113 }
114 } else {
115 /*change more than once*/
117 }
118 } else {
119 /*Parameter of "name" does not exist*/
121 }
122 return status;
123}

References check_value_within_limits(), i_defaults, i_limits, i_values, issue_has_changed(), issue_no_param(), issue_non_eligible_value(), and G4InuclParticleNames::name().

◆ SetDefault() [1/3]

G4bool G4HadronicDeveloperParameters::SetDefault ( const std::string  name,
const G4bool  value 
)

Definition at line 39 of file G4HadronicDeveloperParameters.cc.

39 {
40 G4bool status = false;
41 const std::map< std::string , const G4bool >::iterator it = b_defaults.find( name );
42 if ( it == b_defaults.end() ) {
43 status = true;
44 b_defaults.insert( std::pair<std::string, const G4bool>( name , value ) );
45 b_values.insert( std::pair<std::string, G4bool>( name , value ) );
46 } else {
47 /*error*/
49 }
50 return status;
51}
void issue_is_already_defined(const std::string &name)

References b_defaults, b_values, issue_is_already_defined(), and G4InuclParticleNames::name().

Referenced by anonymous_namespace{G4CascadeParameters.cc}::BERTParameters::BERTParameters(), and G4FTFSettingDefaultHDP::G4FTFSettingDefaultHDP().

◆ SetDefault() [2/3]

G4bool G4HadronicDeveloperParameters::SetDefault ( const std::string  name,
const G4double  value,
G4double  lower_limit = -DBL_MAX,
G4double  upper_limit = DBL_MAX 
)

Definition at line 68 of file G4HadronicDeveloperParameters.cc.

68 {
69 G4bool status = false;
70 const std::map< std::string , const G4double >::iterator it = defaults.find( name );
71 if ( it == defaults.end() ) {
72 status = true;
73 defaults.insert( std::pair<std::string, const G4double>( name , value ) );
74 values.insert( std::pair<std::string, G4double>( name , value ) );
75 limits.insert( std::pair< std::string,std::pair< const G4double , const G4double> >( name, std::pair< const G4double , const G4double> ( lower_limit , upper_limit ) ) );
76 } else {
77 /*error*/
79 }
80 return status;
81}

References defaults, issue_is_already_defined(), limits, G4InuclParticleNames::name(), and values.

◆ SetDefault() [3/3]

G4bool G4HadronicDeveloperParameters::SetDefault ( const std::string  name,
const G4int  value,
G4int  lower_limit = -INT_MAX,
G4int  upper_limit = INT_MAX 
)

Definition at line 53 of file G4HadronicDeveloperParameters.cc.

53 {
54 G4bool status = false;
55 const std::map< std::string , const G4int >::iterator it = i_defaults.find( name );
56 if ( it == i_defaults.end() ) {
57 status = true;
58 i_defaults.insert( std::pair<std::string, const G4int>( name , value ) );
59 i_values.insert( std::pair<std::string, G4int>( name , value ) );
60 i_limits.insert( std::pair< std::string,std::pair< const G4int , const G4int> >( name, std::pair< const G4int , const G4int> ( lower_limit , upper_limit ) ) );
61 } else {
62 /*error*/
64 }
65 return status;
66}

References i_defaults, i_limits, i_values, issue_is_already_defined(), and G4InuclParticleNames::name().

Field Documentation

◆ b_defaults

std::map<std::string,const G4bool> G4HadronicDeveloperParameters::b_defaults
private

Definition at line 74 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), get(), GetDefault(), Set(), and SetDefault().

◆ b_values

std::map<std::string,G4bool> G4HadronicDeveloperParameters::b_values
private

Definition at line 73 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), get(), Set(), and SetDefault().

◆ defaults

std::map<std::string,const G4double> G4HadronicDeveloperParameters::defaults
private

Definition at line 81 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), get(), GetDefault(), Set(), and SetDefault().

◆ i_defaults

std::map<std::string,const G4int> G4HadronicDeveloperParameters::i_defaults
private

Definition at line 77 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), get(), GetDefault(), Set(), and SetDefault().

◆ i_limits

std::map<std::string,std::pair<const G4int,const G4int> > G4HadronicDeveloperParameters::i_limits
private

Definition at line 78 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), Set(), and SetDefault().

◆ i_values

std::map<std::string,G4int> G4HadronicDeveloperParameters::i_values
private

Definition at line 76 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), get(), Set(), and SetDefault().

◆ limits

std::map<std::string,std::pair<const G4double,const G4double> > G4HadronicDeveloperParameters::limits
private

Definition at line 82 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), Set(), and SetDefault().

◆ values

std::map<std::string,G4double> G4HadronicDeveloperParameters::values
private

Definition at line 80 of file G4HadronicDeveloperParameters.hh.

Referenced by Dump(), get(), Set(), and SetDefault().


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