CMS 3D CMS Logo

TPRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace constants;
6  : DQClient(name, taskname, ps) {
7  _thresh_EtMsmRate_high = ps.getUntrackedParameter<double>("thresh_EtMsmRate_high", 0.2);
8  _thresh_EtMsmRate_low = ps.getUntrackedParameter<double>("thresh_EtMsmRate_low", 0.05);
9  _thresh_FGMsmRate_high = ps.getUntrackedParameter<double>("thresh_FGMsmRate_high", 0.2);
10  _thresh_FGMsmRate_low = ps.getUntrackedParameter<double>("thresh_FGMsmRate_low", 0.05);
11  }
12 
13  /* virtual */ void TPRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { DQClient::beginRun(r, es); }
14 
17  edm::LuminosityBlock const& lb,
18  edm::EventSetup const& es) {
19  DQClient::endLuminosityBlock(ib, ig, lb, es);
20  }
21 
22  /* virtual */ std::vector<flag::Flag> TPRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) {
23  // hahs maps
26  std::vector<flag::Flag> vflags;
27  vflags.resize(nTPFlag);
28  vflags[fEtMsm] = flag::Flag("EtMsm");
29  vflags[fFGMsm] = flag::Flag("FGMsm");
30 
31  // INITIALIZE
32  ContainerSingle2D cOccupancyData_depthlike, cOccupancyEmul_depthlike;
33  ContainerSingle2D cEtMsm_depthlike, cFGMsm_depthlike, cEtCorrRatio_depthlike;
34  ContainerSingle2D cSummary;
35  ContainerXXX<double> xDeadD, xDeadE, xEtMsm, xFGMsm;
36  ContainerXXX<double> xNumCorr;
42  cOccupancyData_depthlike.initialize(_taskname,
43  "OccupancyData",
47  0);
48  cOccupancyEmul_depthlike.initialize(_taskname,
49  "OccupancyEmul",
53  0);
54  cEtMsm_depthlike.initialize(_taskname,
55  "EtMsm",
59  0);
60  cFGMsm_depthlike.initialize(_taskname,
61  "FGMsm",
65  0);
66  cEtCorrRatio_depthlike.initialize(_taskname,
67  "EtCorrRatio",
71  0);
73  "EtMsmFraction",
77  0);
79  "FGMsmFraction",
83  0);
84  cSummary.initialize(_name,
85  "Summary",
87  new quantity::FlagQuantity(vflags),
89  0);
90 
91  // BOOK
92  xDeadD.book(_emap);
93  xDeadE.book(_emap);
94  xEtMsm.book(_emap);
95  xFGMsm.book(_emap);
96  xNumCorr.book(_emap);
97 
98  // LOAD
99  cOccupancyData_depthlike.load(ig, _subsystem);
100  cOccupancyEmul_depthlike.load(ig, _subsystem);
101  cEtMsm_depthlike.load(ig, _subsystem);
102  cFGMsm_depthlike.load(ig, _subsystem);
103  cEtCorrRatio_depthlike.load(ig, _subsystem);
106  cSummary.book(ib, _subsystem);
107 
108  // iterate
109  std::vector<HcalTrigTowerDetId> tids = _emap->allTriggerId();
110  for (std::vector<HcalTrigTowerDetId>::const_iterator it = tids.begin(); it != tids.end(); ++it) {
111  // skip 2x3
113  if (tid.version() == 0 && tid.ietaAbs() >= 29)
114  continue;
115 
116  // do the comparison if there are channels that were correlated
117  // both had emul and data tps
118  if (cEtCorrRatio_depthlike.getBinEntries(tid) > 0) {
120 
121  double numetmsm = cEtMsm_depthlike.getBinContent(tid);
122  double numfgmsm = cFGMsm_depthlike.getBinContent(tid);
123  double numcorr = cEtCorrRatio_depthlike.getBinEntries(tid);
124 
125  xEtMsm.get(eid) += numetmsm;
126  xFGMsm.get(eid) += numfgmsm;
127  xNumCorr.get(eid) += numcorr;
128 
129  _cEtMsmFraction_depthlike.setBinContent(tid, numetmsm / numcorr);
130  _cFGMsmFraction_depthlike.setBinContent(tid, numfgmsm / numcorr);
131  }
132  }
133 
134  std::vector<flag::Flag> sumflags;
135  for (auto& it_hashcrate : _vhashCrates) {
136  flag::Flag fSum("TP");
137  HcalElectronicsId eid(it_hashcrate);
138  HcalDetId did = HcalDetId(_emap->lookup(eid));
139 
140  if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward) {
141  double etmsmfr = xNumCorr.get(eid) > 0 ? double(xEtMsm.get(eid)) / double(xNumCorr.get(eid)) : 0;
142  double fgmsmfr = xNumCorr.get(eid) > 0 ? double(xFGMsm.get(eid)) / double(xNumCorr.get(eid)) : 0;
143 
144  if (etmsmfr >= _thresh_EtMsmRate_high)
145  vflags[fEtMsm]._state = flag::fBAD;
146  else if (etmsmfr >= _thresh_EtMsmRate_low)
147  vflags[fEtMsm]._state = flag::fPROBLEMATIC;
148  else
149  vflags[fEtMsm]._state = flag::fGOOD;
150  if (fgmsmfr >= _thresh_FGMsmRate_high)
151  vflags[fFGMsm]._state = flag::fBAD;
152  else if (fgmsmfr >= _thresh_FGMsmRate_low)
153  vflags[fFGMsm]._state = flag::fPROBLEMATIC;
154  else
155  vflags[fFGMsm]._state = flag::fGOOD;
156  }
157 
158  // combine
159  int iflag = 0;
160  for (std::vector<flag::Flag>::iterator ft = vflags.begin(); ft != vflags.end(); ++ft) {
161  cSummary.setBinContent(eid, iflag, ft->_state);
162  fSum += (*ft);
163  iflag++;
164  ft->reset();
165  }
166  sumflags.push_back(fSum);
167  }
168 
169  return sumflags;
170  }
171 } // namespace hcaldqm
ContainerSingle2D _cFGMsmFraction_depthlike
Definition: TPRunSummary.h:22
T getUntrackedParameter(std::string const &, T const &) const
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
virtual double getBinEntries(int, int)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: TPRunSummary.cc:13
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:13
std::string _taskname
Definition: DQClient.h:46
TPRunSummary(std::string const &, std::string const &, edm::ParameterSet const &)
Definition: TPRunSummary.cc:5
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:53
std::vector< uint32_t > _vhashCrates
Definition: DQClient.h:57
std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: TPRunSummary.cc:22
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
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:98
std::string _name
Definition: DQModule.h:41
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:48
void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: TPRunSummary.cc:15
virtual double getBinContent(int, int)
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
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
ib
Definition: cuy.py:662