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 
17 
18 #include "SiStripGainFactor.h"
19 
21 public:
24 
25  std::unique_ptr<SiStripGain> produce(const SiStripGainSimRcd&);
26 
27 private:
28  struct TokenLabel {
33  std::pair<std::string, std::string> recordLabel_;
34  };
35 
36  std::vector<TokenLabel> tokenLabels_;
38 };
39 
41  auto cc = setWhatProduced(this);
42 
43  auto apvGainLabels = iConfig.getParameter<std::vector<edm::ParameterSet> >("APVGain");
44  if (apvGainLabels.empty()) {
45  throw cms::Exception("Configuration") << "Got empty APVGain vector, but need at least one entry";
46  }
47 
48  // Fill the vector of apv labels
49  for (const auto& gainPSet : apvGainLabels) {
50  // Shouldn't all these parameters be tracked?
51  tokenLabels_.emplace_back(
52  cc, gainPSet.getParameter<std::string>("Record"), gainPSet.getUntrackedParameter<std::string>("Label", ""));
53  factor_.push_back_norm(gainPSet.getUntrackedParameter<double>("NormalizationFactor", 1.));
54  }
55 
56  factor_.resetIfBadNorm();
57 }
58 
59 std::unique_ptr<SiStripGain> SiStripGainSimESProducer::produce(const SiStripGainSimRcd& iRecord) {
60  const auto detInfo =
62 
63  const auto& apvGain = iRecord.get(tokenLabels_[0].token_);
64  auto gain = std::make_unique<SiStripGain>(apvGain, factor_.get(apvGain, 0), tokenLabels_[0].recordLabel_, detInfo);
65 
66  for (unsigned int i = 1; i < tokenLabels_.size(); ++i) {
67  const auto& apvGain = iRecord.get(tokenLabels_[i].token_);
68  gain->multiply(apvGain, factor_.get(apvGain, i), tokenLabels_[i].recordLabel_, detInfo);
69  }
70  return gain;
71 }
72 
74 
SiStripDependentRecords.h
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
SiStripGainSimESProducer::produce
std::unique_ptr< SiStripGain > produce(const SiStripGainSimRcd &)
Definition: SiStripGainSimESProducer.cc:59
edm::ESConsumesCollector
Definition: ESConsumesCollector.h:61
SiStripGain.h
ESProducer.h
SiStripGainFactor.h
SiStripDetInfoFileReader::read
SiStripDetInfo read(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:11
SiStripGainSimESProducer::factor_
SiStripGainFactor factor_
Definition: SiStripGainSimESProducer.cc:37
edm::FileInPath
Definition: FileInPath.h:61
SiStripGainFactor
Definition: SiStripGainFactor.h:9
SiStripDetInfoFileReader.h
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
SiStripApvGain.h
SiStripGainSimESProducer::tokenLabels_
std::vector< TokenLabel > tokenLabels_
Definition: SiStripGainSimESProducer.cc:36
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripCondDataRecords.h
SiStripGainFactor::get
double get(const SiStripApvGain &gain, const int apvGainIndex) const
Definition: SiStripGainFactor.h:28
SiStripGainSimESProducer::~SiStripGainSimESProducer
~SiStripGainSimESProducer() override
Definition: SiStripGainSimESProducer.cc:23
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
cc
edm::ESGetToken< SiStripApvGain, SiStripApvGainSimRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:28
SiStripGainSimESProducer::TokenLabel::recordLabel_
std::pair< std::string, std::string > recordLabel_
Definition: SiStripGainSimESProducer.cc:33
SiStripGainSimESProducer::SiStripGainSimESProducer
SiStripGainSimESProducer(const edm::ParameterSet &)
Definition: SiStripGainSimESProducer.cc:40
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
SiStripDetInfoFileReader::kDefaultFile
constexpr static char const *const kDefaultFile
Definition: SiStripDetInfoFileReader.h:10
Exception
Definition: hltDiff.cc:245
SiStripApvGainSimRcd
Definition: SiStripCondDataRecords.h:11
SiStripGainSimESProducer
Definition: SiStripGainSimESProducer.cc:20
SiStripGainSimESProducer::TokenLabel::token_
edm::ESGetToken< SiStripApvGain, SiStripApvGainSimRcd > token_
Definition: SiStripGainSimESProducer.cc:32
edm::ESProducer
Definition: ESProducer.h:104
SiStripGainSimESProducer::TokenLabel::TokenLabel
TokenLabel(edm::ESConsumesCollector &cc, std::string record, std::string label)
Definition: SiStripGainSimESProducer.cc:29
SiStripGainSimRcd
Definition: SiStripDependentRecords.h:32
ParameterSet.h
SiStripApvGain
Definition: SiStripApvGain.h:25
label
const char * label
Definition: PFTauDecayModeTools.cc:11