Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef __PFCPositionCalculatorBase_H__
0002 #define __PFCPositionCalculatorBase_H__
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/Framework/interface/ConsumesCollector.h"
0006 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0007 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
0008 
0009 #include <string>
0010 
0011 namespace edm {
0012   class EventSetup;
0013 }
0014 
0015 class PFCPositionCalculatorBase {
0016   typedef PFCPositionCalculatorBase PosCalc;
0017 
0018 public:
0019   PFCPositionCalculatorBase(const edm::ParameterSet& conf, edm::ConsumesCollector& cc)
0020       : _minFractionInCalc(conf.getParameter<double>("minFractionInCalc")),
0021         _algoName(conf.getParameter<std::string>("algoName")) {}
0022   virtual ~PFCPositionCalculatorBase() = default;
0023   //get rid of things we should never use
0024   PFCPositionCalculatorBase(const PosCalc&) = delete;
0025   PosCalc& operator=(const PosCalc&) = delete;
0026 
0027   virtual void update(const edm::EventSetup&) {}
0028 
0029   // here we transform one PFCluster to use the new position calculation
0030   virtual void calculateAndSetPosition(reco::PFCluster&) = 0;
0031   // here you call a loop inside to transform the whole vector
0032   virtual void calculateAndSetPositions(reco::PFClusterCollection&) = 0;
0033 
0034   const std::string& name() const { return _algoName; }
0035 
0036 protected:
0037   const float _minFractionInCalc;
0038 
0039 private:
0040   const std::string _algoName;
0041 };
0042 
0043 // define the factory for this base class
0044 #include "FWCore/PluginManager/interface/PluginFactory.h"
0045 typedef edmplugin::PluginFactory<PFCPositionCalculatorBase*(const edm::ParameterSet&, edm::ConsumesCollector&)>
0046     PFCPositionCalculatorFactory;
0047 
0048 #endif