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 {
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.,10000.);
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  hfedprof->setBinLabel(i+1,"FED "+ sfed.str());
45  }
46 
47  hfedsize = ibooker.book1D("fedsize","FED Size Distribution",100,0.,10000.);
48 }
49 
50 
51 void L1TFED::analyze(const Event& e, const EventSetup& c)
52 {
53  nev_++;
54  if(verbose_) cout << "L1T FED Integrity: analyze...." << endl;
55 
57  bool t = e.getByToken(rawl_,rawdata);
58 
59  if ( ! t ) {
60  if(verbose_) cout << "can't find FEDRawDataCollection "<< endl;
61  }
62 
63  else {
64 
65  if(verbose_) cout << "fedlist size = " << l1feds_.size() << endl;
66 
67  for (unsigned int i = 0; i<l1feds_.size(); i++){
68  int fedId = l1feds_[i];
69  if(verbose_) cout << "fedId = " << fedId << endl;
70 
71  const FEDRawData & data = rawdata->FEDData(fedId);
72 
73  if(size_t size=data.size()){
74 
75  fedentries->Fill(i);
76  hfedsize->Fill(float(size));
77  hfedprof->Fill(float(i),float(size));
78  if(verbose_) cout << "header check = " << FEDHeader(data.data()).check() << endl;
79  if(verbose_) cout << "trailer check = " << FEDTrailer(data.data()).check() << endl;
80 
81  if(!FEDHeader(data.data()).check()) fedfatal->Fill(i);
82 
83  } else {
84 
85  if(verbose_) cout << "empty fed " << i << endl;
86  if(stableROConfig_) fedfatal->Fill(i);
87 
88  }
89  }
90  }
91 }
92 
93 
size
Write out results.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:160
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
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)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TFED.cc:51
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
L1TFED(const edm::ParameterSet &ps)
Definition: L1TFED.cc:13
HLT enums.
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
~L1TFED() override
Definition: L1TFED.cc:26
def check(config)
Definition: trackerTree.py:14
Definition: Run.h:43