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 
29 
31 
36 
38 public:
40 
41  std::shared_ptr<SiStripLorentzAngle const> produce(const SiStripLorentzAngleDepRcd&);
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
44 
45 private:
47 };
48 
50  auto const getLatency = iConfig.getParameter<edm::ParameterSet>("LatencyRecord");
51  // How useful the "record" parameter really is?
52  if (getLatency.getParameter<std::string>("record") != "SiStripLatencyRcd") {
54  "[SiStripLorentzAngleDepESProducer::ctor] No Latency Record found ");
55  }
56 
57  auto const getPeak = iConfig.getParameter<edm::ParameterSet>("LorentzAnglePeakMode");
58  if (getPeak.getParameter<std::string>("record") != "SiStripLorentzAngleRcd") {
60  "[SiStripLorentzAngleDepESProducer::ctor] No Lorentz Angle Record found ");
61  }
62 
63  auto const getDeconv = iConfig.getParameter<edm::ParameterSet>("LorentzAngleDeconvMode");
64  // How useful the "record" parameter really is?
65  if (getDeconv.getParameter<std::string>("record") != "SiStripLorentzAngleRcd") {
67  "[SiStripLorentzAngleDepESProducer::ctor] No Lorentz Angle Record found ");
68  }
69 
70  auto const peakLabel{getPeak.getUntrackedParameter<std::string>("label")};
71  auto const deconvLabel{getDeconv.getUntrackedParameter<std::string>("label")};
72  setWhatProduced(this).setMayConsume(
74  [peakLabel, deconvLabel](auto const& get, edm::ESTransientHandle<SiStripLatency> iLatency) {
75  if (iLatency->singleReadOutMode() == 1) {
76  return get("", peakLabel);
77  }
78  return get("", deconvLabel);
79  },
80  edm::ESProductTag<SiStripLatency, SiStripLatencyRcd>("", getLatency.getUntrackedParameter<std::string>("label")));
81 
82  edm::LogInfo("SiStripLorentzAngleDepESProducer") << "ctor" << std::endl;
83 }
84 
85 std::shared_ptr<SiStripLorentzAngle const> SiStripLorentzAngleDepESProducer::produce(
86  const SiStripLorentzAngleDepRcd& iRecord) {
87  edm::LogInfo("SiStripLorentzAngleDepESProducer") << "Producer called" << std::endl;
88 
89  //tell shared_ptr not to delete the product since it is already owned by the record
90  return std::shared_ptr<SiStripLorentzAngle const>(&iRecord.get(lorentzAngleToken_), [](auto) {});
91 }
92 
95  {
97  latency.add<std::string>("record", "SiStripLatencyRcd");
98  latency.addUntracked<std::string>("label", "");
99 
100  desc.add<edm::ParameterSetDescription>("LatencyRecord", latency);
101  }
102 
103  {
105  peak.add<std::string>("record", "SiStripLorentzAngleRcd");
106  peak.addUntracked<std::string>("label", "peak");
107 
108  desc.add<edm::ParameterSetDescription>("LorentzAnglePeakMode", peak);
109  }
110 
111  {
113  deconv.add<std::string>("record", "SiStripLorentzAngleRcd");
114  deconv.addUntracked<std::string>("label", "deconvolution");
115 
116  desc.add<edm::ParameterSetDescription>("LorentzAngleDeconvMode", deconv);
117  }
118 
119  descriptions.addDefault(desc);
120 }
121 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void addDefault(ParameterSetDescription const &psetDescription)
std::shared_ptr< SiStripLorentzAngle const > produce(const SiStripLorentzAngleDepRcd &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
int16_t singleReadOutMode() const
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleRcd > lorentzAngleToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
SiStripLorentzAngleDepESProducer(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const