Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0010 #include "FWCore/Utilities/interface/EDGetToken.h"
0011 
0012 #include "RecoTracker/PixelTrackFitting/interface/PixelTrackFilter.h"
0013 #include "RecoTracker/PixelLowPtUtilities/interface/ClusterShapeTrackFilter.h"
0014 #include "DataFormats/SiPixelCluster/interface/SiPixelClusterShapeCache.h"
0015 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0016 #include "RecoTracker/Record/interface/CkfComponentsRecord.h"
0017 
0018 class ClusterShapeTrackFilterProducer : public edm::global::EDProducer<> {
0019 public:
0020   explicit ClusterShapeTrackFilterProducer(const edm::ParameterSet& iConfig);
0021   ~ClusterShapeTrackFilterProducer() override;
0022 
0023   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0024 
0025 private:
0026   void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0027 
0028   edm::EDGetTokenT<SiPixelClusterShapeCache> clusterShapeCacheToken_;
0029   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerToken_;
0030   edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> shapeToken_;
0031   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
0032   const double ptMin_;
0033   const double ptMax_;
0034 };
0035 
0036 ClusterShapeTrackFilterProducer::ClusterShapeTrackFilterProducer(const edm::ParameterSet& iConfig)
0037     : clusterShapeCacheToken_(
0038           consumes<SiPixelClusterShapeCache>(iConfig.getParameter<edm::InputTag>("clusterShapeCacheSrc"))),
0039       trackerToken_(esConsumes()),
0040       shapeToken_(esConsumes(edm::ESInputTag("", "ClusterShapeHitFilter"))),
0041       topoToken_(esConsumes()),
0042       ptMin_(iConfig.getParameter<double>("ptMin")),
0043       ptMax_(iConfig.getParameter<double>("ptMax")) {
0044   produces<PixelTrackFilter>();
0045 }
0046 
0047 void ClusterShapeTrackFilterProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0048   edm::ParameterSetDescription desc;
0049 
0050   desc.add<edm::InputTag>("clusterShapeCacheSrc", edm::InputTag("siPixelClusterShapeCache"));
0051   desc.add<double>("ptMin", 0);
0052   desc.add<double>("ptMax", 999999.);
0053 
0054   descriptions.add("clusterShapeTrackFilter", desc);
0055 }
0056 
0057 ClusterShapeTrackFilterProducer::~ClusterShapeTrackFilterProducer() {}
0058 
0059 void ClusterShapeTrackFilterProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0060   edm::Handle<SiPixelClusterShapeCache> cache;
0061   iEvent.getByToken(clusterShapeCacheToken_, cache);
0062 
0063   auto impl = std::make_unique<ClusterShapeTrackFilter>(cache.product(),
0064                                                         ptMin_,
0065                                                         ptMax_,
0066                                                         &iSetup.getData(trackerToken_),
0067                                                         &iSetup.getData(shapeToken_),
0068                                                         &iSetup.getData(topoToken_));
0069   auto prod = std::make_unique<PixelTrackFilter>(std::move(impl));
0070   iEvent.put(std::move(prod));
0071 }
0072 
0073 DEFINE_FWK_MODULE(ClusterShapeTrackFilterProducer);