CMS 3D CMS Logo

DQHarvester.cc
Go to the documentation of this file.
3 
4 namespace hcaldqm
5 {
7  DQModule(ps)
8  {}
9 
10  /* virtual */ void DQHarvester::beginRun(edm::Run const& r,
11  edm::EventSetup const& es)
12  {
13  if (_ptype==fLocal)
14  if (r.runAuxiliary().run()==1)
15  return;
16 
17  // TEMPORARY FIX
18  if (_ptype != fOffline) { // hidefed2crate
19  _vhashFEDs.clear();
20  _vcdaqEids.clear();
21  }
22 
23  // - get the Hcal Electronics Map
24  // - collect all the FED numbers and FED's rawIds
26  es.get<HcalDbRecord>().get(dbs);
27  _emap = dbs->getHcalMapping();
28 
29  if (_ptype != fOffline) { // hidefed2crate
31  for (std::vector<int>::const_iterator it=_vFEDs.begin();
32  it!=_vFEDs.end(); ++it)
33  {
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)
40  {
41  _vhashFEDs.push_back(HcalElectronicsId(
43  FIBERCH_MIN, false).rawId());
44  continue;
45  }
46 
47  if (*it>FED_VME_MAX)
48  {
49  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
50  _vhashFEDs.push_back(HcalElectronicsId(
51  cspair.first, cspair.second, FIBER_uTCA_MIN1,
52  FIBERCH_MIN, false).rawId());
53  }
54  else
56  FIBER_VME_MIN, SPIGOT_MIN, (*it)-FED_VME_MIN).rawId());
57  }
58 
59  // get the FEDs registered at cDAQ
62  "RunInfoRcd"));
63  if (es.find(recordKey))
64  {
66  es.get<RunInfoRcd>().get(ri);
67  std::vector<int> vfeds= ri->m_fed_in;
68  for (std::vector<int>::const_iterator it=vfeds.begin();
69  it!=vfeds.end(); ++it)
70  {
71  if (*it>=constants::FED_VME_MIN && *it<=FED_VME_MAX)
72  _vcdaqEids.push_back(HcalElectronicsId(
75  (*it)-FED_VME_MIN).rawId());
76  else if (*it>=constants::FED_uTCA_MIN &&
78  {
79  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
80  _vcdaqEids.push_back(HcalElectronicsId(
81  cspair.first, cspair.second,
82  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
83  }
84  }
85  }
86  } else {
88  std::map<int, uint32_t> crateHashMap = utilities::getCrateHashMap(_emap);
89  for (auto& it_crate : _vCrates) {
90  _vhashCrates.push_back(crateHashMap[it_crate]);
91  }
92  }
93 
94  // get the Hcal Channels Quality for channels that are not 0
97  es.get<HcalChannelQualityRcd>().get("withTopo", hcq);
98  const HcalChannelQuality *cq = hcq.product();
99  std::vector<DetId> detids = cq->getAllChannels();
100  for (std::vector<DetId>::const_iterator it=detids.begin();
101  it!=detids.end(); ++it)
102  {
103  if (HcalGenericDetId(*it).genericSubdet()==
105  continue;
106 
107  if (HcalGenericDetId(*it).isHcalDetId())
108  {
109  HcalDetId did(*it);
110  uint32_t mask = (cq->getValues(did))->getValue();
111  if (mask!=0)
112  _xQuality.push(did, mask);
113  }
114  }
115  }
116 
119  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
120  {
121  // should be the same - just in case!
123  _totalLS++;
124  _dqmEndLuminosityBlock(ib, ig, lb, es);
125  }
127  DQMStore::IGetter& ig)
128  {
129  _dqmEndJob(ib, ig);
130  }
131 }
ContainerXXX< uint32_t > _xQuality
Definition: DQHarvester.h:45
std::vector< uint32_t > _vhashFEDs
Definition: DQHarvester.h:43
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:12
uint32_t rawId() const
virtual void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)=0
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
int const SPIGOT_MIN
Definition: Constants.h:136
virtual void push(HcalDetId const &, STDTYPE)
Definition: ContainerXXX.h:285
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:117
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
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:88
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
int const FIBER_uTCA_MIN1
Definition: Constants.h:144
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: DQHarvester.cc:126
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:62
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:32
std::vector< uint32_t > _vhashCrates
Definition: DQHarvester.h:39
DQHarvester(edm::ParameterSet const &)
Definition: DQHarvester.cc:6
std::vector< int > _vCrates
Definition: DQHarvester.h:38
const T & get() const
Definition: EventSetup.h:59
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:95
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:42
std::vector< uint32_t > _vcdaqEids
Definition: DQHarvester.h:48
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:91
HcalGenericSubdetector genericSubdet() const
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: DQHarvester.cc:10
int const FED_VME_MAX
Definition: Constants.h:99
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:123
Definition: Run.h:43
ib
Definition: cuy.py:660