CMS 3D CMS Logo

L1TFED.cc
Go to the documentation of this file.
1 /*
2  * \file L1TFED.cc
3  *
4  * \author J. Berryhill
5  *
6  */
7 
9 
10 using namespace std;
11 using namespace edm;
12 
14  // verbosity switch
15  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
16  l1feds_ = ps.getParameter<std::vector<int> >("L1FEDS");
17  directory_ = ps.getUntrackedParameter<std::string>("FEDDirName", "L1T/FEDIntegrity");
18  stableROConfig_ = ps.getUntrackedParameter<bool>("stableROConfig", true);
19  rawl_ = consumes<FEDRawDataCollection>(ps.getParameter<InputTag>("rawTag"));
20 
21  if (verbose_)
22  cout << "L1TFED: constructor...." << endl;
23  nev_ = 0;
24 }
25 
27 
28 void L1TFED::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
29  ibooker.setCurrentFolder(directory_);
30 
31  fedentries = ibooker.book1D("FEDEntries", "Fed ID occupancy", l1feds_.size(), 0., l1feds_.size());
32  fedfatal = ibooker.book1D("FEDFatal", "Fed ID non present ", l1feds_.size(), 0., l1feds_.size());
33  fednonfatal = ibooker.book1D("FEDNonFatal", "Fed corrupted data ", l1feds_.size(), 0., l1feds_.size());
34  hfedprof = ibooker.bookProfile("fedprofile", "FED Size by ID", l1feds_.size(), 0., l1feds_.size(), 0, 0., 10000.);
35  for (unsigned int i = 0; i < l1feds_.size(); i++) {
36  ostringstream sfed;
37  sfed << l1feds_[i];
38  fedentries->setBinLabel(i + 1, "FED " + sfed.str());
39  fedfatal->setBinLabel(i + 1, "FED " + sfed.str());
40  fednonfatal->setBinLabel(i + 1, "FED " + sfed.str());
41  hfedprof->setBinLabel(i + 1, "FED " + sfed.str());
42  }
43 
44  hfedsize = ibooker.book1D("fedsize", "FED Size Distribution", 100, 0., 10000.);
45 }
46 
47 void L1TFED::analyze(const Event& e, const EventSetup& c) {
48  nev_++;
49  if (verbose_)
50  cout << "L1T FED Integrity: analyze...." << endl;
51 
53  bool t = e.getByToken(rawl_, rawdata);
54 
55  if (!t) {
56  if (verbose_)
57  cout << "can't find FEDRawDataCollection " << endl;
58  }
59 
60  else {
61  if (verbose_)
62  cout << "fedlist size = " << l1feds_.size() << endl;
63 
64  for (unsigned int i = 0; i < l1feds_.size(); i++) {
65  int fedId = l1feds_[i];
66  if (verbose_)
67  cout << "fedId = " << fedId << endl;
68 
69  const FEDRawData& data = rawdata->FEDData(fedId);
70 
71  if (size_t size = data.size()) {
72  fedentries->Fill(i);
73  hfedsize->Fill(float(size));
74  hfedprof->Fill(float(i), float(size));
75  if (verbose_)
76  cout << "header check = " << FEDHeader(data.data()).check() << endl;
77  if (verbose_)
78  cout << "trailer check = " << FEDTrailer(data.data()).check() << endl;
79 
80  if (!FEDHeader(data.data()).check())
81  fedfatal->Fill(i);
82 
83  } else {
84  if (verbose_)
85  cout << "empty fed " << i << endl;
86  if (stableROConfig_)
87  fedfatal->Fill(i);
88  }
89  }
90  }
91 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: L1TFED.cc:28
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TFED.cc:47
virtual 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)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
L1TFED(const edm::ParameterSet &ps)
Definition: L1TFED.cc:13
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
~L1TFED() override
Definition: L1TFED.cc:26
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: Run.h:45