CMS 3D CMS Logo

RPCFEDIntegrity.cc
Go to the documentation of this file.
1 /* \author Anna Cimmino*/
2 #include <algorithm>
5 // Framework
10 //DQM Services
13 
14 //EventFilter
17 
18 typedef std::map<std::pair<int, int>, int >::const_iterator IT;
19 
21  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Constructor";
22 
23  rawCountsLabel_ = consumes<RPCRawDataCounts>(ps.getUntrackedParameter<edm::InputTag>("RPCRawCountsInputTag"));
24  prefixDir_ = ps.getUntrackedParameter<std::string>("RPCPrefixDir", "RPC/FEDIntegrity");
25  merge_ = ps.getUntrackedParameter<bool>("MergeRuns", false);
26  minFEDNum_ = ps.getUntrackedParameter<int>("MinimumFEDID", 790);
27  maxFEDNum_ = ps.getUntrackedParameter<int>("MaximumFEDID", 792);
28 
29  init_ = false;
30  numOfFED_= maxFEDNum_ - minFEDNum_ + 1;
31  FATAL_LIMIT = 5;
32 }
33 
35  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Destructor ";
36  // dbe_=0;
37 }
38 
39 
41  edm::Run const & iRun ,
42  edm::EventSetup const & iSetup ) {
43 
44 
45  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Begin booking histograms ";
46 
47  this->bookFEDMe(ibooker);
48 }
49 
50 
52 
53  //get hold of raw data counts
55  iEvent.getByToken (rawCountsLabel_, rawCounts);
56  if(!rawCounts.isValid()) return;
57 
58 
59  const RPCRawDataCounts & counts = *rawCounts.product();
60 
61  for (int fed=minFEDNum_; fed <=maxFEDNum_; ++fed) {
62  if (counts.fedBxRecords(fed) ) fedMe_[Entries]->Fill(fed);
63  if (counts.fedFormatErrors(fed)) fedMe_[Fatal]->Fill(fed);
64  if (counts.fedErrorRecords(fed)) fedMe_[NonFatal]->Fill(fed);
65  }
66 }
67 
68 
69 //Fill report summary
71 
72 
73  ibooker.cd();
75 
76  fedMe_[Entries] = ibooker.book1D("FEDEntries","FED Entries",numOfFED_, minFEDNum_, maxFEDNum_ +1);
77  this->labelBins(fedMe_[Entries]);
78  fedMe_[Fatal] = ibooker.book1D("FEDFatal","FED Fatal Errors",numOfFED_, minFEDNum_, maxFEDNum_ +1);
79  this->labelBins(fedMe_[Fatal]);
80  fedMe_[NonFatal] = ibooker.book1D("FEDNonFatal","FED NON Fatal Errors",numOfFED_, minFEDNum_, maxFEDNum_ +1);
81  this->labelBins(fedMe_[NonFatal]);
82 
83  init_ = true;
84 }
85 
87 
88  int xbins = myMe->getNbinsX();
89 
90  if (xbins!= numOfFED_ ) return;
91  std::stringstream xLabel;
92 
93  for (int i = 0; i<xbins; i++){
94  xLabel.str("");
95  int fedNum = minFEDNum_ + i;
96  xLabel<<fedNum;
97  myMe->setBinLabel(i+1, xLabel.str(),1);
98  }
99 }
100 
101 
102 
T getUntrackedParameter(std::string const &, T const &) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Begin Lumi block.
int fedErrorRecords(int fedId) const
int fedBxRecords(int fedId) const
const double xbins[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void cd(void)
Definition: DQMStore.cc:269
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void analyze(const edm::Event &iEvent, const edm::EventSetup &c) override
Analyze.
int fedFormatErrors(int fedId) const
int iEvent
Definition: GenABIO.cc:230
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual ~RPCFEDIntegrity()
Destructor.
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void bookFEDMe(DQMStore::IBooker &)
bool isValid() const
Definition: HandleBase.h:74
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * fedMe_[3]
T const * product() const
Definition: Handle.h:81
std::map< std::pair< int, int >, int >::const_iterator IT
void labelBins(MonitorElement *myMe)
edm::EDGetTokenT< RPCRawDataCounts > rawCountsLabel_
int getNbinsX(void) const
get # of bins in X-axis
RPCFEDIntegrity(const edm::ParameterSet &ps)
Constructor.
Definition: Run.h:42
std::string prefixDir_