8 #include <TBufferXML.h>
12 #include <boost/stacktrace.hpp>
25 while (parametermap.begin() != parametermap.end())
27 delete parametermap.begin()->second;
28 parametermap.erase(parametermap.begin());
35 for (map<int, PdbParameterMap *>::const_iterator iter = parametermap.begin();
36 iter != parametermap.end(); ++iter)
38 cout <<
"layer " << iter->first << endl;
39 iter->second->print();
45 while (parametermap.begin() != parametermap.end())
47 delete parametermap.begin()->second;
48 parametermap.erase(parametermap.begin());
55 if (parametermap.find(layer) != parametermap.end())
57 cout <<
PHWHERE <<
" layer " << layer <<
" already exists" << endl;
58 cout <<
"Here is the stacktrace: " << endl;
59 cout << boost::stacktrace::stacktrace();
61 <<
"DO NOT PANIC - this is not a segfault" << endl;
62 cout <<
"Check the stacktrace for the guilty party (typically #2)" << endl;
65 parametermap[
layer] = params;
71 map<int, PdbParameterMap *>::const_iterator iter = parametermap.find(layer);
72 if (iter == parametermap.end())
82 map<int, PdbParameterMap *>::iterator iter = parametermap.find(layer);
83 if (iter == parametermap.end())
91 const string &
extension,
const string &dir)
95 ostringstream fullpath;
96 ostringstream fnamestream;
102 if (*(dir.rbegin()) !=
'/')
106 fnamestream << detector_name <<
"_geoparams"
110 string fname = fnamestream.str();
111 std::transform(fname.begin(), fname.end(), fname.begin(), ::tolower);
114 cout <<
"PdbParameterMapContainer::WriteToFile - save to " << fullpath.str()
117 TFile *
f = TFile::Open(fullpath.str().c_str(),
"recreate");
120 for (std::map<int, PdbParameterMap *>::const_iterator
it =
121 parametermap.begin();
122 it != parametermap.end(); ++
it)
125 container->AddPdbParameterMap(
it->first, myparm);
130 string floatformat = TBufferXML::GetFloatFormat();
131 TBufferXML::SetFloatFormat(
"%.17g");
132 container->Write(
"PdbParameterMapContainer");
135 TBufferXML::SetFloatFormat(floatformat.c_str());
136 cout <<
"sleeping 1 second to prevent duplicate inserttimes" << endl;