CMS 3D CMS Logo

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

#include <TruncatedAverageDeDxEstimator.h>

Inheritance diagram for TruncatedAverageDeDxEstimator:
BaseDeDxEstimator

Public Member Functions

std::pair< float, float > dedx (const reco::DeDxHitCollection &Hits) override
 
 TruncatedAverageDeDxEstimator (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 fraction_
 

Detailed Description

Definition at line 9 of file TruncatedAverageDeDxEstimator.h.

Constructor & Destructor Documentation

◆ TruncatedAverageDeDxEstimator()

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

Definition at line 11 of file TruncatedAverageDeDxEstimator.h.

References fraction_, and edm::ParameterSet::getParameter().

11  {
12  fraction_ = iConfig.getParameter<double>("fraction");
13  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

Member Function Documentation

◆ dedx()

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

Implements BaseDeDxEstimator.

Definition at line 15 of file TruncatedAverageDeDxEstimator.h.

References fraction_, mps_fire::i, and createfilelist::int.

15  {
16  int nTrunc = int(Hits.size() * fraction_);
17  double sumdedx = 0;
18  for (size_t i = 0; i + nTrunc < Hits.size(); i++) {
19  sumdedx += Hits[i].charge();
20  }
21  double avrdedx = (!Hits.empty()) ? sumdedx / (Hits.size() - nTrunc) : 0.0;
22  return std::make_pair(avrdedx, -1);
23  }

Member Data Documentation

◆ fraction_

float TruncatedAverageDeDxEstimator::fraction_
private

Definition at line 26 of file TruncatedAverageDeDxEstimator.h.

Referenced by dedx(), and TruncatedAverageDeDxEstimator().