CMS 3D CMS Logo

PFClusterBuilderBase.h
Go to the documentation of this file.
1 #ifndef __PFClusterBuilderBase_H__
2 #define __PFClusterBuilderBase_H__
3 
8 
10 
11 #include <string>
12 #include <iostream>
13 #include <memory>
14 
15 namespace edm {
16  class EventSetup;
17 }
18 
21 
22 public:
25  : _nSeeds(0),
26  _nClustersFound(0),
27  _minFractionToKeep(conf.getParameter<double>("minFractionToKeep")),
28  _algoName(conf.getParameter<std::string>("algoName")) {
29  if (conf.exists("positionCalc")) {
30  const edm::ParameterSet& pcConf = conf.getParameterSet("positionCalc");
31  const std::string& algo = pcConf.getParameter<std::string>("algoName");
32  _positionCalc = PFCPositionCalculatorFactory::get()->create(algo, pcConf, cc);
33  }
34  }
35  virtual ~PFClusterBuilderBase() = default;
36  // get rid of things we should never use...
37  PFClusterBuilderBase(const PFCBB&) = delete;
38  PFCBB& operator=(const PFCBB&) = delete;
39 
40  virtual void update(const edm::EventSetup&) {}
41 
42  virtual void buildClusters(const reco::PFClusterCollection& topos,
43  const std::vector<bool>& seedable,
44  reco::PFClusterCollection& outclus) = 0;
45 
46  std::ostream& operator<<(std::ostream& o) const {
47  o << "PFClusterBuilder with algo \"" << _algoName << "\" located " << _nSeeds << " seeds and built "
48  << _nClustersFound << " PFClusters from those seeds"
49  << " using position calculation: " << _positionCalc->name() << "." << std::endl;
50  return o;
51  }
52 
53  void reset() { _nSeeds = _nClustersFound = 0; }
54 
55 protected:
56  unsigned _nSeeds, _nClustersFound; // basic performance information
57  const float _minFractionToKeep; // min fraction value to keep in clusters
58  std::unique_ptr<PosCalc> _positionCalc;
59 
60 private:
62 };
63 
64 std::ostream& operator<<(std::ostream& o, const PFClusterBuilderBase& a);
65 
69 
70 #endif
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::ostream & operator<<(std::ostream &o) const
PFCBB & operator=(const PFCBB &)=delete
std::unique_ptr< PosCalc > _positionCalc
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParameterSet const & getParameterSet(std::string const &) const
edmplugin::PluginFactory< PFClusterBuilderBase *(const edm::ParameterSet &, edm::ConsumesCollector &)> PFClusterBuilderFactory
std::ostream & operator<<(std::ostream &o, const PFClusterBuilderBase &a)
PFClusterBuilderBase PFCBB
virtual void update(const edm::EventSetup &)
virtual ~PFClusterBuilderBase()=default
HLT enums.
double a
Definition: hdecay.h:119
PFClusterBuilderBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
virtual void buildClusters(const reco::PFClusterCollection &topos, const std::vector< bool > &seedable, reco::PFClusterCollection &outclus)=0
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
#define get
PFCPositionCalculatorBase PosCalc