CMS 3D CMS Logo

TruncatedAverageDeDxEstimator.h
Go to the documentation of this file.
1 #ifndef RecoTrackerDeDx_TruncatedAverageDeDxEstimator_h
2 #define RecoTrackerDeDx_TruncatedAverageDeDxEstimator_h
3 
7 #include <numeric>
8 
10 public:
12  m_fraction = iConfig.getParameter<double>("fraction");
13  }
14 
15  std::pair<float, float> dedx(const reco::DeDxHitCollection& Hits) override {
16  int nTrunc = int(Hits.size() * m_fraction);
17  double sumdedx = 0;
18  for (size_t i = 0; i + nTrunc < Hits.size(); i++) {
19  sumdedx += Hits[i].charge();
20  }
21  double avrdedx = (Hits.size()) ? sumdedx / (Hits.size() - nTrunc) : 0.0;
22  return std::make_pair(avrdedx, -1);
23  }
24 
25 private:
26  float m_fraction;
27 };
28 
29 #endif
mps_fire.i
i
Definition: mps_fire.py:428
reco::DeDxHitCollection
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:41
DeDxHit.h
DeDxTools.h
TruncatedAverageDeDxEstimator::dedx
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
Definition: TruncatedAverageDeDxEstimator.h:15
BaseDeDxEstimator.h
edm::ParameterSet
Definition: ParameterSet.h:47
createfilelist.int
int
Definition: createfilelist.py:10
TruncatedAverageDeDxEstimator
Definition: TruncatedAverageDeDxEstimator.h:9
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BaseDeDxEstimator
Definition: BaseDeDxEstimator.h:7
TruncatedAverageDeDxEstimator::TruncatedAverageDeDxEstimator
TruncatedAverageDeDxEstimator(const edm::ParameterSet &iConfig)
Definition: TruncatedAverageDeDxEstimator.h:11
TruncatedAverageDeDxEstimator::m_fraction
float m_fraction
Definition: TruncatedAverageDeDxEstimator.h:26