CMS 3D CMS Logo

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

#include <TrigPrimClient.h>

Inheritance diagram for ecaldqm::TrigPrimClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

void producePlots (ProcessType) override
 
 TrigPrimClient ()
 
 ~TrigPrimClient ()
 
- 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 errorFractionThreshold_
 
int minEntries_
 
float TTF4MaskingAlarmThreshold_
 

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

Constructor & Destructor Documentation

ecaldqm::TrigPrimClient::TrigPrimClient ( )

Definition at line 14 of file TrigPrimClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

14  :
16  minEntries_(0),
19  {
20  qualitySummaries_.insert("EmulQualitySummary");
21  }
std::set< std::string > qualitySummaries_
ecaldqm::TrigPrimClient::~TrigPrimClient ( )
inline

Definition at line 11 of file TrigPrimClient.h.

References producePlots(), and setParams().

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 32 of file TrigPrimClient.cc.

References funct::abs(), ecaldqm::dccId(), DEFINE_ECALDQM_WORKER, EcalTrigTowerDetId::detIdFromDenseIndex(), EcalBarrel, EcalEndcap, errorFractionThreshold_, objects.autophobj::float, ecaldqm::DQWorker::Timestamp::iLumi, ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, EcalTrigTowerDetId::kSizeForDenseIndexing, ecaldqm::DQWorkerClient::kUnknown, RecoTauDiscriminantConfiguration::mask, ecaldqm::DQWorker::MEs_, minEntries_, ecaldqm::nDCC, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, EcalTrigTowerDetId::subDet(), electronIdCutBased_cfi::threshold, ecaldqm::DQWorker::timestamp_, and TTF4MaskingAlarmThreshold_.

Referenced by ~TrigPrimClient().

