CMS 3D CMS Logo

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
mps_fire.i
i
Definition: mps_fire.py:428
GenericTruncatedAverageDeDxEstimator::m_fraction
float m_fraction
Definition: GenericTruncatedAverageDeDxEstimator.h:32
reco::DeDxHitCollection
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:41
dqmdumpme.first
first
Definition: dqmdumpme.py:55
dqmdumpme.last
last
Definition: dqmdumpme.py:56
DeDxHit.h
DeDxTools.h
GenericTruncatedAverageDeDxEstimator::dedx
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
Definition: GenericTruncatedAverageDeDxEstimator.h:16
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
BaseDeDxEstimator.h
edm::ParameterSet
Definition: ParameterSet.h:47
createfilelist.int
int
Definition: createfilelist.py:10
GenericTruncatedAverageDeDxEstimator
Definition: GenericTruncatedAverageDeDxEstimator.h:9
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GenericTruncatedAverageDeDxEstimator::m_expo
float m_expo
Definition: GenericTruncatedAverageDeDxEstimator.h:32
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
GenericTruncatedAverageDeDxEstimator::GenericTruncatedAverageDeDxEstimator
GenericTruncatedAverageDeDxEstimator(const edm::ParameterSet &iConfig)
Definition: GenericTruncatedAverageDeDxEstimator.h:11
BaseDeDxEstimator
Definition: BaseDeDxEstimator.h:7