CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
40  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Begin job ";
42 }
43 
45  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Begin run ";
46 
47  if (!init_) this->bookFEDMe();
48  else if (!merge_) this->reset();
49 
50 }
51 
53 
55 
56  //get hold of raw data counts
58  iEvent.getByToken (rawCountsLabel_, rawCounts);
59  if(!rawCounts.isValid()) return;
60 
61 
62  const RPCRawDataCounts & counts = *rawCounts.product();
63 
64  for (int fed=minFEDNum_; fed <=maxFEDNum_; ++fed) {
65  if (counts.fedBxRecords(fed) ) fedMe_[Entries]->Fill(fed);
66  if (counts.fedFormatErrors(fed)) fedMe_[Fatal]->Fill(fed);
67  if (counts.fedErrorRecords(fed)) fedMe_[NonFatal]->Fill(fed);
68  }
69 }
70 
72 
74 
76  dbe_=0;
77 }
78 
79 //Fill report summary
81 
82  if(dbe_){
84 
85  fedMe_[Entries] = dbe_->book1D("FEDEntries","FED Entries",numOfFED_, minFEDNum_, maxFEDNum_ +1);
86  this->labelBins(fedMe_[Entries]);
87  fedMe_[Fatal] = dbe_->book1D("FEDFatal","FED Fatal Errors",numOfFED_, minFEDNum_, maxFEDNum_ +1);
88  this->labelBins(fedMe_[Fatal]);
89  fedMe_[NonFatal] = dbe_->book1D("FEDNonFatal","FED NON Fatal Errors",numOfFED_, minFEDNum_, maxFEDNum_ +1);
90  this->labelBins(fedMe_[NonFatal]);
91  }
92 
93  init_ = true;
94 }
95 
97 
98  int xbins = myMe->getNbinsX();
99 
100  if (xbins!= numOfFED_ ) return;
101  std::stringstream xLabel;
102 
103  for (int i = 0; i<xbins; i++){
104  xLabel.str("");
105  int fedNum = minFEDNum_ + i;
106  xLabel<<fedNum;
107  myMe->setBinLabel(i+1, xLabel.str(),1);
108  }
109 }
110 
111 
113 
114  MonitorElement * me;
115 
116  if(dbe_){
117  for(unsigned int i = 0; i<histoName_.size(); i++){
118  me = 0;
119  me = dbe_->get(prefixDir_ + histoName_[i]);
120  if(0!=me ) me->Reset();
121  }
122  }
123 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int fedErrorRecords(int fedId) const
int fedBxRecords(int fedId) const
const double xbins[]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
End Lumi Block.
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)
int fedFormatErrors(int fedId) const
void beginRun(const edm::Run &r, const edm::EventSetup &c)
void analyze(const edm::Event &iEvent, const edm::EventSetup &c)
Analyze.
int iEvent
Definition: GenABIO.cc:243
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual ~RPCFEDIntegrity()
Destructor.
std::vector< LinkConnSpec >::const_iterator IT
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
bool isValid() const
Definition: HandleBase.h:76
MonitorElement * fedMe_[3]
std::vector< std::string > histoName_
void bookFEDMe(void)
T const * product() const
Definition: Handle.h:81
void endRun(const edm::Run &r, const edm::EventSetup &c)
void beginJob()
BeginJob.
void labelBins(MonitorElement *myMe)
edm::EDGetTokenT< RPCRawDataCounts > rawCountsLabel_
int getNbinsX(void) const
get # of bins in X-axis
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
Begin Lumi block.
RPCFEDIntegrity(const edm::ParameterSet &ps)
Constructor.
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
std::string prefixDir_