CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
15  // verbosity switch
16  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
17  l1feds_ = ps.getParameter<std::vector<int> >("L1FEDS");
18  directory_ = ps.getUntrackedParameter<std::string>("FEDDirName","L1T/FEDIntegrity");
19  stableROConfig_ = ps.getUntrackedParameter<bool>("stableROConfig", true);
20  rawl_ = consumes<FEDRawDataCollection>(ps.getParameter< InputTag >("rawTag"));
21 
22  if(verbose_) cout << "L1TFED: constructor...." << endl;
23  nev_ = 0;
24 }
25 
27 {
28 }
29 
30 void L1TFED::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & iSetup)
31 {
32  ibooker.setCurrentFolder(directory_);
33 
34  fedentries = ibooker.book1D("FEDEntries", "Fed ID occupancy", l1feds_.size(), 0.,l1feds_.size() );
35  fedfatal = ibooker.book1D("FEDFatal", "Fed ID non present ", l1feds_.size(), 0., l1feds_.size());
36  fednonfatal = ibooker.book1D("FEDNonFatal", "Fed corrupted data ", l1feds_.size(), 0.,l1feds_.size() );
37  hfedprof = ibooker.bookProfile("fedprofile","FED Size by ID", l1feds_.size(), 0., l1feds_.size(),0,0.,5000.);
38  for(unsigned int i=0;i<l1feds_.size();i++){
39  ostringstream sfed;
40  sfed << l1feds_[i];
41  fedentries->setBinLabel(i+1,"FED "+ sfed.str());
42  fedfatal->setBinLabel(i+1,"FED "+ sfed.str());
43  fednonfatal->setBinLabel(i+1,"FED "+ sfed.str());
44  }
45 
46  hfedsize = ibooker.book1D("fedsize","FED Size Distribution",100,0.,10000.);
47 }
48 
49 
50 void L1TFED::analyze(const Event& e, const EventSetup& c)
51 {
52  nev_++;
53  if(verbose_) cout << "L1T FED Integrity: analyze...." << endl;
54 
56  bool t = e.getByToken(rawl_,rawdata);
57 
58  if ( ! t ) {
59  if(verbose_) cout << "can't find FEDRawDataCollection "<< endl;
60  }
61 
62  else {
63 
64  if(verbose_) cout << "fedlist size = " << l1feds_.size() << endl;
65 
66  for (unsigned int i = 0; i<l1feds_.size(); i++){
67  int fedId = l1feds_[i];
68  if(verbose_) cout << "fedId = " << fedId << endl;
69 
70  const FEDRawData & data = rawdata->FEDData(fedId);
71 
72  if(size_t size=data.size()){
73 
74  fedentries->Fill(i);
75  hfedsize->Fill(float(size));
76  hfedprof->Fill(float(i),float(size));
77  if(verbose_) cout << "header check = " << FEDHeader(data.data()).check() << endl;
78  if(verbose_) cout << "trailer check = " << FEDTrailer(data.data()).check() << endl;
79 
80  if(!FEDHeader(data.data()).check()) fedfatal->Fill(i);
81 
82  } else {
83 
84  if(verbose_) cout << "empty fed " << i << endl;
85  if(stableROConfig_) fedfatal->Fill(i);
86 
87  }
88  }
89  }
90 }
91 
92 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: L1TFED.cc:30
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 &e, const edm::EventSetup &c)
Definition: L1TFED.cc:50
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
bool check(const std::string &)
virtual ~L1TFED()
Definition: L1TFED.cc:26
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
L1TFED(const edm::ParameterSet &ps)
Definition: L1TFED.cc:13
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121
dictionary rawdata
Definition: lumiPlot.py:393
tuple size
Write out results.
Definition: Run.h:41