CMS 3D CMS Logo

SiStripLorentzAngleDepESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripLorentzAngleDepESProducer
4 // Class: SiStripLorentzAngleDepESProducer
5 //
13 //
14 // Original Author: Michael Segala and Rebeca Gonzalez Suarez
15 // Created: 15/02/2011
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
26 
28 
31 
33 
38 
40 public:
42 
43  std::shared_ptr<SiStripLorentzAngle const> produce(const SiStripLorentzAngleDepRcd&);
44 
45  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
46 
47 private:
49 };
50 
52  auto const getLatency = iConfig.getParameter<edm::ParameterSet>("LatencyRecord");
53  // How useful the "record" parameter really is?
54  if (getLatency.getParameter<std::string>("record") != "SiStripLatencyRcd") {
56  "[SiStripLorentzAngleDepESProducer::ctor] No Latency Record found ");
57  }
58 
59  auto const getPeak = iConfig.getParameter<edm::ParameterSet>("LorentzAnglePeakMode");
60  if (getPeak.getParameter<std::string>("record") != "SiStripLorentzAngleRcd") {
62  "[SiStripLorentzAngleDepESProducer::ctor] No Lorentz Angle Record found ");
63  }
64 
65  auto const getDeconv = iConfig.getParameter<edm::ParameterSet>("LorentzAngleDeconvMode");
66  // How useful the "record" parameter really is?
67  if (getDeconv.getParameter<std::string>("record") != "SiStripLorentzAngleRcd") {
69  "[SiStripLorentzAngleDepESProducer::ctor] No Lorentz Angle Record found ");
70  }
71 
72  auto const peakLabel{getPeak.getUntrackedParameter<std::string>("label")};
73  auto const deconvLabel{getDeconv.getUntrackedParameter<std::string>("label")};
74  setWhatProduced(this).setMayConsume(
76  [peakLabel, deconvLabel](auto const& get, edm::ESTransientHandle<SiStripLatency> iLatency) {
77  if (iLatency->singleReadOutMode() == 1) {
78  return get("", peakLabel);
79  }
80  return get("", deconvLabel);
81  },
82  edm::ESProductTag<SiStripLatency, SiStripLatencyRcd>("", getLatency.getUntrackedParameter<std::string>("label")));
83 
84  edm::LogInfo("SiStripLorentzAngleDepESProducer") << "ctor" << std::endl;
85 }
86 
87 std::shared_ptr<SiStripLorentzAngle const> SiStripLorentzAngleDepESProducer::produce(
88  const SiStripLorentzAngleDepRcd& iRecord) {
89  edm::LogInfo("SiStripLorentzAngleDepESProducer") << "Producer called" << std::endl;
90 
91  //tell shared_ptr not to delete the product since it is already owned by the record
92  return std::shared_ptr<SiStripLorentzAngle const>(&iRecord.get(lorentzAngleToken_), [](auto) {});
93 }
94 
97  {
99  latency.add<std::string>("record", "SiStripLatencyRcd");
100  latency.addUntracked<std::string>("label", "");
101 
102  desc.add<edm::ParameterSetDescription>("LatencyRecord", latency);
103  }
104 
105  {
107  peak.add<std::string>("record", "SiStripLorentzAngleRcd");
108  peak.addUntracked<std::string>("label", "peak");
109 
110  desc.add<edm::ParameterSetDescription>("LorentzAnglePeakMode", peak);
111  }
112 
113  {
115  deconv.add<std::string>("record", "SiStripLorentzAngleRcd");
116  deconv.addUntracked<std::string>("label", "deconvolution");
117 
118  desc.add<edm::ParameterSetDescription>("LorentzAngleDeconvMode", deconv);
119  }
120 
121  descriptions.addDefault(desc);
122 }
123 
SiStripDependentRecords.h
edm::ESProductTag
Definition: ESProductTag.h:29
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
config_102169_raw_cff.latency
latency
Definition: config_102169_raw_cff.py:29
ESHandle.h
edm::LogInfo
Definition: MessageLogger.h:254
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
SiStripLorentzAngleDepESProducer::produce
std::shared_ptr< SiStripLorentzAngle const > produce(const SiStripLorentzAngleDepRcd &)
Definition: SiStripLorentzAngleDepESProducer.cc:87
SiStripLorentzAngleDepESProducer
Definition: SiStripLorentzAngleDepESProducer.cc:39
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
SiStripConstants.h
edm::ParameterSet
Definition: ParameterSet.h:36
SiStripLatency::singleReadOutMode
int16_t singleReadOutMode() const
Definition: SiStripLatency.cc:122
get
#define get
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleRcd >
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
SiStripLorentzAngleDepESProducer::lorentzAngleToken_
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleRcd > lorentzAngleToken_
Definition: SiStripLorentzAngleDepESProducer.cc:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ModuleFactory.h
SiStripLorentzAngleDepESProducer::SiStripLorentzAngleDepESProducer
SiStripLorentzAngleDepESProducer(const edm::ParameterSet &)
Definition: SiStripLorentzAngleDepESProducer.cc:51
ESProductTag.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
Exception
Definition: hltDiff.cc:246
SiStripLorentzAngleDepESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: SiStripLorentzAngleDepESProducer.cc:95
SiStripLorentzAngleDepRcd
Definition: SiStripDependentRecords.h:40
edm::ESProducer
Definition: ESProducer.h:101
SiStripLatency.h
ParameterSet.h
SiStripLorentzAngle.h
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::errors::Configuration
Definition: EDMException.h:36