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
18 
19 typedef std::map<std::pair<int, int>, int >::const_iterator IT;
20 
22  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Constructor";
23 
24  rawCountsLabel_ = ps.getUntrackedParameter<edm::InputTag>("RPCRawCountsInputTag");
25  prefixDir_ = ps.getUntrackedParameter<std::string>("RPCPrefixDir", "RPC/FEDIntegrity");
26  merge_ = ps.getUntrackedParameter<bool>("MergeRuns", false);
27  minFEDNum_ = ps.getUntrackedParameter<int>("MinimumFEDID", 790);
28  maxFEDNum_ = ps.getUntrackedParameter<int>("MaximumFEDID", 792);
29 
30  init_ = false;
31  numOfFED_= maxFEDNum_ - minFEDNum_ + 1;
32  FATAL_LIMIT = 5;
33 }
34 
36  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Destructor ";
37  // dbe_=0;
38 }
39 
41  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Begin job ";
43 }
44 
46  edm::LogVerbatim ("rpcfedintegrity") << "[RPCFEDIntegrity]: Begin run ";
47 
48  if (!init_) this->bookFEDMe();
49  else if (!merge_) this->reset();
50 
51 }
52 
54 
56 
57  //get hold of raw data counts
59  iEvent.getByLabel (rawCountsLabel_, rawCounts);
60  if(!rawCounts.isValid()) return;
61 
62 
63  const RPCRawDataCounts & counts = *rawCounts.product();
64 
65  for (int fed=minFEDNum_; fed <=maxFEDNum_; ++fed) {
66  if (counts.fedBxRecords(fed) ) fedMe_[Entries]->Fill(fed);
67  if (counts.fedFormatErrors(fed)) fedMe_[Fatal]->Fill(fed);
68  if (counts.fedErrorRecords(fed)) fedMe_[NonFatal]->Fill(fed);
69  }
70 }
71 
73 
75 
77  dbe_=0;
78 }
79 
80 //Fill report summary
82 
83  if(dbe_){
85 
86  fedMe_[Entries] = dbe_->book1D("FEDEntries","FED Entries",numOfFED_, minFEDNum_, maxFEDNum_ +1);
87  this->labelBins(fedMe_[Entries]);
88  fedMe_[Fatal] = dbe_->book1D("FEDFatal","FED Fatal Errors",numOfFED_, minFEDNum_, maxFEDNum_ +1);
89  this->labelBins(fedMe_[Fatal]);
90  fedMe_[NonFatal] = dbe_->book1D("FEDNonFatal","FED NON Fatal Errors",numOfFED_, minFEDNum_, maxFEDNum_ +1);
91  this->labelBins(fedMe_[NonFatal]);
92  }
93 
94  init_ = true;
95 }
96 
98 
99  int xbins = myMe->getNbinsX();
100 
101  if (xbins!= numOfFED_ ) return;
102  std::stringstream xLabel;
103 
104  for (int i = 0; i<xbins; i++){
105  xLabel.str("");
106  int fedNum = minFEDNum_ + i;
107  xLabel<<fedNum;
108  myMe->setBinLabel(i+1, xLabel.str(),1);
109  }
110 }
111 
112 
114 
115  MonitorElement * me;
116 
117  if(dbe_){
118  for(unsigned int i = 0; i<histoName_.size(); i++){
119  me = 0;
120  me = dbe_->get(prefixDir_ + histoName_[i]);
121  if(0!=me ) me->Reset();
122  }
123  }
124 }
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:717
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:1468
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * fedMe_[3]
std::vector< std::string > histoName_
void bookFEDMe(void)
T const * product() const
Definition: Handle.h:74
void endRun(const edm::Run &r, const edm::EventSetup &c)
void beginJob()
BeginJob.
void labelBins(MonitorElement *myMe)
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)
edm::InputTag rawCountsLabel_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33
std::string prefixDir_