CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TruncatedAverageDeDxEstimator Class Reference

#include <TruncatedAverageDeDxEstimator.h>

Inheritance diagram for TruncatedAverageDeDxEstimator:
BaseDeDxEstimator

Public Member Functions

virtual std::pair< float, float > dedx (const reco::DeDxHitCollection &Hits)
 
 TruncatedAverageDeDxEstimator (float fraction)
 
- Public Member Functions inherited from BaseDeDxEstimator
virtual ~BaseDeDxEstimator ()
 

Private Attributes

float m_fraction
 

Detailed Description

Definition at line 8 of file TruncatedAverageDeDxEstimator.h.

Constructor & Destructor Documentation

TruncatedAverageDeDxEstimator::TruncatedAverageDeDxEstimator ( float  fraction)
inline

Definition at line 11 of file TruncatedAverageDeDxEstimator.h.

Member Function Documentation

virtual std::pair<float,float> TruncatedAverageDeDxEstimator::dedx ( const reco::DeDxHitCollection Hits)
inlinevirtual

Implements BaseDeDxEstimator.

Definition at line 13 of file TruncatedAverageDeDxEstimator.h.

References i, and m_fraction.

13  {
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  }
int i
Definition: DBlmapReader.cc:9

Member Data Documentation

float TruncatedAverageDeDxEstimator::m_fraction
private

Definition at line 24 of file TruncatedAverageDeDxEstimator.h.

Referenced by dedx().