test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  {
115  HcalElectronicsId eid=HcalElectronicsId(ehashmap.lookup(*it));
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 (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
134  it!=_vhashFEDs.end(); ++it)
135  {
136  flag::Flag fSum("TP");
137  HcalElectronicsId eid(*it);
138 
139  std::vector<uint32_t>::const_iterator cit=std::find(
140  _vcdaqEids.begin(), _vcdaqEids.end(), *it);
141  if (cit==_vcdaqEids.end())
142  {
143  // not @cDAQ
144  sumflags.push_back(flag::Flag("TP", flag::fNCDAQ));
145  continue;
146  }
147 
148  // @cDAQ
149  if (utilities::isFEDHBHE(eid) || utilities::isFEDHF(eid))
150  {
151  double etmsmfr = xNumCorr.get(eid)>0?
152  double(xEtMsm.get(eid))/double(xNumCorr.get(eid)):0;
153  double fgmsmfr = xNumCorr.get(eid)>0?
154  double(xFGMsm.get(eid))/double(xNumCorr.get(eid)):0;
155 
156  if (etmsmfr>=_thresh_EtMsmRate_high)
157  vflags[fEtMsm]._state = flag::fBAD;
158  else if (etmsmfr>=_thresh_EtMsmRate_low)
159  vflags[fEtMsm]._state = flag::fPROBLEMATIC;
160  else
161  vflags[fEtMsm]._state = flag::fGOOD;
162  if (fgmsmfr>=_thresh_FGMsmRate_high)
163  vflags[fFGMsm]._state = flag::fBAD;
164  else if (fgmsmfr>=_thresh_FGMsmRate_low)
165  vflags[fFGMsm]._state = flag::fPROBLEMATIC;
166  else
167  vflags[fFGMsm]._state = flag::fGOOD;
168  }
169 
170  // combine
171  int iflag=0;
172  for (std::vector<flag::Flag>::iterator ft=vflags.begin();
173  ft!=vflags.end(); ++ft)
174  {
175  cSummary.setBinContent(eid, iflag, ft->_state);
176  fSum+=(*ft);
177  iflag++;
178  ft->reset();
179  }
180  sumflags.push_back(fSum);
181  }
182 
183  return sumflags;
184  }
185 }
std::vector< uint32_t > _vcdaqEids
Definition: DQClient.h:64
ContainerSingle2D _cFGMsmFraction_depthlike
Definition: TPRunSummary.h:25
T getUntrackedParameter(std::string const &, T const &) const
int ib
Definition: cuy.py:660
virtual double getBinEntries(int, int)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
std::vector< uint32_t > _vhashFEDs
Definition: DQClient.h:58
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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
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:105
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
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:131
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)
std::vector< int > _vFEDs
Definition: DQClient.h:57
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
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:153
int ietaAbs() const
get the absolute value of the tower ieta
Definition: Run.h:43