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 {
10 public:
12  m_expo = iConfig.getParameter<double>("exponent");
13  }
14 
15  std::pair<float,float> dedx(const reco::DeDxHitCollection& Hits) override {
16  float result=0;
17  size_t n = Hits.size();
18  for(size_t i = 0; i< n; i ++){
19  result+=pow(Hits[i].charge(),m_expo);
20  }
21  return std::make_pair( ((n>0)?pow(result/n,1./m_expo):0.0) ,-1);
22  }
23 
24 private:
25  float m_expo;
26 
27 };
28 
29 #endif
T getParameter(std::string const &) const
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:58
GenericAverageDeDxEstimator(const edm::ParameterSet &iConfig)
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40