CMS 3D CMS Logo

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

#include <TimingClient.h>

Inheritance diagram for ecaldqm::TimingClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

void producePlots (ProcessType) override
 
 TimingClient ()
 
 ~TimingClient () 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 ebtoleranceMean_
 
float eetoleranceMean_
 
int minChannelEntries_
 
int minChannelEntriesFwd_
 
int minTowerEntries_
 
int minTowerEntriesFwd_
 
float tailPopulThreshold_
 
float toleranceMeanFwd_
 
float toleranceRMS_
 
float toleranceRMSFwd_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DQWorkerClient
enum  ProcessType { kLumi, kJob, nProcessType }
 
- 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
 
- Static Public Attributes inherited from ecaldqm::DQWorkerClient
static constexpr int kBad = 0
 
static constexpr int kGood = 1
 
static constexpr int kMBad = 3
 
static constexpr int kMGood = 4
 
static constexpr int kMUnknown = 5
 
static constexpr int kUnknown = 2
 
- 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 8 of file TimingClient.h.

Constructor & Destructor Documentation

◆ TimingClient()

ecaldqm::TimingClient::TimingClient ( )

Definition at line 13 of file TimingClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

14  : DQWorkerClient(),
15  ebtoleranceMean_(0.),
16  eetoleranceMean_(0.),
18  toleranceRMS_(0.),
19  toleranceRMSFwd_(0.),
25  qualitySummaries_.insert("Quality");
26  qualitySummaries_.insert("QualitySummary");
27  }
std::set< std::string > qualitySummaries_

◆ ~TimingClient()

ecaldqm::TimingClient::~TimingClient ( )
inlineoverride

Definition at line 11 of file TimingClient.h.

11 {}

Member Function Documentation

◆ producePlots()

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

Implements ecaldqm::DQWorkerClient.

Definition at line 42 of file TimingClient.cc.

