CMS 3D CMS Logo

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