CMS 3D CMS Logo

StripCPEESProducer.cc
Go to the documentation of this file.
6 
14 
16 {
17  std::string name = p.getParameter<std::string>("ComponentName");
19  if (!p.exists("ComponentType"))
20  edm::LogWarning("StripCPEESProducer")<<" the CPE producer should contain a ComponentType, probably identical to ComponentName in the first step of migration. Falling back to:"<<type;
21  else
22  type=p.getParameter<std::string>("ComponentType");
23 
24  enumMap[std::string("SimpleStripCPE")]=SIMPLE;
25  enumMap[std::string("StripCPEfromTrackAngle")]=TRACKANGLE;
26  enumMap[std::string("StripCPEgeometric")]=GEOMETRIC;
27  enumMap[std::string("FakeStripCPE")]=FAKE;
28  if(enumMap.find(type)==enumMap.end())
29  throw cms::Exception("Unknown StripCPE type") << type;
30 
31  cpeNum = enumMap[type];
32  parametersPSet = (p.exists("parameters") ? p.getParameter<edm::ParameterSet>("parameters") : p);
33  setWhatProduced(this,name);
34 }
35 
36 std::unique_ptr<StripClusterParameterEstimator> StripCPEESProducer::
37 produce(const TkStripCPERecord & iRecord)
38 {
40  edm::ESHandle<MagneticField> magfield; iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
41  edm::ESHandle<SiStripLorentzAngle> lorentzAngle; iRecord.getRecord<SiStripLorentzAngleDepRcd>().get(lorentzAngle);
42  edm::ESHandle<SiStripBackPlaneCorrection> backPlaneCorrection; iRecord.getRecord<SiStripBackPlaneCorrectionDepRcd>().get(backPlaneCorrection);
43  edm::ESHandle<SiStripConfObject> confObj; iRecord.getRecord<SiStripConfObjectRcd>().get(confObj);
45  edm::ESHandle<SiStripNoises> noise; iRecord.getRecord<SiStripNoisesRcd>().get(noise);
48 
49  std::unique_ptr<StripClusterParameterEstimator> cpe;
50 
51  switch(cpeNum) {
52 
53  case SIMPLE:
54  cpe = std::make_unique<StripCPE>( parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency );
55  break;
56 
57  case TRACKANGLE:
58  cpe = std::make_unique<StripCPEfromTrackAngle>( parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency );
59  break;
60 
61  case GEOMETRIC:
62  cpe = std::make_unique<StripCPEgeometric>(parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency );
63  break;
64 
65  case FAKE:
66  cpe = std::make_unique<StripFakeCPE>();
67  break;
68 
69  }
70 
71  return cpe;
72 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
edm::ParameterSet parametersPSet
std::unique_ptr< StripClusterParameterEstimator > produce(const TkStripCPERecord &)
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::map< std::string, CPE_t > enumMap
latency
hardware algo
StripCPEESProducer(const edm::ParameterSet &)