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

Definition at line 16 of file UnbinnedFitDeDxEstimator.h.

16  {
17  fitter.setFunction((f1 = new TF1("myLandau", "TMath::Landau(x,[0],[1],1)", 0, 255)));
18  }

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

◆ ~UnbinnedFitDeDxEstimator()

UnbinnedFitDeDxEstimator::~UnbinnedFitDeDxEstimator ( )
inlineoverride

Definition at line 20 of file UnbinnedFitDeDxEstimator.h.

20  {
21  // clean up everything
22  delete f1;
23  }

References f1.

Member Function Documentation

◆ dedx()

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

Implements BaseDeDxEstimator.

Definition at line 25 of file UnbinnedFitDeDxEstimator.h.

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

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

Member Data Documentation

◆ data

double UnbinnedFitDeDxEstimator::data[50]

◆ f1

TF1* UnbinnedFitDeDxEstimator::f1

◆ fitter

UnbinnedLikelihoodFit UnbinnedFitDeDxEstimator::fitter

Definition at line 45 of file UnbinnedFitDeDxEstimator.h.

Referenced by dedx(), and UnbinnedFitDeDxEstimator().

mps_fire.i
i
Definition: mps_fire.py:428
UnbinnedFitDeDxEstimator::f1
TF1 * f1
Definition: UnbinnedFitDeDxEstimator.h:44
UnbinnedFitDeDxEstimator::fitter
UnbinnedLikelihoodFit fitter
Definition: UnbinnedFitDeDxEstimator.h:45
tools.TF1
TF1
Definition: tools.py:23
UnbinnedFitDeDxEstimator::data
double data[50]
Definition: UnbinnedFitDeDxEstimator.h:43
UnbinnedLikelihoodFit::fit
int32_t fit(int32_t verbosity=-1)
Definition: UnbinnedLikelihoodFit.cc:56
UnbinnedLikelihoodFit::setFunction
void setFunction(TF1 *f)
Definition: UnbinnedLikelihoodFit.cc:50
hit
Definition: SiStripHitEffFromCalibTree.cc:88