43 template <
typename Record>
56 template <
typename Record>
67 auto cc = setWhatProduced(
this);
69 auto apvGainLabels =
iConfig.getParameter<std::vector<edm::ParameterSet>>(
"APVGain");
70 if (apvGainLabels.empty()) {
71 throw cms::Exception(
"Configuration") <<
"Got empty APVGain vector, but need at least one entry";
75 for (
const auto& gainPSet : apvGainLabels) {
79 if (
record ==
"SiStripApvGainRcd")
80 gainGetters_.emplace_back(make_GainGetter<SiStripApvGainRcd>(cc,
record, label));
81 else if (
record ==
"SiStripApvGain2Rcd")
82 gainGetters_.emplace_back(make_GainGetter<SiStripApvGain2Rcd>(cc,
record, label));
83 else if (
record ==
"SiStripApvGain3Rcd")
84 gainGetters_.emplace_back(make_GainGetter<SiStripApvGain3Rcd>(cc,
record, label));
87 <<
"SiStripGainESProducer::ctor ERROR: unrecognized record name " <<
record << std::endl
88 <<
"please specify one of: SiStripApvGainRcd, SiStripApvGain2Rcd, SiStripApvGain3Rcd";
89 factor_.push_back_norm(gainPSet.getUntrackedParameter<
double>(
"NormalizationFactor", 1.));
91 factor_.resetIfBadNorm();
100 auto gain = std::make_unique<SiStripGain>(apvGain,
factor_.
get(apvGain, 0),
gainGetters_[0]->recordLabel(), detInfo);
std::unique_ptr< SiStripGain > produce(const SiStripGainRcd &)
~SiStripGainESProducer() override
const SiStripApvGain & gain(const SiStripGainRcd &rcd) const override
GainGetter(std::string record, std::string label)
auto consumesFrom(ESInputTag const &tag)
SiStripGainESProducer(const edm::ParameterSet &)
std::pair< std::string, std::string > recordLabel_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::vector< std::unique_ptr< GainGetter > > gainGetters_
SiStripDetInfo read(std::string filePath)
const auto & recordLabel() const
edm::ESGetToken< SiStripApvGain, Record > token_
virtual ~GainGetter()=default
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
double get(const SiStripApvGain &gain, const int apvGainIndex) const
static constexpr char const *const kDefaultFile
GainGetterT(edm::ESConsumesCollector &cc, std::string record, std::string label)
virtual const SiStripApvGain & gain(const SiStripGainRcd &rcd) const =0
SiStripGainFactor factor_
auto make_GainGetter(edm::ESConsumesCollector &cc, std::string record, std::string label)