CMS 3D CMS Logo

PresampleClient.cc
Go to the documentation of this file.
2 
4 
7 
9 
10 #include <cmath>
11 
12 namespace ecaldqm {
14  : DQWorkerClient(),
15  minChannelEntries_(0),
16  expectedMean_(0.),
17  toleranceLow_(0.),
18  toleranceHigh_(0.),
19  toleranceRMS_(0.),
20  toleranceRMSFwd_(0.) {
21  qualitySummaries_.insert("Quality");
22  qualitySummaries_.insert("QualitySummary");
23  }
24 
26  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
27  expectedMean_ = _params.getUntrackedParameter<double>("expectedMean");
28  toleranceLow_ = _params.getUntrackedParameter<double>("toleranceLow");
29  toleranceHigh_ = _params.getUntrackedParameter<double>("toleranceHigh");
30  toleranceRMS_ = _params.getUntrackedParameter<double>("toleranceRMS");
31  toleranceRMSFwd_ = _params.getUntrackedParameter<double>("toleranceRMSFwd");
32  }
33 
35  MESet& meQualitySummary(MEs_.at("QualitySummary"));
36  MESet& meQuality(MEs_.at("Quality"));
37  MESet& meErrorsSummary(MEs_.at("ErrorsSummary"));
38  MESet& meMean(MEs_.at("Mean"));
39  MESet& meRMS(MEs_.at("RMS"));
40  MESet& meRMSMap(MEs_.at("RMSMap"));
41  MESet& meRMSMapAll(MEs_.at("RMSMapAll"));
42  MESet& meRMSMapAllByLumi(MEs_.at("RMSMapAllByLumi"));
43 
44  MESet const& sPedestal(sources_.at("Pedestal"));
45  MESet const& sPedestalByLS(sources_.at("PedestalByLS"));
46  MESet const& sChStatus(sources_.at("ChStatus"));
47 
50 
51  MESet::iterator qEnd(meQuality.end());
52 
53  MESet::const_iterator pItr(sPedestal);
54  MESet::const_iterator pLSItr(sPedestalByLS);
55  double maxEB(0.), minEB(0.), maxEE(0.), minEE(0.);
56  double rmsMaxEB(0.), rmsMaxEE(0.);
57  for (MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()) {
58  pItr = qItr;
59  pLSItr = qItr;
60 
61  DetId id(qItr->getId());
62 
63  bool doMask(meQuality.maskMatches(id, mask, statusManager_));
64 
65  double rmsThresh(toleranceRMS_);
66 
67  if (isForward(id))
68  rmsThresh = toleranceRMSFwd_;
69 
70  double entries(pItr->getBinEntries());
71  double entriesLS(pLSItr->getBinEntries());
72 
73  if (entries < minChannelEntries_) {
74  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
75  meQualitySummary.setBinContent(id, doMask ? kMUnknown : kUnknown);
76  meRMSMap.setBinContent(id, -1.);
77  continue;
78  }
79 
80  double mean(pItr->getBinContent());
81  double meanLS(pLSItr->getBinContent());
82  double rms(pItr->getBinError() * std::sqrt(entries));
83  double rmsLS(pLSItr->getBinError() * std::sqrt(entriesLS));
84 
85  int dccid(dccId(id));
86 
87  meMean.fill(dccid, mean);
88  meRMS.fill(dccid, rms);
89  meRMSMap.setBinContent(id, rms);
90  meRMSMapAllByLumi.setBinContent(id, rmsLS);
91 
92  if (((mean > expectedMean_ + toleranceHigh_) || (mean < expectedMean_ - toleranceLow_)) || rms > rmsThresh) {
93  qItr->setBinContent(doMask ? kMBad : kBad);
94  meQualitySummary.setBinContent(id, doMask ? kMBad : kBad);
95  if (!doMask)
96  meErrorsSummary.fill(id);
97  } else {
98  qItr->setBinContent(doMask ? kMGood : kGood);
99  meQualitySummary.setBinContent(id, doMask ? kMGood : kGood);
100  }
101 
102  // Fill Presample Trend plots:
103  // Use PedestalByLS which only contains digis from "current" LS
104  float chStatus(sChStatus.getBinContent(id));
105  if (entriesLS < minChannelEntries_)
106  continue;
107  if (chStatus != EcalChannelStatusCode::kOk)
108  continue; // exclude problematic channels
109 
110  // Get max/min
111  // Min is effectively just 0
112  if (id.subdetId() == EcalBarrel) {
113  if (meanLS > maxEB)
114  maxEB = meanLS;
115  if (meanLS < minEB)
116  minEB = meanLS;
117  if (rmsLS > rmsMaxEB)
118  rmsMaxEB = rmsLS;
119  } else {
120  if (meanLS > maxEE)
121  maxEE = meanLS;
122  if (meanLS < minEE)
123  minEE = meanLS;
124  if (rmsLS > rmsMaxEE)
125  rmsMaxEE = rmsLS;
126  }
127 
128  } // qItr
129 
130  towerAverage_(meRMSMapAll, meRMSMap, -1.);
131 
132  MESet& meTrendMean(MEs_.at("TrendMean"));
133  MESet& meTrendRMS(MEs_.at("TrendRMS"));
134  meTrendMean.fill(EcalBarrel, double(timestamp_.iLumi), maxEB - minEB);
135  meTrendMean.fill(EcalEndcap, double(timestamp_.iLumi), maxEE - minEE);
136  meTrendRMS.fill(EcalBarrel, double(timestamp_.iLumi), rmsMaxEB);
137  meTrendRMS.fill(EcalEndcap, double(timestamp_.iLumi), rmsMaxEE);
138  }
139 
141 } // namespace ecaldqm
ecaldqm::PresampleClient::minChannelEntries_
int minChannelEntries_
Definition: PresampleClient.h:17
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
ecaldqm
Definition: DQWorker.h:24
ecaldqm::MESet::ConstBin::getBinContent
double getBinContent() const
Definition: MESet.h:164
ecaldqm::PresampleClient::producePlots
void producePlots(ProcessType) override
Definition: PresampleClient.cc:34
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::DQWorkerClient::statusManager_
StatusManager const * statusManager_
Definition: DQWorkerClient.h:60
ecaldqm::PresampleClient::toleranceHigh_
float toleranceHigh_
Definition: PresampleClient.h:20
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
ecaldqm::isForward
bool isForward(DetId const &)
Definition: EcalDQMCommonUtils.cc:243
EcalBarrel
Definition: EcalSubdetector.h:10
EcalDQMStatusHelper.h
ecaldqm::PresampleClient::toleranceRMS_
float toleranceRMS_
Definition: PresampleClient.h:21
ecaldqm::MESet::fill
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
DetId
Definition: DetId.h:17
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:56
ecaldqm::PresampleClient::expectedMean_
float expectedMean_
Definition: PresampleClient.h:18
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:15
ecaldqm::MESet::iterator::toNextChannel
const_iterator & toNextChannel()
Definition: MESet.h:289
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
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::MESet::ConstBin::getBinEntries
double getBinEntries() const
Definition: MESet.h:176
ecaldqm::DQWorkerClient::kMGood
Definition: DQWorkerClient.h:37
edm::ParameterSet
Definition: ParameterSet.h:47
EcalChannelStatusCode::kOk
Definition: EcalChannelStatusCode.h:21
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:362
ecaldqm::MESet::iterator
Definition: MESet.h:268
ecaldqm::DQWorkerClient::kMUnknown
Definition: DQWorkerClient.h:37
ecaldqm::DQWorkerClient
Definition: DQWorkerClient.h:13
ecaldqm::PresampleClient
Definition: PresampleClient.h:7
EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
Definition: EcalDQMStatusHelper.h:24
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:25
ecaldqm::MESet::const_iterator
Definition: MESet.h:245
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ecaldqm::DQWorkerClient::towerAverage_
void towerAverage_(MESet &, MESet const &, float)
Definition: DQWorkerClient.cc:159
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:37
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:81
ecaldqm::PresampleClient::toleranceLow_
float toleranceLow_
Definition: PresampleClient.h:19
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:112
ParameterSet.h
PresampleClient.h
ecaldqm::PresampleClient::setParams
void setParams(edm::ParameterSet const &) override
Definition: PresampleClient.cc:25
ecaldqm::PresampleClient::PresampleClient
PresampleClient()
Definition: PresampleClient.cc:13
ecaldqm::PresampleClient::toleranceRMSFwd_
float toleranceRMSFwd_
Definition: PresampleClient.h:22
EcalChannelStatusCode.h
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:27
ecaldqm::dccId
unsigned dccId(DetId const &)
Definition: EcalDQMCommonUtils.cc:16
ecaldqm::MESet::ConstBin::getBinError
double getBinError() const
Definition: MESet.h:170