CMS 3D CMS Logo

PFClusterBuilderBase.h
Go to the documentation of this file.
1 #ifndef __PFClusterBuilderBase_H__
2 #define __PFClusterBuilderBase_H__
3 
7 
9 
10 #include <string>
11 #include <iostream>
12 #include <memory>
13 
14 namespace edm {
15  class EventSetup;
16 }
17 
20  public:
23  _nSeeds(0), _nClustersFound(0),
24  _minFractionToKeep(conf.getParameter<double>("minFractionToKeep")),
25  _algoName(conf.getParameter<std::string>("algoName")) {
26  if( conf.exists("positionCalc") ) {
27  const edm::ParameterSet& pcConf = conf.getParameterSet("positionCalc");
28  const std::string& algo = pcConf.getParameter<std::string>("algoName");
29  _positionCalc = std::unique_ptr<PosCalc>{PFCPositionCalculatorFactory::get()->create(algo,
30  pcConf)};
31  }
32  }
33  virtual ~PFClusterBuilderBase() = default;
34  // get rid of things we should never use...
35  PFClusterBuilderBase(const PFCBB&) = delete;
36  PFCBB& operator=(const PFCBB&) = delete;
37 
38  virtual void update(const edm::EventSetup&) { }
39 
40  virtual void buildClusters(const reco::PFClusterCollection& topos,
41  const std::vector<bool>& seedable,
42  reco::PFClusterCollection& outclus) = 0;
43 
44  std::ostream& operator<<(std::ostream& o) const {
45  o << "PFClusterBuilder with algo \"" << _algoName
46  << "\" located " << _nSeeds << " seeds and built "
47  << _nClustersFound << " PFClusters from those seeds"
48  << " using position calculation: " << _positionCalc->name()
49  << "." << 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 
65 std::ostream& operator<<(std::ostream& o, const PFClusterBuilderBase& a);
66 
69 
70 #endif
T getParameter(std::string const &) const
std::ostream & operator<<(std::ostream &o) const
std::unique_ptr< PosCalc > _positionCalc
bool exists(std::string const &parameterName) const
checks if a parameter exists
PFClusterBuilderBase PFCBB
edmplugin::PluginFactory< PFClusterBuilderBase *(const edm::ParameterSet &) > PFClusterBuilderFactory
ParameterSet const & getParameterSet(std::string const &) const
virtual void update(const edm::EventSetup &)
PFClusterBuilderBase(const edm::ParameterSet &conf)
HLT enums.
double a
Definition: hdecay.h:121
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
T get(const Candidate &c)
Definition: component.h:55
PFCPositionCalculatorBase PosCalc