test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TruncatedAverageDeDxEstimator.h
Go to the documentation of this file.
1 #ifndef RecoTrackerDeDx_TruncatedAverageDeDxEstimator_h
2 #define RecoTrackerDeDx_TruncatedAverageDeDxEstimator_h
3 
6 #include <numeric>
7 
9 {
10 public:
11  TruncatedAverageDeDxEstimator(float fraction): m_fraction(fraction) {}
12 
13  virtual std::pair<float,float> dedx(const reco::DeDxHitCollection& Hits){
14  int nTrunc = int( Hits.size()*m_fraction);
15  double sumdedx = 0;
16  for(size_t i=0;i + nTrunc < Hits.size() ; i++){
17  sumdedx+=Hits[i].charge();
18  }
19  double avrdedx = (Hits.size()) ? sumdedx/(Hits.size()-nTrunc) :0.0;
20  return std::make_pair(avrdedx,-1);
21  }
22 
23 private:
24  float m_fraction;
25 
26 };
27 
28 #endif
int i
Definition: DBlmapReader.cc:9
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:49
virtual std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits)