CMS 3D CMS Logo

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