8 #include <TBufferXML.h>
23 while(parametermap.begin() != parametermap.end())
25 delete parametermap.begin()->second;
26 parametermap.erase(parametermap.begin());
34 for (map<int, PdbParameterMap *>::const_iterator iter = parametermap.begin();
35 iter != parametermap.end(); ++iter)
37 cout <<
"layer " << iter->first << endl;
38 iter->second->print();
44 while(parametermap.begin() != parametermap.end())
46 delete parametermap.begin()->second;
47 parametermap.erase(parametermap.begin());
55 if (parametermap.find(layer) != parametermap.end())
57 cout <<
PHWHERE <<
" layer " << layer <<
" already exists" << endl;
60 parametermap[layer] = params;
66 map<int, PdbParameterMap *>::const_iterator iter = parametermap.find(layer);
67 if (iter == parametermap.end())
77 map<int, PdbParameterMap *>::iterator iter = parametermap.find(layer);
78 if (iter == parametermap.end())
87 const string &extension,
const string &dir)
91 ostringstream fullpath;
92 ostringstream fnamestream;
98 if (*(dir.rbegin()) !=
'/')
102 fnamestream << detector_name <<
"_geoparams" <<
"-"
104 << TStop.
getTics() <<
"-" << time(0) <<
"." << extension;
105 string fname = fnamestream.str();
106 std::transform(fname.begin(), fname.end(), fname.begin(), ::tolower);
109 cout <<
"PdbParameterMapContainer::WriteToFile - save to " << fullpath.str()
112 TFile *f = TFile::Open(fullpath.str().c_str(),
"recreate");
115 for (std::map<int, PdbParameterMap *>::const_iterator it =
116 parametermap.begin(); it != parametermap.end(); ++it)
124 string floatformat = TBufferXML::GetFloatFormat();
125 TBufferXML::SetFloatFormat(
"%.17g");
126 container->Write(
"PdbParameterMapContainer");
129 TBufferXML::SetFloatFormat(floatformat.c_str());
130 cout <<
"sleeping 1 second to prevent duplicate inserttimes" << endl;
int getInternalValue() const
void AddPdbParameterMap(const int layer, PdbParameterMap *params)
PdbParameterMap * GetParametersToModify(const int layer)
int WriteToFile(const std::string &detector_name, const std::string &extension, const std::string &dir=".")
write PdbParameterMapContainer to an external file with root or xml extension.
const PdbParameterMap * GetParameters(const int layer) const
virtual ~PdbParameterMapContainer()