Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-24 02:13:01

0001 // user includes
0002 #include "FWCore/Framework/interface/ESProducer.h"
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "FWCore/Framework/interface/ModuleFactory.h"
0006 #include "FWCore/Framework/interface/ModuleFactory.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/PluginManager/interface/ModuleDef.h"
0009 #include "FWCore/Utilities/interface/typelookup.h"
0010 #include "RecoTracker/Record/interface/CkfComponentsRecord.h"
0011 #include "RecoTracker/Record/interface/MultiRecHitRecord.h"
0012 #include "RecoTracker/SiTrackerMRHTools/interface/SiTrackerMultiRecHitUpdator.h"
0013 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0014 
0015 // system includes
0016 #include <string>
0017 #include <memory>
0018 
0019 class SiTrackerMultiRecHitUpdatorESProducer : public edm::ESProducer {
0020 public:
0021   SiTrackerMultiRecHitUpdatorESProducer(const edm::ParameterSet& p);
0022   ~SiTrackerMultiRecHitUpdatorESProducer() override = default;
0023   std::unique_ptr<SiTrackerMultiRecHitUpdator> produce(const MultiRecHitRecord&);
0024 
0025 private:
0026   std::string myname_, sname_, hitpropagator_;
0027   bool debug_;
0028   std::vector<double> annealingProgram_;
0029   float chi2Cut1D_, chi2Cut2D_;
0030 
0031   edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> ttrhbToken;
0032   edm::ESGetToken<TrackingRecHitPropagator, CkfComponentsRecord> ttrhpToken;
0033 };
0034 
0035 using namespace edm;
0036 
0037 SiTrackerMultiRecHitUpdatorESProducer::SiTrackerMultiRecHitUpdatorESProducer(const edm::ParameterSet& p)
0038     : myname_(p.getParameter<std::string>("ComponentName")),
0039       sname_(p.getParameter<std::string>("TTRHBuilder")),
0040       hitpropagator_(p.getParameter<std::string>("HitPropagator")),
0041       debug_(p.getParameter<bool>("Debug")),
0042       annealingProgram_(p.getParameter<std::vector<double> >("AnnealingProgram")),
0043       chi2Cut1D_(p.getParameter<double>("ChiSquareCut1D")),
0044       chi2Cut2D_(p.getParameter<double>("ChiSquareCut2D")) {
0045   auto cc = setWhatProduced(this, myname_);
0046   ttrhbToken = cc.consumes(edm::ESInputTag("", sname_));
0047   ttrhpToken = cc.consumes(edm::ESInputTag("", hitpropagator_));
0048 }
0049 
0050 std::unique_ptr<SiTrackerMultiRecHitUpdator> SiTrackerMultiRecHitUpdatorESProducer::produce(
0051     const MultiRecHitRecord& iRecord) {
0052   const TransientTrackingRecHitBuilder* hbuilder = &iRecord.get(ttrhbToken);
0053   const TrackingRecHitPropagator* hhitpropagator = &iRecord.get(ttrhpToken);
0054 
0055   return std::make_unique<SiTrackerMultiRecHitUpdator>(
0056       hbuilder, hhitpropagator, chi2Cut1D_, chi2Cut2D_, annealingProgram_, debug_);
0057 }
0058 
0059 DEFINE_FWK_EVENTSETUP_MODULE(SiTrackerMultiRecHitUpdatorESProducer);