CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
57 
58  switch(cpeNum_) {
59  case DEFAULT:
60  iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
61  cpe_ = std::make_shared<Phase2StripCPE>(pset_, *magfield);
62  break;
63  case GEOMETRIC:
64  cpe_ = std::make_shared<Phase2StripCPEGeometric>(pset_);
65  break;
66  }
67  return cpe_;
68 
69 }
70 
71 
T getParameter(std::string const &) const
tuple magfield
Definition: HLT_ES_cff.py:2311
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)