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::shared_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  std::shared_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > cpe_;
36 
37 };
38 
39 
41  std::string name = p.getParameter<std::string>("ComponentType");
42 
43  enumMap_[std::string("Phase2StripCPE")] = DEFAULT;
44  enumMap_[std::string("Phase2StripCPEGeometric")] = GEOMETRIC;
45  if (enumMap_.find(name) == enumMap_.end())
46  throw cms::Exception("Unknown StripCPE type") << name;
47 
48  cpeNum_ = enumMap_[name];
49  pset_ = p.getParameter<edm::ParameterSet>("parameters");
50  setWhatProduced(this, name);
51 }
52 
53 
54 std::shared_ptr<ClusterParameterEstimator<Phase2TrackerCluster1D> > Phase2StripCPEESProducer::produce(const TkStripCPERecord & iRecord) {
55 
58 
59  switch(cpeNum_) {
60  case DEFAULT:
61  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
62  iRecord.getRecord<TrackerDigiGeometryRecord>().get( pDD );
63  cpe_ = std::make_shared<Phase2StripCPE>(pset_, *magfield,*pDD);
64  break;
65  case GEOMETRIC:
66  cpe_ = std::make_shared<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_
Phase2StripCPEESProducer(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::shared_ptr< ClusterParameterEstimator< Phase2TrackerCluster1D > > cpe_
std::shared_ptr< ClusterParameterEstimator< Phase2TrackerCluster1D > > produce(const TkStripCPERecord &iRecord)