CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCMonitorRaw.cc
Go to the documentation of this file.
2 
7 
11 
13 
16 
17 #include "TH1F.h"
18 #include "TH2F.h"
19 #include "TFile.h"
20 
21 #include <fstream>
22 #include <iostream>
23 #include <iomanip>
24 #include <bitset>
25 
26 typedef std::map< std::pair<int,int>, int>::const_iterator IT;
27 
29 
30  rpcRawDataCountsTag_ = consumes<RPCRawDataCounts>(cfg.getParameter<edm::InputTag>("rpcRawDataCountsTag"));
31 
32  for (unsigned int i=0; i<10;i++) theWatchedErrorHistoPos[i]=0;
33  std::vector<int> algos = cfg.getUntrackedParameter<std::vector<int> >("watchedErrors");
34  for (std::vector<int>::const_iterator it=algos.begin();it!= algos.end(); ++it) {
35  unsigned int ialgo = *it;
36  if (ialgo < 10) 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 
44  edm::Run const & iRun ,
45  edm::EventSetup const & iSetup ) {
46  ibooker.cd();
47  ibooker.setCurrentFolder("RPC/LinkMonitor");
48 
49  me_t[0]=ibooker.book1D("recordType_790",RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(790));
50  me_t[1]=ibooker.book1D("recordType_791",RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(791));
51  me_t[2]=ibooker.book1D("recordType_792",RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(792));
52  for (int i=0;i<3;++i)me_t[i]->getTH1F()->SetStats(0);
53 
54  me_e[0]=ibooker.book1D("readoutErrors_790",RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(790));
55  me_e[1]=ibooker.book1D("readoutErrors_791",RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(791));
56  me_e[2]=ibooker.book1D("readoutErrors_792",RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(792));
57  for (int i=0;i<3;++i)me_e[i]->getTH1F()->SetStats(0);
58 
59  me_mapGoodEvents=ibooker.book2D("mapGoodRecords","mapGoodRecords",36,-0.5,35.5, 3, 789.5,792.5);
60  me_mapGoodEvents->getTH2F()->SetNdivisions(3,"y");
61  me_mapGoodEvents->getTH2F()->SetXTitle("rmb");
62  me_mapGoodEvents->getTH2F()->SetYTitle("fed");
63  me_mapGoodEvents->getTH2F()->SetStats(0);
64  me_mapBadEvents =ibooker.book2D("mapErrorRecords", "mapErrorRecords", 36,-0.5,35.5, 3, 789.5,792.5);
65  me_mapBadEvents->getTH2F()->SetXTitle("fed");
66  me_mapBadEvents->getTH2F()->SetYTitle("rmb");
67  me_mapBadEvents->getTH2F()->SetNdivisions(3,"y");
68  me_mapBadEvents->getTH2F()->SetStats(0);
69 
70  for (unsigned int i=0; i<=9; ++i) {
72  for (unsigned int fed=790; fed <=792; ++fed) {
74  MonitorElement* watched = ibooker.book2D(histo->GetName(),histo);
75  theWatchedErrorHistos[fed-790].push_back(watched);
77  }
78  }
79  }
80 
81 }
82 
83 
84 
86 {
87 
89  ev.getByToken(rpcRawDataCountsTag_, rawCounts);
90  const RPCRawDataCounts & counts = *rawCounts.product();
91 
92  //
93  // record type
94  //
95  for (IT it=counts.theRecordTypes.begin(); it != counts.theRecordTypes.end(); ++it)
96  me_t[it->first.first-790]->Fill(it->first.second,it->second);
97 
98  //
99  // good events topology
100  //
101  for (IT it = counts.theGoodEvents.begin(); it != counts.theGoodEvents.end(); ++it)
102  me_mapGoodEvents->Fill(it->first.second, it->first.first, it->second);
103 
104  //
105  // bad events topology
106  //
107  for (IT it = counts.theBadEvents.begin(); it != counts.theBadEvents.end(); ++it)
108  me_mapBadEvents->Fill(it->first.second, it->first.first, it->second);
109 
110 
111  //
112  // readout errors
113  //
114  for (IT it=counts.theReadoutErrors.begin(); it != counts.theReadoutErrors.end(); ++it) {
115  rpcrawtodigi::ReadoutError error(it->first.second);
116  LinkBoardElectronicIndex ele = error.where();
118 
119  int fed = it->first.first;
120  me_e[fed-790]->Fill(type, it->second);
121 
122  //
123  // in addition fill location map for selected errors
124  //
126  if ( idx >= 0) {
127  std::vector<MonitorElement* > & wh = theWatchedErrorHistos[fed-790];
128  MonitorElement* me = wh[idx];
129  me->Fill(ele.dccInputChannelNum, ele.tbLinkInputNum, it->second);
130  }
131  }
132 
133 
134 // for (int i=0; i<3; ++i) {
135 // me_t[i]->update();
136 // me_e[i]->update();
137 // std::vector<MonitorElement* > & wh = theWatchedErrorHistos[i];
138 // for (std::vector<MonitorElement* >::iterator it=wh.begin(); it != wh.end(); ++it) (*it)->update();
139 // }
140 // me_mapGoodEvents->update();
141 // me_mapBadEvents->update();
142 
143 
144 
145 }
std::map< std::pair< int, int >, int > theReadoutErrors
LinkBoardElectronicIndex where() const
Definition: ReadoutError.cc:20
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:293
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
void cd(void)
Definition: DQMStore.cc:266
MonitorElement * me_mapBadEvents
Definition: RPCMonitorRaw.h:36
std::vector< MonitorElement * > theWatchedErrorHistos[3]
Definition: RPCMonitorRaw.h:39
bool ev
static TH1F * emptyReadoutErrorHisto(int fedId)
ReadoutErrorType type() const
Definition: ReadoutError.cc:14
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void Fill(long long x)
MonitorElement * me_mapGoodEvents
Definition: RPCMonitorRaw.h:35
edm::EDGetTokenT< RPCRawDataCounts > rpcRawDataCountsTag_
Definition: RPCMonitorRaw.h:47
MonitorElement * me_t[3]
Definition: RPCMonitorRaw.h:33
static TH2F * emptyReadoutErrorMapHisto(int fedId, int type)
virtual ~RPCMonitorRaw()
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
RPCMonitorRaw(const edm::ParameterSet &cfg)
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
std::map< std::pair< int, int >, int > theGoodEvents
std::vector< LinkConnSpec >::const_iterator IT
unsigned int theWatchedErrorHistoPos[10]
Definition: RPCMonitorRaw.h:42
#define LogTrace(id)
std::map< std::pair< int, int >, int > theRecordTypes
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static TH1F * emptyRecordTypeHisto(int fedId)
std::map< std::pair< int, int >, int > theBadEvents
TH2F * getTH2F(void) const
Definition: Run.h:43
MonitorElement * me_e[3]
Definition: RPCMonitorRaw.h:34