CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrigPrimClient.cc
Go to the documentation of this file.
1 #include "../interface/TrigPrimClient.h"
2 
4 
6 
8 
9 #include <cmath>
10 
11 namespace ecaldqm
12 {
15  minEntries_(0),
16  errorFractionThreshold_(0.)
17  {
18  qualitySummaries_.insert("EmulQualitySummary");
19  }
20 
21  void
23  {
24  minEntries_ = _params.getUntrackedParameter<int>("minEntries");
25  errorFractionThreshold_ = _params.getUntrackedParameter<double>("errorFractionThreshold");
26  }
27 
28  void
30  {
31  MESet& meTimingSummary(MEs_.at("TimingSummary"));
32  MESet& meNonSingleSummary(MEs_.at("NonSingleSummary"));
33  MESet& meEmulQualitySummary(MEs_.at("EmulQualitySummary"));
34 
35  MESet const& sEtEmulError(sources_.at("EtEmulError"));
36  MESet const& sMatchedIndex(sources_.at("MatchedIndex"));
37 
39 
40  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++){
42 
43  bool doMask(meEmulQualitySummary.maskMatches(ttid, mask, statusManager_));
44 
45  float towerEntries(0.);
46  float tMax(0.5);
47  float nMax(0.);
48  for(int iBin(0); iBin < 6; iBin++){
49  float entries(sMatchedIndex.getBinContent(ttid, iBin + 1));
50  towerEntries += entries;
51 
52  if(entries > nMax){
53  nMax = entries;
54  tMax = iBin == 0 ? -0.5 : iBin + 0.5; // historical reasons.. much clearer to say "no entry = -0.5"
55  }
56  }
57 
58  meTimingSummary.setBinContent(ttid, tMax);
59 
60  if(towerEntries < minEntries_){
61  meEmulQualitySummary.setBinContent(ttid, doMask ? kMUnknown : kUnknown);
62  continue;
63  }
64 
65  float nonsingleFraction(1. - nMax / towerEntries);
66 
67  if(nonsingleFraction > 0.)
68  meNonSingleSummary.setBinContent(ttid, nonsingleFraction);
69 
70  if(sEtEmulError.getBinContent(ttid) / towerEntries > errorFractionThreshold_)
71  meEmulQualitySummary.setBinContent(ttid, doMask ? kMBad : kBad);
72  else
73  meEmulQualitySummary.setBinContent(ttid, doMask ? kMGood : kGood);
74  }
75 
76  // Fill TTF4 v Masking ME
77  // NOT an occupancy plot: only tells you if non-zero TTF4 occupancy was seen
78  // without giving info about how many were seen
79  MESet& meTTF4vMask(MEs_.at("TTF4vMask"));
80  MESet const& sTTFlags4(sources_.at("TTFlags4"));
81  MESet const& sTTMaskMapAll(sources_.at("TTMaskMapAll"));
82 
83  // Loop over all TTs
84  for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
86  bool isMasked( sTTMaskMapAll.getBinContent(ttid) > 0. );
87  bool hasTTF4( sTTFlags4.getBinContent(ttid) > 0. );
88  if ( isMasked ) {
89  if ( hasTTF4 )
90  meTTF4vMask.setBinContent( ttid,12 ); // Masked, has TTF4
91  else
92  meTTF4vMask.setBinContent( ttid,11 ); // Masked, no TTF4
93  } else {
94  if ( hasTTF4 )
95  meTTF4vMask.setBinContent( ttid,13 ); // not Masked, has TTF4
96  }
97  } // TT loop
98 
99  } // TrigPrimClient::producePlots()
100 
102 }
T getUntrackedParameter(std::string const &, T const &) const
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:108
static const int PHYSICS_BAD_CHANNEL_WARNING
void producePlots(ProcessType) override
void setParams(edm::ParameterSet const &) override
std::set< std::string > qualitySummaries_
StatusManager const * statusManager_
MESetCollection sources_
MESetCollection MEs_
Definition: DQWorker.h:75