CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
UnbinnedFitDeDxEstimator Class Reference

#include <UnbinnedFitDeDxEstimator.h>

Inheritance diagram for UnbinnedFitDeDxEstimator:
BaseDeDxEstimator

Public Member Functions

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

Public Attributes

double data [50]
 
TF1 * f1
 
UnbinnedLikelihoodFit fitter
 

Detailed Description

Definition at line 14 of file UnbinnedFitDeDxEstimator.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file UnbinnedFitDeDxEstimator.h.

References f1, fitter, and UnbinnedLikelihoodFit::setFunction().

18  {
19  fitter.setFunction((f1 = new TF1("myLandau","TMath::Landau(x,[0],[1],1)",0,255)));
20  }
UnbinnedFitDeDxEstimator::~UnbinnedFitDeDxEstimator ( )
inlineoverride

Definition at line 22 of file UnbinnedFitDeDxEstimator.h.

References f1.

22  {
23  // clean up everything
24  delete f1;
25  }

Member Function Documentation

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

Implements BaseDeDxEstimator.

Definition at line 27 of file UnbinnedFitDeDxEstimator.h.

References data, f1, UnbinnedLikelihoodFit::fit(), fitter, and mps_fire::i.

27  {
28  // if there is no hit, returns invalid.
29  if(Hits.empty()) return std::make_pair(-1,-1);
30  // sets the initial parameters
31  f1->SetParameters(3.0 , 0.3);
32  // fills a temporary array and performs the fit
33  uint32_t i=0;
34  for (reco::DeDxHitCollection::const_iterator hit = Hits.begin(); hit!=Hits.end(); ++hit,++i) {
35  data[i] = hit->charge();
36  }
37  // fit !
38  fitter.fit(Hits.size(),data);
39  // returns the mpv and its error
40  return std::make_pair(f1->GetParameter(0),f1->GetParError(0));
41  }
int32_t fit(int32_t verbosity=-1)

Member Data Documentation

double UnbinnedFitDeDxEstimator::data[50]
TF1* UnbinnedFitDeDxEstimator::f1
UnbinnedLikelihoodFit UnbinnedFitDeDxEstimator::fitter

Definition at line 46 of file UnbinnedFitDeDxEstimator.h.

Referenced by dedx(), and UnbinnedFitDeDxEstimator().