CMS 3D CMS Logo

DQClient.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace constants;
6  std::string const &taskname,
7  edm::ParameterSet const &ps,
9  : DQModule(ps),
10  _taskname(taskname),
11  _totalLS(0),
12  _maxProcessedLS(0),
13  hcalDbServiceToken_(iC.esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()),
14  runInfoToken_(iC.esConsumes<RunInfo, RunInfoRcd, edm::Transition::BeginRun>()),
15  hcalChannelQualityToken_(
17  edm::ESInputTag("", "withTopo"))) {
18  // - SET THE TASK NAME YOU REFER TO
19  // - SET THE CLIENT'S NAME AS WELL - RUN SUMMARY PLOTS
20  // WILL BE GENERATED UNDER THAT FOLDER
21  _name = name;
22  }
23 
24  void DQClient::beginRun(edm::Run const &r, edm::EventSetup const &es) {
25  // TEMPORARY
26  _vhashFEDs.clear();
27  _vcdaqEids.clear();
28  _vhashCrates.clear();
29 
30  // get various FED lists
32  _emap = dbs->getHcalMapping();
33 
34  if (_ptype != fOffline) { // hidefed2crate
36  for (std::vector<int>::const_iterator it = _vFEDs.begin(); it != _vFEDs.end(); ++it) {
37  //
38  // FIXME
39  // until there exists a map of FED2Crate and Crate2FED,
40  // all the unknown Crates will be mapped to 0...
41  //
42  if (*it == 0) {
44  continue;
45  }
46 
47  if (*it > FED_VME_MAX) {
48  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
49  _vhashFEDs.push_back(
50  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
51  } else
53  }
54 
55  // get FEDs registered @cDAQ
56  if (auto runInfoRec = es.tryToGet<RunInfoRcd>()) {
57  const RunInfo &runInfo = es.getData(runInfoToken_);
58  std::vector<int> vfeds = runInfo.m_fed_in;
59  for (std::vector<int>::const_iterator it = vfeds.begin(); it != vfeds.end(); ++it) {
60  if (*it >= constants::FED_VME_MIN && *it <= FED_VME_MAX)
61  _vcdaqEids.push_back(
63  .rawId());
64  else if (*it >= constants::FED_uTCA_MIN && *it <= FEDNumbering::MAXHCALuTCAFEDID) {
65  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
66  _vcdaqEids.push_back(
67  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
68  }
69  }
70  }
71  } else {
73  std::map<int, uint32_t> crateHashMap = utilities::getCrateHashMap(_emap);
74  for (auto &it_crate : _vCrates) {
75  _vhashCrates.push_back(crateHashMap[it_crate]);
76  }
77  }
78 
79  // Initialize channel quality masks, but do not load (changed for 10_4_X,
80  // moving to LS granularity)
82  }
83 
86  edm::LuminosityBlock const &lb,
87  edm::EventSetup const &es) {
88  // get the Channel Quality masks
89  _xQuality.reset();
91  std::vector<DetId> detids = cq->getAllChannels();
92  for (std::vector<DetId>::const_iterator it = detids.begin(); it != detids.end(); ++it) {
94  continue;
95 
96  if (HcalGenericDetId(*it).isHcalDetId()) {
97  HcalDetId did(*it);
98  uint32_t mask = (cq->getValues(did))->getValue();
99  if (mask != 0)
100  _xQuality.push(did, mask);
101  }
102  }
103  }
104 
107  edm::LuminosityBlock const &lb,
108  edm::EventSetup const &) {
110  _totalLS++;
113  }
114 
115  std::vector<flag::Flag> DQClient::endJob(DQMStore::IBooker &, DQMStore::IGetter &) {
116  return std::vector<flag::Flag>();
117  }
118 } // namespace hcaldqm
std::vector< uint32_t > _vcdaqEids
Definition: DQClient.h:74
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:10
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hcalChannelQualityToken_
Definition: DQClient.h:59
std::vector< uint32_t > _vhashFEDs
Definition: DQClient.h:68
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: DQClient.h:58
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:24
std::optional< T > tryToGet() const
Definition: EventSetup.h:103
DQClient(std::string const &, std::string const &, edm::ParameterSet const &, edm::ConsumesCollector &iC)
Definition: DQClient.cc:5
int const SPIGOT_MIN
Definition: Constants.h:120
virtual void push(HcalDetId const &, STDTYPE)
Definition: ContainerXXX.h:227
HcalElectronicsMap const * _emap
Definition: DQClient.h:60
ContainerXXX< uint32_t > _xQuality
Definition: DQClient.h:71
const HcalElectronicsMap * getHcalMapping() const
virtual void reset()
Definition: ContainerXXX.h:292
int const FIBER_VME_MIN
Definition: Constants.h:125
std::vector< uint32_t > _vhashCrates
Definition: DQClient.h:64
int const FED_uTCA_MIN
Definition: Constants.h:87
int const FIBERCH_MIN
Definition: Constants.h:134
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< int > _vCrates
Definition: DQClient.h:63
virtual void beginLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &lb, edm::EventSetup const &)
Definition: DQClient.cc:84
ProcessingType _ptype
Definition: DQModule.h:44
bool isHcalDetId() const
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:105
int const FED_VME_MIN
Definition: Constants.h:82
int const FIBER_uTCA_MIN1
Definition: Constants.h:128
Transition
Definition: Transition.h:12
std::vector< DetId > getAllChannels() const
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition: Utilities.cc:80
std::string _name
Definition: DQModule.h:42
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
HcalGenericSubdetector genericSubdet() const
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition: Utilities.cc:66
std::vector< int > _vFEDs
Definition: DQClient.h:67
constexpr uint32_t rawId() const
HLT enums.
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:97
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: DQClient.cc:115
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
int const FED_VME_MAX
Definition: Constants.h:83
LuminosityBlockNumber_t luminosityBlock() const
Readout chain identification for Hcal.
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: DQClient.h:57
int const SLOT_uTCA_MIN
Definition: Constants.h:107
Definition: Run.h:45