CMS 3D CMS Logo

RecoRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace constants;
5 
7  : DQClient(name, taskname, ps) {
8  _thresh_unihf = ps.getUntrackedParameter<double>("thresh_unihf", 0.2);
9  _thresh_tcds = ps.getUntrackedParameter<double>("thresh_tcds", 1.5);
10  }
11 
12  /* virtual */ void RecoRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) {
13  DQClient::beginRun(r, es);
14  }
15 
16  /*
17  *
18  */
21  edm::LuminosityBlock const& lb,
22  edm::EventSetup const& es) {
23  DQClient::endLuminosityBlock(ib, ig, lb, es);
24  }
25 
26  /*
27  *
28  */
29  /* virtual */ std::vector<flag::Flag> RecoRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) {
30  if (_ptype != fOffline)
31  return std::vector<flag::Flag>();
32 
33  // FILTERS, some useful vectors, hash maps
34  std::vector<uint32_t> vhashCrateHF;
35  vhashCrateHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
36  vhashCrateHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
37  vhashCrateHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
38  filter::HashFilter filter_CrateHF;
40  vhashCrateHF); // preserve only HF crates
43  bool tcdsshift = false;
44  std::vector<flag::Flag> vflags;
45  vflags.resize(nRecoFlag);
46  vflags[fUniSlotHF] = flag::Flag("UniSlotHF");
47  vflags[fTCDS] = flag::Flag("TCDS");
48 
49  // INITIALIZE
50  Container2D cOccupancy_depth, cOccupancyCut_depth;
51  ContainerSingle2D cSummary;
52  Container1D cTimingCut_HBHEPartition;
53  ContainerXXX<double> xUniHF, xUni;
56  cOccupancy_depth.initialize(_taskname,
57  "Occupancy",
62  0);
63  cOccupancyCut_depth.initialize(_taskname,
64  "OccupancyCut",
69  0);
70  cTimingCut_HBHEPartition.initialize(_taskname,
71  "TimingCut",
75  0);
76 
77  cSummary.initialize(_name,
78  "Summary",
80  new quantity::FlagQuantity(vflags),
82  0);
83 
84  // BOOK
85  xUniHF.book(_emap, filter_CrateHF);
86 
87  // LOAD
88  cOccupancy_depth.load(ig, _emap, _subsystem);
89  cOccupancyCut_depth.load(ig, _emap, _subsystem);
90  cTimingCut_HBHEPartition.book(ib, _emap, _subsystem);
91  cSummary.book(ib, _subsystem);
92 
93  // iterate over all channels
94  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
95  for (std::vector<HcalGenericDetId>::const_iterator it = gids.begin(); it != gids.end(); ++it) {
96  if (!it->isHcalDetId())
97  continue;
98 
99  HcalDetId did(it->rawId());
101 
102  if (did.subdet() == HcalForward)
103  xUniHF.get(eid) += cOccupancyCut_depth.getBinContent(did);
104  }
105 
106  // iphi/slot HF non uniformity
107  for (doubleCompactMap::const_iterator it = xUniHF.begin(); it != xUniHF.end(); ++it) {
108  uint32_t hash1 = it->first;
109  HcalElectronicsId eid1(hash1);
110  double x1 = it->second;
111  for (doubleCompactMap::const_iterator jt = xUniHF.begin(); jt != xUniHF.end(); ++jt) {
112  if (jt == it)
113  continue;
114 
115  double x2 = jt->second;
116  if (x2 == 0)
117  continue;
118  if (x1 / x2 < _thresh_unihf)
119  xUni.get(eid1)++;
120  }
121  }
122 
123  // TCDS shift
124  double a = cTimingCut_HBHEPartition.getMean(HcalDetId(HcalBarrel, 1, 5, 1));
125  double b = cTimingCut_HBHEPartition.getMean(HcalDetId(HcalBarrel, 1, 30, 1));
126  double c = cTimingCut_HBHEPartition.getMean(HcalDetId(HcalBarrel, 1, 55, 1));
127  double dab = fabs(a - b);
128  double dac = fabs(a - c);
129  double dbc = fabs(b - c);
130  if (dab >= _thresh_tcds || dac >= _thresh_tcds || dbc >= _thresh_tcds)
131  tcdsshift = true;
132 
133  // summary flags
134  std::vector<flag::Flag> sumflags;
135  int icrate = 0;
136  for (std::vector<uint32_t>::const_iterator it = _vhashCrates.begin(); it != _vhashCrates.end(); ++it) {
137  flag::Flag fSum("RECO");
138  HcalElectronicsId eid(*it);
139  HcalDetId did = HcalDetId(_emap->lookup(eid));
140 
141  // registered @cDAQ
142  if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap) {
143  if (tcdsshift)
144  vflags[fTCDS]._state = flag::fBAD;
145  else
146  vflags[fTCDS]._state = flag::fGOOD;
147  }
148  if (did.subdet() == HcalForward) {
149  if (xUni.get(eid) > 0)
150  vflags[fUniSlotHF]._state = flag::fBAD;
151  else
152  vflags[fUniSlotHF]._state = flag::fGOOD;
153  }
154 
155  // combine
156  int iflag = 0;
157  for (std::vector<flag::Flag>::iterator ft = vflags.begin(); ft != vflags.end(); ++ft) {
158  cSummary.setBinContent(eid, iflag, ft->_state);
159  fSum += (*ft);
160  iflag++;
161  ft->reset();
162  }
163  sumflags.push_back(fSum);
164  icrate++;
165  }
166 
167  return sumflags;
168  }
169 } // namespace hcaldqm
T getUntrackedParameter(std::string const &, T const &) const
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:33
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:13
virtual CompactMap::const_iterator begin()
Definition: ContainerXXX.h:69
std::string _taskname
Definition: DQClient.h:46
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
RecoRunSummary(std::string const &, std::string const &, edm::ParameterSet const &)
std::vector< uint32_t > _vhashCrates
Definition: DQClient.h:57
int const FIBERCH_MIN
Definition: Constants.h:130
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
virtual CompactMap::const_iterator end()
Definition: ContainerXXX.h:70
ProcessingType _ptype
Definition: DQModule.h:43
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
void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
int const FIBER_uTCA_MIN1
Definition: Constants.h:124
std::vector< HcalGenericDetId > allPrecisionId() const
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::string _name
Definition: DQModule.h:41
virtual double getMean(HcalDetId const &, int axis=1)
Definition: Container1D.cc:189
double getBinContent(HcalDetId const &) override
Definition: Container2D.cc:132
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:87
std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:592
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:25
double b
Definition: hdecay.h:120
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:197
double a
Definition: hdecay.h:121
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:48
virtual void load(DQMStore::IGetter &, HcalElectronicsMap const *, std::string const &subsystem="Hcal", std::string const &aux="")
Definition: Container1D.cc:450
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
Readout chain identification for Hcal.
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
int const SLOT_uTCA_MIN
Definition: Constants.h:103
Definition: Run.h:45
ib
Definition: cuy.py:662