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:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 ESFEDIntegrityTask (const edm::ParameterSet &ps)
 
 ~ESFEDIntegrityTask () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 14 of file ESFEDIntegrityTask.h.

Constructor & Destructor Documentation

◆ ESFEDIntegrityTask()

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

Definition at line 25 of file ESFEDIntegrityTask.cc.

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

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

◆ ~ESFEDIntegrityTask()

ESFEDIntegrityTask::~ESFEDIntegrityTask ( )
inlineoverride

Definition at line 17 of file ESFEDIntegrityTask.h.

17 {}

Member Function Documentation

◆ analyze()

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

Analyze.

Reimplemented from DQMEDAnalyzer.

Definition at line 55 of file ESFEDIntegrityTask.cc.

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

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

◆ bookHistograms()

void ESFEDIntegrityTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 40 of file ESFEDIntegrityTask.cc.

References dqm::implementation::IBooker::book1D(), timingPdfMaker::histo, and dqm::implementation::NavigatorBase::setCurrentFolder().

40  {
41  char histo[200];
42 
43  iBooker.setCurrentFolder(prefixME_ + "/" + fedDirName_);
44 
45  sprintf(histo, "FEDEntries");
46  meESFedsEntries_ = iBooker.book1D(histo, histo, 56, 520, 576);
47 
48  sprintf(histo, "FEDFatal");
49  meESFedsFatal_ = iBooker.book1D(histo, histo, 56, 520, 576);
50 
51  sprintf(histo, "FEDNonFatal");
52  meESFedsNonFatal_ = iBooker.book1D(histo, histo, 56, 520, 576);
53 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * meESFedsFatal_
MonitorElement * meESFedsEntries_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * meESFedsNonFatal_

Member Data Documentation

◆ dccCollections_

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

Definition at line 32 of file ESFEDIntegrityTask.h.

◆ debug_

bool ESFEDIntegrityTask::debug_
private

Definition at line 30 of file ESFEDIntegrityTask.h.

◆ fedDirName_

std::string ESFEDIntegrityTask::fedDirName_
private

Definition at line 29 of file ESFEDIntegrityTask.h.

◆ FEDRawDataCollection_

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

Definition at line 33 of file ESFEDIntegrityTask.h.

◆ ievt_

int ESFEDIntegrityTask::ievt_
private

Definition at line 26 of file ESFEDIntegrityTask.h.

◆ meESFedsEntries_

MonitorElement* ESFEDIntegrityTask::meESFedsEntries_
private

Definition at line 35 of file ESFEDIntegrityTask.h.

◆ meESFedsFatal_

MonitorElement* ESFEDIntegrityTask::meESFedsFatal_
private

Definition at line 36 of file ESFEDIntegrityTask.h.

◆ meESFedsNonFatal_

MonitorElement* ESFEDIntegrityTask::meESFedsNonFatal_
private

Definition at line 37 of file ESFEDIntegrityTask.h.

◆ prefixME_

std::string ESFEDIntegrityTask::prefixME_
private

Definition at line 28 of file ESFEDIntegrityTask.h.