CMS 3D CMS Logo

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