33  {
34  MESet& meTimingSummary(MEs_.at("TimingSummary"));
35  MESet& meNonSingleSummary(MEs_.at("NonSingleSummary"));
36  MESet& meEmulQualitySummary(MEs_.at("EmulQualitySummary"));
37  MESet& meTrendTTF4Flags(MEs_.at("TrendTTF4Flags"));
38 
39  MESet const& sEtEmulError(sources_.at("EtEmulError"));
40  MESet const& sMatchedIndex(sources_.at("MatchedIndex"));
41  MESet const& sTPDigiThrAll(sources_.at("TPDigiThrAll"));
42  MESetNonObject const& sLHCStatusByLumi(static_cast<MESetNonObject&>(sources_.at("LHCStatusByLumi")));
43 
45 
46  // Store # of entries for Occupancy analysis
47  std::vector<float> Nentries(nDCC,0.);
48 
49  double currentLHCStatus = sLHCStatusByLumi.getFloatValue();
50  bool statsCheckEnabled = ((currentLHCStatus > 10.5 && currentLHCStatus < 11.5) || currentLHCStatus < 0); // currentLHCStatus = -1 is the default when no beam info is available
51 
52  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++){
54 
55  bool doMask(meEmulQualitySummary.maskMatches(ttid, mask, statusManager_));
56 
57  float towerEntries(0.);
58  float tMax(0.5);
59  float nMax(0.);
60  for(int iBin(0); iBin < 6; iBin++){
61  float entries(sMatchedIndex.getBinContent(ttid, iBin + 1));
62  towerEntries += entries;
63 
64  if(entries > nMax){
65  nMax = entries;
66  tMax = iBin == 0 ? -0.5 : iBin + 0.5; // historical reasons.. much clearer to say "no entry = -0.5"
67  }
68  }
69 
70  meTimingSummary.setBinContent(ttid, tMax);
71 
72  if(towerEntries < minEntries_){
73  meEmulQualitySummary.setBinContent(ttid, doMask ? kMUnknown : kUnknown);
74  continue;
75  }
76 
77  float nonsingleFraction(1. - nMax / towerEntries);
78 
79  if(nonsingleFraction > 0.)
80  meNonSingleSummary.setBinContent(ttid, nonsingleFraction);
81 
82  if(sEtEmulError.getBinContent(ttid) / towerEntries > errorFractionThreshold_)
83  meEmulQualitySummary.setBinContent(ttid, doMask ? kMBad : kBad);
84  else
85  meEmulQualitySummary.setBinContent(ttid, doMask ? kMGood : kGood);
86 
87  // Keep count for Occupancy analysis
88  unsigned iDCC( dccId(ttid)-1 );
89  Nentries[iDCC] += sTPDigiThrAll.getBinContent(ttid);
90  }
91 
92  // Fill TTF4 v Masking ME
93  // NOT an occupancy plot: only tells you if non-zero TTF4 occupancy was seen
94  // without giving info about how many were seen
95  MESet& meTTF4vMask(MEs_.at("TTF4vMask"));
96  MESet& meTTF4vMaskByLumi(MEs_.at("TTF4vMaskByLumi"));
97  MESet const& sTTFlags4(sources_.at("TTFlags4"));
98  MESet const& sTTFlags4ByLumi(sources_.at("TTFlags4ByLumi"));
99  MESet const& sTTMaskMapAll(sources_.at("TTMaskMapAll"));
100 
101  std::vector<float> nWithTTF4(nDCC, 0.); // counters to keep track of number of towers in a DCC that have TTF4 flag set
102  int nWithTTF4_EE = 0; // total number of towers in EE with TTF4
103  int nWithTTF4_EB = 0; // total number of towers in EB with TTF4
104  // Loop over all TTs
105  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
107  unsigned iDCC( dccId(ttid)-1 );
108  bool isMasked( sTTMaskMapAll.getBinContent(ttid) > 0. );
109  bool hasTTF4( sTTFlags4.getBinContent(ttid) > 0. );
110  bool hasTTF4InThisLumiSection( sTTFlags4ByLumi.getBinContent(ttid) > 0. );
111  if (hasTTF4InThisLumiSection) {
112  nWithTTF4[iDCC]++;
113  if (ttid.subDet() == EcalBarrel) nWithTTF4_EB++;
114  else if (ttid.subDet() == EcalEndcap) nWithTTF4_EE++;
115  }
116  if ( isMasked ) {
117  if ( hasTTF4 ) {
118  meTTF4vMask.setBinContent( ttid,12 ); // Masked, has TTF4
119  }
120  else {
121  meTTF4vMask.setBinContent( ttid,11 ); // Masked, no TTF4
122  }
123  if ( hasTTF4InThisLumiSection ) {
124  meTTF4vMaskByLumi.setBinContent( ttid,12 ); // Masked, has TTF4
125  }
126  else {
127  meTTF4vMaskByLumi.setBinContent( ttid,11 ); // Masked, no TTF4
128  }
129  } else {
130  if ( hasTTF4 ) meTTF4vMask.setBinContent( ttid,13 ); // not Masked, has TTF4
131  if ( hasTTF4InThisLumiSection ) meTTF4vMaskByLumi.setBinContent( ttid,13 ); // not Masked, has TTF4
132  }
133  } // TT loop
134 
135  // Fill trend plots for number of TTs with TTF4 flag set
136  meTrendTTF4Flags.fill(EcalBarrel, double(timestamp_.iLumi), nWithTTF4_EB);
137  meTrendTTF4Flags.fill(EcalEndcap, double(timestamp_.iLumi), nWithTTF4_EE);
138 
139  // Quality check: set an entire FED to BAD if a more than 80% of the TTs in that FED show any DCC-SRP flag mismatch errors
140  // Fill flag mismatch statistics
141  std::vector<float> nTTs(nDCC,0.);
142  std::vector<float> nTTFMismath(nDCC,0.);
143  MESet const& sTTFMismatch(sources_.at("TTFMismatch"));
144  for ( unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++ ) {
146  unsigned iDCC( dccId(ttid)-1 );
147  if ( sTTFMismatch.getBinContent(ttid) > 0. )
148  nTTFMismath[iDCC]++;
149  nTTs[iDCC]++;
150  }
151  // Analyze flag mismatch statistics and TTF4 fraction statistics
152  for ( unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++ ) {
154  unsigned iDCC( dccId(ttid)-1 );
155  if ( nTTFMismath[iDCC] > 0.8*nTTs[iDCC] || nWithTTF4[iDCC] > TTF4MaskingAlarmThreshold_*nTTs[iDCC]) {
156  meEmulQualitySummary.setBinContent( ttid, meEmulQualitySummary.maskMatches(ttid, mask, statusManager_) ? kMBad : kBad );
157  }
158  }
159 
160  // Quality check: set entire FED to BAD if its occupancy begins to vanish
161  // Fill FED statistics from TP digi occupancy
162  float meanFEDEB(0.), meanFEDEE(0.), rmsFEDEB(0.), rmsFEDEE(0.);
163  unsigned int nFEDEB(0), nFEDEE(0);
164  for ( unsigned iDCC(0); iDCC < nDCC; iDCC++ ) {
165  if ( iDCC >=kEBmLow && iDCC <= kEBpHigh) {
166  meanFEDEB += Nentries[iDCC];
167  rmsFEDEB += Nentries[iDCC]*Nentries[iDCC];
168  nFEDEB++;
169  }
170  else {
171  meanFEDEE += Nentries[iDCC];
172  rmsFEDEE += Nentries[iDCC]*Nentries[iDCC];
173  nFEDEE++;
174  }
175  }
176  meanFEDEB /= float( nFEDEB ); rmsFEDEB /= float( nFEDEB );
177  meanFEDEE /= float( nFEDEE ); rmsFEDEE /= float( nFEDEE );
178  rmsFEDEB = sqrt( std::abs(rmsFEDEB - meanFEDEB*meanFEDEB) );
179  rmsFEDEE = sqrt( std::abs(rmsFEDEE - meanFEDEE*meanFEDEE) );
180  // Analyze FED statistics
181  float meanFED(0.), rmsFED(0.), nRMS(5.);
182  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++){
184  unsigned iDCC( dccId(ttid)-1 );
185  if ( iDCC >= kEBmLow && iDCC <= kEBpHigh ) {
186  meanFED = meanFEDEB;
187  rmsFED = rmsFEDEB;
188  }
189  else {
190  meanFED = meanFEDEE;
191  rmsFED = rmsFEDEE;
192  }
193  float threshold( meanFED < nRMS*rmsFED ? minEntries_ : meanFED - nRMS*rmsFED );
194  if ( (meanFED > 100. && Nentries[iDCC] < threshold) && statsCheckEnabled )
195  meEmulQualitySummary.setBinContent( ttid, meEmulQualitySummary.maskMatches(ttid, mask, statusManager_) ? kMBad : kBad );
196  }
197 
198  } // producePlots()
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
static const int PHYSICS_BAD_CHANNEL_WARNING
T sqrt(T t)
Definition: SSEVec.h:18
StatusManager const * statusManager_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MESetCollection sources_
Timestamp timestamp_
Definition: DQWorker.h:78
MESetCollection MEs_
Definition: DQWorker.h:75
unsigned dccId(DetId const &)
void ecaldqm::TrigPrimClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 24 of file TrigPrimClient.cc.

References errorFractionThreshold_, edm::ParameterSet::getUntrackedParameter(), minEntries_, and TTF4MaskingAlarmThreshold_.

Referenced by ~TrigPrimClient().

25  {
26  minEntries_ = _params.getUntrackedParameter<int>("minEntries");
27  errorFractionThreshold_ = _params.getUntrackedParameter<double>("errorFractionThreshold");
28  TTF4MaskingAlarmThreshold_ = _params.getUntrackedParameter<double>("TTF4MaskingAlarmThreshold");
29  }

Member Data Documentation

float ecaldqm::TrigPrimClient::errorFractionThreshold_
private

Definition at line 19 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::TrigPrimClient::minEntries_
private

Definition at line 18 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::TrigPrimClient::TTF4MaskingAlarmThreshold_
private

Definition at line 20 of file TrigPrimClient.h.

Referenced by producePlots(), and setParams().