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::GenericTruncatedAverageDeDxEstimator ( const edm::ParameterSet iConfig)
inline

Definition at line 11 of file GenericTruncatedAverageDeDxEstimator.h.

11  {
12  m_fraction = iConfig.getParameter<double>("fraction");
13  m_expo = iConfig.getParameter<double>("exponent");
14  }

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

Member Function Documentation

◆ dedx()

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

Implements BaseDeDxEstimator.

Definition at line 16 of file GenericTruncatedAverageDeDxEstimator.h.

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  }

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

Referenced by DeDxHitInfoProducer::produce().

Member Data Documentation

◆ m_expo

float GenericTruncatedAverageDeDxEstimator::m_expo
private

◆ m_fraction

float GenericTruncatedAverageDeDxEstimator::m_fraction
private
mps_fire.i
i
Definition: mps_fire.py:428
GenericTruncatedAverageDeDxEstimator::m_fraction
float m_fraction
Definition: GenericTruncatedAverageDeDxEstimator.h:32
dqmdumpme.last
last
Definition: dqmdumpme.py:56
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
createfilelist.int
int
Definition: createfilelist.py:10
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GenericTruncatedAverageDeDxEstimator::m_expo
float m_expo
Definition: GenericTruncatedAverageDeDxEstimator.h:32
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29