CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPCMonitorRaw.cc
Go to the documentation of this file.
3 
7 
9  rpcRawDataCountsTag_ = consumes<RPCRawDataCounts>(cfg.getParameter<edm::InputTag>("rpcRawDataCountsTag"));
10 
11  for (unsigned int i = 0; i < 10; i++)
13  std::vector<int> algos = cfg.getUntrackedParameter<std::vector<int> >("watchedErrors");
14  for (std::vector<int>::const_iterator it = algos.begin(); it != algos.end(); ++it) {
15  unsigned int ialgo = *it;
16  if (ialgo < 10)
17  theWatchedErrorHistoPos[ialgo] = 1; // real position initialisain is in begin job. here mark just switched on.
18  }
19 }
20 
21 RPCMonitorRaw::~RPCMonitorRaw() { LogTrace("") << "RPCMonitorRaw destructor"; }
22 
23 void RPCMonitorRaw::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
24  ibooker.cd();
25  ibooker.setCurrentFolder("RPC/LinkMonitor");
26 
27  me_t[0] = ibooker.book1D("recordType_790", RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(790));
28  me_t[1] = ibooker.book1D("recordType_791", RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(791));
29  me_t[2] = ibooker.book1D("recordType_792", RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(792));
30  for (int i = 0; i < 3; ++i)
31  me_t[i]->getTH1F()->SetStats(false);
32 
33  me_e[0] = ibooker.book1D("readoutErrors_790", RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(790));
34  me_e[1] = ibooker.book1D("readoutErrors_791", RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(791));
35  me_e[2] = ibooker.book1D("readoutErrors_792", RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(792));
36  for (int i = 0; i < 3; ++i)
37  me_e[i]->getTH1F()->SetStats(false);
38 
39  me_mapGoodEvents = ibooker.book2D("mapGoodRecords", "mapGoodRecords", 36, -0.5, 35.5, 3, 789.5, 792.5);
40  me_mapGoodEvents->getTH2F()->SetNdivisions(3, "y");
42  me_mapGoodEvents->getTH2F()->SetYTitle("fed");
43  me_mapGoodEvents->getTH2F()->SetStats(false);
44  me_mapBadEvents = ibooker.book2D("mapErrorRecords", "mapErrorRecords", 36, -0.5, 35.5, 3, 789.5, 792.5);
46  me_mapBadEvents->getTH2F()->SetYTitle("rmb");
47  me_mapBadEvents->getTH2F()->SetNdivisions(3, "y");
48  me_mapBadEvents->getTH2F()->SetStats(false);
49 
50  for (unsigned int i = 0; i <= 9; ++i) {
52  for (unsigned int fed = 790; fed <= 792; ++fed) {
54  MonitorElement* watched = ibooker.book2D(histo->GetName(), histo);
55  theWatchedErrorHistos[fed - 790].push_back(watched);
56  theWatchedErrorHistoPos[i] = theWatchedErrorHistos[fed - 790].size();
57  }
58  }
59  }
60 }
61 
64  ev.getByToken(rpcRawDataCountsTag_, rawCounts);
65  const RPCRawDataCounts& counts = *rawCounts.product();
66 
67  // record type
68  for (auto cnt : counts.theRecordTypes)
69  me_t[cnt.first.first - 790]->Fill(cnt.first.second, cnt.second);
70 
71  // good events topology
72  for (auto cnt : counts.theGoodEvents)
73  me_mapGoodEvents->Fill(cnt.first.second, cnt.first.first, cnt.second);
74 
75  // bad events topology
76  for (auto cnt : counts.theBadEvents)
77  me_mapBadEvents->Fill(cnt.first.second, cnt.first.first, cnt.second);
78 
79  // readout errors
80  for (auto cnt : counts.theReadoutErrors) {
81  rpcrawtodigi::ReadoutError error(cnt.first.second);
82  LinkBoardElectronicIndex ele = error.where();
84 
85  int fed = cnt.first.first;
86  me_e[fed - 790]->Fill(type, cnt.second);
87 
88  // in addition fill location map for selected errors
89  int idx = theWatchedErrorHistoPos[type] - 1;
90  if (idx >= 0) {
91  std::vector<MonitorElement*>& wh = theWatchedErrorHistos[fed - 790];
92  MonitorElement* me = wh[idx];
93  me->Fill(ele.dccInputChannelNum, ele.tbLinkInputNum, cnt.second);
94  }
95  }
96 }
void analyze(const edm::Event &, const edm::EventSetup &) override
LinkBoardElectronicIndex where() const
Definition: ReadoutError.cc:19
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::pair< int, int >, int > theReadoutErrors
tuple cfg
Definition: looper.py:296
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
MonitorElement * me_mapBadEvents
Definition: RPCMonitorRaw.h:27
bool ev
static TH1F * emptyReadoutErrorHisto(int fedId)
ReadoutErrorType type() const
Definition: ReadoutError.cc:14
#define LogTrace(id)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * me_mapGoodEvents
Definition: RPCMonitorRaw.h:26
edm::EDGetTokenT< RPCRawDataCounts > rpcRawDataCountsTag_
Definition: RPCMonitorRaw.h:38
void Fill(long long x)
std::map< std::pair< int, int >, int > theRecordTypes
MonitorElement * me_t[3]
Definition: RPCMonitorRaw.h:24
std::vector< MonitorElement * > theWatchedErrorHistos[3]
Definition: RPCMonitorRaw.h:30
static TH2F * emptyReadoutErrorMapHisto(int fedId, int type)
RPCMonitorRaw(const edm::ParameterSet &cfg)
Definition: RPCMonitorRaw.cc:8
~RPCMonitorRaw() override
unsigned int theWatchedErrorHistoPos[10]
Definition: RPCMonitorRaw.h:33
tuple algos
Definition: Puppi_cff.py:75
std::map< std::pair< int, int >, int > theGoodEvents
std::map< std::pair< int, int >, int > theBadEvents
T const * product() const
Definition: Handle.h:70
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:177
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static TH1F * emptyRecordTypeHisto(int fedId)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * me_e[3]
Definition: RPCMonitorRaw.h:25