9 #include <boost/cstdint.hpp>
10 #include <boost/regex.hpp>
16 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::DQMHistoryServiceBase]";
21 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::~DQMHistoryServiceBase]";
25 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::initialize]";
35 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::checkForCompatibility]";
39 uint32_t previousRun=atoi(ss.substr(ss.find(
"Run ")+4).c_str());
41 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::checkForCompatibility] extracted string " << previousRun ;
54 std::vector<std::string> userDBContent;
55 typedef std::vector<edm::ParameterSet> VParameters;
57 VParameters::iterator ithistoList = histoList.begin();
58 VParameters::iterator ithistoListEnd = histoList.end();
60 for(; ithistoList != ithistoListEnd; ++ithistoList ) {
61 std::string keyName = ithistoList->getUntrackedParameter<std::string>(
"keyName");
62 std::vector<std::string> Quantities = ithistoList->getUntrackedParameter<std::vector<std::string> >(
"quantitiesToExtract");
63 for (
size_t i=0;
i<Quantities.size();++
i){
65 if ( Quantities[
i] ==
"landau" )
67 else if ( Quantities[
i] ==
"gauss" )
69 else if ( Quantities[
i] ==
"stat" )
78 ss <<
"[DQMHistoryServiceBase::scanTreeAndFillSummary] QUANTITIES TO BE INSERTED IN DB :" << std::endl;
80 for (
size_t i=0;
i<userDBContentA.size();++
i){
81 ss << userDBContentA[
i]<< std::endl;
90 edm::LogInfo(
"HDQMSummary") <<
"\nSTARTING TO FILL OBJECT " << std::endl;
91 ithistoList = histoList.begin();
92 for(; ithistoList != ithistoListEnd; ++ithistoList ) {
93 std::string keyName = ithistoList->getUntrackedParameter<std::string>(
"keyName");
94 std::vector<std::string> Quantities = ithistoList->getUntrackedParameter<std::vector<std::string> >(
"quantitiesToExtract");
107 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::openRequestedFile] Accessing root File" <<
fileName;
111 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::openRequestedFile] Accessing dqmStore stream in Online Operation";
122 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::scanTreeAndFillSummary] keyName " << keyName;
124 std::vector<MonitorElement*>::const_iterator iterMes = MEs.begin();
125 std::vector<MonitorElement*>::const_iterator iterMesEnd = MEs.end();
126 std::stringstream ss;
133 catch( boost::regex_error&
e ) {
134 std::cout <<
"Error: " << keyName <<
" is not a valid regular expression: \""
135 << e.what() <<
"\"" << std::endl;
136 std::cout <<
"Skip search for matches" << std::endl;
139 for (; iterMes!=iterMesEnd; ++iterMes){
143 me_name = (*iterMes)->getFullname();
146 me_name = (*iterMes)->getName();
148 if( me_name.find(
"^") != 0 ) {
149 me_name =
"^" + me_name;
153 if( boost::regex_search(me_name, re) ) {
156 std::vector<std::string> userDBContent;
158 ss <<
"\nFound compatible ME " << me_name <<
" for key " << keyName << std::endl;
160 for(
size_t i=0;
i<Quantities.size();++
i) {
162 if(Quantities[
i] ==
"landau"){
166 else if(Quantities[
i] ==
"gauss"){
170 else if(Quantities[
i] ==
"stat"){
181 ss <<
"detid " << detid <<
" \n";
182 for(
size_t i=0;
i<values.size();++
i)
183 ss <<
"Quantity " << userDBContent[
i] <<
" value " << values[
i] << std::endl;
185 summary->
put(detid,values,userDBContent);
188 edm::LogInfo(
"DQMHistoryServiceBase") <<
"[DQMHistoryServiceBase::scanTreeAndFillSummary] " << ss.str();
193 userDBContent.push_back(keyName+
fSep+std::string(
"landauPeak"));
194 userDBContent.push_back(keyName+
fSep+std::string(
"landauPeakErr"));
195 userDBContent.push_back(keyName+
fSep+std::string(
"landauSFWHM"));
196 userDBContent.push_back(keyName+
fSep+std::string(
"landauChi2NDF"));
201 userDBContent.push_back(keyName+
fSep+std::string(
"gaussMean"));
202 userDBContent.push_back(keyName+
fSep+std::string(
"gaussSigma"));
203 userDBContent.push_back(keyName+
fSep+std::string(
"gaussChi2NDF"));
207 userDBContent.push_back(keyName+
fSep+std::string(
"entries"));
208 userDBContent.push_back(keyName+
fSep+std::string(
"mean"));
209 userDBContent.push_back(keyName+
fSep+std::string(
"rms"));
219 else values.push_back(-99.);
228 else values.push_back(-99.);
233 values.push_back( (*iterMes)->getEntries());
234 values.push_back( (*iterMes)->getMean());
235 values.push_back( (*iterMes)->getRMS());
virtual bool setDBValuesForGauss(std::vector< MonitorElement * >::const_iterator iterMes, HDQMSummary::InputVector &values)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual uint32_t getRunNumber() const
virtual void createSummary()
virtual ~DQMHistoryServiceBase()
void setRunNr(int inputRunNr)
double getLanGaussParErr(std::string s)
bool put(const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
virtual bool checkForCompatibility(std::string ss)
double doGaussFit(MonitorElement *ME)
double getLanGaussConv(std::string s)
virtual void openRequestedFile()
std::vector< MonitorElement * > getAllContents(const std::string &path) const
virtual bool setDBValuesForUser(std::vector< MonitorElement * >::const_iterator iterMes, HDQMSummary::InputVector &values, std::string &quantity)
std::vector< float > InputVector
DQMHistoryServiceBase(const edm::ParameterSet &, const edm::ActivityRegistry &)
virtual bool setDBLabelsForStat(std::string &keyName, std::vector< std::string > &userDBContent)
void setUserDBContent(std::vector< std::string > userDBContent)
double getLanGaussPar(std::string s)
double getGaussPar(std::string s)
edm::ParameterSet iConfig_
virtual uint32_t returnDetComponent(const MonitorElement *MEs)
virtual bool setDBLabelsForGauss(std::string &keyName, std::vector< std::string > &userDBContent)
virtual void initialize()
virtual bool setDBLabelsForUser(std::string &keyName, std::vector< std::string > &userDBContent, std::string &quantity)
virtual void setSeparator(std::string const &)
virtual bool setDBLabelsForLandau(std::string &keyName, std::vector< std::string > &userDBContent)
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
virtual void scanTreeAndFillSummary(const std::vector< MonitorElement * > &MEs, HDQMSummary *summary, std::string &histoName, std::vector< std::string > &Quantities)
virtual bool setDBValuesForLandau(std::vector< MonitorElement * >::const_iterator iterMes, HDQMSummary::InputVector &values)
std::vector< std::string > getUserDBContent() const
double doLanGaussFit(MonitorElement *ME)
virtual bool setDBValuesForStat(std::vector< MonitorElement * >::const_iterator iterMes, HDQMSummary::InputVector &values)