References funct::abs(), ecaldqm::MESetCollection::at(), EcalTrigTowerConstituentsMap::constituentsOf(), ebtoleranceMean_, EcalBarrel, EcalEndcap, EcalTriggerTower, eetoleranceMean_, ecaldqm::MESet::fill(), ecaldqm::MESet::ConstBin::getBinContent(), ecaldqm::MESet::ConstBin::getBinEntries(), ecaldqm::MESet::ConstBin::getBinError(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), EcalPhiSymFlatTableProducers_cfi::id, ecaldqm::DQWorker::Timestamp::iLumi, ecaldqm::isForward(), ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, EcalChannelStatusCode::kOk, ecaldqm::DQWorkerClient::kUnknown, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, SiStripPI::mean, ecaldqm::DQWorker::MEs_, LaserClient_cfi::minChannelEntries, minChannelEntries_, minChannelEntriesFwd_, TimingClient_cfi::minTowerEntries, minTowerEntries_, minTowerEntriesFwd_, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, quality, SiStripPI::rms, ecaldqm::scConstituents(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, EBDetId::switchZSide(), EEDetId::switchZSide(), tailPopulThreshold_, ecaldqm::DQWorker::timestamp_, toleranceMeanFwd_, toleranceRMS_, toleranceRMSFwd_, ecaldqm::MESet::iterator::toNextChannel(), EBDetId::zside(), and EEDetId::zside().

42  {
43  MESet& meQuality(MEs_.at("Quality"));
44  MESet& meMeanSM(MEs_.at("MeanSM"));
45  MESet& meMeanAll(MEs_.at("MeanAll"));
46  MESet& meFwdBkwdDiff(MEs_.at("FwdBkwdDiff"));
47  MESet& meFwdvBkwd(MEs_.at("FwdvBkwd"));
48  MESet& meRMSMap(MEs_.at("RMSMap"));
49  MESet& meRMSAll(MEs_.at("RMSAll"));
50  MESet& meProjEta(MEs_.at("ProjEta"));
51  MESet& meProjPhi(MEs_.at("ProjPhi"));
52  MESet& meQualitySummary(MEs_.at("QualitySummary"));
53 
54  MESet const& sTimeAllMap(sources_.at("TimeAllMap"));
55  MESet const& sTimeMap(sources_.at("TimeMap"));
56  MESet const& sTimeMapByLS(sources_.at("TimeMapByLS"));
57  MESet const& sChStatus(sources_.at("ChStatus"));
58 
60 
61  MESet::iterator qEnd(meQuality.end(GetElectronicsMap()));
62 
63  MESet::iterator rItr(GetElectronicsMap(), meRMSMap);
64  MESet::const_iterator tItr(GetElectronicsMap(), sTimeMap);
65  MESet::const_iterator tLSItr(GetElectronicsMap(), sTimeMapByLS);
66 
67  float EBentries(0.), EEentries(0.);
68  float EBmean(0.), EEmean(0.);
69  float EBrms(0.), EErms(0.);
70  for (MESet::iterator qItr(meQuality.beginChannel(GetElectronicsMap())); qItr != qEnd;
71  qItr.toNextChannel(GetElectronicsMap())) {
72  tItr = qItr;
73  rItr = qItr;
74 
75  DetId id(qItr->getId());
76 
78  float meanThresh;
79  float rmsThresh(toleranceRMS_);
80 
81  if (id.subdetId() == EcalBarrel)
82  meanThresh = ebtoleranceMean_;
83  else
84  meanThresh = eetoleranceMean_;
85 
86  if (isForward(id)) {
88  meanThresh = toleranceMeanFwd_;
89  rmsThresh = toleranceRMSFwd_;
90  }
91 
92  bool doMask(meQuality.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
93 
94  float entries(tItr->getBinEntries());
95 
96  if (entries < minChannelEntries) {
97  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
98  rItr->setBinContent(-1.);
99  continue;
100  }
101 
102  float mean(tItr->getBinContent());
103  float rms(tItr->getBinError() * sqrt(entries));
104 
105  meMeanSM.fill(getEcalDQMSetupObjects(), id, mean);
106  meMeanAll.fill(getEcalDQMSetupObjects(), id, mean);
107  meProjEta.fill(getEcalDQMSetupObjects(), id, mean);
108  meProjPhi.fill(getEcalDQMSetupObjects(), id, mean);
109  meRMSAll.fill(getEcalDQMSetupObjects(), id, rms);
110  rItr->setBinContent(rms);
111 
112  bool negative(false);
113  float posTime(0.);
114 
115  if (id.subdetId() == EcalBarrel) {
116  EBDetId ebid(id);
117  if (ebid.zside() < 0) {
118  negative = true;
119  EBDetId posId(EBDetId::switchZSide(ebid));
120  posTime = sTimeMap.getBinContent(getEcalDQMSetupObjects(), posId);
121  }
122  } else {
123  EEDetId eeid(id);
124  if (eeid.zside() < 0) {
125  negative = true;
126  EEDetId posId(EEDetId::switchZSide(eeid));
127  posTime = sTimeMap.getBinContent(getEcalDQMSetupObjects(), posId);
128  }
129  }
130  if (negative) {
131  meFwdBkwdDiff.fill(getEcalDQMSetupObjects(), id, posTime - mean);
132  meFwdvBkwd.fill(getEcalDQMSetupObjects(), id, mean, posTime);
133  }
134 
135  if (std::abs(mean) > meanThresh || rms > rmsThresh)
136  qItr->setBinContent(doMask ? kMBad : kBad);
137  else
138  qItr->setBinContent(doMask ? kMGood : kGood);
139 
140  // For Trend plots:
141  tLSItr = qItr;
142  float entriesLS(tLSItr->getBinEntries());
143  float meanLS(tLSItr->getBinContent());
144  float rmsLS(tLSItr->getBinError() * sqrt(entriesLS));
145  int chStatus = static_cast<int>(sChStatus.getBinContent(getEcalDQMSetupObjects(), id));
146 
147  if (entriesLS < minChannelEntries)
148  continue;
149  if (chStatus != EcalChannelStatusCode::kOk)
150  continue; // exclude problematic channels
151 
152  // Keep running count of timing mean, rms, and N_hits
153  if (id.subdetId() == EcalBarrel) {
154  EBmean += meanLS;
155  EBrms += rmsLS;
156  EBentries += entriesLS;
157  } else {
158  EEmean += meanLS;
159  EErms += rmsLS;
160  EEentries += entriesLS;
161  }
162 
163  } // channel loop
164 
165  // Fill Timing Trend plots at each LS
166  MESet& meTrendMean(MEs_.at("TrendMean"));
167  MESet& meTrendRMS(MEs_.at("TrendRMS"));
168  if (EBentries > 0.) {
169  if (std::abs(EBmean) > 0.)
170  meTrendMean.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), EBmean / EBentries);
171  if (std::abs(EBrms) > 0.)
172  meTrendRMS.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), EBrms / EBentries);
173  }
174  if (EEentries > 0.) {
175  if (std::abs(EEmean) > 0.)
176  meTrendMean.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), EEmean / EEentries);
177  if (std::abs(EErms) > 0.)
178  meTrendRMS.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), EErms / EEentries);
179  }
180 
181  MESet::iterator qsEnd(meQualitySummary.end(GetElectronicsMap()));
182 
183  for (MESet::iterator qsItr(meQualitySummary.beginChannel(GetElectronicsMap())); qsItr != qsEnd;
184  qsItr.toNextChannel(GetElectronicsMap())) {
185  DetId tId(qsItr->getId());
186 
187  std::vector<DetId> ids;
188 
189  if (tId.subdetId() == EcalTriggerTower)
191  else
192  ids = scConstituents(EcalScDetId(tId));
193 
195  float meanThresh;
196  float rmsThresh(toleranceRMS_);
197 
198  if (tId.subdetId() == EcalBarrel)
199  meanThresh = ebtoleranceMean_;
200  else
201  meanThresh = eetoleranceMean_;
202 
203  if (isForward(tId)) {
205  meanThresh = toleranceMeanFwd_;
206  rmsThresh = toleranceRMSFwd_;
207  }
208 
209  // tower entries != sum(channel entries) because of the difference in timing cut at the source
210  float summaryEntries(sTimeAllMap.getBinEntries(getEcalDQMSetupObjects(), tId));
211 
212  float towerEntries(0.);
213  float towerMean(0.);
214  float towerMean2(0.);
215 
216  bool doMask(false);
217 
218  for (std::vector<DetId>::iterator idItr(ids.begin()); idItr != ids.end(); ++idItr) {
219  DetId& id(*idItr);
220 
221  doMask |= meQuality.maskMatches(id, mask, statusManager_, GetTrigTowerMap());
222 
223  MESet::const_iterator tmItr(GetElectronicsMap(), sTimeMap, id);
224 
225  float entries(tmItr->getBinEntries());
226  if (entries < 0.)
227  continue;
228  towerEntries += entries;
229  float mean(tmItr->getBinContent());
230  towerMean += mean * entries;
231  float rms(tmItr->getBinError() * sqrt(entries));
232  towerMean2 += (rms * rms + mean * mean) * entries;
233  }
234 
235  double quality(doMask ? kMUnknown : kUnknown);
236  if (towerEntries / ids.size() > minTowerEntries / 25.) {
237  if (summaryEntries < towerEntries * (1. - tailPopulThreshold_)) // large timing deviation
238  quality = doMask ? kMBad : kBad;
239  else {
240  towerMean /= towerEntries;
241  towerMean2 /= towerEntries;
242 
243  float towerRMS(sqrt(towerMean2 - towerMean * towerMean));
244 
245  if (std::abs(towerMean) > meanThresh || towerRMS > rmsThresh)
246  quality = doMask ? kMBad : kBad;
247  else
248  quality = doMask ? kMGood : kGood;
249  }
250  }
251  qsItr->setBinContent(quality);
252  }
253  }
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:48
static const int PHYSICS_BAD_CHANNEL_WARNING
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
MESet & at(const std::string &key)
Definition: MESet.h:401
static constexpr int kGood
static constexpr int kMUnknown
bool isForward(DetId const &)
static constexpr int kUnknown
static constexpr int kMBad
EEDetId switchZSide() const
Definition: EEDetId.cc:402
string quality
T sqrt(T t)
Definition: SSEVec.h:23
StatusManager const * statusManager_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr int kBad
EBDetId switchZSide() const
Definition: EBDetId.cc:72
MESetCollection sources_
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
Timestamp timestamp_
Definition: DQWorker.h:134
MESetCollection MEs_
Definition: DQWorker.h:131
static constexpr int kMGood
std::vector< DetId > scConstituents(EcalScDetId const &)
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
Definition: DQWorker.cc:155

