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 
27 
29  prebookEffParams = ps.getUntrackedParameter<bool>("PREBOOK_EFF_PARAMS", false);
30  processDcsScalers = ps.getUntrackedParameter<bool>("PROCESS_DCS_SCALERS", true);
32  config.load(params);
33 
34  fp = ps.getParameter<edm::FileInPath>("BOOKING_XML_FILE");
35  config.setBOOKING_XML_FILE(fp.fullPath());
36 
37  // dbe = edm::Service<DQMStore>().operator->();
38 
39 #ifdef DQMLOCAL
40  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this));
41 #endif
42 #ifdef DQMGLOBAL
43  // edm::ConsumesCollector coco( consumesCollector() );
44  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCMonitorModule*>(this), inputTag, consumesCollector());
45  dcstoken = consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi"));
46 
47 #endif
48 
49  dispatcher->init();
50 
51  if (ps.exists("MASKEDHW")) {
52  maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
53  //dispatcher->maskHWElements(maskedHW);
54  }
55 }
56 
61  if (dispatcher)
62  delete dispatcher;
63 }
64 
71 /*
72 void CSCMonitorModule::beginRun(const edm::Run& r, const edm::EventSetup& c) {
73 
74  if (prebookEffParams) {
75  dispatcher->updateFractionAndEfficiencyHistos();
76  }
77 
78 }
79 */
80 
87  // Get crate mapping from database
89  c.get<CSCCrateMapRcd>().get(hcrate);
90  pcrate = hcrate.product();
91 
92  cscdqm::HWStandbyType standby;
93 
94  // Get DCS status scalers
95  if (processDcsScalers) {
97 #ifdef DQMLOCAL
98  if (e.getByToken(dcstoken, dcsStatus)) {
99 #endif
100 #ifdef DQMGLOBAL
101  if (e.getByToken(dcstoken, dcsStatus)) {
102 #endif
103  DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
104  for (; dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
105  standby.applyMeP(dcsStatusItr->ready(DcsStatus::CSCp));
106  standby.applyMeM(dcsStatusItr->ready(DcsStatus::CSCm));
107  }
108  }
109  standby.process = true;
110  }
111 
112  dispatcher->processEvent(e, inputTag, standby);
113  }
114 
123  ibooker = &ib;
124 
133  dispatcher->book();
134 
135  if (!maskedHW.empty())
137  if (prebookEffParams) {
139  }
140  }
141 
148  cscdqm::MonitorObject* me = nullptr;
149  std::string name = req.hdef->getName();
150 
151  std::string path = req.folder;
152  if (!req.hdef->getPath().empty()) {
153  path = path + req.hdef->getPath() + "/";
154  }
155 
156  //std::cout << "Moving to " << path << " for name = " << name << " with fullPath = " << req.hdef->getFullPath() << "\n";
157 
158  //dbe->setCurrentFolder(path);
159  ibooker->cd();
160  ibooker->setCurrentFolder(path);
161 
162  if (req.htype == cscdqm::INT) {
163  me = new CSCMonitorObject(ibooker->bookInt(name));
164  me->Fill(req.default_int);
165  } else if (req.htype == cscdqm::FLOAT) {
168  ibooker->cd();
170  } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
171  ibooker->cd();
173  } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
174  ibooker->cd();
176  } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
177  ibooker->cd();
179  }
180  me = new CSCMonitorObject(ibooker->bookFloat(name));
181  me->Fill(req.default_float);
182  } else if (req.htype == cscdqm::STRING) {
183  me = new CSCMonitorObject(ibooker->bookString(name, req.default_string));
184  } else if (req.htype == cscdqm::H1D) {
185  me = new CSCMonitorObject(ibooker->book1D(name, req.title, req.nchX, req.lowX, req.highX));
186  } else if (req.htype == cscdqm::H2D) {
188  ibooker->cd();
190  name = "reportSummaryMap";
191  }
192  me = new CSCMonitorObject(
193  ibooker->book2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY));
194  } else if (req.htype == cscdqm::H3D) {
195  me = new CSCMonitorObject(ibooker->book3D(
196  name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ));
197  } else if (req.htype == cscdqm::PROFILE) {
199  name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.option.c_str()));
200  } else if (req.htype == cscdqm::PROFILE2D) {
201  me = new CSCMonitorObject(ibooker->bookProfile2D(name,
202  req.title,
203  req.nchX,
204  req.lowX,
205  req.highX,
206  req.nchY,
207  req.lowY,
208  req.highY,
209  req.nchZ,
210  req.lowZ,
211  req.highZ,
212  req.option.c_str()));
213  }
214 
215  return me;
216  }
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
void init()
Initialize Dispatcher: book histograms, init processor, etc.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookFloat(TString const &name)
Definition: DQMStore.cc:233
static const char DIR_DAQINFO[]
cscdqm::MonitorObject implementation used in CSCMonitorModuleCmn
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
CSCMonitorModule(const edm::ParameterSet &ps)
Constructor.
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
virtual void Fill(float x)=0
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
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.
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!
const HistoId getId() const
Get Histogram ID.
static const char DIR_DCSINFO[]
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:333
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)
Definition: DQMStore.cc:317
const CSCCrateMap * pcrate
static const char INPUT_TAG_LABEL[]
Global stuff.
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")
Definition: DQMStore.cc:381
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[]
~CSCMonitorModule() override
Destructor.
DQMStore::IBooker * ibooker
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
T get() const
Definition: EventSetup.h:73
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 * bookString(TString const &name, TString const &value)
Definition: DQMStore.cc:235
std::string fullPath() const
Definition: FileInPath.cc:163
cscdqm::MonitorObject * bookMonitorObject(const cscdqm::HistoBookRequest &p_req) override
Book Monitor Object on Request.
T const * product() const
Definition: ESHandle.h:86
static const HistoName keys[]
MonitorElement * bookInt(TString const &name)
Definition: DQMStore.cc:231
Definition: Run.h:45
ib
Definition: cuy.py:662