test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PresampleClient.cc
Go to the documentation of this file.
1 #include "../interface/PresampleClient.h"
2 
4 
6 
8 
9 #include <cmath>
10 
11 namespace ecaldqm
12 {
15  minChannelEntries_(0),
16  expectedMean_(0.),
17  toleranceMean_(0.),
18  toleranceRMS_(0.),
19  toleranceRMSFwd_(0.)
20  {
21  qualitySummaries_.insert("Quality");
22  qualitySummaries_.insert("QualitySummary");
23  }
24 
25  void
27  {
28  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
29  expectedMean_ = _params.getUntrackedParameter<double>("expectedMean");
30  toleranceMean_ = _params.getUntrackedParameter<double>("toleranceMean");
31  toleranceRMS_ = _params.getUntrackedParameter<double>("toleranceRMS");
32  toleranceRMSFwd_ = _params.getUntrackedParameter<double>("toleranceRMSFwd");
33  }
34 
35  void
37  {
38  MESet& meQualitySummary(MEs_.at("QualitySummary"));
39  MESet& meQuality(MEs_.at("Quality"));
40  MESet& meErrorsSummary(MEs_.at("ErrorsSummary"));
41  MESet& meMean(MEs_.at("Mean"));
42  MESet& meRMS(MEs_.at("RMS"));
43  MESet& meRMSMap(MEs_.at("RMSMap"));
44  MESet& meRMSMapAll(MEs_.at("RMSMapAll"));
45 
46  MESet const& sPedestal(sources_.at("Pedestal"));
47 
50 
51  MESet::iterator qEnd(meQuality.end());
52 
53  MESet::const_iterator pItr(sPedestal);
54  double maxEB(0.), minEB(0.), maxEE(0.), minEE(0.);
55  double rmsMaxEB(0.), rmsMaxEE(0.);
56  for(MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
57 
58  pItr = qItr;
59 
60  DetId id(qItr->getId());
61 
62  bool doMask(meQuality.maskMatches(id, mask, statusManager_));
63 
64  double rmsThresh(toleranceRMS_);
65 
66  if(isForward(id)) rmsThresh = toleranceRMSFwd_;
67 
68  double entries(pItr->getBinEntries());
69 
71  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
72  meQualitySummary.setBinContent(id, doMask ? kMUnknown : kUnknown);
73  meRMSMap.setBinContent(id, -1.);
74  continue;
75  }
76 
77  double mean(pItr->getBinContent());
78  double rms(pItr->getBinError() * std::sqrt(entries));
79 
80  int dccid(dccId(id));
81 
82  meMean.fill(dccid, mean);
83  meRMS.fill(dccid, rms);
84  meRMSMap.setBinContent(id, rms);
85 
86  if(std::abs(mean - expectedMean_) > toleranceMean_ || rms > rmsThresh){
87  qItr->setBinContent(doMask ? kMBad : kBad);
88  meQualitySummary.setBinContent(id, doMask ? kMBad : kBad);
89  if(!doMask) meErrorsSummary.fill(id);
90  }
91  else{
92  qItr->setBinContent(doMask ? kMGood : kGood);
93  meQualitySummary.setBinContent(id, doMask ? kMGood : kGood);
94  }
95 
96  if(id.subdetId() == EcalBarrel){
97  if(mean > maxEB) maxEB = mean;
98  if(mean < minEB) minEB = mean;
99  if(rms > rmsMaxEB) rmsMaxEB = rms;
100  }
101  else{
102  if(mean > maxEE) maxEE = mean;
103  if(mean < minEE) minEE = mean;
104  if(rms > rmsMaxEE) rmsMaxEE = rms;
105  }
106  }
107 
108  towerAverage_(meRMSMapAll, meRMSMap, -1.);
109 
110  MESet& meTrendMean(MEs_.at("TrendMean"));
111  MESet& meTrendRMS(MEs_.at("TrendRMS"));
112  meTrendMean.fill(EcalBarrel, double(timestamp_.iLumi), maxEB - minEB);
113  meTrendMean.fill(EcalEndcap, double(timestamp_.iLumi), maxEE - minEE);
114  meTrendRMS.fill(EcalBarrel, double(timestamp_.iLumi), rmsMaxEB);
115  meTrendRMS.fill(EcalEndcap, double(timestamp_.iLumi), rmsMaxEE);
116  }
117 
119 }
T getUntrackedParameter(std::string const &, T const &) const
void towerAverage_(MESet &, MESet const &, float)
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:108
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
bool isForward(DetId const &)
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
const_iterator & toNextChannel()
Definition: MESet.h:271
void setParams(edm::ParameterSet const &) override
std::set< std::string > qualitySummaries_
T sqrt(T t)
Definition: SSEVec.h:48
StatusManager const * statusManager_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MESetCollection sources_
Definition: DetId.h:18
Timestamp timestamp_
Definition: DQWorker.h:78
static const int PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
MESetCollection MEs_
Definition: DQWorker.h:75
void producePlots(ProcessType) override
unsigned dccId(DetId const &)