7 #include "CLHEP/Units/PhysicalConstants.h" 11 #include "Randomize.hh" 16 string hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" gcard: >> " ;
17 int run_number = gemcOpt.
optMap[
"RUNNO"].arg;
22 if(dfopt[0] !=
"no" && dfopt.size() > 1)
27 string file = gemcOpt.
optMap[
"gcard"].args;
28 if(file==
"no")
return;
30 QFile gcard(file.c_str());
32 if (!domDocument.setContent(&gcard))
35 cout << hd_msg <<
" gcard format is wrong - check XML syntax. Exiting." << endl;
41 QDomElement docElem = domDocument.documentElement();
43 QDomNode n = docElem.firstChild();
47 QDomElement e = n.toElement();
62 QDomNode nn = e.firstChild();
65 QDomElement ee = nn.toElement();
85 nn = nn.nextSibling();
111 rot = G4RotationMatrix(G4ThreeVector(1, 0, 0),
112 G4ThreeVector(0, 1, 0),
113 G4ThreeVector(0, 0, 1));
127 if(exist ==
"no" || exist ==
"NO" || exist ==
"No")
134 map<string, string> detmap;
137 for(map<string, detectorCondition>::iterator it = detectorConditionsMap.begin(); it != detectorConditionsMap.end(); it++)
140 detmap[it->first] =
" is loaded with factory " + it->second.get_factory()
141 +
", variation " + it->second.get_variation()
142 +
" and run number " +
stringify(it->second.get_run_number());
144 if(it->second.get_position().mag2() != 0)
146 string key =
"local shift for " + it->first;
147 detmap[key] =
"(" +
stringify(it->second.get_position().x()/mm) +
", " 148 +
stringify(it->second.get_position().y()/mm) +
", " 149 +
stringify(it->second.get_position().z()/mm) +
")mm";
152 if(it->second.get_vrotation().mag2() != 0)
154 string key =
"local rotation for " + it->first;
155 detmap[key] =
"(" +
stringify(it->second.get_vrotation().x()/degree) +
", " 156 +
stringify(it->second.get_vrotation().y()/degree) +
", " 157 +
stringify(it->second.get_vrotation().z()/degree) +
")deg";
168 for(map<string, detectorCondition>::iterator it=dcon.begin(); it != dcon.end(); it++)
170 if(it->second.get_factory() == factory)
178 if(detectorConditionsMap.find(detector) != detectorConditionsMap.end())
179 return detectorConditionsMap[detector].get_run_number();
187 if(detectorConditionsMap.find(detector) != detectorConditionsMap.end())
195 if(detectorConditionsMap.find(detector) != detectorConditionsMap.end())
196 return detectorConditionsMap[detector].get_system();
205 map<string, string> allSystems;
207 for(map<string, detectorCondition>::iterator it=detectorConditionsMap.begin(); it != detectorConditionsMap.end(); it++)
208 allSystems[it->first] = it->second.get_factory();
217 string fname = opts.
optMap[
"RUN_WEIGHTS"].args;
218 int nevts = opts.
optMap[
"N"].arg;
219 startEvent = opts.
optMap[
"EVN"].arg;
220 defaultRunNumber = opts.
optMap[
"RUNNO"].arg;
229 w[defaultRunNumber] = 1;
230 n[defaultRunNumber] = nevts;
234 ifstream in(fname.c_str());
238 cerr <<
" !!! Can't open input file " << fname.c_str() <<
". Exiting. " << endl;
253 for(
int i=0; i<nevts; i++)
255 double random = G4UniformRand();
257 for(map<int, double>::iterator it = w.begin(); it != w.end(); it++)
268 cout <<
" > Run weights table loaded: " << endl;
269 for(map<int, double>::iterator it = w.begin(); it != w.end(); it++)
270 cout <<
" - run: " << it->first <<
"\t weight: " << w[it->first] <<
"\t n. events: " << n[it->first] << endl;
277 int dn = evn - startEvent ;
281 for(map<int, int>::iterator it = n.begin(); it != n.end(); it++)
286 if(it->first != runNo)
300 runNo = defaultRunNumber;
void set_system(string s)
int check_if_factory_is_needed(map< string, detectorCondition > dcon, string factory)
map< string, string > getDetectorConditionsMap()
void set_rotation(string X, string Y, string Z)
vector< string > get_info(string input, string chars)
get information from strings such as "5*GeV, 2*deg, 10*deg", parses out strings in second argument ...
void set_factory(string f)
int get_run_number(string detector)
string get_variation(string var)
parse variation name from string
string qv_tostring(QVariant input)
string get_variation(string detector)
double get_number(string v, int warn_no_unit)
Returns number with dimension from string, i.e. 100*cm.
string assignAttribute(QDomElement e, string attribute, string defaultValue)
string stringify(double x)
map< string, aopt > optMap
Options map.
void set_existance(string exist)
void set_variation(string v)
string get_system(string detector)
void set_position(string X, string Y, string Z)
void set_run_number(int r)
map< string, string > get_systems()