CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::OccupancyClient Class Reference

#include <OccupancyClient.h>

Inheritance diagram for ecaldqm::OccupancyClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

 OccupancyClient ()
 
void producePlots (ProcessType) override
 
 ~OccupancyClient ()
 
- 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 ()(false)
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

float deviationThreshold_
 
int minHits_
 

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 OccupancyClient.h.

Constructor & Destructor Documentation

ecaldqm::OccupancyClient::OccupancyClient ( )

Definition at line 13 of file OccupancyClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

13  :
15  minHits_(0),
17  {
18  qualitySummaries_.insert("QualitySummary");
19  }
std::set< std::string > qualitySummaries_
ecaldqm::OccupancyClient::~OccupancyClient ( )
inline

Definition at line 11 of file OccupancyClient.h.

References producePlots(), and setParams().

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 29 of file OccupancyClient.cc.

References funct::abs(), ecaldqm::dccId(), DEFINE_ECALDQM_WORKER, EcalTrigTowerDetId::detIdFromDenseIndex(), deviationThreshold_, EcalTriggerTower, objects.autophobj::float, ecaldqm::getTrigTowerMap(), triggerObjects_cff::id, electrons_cff::ids, EcalTrigTowerDetId::ieta(), ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, EcalTrigTowerDetId::kSizeForDenseIndexing, RecoTauDiscriminantConfiguration::mask, ecaldqm::DQWorker::MEs_, minHits_, ecaldqm::nDCC, EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, jets_cff::quality, ecaldqm::scConstituents(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, electronIdCutBased_cfi::threshold, ecaldqm::MESet::const_iterator::toNextChannel(), ecaldqm::MESet::iterator::toNextChannel(), and EcalTrigTowerConstituentsMap::towerOf().

Referenced by ~OccupancyClient().

30  {
31  using namespace std;
32 
33  // number of allowed ieta indices
34  // EE-: -28 to -1 with -27, -25 empty
35  // EE+: 1 to 28 with 26, 28 empty
36  unsigned const nPhiRings(56);
37 
38  MESet& meQualitySummary(MEs_.at("QualitySummary"));
39 // MESet& meHotDigi(MEs_.at("HotDigi"));
40 // MESet& meHotRecHitThr(MEs_.at("HotRecHitThr"));
41 // MESet& meHotTPDigiThr(MEs_.at("HotTPDigiThr"));
42 
43  MESet const& sDigi(sources_.at("DigiAll"));
44  MESet const& sRecHitThr(sources_.at("RecHitThrAll"));
45  MESet const& sTPDigiThr(sources_.at("TPDigiThrAll"));
46 
50 
51  double digiPhiRingMean[nPhiRings];
52  std::fill_n(digiPhiRingMean, nPhiRings, 0.);
53  double rechitPhiRingMean[nPhiRings];
54  std::fill_n(rechitPhiRingMean, nPhiRings, 0.);
55  int numCrystals[nPhiRings]; // this is static, but is easier to count now
56  std::fill_n(numCrystals, nPhiRings, 0);
57 
58  MESet::const_iterator dEnd(sDigi.end());
59  MESet::const_iterator rItr(sRecHitThr);
60  for(MESet::const_iterator dItr(sDigi.beginChannel()); dItr != dEnd; dItr.toNextChannel()){
61  rItr = dItr;
62 
63  float entries(dItr->getBinContent());
64  float rhentries(rItr->getBinContent());
65 
66  DetId id(dItr->getId());
67  int ieta(0);
68  if(id.subdetId() == EcalTriggerTower) // barrel
69  ieta = EcalTrigTowerDetId(id).ieta();
70  else{
71  std::vector<DetId> ids(scConstituents(EcalScDetId(id)));
72  if(ids.empty()) continue;
73  ieta = getTrigTowerMap()->towerOf(ids[0]).ieta();
74  }
75 
76  unsigned index(ieta < 0 ? ieta + 28 : ieta + 27);
77 
78  digiPhiRingMean[index] += entries;
79  rechitPhiRingMean[index] += rhentries;
80  numCrystals[index] += 1;
81  }
82 
83  for(unsigned ie(0); ie < nPhiRings; ie++){
84  digiPhiRingMean[ie] /= numCrystals[ie];
85  rechitPhiRingMean[ie] /= numCrystals[ie];
86  }
87 
88  // Store # of entries for Occupancy analysis
89  std::vector<float> Nentries(nDCC,0.); // digis
90  std::vector<float> Nrhentries(nDCC,0.); // (filtered) rechits
91 
92  // second round to find hot towers
93  for(MESet::const_iterator dItr(sDigi.beginChannel()); dItr != dEnd; dItr.toNextChannel()){
94  DetId id(dItr->getId());
95 
96  bool doMask(meQualitySummary.maskMatches(id, mask, statusManager_));
97 
98  rItr = dItr;
99 
100  float entries(dItr->getBinContent());
101  float rhentries(rItr->getBinContent());
102 
103  int ieta(0);
104  if(id.subdetId() == EcalTriggerTower) // barrel
105  ieta = EcalTrigTowerDetId(id).ieta();
106  else{
107  std::vector<DetId> ids(scConstituents(EcalScDetId(id)));
108  if(ids.empty()) continue;
109  ieta = getTrigTowerMap()->towerOf(ids[0]).ieta();
110  }
111 
112  unsigned index(ieta < 0 ? ieta + 28 : ieta + 27);
113 
114  int quality(doMask ? kMGood : kGood);
115 
116  if(entries > minHits_ && entries > digiPhiRingMean[index] * deviationThreshold_){
117  // meHotDigi->fill(id);
118  quality = doMask ? kMBad : kBad;
119  }
120  if(rhentries > minHits_ && rhentries > rechitPhiRingMean[index] * deviationThreshold_){
121  // meHotRecHitThr->fill(id);
122  quality = doMask ? kMBad : kBad;
123  }
124 
125  meQualitySummary.setBinContent(id, double(quality));
126 
127  // Keep count of digis & rechits for Occupancy analysis
128  unsigned iDCC( dccId(id)-1 );
129  if ( entries > minHits_ ) Nentries[iDCC] += entries;
130  if ( rhentries > minHits_ ) Nrhentries[iDCC] += rhentries;
131 
132  }
133 
134  double tpdigiPhiRingMean[nPhiRings];
135  std::fill_n(tpdigiPhiRingMean, nPhiRings, 0.);
136 
137  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; ++iTT){
139  float entries(sTPDigiThr.getBinContent(ttid));
140 
141  unsigned index(ttid.ieta() < 0 ? ttid.ieta() + 28 : ttid.ieta() + 27);
142 
143  tpdigiPhiRingMean[index] += entries;
144  }
145 
146  for(int ie(0); ie < 28; ie++){
147  float denom(-1.);
148  if(ie < 27) denom = 72.;
149  else denom = 36.;
150  tpdigiPhiRingMean[ie] /= denom;
151  tpdigiPhiRingMean[55 - ie] /= denom;
152  }
153 
154  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; ++iTT){
156 
157  float entries(sTPDigiThr.getBinContent(ttid));
158 
159  unsigned index(ttid.ieta() < 0 ? ttid.ieta() + 28 : ttid.ieta() + 27);
160 
161  int quality(kGood);
162 
163  if(entries > minHits_ && entries > tpdigiPhiRingMean[index] * deviationThreshold_){
164  // meHotTPDigiThr.fill(ttid);
165  quality = kBad;
166  }
167 
168  if(quality != kBad) continue;
169 
170  std::vector<DetId> ids(getTrigTowerMap()->constituentsOf(ttid));
171  for(unsigned iD(0); iD < ids.size(); ++iD){
172  DetId& id(ids[iD]);
173 
174  int quality(meQualitySummary.getBinContent(id));
175  if(quality == kMBad || quality == kBad) continue;
176 
177  meQualitySummary.setBinContent(id, meQualitySummary.maskMatches(id, mask, statusManager_) ? kMBad : kBad);
178  }
179  }
180 
181  // Quality check: set entire FED to BAD if its occupancy begins to vanish
182  // Fill FED statistics from (filtered) RecHit Occupancy
183  float meanFEDEB(0), meanFEDEE(0), rmsFEDEB(0), rmsFEDEE(0);
184  unsigned int nFEDEB(0), nFEDEE(0);
185  for ( unsigned iDCC(0); iDCC < nDCC; iDCC++ ) {
186  if ( iDCC >=kEBmLow && iDCC <= kEBpHigh) {
187  meanFEDEB += Nrhentries[iDCC];
188  rmsFEDEB += Nrhentries[iDCC]*Nrhentries[iDCC];
189  nFEDEB++;
190  }
191  else {
192  meanFEDEE += Nrhentries[iDCC];
193  rmsFEDEE += Nrhentries[iDCC]*Nrhentries[iDCC];
194  nFEDEE++;
195  }
196  }
197  meanFEDEB /= float( nFEDEB ); rmsFEDEB /= float( nFEDEB );
198  meanFEDEE /= float( nFEDEE ); rmsFEDEE /= float( nFEDEE );
199  rmsFEDEB = sqrt( abs(rmsFEDEB - meanFEDEB*meanFEDEB) );
200  rmsFEDEE = sqrt( abs(rmsFEDEE - meanFEDEE*meanFEDEE) );
201  // Analyze FED statistics
202  float meanFED(0.), rmsFED(0.), nRMS(5.);
203  for ( MESet::iterator qsItr(meQualitySummary.beginChannel()); qsItr != meQualitySummary.end(); qsItr.toNextChannel() ) {
204  DetId id( qsItr->getId() );
205  unsigned iDCC( dccId(id)-1 );
206  if ( iDCC >= kEBmLow && iDCC <= kEBpHigh ) {
207  meanFED = meanFEDEB;
208  rmsFED = rmsFEDEB;
209  }
210  else {
211  meanFED = meanFEDEE;
212  rmsFED = rmsFEDEE;
213  }
214  float threshold( meanFED < nRMS*rmsFED ? minHits_ : meanFED - nRMS*rmsFED );
215  if ( meanFED > 1000. && Nrhentries[iDCC] < threshold )
216  meQualitySummary.setBinContent( id, meQualitySummary.maskMatches(id, mask, statusManager_) ? kMBad : kBad );
217  }
218 
219  } // producePlots()
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
static const int PHYSICS_BAD_CHANNEL_WARNING
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int PHYSICS_BAD_CHANNEL_ERROR
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
int ieta() const
get the tower ieta
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
MESetCollection sources_
Definition: DetId.h:18
MESetCollection MEs_
Definition: DQWorker.h:75
std::vector< DetId > scConstituents(EcalScDetId const &)
unsigned dccId(DetId const &)
void ecaldqm::OccupancyClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 22 of file OccupancyClient.cc.

References deviationThreshold_, edm::ParameterSet::getUntrackedParameter(), and minHits_.

Referenced by ~OccupancyClient().

23  {
24  minHits_ = _params.getUntrackedParameter<int>("minHits");
25  deviationThreshold_ = _params.getUntrackedParameter<double>("deviationThreshold");
26  }

Member Data Documentation

float ecaldqm::OccupancyClient::deviationThreshold_
private

Definition at line 19 of file OccupancyClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::OccupancyClient::minHits_
private

Definition at line 18 of file OccupancyClient.h.

Referenced by producePlots(), and setParams().