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 
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
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripLorentzAngleDepESProducer::produce
std::shared_ptr< SiStripLorentzAngle const > produce(const SiStripLorentzAngleDepRcd &)
Definition: SiStripLorentzAngleDepESProducer.cc:85
SiStripLorentzAngleDepESProducer
Definition: SiStripLorentzAngleDepESProducer.cc:37
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:103
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:47
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:46
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
SiStripLorentzAngleDepESProducer::SiStripLorentzAngleDepESProducer
SiStripLorentzAngleDepESProducer(const edm::ParameterSet &)
Definition: SiStripLorentzAngleDepESProducer.cc:49
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:93
SiStripLorentzAngleDepRcd
Definition: SiStripDependentRecords.h:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESProducer
Definition: ESProducer.h:104
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