Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:29

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/global/EDProducer.h"
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0012 
0013 #include "RecoTracker/PixelTrackFitting/interface/PixelFitter.h"
0014 #include "RecoTracker/PixelLowPtUtilities/interface/TrackFitter.h"
0015 
0016 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0017 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0018 #include "MagneticField/Engine/interface/MagneticField.h"
0019 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0020 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0021 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0022 
0023 class TrackFitterProducer : public edm::global::EDProducer<> {
0024 public:
0025   explicit TrackFitterProducer(const edm::ParameterSet& iConfig);
0026   ~TrackFitterProducer() override {}
0027 
0028   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0029 
0030 private:
0031   void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0032 
0033   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0034   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magFieldToken_;
0035   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> ttrhToken_;
0036   edm::EDGetTokenT<reco::BeamSpot> theBeamSpotToken;
0037 };
0038 
0039 TrackFitterProducer::TrackFitterProducer(const edm::ParameterSet& iConfig)
0040     : geomToken_(esConsumes()),
0041       magFieldToken_(esConsumes()),
0042       ttrhToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("TTRHBuilder")))) {
0043   produces<PixelFitter>();
0044 }
0045 
0046 void TrackFitterProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0047   edm::ParameterSetDescription desc;
0048 
0049   desc.add<std::string>("TTRHBuilder", "");
0050 
0051   descriptions.add("trackFitter", desc);
0052 }
0053 
0054 void TrackFitterProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0055   const auto& tracker = &iSetup.getData(geomToken_);
0056   const auto& field = &iSetup.getData(magFieldToken_);
0057   const auto& ttrh = &iSetup.getData(ttrhToken_);
0058 
0059   auto impl = std::make_unique<TrackFitter>(tracker, field, ttrh);
0060   auto prod = std::make_unique<PixelFitter>(std::move(impl));
0061   iEvent.put(std::move(prod));
0062 }
0063 
0064 DEFINE_FWK_MODULE(TrackFitterProducer);