RecoLocalTracker
SiStripClusterizer
plugins
SiStripClusterizerConditionsESProducer.cc
Go to the documentation of this file.
1
7
#include <memory>
8
9
#include "
FWCore/Framework/interface/ModuleFactory.h
"
10
#include "
FWCore/Framework/interface/ESProducer.h
"
11
#include "
FWCore/Framework/interface/ESHandle.h
"
12
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
13
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
14
15
#include "
RecoLocalTracker/Records/interface/SiStripClusterizerConditionsRcd.h
"
16
#include "
CalibFormats/SiStripObjects/interface/SiStripClusterizerConditions.h
"
17
18
#include "
CalibFormats/SiStripObjects/interface/SiStripGain.h
"
19
#include "
CalibFormats/SiStripObjects/interface/SiStripDetCabling.h
"
20
21
class
SiStripClusterizerConditionsESProducer
:
public
edm::ESProducer
{
22
public
:
23
SiStripClusterizerConditionsESProducer
(
const
edm::ParameterSet
&);
24
~SiStripClusterizerConditionsESProducer
()
override
{}
25
26
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
27
28
using
ReturnType
= std::unique_ptr<SiStripClusterizerConditions>;
29
ReturnType
produce
(
const
SiStripClusterizerConditionsRcd
&);
30
31
private
:
32
edm::ESGetToken<SiStripGain, SiStripGainRcd>
m_gainToken
;
33
edm::ESGetToken<SiStripNoises, SiStripNoisesRcd>
m_noisesToken
;
34
edm::ESGetToken<SiStripQuality, SiStripQualityRcd>
m_qualityToken
;
35
};
36
37
SiStripClusterizerConditionsESProducer::SiStripClusterizerConditionsESProducer
(
const
edm::ParameterSet
& iConfig) {
38
auto
cc
=
setWhatProduced
(
this
, iConfig.
getParameter
<
std::string
>(
"Label"
));
39
40
m_gainToken
=
cc
.consumesFrom<
SiStripGain
,
SiStripGainRcd
>();
41
m_noisesToken
=
cc
.consumesFrom<
SiStripNoises
,
SiStripNoisesRcd
>();
42
m_qualityToken
=
cc
.consumesFrom<
SiStripQuality
,
SiStripQualityRcd
>(
43
edm::ESInputTag
{
""
, iConfig.
getParameter
<
std::string
>(
"QualityLabel"
)});
44
}
45
46
void
SiStripClusterizerConditionsESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
47
edm::ParameterSetDescription
desc
;
48
desc
.add<
std::string
>(
"QualityLabel"
,
""
);
49
desc
.add<
std::string
>(
"Label"
,
""
);
50
descriptions.
add
(
"SiStripClusterizerConditionsESProducer"
,
desc
);
51
}
52
53
SiStripClusterizerConditionsESProducer::ReturnType
SiStripClusterizerConditionsESProducer::produce
(
54
const
SiStripClusterizerConditionsRcd
& iRecord) {
55
auto
gainsH = iRecord.
getTransientHandle
(
m_gainToken
);
56
const
auto
&
noises
= iRecord.
get
(
m_noisesToken
);
57
const
auto
&
quality
= iRecord.
get
(
m_qualityToken
);
58
59
auto
product = std::make_unique<SiStripClusterizerConditions>(&
quality
);
60
61
const
auto
& connected =
quality
.cabling()->connected();
62
const
auto
& detCabling =
quality
.cabling()->getDetCabling();
63
product->reserve(connected.size());
64
for
(
const
auto
&
conn
: connected) {
65
const
auto
det =
conn
.first;
66
if
(!
quality
.IsModuleBad(det)) {
67
const
auto
gainRange = gainsH->getRange(det);
68
std::vector<float> invGains;
69
invGains.reserve(6);
70
std::transform
(
71
gainRange.first, gainRange.second, std::back_inserter(invGains), [](
auto
gain
) { return 1.f / gain; });
72
73
static
const
std::vector<const FedChannelConnection*> noConn{};
74
const
auto
detConn_it = detCabling.find(det);
75
76
product->emplace_back(det,
77
quality
.getRange(det),
78
noises
.getRange(det),
79
invGains,
80
(detCabling.end() != detConn_it) ? (*detConn_it).second : noConn);
81
}
82
}
83
LogDebug
(
"SiStripClusterizerConditionsESProducer"
)
84
<<
"Produced a SiStripClusterizerConditions object for "
<< product->allDets().size() <<
" modules"
;
85
return
product;
86
}
87
88
DEFINE_FWK_EVENTSETUP_MODULE
(
SiStripClusterizerConditionsESProducer
);
ConfigurationDescriptions.h
SiStripGainRcd
Definition:
SiStripDependentRecords.h:29
SiStripClusterizerConditionsESProducer
Definition:
SiStripClusterizerConditionsESProducer.cc:21
edm::ESInputTag
Definition:
ESInputTag.h:87
ESHandle.h
SiStripNoises
Definition:
SiStripNoises.h:25
SiStripGain.h
AlCaHarvesting_cff.SiStripQuality
SiStripQuality
Definition:
AlCaHarvesting_cff.py:223
SiStripGain
Definition:
SiStripGain.h:44
SiStripClusterizerConditionsESProducer::m_qualityToken
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > m_qualityToken
Definition:
SiStripClusterizerConditionsESProducer.cc:34
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition:
ESProducer.h:163
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
ESProducer.h
SiStripCommissioningClient_cfg.conn
conn
Definition:
SiStripCommissioningClient_cfg.py:5
SiStripClusterizerConditionsESProducer::ReturnType
std::unique_ptr< SiStripClusterizerConditions > ReturnType
Definition:
SiStripClusterizerConditionsESProducer.cc:28
SiStripClusterizerConditionsESProducer::m_gainToken
edm::ESGetToken< SiStripGain, SiStripGainRcd > m_gainToken
Definition:
SiStripClusterizerConditionsESProducer.cc:32
SiStripNoisesRcd
Definition:
SiStripCondDataRecords.h:40
quality
const uint32_t *__restrict__ Quality * quality
Definition:
CAHitNtupletGeneratorKernelsImpl.h:109
SiStripDetCabling.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
SiStripQualityRcd
Definition:
SiStripDependentRecords.h:55
SiStripClusterizerConditionsESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
SiStripClusterizerConditionsESProducer.cc:46
edm::eventsetup::DependentRecordImplementation::getTransientHandle
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition:
DependentRecordImplementation.h:98
SiStripClusterizerConditionsESProducer::~SiStripClusterizerConditionsESProducer
~SiStripClusterizerConditionsESProducer() override
Definition:
SiStripClusterizerConditionsESProducer.cc:24
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition:
HcalDetIdTransform.cc:7
ParameterSetDescription.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition:
DependentRecordImplementation.h:109
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripClusterizerConditions.h
LogDebug
#define LogDebug(id)
Definition:
MessageLogger.h:233
edm::ParameterSet
Definition:
ParameterSet.h:47
SiStripClusterizerConditionsESProducer::m_noisesToken
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > m_noisesToken
Definition:
SiStripClusterizerConditionsESProducer.cc:33
SiStripClusterizerConditionsRcd
Definition:
SiStripClusterizerConditionsRcd.h:8
cc
edm::ESGetToken< SiStripGain, SiStripGainRcd >
PedestalClient_cfi.gain
gain
Definition:
PedestalClient_cfi.py:37
SiStripClusterizerConditionsESProducer::produce
ReturnType produce(const SiStripClusterizerConditionsRcd &)
Definition:
SiStripClusterizerConditionsESProducer.cc:53
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
edm::ESProducer
Definition:
ESProducer.h:104
HLTEgPhaseIITestSequence_cff.noises
noises
Definition:
HLTEgPhaseIITestSequence_cff.py:1348
SiStripClusterizerConditionsRcd.h
SiStripClusterizerConditionsESProducer::SiStripClusterizerConditionsESProducer
SiStripClusterizerConditionsESProducer(const edm::ParameterSet &)
Definition:
SiStripClusterizerConditionsESProducer.cc:37
Generated for CMSSW Reference Manual by
1.8.16