CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::TrigPrimClient Class Reference

#include <TrigPrimClient.h>

Inheritance diagram for ecaldqm::TrigPrimClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

void producePlots (ProcessType) override
 
 TrigPrimClient ()
 
 ~TrigPrimClient () override
 
- Public Member Functions inherited from ecaldqm::DQWorkerClient
void bookMEs (DQMStore::IBooker &) override
 
 DQWorkerClient ()
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void releaseMEs () override
 
void releaseSource ()
 
virtual void resetMEs ()
 
void resetPerLumi ()
 
bool retrieveSource (DQMStore::IGetter &, ProcessType)
 
bool runsOn (ProcessType _type) const
 
void setStatusManager (StatusManager const &_manager)
 
virtual void setTokens (edm::ConsumesCollector &)
 
 ~DQWorkerClient () override
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
bool checkElectronicsMap (bool=true)
 
bool checkGeometry (bool=true)
 
bool checkTopology (bool=true)
 
bool checkTrigTowerMap (bool=true)
 
 DQWorker ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
CaloGeometry const * GetGeometry ()
 
std::string const & getName () const
 
CaloTopology const * GetTopology ()
 
EcalTrigTowerConstituentsMap const * GetTrigTowerMap ()
 
bool onlineMode () const
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setSetupObjects (edm::EventSetup const &)
 
void setSetupObjectsEndLumi (edm::EventSetup const &)
 
void setTime (time_t _t)
 
void setTokens (edm::ConsumesCollector &)
 
virtual ~DQWorker () noexcept(false)
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

float errorFractionThreshold_
 
int minEntries_
 
bool sourceFromEmul_
 
float TTF4MaskingAlarmThreshold_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DQWorkerClient
enum  ProcessType { kLumi, kJob, nProcessType }
 
enum  Quality {
  kBad = 0, kGood = 1, kUnknown = 2, kMBad = 3,
  kMGood = 4, kMUnknown = 5
}
 
- Static Public Member Functions inherited from ecaldqm::DQWorkerClient
static void fillDescriptions (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandle
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandle
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandleEndLumi
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandle
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandleEndLumi
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandle
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandleEndLumi
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from ecaldqm::DQWorkerClient
void setME (edm::ParameterSet const &_ps) final
 
void setSource (edm::ParameterSet const &) override
 
void towerAverage_ (MESet &, MESet const &, float)
 
bool using_ (std::string const &_name, ProcessType _type=kJob) const
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DQWorkerClient
bool hasLumiPlots_
 
std::set< std::string > qualitySummaries_
 
MESetCollection sources_
 
StatusManager const * statusManager_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 7 of file TrigPrimClient.h.

Constructor & Destructor Documentation

◆ TrigPrimClient()

ecaldqm::TrigPrimClient::TrigPrimClient ( )

Definition at line 13 of file TrigPrimClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

15  qualitySummaries_.insert("EmulQualitySummary");
16  }
std::set< std::string > qualitySummaries_

◆ ~TrigPrimClient()

ecaldqm::TrigPrimClient::~TrigPrimClient ( )
inlineoverride

Definition at line 10 of file TrigPrimClient.h.

10 {}

Member Function Documentation

◆ producePlots()

void ecaldqm::TrigPrimClient::producePlots ( ProcessType  )
overridevirtual

Implements ecaldqm::DQWorkerClient.

Definition at line 31 of file TrigPrimClient.cc.

References funct::abs(), ecaldqm::MESetCollection::at(), ecaldqm::dccId(), EcalTrigTowerDetId::detIdFromDenseIndex(), EcalBarrel, EcalEndcap, errorFractionThreshold_, nano_mu_digi_cff::float, ecaldqm::MESet::getBinContent(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), ecaldqm::DQWorker::Timestamp::iLumi, ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, EcalTrigTowerDetId::kSizeForDenseIndexing, ecaldqm::DQWorkerClient::kUnknown, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, ecaldqm::DQWorker::MEs_, minEntries_, ecaldqm::nDCC, metDiagnosticParameterSet_cfi::nMax, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, ecaldqm::MESet::setBinContent(), sourceFromEmul_, ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, EcalTrigTowerDetId::subDet(), DiMuonV_cfg::threshold, ecaldqm::DQWorker::timestamp_, and TTF4MaskingAlarmThreshold_.

