CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GenericTruncatedAverageDeDxEstimator.h
Go to the documentation of this file.
1 #ifndef RecoTrackerDeDx_GenericTruncatedAverageDeDxEstimator_h
2 #define RecoTrackerDeDx_GenericTruncatedAverageDeDxEstimator_h
3 
7 #include <numeric>
8 
10 public:
12  m_fraction = iConfig.getParameter<double>("fraction");
13  m_expo = iConfig.getParameter<double>("exponent");
14  }
15 
16  std::pair<float, float> dedx(const reco::DeDxHitCollection& Hits) override {
17  int first = 0, last = Hits.size();
18  if (m_fraction > 0) { // truncate high charge ones
19  last -= int(Hits.size() * m_fraction);
20  } else {
21  first += int(Hits.size() * (-m_fraction));
22  }
23  double sumdedx = 0;
24  for (int i = first; i < last; i++) {
25  sumdedx += pow(Hits[i].charge(), m_expo);
26  }
27  double avrdedx = (last - first) ? pow(sumdedx / (last - first), 1.0 / m_expo) : 0.0;
28  return std::make_pair(avrdedx, -1);
29  }
30 
31 private:
33 };
34 
35 #endif
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:41
GenericTruncatedAverageDeDxEstimator(const edm::ParameterSet &iConfig)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
tuple last
Definition: dqmdumpme.py:56
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29