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 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
int16_t singleReadOutMode() const
void addDefault(ParameterSetDescription const &psetDescription)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::shared_ptr< SiStripLorentzAngle const > produce(const SiStripLorentzAngleDepRcd &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleRcd > lorentzAngleToken_
SiStripLorentzAngleDepESProducer(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)