CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
ESFEDIntegrityTask Class Reference

#include <ESFEDIntegrityTask.h>

Inheritance diagram for ESFEDIntegrityTask:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 ESFEDIntegrityTask (const edm::ParameterSet &ps)
 
 ~ESFEDIntegrityTask () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 

Private Attributes

edm::EDGetTokenT< ESRawDataCollectiondccCollections_
 
bool debug_
 
std::string fedDirName_
 
edm::EDGetTokenT< FEDRawDataCollectionFEDRawDataCollection_
 
int ievt_
 
MonitorElementmeESFedsEntries_
 
MonitorElementmeESFedsFatal_
 
MonitorElementmeESFedsNonFatal_
 
std::string prefixME_
 

Detailed Description

Definition at line 15 of file ESFEDIntegrityTask.h.

Constructor & Destructor Documentation

ESFEDIntegrityTask::ESFEDIntegrityTask ( const edm::ParameterSet ps)

Definition at line 25 of file ESFEDIntegrityTask.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

25  {
26 
27  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
28  fedDirName_ = ps.getUntrackedParameter<string>("FEDDirName", "FEDIntegrity");
29  debug_ = ps.getUntrackedParameter<bool>("debug", false);
30 
31  dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
32  FEDRawDataCollection_ = consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("FEDRawDataCollection"));
33 
34  meESFedsEntries_ = nullptr;
35  meESFedsFatal_ = nullptr;
36  meESFedsNonFatal_ = nullptr;
37 
38  ievt_ = 0;
39 
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meESFedsFatal_
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
ESFEDIntegrityTask::~ESFEDIntegrityTask ( )
inlineoverride

Member Function Documentation

void ESFEDIntegrityTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Analyze.

Definition at line 65 of file ESFEDIntegrityTask.cc.

References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, FEDRawData::data(), DEFINE_FWK_MODULE, edm::SortedCollection< T, SORT >::end(), FEDRawDataCollection::FEDData(), ESDCCHeaderBlock::fedId(), ESDCCHeaderBlock::getBX(), edm::Event::getByToken(), ESDCCHeaderBlock::getDCCErrors(), ESDCCHeaderBlock::getFEChannelStatus(), ESDCCHeaderBlock::getLV1(), ESDCCHeaderBlock::getOptoRX0(), ESDCCHeaderBlock::getOptoRX1(), ESDCCHeaderBlock::getOptoRX2(), ESDCCHeaderBlock::getOrbitNumber(), RecoTauValidation_cfi::header, mps_fire::i, and FEDRawData::size().

Referenced by ~ESFEDIntegrityTask().

