File indexing completed on 2024-04-06 12:31:32
0001 #include "FWCore/Framework/interface/EventSetup.h"
0002 #include "FWCore/Framework/interface/ESHandle.h"
0003 #include "FWCore/Framework/interface/ModuleFactory.h"
0004 #include "FWCore/Framework/interface/ESProducer.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0007 #include "TrackingTools/KalmanUpdators/interface/MRHChi2MeasurementEstimator.h"
0008 #include <memory>
0009
0010 namespace {
0011
0012 class MRHChi2MeasurementEstimatorESProducer : public edm::ESProducer {
0013 public:
0014 MRHChi2MeasurementEstimatorESProducer(const edm::ParameterSet& p);
0015
0016 std::unique_ptr<Chi2MeasurementEstimatorBase> produce(const TrackingComponentsRecord&);
0017
0018 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0019
0020 private:
0021 const double maxChi2_;
0022 const double nSigma_;
0023 };
0024
0025 MRHChi2MeasurementEstimatorESProducer::MRHChi2MeasurementEstimatorESProducer(const edm::ParameterSet& p)
0026 : maxChi2_(p.getParameter<double>("MaxChi2")), nSigma_(p.getParameter<double>("nSigma")) {
0027 std::string myname = p.getParameter<std::string>("ComponentName");
0028 setWhatProduced(this, myname);
0029 }
0030
0031 std::unique_ptr<Chi2MeasurementEstimatorBase> MRHChi2MeasurementEstimatorESProducer::produce(
0032 const TrackingComponentsRecord& iRecord) {
0033 return std::make_unique<MRHChi2MeasurementEstimator>(maxChi2_, nSigma_);
0034 }
0035
0036 void MRHChi2MeasurementEstimatorESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0037 edm::ParameterSetDescription desc;
0038 desc.add<double>("MaxChi2");
0039 desc.add<double>("nSigma");
0040 desc.add<std::string>("ComponentName");
0041 descriptions.addDefault(desc);
0042 }
0043 }
0044
0045 DEFINE_FWK_EVENTSETUP_MODULE(MRHChi2MeasurementEstimatorESProducer);