CalibTracker
SiStripESProducers
plugins
real
SiStripDelayESProducer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: SiStripDelayESProducer
4
// Class: SiStripDelayESProducer
5
//
13
//
14
// Original Author: M. De Mattia
15
// Created: 26/10/2010
16
//
17
//
18
19
// system include files
20
#include <memory>
21
22
// user include files
23
#include "
FWCore/Framework/interface/ModuleFactory.h
"
24
#include "
FWCore/Framework/interface/ESProducer.h
"
25
#include "
FWCore/Framework/interface/ModuleFactory.h
"
26
27
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
28
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
29
30
#include "
DataFormats/SiStripCommon/interface/SiStripConstants.h
"
31
#include "
CalibFormats/SiStripObjects/interface/SiStripDelay.h
"
32
#include "
CalibTracker/Records/interface/SiStripDependentRecords.h
"
33
34
class
SiStripDelayESProducer
:
public
edm::ESProducer
{
35
public
:
36
SiStripDelayESProducer
(
const
edm::ParameterSet
&);
37
~SiStripDelayESProducer
()
override
{};
38
39
std::unique_ptr<SiStripDelay>
produce
(
const
SiStripDelayRcd
&);
40
41
private
:
42
struct
TokenSign
{
43
TokenSign
(
edm::ESConsumesCollector
&
cc
,
const
std::string
&
recordName
,
const
std::string
&
label
,
int
sumSign)
44
:
token_
{
cc
.consumesFrom<
SiStripBaseDelay
,
SiStripBaseDelayRcd
>(
edm::ESInputTag
{
""
,
label
})},
45
recordName_
{
recordName
},
46
label_
{
label
},
47
sumSign_
{sumSign} {}
48
edm::ESGetToken<SiStripBaseDelay, SiStripBaseDelayRcd>
token_
;
49
std::string
recordName_
;
50
std::string
label_
;
51
int
sumSign_
;
52
};
53
std::vector<TokenSign>
tokens_
;
54
};
55
56
SiStripDelayESProducer::SiStripDelayESProducer
(
const
edm::ParameterSet
& iConfig) {
57
auto
cc
=
setWhatProduced
(
this
);
58
59
edm::LogInfo
(
"SiStripDelayESProducer"
) <<
"ctor"
<< std::endl;
60
61
for
(
const
auto
&
pset
: iConfig.
getParameter
<std::vector<edm::ParameterSet>>(
"ListOfRecordToMerge"
)) {
62
auto
recordName
=
pset
.getParameter<
std::string
>(
"Record"
);
63
auto
label
=
pset
.getParameter<
std::string
>(
"Label"
);
64
65
edm::LogInfo
(
"SiStripDelayESProducer"
)
66
<<
"[SiStripDelayESProducer::ctor] Going to get data from record "
<<
recordName
<<
" with label "
<<
label
;
67
68
// Is the "recordName" parameter really useful?
69
if
(
recordName
==
"SiStripBaseDelayRcd"
) {
70
tokens_
.emplace_back(
cc
,
recordName
,
label
,
pset
.getParameter<
int
>(
"SumSign"
));
71
}
else
{
72
// Would an exception make sense?
73
edm::LogError
(
"SiStripDelayESProducer"
)
74
<<
"[SiStripDelayESProducer::ctor] Skipping the requested data for unexisting record "
<<
recordName
75
<<
" with tag "
<<
label
<< std::endl;
76
}
77
}
78
}
79
80
std::unique_ptr<SiStripDelay>
SiStripDelayESProducer::produce
(
const
SiStripDelayRcd
& iRecord) {
81
edm::LogInfo
(
"SiStripDelayESProducer"
) <<
"produce called"
<< std::endl;
82
auto
delay
= std::make_unique<SiStripDelay>();
83
84
for
(
const
auto
& tokenSign :
tokens_
) {
85
const
auto
& baseDelay = iRecord.
get
(tokenSign.token_);
86
delay
->fillNewDelay(baseDelay, tokenSign.sumSign_, std::make_pair(tokenSign.recordName_, tokenSign.label_));
87
}
88
89
delay
->makeDelay();
90
91
return
delay
;
92
}
93
94
DEFINE_FWK_EVENTSETUP_MODULE
(
SiStripDelayESProducer
);
SiStripDelay.h
SiStripDependentRecords.h
edm::ESInputTag
Definition:
ESInputTag.h:87
SiStripDelayESProducer::~SiStripDelayESProducer
~SiStripDelayESProducer() override
Definition:
SiStripDelayESProducer.cc:37
MessageLogger.h
edm::ESConsumesCollector
Definition:
ESConsumesCollector.h:61
SiStripDelayESProducer::TokenSign::sumSign_
int sumSign_
Definition:
SiStripDelayESProducer.cc:51
align_cfg.recordName
recordName
Definition:
align_cfg.py:66
SiStripDelayESProducer
Definition:
SiStripDelayESProducer.cc:34
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition:
ESProducer.h:163
ESProducer.h
SiStripDelayESProducer::produce
std::unique_ptr< SiStripDelay > produce(const SiStripDelayRcd &)
Definition:
SiStripDelayESProducer.cc:80
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
SiStripBaseDelay
Definition:
SiStripBaseDelay.h:23
SiStripDelayESProducer::TokenSign::TokenSign
TokenSign(edm::ESConsumesCollector &cc, const std::string &recordName, const std::string &label, int sumSign)
Definition:
SiStripDelayESProducer.cc:43
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition:
DependentRecordImplementation.h:103
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripConstants.h
edm::ParameterSet
Definition:
ParameterSet.h:47
SiStripDelayESProducer::tokens_
std::vector< TokenSign > tokens_
Definition:
SiStripDelayESProducer.cc:53
SiStripDelayESProducer::SiStripDelayESProducer
SiStripDelayESProducer(const edm::ParameterSet &)
Definition:
SiStripDelayESProducer.cc:56
SiStripDelayESProducer::TokenSign
Definition:
SiStripDelayESProducer.cc:42
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
cc
edm::ESGetToken< SiStripBaseDelay, SiStripBaseDelayRcd >
SiStripDelayESProducer::TokenSign::label_
std::string label_
Definition:
SiStripDelayESProducer.cc:50
ModuleFactory.h
SiStripDelayESProducer::TokenSign::recordName_
std::string recordName_
Definition:
SiStripDelayESProducer.cc:49
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
SiStripBaseDelayRcd
Definition:
SiStripCondDataRecords.h:38
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
edm::ESProducer
Definition:
ESProducer.h:104
phase2TrackerDigitizer_cfi.delay
delay
Definition:
phase2TrackerDigitizer_cfi.py:49
ParameterSet.h
SiStripDelayRcd
Definition:
SiStripDependentRecords.h:36
label
const char * label
Definition:
PFTauDecayModeTools.cc:11
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
SiStripDelayESProducer::TokenSign::token_
edm::ESGetToken< SiStripBaseDelay, SiStripBaseDelayRcd > token_
Definition:
SiStripDelayESProducer.cc:48
Generated for CMSSW Reference Manual by
1.8.16