CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TPRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace constants;
6  std::string const& taskname,
7  edm::ParameterSet const& ps,
9  : DQClient(name, taskname, ps, iC) {
10  _thresh_EtMsmRate_high = ps.getUntrackedParameter<double>("thresh_EtMsmRate_high", 0.2);
11  _thresh_EtMsmRate_low = ps.getUntrackedParameter<double>("thresh_EtMsmRate_low", 0.05);
12  _thresh_FGMsmRate_high = ps.getUntrackedParameter<double>("thresh_FGMsmRate_high", 0.2);
13  _thresh_FGMsmRate_low = ps.getUntrackedParameter<double>("thresh_FGMsmRate_low", 0.05);
14  }
15 
16  /* virtual */ void TPRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { DQClient::beginRun(r, es); }
17 
20  edm::LuminosityBlock const& lb,
21  edm::EventSetup const& es) {
22  DQClient::endLuminosityBlock(ib, ig, lb, es);
23  }
24 
25  /* virtual */ std::vector<flag::Flag> TPRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) {
26  // hahs maps
29  std::vector<flag::Flag> vflags;
30  vflags.resize(nTPFlag);
31  vflags[fEtMsm] = flag::Flag("EtMsm");
32  vflags[fFGMsm] = flag::Flag("FGMsm");
33 
34  // INITIALIZE
35  ContainerSingle2D cOccupancyData_depthlike, cOccupancyEmul_depthlike;
36  ContainerSingle2D cEtMsm_depthlike, cFGMsm_depthlike, cEtCorrRatio_depthlike;
37  ContainerSingle2D cSummary;
38  ContainerXXX<double> xDeadD, xDeadE, xEtMsm, xFGMsm;
39  ContainerXXX<double> xNumCorr;
45  cOccupancyData_depthlike.initialize(_taskname,
46  "OccupancyData",
50  0);
51  cOccupancyEmul_depthlike.initialize(_taskname,
52  "OccupancyEmul",
56  0);
57  cEtMsm_depthlike.initialize(_taskname,
58  "EtMsm",
62  0);
63  cFGMsm_depthlike.initialize(_taskname,
64  "FGMsm",
68  0);
69  cEtCorrRatio_depthlike.initialize(_taskname,
70  "EtCorrRatio",
74  0);
76  "EtMsmFraction",
80  0);
82  "FGMsmFraction",
86  0);
87  cSummary.initialize(_name,
88  "Summary",
90  new quantity::FlagQuantity(vflags),
92  0);
93 
94  // BOOK
95  xDeadD.book(_emap);
96  xDeadE.book(_emap);
97  xEtMsm.book(_emap);
98  xFGMsm.book(_emap);
99  xNumCorr.book(_emap);
100 
101  // LOAD
102  cOccupancyData_depthlike.load(ig, _subsystem);
103  cOccupancyEmul_depthlike.load(ig, _subsystem);
104  cEtMsm_depthlike.load(ig, _subsystem);
105  cFGMsm_depthlike.load(ig, _subsystem);
106  cEtCorrRatio_depthlike.load(ig, _subsystem);
109  cSummary.book(ib, _subsystem);
110 
111  // iterate
112  std::vector<HcalTrigTowerDetId> tids = _emap->allTriggerId();
113  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
114  // skip 2x3
116  if (tid.version() == 0 && tid.ietaAbs() >= 29)
117  continue;
118 
119  // do the comparison if there are channels that were correlated
120  // both had emul and data tps
121  if (cEtCorrRatio_depthlike.getBinEntries(tid) > 0) {
123 
124  double numetmsm = cEtMsm_depthlike.getBinContent(tid);
125  double numfgmsm = cFGMsm_depthlike.getBinContent(tid);
126  double numcorr = cEtCorrRatio_depthlike.getBinEntries(tid);
127 
128  xEtMsm.get(eid) += numetmsm;
129  xFGMsm.get(eid) += numfgmsm;
130  xNumCorr.get(eid) += numcorr;
131 
132  _cEtMsmFraction_depthlike.setBinContent(tid, numetmsm / numcorr);
133  _cFGMsmFraction_depthlike.setBinContent(tid, numfgmsm / numcorr);
134  }
135  }
136 
137  std::vector<flag::Flag> sumflags;
138  for (auto& it_hashcrate : _vhashCrates) {
139  flag::Flag fSum("TP");
140  HcalElectronicsId eid(it_hashcrate);
141  HcalDetId did = HcalDetId(_emap->lookup(eid));
142 
143  if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward) {
144  double etmsmfr = xNumCorr.get(eid) > 0 ? double(xEtMsm.get(eid)) / double(xNumCorr.get(eid)) : 0;
145  double fgmsmfr = xNumCorr.get(eid) > 0 ? double(xFGMsm.get(eid)) / double(xNumCorr.get(eid)) : 0;
146 
147  if (etmsmfr >= _thresh_EtMsmRate_high)
148  vflags[fEtMsm]._state = flag::fBAD;
149  else if (etmsmfr >= _thresh_EtMsmRate_low)
150  vflags[fEtMsm]._state = flag::fPROBLEMATIC;
151  else
152  vflags[fEtMsm]._state = flag::fGOOD;
153  if (fgmsmfr >= _thresh_FGMsmRate_high)
154  vflags[fFGMsm]._state = flag::fBAD;
155  else if (fgmsmfr >= _thresh_FGMsmRate_low)
156  vflags[fFGMsm]._state = flag::fPROBLEMATIC;
157  else
158  vflags[fFGMsm]._state = flag::fGOOD;
159  }
160 
161  // combine
162  int iflag = 0;
163  for (std::vector<flag::Flag>::iterator ft = vflags.begin(); ft != vflags.end(); ++ft) {
164  cSummary.setBinContent(eid, iflag, ft->_state);
165  fSum += (*ft);
166  iflag++;
167  ft->reset();
168  }
169  sumflags.push_back(fSum);
170  }
171 
172  return sumflags;
173  }
174 } // namespace hcaldqm
ContainerSingle2D _cFGMsmFraction_depthlike
Definition: TPRunSummary.h:22
T getUntrackedParameter(std::string const &, T const &) const
int ib
Definition: cuy.py:661
virtual double getBinEntries(int, int)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: TPRunSummary.cc:16
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:24
std::string _taskname
Definition: DQClient.h:50
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
HcalElectronicsMap const * _emap
Definition: DQClient.h:60
std::vector< uint32_t > _vhashCrates
Definition: DQClient.h:64
std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: TPRunSummary.cc:25
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
void reset()
Definition: Flag.h:59
virtual void setBinContent(int, int, int)
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:105
std::string _name
Definition: DQModule.h:42
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:87
int version() const
get the version code for the trigger tower
ContainerSingle2D _cEtMsmFraction_depthlike
Definition: TPRunSummary.h:21
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:197
std::string _subsystem
Definition: DQModule.h:49
void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: TPRunSummary.cc:18
virtual double getBinContent(int, int)
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
TPRunSummary(std::string const &, std::string const &, edm::ParameterSet const &, edm::ConsumesCollector &iC)
Definition: TPRunSummary.cc:5
virtual void load(DQMStore::IGetter &, std::string subsystem="Hcal", std::string aux="")
Readout chain identification for Hcal.
std::vector< HcalTrigTowerDetId > allTriggerId() const
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
int ietaAbs() const
get the absolute value of the tower ieta
Definition: Run.h:45