CMS 3D CMS Logo

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