Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:48

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