GEMC
2.2
Geant4 Monte-Carlo Framework
Main Page
Namespaces
Data Structures
Files
File List
Globals
parameters
text_parameters.cc
Go to the documentation of this file.
1
// gemc headers
2
#include "
parameter_factory.h
"
3
#include "
text_parameters.h
"
4
#include "
string_utilities.h
"
5
#include "
utils.h
"
6
7
8
map<string, double>
text_parameters::loadParameters
(
goptions
opts,
runConditions
RC)
9
{
10
string
hd_msg = opts.
optMap
[
"LOG_MSG"
].args +
" TEXT Parameters: >> "
;
11
double
verbosity
= opts.
optMap
[
"PARAMETER_VERBOSITY"
].arg;
12
13
map<string, double> GParameters;
// parameters maps
14
// first check if there's at least one detector with MYSQL factory
15
if
(!
check_if_factory_is_needed
(RC.
detectorConditionsMap
,
factoryType
))
16
return
GParameters;
17
18
// Looping over detectorConditionsMap for detector names
19
// To each detector is associated a material table and an opt properties table
20
for
(map<string, detectorCondition>::iterator it=RC.
detectorConditionsMap
.begin(); it != RC.
detectorConditionsMap
.end(); it++)
21
{
22
if
(it->second.get_factory() !=
factoryType
)
23
continue
;
24
25
string
dname = it->first;
26
string
fname = dname +
"__parameters"
;
27
string
variation =
get_variation
(it->second.get_variation());
28
29
if
(verbosity)
30
cout << hd_msg <<
" Importing Parameters for Detector: "
<< dname <<
" with "
<<
factoryType
<<
" factory, variation "
<< variation << endl;
31
32
fname +=
"_"
+ variation +
".txt"
;
33
ifstream IN(fname.c_str());
34
if
(!IN)
35
{
36
// file doesn't exist for this system.
37
if
(verbosity > 1)
38
cout << hd_msg <<
" Warning: failed to open "
<< fname <<
" for system: "
<< dname <<
". Maybe the filename doesn't exist?"
<< endl;
39
continue
;
40
}
41
42
while
(!IN.eof())
43
{
44
string
dbline;
45
getline(IN, dbline);
46
47
if
(!dbline.size())
48
continue
;
49
50
gtable
gt(
get_strings
(dbline,
"|"
));
51
52
GParameters[gt.
data
[0]] =
get_par_value
(gt);
53
54
if
(verbosity > 1)
55
log_value
(gt,
factoryType
);
56
}
57
58
IN.close();
59
}
60
61
return
GParameters;
62
}
get_strings
vector< string > get_strings(string input)
returns a vector of strings from a stringstream, space is delimiter
Definition:
string_utilities.cc:43
check_if_factory_is_needed
int check_if_factory_is_needed(map< string, detectorCondition > dcon, string factory)
Definition:
run_conditions.cc:162
get_par_value
double get_par_value(gtable gt)
Definition:
parameter_factory.cc:87
gtable::data
vector< string > data
Definition:
utils.h:76
gtable
Definition:
utils.h:65
verbosity
double verbosity
Definition:
gdml_det_factory.cc:6
get_variation
string get_variation(string var)
parse variation name from string
Definition:
string_utilities.cc:185
utils.h
runConditions::detectorConditionsMap
map< string, detectorCondition > detectorConditionsMap
Definition:
run_conditions.h:91
runConditions
Definition:
run_conditions.h:83
string_utilities.h
goptions
Definition:
options.h:54
goptions::optMap
map< string, aopt > optMap
Options map.
Definition:
options.h:71
parametersFactory::factoryType
string factoryType
Definition:
parameter_factory.h:21
text_parameters::loadParameters
map< string, double > loadParameters(goptions, runConditions)
Definition:
text_parameters.cc:8
parameter_factory.h
log_value
void log_value(gtable gt, string factory)
Definition:
parameter_factory.cc:94
text_parameters.h
Generated on Wed Jul 6 2016 11:13:16 for GEMC by
1.8.11