Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-18 09:15:20

0001 #ifndef RecoParticleFlow_PFClusterProducer_PFRecHitCreatorBase_h
0002 #define RecoParticleFlow_PFClusterProducer_PFRecHitCreatorBase_h
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 
0010 #include "FWCore/Framework/interface/ConsumesCollector.h"
0011 #include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
0012 #include "DataFormats/Math/interface/Vector3D.h"
0013 #include "DataFormats/DetId/interface/DetId.h"
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 #include "FWCore/Framework/interface/ESHandle.h"
0016 #include "FWCore/Framework/interface/EventSetup.h"
0017 #include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
0018 #include "DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h"
0019 
0020 #include "RecoParticleFlow/PFClusterProducer/interface/PFRecHitQTestBase.h"
0021 #include <memory>
0022 
0023 class PFRecHitCreatorBase {
0024 public:
0025   PFRecHitCreatorBase() {}
0026   PFRecHitCreatorBase(const edm::ParameterSet& iConfig, edm::ConsumesCollector& cc) {
0027     std::vector<edm::ParameterSet> qTests = iConfig.getParameter<std::vector<edm::ParameterSet> >("qualityTests");
0028     for (auto& qTest : qTests) {
0029       std::string name = qTest.getParameter<std::string>("name");
0030       qualityTests_.emplace_back(PFRecHitQTestFactory::get()->create(name, qTest, cc));
0031     }
0032   }
0033   virtual ~PFRecHitCreatorBase() = default;
0034 
0035   virtual void init(const edm::EventSetup& es) {}
0036 
0037   virtual void importRecHits(std::unique_ptr<reco::PFRecHitCollection>&,
0038                              std::unique_ptr<reco::PFRecHitCollection>&,
0039                              const edm::Event&,
0040                              const edm::EventSetup&) = 0;
0041 
0042 protected:
0043   void beginEvent(const edm::Event& event, const edm::EventSetup& setup) {
0044     for (auto& qualityTest : qualityTests_)
0045       qualityTest->beginEvent(event, setup);
0046   }
0047 
0048   std::vector<std::unique_ptr<PFRecHitQTestBase> > qualityTests_;
0049 };
0050 
0051 #include "FWCore/PluginManager/interface/PluginFactory.h"
0052 typedef edmplugin::PluginFactory<PFRecHitCreatorBase*(const edm::ParameterSet&, edm::ConsumesCollector&)>
0053     PFRecHitFactory;
0054 #endif