31  {
32  MESet* meNonSingleSummary = nullptr;
33  MESet* meTimingSummary = nullptr;
34  MESet* sEtEmulError = nullptr;
35  MESet* sMatchedIndex = nullptr;
36 
37  MESet& meEmulQualitySummary(MEs_.at("EmulQualitySummary"));
38  MESet& meTrendTTF4Flags(MEs_.at("TrendTTF4Flags"));
39 
40  MESet const& sTPDigiThrAll(sources_.at("TPDigiThrAll"));
41  MESetNonObject const& sLHCStatusByLumi(static_cast<MESetNonObject&>(sources_.at("LHCStatusByLumi")));
42 
44 
45  // Store # of entries for Occupancy analysis
46  std::vector<float> Nentries(nDCC, 0.);
47 
48  double currentLHCStatus = sLHCStatusByLumi.getFloatValue();
49  bool statsCheckEnabled =
50  ((currentLHCStatus > 10.5 && currentLHCStatus < 11.5) ||
51  currentLHCStatus < 0); // currentLHCStatus = -1 is the default when no beam info is available
52 
53  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
55 
56  bool doMask(meEmulQualitySummary.maskMatches(ttid, mask, statusManager_, GetTrigTowerMap()));
57 
58  if (sourceFromEmul_) {
59  sEtEmulError = &sources_.at("EtEmulError");
60  sMatchedIndex = &sources_.at("MatchedIndex");
61  meNonSingleSummary = &MEs_.at("NonSingleSummary");
62  meTimingSummary = &MEs_.at("TimingSummary");
63  float towerEntries(0.);
64  float tMax(0.5);
65  float nMax(0.);
66  for (int iBin(0); iBin < 6; iBin++) {
67  float entries(sMatchedIndex->getBinContent(getEcalDQMSetupObjects(), ttid, iBin + 1));
68  towerEntries += entries;
69 
70  if (entries > nMax) {
71  nMax = entries;
72  tMax = iBin == 0 ? -0.5 : iBin + 0.5; // historical reasons.. much clearer to say "no entry = -0.5"
73  }
74  }
75  meTimingSummary->setBinContent(getEcalDQMSetupObjects(), ttid, tMax);
76  if (towerEntries < minEntries_) {
77  meEmulQualitySummary.setBinContent(getEcalDQMSetupObjects(), ttid, doMask ? kMUnknown : kUnknown);
78  continue;
79  }
80 
81  float nonsingleFraction(1. - nMax / towerEntries);
82 
83  if (nonsingleFraction > 0.) {
84  meNonSingleSummary->setBinContent(getEcalDQMSetupObjects(), ttid, nonsingleFraction);
85  }
86 
87  if (sEtEmulError->getBinContent(getEcalDQMSetupObjects(), ttid) / towerEntries > errorFractionThreshold_) {
88  meEmulQualitySummary.setBinContent(getEcalDQMSetupObjects(), ttid, doMask ? kMBad : kBad);
89  } else {
90  meEmulQualitySummary.setBinContent(getEcalDQMSetupObjects(), ttid, doMask ? kMGood : kGood);
91  }
92  }
93 
94  // Keep count for Occupancy analysis
95  unsigned iDCC(dccId(ttid, GetElectronicsMap()) - 1);
96  Nentries[iDCC] += sTPDigiThrAll.getBinContent(getEcalDQMSetupObjects(), ttid);
97  }
98 
99  // Fill TTF4 v Masking ME
100  // NOT an occupancy plot: only tells you if non-zero TTF4 occupancy was seen
101  // without giving info about how many were seen
102  MESet& meTTF4vMask(MEs_.at("TTF4vMask"));
103  MESet& meTTF4vMaskByLumi(MEs_.at("TTF4vMaskByLumi"));
104  MESet const& sTTFlags4(sources_.at("TTFlags4"));
105  MESet const& sTTFlags4ByLumi(sources_.at("TTFlags4ByLumi"));
106  MESet const& sTTMaskMapAll(sources_.at("TTMaskMapAll"));
107 
108  std::vector<float> nWithTTF4(nDCC,
109  0.); // counters to keep track of number of towers in a DCC that have TTF4 flag set
110  int nWithTTF4_EE = 0; // total number of towers in EE with TTF4
111  int nWithTTF4_EB = 0; // total number of towers in EB with TTF4
112  // Loop over all TTs
113  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
115  unsigned iDCC(dccId(ttid, GetElectronicsMap()) - 1);
116  bool isMasked(sTTMaskMapAll.getBinContent(getEcalDQMSetupObjects(), ttid) > 0.);
117  bool hasTTF4(sTTFlags4.getBinContent(getEcalDQMSetupObjects(), ttid) > 0.);
118  bool hasTTF4InThisLumiSection(sTTFlags4ByLumi.getBinContent(getEcalDQMSetupObjects(), ttid) > 0.);
119  if (hasTTF4InThisLumiSection) {
120  nWithTTF4[iDCC]++;
121  if (ttid.subDet() == EcalBarrel)
122  nWithTTF4_EB++;
123  else if (ttid.subDet() == EcalEndcap)
124  nWithTTF4_EE++;
125  }
126  if (isMasked) {
127  if (hasTTF4) {
128  meTTF4vMask.setBinContent(getEcalDQMSetupObjects(), ttid, 12); // Masked, has TTF4
129  } else {
130  meTTF4vMask.setBinContent(getEcalDQMSetupObjects(), ttid, 11); // Masked, no TTF4
131  }
132  if (hasTTF4InThisLumiSection) {
133  meTTF4vMaskByLumi.setBinContent(getEcalDQMSetupObjects(), ttid, 12); // Masked, has TTF4
134  } else {
135  meTTF4vMaskByLumi.setBinContent(getEcalDQMSetupObjects(), ttid, 11); // Masked, no TTF4
136  }
137  } else {
138  if (hasTTF4)
139  meTTF4vMask.setBinContent(getEcalDQMSetupObjects(), ttid, 13); // not Masked, has TTF4
140  if (hasTTF4InThisLumiSection)
141  meTTF4vMaskByLumi.setBinContent(getEcalDQMSetupObjects(), ttid, 13); // not Masked, has TTF4
142  }
143  } // TT loop
144 
145  // Fill trend plots for number of TTs with TTF4 flag set
146  meTrendTTF4Flags.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), nWithTTF4_EB);
147  meTrendTTF4Flags.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), nWithTTF4_EE);
148 
149  // Quality check: set an entire FED to BAD if a more than 80% of the TTs in that FED show any DCC-SRP flag mismatch errors
150  // Fill flag mismatch statistics
151  std::vector<float> nTTs(nDCC, 0.);
152  std::vector<float> nTTFMismath(nDCC, 0.);
153  MESet const& sTTFMismatch(sources_.at("TTFMismatch"));
154  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
156  unsigned iDCC(dccId(ttid, GetElectronicsMap()) - 1);
157  if (sTTFMismatch.getBinContent(getEcalDQMSetupObjects(), ttid) > 0.)
158  nTTFMismath[iDCC]++;
159  nTTs[iDCC]++;
160  }
161  // Analyze flag mismatch statistics and TTF4 fraction statistics
162  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
164  unsigned iDCC(dccId(ttid, GetElectronicsMap()) - 1);
165  if (nTTFMismath[iDCC] > 0.8 * nTTs[iDCC] || nWithTTF4[iDCC] > TTF4MaskingAlarmThreshold_ * nTTs[iDCC]) {
166  meEmulQualitySummary.setBinContent(
168  ttid,
169  meEmulQualitySummary.maskMatches(ttid, mask, statusManager_, GetTrigTowerMap()) ? kMBad : kBad);
170  }
171  }
172 
173  // Quality check: set entire FED to BAD if its occupancy begins to vanish
174  // Fill FED statistics from TP digi occupancy
175  float meanFEDEB(0.), meanFEDEE(0.), rmsFEDEB(0.), rmsFEDEE(0.);
176  unsigned int nFEDEB(0), nFEDEE(0);
177  for (unsigned iDCC(0); iDCC < nDCC; iDCC++) {
178  if (iDCC >= kEBmLow && iDCC <= kEBpHigh) {
179  meanFEDEB += Nentries[iDCC];
180  rmsFEDEB += Nentries[iDCC] * Nentries[iDCC];
181  nFEDEB++;
182  } else {
183  meanFEDEE += Nentries[iDCC];
184  rmsFEDEE += Nentries[iDCC] * Nentries[iDCC];
185  nFEDEE++;
186  }
187  }
188  meanFEDEB /= float(nFEDEB);
189  rmsFEDEB /= float(nFEDEB);
190  meanFEDEE /= float(nFEDEE);
191  rmsFEDEE /= float(nFEDEE);
192  rmsFEDEB = sqrt(std::abs(rmsFEDEB - meanFEDEB * meanFEDEB));
193  rmsFEDEE = sqrt(std::abs(rmsFEDEE - meanFEDEE * meanFEDEE));
194  // Analyze FED statistics
195  float meanFED(0.), rmsFED(0.), nRMS(5.);
196  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
198  unsigned iDCC(dccId(ttid, GetElectronicsMap()) - 1);
199  if (iDCC >= kEBmLow && iDCC <= kEBpHigh) {
200  meanFED = meanFEDEB;
201  rmsFED = rmsFEDEB;
202  } else {
203  meanFED = meanFEDEE;
204  rmsFED = rmsFEDEE;
205  }
206  float threshold(meanFED < nRMS * rmsFED ? minEntries_ : meanFED - nRMS * rmsFED);
207  if ((meanFED > 100. && Nentries[iDCC] < threshold) && statsCheckEnabled)
208  meEmulQualitySummary.setBinContent(
210  ttid,
211  meEmulQualitySummary.maskMatches(ttid, mask, statusManager_, GetTrigTowerMap()) ? kMBad : kBad);
212  }
213 
214  } // producePlots()
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:48
static const int PHYSICS_BAD_CHANNEL_WARNING
MESet & at(const std::string &key)
Definition: MESet.h:399
T sqrt(T t)
Definition: SSEVec.h:19
StatusManager const * statusManager_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
MESetCollection sources_
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Timestamp timestamp_
Definition: DQWorker.h:134
MESetCollection MEs_
Definition: DQWorker.h:131
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
Definition: DQWorker.cc:155

