CMS 3D CMS Logo

RPCMonitorRaw.cc
Go to the documentation of this file.
2 
6 
10 
12 
15 
16 #include "TH1F.h"
17 #include "TH2F.h"
18 #include "TFile.h"
19 
20 #include <fstream>
21 #include <iostream>
22 #include <iomanip>
23 #include <bitset>
24 
25 typedef std::map<std::pair<int, int>, int>::const_iterator IT;
26 
28  rpcRawDataCountsTag_ = consumes<RPCRawDataCounts>(cfg.getParameter<edm::InputTag>("rpcRawDataCountsTag"));
29 
30  for (unsigned int i = 0; i < 10; i++)
32  std::vector<int> algos = cfg.getUntrackedParameter<std::vector<int> >("watchedErrors");
33  for (std::vector<int>::const_iterator it = algos.begin(); it != algos.end(); ++it) {
34  unsigned int ialgo = *it;
35  if (ialgo < 10)
36  theWatchedErrorHistoPos[ialgo] = 1; // real position initialisain is in begin job. here mark just switched on.
37  }
38 }
39 
40 RPCMonitorRaw::~RPCMonitorRaw() { LogTrace("") << "RPCMonitorRaw destructor"; }
41 
42 void RPCMonitorRaw::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
43  ibooker.cd();
44  ibooker.setCurrentFolder("RPC/LinkMonitor");
45 
46  me_t[0] = ibooker.book1D("recordType_790", RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(790));
47  me_t[1] = ibooker.book1D("recordType_791", RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(791));
48  me_t[2] = ibooker.book1D("recordType_792", RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(792));
49  for (int i = 0; i < 3; ++i)
50  me_t[i]->getTH1F()->SetStats(false);
51 
52  me_e[0] = ibooker.book1D("readoutErrors_790", RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(790));
53  me_e[1] = ibooker.book1D("readoutErrors_791", RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(791));
54  me_e[2] = ibooker.book1D("readoutErrors_792", RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(792));
55  for (int i = 0; i < 3; ++i)
56  me_e[i]->getTH1F()->SetStats(false);
57 
58  me_mapGoodEvents = ibooker.book2D("mapGoodRecords", "mapGoodRecords", 36, -0.5, 35.5, 3, 789.5, 792.5);
59  me_mapGoodEvents->getTH2F()->SetNdivisions(3, "y");
61  me_mapGoodEvents->getTH2F()->SetYTitle("fed");
62  me_mapGoodEvents->getTH2F()->SetStats(false);
63  me_mapBadEvents = ibooker.book2D("mapErrorRecords", "mapErrorRecords", 36, -0.5, 35.5, 3, 789.5, 792.5);
65  me_mapBadEvents->getTH2F()->SetYTitle("rmb");
66  me_mapBadEvents->getTH2F()->SetNdivisions(3, "y");
67  me_mapBadEvents->getTH2F()->SetStats(false);
68 
69  for (unsigned int i = 0; i <= 9; ++i) {
71  for (unsigned int fed = 790; fed <= 792; ++fed) {
73  MonitorElement* watched = ibooker.book2D(histo->GetName(), histo);
74  theWatchedErrorHistos[fed - 790].push_back(watched);
75  theWatchedErrorHistoPos[i] = theWatchedErrorHistos[fed - 790].size();
76  }
77  }
78  }
79 }
80 
83  ev.getByToken(rpcRawDataCountsTag_, rawCounts);
84  const RPCRawDataCounts& counts = *rawCounts.product();
85 
86  //
87  // record type
88  //
89  for (IT it = counts.theRecordTypes.begin(); it != counts.theRecordTypes.end(); ++it)
90  me_t[it->first.first - 790]->Fill(it->first.second, it->second);
91 
92  //
93  // good events topology
94  //
95  for (IT it = counts.theGoodEvents.begin(); it != counts.theGoodEvents.end(); ++it)
96  me_mapGoodEvents->Fill(it->first.second, it->first.first, it->second);
97 
98  //
99  // bad events topology
100  //
101  for (IT it = counts.theBadEvents.begin(); it != counts.theBadEvents.end(); ++it)
102  me_mapBadEvents->Fill(it->first.second, it->first.first, it->second);
103 
104  //
105  // readout errors
106  //
107  for (IT it = counts.theReadoutErrors.begin(); it != counts.theReadoutErrors.end(); ++it) {
108  rpcrawtodigi::ReadoutError error(it->first.second);
109  LinkBoardElectronicIndex ele = error.where();
111 
112  int fed = it->first.first;
113  me_e[fed - 790]->Fill(type, it->second);
114 
115  //
116  // in addition fill location map for selected errors
117  //
118  int idx = theWatchedErrorHistoPos[type] - 1;
119  if (idx >= 0) {
120  std::vector<MonitorElement*>& wh = theWatchedErrorHistos[fed - 790];
121  MonitorElement* me = wh[idx];
122  me->Fill(ele.dccInputChannelNum, ele.tbLinkInputNum, it->second);
123  }
124  }
125 
126  // for (int i=0; i<3; ++i) {
127  // me_t[i]->update();
128  // me_e[i]->update();
129  // std::vector<MonitorElement* > & wh = theWatchedErrorHistos[i];
130  // for (std::vector<MonitorElement* >::iterator it=wh.begin(); it != wh.end(); ++it) (*it)->update();
131  // }
132  // me_mapGoodEvents->update();
133  // me_mapBadEvents->update();
134 }
RPCMonitorRaw::~RPCMonitorRaw
~RPCMonitorRaw() override
Definition: RPCMonitorRaw.cc:40
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
Handle.h
rpcrawtodigi::ReadoutError::ReadoutErrorType
ReadoutErrorType
Definition: ReadoutError.h:10
mps_fire.i
i
Definition: mps_fire.py:355
RPCMonitorRaw::theWatchedErrorHistoPos
unsigned int theWatchedErrorHistoPos[10]
Definition: RPCMonitorRaw.h:40
RPCRawDataCountsHistoMaker::emptyRecordTypeHisto
static TH1F * emptyRecordTypeHisto(int fedId)
Definition: RPCRawDataCountsHistoMaker.cc:23
MessageLogger.h
RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto
static TH1F * emptyReadoutErrorHisto(int fedId)
Definition: RPCRawDataCountsHistoMaker.cc:12
edm::Handle::product
T const * product() const
Definition: Handle.h:70
RPCRawDataCounts
Definition: RPCRawDataCounts.h:15
edm::Run
Definition: Run.h:45
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
DQMStore.h
rpcrawtodigi::ReadoutError
Definition: ReadoutError.h:8
RPCMonitorRaw::RPCMonitorRaw
RPCMonitorRaw(const edm::ParameterSet &cfg)
Definition: RPCMonitorRaw.cc:27
edm::Handle
Definition: AssociativeIterator.h:50
training_settings.idx
idx
Definition: training_settings.py:16
relativeConstraints.error
error
Definition: relativeConstraints.py:53
RPCMonitorRaw::me_e
MonitorElement * me_e[3]
Definition: RPCMonitorRaw.h:32
dqm::impl::MonitorElement::getTH2F
virtual TH2F * getTH2F()
Definition: MonitorElement.cc:992
LinkBoardElectronicIndex::dccInputChannelNum
int dccInputChannelNum
Definition: LinkBoardElectronicIndex.h:12
jets_cff.algos
algos
Definition: jets_cff.py:644
RPCRawDataCountsHistoMaker.h
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
RPCMonitorRaw::me_mapBadEvents
MonitorElement * me_mapBadEvents
Definition: RPCMonitorRaw.h:34
RPCMonitorRaw::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: RPCMonitorRaw.cc:42
LinkBoardElectronicIndex::tbLinkInputNum
int tbLinkInputNum
Definition: LinkBoardElectronicIndex.h:13
ReadoutError.h
edm::ParameterSet
Definition: ParameterSet.h:36
RPCMonitorRaw.h
Event.h
IT
std::map< std::pair< int, int >, int >::const_iterator IT
Definition: RPCMonitorRaw.cc:25
RPCRawDataCountsHistoMaker::emptyReadoutErrorMapHisto
static TH2F * emptyReadoutErrorMapHisto(int fedId, int type)
Definition: RPCRawDataCountsHistoMaker.cc:35
edm::EventSetup
Definition: EventSetup.h:57
LinkBoardElectronicIndex.h
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition: TriggerBoardSpec.cc:5
looper.cfg
cfg
Definition: looper.py:297
LinkBoardElectronicIndex
Definition: LinkBoardElectronicIndex.h:10
RPCMonitorRaw::theWatchedErrorHistos
std::vector< MonitorElement * > theWatchedErrorHistos[3]
Definition: RPCMonitorRaw.h:37
type
type
Definition: HCALResponse.h:21
dqm::implementation::IBooker::book2D
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
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
dqmiodumpmetadata.counts
counts
Definition: dqmiodumpmetadata.py:25
RPCMonitorRaw::me_mapGoodEvents
MonitorElement * me_mapGoodEvents
Definition: RPCMonitorRaw.h:33
dqm::implementation::IBooker
Definition: DQMStore.h:43
RPCMonitorRaw::rpcRawDataCountsTag_
edm::EDGetTokenT< RPCRawDataCounts > rpcRawDataCountsTag_
Definition: RPCMonitorRaw.h:45
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
ParameterSet.h
RPCMonitorRaw::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: RPCMonitorRaw.cc:81
RPCMonitorRaw::me_t
MonitorElement * me_t[3]
Definition: RPCMonitorRaw.h:31
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
edm::Event
Definition: Event.h:73
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98