Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 
0007 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0008 #include "TrackingTools/TrackFitters/interface/TrajectoryFitterRecord.h"
0009 #include "TrackingTools/PatternTools/interface/TrajectorySmoother.h"
0010 
0011 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
0012 #include "TrackingTools/GsfTracking/interface/GsfMaterialEffectsUpdator.h"
0013 #include "TrackingTools/GsfTracking/interface/GsfPropagatorWithMaterial.h"
0014 #include "TrackingTools/GsfTracking/interface/GsfMultiStateUpdator.h"
0015 #include "TrackingTools/GsfTools/interface/MultiGaussianStateMerger.h"
0016 #include "TrackingTools/GsfTools/interface/CloseComponentsMerger.h"
0017 #include "TrackingTools/GsfTracking/interface/MultiTrajectoryStateMerger.h"
0018 #include "TrackingTools/GsfTracking/interface/GsfChi2MeasurementEstimator.h"
0019 #include "TrackingTools/GsfTracking/interface/GsfTrajectorySmoother.h"
0020 
0021 #include <string>
0022 #include <memory>
0023 
0024 /** Provides a GSF smoother algorithm */
0025 
0026 class GsfTrajectorySmootherESProducer : public edm::ESProducer {
0027 public:
0028   GsfTrajectorySmootherESProducer(const edm::ParameterSet& p);
0029 
0030   std::unique_ptr<TrajectorySmoother> produce(const TrajectoryFitterRecord&);
0031 
0032   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0033 
0034 private:
0035   edm::ESGetToken<GsfMaterialEffectsUpdator, TrackingComponentsRecord> matToken_;
0036   edm::ESGetToken<Propagator, TrackingComponentsRecord> propagatorToken_;
0037   edm::ESGetToken<MultiGaussianStateMerger<5>, TrackingComponentsRecord> mergerToken_;
0038   edm::ESGetToken<DetLayerGeometry, RecoGeometryRecord> geoToken_;
0039   const double scale_;
0040 };
0041 
0042 GsfTrajectorySmootherESProducer::GsfTrajectorySmootherESProducer(const edm::ParameterSet& p)
0043     : scale_(p.getParameter<double>("ErrorRescaling")) {
0044   std::string myname = p.getParameter<std::string>("ComponentName");
0045   auto cc = setWhatProduced(this, myname);
0046   matToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("MaterialEffectsUpdator")));
0047   propagatorToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("GeometricalPropagator")));
0048   mergerToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("Merger")));
0049   geoToken_ = cc.consumes(edm::ESInputTag("", p.getParameter<std::string>("RecoGeometry")));
0050 }
0051 
0052 std::unique_ptr<TrajectorySmoother> GsfTrajectorySmootherESProducer::produce(const TrajectoryFitterRecord& iRecord) {
0053   //
0054   // propagator
0055   //
0056   GsfPropagatorWithMaterial propagator(iRecord.get(propagatorToken_), iRecord.get(matToken_));
0057   //
0058   // merger
0059   //
0060   MultiTrajectoryStateMerger merger(iRecord.get(mergerToken_));
0061   //
0062   // estimator
0063   //
0064   //   double chi2Cut = pset_.getParameter<double>("ChiSquarCut");
0065   double chi2Cut(100.);
0066   GsfChi2MeasurementEstimator estimator(chi2Cut);
0067   //
0068   // geometry
0069   // create algorithm
0070   //
0071   //   bool matBefUpd = pset_.getParameter<bool>("MaterialBeforeUpdate");
0072   return std::make_unique<GsfTrajectorySmoother>(
0073       propagator,
0074       GsfMultiStateUpdator(),
0075       estimator,
0076       merger,
0077       //                                     matBefUpd,
0078       scale_,
0079       true,  //BM should this be taken from parameterSet?
0080       &iRecord.get(geoToken_));
0081 }
0082 
0083 void GsfTrajectorySmootherESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0084   edm::ParameterSetDescription desc;
0085   desc.add<std::string>("ComponentName");
0086   desc.add<std::string>("MaterialEffectsUpdator");
0087   desc.add<std::string>("GeometricalPropagator");
0088   desc.add<std::string>("Merger");
0089   desc.add<std::string>("RecoGeometry");
0090   desc.add<double>("ErrorRescaling");
0091 
0092   descriptions.addDefault(desc);
0093 }
0094 DEFINE_FWK_EVENTSETUP_MODULE(GsfTrajectorySmootherESProducer);