65  {
66 
67  ievt_++;
68 
69  int gt_L1A = 0;
70  // int gt_OrbitNumber = 0, gt_BX = 0;
71  int esDCC_L1A_MostFreqCounts = 0;
72  int esDCC_BX_MostFreqCounts = 0;
73  int esDCC_OrbitNumber_MostFreqCounts = 0;
74  int gtFedDataSize = 0;
75 
77  Handle<FEDRawDataCollection> allFedRawData;
78 
79  if ( e.getByToken(FEDRawDataCollection_, allFedRawData) ) {
80 
81  // ES FEDs
82  for (int esFED=520; esFED<=575; ++esFED) {
83 
84  const FEDRawData& fedData = allFedRawData->FEDData(esFED);
85  int length = fedData.size()/sizeof(uint64_t);
86 
87  if ( length > 0 )
88  if ( meESFedsEntries_ ) meESFedsEntries_->Fill(esFED);
89  }
90 
91  // GT FED data
92  const FEDRawData& gtFedData = allFedRawData->FEDData(812);
93 
94  gtFedDataSize = gtFedData.size()/sizeof(uint64_t);
95 
96  if ( gtFedDataSize > 0 ) {
97 
98  FEDHeader header(gtFedData.data());
99 
100  gt_L1A = header.lvl1ID();
101  //gt_OrbitNumber = e.orbitNumber();
102  //gt_BX = e.bunchCrossing();
103  } else {
104 
105  map<int, int> esDCC_L1A_FreqMap;
106  map<int, int> esDCC_BX_FreqMap;
107  map<int, int> esDCC_OrbitNumber_FreqMap;
108 
109  if ( e.getByToken(dccCollections_, dccs) ) {
110 
111  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
112  ESDCCHeaderBlock esdcc = (*dccItr);
113 
114  esDCC_L1A_FreqMap[esdcc.getLV1()]++;
115  esDCC_BX_FreqMap[esdcc.getBX()]++;
116  esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()]++;
117 
118  if (esDCC_L1A_FreqMap[esdcc.getLV1()] > esDCC_L1A_MostFreqCounts) {
119  esDCC_L1A_MostFreqCounts = esDCC_L1A_FreqMap[esdcc.getLV1()];
120  gt_L1A = esdcc.getLV1();
121  }
122 
123  if (esDCC_BX_FreqMap[esdcc.getBX()] > esDCC_BX_MostFreqCounts) {
124  esDCC_BX_MostFreqCounts = esDCC_BX_FreqMap[esdcc.getBX()];
125  //gt_BX = esdcc.getBX();
126  }
127 
128  if (esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()] > esDCC_OrbitNumber_MostFreqCounts) {
129  esDCC_OrbitNumber_MostFreqCounts = esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()];
130  //gt_OrbitNumber = esdcc.getOrbitNumber();
131  }
132 
133  }
134  } else {
135  LogWarning("ESFEDIntegrityTask") << "dccCollections not available";
136  }
137 
138  }
139 
140  } else {
141  LogWarning("ESFEDIntegrityTask") << "FEDRawDataCollection not available";
142  }
143 
144  vector<int> fiberStatus;
145  if ( e.getByToken(dccCollections_, dccs) ) {
146  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
147  ESDCCHeaderBlock dcc = (*dccItr);
148 
149  if (dcc.getDCCErrors() > 0) {
150 
151  if ( meESFedsFatal_ ) meESFedsFatal_->Fill(dcc.fedId());
152 
153  } else {
154  if (debug_) cout<<dcc.fedId()<<" "<<dcc.getOptoRX0()<<" "<<dcc.getOptoRX1()<<" "<<dcc.getOptoRX2()<<endl;
155  fiberStatus = dcc.getFEChannelStatus();
156 
157  if (dcc.getOptoRX0() == 128) {
158  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
159  } else if (dcc.getOptoRX0() == 129) {
160  for (unsigned int i=0; i<12; ++i) {
161  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
162  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
163  }
164  }
165  if (dcc.getOptoRX1() == 128) {
166  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
167  } else if (dcc.getOptoRX1() == 129) {
168  for (unsigned int i=12; i<24; ++i) {
169  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
170  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
171  }
172  }
173  if (dcc.getOptoRX2() == 128) {
174  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
175  } else if (dcc.getOptoRX2() == 129){
176  for (unsigned int i=24; i<36; ++i) {
177  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
178  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
179  }
180  }
181  }
182 
183  if (dcc.getLV1() != gt_L1A) meESFedsNonFatal_->Fill(dcc.fedId());
184  //if (dcc.getBX() != gt_BX) meESFedsNonFatal_->Fill(dcc.fedId());
185  //if (dcc.getOrbitNumber() != gt_OrbitNumber) meESFedsNonFatal_->Fill(dcc.fedId());
186  }
187  }
188 
189  //for (ESLocalRawDataCollection::const_iterator kItr = kchips->begin(); kItr != kchips->end(); ++kItr) {
190 
191  //ESKCHIPBlock kchip = (*kItr);
192 
193  //Int_t nErr = 0;
194  //if (kchip.getFlag1() > 0) nErr++;
195  //if (kchip.getFlag2() > 0) nErr++;
196  //if (kchip.getBC() != kchip.getOptoBC()) nErr++;
197  //if (kchip.getEC() != kchip.getOptoEC()) nErr++;
198  //if (nErr>0) meESFedsNonFatal_->Fill(dcc.fedId());
199  //}
200 
201 }
int getLV1() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< ESDCCHeaderBlock >::const_iterator const_iterator
int getOptoRX0() const
int getOptoRX1() const
MonitorElement * meESFedsFatal_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const std::vector< int > & getFEChannelStatus() const
void Fill(long long x)
int getBX() const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
int getOrbitNumber() const
const_iterator end() const
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
unsigned long long uint64_t
Definition: Time.h:15
int getDCCErrors() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
const int fedId() const
int getOptoRX2() const
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
const_iterator begin() const
void ESFEDIntegrityTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 43 of file ESFEDIntegrityTask.cc.

References DQMStore::IBooker::book1D(), trackerHits::histo, and DQMStore::IBooker::setCurrentFolder().

Referenced by ~ESFEDIntegrityTask().

44 {
45  char histo[200];
46 
47  iBooker.setCurrentFolder(prefixME_ + "/" + fedDirName_);
48 
49  sprintf(histo, "FEDEntries");
50  meESFedsEntries_ = iBooker.book1D(histo, histo, 56, 520, 576);
51 
52  sprintf(histo, "FEDFatal");
53  meESFedsFatal_ = iBooker.book1D(histo, histo, 56, 520, 576);
54 
55  sprintf(histo, "FEDNonFatal");
56  meESFedsNonFatal_ = iBooker.book1D(histo, histo, 56, 520, 576);
57 }
MonitorElement * meESFedsFatal_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::endJob ( void  )
overrideprotected

Definition at line 59 of file ESFEDIntegrityTask.cc.

Referenced by ~ESFEDIntegrityTask().

59  {
60 
61  LogInfo("ESFEDIntegrityTask") << "analyzed " << ievt_ << " events";
62 
63 }

Member Data Documentation

edm::EDGetTokenT<ESRawDataCollection> ESFEDIntegrityTask::dccCollections_
private

Definition at line 39 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::debug_
private

Definition at line 37 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::fedDirName_
private

Definition at line 36 of file ESFEDIntegrityTask.h.

edm::EDGetTokenT<FEDRawDataCollection> ESFEDIntegrityTask::FEDRawDataCollection_
private

Definition at line 40 of file ESFEDIntegrityTask.h.

int ESFEDIntegrityTask::ievt_
private

Definition at line 33 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsEntries_
private

Definition at line 42 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsFatal_
private

Definition at line 43 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsNonFatal_
private

Definition at line 44 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::prefixME_
private

Definition at line 35 of file ESFEDIntegrityTask.h.