CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Chi2MeasurementEstimatorESProducer.cc
Go to the documentation of this file.
5 
8 
9 
14 #include <boost/shared_ptr.hpp>
15 
16 namespace {
17 
18 class Chi2MeasurementEstimatorESProducer: public edm::ESProducer{
19  public:
20  Chi2MeasurementEstimatorESProducer(const edm::ParameterSet & p);
21  virtual ~Chi2MeasurementEstimatorESProducer();
22  boost::shared_ptr<Chi2MeasurementEstimatorBase> produce(const TrackingComponentsRecord &);
23 
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
25  // static edm::ParameterSetDescription getFilledConfigurationDescription();
26 
27  private:
28  boost::shared_ptr<Chi2MeasurementEstimatorBase> m_estimator;
29  edm::ParameterSet const m_pset;
30 };
31 
32 Chi2MeasurementEstimatorESProducer::Chi2MeasurementEstimatorESProducer(const edm::ParameterSet & p) :
33  m_pset(p) {
34  std::string myname = p.getParameter<std::string>("ComponentName");
35  setWhatProduced(this,myname);
36 }
37 
38 Chi2MeasurementEstimatorESProducer::~Chi2MeasurementEstimatorESProducer() {}
39 
40 boost::shared_ptr<Chi2MeasurementEstimatorBase>
41 Chi2MeasurementEstimatorESProducer::produce(const TrackingComponentsRecord & iRecord){
42  auto maxChi2 = m_pset.getParameter<double>("MaxChi2");
43  auto nSigma = m_pset.getParameter<double>("nSigma");
44  auto maxDis = m_pset.getParameter<double>("MaxDisplacement");
45  auto maxSag = m_pset.getParameter<double>("MaxSagitta");
46  auto minTol = m_pset.getParameter<double>("MinimalTolerance");
47 
48  m_estimator = boost::shared_ptr<Chi2MeasurementEstimatorBase>(new Chi2MeasurementEstimator(maxChi2,nSigma, maxDis, maxSag, minTol));
49  return m_estimator;
50 }
51 
52 
53  /*
54 edm::ParameterSetDescription
55 Chi2MeasurementEstimatorESProducer::getFilledConfigurationDescription() {
56 
57  edm::ParameterSetDescription desc;
58  desc.add<double>("MaxChi2",30);
59  desc.add<double>("nSigma",3);
60  desc.add<double>("MaxDisplacement",0.5);
61  desc.add<double>("MaxSagitta",2.);
62  desc.add<double>("MinimalTolerance",0.5);
63  return desc;
64 }
65  */
66 
67 void
68 Chi2MeasurementEstimatorESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
69 
70  // edm::ParameterSetDescription desc = Chi2MeasurementEstimatorESProducer::getFilledConfigurationDescription();
72  desc.add<double>("MaxChi2",30);
73  desc.add<double>("nSigma",3);
74  desc.add<double>("MaxDisplacement",0.5);
75  desc.add<double>("MaxSagitta",2.);
76  desc.add<double>("MinimalTolerance",0.5);
77  desc.add<std::string>("ComponentName","Chi2");
78  descriptions.add("Chi2MeasurementEstimator", desc);
79 }
80 
81 
82 }
83 
84 
85 
86 DEFINE_FWK_EVENTSETUP_MODULE(Chi2MeasurementEstimatorESProducer);
87 
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60