CMS 3D CMS Logo

CSCMonitorModule.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: CSCMonitorModule.cc
5  *
6  * Description: CSC Monitor Module
7  *
8  * Version: 1.0
9  * Created: 11/13/2008 02:31:12 PM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
19 #include "CSCMonitorModule.h"
20 
26  : hcrateToken_(esConsumes<CSCCrateMap, CSCCrateMapRcd>()) {
28 
30  prebookEffParams = ps.getUntrackedParameter<bool>("PREBOOK_EFF_PARAMS", false);
31  processDcsScalers = ps.getUntrackedParameter<bool>("PROCESS_DCS_SCALERS", true);
33  config.load(params);
34 
35  fp = ps.getParameter<edm::FileInPath>("BOOKING_XML_FILE");
36  config.setBOOKING_XML_FILE(fp.fullPath());
37 
38  // dbe = edm::Service<DQMStore>().operator->();
39 
40 #ifdef DQMLOCAL
41  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this));
42 #endif
43 #ifdef DQMGLOBAL
44  // edm::ConsumesCollector coco( consumesCollector() );
45  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this), inputTag, consumesCollector());
46  dcstoken = consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi"));
47 
48 #endif
49 
50  dispatcher->init();
51 
52  if (ps.exists("MASKEDHW")) {
53  maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
54  //dispatcher->maskHWElements(maskedHW);
55  }
56 }
57 
62  if (dispatcher)
63  delete dispatcher;
64 }
65 
72 /*
73 void CSCMonitorModule::beginRun(const edm::Run& r, const edm::EventSetup& c) {
74 
75  if (prebookEffParams) {
76  dispatcher->updateFractionAndEfficiencyHistos();
77  }
78 
79 }
80 */
81 
88  // Get crate mapping from database
91  hcrate = c.getHandle(hcrateToken_);
92  pcrate = hcrate.product();
93 
94  cscdqm::HWStandbyType standby;
95 
96  // Get DCS status scalers
97  if (processDcsScalers) {
99 #ifdef DQMLOCAL
100  if (e.getByToken(dcstoken, dcsStatus)) {
101 #endif
102 #ifdef DQMGLOBAL
103  if (e.getByToken(dcstoken, dcsStatus)) {
104 #endif
105  DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
106  for (; dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
107  standby.applyMeP(dcsStatusItr->ready(DcsStatus::CSCp));
108  standby.applyMeM(dcsStatusItr->ready(DcsStatus::CSCm));
109  }
110  }
111  standby.process = true;
112  }
113 
114  dispatcher->processEvent(e, inputTag, standby);
115  }
116 
125  ibooker = &ib;
126 
135  dispatcher->book();
136 
137  if (!maskedHW.empty())
139  if (prebookEffParams) {
141  }
142  }
143 
150  cscdqm::MonitorObject* me = nullptr;
151  std::string name = req.hdef->getName();
152 
153  std::string path = req.folder;
154  if (!req.hdef->getPath().empty()) {
155  path = path + req.hdef->getPath() + "/";
156  }
157 
158  //std::cout << "Moving to " << path << " for name = " << name << " with fullPath = " << req.hdef->getFullPath() << "\n";
159 
160  //dbe->setCurrentFolder(path);
161  ibooker->cd();
163 
164  if (req.htype == cscdqm::INT) {
166  me->Fill(req.default_int);
167  } else if (req.htype == cscdqm::FLOAT) {
170  ibooker->cd();
172  } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
173  ibooker->cd();
175  } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
176  ibooker->cd();
178  } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
179  ibooker->cd();
181  }
183  me->Fill(req.default_float);
184  } else if (req.htype == cscdqm::STRING) {
186  } else if (req.htype == cscdqm::H1D) {
187  me = new CSCMonitorObject(ibooker->book1D(name, req.title, req.nchX, req.lowX, req.highX));
188  } else if (req.htype == cscdqm::H2D) {
190  ibooker->cd();
192  name = "reportSummaryMap";
193  }
194  me = new CSCMonitorObject(
195  ibooker->book2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY));
196  } else if (req.htype == cscdqm::H3D) {
198  name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ));
199  } else if (req.htype == cscdqm::PROFILE) {
201  name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.option.c_str()));
202  } else if (req.htype == cscdqm::PROFILE2D) {
204  req.title,
205  req.nchX,
206  req.lowX,
207  req.highX,
208  req.nchY,
209  req.lowY,
210  req.highY,
211  req.nchZ,
212  req.lowZ,
213  req.highZ,
214  req.option.c_str()));
215  }
216 
217  return me;
218  }
void init()
Initialize Dispatcher: book histograms, init processor, etc.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
const edm::ESGetToken< CSCCrateMap, CSCCrateMapRcd > hcrateToken_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
static const char DIR_DAQINFO[]
cscdqm::MonitorObject implementation used in CSCMonitorModuleCmn
CSCMonitorModule(const edm::ParameterSet &ps)
Constructor.
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
bool exists(std::string const &parameterName) const
checks if a parameter exists
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Book Histograms in the beginRun.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Begin the run.
cscdqm::Dispatcher * dispatcher
std::vector< std::string > maskedHW
Definition: config.py:1
static bool regexMatch(const std::string &expression, const std::string &message)
Match RegExp expression string against string message and return result.
CSCDQM Framework frontend and Histogram Cache controller.
const HistoId getId() const
Get Histogram ID.
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!
T getUntrackedParameter(std::string const &, T const &) const
T const * product() const
Definition: ESHandle.h:86
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
static const char DIR_DCSINFO[]
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const CSCCrateMap * pcrate
static const char INPUT_TAG_LABEL[]
Global stuff.
static const char DIR_EVENTINFO[]
edm::InputTag inputTag
virtual const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
static const char DIR_CRTINFO[]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
~CSCMonitorModule() override
Destructor.
DQMStore::IBooker * ibooker
cscdqm::MonitorObject * bookMonitorObject(const cscdqm::HistoBookRequest &p_req) override
Book Monitor Object on Request.
virtual const std::string getName() const
Get processed histogram name. It can include additional parameter in formated name. This Name is being constructed from raw name and additional parameter.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
Definition: DQMStore.h:367
static const HistoName keys[]
Definition: Run.h:45
ib
Definition: cuy.py:661