CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GenericTruncatedAverageDeDxEstimator Class Reference

#include <GenericTruncatedAverageDeDxEstimator.h>

Inheritance diagram for GenericTruncatedAverageDeDxEstimator:
BaseDeDxEstimator

Public Member Functions

std::pair< float, float > dedx (const reco::DeDxHitCollection &Hits) override
 
 GenericTruncatedAverageDeDxEstimator (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from BaseDeDxEstimator
virtual void beginRun (edm::Run const &run, const edm::EventSetup &iSetup)
 
virtual ~BaseDeDxEstimator ()
 

Private Attributes

float m_expo
 
float m_fraction
 

Detailed Description

Definition at line 9 of file GenericTruncatedAverageDeDxEstimator.h.

Constructor & Destructor Documentation

GenericTruncatedAverageDeDxEstimator::GenericTruncatedAverageDeDxEstimator ( const edm::ParameterSet iConfig)
inline

Definition at line 12 of file GenericTruncatedAverageDeDxEstimator.h.

References edm::ParameterSet::getParameter(), m_expo, and m_fraction.

12  {
13  m_fraction = iConfig.getParameter<double>("fraction");
14  m_expo = iConfig.getParameter<double>("exponent");
15  }
T getParameter(std::string const &) const

Member Function Documentation

std::pair<float,float> GenericTruncatedAverageDeDxEstimator::dedx ( const reco::DeDxHitCollection Hits)
inlineoverridevirtual

Implements BaseDeDxEstimator.

Definition at line 17 of file GenericTruncatedAverageDeDxEstimator.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, plotBeamSpotDB::first, mps_fire::i, createfilelist::int, plotBeamSpotDB::last, m_expo, m_fraction, and funct::pow().

Referenced by DeDxHitInfoProducer::produce().

17  {
18  int first = 0, last = Hits.size();
19  if (m_fraction > 0) { // truncate high charge ones
20  last -= int(Hits.size()*m_fraction);
21  } else {
22  first += int(Hits.size()*(-m_fraction));
23  }
24  double sumdedx = 0;
25  for(int i = first; i < last; i++){
26  sumdedx+=pow(Hits[i].charge(),m_expo);
27  }
28  double avrdedx = (last-first) ? pow(sumdedx/(last-first),1.0/m_expo) :0.0;
29  return std::make_pair(avrdedx,-1);
30  }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

float GenericTruncatedAverageDeDxEstimator::m_expo
private
float GenericTruncatedAverageDeDxEstimator::m_fraction
private