CMS 3D CMS Logo

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