CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCOfflineClient.cc
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: CSCOfflineClient.cc
5  *
6  * Description: CSC Offline Client
7  *
8  * Version: 1.0
9  * Created: 08/20/2009 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 "CSCOfflineClient.h"
20 
26 
27  edm::ParameterSet params = ps.getUntrackedParameter<edm::ParameterSet>("EventProcessor");
28  config.load(params);
29 
30  dispatcher = new cscdqm::Dispatcher(&config, const_cast<CSCOfflineClient*>(this));
31  dispatcher->init();
32 
33  if (ps.exists("MASKEDHW")) {
34  maskedHW = ps.getUntrackedParameter<std::vector<std::string> >("MASKEDHW");
35  // dispatcher->maskHWElements(maskedHW);
36  }
37 
38 }
39 
44  if (dispatcher) delete dispatcher;
45 }
46 
47 /*** No longer triggered for DQMEDHarvester ***/
48 /*
49 void CSCOfflineClient::endRun(const edm::Run& r, const edm::EventSetup& c) {
50 
51  // *
52  // * Putting histograms to internal cache: EMU stuff
53  // * /
54  dbe->setCurrentFolder(config.getFOLDER_EMU());
55  std::vector<std::string> me_names = dbe->getMEs();
56  for (std::vector<std::string>::iterator iter = me_names.begin(); iter != me_names.end(); iter++) {
57  std::string me_name = *iter;
58  MonitorElement* me = dbe->get(config.getFOLDER_EMU() + me_name);
59  cscdqm::HistoId id;
60  if (me && cscdqm::HistoDef::getHistoIdByName(me_name, id)) {
61  const cscdqm::EMUHistoDef def(id);
62  cscdqm::MonitorObject* mo = new CSCMonitorObject(me);
63  config.fnPutHisto(def, mo);
64  }
65  }
66 
67  // *
68  // * Putting histograms to internal cache: EventInfo
69  // * /
70 
71  {
72  std::string name = DIR_EVENTINFO;
73  name += "reportSummaryMap";
74  MonitorElement* me = dbe->get(name);
75  if (me) {
76  const cscdqm::EMUHistoDef def(cscdqm::h::EMU_CSC_STATS_SUMMARY);
77  cscdqm::MonitorObject* mo = new CSCMonitorObject(me);
78  config.fnPutHisto(def, mo);
79  }
80  }
81 
82  config.incNEvents();
83  dispatcher->updateFractionAndEfficiencyHistos();
84 
85 }
86 */
87 
88 // void CSCOfflineClient::bookHistograms(DQMStore::IBooker & ib, edm::Run const &, edm::EventSetup const &)
90 {
91  ibooker = &ib;
92  dispatcher->book();
93  if (maskedHW.size() != 0)
95 
96 
97  /*
98  * Putting histograms to internal cache: EMU stuff
99  */
100  ibooker->setCurrentFolder(config.getFOLDER_EMU());
101  std::vector<std::string> me_names = igetter.getMEs();
102  for (std::vector<std::string>::iterator iter = me_names.begin(); iter != me_names.end(); iter++) {
103  std::string me_name = *iter;
104  MonitorElement* me = igetter.get(config.getFOLDER_EMU() + me_name);
105  cscdqm::HistoId id;
106  if (me && cscdqm::HistoDef::getHistoIdByName(me_name, id)) {
107  const cscdqm::EMUHistoDef def(id);
109  config.fnPutHisto(def, mo);
110  }
111  }
112 
113  /*
114  * Putting histograms to internal cache: EventInfo
115  */
116 
117  {
119  name += "reportSummaryMap";
120  MonitorElement* me = igetter.get(name);
121  if (me) {
124  config.fnPutHisto(def, mo);
125  }
126  }
127 
128  config.incNEvents();
130 
131 }
132 
139 
141  std::string name = req.hdef->getName();
142 
143  std::string path = req.folder;
144  if (req.hdef->getPath().size() > 0) {
145  path = path + req.hdef->getPath() + "/";
146  }
147 
148  ibooker->cd();
149  ibooker->setCurrentFolder(path);
150 
151  if (req.htype == cscdqm::INT) {
152  me = new CSCMonitorObject(ibooker->bookInt(name));
153  me->Fill(req.default_int);
154  } else
155  if (req.htype == cscdqm::FLOAT) {
156  if (req.hdef->getId() == cscdqm::h::PAR_REPORT_SUMMARY) {
157  ibooker->cd();
159  } else if (cscdqm::Utility::regexMatch("^PAR_DCS_", cscdqm::h::keys[req.hdef->getId()])) {
160  ibooker->cd();
162  } else if (cscdqm::Utility::regexMatch("^PAR_DAQ_", cscdqm::h::keys[req.hdef->getId()])) {
163  ibooker->cd();
165  } else if (cscdqm::Utility::regexMatch("^PAR_CRT_", cscdqm::h::keys[req.hdef->getId()])) {
166  ibooker->cd();
168  }
169  me = new CSCMonitorObject(ibooker->bookFloat(name));
170  me->Fill(req.default_float);
171  } else
172  if (req.htype == cscdqm::STRING) {
173  me = new CSCMonitorObject(ibooker->bookString(name, req.default_string));
174  }
175 
176  return me;
177 
178 }
void init()
Initialize Dispatcher: book histograms, init processor, etc.
static const bool getHistoIdByName(const std::string &p_name, HistoId &p_id)
Get Histogram ID by name.
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
int ib
Definition: cuy.py:660
static const char DIR_DAQINFO[]
cscdqm::MonitorObject implementation used in CSCMonitorModuleCmn
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 ...
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:291
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:101
bool exists(std::string const &parameterName) const
checks if a parameter exists
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:95
DQMStore::IBooker * ibooker
#define NULL
Definition: scimark2.h:8
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!
virtual ~CSCOfflineClient()
Destructor.
unsigned int HistoId
tuple path
else: Piece not in the list, fine.
const HistoId getId() const
Get Histogram ID.
cscdqm::Dispatcher * dispatcher
static const char DIR_DCSINFO[]
EMU Level Histogram Definition.
static const char DIR_EVENTINFO[]
std::vector< std::string > getMEs(void)
Definition: DQMStore.cc:299
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
static const char DIR_CRTINFO[]
cscdqm::Configuration config
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
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.
CSCOfflineClient(const edm::ParameterSet &ps)
Constructor.
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:107
JetCorrectorParameters::Definitions def
Definition: classes.h:6
static const HistoName keys[]
std::vector< std::string > maskedHW
cscdqm::MonitorObject * bookMonitorObject(const cscdqm::HistoBookRequest &p_req)
Book Monitor Object on Request.