CMS 3D CMS Logo

DQHarvester.cc
Go to the documentation of this file.
3 
4 namespace hcaldqm {
5  using namespace constants;
6 
8 
9  void DQHarvester::beginRun(edm::Run const &r, edm::EventSetup const &es) {
10  if (_ptype == fLocal)
11  if (r.runAuxiliary().run() == 1)
12  return;
13 
14  // TEMPORARY FIX
15  if (_ptype != fOffline) { // hidefed2crate
16  _vhashFEDs.clear();
17  _vcdaqEids.clear();
18  }
19 
20  // - get the Hcal Electronics Map
21  // - collect all the FED numbers and FED's rawIds
23  es.get<HcalDbRecord>().get(dbs);
24  _emap = dbs->getHcalMapping();
25 
26  if (_ptype != fOffline) { // hidefed2crate
28  for (std::vector<int>::const_iterator it = _vFEDs.begin(); it != _vFEDs.end(); ++it) {
29  //
30  // FIXME
31  // until there exists a map of FED2Crate and Crate2FED,
32  // all the unknown Crates will be mapped to 0...
33  //
34  if (*it == 0) {
36  continue;
37  }
38 
39  if (*it > FED_VME_MAX) {
40  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
41  _vhashFEDs.push_back(
42  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
43  } else
45  }
46 
47  // get the FEDs registered at cDAQ
48  if (auto runInfoRec = es.tryToGet<RunInfoRcd>()) {
50  runInfoRec->get(ri);
51  std::vector<int> vfeds = ri->m_fed_in;
52  for (std::vector<int>::const_iterator it = vfeds.begin(); it != vfeds.end(); ++it) {
53  if (*it >= constants::FED_VME_MIN && *it <= FED_VME_MAX)
54  _vcdaqEids.push_back(
56  .rawId());
57  else if (*it >= constants::FED_uTCA_MIN && *it <= FEDNumbering::MAXHCALuTCAFEDID) {
58  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
59  _vcdaqEids.push_back(
60  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
61  }
62  }
63  }
64  } else {
66  std::map<int, uint32_t> crateHashMap = utilities::getCrateHashMap(_emap);
67  for (auto &it_crate : _vCrates) {
68  _vhashCrates.push_back(crateHashMap[it_crate]);
69  }
70  }
71 
72  // Initialize channel quality masks, but do not load (changed for 10_4_X,
73  // moving to LS granularity)
75  }
76 
79  edm::LuminosityBlock const &lb,
80  edm::EventSetup const &es) {
81  // get the Hcal Channels Quality for channels that are not 0
83  es.get<HcalChannelQualityRcd>().get("withTopo", hcq);
84  const HcalChannelQuality *cq = hcq.product();
85  std::vector<DetId> detids = cq->getAllChannels();
86  for (std::vector<DetId>::const_iterator it = detids.begin(); it != detids.end(); ++it) {
88  continue;
89 
90  if (HcalGenericDetId(*it).isHcalDetId()) {
91  HcalDetId did(*it);
92  uint32_t mask = (cq->getValues(did))->getValue();
93  if (mask != 0)
94  _xQuality.push(did, mask);
95  }
96  }
97  }
98 
100  DQMStore::IGetter &ig,
101  edm::LuminosityBlock const &lb,
102  edm::EventSetup const &es) {
103  // should be the same - just in case!
105  _totalLS++;
106  _dqmEndLuminosityBlock(ib, ig, lb, es);
107  }
109 } // namespace hcaldqm
ContainerXXX< uint32_t > _xQuality
Definition: DQHarvester.h:48
constexpr uint32_t rawId() const
std::vector< uint32_t > _vhashFEDs
Definition: DQHarvester.h:46
std::optional< T > tryToGet() const
Definition: EventSetup.h:92
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:10
virtual void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)=0
int const SPIGOT_MIN
Definition: Constants.h:108
virtual void push(HcalDetId const &, STDTYPE)
Definition: ContainerXXX.h:227
const Item * getValues(DetId fId, bool throwOnFail=true) const
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: DQHarvester.cc:99
int const FIBER_VME_MIN
Definition: Constants.h:113
int const FED_uTCA_MIN
Definition: Constants.h:75
int const FIBERCH_MIN
Definition: Constants.h:122
LuminosityBlockNumber_t luminosityBlock() const
ProcessingType _ptype
Definition: DQModule.h:43
int const FED_VME_MIN
Definition: Constants.h:70
std::vector< DetId > getAllChannels() const
std::vector< int > m_fed_in
Definition: RunInfo.h:26
virtual void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)=0
void dqmBeginLuminosityBlock(DQMStore::IBooker &ib, DQMStore::IGetter &ig, edm::LuminosityBlock const &lb, edm::EventSetup const &es)
Definition: DQHarvester.cc:77
int const FIBER_uTCA_MIN1
Definition: Constants.h:116
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DQHarvester.cc:108
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:61
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition: Utilities.cc:66
bool isHcalDetId() const
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition: Utilities.cc:52
HcalElectronicsMap const * _emap
Definition: DQHarvester.h:35
std::vector< uint32_t > _vhashCrates
Definition: DQHarvester.h:42
DQHarvester(edm::ParameterSet const &)
Definition: DQHarvester.cc:7
std::vector< int > _vCrates
Definition: DQHarvester.h:41
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:83
T get() const
Definition: EventSetup.h:71
const HcalElectronicsMap * getHcalMapping() const
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
std::vector< int > _vFEDs
Definition: DQHarvester.h:45
std::vector< uint32_t > _vcdaqEids
Definition: DQHarvester.h:51
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
HcalGenericSubdetector genericSubdet() const
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQHarvester.cc:9
int const FED_VME_MAX
Definition: Constants.h:71
T const * product() const
Definition: ESHandle.h:86
Readout chain identification for Hcal.
RunNumber_t run() const
Definition: RunAuxiliary.h:41
int const SLOT_uTCA_MIN
Definition: Constants.h:95
Definition: Run.h:45
ib
Definition: cuy.py:662