CMS 3D CMS Logo

Public Member Functions | Public Attributes

UnbinnedFitDeDxEstimator Class Reference

#include <UnbinnedFitDeDxEstimator.h>

Inheritance diagram for UnbinnedFitDeDxEstimator:
BaseDeDxEstimator

List of all members.

Public Member Functions

virtual std::pair< float, float > dedx (const reco::DeDxHitCollection &Hits)
 UnbinnedFitDeDxEstimator ()
virtual ~UnbinnedFitDeDxEstimator ()

Public Attributes

double data [50]
TF1 * f1
UnbinnedLikelihoodFit fitter

Detailed Description

Definition at line 13 of file UnbinnedFitDeDxEstimator.h.


Constructor & Destructor Documentation

UnbinnedFitDeDxEstimator::UnbinnedFitDeDxEstimator ( ) [inline]

Definition at line 17 of file UnbinnedFitDeDxEstimator.h.

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

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

Definition at line 21 of file UnbinnedFitDeDxEstimator.h.

References f1.

                                      {
    // clean up everything
    delete f1;
  }

Member Function Documentation

virtual std::pair<float,float> UnbinnedFitDeDxEstimator::dedx ( const reco::DeDxHitCollection Hits) [inline, virtual]

Implements BaseDeDxEstimator.

Definition at line 26 of file UnbinnedFitDeDxEstimator.h.

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

                                                                       {
    // if there is no hit, returns invalid.
    if(Hits.size()==0) return std::make_pair(-1,-1);
    // sets the initial parameters
    f1->SetParameters(3.0 , 0.3);
    // fills a temporary array and performs the fit
    uint32_t i=0;
    for (reco::DeDxHitCollection::const_iterator hit = Hits.begin(); hit!=Hits.end(); ++hit,++i) {
      data[i] = hit->charge();
    }
    // fit !
    fitter.fit(Hits.size(),data);
    // returns the mpv and its error
    return std::make_pair(f1->GetParameter(0),f1->GetParError(0)); 
  }

Member Data Documentation

Definition at line 43 of file UnbinnedFitDeDxEstimator.h.

Referenced by dedx().

Definition at line 45 of file UnbinnedFitDeDxEstimator.h.

Referenced by dedx(), and UnbinnedFitDeDxEstimator().