CMS 3D CMS Logo

GenericPopConHistoryDQM.cc
Go to the documentation of this file.
2 
8 public:
9  explicit GenericHistoryDQM(const edm::ParameterSet& iConfig)
11  , m_detectorID{iConfig.getParameter<uint32_t>("DetectorId")}
12  {}
13 
14  ~GenericHistoryDQM() override;
15 private:
16  //Methods to be specified by each subdet
17  uint32_t returnDetComponent(const MonitorElement* ME) const override;
18  bool setDBLabelsForUser (const std::string& keyName, std::vector<std::string>& userDBContent, const std::string& quantity ) const override;
19  bool setDBValuesForUser(const MonitorElement* me, HDQMSummary::InputVector& values, const std::string& quantity ) const override;
20 
21  uint32_t m_detectorID;
22 };
23 
25 
27 {
28  LogTrace("GenericHistoryDQM") << "[GenericHistoryDQM::returnDetComponent] returning value defined in the configuration Pset \"DetectorId\"";
29  return m_detectorID;
30 }
31 
33 bool GenericHistoryDQM::setDBLabelsForUser(const std::string& keyName, std::vector<std::string>& userDBContent, const std::string& quantity ) const
34 {
35  if(quantity=="userExample_XMax"){
36  userDBContent.push_back(keyName+std::string("@")+std::string("userExample_XMax"));
37  }
38  else if(quantity=="userExample_mean"){
39  userDBContent.push_back(keyName+std::string("@")+std::string("userExample_mean"));
40  }
41  else{
42  edm::LogError("DQMHistoryServiceBase")
43  << "Quantity " << quantity
44  << " cannot be handled\nAllowed quantities are"
45  << "\n 'stat' that includes: entries, mean, rms"
46  << "\n 'landau' that includes: landauPeak, landauPeakErr, landauSFWHM, landauChi2NDF"
47  << "\n 'gauss' that includes: gaussMean, gaussSigma, gaussChi2NDF"
48  << "\n or a specific user quantity that should be implemented in the user functions GenericHistoryDQM::setDBLabelsForUser"
49  << std::endl;
50  return false;
51  }
52  return true;
53 }
54 
56 {
57  if(quantity=="userExample_XMax"){
58  values.push_back( me->getTH1F()->GetXaxis()->GetBinCenter(me->getTH1F()->GetMaximumBin()));
59  }
60  else if(quantity=="userExample_mean"){
61  values.push_back( me->getMean() );
62  }
63  else{
64  return false;
65  }
66  return true;
67 }
68 
T getParameter(std::string const &) const
TH1F * getTH1F() const
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
bool setDBLabelsForUser(const std::string &keyName, std::vector< std::string > &userDBContent, const std::string &quantity) const override
Example on how to define an user function for the statistic extraction.
GenericHistoryDQM(const edm::ParameterSet &iConfig)
Definition: ME.h:11
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< float > InputVector
Definition: HDQMSummary.h:62
bool setDBValuesForUser(const MonitorElement *me, HDQMSummary::InputVector &values, const std::string &quantity) const override
#define LogTrace(id)
uint32_t returnDetComponent(const MonitorElement *ME) const override