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 ()
 
- 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 &)
 
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 ()(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 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 14 of file TimingClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

14  :
16  toleranceMean_(0.),
18  toleranceRMS_(0.),
19  toleranceRMSFwd_(0.),
25  {
26  qualitySummaries_.insert("Quality");
27  qualitySummaries_.insert("QualitySummary");
28  }
std::set< std::string > qualitySummaries_
ecaldqm::TimingClient::~TimingClient ( )
inline

Definition at line 11 of file TimingClient.h.

References producePlots(), and setParams().

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 45 of file TimingClient.cc.

References funct::abs(), EcalTrigTowerConstituentsMap::constituentsOf(), DEFINE_ECALDQM_WORKER, EcalBarrel, EcalEndcap, EcalTriggerTower, ecaldqm::MESet::fill(), ecaldqm::MESet::ConstBin::getBinContent(), ecaldqm::MESet::ConstBin::getBinEntries(), ecaldqm::MESet::ConstBin::getBinError(), ecaldqm::getTrigTowerMap(), triggerObjects_cff::id, photons_cff::ids, 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, RecoTauDiscriminantConfiguration::mask, SiStripPI::mean, ecaldqm::DQWorker::MEs_, minChannelEntries_, minChannelEntriesFwd_, minTowerEntries_, minTowerEntriesFwd_, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, jets_cff::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().

Referenced by ~TimingClient().

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

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

Referenced by ~TimingClient().

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

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