CMS 3D CMS Logo

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 
142  // skip monitoring for ZDC crate for now (Oct. 1 2023), the Hcal DQM group need to discuss with the ZDC group on the monitoring settings.
143  if (HcalGenericDetId(_emap->lookup(eid)).isHcalZDCDetId()) {
144  sumflags.push_back(fSum);
145  continue;
146  }
147 
149 
150  if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward) {
151  double etmsmfr = xNumCorr.get(eid) > 0 ? double(xEtMsm.get(eid)) / double(xNumCorr.get(eid)) : 0;
152  double fgmsmfr = xNumCorr.get(eid) > 0 ? double(xFGMsm.get(eid)) / double(xNumCorr.get(eid)) : 0;
153 
154  if (etmsmfr >= _thresh_EtMsmRate_high)
155  vflags[fEtMsm]._state = flag::fBAD;
156  else if (etmsmfr >= _thresh_EtMsmRate_low)
157  vflags[fEtMsm]._state = flag::fPROBLEMATIC;
158  else
159  vflags[fEtMsm]._state = flag::fGOOD;
160  if (fgmsmfr >= _thresh_FGMsmRate_high)
161  vflags[fFGMsm]._state = flag::fBAD;
162  else if (fgmsmfr >= _thresh_FGMsmRate_low)
163  vflags[fFGMsm]._state = flag::fPROBLEMATIC;
164  else
165  vflags[fFGMsm]._state = flag::fGOOD;
166  }
167 
168  // combine
169  int iflag = 0;
170  for (std::vector<flag::Flag>::iterator ft = vflags.begin(); ft != vflags.end(); ++ft) {
171  cSummary.setBinContent(eid, iflag, ft->_state);
172  fSum += (*ft);
173  iflag++;
174  ft->reset();
175  }
176  sumflags.push_back(fSum);
177  }
178 
179  return sumflags;
180  }
181 } // namespace hcaldqm
ContainerSingle2D _cFGMsmFraction_depthlike
Definition: TPRunSummary.h:22
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
std::vector< HcalTrigTowerDetId > allTriggerId() const
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:24
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
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="")
T getUntrackedParameter(std::string const &, T const &) const
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
ContainerSingle2D _cEtMsmFraction_depthlike
Definition: TPRunSummary.h:21
int ietaAbs() const
get the absolute value of the tower ieta
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="")
int version() const
get the version code for the trigger tower
Readout chain identification for Hcal.
Definition: Run.h:45
ib
Definition: cuy.py:661