CMS 3D CMS Logo

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