CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTResidualFitter Class Reference

#include <DTResidualFitter.h>

Public Member Functions

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

Private Attributes

bool debug_
 

Detailed Description

Definition at line 23 of file DTResidualFitter.h.

Constructor & Destructor Documentation

DTResidualFitter::DTResidualFitter ( bool  debug = false)

Definition at line 14 of file DTResidualFitter.cc.

14 :debug_(debug) {}
#define debug
Definition: HDRShower.cc:19
DTResidualFitter::~DTResidualFitter ( )

Definition at line 16 of file DTResidualFitter.cc.

16 {}

Member Function Documentation

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

Definition at line 18 of file DTResidualFitter.cc.

References debug_.

Referenced by dtCalibration::DTVDriftSegment::compute().

18  {
19 
20  TString option("R");
21  if(!debug_) option += "Q";
22 
23  float minFit = histo.GetMean() - histo.GetRMS();
24  float maxFit = histo.GetMean() + histo.GetRMS();
25 
26  TString funcName = TString(histo.GetName()) + "_gaus";
27  TF1* fitFunc = new TF1(funcName,"gaus",minFit,maxFit);
28 
29  histo.Fit(fitFunc,option);
30 
31  minFit = fitFunc->GetParameter(1) - nSigmas*fitFunc->GetParameter(2);
32  maxFit = fitFunc->GetParameter(1) + nSigmas*fitFunc->GetParameter(2);
33  fitFunc->SetRange(minFit,maxFit);
34  histo.Fit(fitFunc,option);
35 
36  return DTResidualFitResult( fitFunc->GetParameter(1),
37  fitFunc->GetParError(1),
38  fitFunc->GetParameter(2),
39  fitFunc->GetParError(2) );
40 }

Member Data Documentation

bool DTResidualFitter::debug_
private

Definition at line 31 of file DTResidualFitter.h.

Referenced by fitResiduals().