CMS 3D CMS Logo

GenericAverageDeDxEstimator.h
Go to the documentation of this file.
1 #ifndef RecoTrackerDeDx_GenericAverageDeDxEstimator_h
2 #define RecoTrackerDeDx_GenericAverageDeDxEstimator_h
3 
7 
9 public:
10  GenericAverageDeDxEstimator(const edm::ParameterSet& iConfig) { m_expo = iConfig.getParameter<double>("exponent"); }
11 
12  std::pair<float, float> dedx(const reco::DeDxHitCollection& Hits) override {
13  float result = 0;
14  size_t n = Hits.size();
15  for (size_t i = 0; i < n; i++) {
16  result += pow(Hits[i].charge(), m_expo);
17  }
18  return std::make_pair(((n > 0) ? pow(result / n, 1. / m_expo) : 0.0), -1);
19  }
20 
21 private:
22  float m_expo;
23 };
24 
25 #endif
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:41
constexpr int pow(int x)
Definition: conifer.h:24
GenericAverageDeDxEstimator(const edm::ParameterSet &iConfig)