CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
- 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 ()
 
bool retrieveSource (DQMStore::IGetter &, ProcessType)
 
bool runsOn (ProcessType _type) const
 
void setStatusManager (StatusManager const &_manager)
 
virtual ~DQWorkerClient ()
 
- 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 &)
 
std::string const & 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 ()
 

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

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

Definition at line 11 of file TimingClient.h.

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 44 of file TimingClient.cc.

References funct::abs(), EcalTrigTowerConstituentsMap::constituentsOf(), EcalBarrel, EcalTriggerTower, python.tagInventory::entries, ecaldqm::MESet::ConstBin::getBinContent(), ecaldqm::MESet::ConstBin::getBinEntries(), ecaldqm::MESet::ConstBin::getBinError(), ecaldqm::getTrigTowerMap(), ecaldqm::isForward(), ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, timingPdfMaker::mean, ecaldqm::DQWorker::MEs_, LaserClient_cfi::minChannelEntries, minChannelEntries_, minChannelEntriesFwd_, TimingClient_cfi::minTowerEntries, minTowerEntries_, minTowerEntriesFwd_, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, HLT_25ns14e33_v1_cff::quality, plotscripts::rms(), ecaldqm::scConstituents(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, EBDetId::switchZSide(), EEDetId::switchZSide(), tailPopulThreshold_, toleranceMean_, toleranceMeanFwd_, toleranceRMS_, toleranceRMSFwd_, ecaldqm::MESet::iterator::toNextChannel(), EBDetId::zside(), and EEDetId::zside().

45  {
46  MESet& meQuality(MEs_.at("Quality"));
47  MESet& meMeanSM(MEs_.at("MeanSM"));
48  MESet& meMeanAll(MEs_.at("MeanAll"));
49  MESet& meFwdBkwdDiff(MEs_.at("FwdBkwdDiff"));
50  MESet& meFwdvBkwd(MEs_.at("FwdvBkwd"));
51  MESet& meRMSMap(MEs_.at("RMSMap"));
52  MESet& meRMSAll(MEs_.at("RMSAll"));
53  MESet& meProjEta(MEs_.at("ProjEta"));
54  MESet& meProjPhi(MEs_.at("ProjPhi"));
55  MESet& meQualitySummary(MEs_.at("QualitySummary"));
56 
57  MESet const& sTimeAllMap(sources_.at("TimeAllMap"));
58  MESet const& sTimeMap(sources_.at("TimeMap"));
59 
61 
62  MESet::iterator qEnd(meQuality.end());
63 
64  MESet::iterator rItr(meRMSMap);
65  MESet::const_iterator tItr(sTimeMap);
66 
67  for(MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
68 
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 
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  }
115  else{
116  EEDetId eeid(id);
117  if(eeid.zside() < 0){
118  negative = true;
119  EEDetId posId(EEDetId::switchZSide(eeid));
120  posTime = sTimeMap.getBinContent(posId);
121  }
122  }
123  if(negative){
124  meFwdBkwdDiff.fill(id, posTime - mean);
125  meFwdvBkwd.fill(id, mean, posTime);
126  }
127 
128  if(abs(mean) > meanThresh || rms > rmsThresh)
129  qItr->setBinContent(doMask ? kMBad : kBad);
130  else
131  qItr->setBinContent(doMask ? kMGood : kGood);
132  }
133 
134  MESet::iterator qsEnd(meQualitySummary.end());
135 
136  for(MESet::iterator qsItr(meQualitySummary.beginChannel()); qsItr != qsEnd; qsItr.toNextChannel()){
137 
138  DetId tId(qsItr->getId());
139 
140  std::vector<DetId> ids;
141 
142  if(tId.subdetId() == EcalTriggerTower)
144  else
145  ids = scConstituents(EcalScDetId(tId));
146 
148  float meanThresh(toleranceMean_);
149  float rmsThresh(toleranceRMS_);
150 
151  if(isForward(tId)){
153  meanThresh = toleranceMeanFwd_;
154  rmsThresh = toleranceRMSFwd_;
155  }
156 
157  // tower entries != sum(channel entries) because of the difference in timing cut at the source
158  float summaryEntries(sTimeAllMap.getBinEntries(tId));
159 
160  float towerEntries(0.);
161  float towerMean(0.);
162  float towerMean2(0.);
163 
164  bool doMask(false);
165 
166  for(std::vector<DetId>::iterator idItr(ids.begin()); idItr != ids.end(); ++idItr){
167  DetId& id(*idItr);
168 
169  doMask |= meQuality.maskMatches(id, mask, statusManager_);
170 
171  MESet::const_iterator tmItr(sTimeMap, id);
172 
173  float entries(tmItr->getBinEntries());
174  if(entries < 0.) continue;
175  towerEntries += entries;
176  float mean(tmItr->getBinContent());
177  towerMean += mean * entries;
178  float rms(tmItr->getBinError() * sqrt(entries));
179  towerMean2 += (rms * rms + mean * mean) * entries;
180  }
181 
182  double quality(doMask ? kMUnknown : kUnknown);
183  if(towerEntries / ids.size() > minTowerEntries / 25.){
184  if(summaryEntries < towerEntries * (1. - tailPopulThreshold_)) // large timing deviation
185  quality = doMask ? kMBad : kBad;
186  else{
187  towerMean /= towerEntries;
188  towerMean2 /= towerEntries;
189 
190  float towerRMS(sqrt(towerMean2 - towerMean * towerMean));
191 
192  if(abs(towerMean) > meanThresh || towerRMS > rmsThresh)
193  quality = doMask ? kMBad : kBad;
194  else
195  quality = doMask ? kMGood : kGood;
196  }
197  }
198  qsItr->setBinContent(quality);
199  }
200  }
static const int PHYSICS_BAD_CHANNEL_WARNING
bool isForward(DetId const &)
EBDetId switchZSide() const
Definition: EBDetId.cc:82
T sqrt(T t)
Definition: SSEVec.h:48
EcalTrigTowerConstituentsMap const * getTrigTowerMap()
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:487
Definition: DetId.h:18
MESetCollection MEs_
Definition: DQWorker.h:75
std::vector< DetId > scConstituents(EcalScDetId const &)
void ecaldqm::TimingClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 30 of file TimingClient.cc.

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

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

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