CMS 3D CMS Logo

Phase2StripCPEESProducer.cc
Go to the documentation of this file.
5 
10 
15 
17 
18 #include <memory>
19 #include <map>
20 
22 
23  public:
24 
26  std::unique_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > produce(const TkStripCPERecord & iRecord);
27 
28  private:
29 
30  enum CPE_t { DEFAULT, GEOMETRIC };
31  std::map<std::string, CPE_t> enumMap_;
32 
35 
36 };
37 
38 
40  std::string name = p.getParameter<std::string>("ComponentType");
41 
42  enumMap_[std::string("Phase2StripCPE")] = DEFAULT;
43  enumMap_[std::string("Phase2StripCPEGeometric")] = GEOMETRIC;
44  if (enumMap_.find(name) == enumMap_.end())
45  throw cms::Exception("Unknown StripCPE type") << name;
46 
47  cpeNum_ = enumMap_[name];
48  pset_ = p.getParameter<edm::ParameterSet>("parameters");
49  setWhatProduced(this, name);
50 }
51 
52 
53 std::unique_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > Phase2StripCPEESProducer::produce(const TkStripCPERecord & iRecord) {
54 
57 
58  std::unique_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > cpe_;
59  switch(cpeNum_) {
60  case DEFAULT:
61  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
62  iRecord.getRecord<TrackerDigiGeometryRecord>().get( pDD );
63  cpe_ = std::make_unique<Phase2StripCPE>(pset_, *magfield,*pDD);
64  break;
65  case GEOMETRIC:
66  cpe_ = std::make_unique<Phase2StripCPEGeometric>(pset_);
67  break;
68  }
69  return cpe_;
70 
71 }
72 
73 
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::map< std::string, CPE_t > enumMap_
std::unique_ptr< ClusterParameterEstimator< Phase2TrackerCluster1D > > produce(const TkStripCPERecord &iRecord)
Phase2StripCPEESProducer(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60