Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "FWCore/Framework/interface/ESProducer.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/ESHandle.h"
0004 #include "FWCore/Framework/interface/ModuleFactory.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Utilities/interface/ESGetToken.h"
0007 
0008 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0009 #include "TrackingTools/TrackFitters/interface/TrajectoryFitterRecord.h"
0010 #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h"
0011 
0012 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
0013 #include "TrackingTools/GsfTracking/interface/GsfMaterialEffectsUpdator.h"
0014 #include "TrackingTools/GsfTracking/interface/GsfPropagatorWithMaterial.h"
0015 #include "TrackingTools/GsfTracking/interface/GsfMultiStateUpdator.h"
0016 #include "TrackingTools/GsfTools/interface/MultiGaussianStateMerger.h"
0017 #include "TrackingTools/GsfTools/interface/CloseComponentsMerger.h"
0018 #include "TrackingTools/GsfTracking/interface/MultiTrajectoryStateMerger.h"
0019 #include "TrackingTools/GsfTracking/interface/GsfChi2MeasurementEstimator.h"
0020 #include "TrackingTools/GsfTracking/interface/GsfTrajectoryFitter.h"
0021 
0022 #include <string>
0023 #include <memory>
0024 
0025 #include <iostream>
0026 
0027 /** Provides a GSF fitter algorithm */
0028 
0029 class GsfTrajectoryFitterESProducer : public edm::ESProducer {
0030 public:
0031   GsfTrajectoryFitterESProducer(const edm::ParameterSet& p);
0032   ~GsfTrajectoryFitterESProducer() override;
0033   std::unique_ptr<TrajectoryFitter> produce(const TrajectoryFitterRecord&);
0034 
0035   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0036 
0037 private:
0038   edm::ESGetToken<GsfMaterialEffectsUpdator, TrackingComponentsRecord> matUpdatorToken_;
0039   edm::ESGetToken<Propagator, TrackingComponentsRecord> propagatorToken_;
0040   edm::ESGetToken<MultiGaussianStateMerger<5>, TrackingComponentsRecord> mergerToken_;
0041   edm::ESGetToken<DetLayerGeometry, RecoGeometryRecord> geoToken_;
0042 };
0043 
0044 GsfTrajectoryFitterESProducer::GsfTrajectoryFitterESProducer(const edm::ParameterSet& p) {
0045   std::string myname = p.getParameter<std::string>("ComponentName");
0046   auto cc = setWhatProduced(this, myname);
0047   matUpdatorToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("MaterialEffectsUpdator")));
0048   propagatorToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("GeometricalPropagator")));
0049   mergerToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("Merger")));
0050   geoToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("RecoGeometry")));
0051 }
0052 
0053 GsfTrajectoryFitterESProducer::~GsfTrajectoryFitterESProducer() {}
0054 
0055 std::unique_ptr<TrajectoryFitter> GsfTrajectoryFitterESProducer::produce(const TrajectoryFitterRecord& iRecord) {
0056   //
0057   // propagator
0058   //
0059   GsfPropagatorWithMaterial propagator(iRecord.get(propagatorToken_), iRecord.get(matUpdatorToken_));
0060   //
0061   // merger
0062   //
0063   MultiTrajectoryStateMerger merger(iRecord.get(mergerToken_));
0064   //
0065   // estimator
0066   //
0067   //   double chi2Cut = pset_.getParameter<double>("ChiSquarCut");
0068   double chi2Cut(100.);
0069   GsfChi2MeasurementEstimator estimator(chi2Cut);
0070 
0071   //
0072   // create algorithm
0073   //
0074   return std::make_unique<GsfTrajectoryFitter>(
0075       propagator, GsfMultiStateUpdator(), estimator, merger, &iRecord.get(geoToken_));
0076 }
0077 
0078 void GsfTrajectoryFitterESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0079   edm::ParameterSetDescription desc;
0080   desc.add<std::string>("ComponentName");
0081   desc.add<std::string>("MaterialEffectsUpdator");
0082   desc.add<std::string>("GeometricalPropagator");
0083   desc.add<std::string>("Merger");
0084   desc.add<std::string>("RecoGeometry");
0085   descriptions.addDefault(desc);
0086 }
0087 
0088 DEFINE_FWK_EVENTSETUP_MODULE(GsfTrajectoryFitterESProducer);