DQM
HcalCommon
src
DQClient.cc
Go to the documentation of this file.
1
#include "
DQM/HcalCommon/interface/DQClient.h
"
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
20
edm::ESHandle<HcalDbService>
dbs;
21
es.
get
<
HcalDbRecord
>().
get
(dbs);
22
_emap
= dbs->
getHcalMapping
();
23
24
if
(
_ptype
!=
fOffline
) {
// hidefed2crate
25
_vFEDs
=
utilities::getFEDList
(
_emap
);
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) {
33
_vhashFEDs
.push_back(
HcalElectronicsId
(0,
SLOT_uTCA_MIN
,
FIBER_uTCA_MIN1
,
FIBERCH_MIN
,
false
).rawId());
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
42
_vhashFEDs
.push_back(
HcalElectronicsId
(
FIBERCH_MIN
,
FIBER_VME_MIN
,
SPIGOT_MIN
, (*it) -
FED_VME_MIN
).rawId());
43
}
44
45
// get FEDs registered @cDAQ
46
if
(
auto
runInfoRec = es.
tryToGet
<
RunInfoRcd
>()) {
47
edm::ESHandle<RunInfo>
ri;
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(
53
HcalElectronicsId
(
constants::FIBERCH_MIN
,
constants::FIBER_VME_MIN
,
SPIGOT_MIN
, (*it) -
FED_VME_MIN
)
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
{
63
_vCrates
=
utilities::getCrateList
(
_emap
);
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)
72
_xQuality
.
initialize
(
hashfunctions::fDChannel
);
73
}
74
75
void
DQClient::beginLuminosityBlock
(
DQMStore::IBooker
&,
76
DQMStore::IGetter
&,
77
edm::LuminosityBlock
const
&lb,
78
edm::EventSetup
const
&es) {
79
// get the Channel Quality masks
80
_xQuality
.
reset
();
81
edm::ESHandle<HcalChannelQuality>
hcq;
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) {
86
if
(
HcalGenericDetId
(*it).
genericSubdet
() ==
HcalGenericDetId::HcalGenUnknown
)
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
98
void
DQClient::endLuminosityBlock
(
DQMStore::IBooker
&,
99
DQMStore::IGetter
&,
100
edm::LuminosityBlock
const
&lb,
101
edm::EventSetup
const
&) {
102
_currentLS
= lb.
luminosityBlock
();
103
_totalLS
++;
104
if
(
_maxProcessedLS
<
_currentLS
)
105
_maxProcessedLS
=
_currentLS
;
106
}
107
108
std::vector<flag::Flag>
DQClient::endJob
(
DQMStore::IBooker
&,
DQMStore::IGetter
&) {
109
return
std::vector<flag::Flag>();
110
}
111
}
// namespace hcaldqm
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
hcaldqm::constants::FED_VME_MIN
const int FED_VME_MIN
Definition:
Constants.h:80
hcaldqm::DQClient::_vcdaqEids
std::vector< uint32_t > _vcdaqEids
Definition:
DQClient.h:70
hcaldqm::ContainerXXX::initialize
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition:
ContainerXXX.h:81
hcaldqm::DQClient::_xQuality
ContainerXXX< uint32_t > _xQuality
Definition:
DQClient.h:67
hcaldqm::utilities::getCrateHashMap
std::map< int, uint32_t > getCrateHashMap(HcalElectronicsMap const *emap)
Definition:
Utilities.cc:66
hcaldqm::DQModule
Definition:
DQModule.h:30
HcalGenericDetId
Definition:
HcalGenericDetId.h:15
edm::LuminosityBlock
Definition:
LuminosityBlock.h:50
HcalChannelQualityRcd
Definition:
HcalChannelQualityRcd.h:8
edm::Run
Definition:
Run.h:45
hcaldqm::DQClient::_vhashFEDs
std::vector< uint32_t > _vhashFEDs
Definition:
DQClient.h:64
hcaldqm
Definition:
Constants.h:8
hcaldqm::constants::SPIGOT_MIN
const int SPIGOT_MIN
Definition:
Constants.h:118
hcaldqm::utilities::getCrateList
std::vector< int > getCrateList(HcalElectronicsMap const *emap)
Definition:
Utilities.cc:52
hcaldqm::constants::SLOT_uTCA_MIN
const int SLOT_uTCA_MIN
Definition:
Constants.h:105
hcaldqm::constants::FIBER_uTCA_MIN1
const int FIBER_uTCA_MIN1
Definition:
Constants.h:126
RunInfo::m_fed_in
std::vector< int > m_fed_in
Definition:
RunInfo.h:25
HcalChannelQuality
Definition:
HcalChannelQuality.h:17
constants
hcaldqm::DQClient::endLuminosityBlock
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition:
DQClient.cc:98
hcaldqm::DQModule::_ptype
ProcessingType _ptype
Definition:
DQModule.h:43
hcaldqm::DQClient::_vFEDs
std::vector< int > _vFEDs
Definition:
DQClient.h:63
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition:
HcalCondObjectContainer.h:159
hcaldqm::utilities::getFEDList
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition:
Utilities.cc:83
HcalDbService::getHcalMapping
const HcalElectronicsMap * getHcalMapping() const
Definition:
HcalDbService.cc:343
hcaldqm::DQClient::beginLuminosityBlock
virtual void beginLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &lb, edm::EventSetup const &)
Definition:
DQClient.cc:75
edm::EventSetup::tryToGet
std::optional< T > tryToGet() const
Definition:
EventSetup.h:101
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
hcaldqm::DQClient::_totalLS
int _totalLS
Definition:
DQClient.h:52
hcaldqm::DQModule::_currentLS
int _currentLS
Definition:
DQModule.h:52
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition:
LuminosityBlockBase.h:40
hcaldqm::ContainerXXX::push
virtual void push(HcalDetId const &, STDTYPE)
Definition:
ContainerXXX.h:227
HcalGenericDetId::HcalGenUnknown
Definition:
HcalGenericDetId.h:27
hcaldqm::ContainerXXX::reset
virtual void reset()
Definition:
ContainerXXX.h:292
hcaldqm::DQClient::beginRun
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition:
DQClient.cc:13
hcaldqm::constants::FIBER_VME_MIN
const int FIBER_VME_MIN
Definition:
Constants.h:123
edm::ESHandle< HcalDbService >
HcalElectronicsId
Readout chain identification for Hcal.
Definition:
HcalElectronicsId.h:32
hcaldqm::DQModule::_name
std::string _name
Definition:
DQModule.h:41
DQClient.h
hcaldqm::constants::FIBERCH_MIN
const int FIBERCH_MIN
Definition:
Constants.h:132
hcaldqm::DQClient::_maxProcessedLS
int _maxProcessedLS
Definition:
DQClient.h:53
hcaldqm::DQClient::DQClient
DQClient(std::string const &, std::string const &, edm::ParameterSet const &)
Definition:
DQClient.cc:5
RunInfoRcd
Definition:
RunSummaryRcd.h:26
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
hcaldqm::hashfunctions::fDChannel
Definition:
HashFunctions.h:134
hcaldqm::constants::FED_uTCA_MIN
const int FED_uTCA_MIN
Definition:
Constants.h:85
HcalCondObjectContainer::getAllChannels
std::vector< DetId > getAllChannels() const
Definition:
HcalCondObjectContainer.h:312
reco::JetExtendedAssociation::getValue
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
Definition:
JetExtendedAssociation.cc:50
hcaldqm::constants::FED_VME_MAX
const int FED_VME_MAX
Definition:
Constants.h:81
FEDNumbering::MAXHCALuTCAFEDID
Definition:
FEDNumbering.h:104
HcalDetId
Definition:
HcalDetId.h:12
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
hcaldqm::DQClient::_vhashCrates
std::vector< uint32_t > _vhashCrates
Definition:
DQClient.h:60
HcalGenericDetId::isHcalDetId
bool isHcalDetId() const
Definition:
HcalGenericDetId.cc:64
hcaldqm::DQClient::_emap
const HcalElectronicsMap * _emap
Definition:
DQClient.h:56
dqm::implementation::IGetter
Definition:
DQMStore.h:484
HcalGenericDetId::genericSubdet
HcalGenericSubdetector genericSubdet() const
Definition:
HcalGenericDetId.cc:21
HcalElectronicsId::rawId
constexpr uint32_t rawId() const
Definition:
HcalElectronicsId.h:59
hcaldqm::utilities::fed2crate
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition:
Utilities.cc:10
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition:
DQMStore.h:43
hcaldqm::DQClient::endJob
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
Definition:
DQClient.cc:108
HcalDbRecord
Definition:
HcalDbRecord.h:30
hcaldqm::DQClient::_vCrates
std::vector< int > _vCrates
Definition:
DQClient.h:59
hcaldqm::fOffline
Definition:
DQModule.h:26
Generated for CMSSW Reference Manual by
1.8.16