CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 11 of file GenericTruncatedAverageDeDxEstimator.h.

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

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

Member Function Documentation

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

Implements BaseDeDxEstimator.

Definition at line 16 of file GenericTruncatedAverageDeDxEstimator.h.

References RecoTauCleanerPlugins::charge, first, mps_fire::i, dqmdumpme::last, m_expo, m_fraction, and funct::pow().

Referenced by DeDxHitInfoProducer::produce().

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

Member Data Documentation

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