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)
 
 ~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 &)
 
 DQWorker ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
const std::string & getName () const
 
bool onlineMode () const
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setTime (time_t _t)
 
virtual ~DQWorker () noexcept(false)
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

int minChannelEntries_
 
int minChannelEntriesFwd_
 
int minTowerEntries_
 
int minTowerEntriesFwd_
 
float tailPopulThreshold_
 
float toleranceMean_
 
float toleranceMeanFwd_
 
float toleranceRMS_
 
float toleranceRMSFwd_
 

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)
 
- 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.

14  : DQWorkerClient(),
15  toleranceMean_(0.),
17  toleranceRMS_(0.),
18  toleranceRMSFwd_(0.),
24  qualitySummaries_.insert("Quality");
25  qualitySummaries_.insert("QualitySummary");
26  }

References ecaldqm::DQWorkerClient::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 40 of file TimingClient.cc.

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

References funct::abs(), EcalTrigTowerConstituentsMap::constituentsOf(), EcalBarrel, EcalEndcap, EcalTriggerTower, ecaldqm::MESet::fill(), ecaldqm::MESet::ConstBin::getBinContent(), ecaldqm::MESet::ConstBin::getBinEntries(), ecaldqm::MESet::ConstBin::getBinError(), ecaldqm::getTrigTowerMap(), triggerObjects_cff::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, SiStripPI::mean, ecaldqm::DQWorker::MEs_, LaserClient_cfi::minChannelEntries, minChannelEntries_, minChannelEntriesFwd_, TimingClient_cfi::minTowerEntries, minTowerEntries_, minTowerEntriesFwd_, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, qcdUeDQM_cfi::quality, SiStripPI::rms, ecaldqm::scConstituents(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, EBDetId::switchZSide(), EEDetId::switchZSide(), tailPopulThreshold_, ecaldqm::DQWorker::timestamp_, toleranceMean_, toleranceMeanFwd_, toleranceRMS_, toleranceRMSFwd_, ecaldqm::MESet::iterator::toNextChannel(), EBDetId::zside(), and EEDetId::zside().

◆ setParams()

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 28 of file TimingClient.cc.

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

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

Member Data Documentation

◆ minChannelEntries_

int ecaldqm::TimingClient::minChannelEntries_
private

Definition at line 22 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minChannelEntriesFwd_

int ecaldqm::TimingClient::minChannelEntriesFwd_
private

Definition at line 23 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minTowerEntries_

int ecaldqm::TimingClient::minTowerEntries_
private

Definition at line 24 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ minTowerEntriesFwd_

int ecaldqm::TimingClient::minTowerEntriesFwd_
private

Definition at line 25 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ tailPopulThreshold_

float ecaldqm::TimingClient::tailPopulThreshold_
private

Definition at line 26 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceMean_

float ecaldqm::TimingClient::toleranceMean_
private

Definition at line 18 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceMeanFwd_

float ecaldqm::TimingClient::toleranceMeanFwd_
private

Definition at line 19 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMS_

float ecaldqm::TimingClient::toleranceRMS_
private

Definition at line 20 of file TimingClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMSFwd_

float ecaldqm::TimingClient::toleranceRMSFwd_
private

Definition at line 21 of file TimingClient.h.

Referenced by producePlots(), and setParams().

ecaldqm::TimingClient::toleranceMean_
float toleranceMean_
Definition: TimingClient.h:18
ecaldqm::TimingClient::minChannelEntries_
int minChannelEntries_
Definition: TimingClient.h:22
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
EBDetId
Definition: EBDetId.h:17
EEDetId::switchZSide
EEDetId switchZSide() const
Definition: EEDetId.cc:402
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::DQWorkerClient::statusManager_
StatusManager const * statusManager_
Definition: DQWorkerClient.h:60
ecaldqm::TimingClient::toleranceMeanFwd_
float toleranceMeanFwd_
Definition: TimingClient.h:19
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
ecaldqm::isForward
bool isForward(DetId const &)
Definition: EcalDQMCommonUtils.cc:243
EcalBarrel
Definition: EcalSubdetector.h:10
DetId
Definition: DetId.h:17
ecaldqm::TimingClient::minChannelEntriesFwd_
int minChannelEntriesFwd_
Definition: TimingClient.h:23
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:56
ecaldqm::TimingClient::toleranceRMS_
float toleranceRMS_
Definition: TimingClient.h:20
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
EcalScDetId
Definition: EcalScDetId.h:24
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
EEDetId
Definition: EEDetId.h:14
ecaldqm::DQWorkerClient::kMBad
Definition: DQWorkerClient.h:37
EcalEndcap
Definition: EcalSubdetector.h:10
ecaldqm::DQWorkerClient::kUnknown
Definition: DQWorkerClient.h:37
ecaldqm::DQWorkerClient::kBad
Definition: DQWorkerClient.h:37
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:55
ecaldqm::DQWorkerClient::kMGood
Definition: DQWorkerClient.h:37
LaserClient_cfi.minChannelEntries
minChannelEntries
Definition: LaserClient_cfi.py:8
EcalChannelStatusCode::kOk
Definition: EcalChannelStatusCode.h:21
ecaldqm::DQWorkerClient::kMUnknown
Definition: DQWorkerClient.h:37
ecaldqm::DQWorkerClient::DQWorkerClient
DQWorkerClient()
Definition: DQWorkerClient.cc:17
TimingClient_cfi.minTowerEntries
minTowerEntries
Definition: TimingClient_cfi.py:7
ecaldqm::getTrigTowerMap
const EcalTrigTowerConstituentsMap * getTrigTowerMap()
Definition: EcalDQMCommonUtils.cc:458
EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING
static const int PHYSICS_BAD_CHANNEL_WARNING
Definition: EcalDQMStatusHelper.h:46
ecaldqm::TimingClient::minTowerEntries_
int minTowerEntries_
Definition: TimingClient.h:24
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
ecaldqm::scConstituents
std::vector< DetId > scConstituents(EcalScDetId const &)
Definition: EcalDQMCommonUtils.cc:173
ecaldqm::TimingClient::minTowerEntriesFwd_
int minTowerEntriesFwd_
Definition: TimingClient.h:25
EBDetId::switchZSide
EBDetId switchZSide() const
Definition: EBDetId.cc:72
EcalTriggerTower
Definition: EcalSubdetector.h:10
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
EcalTrigTowerConstituentsMap::constituentsOf
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
Definition: EcalTrigTowerConstituentsMap.cc:162
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:37
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:81
ecaldqm::TimingClient::toleranceRMSFwd_
float toleranceRMSFwd_
Definition: TimingClient.h:21
ecaldqm::TimingClient::tailPopulThreshold_
float tailPopulThreshold_
Definition: TimingClient.h:26
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22