CMS 3D CMS Logo

StripCPEESProducer.cc
Go to the documentation of this file.
7 
9 
14 
18 
20 public:
22  std::unique_ptr<StripClusterParameterEstimator> produce(const TkStripCPERecord&);
23 
24 private:
26 
29 
36 };
37 
39  std::string name = p.getParameter<std::string>("ComponentName");
41  if (!p.exists("ComponentType"))
42  edm::LogWarning("StripCPEESProducer") << " the CPE producer should contain a ComponentType, probably identical to "
43  "ComponentName in the first step of migration. Falling back to:"
44  << type;
45  else
46  type = p.getParameter<std::string>("ComponentType");
47 
48  std::map<std::string, CPE_t> enumMap;
49  enumMap[std::string("SimpleStripCPE")] = SIMPLE;
50  enumMap[std::string("StripCPEfromTrackAngle")] = TRACKANGLE;
51  enumMap[std::string("StripCPEgeometric")] = GEOMETRIC;
52  enumMap[std::string("FakeStripCPE")] = FAKE;
53  if (enumMap.find(type) == enumMap.end())
54  throw cms::Exception("Unknown StripCPE type") << type;
55 
56  cpeNum = enumMap[type];
57  parametersPSet = (p.exists("parameters") ? p.getParameter<edm::ParameterSet>("parameters") : p);
58  auto cc = setWhatProduced(this, name);
59  pDDToken_ = cc.consumes();
60  magfieldToken_ = cc.consumes();
61  lorentzAngleToken_ = cc.consumes();
62  backPlaneCorrectionToken_ = cc.consumes();
63  confObjToken_ = cc.consumes();
64  latencyToken_ = cc.consumes();
65 }
66 
67 std::unique_ptr<StripClusterParameterEstimator> StripCPEESProducer::produce(const TkStripCPERecord& iRecord) {
68  TrackerGeometry const& pDD = iRecord.get(pDDToken_);
69  MagneticField const& magfield = iRecord.get(magfieldToken_);
70  SiStripLorentzAngle const& lorentzAngle = iRecord.get(lorentzAngleToken_);
71  SiStripBackPlaneCorrection const& backPlaneCorrection = iRecord.get(backPlaneCorrectionToken_);
72  SiStripConfObject const& confObj = iRecord.get(confObjToken_);
73  SiStripLatency const& latency = iRecord.get(latencyToken_);
74 
75  std::unique_ptr<StripClusterParameterEstimator> cpe;
76 
77  switch (cpeNum) {
78  case SIMPLE:
79  cpe = std::make_unique<StripCPE>(
80  parametersPSet, magfield, pDD, lorentzAngle, backPlaneCorrection, confObj, latency);
81  break;
82 
83  case TRACKANGLE:
84  cpe = std::make_unique<StripCPEfromTrackAngle>(
85  parametersPSet, magfield, pDD, lorentzAngle, backPlaneCorrection, confObj, latency);
86  break;
87 
88  case GEOMETRIC:
89  cpe = std::make_unique<StripCPEgeometric>(
90  parametersPSet, magfield, pDD, lorentzAngle, backPlaneCorrection, confObj, latency);
91  break;
92 
93  case FAKE:
94  cpe = std::make_unique<StripFakeCPE>();
95  break;
96  }
97 
98  return cpe;
99 }
100 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSet parametersPSet
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
std::unique_ptr< StripClusterParameterEstimator > produce(const TkStripCPERecord &)
edm::ESGetToken< SiStripLatency, SiStripLatencyRcd > latencyToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
edm::ESGetToken< SiStripBackPlaneCorrection, SiStripBackPlaneCorrectionDepRcd > backPlaneCorrectionToken_
edm::ESGetToken< SiStripConfObject, SiStripConfObjectRcd > confObjToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
StripCPEESProducer(const edm::ParameterSet &)
edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcd > lorentzAngleToken_