Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:38

0001 #include "FWCore/Framework/interface/ESHandle.h"
0002 #include "FWCore/Framework/interface/ESProducer.h"
0003 
0004 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
0005 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0006 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
0007 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h"
0008 
0009 #include "FWCore/Framework/interface/ESProducer.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0012 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0013 
0014 #include "TrackingTools/TrackFitters/interface/TrajectoryFitterRecord.h"
0015 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0016 #include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
0017 #include <memory>
0018 
0019 namespace {
0020 
0021   class KFTrajectorySmootherESProducer final : public edm::ESProducer {
0022   public:
0023     KFTrajectorySmootherESProducer(const edm::ParameterSet& p);
0024     std::unique_ptr<TrajectorySmoother> produce(const TrajectoryFitterRecord&);
0025 
0026     static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0027       edm::ParameterSetDescription desc;
0028       desc.add<std::string>("ComponentName", "KFSmoother");
0029       desc.add<std::string>("Propagator", "PropagatorWithMaterial");
0030       desc.add<std::string>("Updator", "KFUpdator");
0031       desc.add<std::string>("Estimator", "Chi2");
0032       desc.add<std::string>("RecoGeometry", "GlobalDetLayerGeometry");
0033       desc.add<double>("errorRescaling", 100);
0034       desc.add<int>("minHits", 3);
0035       descriptions.add("KFTrajectorySmoother", desc);
0036     }
0037 
0038   private:
0039     edm::ESGetToken<Propagator, TrackingComponentsRecord> propToken_;
0040     edm::ESGetToken<TrajectoryStateUpdator, TrackingComponentsRecord> updToken_;
0041     edm::ESGetToken<Chi2MeasurementEstimatorBase, TrackingComponentsRecord> estToken_;
0042     edm::ESGetToken<DetLayerGeometry, RecoGeometryRecord> geoToken_;
0043     const double rescaleFactor_;
0044     const int minHits_;
0045   };
0046 
0047   KFTrajectorySmootherESProducer::KFTrajectorySmootherESProducer(const edm::ParameterSet& p)
0048       : rescaleFactor_{p.getParameter<double>("errorRescaling")}, minHits_{p.getParameter<int>("minHits")} {
0049     std::string myname = p.getParameter<std::string>("ComponentName");
0050     auto cc = setWhatProduced(this, myname);
0051     propToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("Propagator")));
0052     updToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("Updator")));
0053     estToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("Estimator")));
0054     geoToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("RecoGeometry")));
0055   }
0056 
0057   std::unique_ptr<TrajectorySmoother> KFTrajectorySmootherESProducer::produce(const TrajectoryFitterRecord& iRecord) {
0058     return std::make_unique<KFTrajectorySmoother>(&iRecord.get(propToken_),
0059                                                   &iRecord.get(updToken_),
0060                                                   &iRecord.get(estToken_),
0061                                                   rescaleFactor_,
0062                                                   minHits_,
0063                                                   &iRecord.get(geoToken_));
0064   }
0065 }  // namespace
0066 
0067 #include "FWCore/Framework/interface/ModuleFactory.h"
0068 DEFINE_FWK_EVENTSETUP_MODULE(KFTrajectorySmootherESProducer);