CMS 3D CMS Logo

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