CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTResidualFitter Class Reference

#include <DTResidualFitter.h>

List of all members.

Public Member Functions

 DTResidualFitter (bool debug=false)
DTResidualFitResult fitResiduals (TH1F &histo, int nSigmas=1)
 ~DTResidualFitter ()

Private Attributes

bool debug_

Detailed Description

Definition at line 25 of file DTResidualFitter.h.


Constructor & Destructor Documentation

DTResidualFitter::DTResidualFitter ( bool  debug = false)

Definition at line 16 of file DTResidualFitter.cc.

DTResidualFitter::~DTResidualFitter ( )

Definition at line 18 of file DTResidualFitter.cc.

{}

Member Function Documentation

DTResidualFitResult DTResidualFitter::fitResiduals ( TH1F &  histo,
int  nSigmas = 1 
)

Definition at line 20 of file DTResidualFitter.cc.

References debug_.

Referenced by DTVDriftSegment::compute().

                                                                          {
  
   TString option("R");
   if(!debug_) option += "Q";
 
   float minFit = histo.GetMean() - histo.GetRMS();
   float maxFit = histo.GetMean() + histo.GetRMS();

   TString funcName = TString(histo.GetName()) + "_gaus";
   TF1* fitFunc = new TF1(funcName,"gaus",minFit,maxFit);

   histo.Fit(fitFunc,option);

   minFit = fitFunc->GetParameter(1) - nSigmas*fitFunc->GetParameter(2);
   maxFit = fitFunc->GetParameter(1) + nSigmas*fitFunc->GetParameter(2);
   fitFunc->SetRange(minFit,maxFit);
   histo.Fit(fitFunc,option);

   return DTResidualFitResult( fitFunc->GetParameter(1),
                               fitFunc->GetParError(1),
                               fitFunc->GetParameter(2),
                               fitFunc->GetParError(2) ); 
} 

Member Data Documentation

bool DTResidualFitter::debug_ [private]

Definition at line 33 of file DTResidualFitter.h.

Referenced by fitResiduals().