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 {
11 public:
13  m_fraction = iConfig.getParameter<double>("fraction");
14  }
15 
16  std::pair<float,float> dedx(const reco::DeDxHitCollection& Hits) override{
17  int nTrunc = int( Hits.size()*m_fraction);
18  double sumdedx = 0;
19  for(size_t i=0;i + nTrunc < Hits.size() ; i++){
20  sumdedx+=Hits[i].charge();
21  }
22  double avrdedx = (Hits.size()) ? sumdedx/(Hits.size()-nTrunc) :0.0;
23  return std::make_pair(avrdedx,-1);
24  }
25 
26 private:
27  float m_fraction;
28 
29 };
30 
31 #endif
T getParameter(std::string const &) const
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:58
TruncatedAverageDeDxEstimator(const edm::ParameterSet &iConfig)