◆ setParams()

void ecaldqm::TrigPrimClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 18 of file TrigPrimClient.cc.

References l1extraParticles_cfi::_params, ecaldqm::MESetCollection::erase(), errorFractionThreshold_, ecaldqm::DQWorker::MEs_, minEntries_, sourceFromEmul_, ecaldqm::DQWorkerClient::sources_, AlCaHLTBitMon_QueryRunRegistry::string, and TTF4MaskingAlarmThreshold_.

18  {
19  minEntries_ = _params.getUntrackedParameter<int>("minEntries");
20  errorFractionThreshold_ = _params.getUntrackedParameter<double>("errorFractionThreshold");
21  TTF4MaskingAlarmThreshold_ = _params.getUntrackedParameter<double>("TTF4MaskingAlarmThreshold");
22  sourceFromEmul_ = _params.getUntrackedParameter<bool>("sourceFromEmul");
23  if (!sourceFromEmul_) {
24  MEs_.erase(std::string("NonSingleSummary"));
25  MEs_.erase(std::string("TimingSummary"));
26  sources_.erase(std::string("EtEmulError"));
27  sources_.erase(std::string("MatchedIndex"));
28  }
29  }
MESetCollection sources_
MESetCollection MEs_
Definition: DQWorker.h:131
void erase(const std::string &key)
Definition: MESet.h:390

Member Data Documentation

◆ errorFractionThreshold_

float ecaldqm::TrigPrimClient::errorFractionThreshold_
private

Definition at line 18 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().

◆ minEntries_

int ecaldqm::TrigPrimClient::minEntries_
private

Definition at line 17 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().

◆ sourceFromEmul_

bool ecaldqm::TrigPrimClient::sourceFromEmul_
private

Definition at line 21 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().

◆ TTF4MaskingAlarmThreshold_

float ecaldqm::TrigPrimClient::TTF4MaskingAlarmThreshold_
private

Definition at line 19 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().