CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 &)
 
 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

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)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken
< EcalElectronicsMapping,
EcalMappingRcd
elecMapHandle
 
edm::ESGetToken
< EcalElectronicsMapping,
EcalMappingRcd
elecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geomHandle
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geomHandleEndLumi
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topoHandle
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topoHandleEndLumi
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapHandle
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapHandleEndLumi
 
- 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

ecaldqm::TimingClient::TimingClient ( )

Definition at line 13 of file TimingClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

14  : DQWorkerClient(),
15  toleranceMean_(0.),
17  toleranceRMS_(0.),
18  toleranceRMSFwd_(0.),
24  qualitySummaries_.insert("Quality");
25  qualitySummaries_.insert("QualitySummary");
26  }
std::set< std::string > qualitySummaries_
ecaldqm::TimingClient::~TimingClient ( )
inlineoverride

Definition at line 11 of file TimingClient.h.

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 40 of file TimingClient.cc.

References funct::abs(), ecaldqm::MESetCollection::at(), EcalTrigTowerConstituentsMap::constituentsOf(), EcalBarrel, EcalEndcap, EcalTriggerTower, ecaldqm::MESet::fill(), ecaldqm::MESet::ConstBin::getBinContent(), ecaldqm::MESet::ConstBin::getBinEntries(), ecaldqm::MESet::ConstBin::getBinError(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), gpuClustering::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, 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().

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 28 of file TimingClient.cc.

References edm::ParameterSet::getUntrackedParameter(), minChannelEntries_, minChannelEntriesFwd_, minTowerEntries_, minTowerEntriesFwd_, tailPopulThreshold_, toleranceMean_, toleranceMeanFwd_, toleranceRMS_, and toleranceRMSFwd_.

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  }

Member Data Documentation

int ecaldqm::TimingClient::minChannelEntries_
private

Definition at line 22 of file TimingClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::TimingClient::minChannelEntriesFwd_
private

Definition at line 23 of file TimingClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::TimingClient::minTowerEntries_
private

Definition at line 24 of file TimingClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::TimingClient::minTowerEntriesFwd_
private

Definition at line 25 of file TimingClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::TimingClient::tailPopulThreshold_
private

Definition at line 26 of file TimingClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::TimingClient::toleranceMean_
private

Definition at line 18 of file TimingClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::TimingClient::toleranceMeanFwd_
private

Definition at line 19 of file TimingClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::TimingClient::toleranceRMS_
private

Definition at line 20 of file TimingClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::TimingClient::toleranceRMSFwd_
private

Definition at line 21 of file TimingClient.h.

Referenced by producePlots(), and setParams().