CMS 3D CMS Logo

DQClient.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace constants;
5  DQClient::DQClient(std::string const &name, std::string const &taskname, edm::ParameterSet const &ps)
6  : DQModule(ps), _taskname(taskname), _maxProcessedLS(0) {
7  // - SET THE TASK NAME YOU REFER TO
8  // - SET THE CLIENT'S NAME AS WELL - RUN SUMMARY PLOTS
9  // WILL BE GENERATED UNDER THAT FOLDER
10  _name = name;
11  }
12 
13  void DQClient::beginRun(edm::Run const &r, edm::EventSetup const &es) {
14  // TEMPORARY
15  _vhashFEDs.clear();
16  _vcdaqEids.clear();
17  _vhashCrates.clear();
18 
19  // get various FED lists
21  es.get<HcalDbRecord>().get(dbs);
22  _emap = dbs->getHcalMapping();
23 
24  if (_ptype != fOffline) { // hidefed2crate
26  for (std::vector<int>::const_iterator it = _vFEDs.begin(); it != _vFEDs.end(); ++it) {
27  //
28  // FIXME
29  // until there exists a map of FED2Crate and Crate2FED,
30  // all the unknown Crates will be mapped to 0...
31  //
32  if (*it == 0) {
34  continue;
35  }
36 
37  if (*it > FED_VME_MAX) {
38  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
39  _vhashFEDs.push_back(
40  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
41  } else
43  }
44 
45  // get FEDs registered @cDAQ
46  if (auto runInfoRec = es.tryToGet<RunInfoRcd>()) {
48  runInfoRec->get(ri);
49  std::vector<int> vfeds = ri->m_fed_in;
50  for (std::vector<int>::const_iterator it = vfeds.begin(); it != vfeds.end(); ++it) {
51  if (*it >= constants::FED_VME_MIN && *it <= FED_VME_MAX)
52  _vcdaqEids.push_back(
54  .rawId());
55  else if (*it >= constants::FED_uTCA_MIN && *it <= FEDNumbering::MAXHCALuTCAFEDID) {
56  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
57  _vcdaqEids.push_back(
58  HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
59  }
60  }
61  }
62  } else {
64  std::map<int, uint32_t> crateHashMap = utilities::getCrateHashMap(_emap);
65  for (auto &it_crate : _vCrates) {
66  _vhashCrates.push_back(crateHashMap[it_crate]);
67  }
68  }
69 
70  // Initialize channel quality masks, but do not load (changed for 10_4_X,
71  // moving to LS granularity)
73  }
74 
77  edm::LuminosityBlock const &lb,
78  edm::EventSetup const &es) {
79  // get the Channel Quality masks
80  _xQuality.reset();
82  es.get<HcalChannelQualityRcd>().get("withTopo", hcq);
83  const HcalChannelQuality *cq = hcq.product();
84  std::vector<DetId> detids = cq->getAllChannels();
85  for (std::vector<DetId>::const_iterator it = detids.begin(); it != detids.end(); ++it) {
87  continue;
88 
89  if (HcalGenericDetId(*it).isHcalDetId()) {
90  HcalDetId did(*it);
91  uint32_t mask = (cq->getValues(did))->getValue();
92  if (mask != 0)
93  _xQuality.push(did, mask);
94  }
95  }
96  }
97 
100  edm::LuminosityBlock const &lb,
101  edm::EventSetup const &) {
103  _totalLS++;
106  }
107 
108  std::vector<flag::Flag> DQClient::endJob(DQMStore::IBooker &, DQMStore::IGetter &) {
109  return std::vector<flag::Flag>();
110  }
111 } // namespace hcaldqm
std::vector< uint32_t > _vcdaqEids
Definition: DQClient.h:67
constexpr uint32_t rawId() const
std::optional< T > tryToGet() const
Definition: EventSetup.h:92
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:10
std::vector< uint32_t > _vhashFEDs
Definition: DQClient.h:61
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:13
int const SPIGOT_MIN
Definition: Constants.h:116
virtual void push(HcalDetId const &, STDTYPE)
Definition: ContainerXXX.h:227
HcalElectronicsMap const * _emap
Definition: DQClient.h:53
ContainerXXX< uint32_t > _xQuality
Definition: DQClient.h:64
const Item * getValues(DetId fId, bool throwOnFail=true) const
virtual void reset()
Definition: ContainerXXX.h:292
int const FIBER_VME_MIN
Definition: Constants.h:121
std::vector< uint32_t > _vhashCrates
Definition: DQClient.h:57
int const FED_uTCA_MIN
Definition: Constants.h:83
int const FIBERCH_MIN
Definition: Constants.h:130
LuminosityBlockNumber_t luminosityBlock() const
std::vector< int > _vCrates
Definition: DQClient.h:56
virtual void beginLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &lb, edm::EventSetup const &)
Definition: DQClient.cc:75
ProcessingType _ptype
Definition: DQModule.h:43
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:98
int const FED_VME_MIN
Definition: Constants.h:78
std::vector< DetId > getAllChannels() const
std::vector< int > m_fed_in
Definition: RunInfo.h:26
int const FIBER_uTCA_MIN1
Definition: Constants.h:124
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition: Utilities.cc:66
std::string _name
Definition: DQModule.h:41
bool isHcalDetId() const
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition: Utilities.cc:52
std::vector< int > _vFEDs
Definition: DQClient.h:60
DQClient(std::string const &, std::string const &, edm::ParameterSet const &)
Definition: DQClient.cc:5
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:83
T get() const
Definition: EventSetup.h:71
const HcalElectronicsMap * getHcalMapping() const
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
Definition: DQClient.cc:108
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
HcalGenericSubdetector genericSubdet() const
int const FED_VME_MAX
Definition: Constants.h:79
T const * product() const
Definition: ESHandle.h:86
Readout chain identification for Hcal.
int const SLOT_uTCA_MIN
Definition: Constants.h:103
Definition: Run.h:45