CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
27  edm::FileInPath fp;
28 
30  prebookEffParams = ps.getUntrackedParameter<bool>("PREBOOK_EFF_PARAMS", false);
31  processDcsScalers = ps.getUntrackedParameter<bool>("PROCESS_DCS_SCALERS", true);
32  edm::ParameterSet params = ps.getUntrackedParameter<edm::ParameterSet>("EventProcessor");
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),
47  dcstoken = consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi") );
48 
49 #endif
50 
51  dispatcher->init();
52 
53  if (ps.exists("MASKEDHW")) {
54  maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
55  //dispatcher->maskHWElements(maskedHW);
56  }
57 
58 }
59 
64  if (dispatcher) delete dispatcher;
65 }
66 
73 /*
74 void CSCMonitorModule::beginRun(const edm::Run& r, const edm::EventSetup& c) {
75 
76  if (prebookEffParams) {
77  dispatcher->updateFractionAndEfficiencyHistos();
78  }
79 
80 }
81 */
82 
89 
90  // Get crate mapping from database
92  c.get<CSCCrateMapRcd>().get(hcrate);
93  pcrate = hcrate.product();
94 
95  cscdqm::HWStandbyType standby;
96 
97  // Get DCS status scalers
98  if (processDcsScalers) {
100 #ifdef DQMLOCAL
101  if (e.getByToken(dcstoken, dcsStatus)) {
102 #endif
103 #ifdef DQMGLOBAL
104  if (e.getByToken(dcstoken, dcsStatus) ) {
105 #endif
106  DcsStatusCollection::const_iterator dcsStatusItr = dcsStatus->begin();
107  for (; dcsStatusItr != dcsStatus->end(); ++dcsStatusItr) {
108  standby.applyMeP(dcsStatusItr->ready(DcsStatus::CSCp));
109  standby.applyMeM(dcsStatusItr->ready(DcsStatus::CSCm));
110  }
111  }
112  standby.process = true;
113  }
114 
115  dispatcher->processEvent(e, inputTag, standby);
116 
117 }
118 
126 {
128  ibooker = &ib;
129 
138  dispatcher->book();
139 
140  if (maskedHW.size() != 0)
142  if (prebookEffParams) {
144  }
145 
146 }
147 
148 
155 
157  std::string name = req.hdef->getName();
158 
159  std::string path = req.folder;
160  if (req.hdef->getPath().size() > 0) {
161  path = path + req.hdef->getPath() + "/";
162  }
163 
164  //std::cout << "Moving to " << path << " for name = " << name << " with fullPath = " << req.hdef->getFullPath() << "\n";
165 
166  //dbe->setCurrentFolder(path);
167  ibooker->cd();
168  ibooker->setCurrentFolder(path);
169 
170  if (req.htype == cscdqm::INT) {
171  me = new CSCMonitorObject(ibooker->bookInt(name));
172  me->Fill(req.default_int);
173  } else
174  if (req.htype == cscdqm::FLOAT) {
175  if (req.hdef->getId() == cscdqm::h::PAR_REPORT_SUMMARY ||
179  ibooker->cd();
181  } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
182  ibooker->cd();
184  } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
185  ibooker->cd();
187  } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
188  ibooker->cd();
190  }
191  me = new CSCMonitorObject(ibooker->bookFloat(name));
192  me->Fill(req.default_float);
193  } else
194  if (req.htype == cscdqm::STRING) {
195  me = new CSCMonitorObject(ibooker->bookString(name, req.default_string));
196  } else
197  if (req.htype == cscdqm::H1D) {
198  me = new CSCMonitorObject(ibooker->book1D(name, req.title, req.nchX, req.lowX, req.highX));
199  } else
200  if (req.htype == cscdqm::H2D) {
202  ibooker->cd();
204  name = "reportSummaryMap";
205  }
206  me = new CSCMonitorObject(ibooker->book2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY));
207  } else
208  if (req.htype == cscdqm::H3D) {
209  me = new CSCMonitorObject(ibooker->book3D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ));
210  } else
211  if (req.htype == cscdqm::PROFILE) {
212  me = new CSCMonitorObject(ibooker->bookProfile(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.option.c_str()));
213  } else
214  if (req.htype == cscdqm::PROFILE2D) {
215  me = new CSCMonitorObject(ibooker->bookProfile2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ, req.option.c_str()));
216  }
217 
218  return me;
219 
220 }
221 
cscdqm::Configuration config
void init()
Initialize Dispatcher: book histograms, init processor, etc.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int ib
Definition: cuy.py:660
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
static const char DIR_DAQINFO[]
cscdqm::MonitorObject implementation used in CSCMonitorModuleCmn
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
CSCMonitorModule(const edm::ParameterSet &ps)
Constructor.
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
void cd(void)
Definition: DQMStore.cc:266
virtual void Fill(float x)=0
Monitoring Object interface used to cover Root object and provide common interface to EventProcessor ...
virtual ~CSCMonitorModule()
Destructor.
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:103
bool exists(std::string const &parameterName) const
checks if a parameter exists
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:97
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Book Histograms in the beginRun.
#define NULL
Definition: scimark2.h:8
cscdqm::Dispatcher * dispatcher
std::vector< std::string > maskedHW
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!
void analyze(const edm::Event &e, const edm::EventSetup &c)
Begin the run.
tuple path
else: Piece not in the list, fine.
const HistoId getId() const
Get Histogram ID.
cscdqm::MonitorObject * bookMonitorObject(const cscdqm::HistoBookRequest &p_req)
Book Monitor Object on Request.
static const char DIR_DCSINFO[]
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:163
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
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)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
static const char DIR_CRTINFO[]
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
DQMStore::IBooker * ibooker
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 * bookFloat(Args &&...args)
Definition: DQMStore.h:109
std::string fullPath() const
Definition: FileInPath.cc:165
MonitorElement * book3D(Args &&...args)
Definition: DQMStore.h:151
static const HistoName keys[]
Definition: Run.h:41