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  {
9  _thresh_fgmsm = ps.getUntrackedParameter<double>("thresh_fgmsm",
10  0.1);
11  _thresh_etmsm = ps.getUntrackedParameter<double>("thresh_etmsm",
12  0.1);
13  }
14 
15  /* virtual */ void TPRunSummary::beginRun(edm::Run const& r,
16  edm::EventSetup const& es)
17  {
18  DQClient::beginRun(r,es);
19  }
20 
23  edm::EventSetup const& es)
24  {
25  DQClient::endLuminosityBlock(ib, ig, lb, es);
26  }
27 
28  /* virtual */ std::vector<flag::Flag> TPRunSummary::endJob(
30  {
31  // hahs maps
34  std::vector<flag::Flag> vflags; vflags.resize(nTPFlag);
35  vflags[fEtMsm]=flag::Flag("EtMsm");
36  vflags[fFGMsm]=flag::Flag("FGMsm");
37 
38  // INITIALIZE
39  ContainerSingle2D cOccupancyData_depthlike, cOccupancyEmul_depthlike;
40  ContainerSingle2D cEtMsm_depthlike, cFGMsm_depthlike,
41  cEtCorrRatio_depthlike;
42  ContainerSingle2D cSummary;
43  ContainerXXX<double> xDeadD, xDeadE, xEtMsm, xFGMsm;
48  cOccupancyData_depthlike.initialize(_taskname, "OccupancyData",
52  cOccupancyEmul_depthlike.initialize(_taskname, "OccupancyEmul",
56  cEtMsm_depthlike.initialize(_taskname, "EtMsm",
60  cFGMsm_depthlike.initialize(_taskname, "FGMsm",
64  cEtCorrRatio_depthlike.initialize(_taskname, "EtCorrRatio",
76  cSummary.initialize(_name, "Summary",
78  new quantity::FlagQuantity(vflags),
80 
81  // BOOK
82  xDeadD.book(_emap); xDeadE.book(_emap); xEtMsm.book(_emap);
83  xFGMsm.book(_emap);
84 
85  // LOAD
86  cOccupancyData_depthlike.load(ig, _subsystem);
87  cOccupancyEmul_depthlike.load(ig, _subsystem);
88  cEtMsm_depthlike.load(ig, _subsystem);
89  cFGMsm_depthlike.load(ig, _subsystem);
90  cEtCorrRatio_depthlike.load(ig, _subsystem);
93  cSummary.book(ib, _subsystem);
94 
95  // iterate
96  std::vector<HcalTrigTowerDetId> tids = _emap->allTriggerId();
97  for (std::vector<HcalTrigTowerDetId>::const_iterator it=tids.begin();
98  it!=tids.end(); ++it)
99  {
100  // skip 2x3
102  if (tid.version()==0 && tid.ietaAbs()>=29)
103  continue;
104  HcalElectronicsId eid=HcalElectronicsId(ehashmap.lookup(*it));
105  double etmsmfr = double(cEtMsm_depthlike.getBinContent(tid))/
106  double(cEtCorrRatio_depthlike.getBinEntries(tid));
107  etmsmfr>=0.1?xEtMsm.get(eid)++:xEtMsm.get(eid)+=0;
108  double fgmsmfr = double(cFGMsm_depthlike.getBinContent(tid))/
109  double(cEtCorrRatio_depthlike.getBinEntries(tid));
110  fgmsmfr>=0.1?xFGMsm.get(eid)++:xFGMsm.get(eid)+=0;
111 
114  }
115 
116  std::vector<flag::Flag> sumflags;
117  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
118  it!=_vhashFEDs.end(); ++it)
119  {
120  flag::Flag fSum("TP");
121  HcalElectronicsId eid(*it);
122 
123  std::vector<uint32_t>::const_iterator cit=std::find(
124  _vcdaqEids.begin(), _vcdaqEids.end(), *it);
125  if (cit==_vcdaqEids.end())
126  {
127  // not @cDAQ
128  sumflags.push_back(flag::Flag("TP", flag::fNCDAQ));
129  continue;
130  }
131 
132  // @cDAQ
133  if (utilities::isFEDHBHE(eid) || utilities::isFEDHF(eid))
134  {
135  if (xEtMsm.get(eid)>0)
136  vflags[fEtMsm]._state = flag::fBAD;
137  else
138  vflags[fEtMsm]._state = flag::fGOOD;
139  if (xFGMsm.get(eid)>0)
140  vflags[fFGMsm]._state = flag::fBAD;
141  else
142  vflags[fFGMsm]._state = flag::fGOOD;
143  }
144 
145  // combine
146  int iflag=0;
147  for (std::vector<flag::Flag>::iterator ft=vflags.begin();
148  ft!=vflags.end(); ++ft)
149  {
150  cSummary.setBinContent(eid, iflag, ft->_state);
151  fSum+=(*ft);
152  iflag++;
153  ft->reset();
154  }
155  sumflags.push_back(fSum);
156  }
157 
158  return sumflags;
159  }
160 }
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:15
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:84
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: TPRunSummary.cc:21
std::string _name
Definition: DQModule.h:57
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: TPRunSummary.cc:28
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:124
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:93
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:243
std::string _subsystem
Definition: DQModule.h:64
virtual double getBinContent(int, int)
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:85
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:146
int ietaAbs() const
get the absolute value of the tower ieta
Definition: Run.h:43