CMS 3D CMS Logo

DQHarvester.cc
Go to the documentation of this file.
3 
4 namespace hcaldqm {
5  using namespace constants;
6 
8  : DQModule(ps),
9  hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()),
10  runInfoToken_(esConsumes<RunInfo, RunInfoRcd, edm::Transition::BeginRun>()),
11  hcalChannelQualityToken_(
13  edm::ESInputTag("", "withTopo"))) {}
14 
15  void DQHarvester::beginRun(edm::Run const &r, edm::EventSetup const &es) {
16  if (_ptype == fLocal)
17  if (r.runAuxiliary().run() == 1)
18  return;
19 
20  // TEMPORARY FIX
21  if (_ptype != fOffline) { // hidefed2crate
22  _vhashFEDs.clear();
23  _vcdaqEids.clear();
24  }
25 
26  // - get the Hcal Electronics Map
27  // - collect all the FED numbers and FED's rawIds
29  _emap = dbs->getHcalMapping();
30 
31  if (_ptype != fOffline) { // hidefed2crate
33  for (std::vector<int>::const_iterator it = _vFEDs.begin(); it != _vFEDs.end(); ++it) {
34  //
35  // FIXME
36  // until there exists a map of FED2Crate and Crate2FED,
37  // all the unknown Crates will be mapped to 0...
38  //
39  if (*it == 0) {
41  continue;
42  }
43 
44  if (*it > FED_VME_MAX) {
45  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
46  _vhashFEDs.push_back(
47  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
48  } else
50  }
51 
52  // get the FEDs registered at cDAQ
53  if (auto runInfoRec = es.tryToGet<RunInfoRcd>()) {
54  const RunInfo &runInfo = es.getData(runInfoToken_);
55  std::vector<int> vfeds = runInfo.m_fed_in;
56  for (std::vector<int>::const_iterator it = vfeds.begin(); it != vfeds.end(); ++it) {
57  if (*it >= constants::FED_VME_MIN && *it <= FED_VME_MAX)
58  _vcdaqEids.push_back(
60  .rawId());
62  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
63  _vcdaqEids.push_back(
64  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
65  }
66  }
67  }
68  } else {
70  std::map<int, uint32_t> crateHashMap = utilities::getCrateHashMap(_emap);
71  for (auto &it_crate : _vCrates) {
72  _vhashCrates.push_back(crateHashMap[it_crate]);
73  }
74  }
75 
76  // Initialize channel quality masks, but do not load (changed for 10_4_X,
77  // moving to LS granularity)
79  }
80 
83  edm::LuminosityBlock const &lb,
84  edm::EventSetup const &es) {
85  // get the Hcal Channels Quality for channels that are not 0
87  std::vector<DetId> detids = cq->getAllChannels();
88  for (std::vector<DetId>::const_iterator it = detids.begin(); it != detids.end(); ++it) {
90  continue;
91 
92  if (HcalGenericDetId(*it).isHcalDetId()) {
93  HcalDetId did(*it);
94  uint32_t mask = (cq->getValues(did))->getValue();
95  if (mask != 0)
96  _xQuality.push(did, mask);
97  }
98  }
99  }
100 
102  DQMStore::IGetter &ig,
103  edm::LuminosityBlock const &lb,
104  edm::EventSetup const &es) {
105  // should be the same - just in case!
107  _totalLS++;
108  _dqmEndLuminosityBlock(ib, ig, lb, es);
109  }
111 } // namespace hcaldqm
ContainerXXX< uint32_t > _xQuality
Definition: DQHarvester.h:48
std::vector< uint32_t > _vhashFEDs
Definition: DQHarvester.h:46
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:10
dbs
Find files in dataset.
std::optional< T > tryToGet() const
Definition: EventSetup.h:100
virtual void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)=0
int const SPIGOT_MIN
Definition: Constants.h:124
virtual void push(HcalDetId const &, STDTYPE)
Definition: ContainerXXX.h:228
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: DQHarvester.h:53
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: DQHarvester.cc:101
int const FIBER_VME_MIN
Definition: Constants.h:129
int const FED_uTCA_MIN
Definition: Constants.h:91
int const FIBERCH_MIN
Definition: Constants.h:138
const Item * getValues(DetId fId, bool throwOnFail=true) const
ProcessingType _ptype
Definition: DQModule.h:44
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: DQHarvester.h:54
bool isHcalDetId() const
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalChannelQualityToken_
Definition: DQHarvester.h:55
int const FED_VME_MIN
Definition: Constants.h:86
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:81
int const FIBER_uTCA_MIN1
Definition: Constants.h:132
Transition
Definition: Transition.h:12
std::vector< DetId > getAllChannels() const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DQHarvester.cc:110
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition: Utilities.cc:80
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
HcalGenericSubdetector genericSubdet() const
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition: Utilities.cc:66
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
constexpr uint32_t rawId() const
HLT enums.
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:97
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:82
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQHarvester.cc:15
int const FED_VME_MAX
Definition: Constants.h:87
LuminosityBlockNumber_t luminosityBlock() const
Readout chain identification for Hcal.
int const SLOT_uTCA_MIN
Definition: Constants.h:111
Definition: Run.h:45
ib
Definition: cuy.py:661