Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 
0011 #include "RecoTracker/PixelTrackFitting/interface/PixelTrackFilter.h"
0012 #include "RecoTracker/PixelTrackFitting/interface/PixelTrackFilterByKinematics.h"
0013 
0014 class PixelTrackFilterByKinematicsProducer : public edm::global::EDProducer<> {
0015 public:
0016   explicit PixelTrackFilterByKinematicsProducer(const edm::ParameterSet& iConfig);
0017   ~PixelTrackFilterByKinematicsProducer() override;
0018 
0019   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0020 
0021 private:
0022   void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
0023 
0024   const float theoPtMin;
0025   const float theNSigmaInvPtTolerance;
0026   const float theTIPMax;
0027   const float theNSigmaTipMaxTolerance;
0028   const float theChi2Max;
0029 };
0030 
0031 PixelTrackFilterByKinematicsProducer::PixelTrackFilterByKinematicsProducer(const edm::ParameterSet& iConfig)
0032     : theoPtMin(1 / iConfig.getParameter<double>("ptMin")),
0033       theNSigmaInvPtTolerance(iConfig.getParameter<double>("nSigmaInvPtTolerance")),
0034       theTIPMax(iConfig.getParameter<double>("tipMax")),
0035       theNSigmaTipMaxTolerance(iConfig.getParameter<double>("nSigmaTipMaxTolerance")),
0036       theChi2Max(iConfig.getParameter<double>("chi2")) {
0037   produces<PixelTrackFilter>();
0038 }
0039 
0040 void PixelTrackFilterByKinematicsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0041   edm::ParameterSetDescription desc;
0042 
0043   desc.add<double>("ptMin", 0.1);
0044   desc.add<double>("nSigmaInvPtTolerance", 0.0);
0045   desc.add<double>("tipMax", 1.0);
0046   desc.add<double>("nSigmaTipMaxTolerance", 0.0);
0047   desc.add<double>("chi2", 1000.0);
0048 
0049   descriptions.add("pixelTrackFilterByKinematics", desc);
0050 }
0051 
0052 PixelTrackFilterByKinematicsProducer::~PixelTrackFilterByKinematicsProducer() {}
0053 
0054 void PixelTrackFilterByKinematicsProducer::produce(edm::StreamID,
0055                                                    edm::Event& iEvent,
0056                                                    const edm::EventSetup& iSetup) const {
0057   auto impl = std::make_unique<PixelTrackFilterByKinematics>(
0058       theoPtMin, theNSigmaInvPtTolerance, theTIPMax, theNSigmaTipMaxTolerance, theChi2Max);
0059   auto prod = std::make_unique<PixelTrackFilter>(std::move(impl));
0060   iEvent.put(std::move(prod));
0061 }
0062 
0063 DEFINE_FWK_MODULE(PixelTrackFilterByKinematicsProducer);