Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-20 02:47:05

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 
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0011 
0012 #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitter.h"
0013 #include "RecoPixelVertexing/PixelTrackFitting/interface/PixelFitterByConformalMappingAndLine.h"
0014 
0015 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0016 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0017 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0018 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0019 
0020 class PixelFitterByConformalMappingAndLineProducer : public edm::global::EDProducer<> {
0021 public:
0022   explicit PixelFitterByConformalMappingAndLineProducer(const edm::ParameterSet& iConfig)
0023       : theTTRHBuilderToken(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("TTRHBuilder")))),
0024         theTrackerToken(esConsumes()),
0025         theFieldToken(esConsumes()),
0026         thePutToken(produces<PixelFitter>()),
0027         theFixImpactParameter(0),
0028         theUseFixImpactParameter(false) {
0029     if (iConfig.getParameter<bool>("useFixImpactParameter")) {
0030       theFixImpactParameter = iConfig.getParameter<double>("fixImpactParameter");
0031       theUseFixImpactParameter = true;
0032     }
0033   }
0034   ~PixelFitterByConformalMappingAndLineProducer() override {}
0035 
0036   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0037     edm::ParameterSetDescription desc;
0038 
0039     desc.add<std::string>("TTRHBuilder", "PixelTTRHBuilderWithoutAngle");
0040     desc.add<bool>("useFixImpactParameter", false);
0041     desc.add<double>("fixImpactParameter", 0.0);
0042     descriptions.add("pixelFitterByConformalMappingAndLine", desc);
0043   }
0044 
0045 private:
0046   void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0047 
0048   const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theTTRHBuilderToken;
0049   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerToken;
0050   const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theFieldToken;
0051   const edm::EDPutTokenT<PixelFitter> thePutToken;
0052   double theFixImpactParameter;
0053   bool theUseFixImpactParameter;
0054 };
0055 
0056 void PixelFitterByConformalMappingAndLineProducer::produce(edm::StreamID,
0057                                                            edm::Event& iEvent,
0058                                                            const edm::EventSetup& iSetup) const {
0059   iEvent.emplace(thePutToken,
0060                  std::make_unique<PixelFitterByConformalMappingAndLine>(&iSetup.getData(theTTRHBuilderToken),
0061                                                                         &iSetup.getData(theTrackerToken),
0062                                                                         &iSetup.getData(theFieldToken),
0063                                                                         theFixImpactParameter,
0064                                                                         theUseFixImpactParameter));
0065 }
0066 
0067 DEFINE_FWK_MODULE(PixelFitterByConformalMappingAndLineProducer);