5 #include <phparameter/PHParameters.h>
6 #include <phparameter/PHParametersContainer.h>
8 #include <pdbcalbase/PdbParameterMapContainer.h>
19 #include <boost/format.hpp>
20 #include <boost/stacktrace.hpp>
31 , m_ParamsContainer(nullptr)
33 , m_SaveTopNode(nullptr)
34 , m_OverlapCheckFlag(
false)
37 , m_BeginRunExecutedFlag(0)
39 , m_SuperDetector(
"NONE")
40 , m_CalibFileDir(
"./")
45 nam << name <<
"_" << lyr;
46 Name(nam.str().c_str());
63 string g4geonodename =
"G4GEO_";
64 string paramnodename =
"G4GEOPARAM_";
66 int isSuperDetector = 0;
70 m_ParamsContainer = findNode::getClass<PHParametersContainer>(parNode, g4geonodename);
78 parNode->addNode(DetNode);
158 cout <<
Name() << endl;
180 cout <<
PHWHERE <<
" no parameters for detid " << detid << endl;
195 cout <<
PHWHERE <<
" no parameters for detid " << detid << endl;
211 cout <<
PHWHERE <<
" no parameters for detid " << detid << endl;
222 cout <<
"called like set_double_param(" << detid <<
", \""
223 << name <<
"\", " << dval <<
")" << endl;
224 cout <<
"detid " << detid <<
" not implemented" << endl;
225 cout <<
"implemented detector ids: " << endl;
228 cout <<
"detid: " << iter2.first << endl;
232 if (iter->second.find(name) == iter->second.end())
234 cout <<
"double parameter " << name <<
" not implemented for detid "
236 cout <<
"implemented double parameters are:" << endl;
237 for (
auto &iter2 : iter->second)
239 cout << iter2.first << endl;
249 map<const std::string, double> newdmap;
256 ret.first->second[
name] = dval;
265 cout <<
"called like set_int_param(" << detid <<
", \""
266 << name <<
"\", " << ival <<
")" << endl;
267 cout <<
"detid " << detid <<
" not implemented" << endl;
268 cout <<
"implemented detector ids: " << endl;
271 cout <<
"detid: " << iter2.first << endl;
275 if (iter->second.find(name) == iter->second.end())
277 cout <<
"int parameter " << name <<
" not implemented for detid"
279 cout <<
"implemented int parameters are:" << endl;
280 for (
auto &iter2 : iter->second)
282 cout << iter2.first << endl;
288 map<const std::string, int> newintmap;
295 ret.first->second[
name] = ival;
303 cout <<
"called like set_string_param(" << detid <<
", \""
304 << name <<
"\", " << sval <<
")" << endl;
305 cout <<
"detid " << detid <<
" not implemented" << endl;
306 cout <<
"implemented detector ids: " << endl;
309 cout <<
"detid: " << iter2.first << endl;
313 if (iter->second.find(name) == iter->second.end())
315 cout <<
"string parameter " << name <<
" not implemented for detid "
317 cout <<
"implemented string parameters are:" << endl;
318 for (
auto &iter2 : iter->second)
320 cout << iter2.first << endl;
331 map<const std::string, string> newdmap;
338 ret.first->second[
name] = sval;
347 for (
auto &iter2 : iter1.second)
356 for (
auto &iter2 : iter1.second)
365 for (
auto &iter2 : iter1.second)
387 map<const std::string, double> newdoublemap;
389 auto ret2 = ret.first->second.insert(make_pair(name, dval));
390 if (ret2.second ==
false)
392 cout <<
PHWHERE <<
"Default double Parameter " << name
393 <<
" for detid " << detid <<
" already set to "
394 << ret.first->second[
name] <<
" will not overwrite with " << dval << endl;
395 cout <<
"Means: You are calling set_default_double_param twice for the same parameter" << endl;
396 cout <<
"Please make up your mind and call it only once using the correct default" << endl;
405 map<const std::string, int> newintmap;
407 auto ret2 = ret.first->second.insert(make_pair(name, ival));
408 if (ret2.second ==
false)
410 cout <<
PHWHERE <<
"Default integer Parameter " << name
411 <<
" for detid " << detid <<
" already set to "
412 << ret.first->second[
name] <<
" will not overwrite with " << ival << endl;
413 cout <<
"Means: You are calling set_default_int_param twice for the same parameter" << endl;
414 cout <<
"Please make up your mind and call it only once using the correct default" << endl;
423 map<const std::string, string> newstringmap;
425 auto ret2 = ret.first->second.insert(make_pair(name, sval));
426 if (ret2.second ==
false)
428 cout <<
PHWHERE <<
"Default String Parameter " << name
429 <<
" for detid " << detid <<
" already set to "
430 << ret.first->second[
name] <<
" will not overwrite with " << sval << endl;
431 cout <<
"Means: You are calling set_default_string_param twice for the same parameter" << endl;
432 cout <<
"Please make up your mind and call it only once using the correct default" << endl;
455 detidparams =
new PHParameters((boost::format(
"%s_%d") %
Name() % iter1.first).str());
458 for (
auto &iter2 : iter1.second)
469 detidparams =
new PHParameters((boost::format(
"%s_%d") %
Name() % iter1.first).str());
472 for (
auto &iter2 : iter1.second)
483 detidparams =
new PHParameters((boost::format(
"%s_%d") %
Name() % iter1.first).str());
486 for (
auto &iter2 : iter1.second)
500 cout <<
"problem committing to DB" << endl;
517 cout << boost::stacktrace::stacktrace();
519 <<
"DO NOT PANIC - this is not a segfault" << endl;
520 cout <<
"This method is a dummy, tell the offline gurus about it and give this stack trace" << endl;
522 cout <<
"problem reading from DB" << endl;
540 cout <<
PHWHERE <<
"filetype " << ftyp <<
" not implemented" << endl;
548 cout <<
"problem saving to " << extension <<
" file " << endl;
565 cout <<
PHWHERE <<
"filetype " << ftyp <<
" not implemented" << endl;
571 cout << boost::stacktrace::stacktrace();
573 <<
"DO NOT PANIC - this is not a segfault" << endl;
574 cout <<
"This method is a dummy, tell the offline gurus about it and give this stack trace" << endl;
575 cout <<
"problem reading from " << extension <<
" file " << endl;
576 cout <<
"problem reading from DB" << endl;
635 cout <<
"Default Parameters: " << endl;
636 cout <<
"int values: " << endl;
639 cout <<
"Detector id: " << iter1.first << endl;
640 for (
auto &iter2 : iter1.second)
642 cout << iter2.first <<
" : " << iter2.second << endl;
645 cout <<
"double values: " << endl;
648 cout <<
"Detector id: " << iter1.first << endl;
649 for (
auto &iter2 : iter1.second)
651 cout << iter2.first <<
" : " << iter2.second << endl;
654 cout <<
"string values: " << endl;
657 cout <<
"Detector id: " << iter1.first << endl;
658 for (
auto &iter2 : iter1.second)
660 cout << iter2.first <<
" : " << iter2.second << endl;
668 cout <<
"Macro Parameters: " << endl;
669 cout <<
"int values: " << endl;
672 cout <<
"Detector id: " << iter1.first << endl;
673 for (
auto &iter2 : iter1.second)
675 cout << iter2.first <<
" : " << iter2.second << endl;
678 cout <<
"double values: " << endl;
681 cout <<
"Detector id: " << iter1.first << endl;
682 for (
auto &iter2 : iter1.second)
684 cout << iter2.first <<
" : " << iter2.second << endl;
687 cout <<
"string values: " << endl;
690 cout <<
"Detector id: " << iter1.first << endl;
691 for (
auto &iter2 : iter1.second)
693 cout << iter2.first <<
" : " << iter2.second << endl;