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 
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  std::vector<std::string> 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  if (prebookEffParams) {
76  }
77 
78 }
79 
86 
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.getByLabel("scalersRawToDigi", 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 }
115 
122 
124  std::string name = req.hdef->getName();
125 
126  std::string path = req.folder;
127  if (req.hdef->getPath().size() > 0) {
128  path = path + req.hdef->getPath() + "/";
129  }
130 
131  //std::cout << "Moving to " << path << " for name = " << name << " with fullPath = " << req.hdef->getFullPath() << "\n";
132 
133  dbe->setCurrentFolder(path);
134 
135  if (req.htype == cscdqm::INT) {
136  me = new CSCMonitorObject(dbe->bookInt(name));
137  me->Fill(req.default_int);
138  } else
139  if (req.htype == cscdqm::FLOAT) {
140  if (req.hdef->getId() == cscdqm::h::PAR_REPORT_SUMMARY ||
141  req.hdef->getId() == cscdqm::h::PAR_CRT_SUMMARY ||
142  req.hdef->getId() == cscdqm::h::PAR_DAQ_SUMMARY ||
143  req.hdef->getId() == cscdqm::h::PAR_DCS_SUMMARY) {
145  } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
147  } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
149  } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
151  }
152  me = new CSCMonitorObject(dbe->bookFloat(name));
153  me->Fill(req.default_float);
154  } else
155  if (req.htype == cscdqm::STRING) {
156  me = new CSCMonitorObject(dbe->bookString(name, req.default_string));
157  } else
158  if (req.htype == cscdqm::H1D) {
159  me = new CSCMonitorObject(dbe->book1D(name, req.title, req.nchX, req.lowX, req.highX));
160  } else
161  if (req.htype == cscdqm::H2D) {
162  if (req.hdef->getId() == cscdqm::h::EMU_CSC_STATS_SUMMARY) {
164  name = "reportSummaryMap";
165  }
166  me = new CSCMonitorObject(dbe->book2D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY));
167  } else
168  if (req.htype == cscdqm::H3D) {
169  me = new CSCMonitorObject(dbe->book3D(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.nchZ, req.lowZ, req.highZ));
170  } else
171  if (req.htype == cscdqm::PROFILE) {
172  me = new CSCMonitorObject(dbe->bookProfile(name, req.title, req.nchX, req.lowX, req.highX, req.nchY, req.lowY, req.highY, req.option.c_str()));
173  } else
174  if (req.htype == cscdqm::PROFILE2D) {
175  me = new CSCMonitorObject(dbe->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()));
176  }
177 
178  return me;
179 
180 }
181 
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
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
static const char DIR_DAQINFO[]
cscdqm::MonitorObject implementation used in CSCMonitorModuleCmn
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
CSCMonitorModule(const edm::ParameterSet &ps)
Constructor.
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:1134
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 ...
virtual ~CSCMonitorModule()
Destructor.
bool exists(std::string const &parameterName) const
checks if a parameter exists
#define NULL
Definition: scimark2.h:8
cscdqm::Dispatcher * dispatcher
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.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
Begin the run.
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:809
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)
Analyze Event.
const HistoId getId() const
Get Histogram ID.
cscdqm::MonitorObject * bookMonitorObject(const cscdqm::HistoBookRequest &p_req)
Book Monitor Object on Request.
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:838
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.
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1186
static const char DIR_EVENTINFO[]
edm::InputTag inputTag
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
virtual const std::string getPath() const
Get path part of the histogram (used only for DDUs and CSCs)
static const char DIR_CRTINFO[]
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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.
std::string fullPath() const
Definition: FileInPath.cc:171
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:779
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
static const HistoName keys[]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1330