CMS 3D CMS Logo

TPRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm
4 {
6  std::string const& taskname, edm::ParameterSet const& ps) :
7  DQClient(name, taskname, ps)
8  {
10  "thresh_EtMsmRate_high", 0.2);
12  "thresh_EtMsmRate_low", 0.05);
14  "thresh_FGMsmRate_high", 0.2);
16  "thresh_FGMsmRate_low", 0.05);
17  }
18 
19  /* virtual */ void TPRunSummary::beginRun(edm::Run const& r,
20  edm::EventSetup const& es)
21  {
22  DQClient::beginRun(r,es);
23  }
24 
27  edm::EventSetup const& es)
28  {
29  DQClient::endLuminosityBlock(ib, ig, lb, es);
30  }
31 
32  /* virtual */ std::vector<flag::Flag> TPRunSummary::endJob(
34  {
35  // hahs maps
38  std::vector<flag::Flag> vflags; vflags.resize(nTPFlag);
39  vflags[fEtMsm]=flag::Flag("EtMsm");
40  vflags[fFGMsm]=flag::Flag("FGMsm");
41 
42  // INITIALIZE
43  ContainerSingle2D cOccupancyData_depthlike, cOccupancyEmul_depthlike;
44  ContainerSingle2D cEtMsm_depthlike, cFGMsm_depthlike,
45  cEtCorrRatio_depthlike;
46  ContainerSingle2D cSummary;
47  ContainerXXX<double> xDeadD, xDeadE, xEtMsm, xFGMsm;
48  ContainerXXX<double> xNumCorr;
54  cOccupancyData_depthlike.initialize(_taskname, "OccupancyData",
58  cOccupancyEmul_depthlike.initialize(_taskname, "OccupancyEmul",
62  cEtMsm_depthlike.initialize(_taskname, "EtMsm",
66  cFGMsm_depthlike.initialize(_taskname, "FGMsm",
70  cEtCorrRatio_depthlike.initialize(_taskname, "EtCorrRatio",
82  cSummary.initialize(_name, "Summary",
84  new quantity::FlagQuantity(vflags),
86 
87  // BOOK
88  xDeadD.book(_emap); xDeadE.book(_emap); xEtMsm.book(_emap);
89  xFGMsm.book(_emap); xNumCorr.book(_emap);
90 
91  // LOAD
92  cOccupancyData_depthlike.load(ig, _subsystem);
93  cOccupancyEmul_depthlike.load(ig, _subsystem);
94  cEtMsm_depthlike.load(ig, _subsystem);
95  cFGMsm_depthlike.load(ig, _subsystem);
96  cEtCorrRatio_depthlike.load(ig, _subsystem);
99  cSummary.book(ib, _subsystem);
100 
101  // iterate
102  std::vector<HcalTrigTowerDetId> tids = _emap->allTriggerId();
103  for (std::vector<HcalTrigTowerDetId>::const_iterator it=tids.begin();
104  it!=tids.end(); ++it)
105  {
106  // skip 2x3
108  if (tid.version()==0 && tid.ietaAbs()>=29)
109  continue;
110 
111  // do the comparison if there are channels that were correlated
112  // both had emul and data tps
113  if (cEtCorrRatio_depthlike.getBinEntries(tid)>0)
114  {
116 
117  double numetmsm = cEtMsm_depthlike.getBinContent(tid);
118  double numfgmsm = cFGMsm_depthlike.getBinContent(tid);
119  double numcorr = cEtCorrRatio_depthlike.getBinEntries(tid);
120 
121  xEtMsm.get(eid) += numetmsm;
122  xFGMsm.get(eid) += numfgmsm;
123  xNumCorr.get(eid) += numcorr;
124 
126  numetmsm/numcorr);
128  numfgmsm/numcorr);
129  }
130  }
131 
132  std::vector<flag::Flag> sumflags;
133  for (auto& it_hashcrate : _vhashCrates) {
134  flag::Flag fSum("TP");
135  HcalElectronicsId eid(it_hashcrate);
136  HcalDetId did = HcalDetId(_emap->lookup(eid));
137 
138  if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward) {
139  double etmsmfr = xNumCorr.get(eid)>0?
140  double(xEtMsm.get(eid))/double(xNumCorr.get(eid)):0;
141  double fgmsmfr = xNumCorr.get(eid)>0?
142  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();
161  ft!=vflags.end(); ++ft)
162  {
163  cSummary.setBinContent(eid, iflag, ft->_state);
164  fSum+=(*ft);
165  iflag++;
166  ft->reset();
167  }
168  sumflags.push_back(fSum);
169  }
170 
171  return sumflags;
172  }
173 }
ContainerSingle2D _cFGMsmFraction_depthlike
Definition: TPRunSummary.h:25
T getUntrackedParameter(std::string const &, T const &) const
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
virtual double getBinEntries(int, int)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:15
std::string _taskname
Definition: DQClient.h:47
TPRunSummary(std::string const &, std::string const &, edm::ParameterSet const &)
Definition: TPRunSummary.cc:5
HcalElectronicsMap const * _emap
Definition: DQClient.h:54
std::vector< uint32_t > _vhashCrates
Definition: DQClient.h:58
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 beginRun(edm::Run const &, edm::EventSetup const &)
Definition: TPRunSummary.cc:19
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:114
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: TPRunSummary.cc:25
std::string _name
Definition: DQModule.h:57
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: TPRunSummary.cc:32
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:99
virtual void initialize(std::string const &folder, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
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:249
std::string _subsystem
Definition: DQModule.h:64
virtual double getBinContent(int, int)
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:91
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:42
ib
Definition: cuy.py:660