CMS 3D CMS Logo

SiStripGainSimESProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <utility>
4 
5 // user include files
8 
11 
16 
17 #include "SiStripGainFactor.h"
18 
20 public:
23 
24  std::unique_ptr<SiStripGain> produce(const SiStripGainSimRcd&);
25 
26 private:
27  struct TokenLabel {
32  std::pair<std::string, std::string> recordLabel_;
33  };
34 
35  std::vector<TokenLabel> tokenLabels_;
37 };
38 
40  auto cc = setWhatProduced(this);
41 
42  auto apvGainLabels = iConfig.getParameter<std::vector<edm::ParameterSet> >("APVGain");
43  if (apvGainLabels.empty()) {
44  throw cms::Exception("Configuration") << "Got empty APVGain vector, but need at least one entry";
45  }
46 
47  // Fill the vector of apv labels
48  for (const auto& gainPSet : apvGainLabels) {
49  // Shouldn't all these parameters be tracked?
50  tokenLabels_.emplace_back(
51  cc, gainPSet.getParameter<std::string>("Record"), gainPSet.getUntrackedParameter<std::string>("Label", ""));
52  factor_.push_back_norm(gainPSet.getUntrackedParameter<double>("NormalizationFactor", 1.));
53  }
54 
55  factor_.resetIfBadNorm();
56 }
57 
58 std::unique_ptr<SiStripGain> SiStripGainSimESProducer::produce(const SiStripGainSimRcd& iRecord) {
59  const auto& apvGain = iRecord.get(tokenLabels_[0].token_);
60  auto gain = std::make_unique<SiStripGain>(apvGain, factor_.get(apvGain, 0), tokenLabels_[0].recordLabel_);
61 
62  for (unsigned int i = 1; i < tokenLabels_.size(); ++i) {
63  const auto& apvGain = iRecord.get(tokenLabels_[i].token_);
64  gain->multiply(apvGain, factor_.get(apvGain, i), tokenLabels_[i].recordLabel_);
65  }
66  return gain;
67 }
68 
70 
SiStripDependentRecords.h
mps_fire.i
i
Definition: mps_fire.py:355
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
SiStripGainSimESProducer::produce
std::unique_ptr< SiStripGain > produce(const SiStripGainSimRcd &)
Definition: SiStripGainSimESProducer.cc:58
edm::ESConsumesCollector
Definition: ESConsumesCollector.h:58
SiStripGain.h
ESProducer.h
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
SiStripGainFactor.h
SiStripGainSimESProducer::factor_
SiStripGainFactor factor_
Definition: SiStripGainSimESProducer.cc:36
SiStripGainFactor
Definition: SiStripGainFactor.h:9
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
SiStripApvGain.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripGainSimESProducer::tokenLabels_
std::vector< TokenLabel > tokenLabels_
Definition: SiStripGainSimESProducer.cc:35
edm::ParameterSet
Definition: ParameterSet.h:36
SiStripCondDataRecords.h
SiStripGainFactor::get
double get(const SiStripApvGain &gain, const int apvGainIndex) const
Definition: SiStripGainFactor.h:28
SiStripGainSimESProducer::~SiStripGainSimESProducer
~SiStripGainSimESProducer() override
Definition: SiStripGainSimESProducer.cc:22
cc
edm::ESGetToken< SiStripApvGain, SiStripApvGainSimRcd >
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
ModuleFactory.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiStripGainSimESProducer::TokenLabel
Definition: SiStripGainSimESProducer.cc:27
SiStripGainSimESProducer::TokenLabel::recordLabel_
std::pair< std::string, std::string > recordLabel_
Definition: SiStripGainSimESProducer.cc:32
SiStripGainSimESProducer::SiStripGainSimESProducer
SiStripGainSimESProducer(const edm::ParameterSet &)
Definition: SiStripGainSimESProducer.cc:39
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
Exception
Definition: hltDiff.cc:246
SiStripApvGainSimRcd
Definition: SiStripCondDataRecords.h:11
SiStripGainSimESProducer
Definition: SiStripGainSimESProducer.cc:19
SiStripGainSimESProducer::TokenLabel::token_
edm::ESGetToken< SiStripApvGain, SiStripApvGainSimRcd > token_
Definition: SiStripGainSimESProducer.cc:31
edm::ESProducer
Definition: ESProducer.h:101
SiStripGainSimESProducer::TokenLabel::TokenLabel
TokenLabel(edm::ESConsumesCollector &cc, std::string record, std::string label)
Definition: SiStripGainSimESProducer.cc:28
SiStripGainSimRcd
Definition: SiStripDependentRecords.h:32
ParameterSet.h
SiStripApvGain
Definition: SiStripApvGain.h:25
label
const char * label
Definition: PFTauDecayModeTools.cc:11