◆ setParams()

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 29 of file TimingClient.cc.

References l1extraParticles_cfi::_params, ebtoleranceMean_, eetoleranceMean_, minChannelEntries_, minChannelEntriesFwd_, minTowerEntries_, minTowerEntriesFwd_, tailPopulThreshold_, toleranceMeanFwd_, toleranceRMS_, and toleranceRMSFwd_.

29  {
30  ebtoleranceMean_ = _params.getUntrackedParameter<double>("ebtoleranceMean");
31  eetoleranceMean_ = _params.getUntrackedParameter<double>("eetoleranceMean");
32  toleranceMeanFwd_ = _params.getUntrackedParameter<double>("toleranceMeanFwd");
33  toleranceRMS_ = _params.getUntrackedParameter<double>("toleranceRMS");
34  toleranceRMSFwd_ = _params.getUntrackedParameter<double>("toleranceRMSFwd");
35  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
36  minChannelEntriesFwd_ = _params.getUntrackedParameter<int>("minChannelEntriesFwd");
37  minTowerEntries_ = _params.getUntrackedParameter<int>("minTowerEntries");
38  minTowerEntriesFwd_ = _params.getUntrackedParameter<int>("minChannelEntriesFwd");
39  tailPopulThreshold_ = _params.getUntrackedParameter<double>("tailPopulThreshold");
40  }

Member Data Documentation

◆ ebtoleranceMean_

float ecaldqm::TimingClient::ebtoleranceMean_
private

Definition at line 18 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ eetoleranceMean_

float ecaldqm::TimingClient::eetoleranceMean_
private

Definition at line 19 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minChannelEntries_

int ecaldqm::TimingClient::minChannelEntries_
private

Definition at line 23 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minChannelEntriesFwd_

int ecaldqm::TimingClient::minChannelEntriesFwd_
private

Definition at line 24 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minTowerEntries_

int ecaldqm::TimingClient::minTowerEntries_
private

Definition at line 25 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minTowerEntriesFwd_

int ecaldqm::TimingClient::minTowerEntriesFwd_
private

Definition at line 26 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ tailPopulThreshold_

float ecaldqm::TimingClient::tailPopulThreshold_
private

Definition at line 27 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceMeanFwd_

float ecaldqm::TimingClient::toleranceMeanFwd_
private

Definition at line 20 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMS_

float ecaldqm::TimingClient::toleranceRMS_
private

Definition at line 21 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMSFwd_

float ecaldqm::TimingClient::toleranceRMSFwd_
private

Definition at line 22 of file TimingClient.h.

Referenced by producePlots(), and setParams().