CMS 3D CMS Logo

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