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 25 of file DTResidualFitter.h.

Constructor & Destructor Documentation

DTResidualFitter::DTResidualFitter ( bool  debug = false)

Definition at line 16 of file DTResidualFitter.cc.

16 :debug_(debug) {}
#define debug
Definition: MEtoEDMFormat.h:34
DTResidualFitter::~DTResidualFitter ( )

Definition at line 18 of file DTResidualFitter.cc.

18 {}

Member Function Documentation

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

Definition at line 20 of file DTResidualFitter.cc.

References debug_.

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

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

Member Data Documentation

bool DTResidualFitter::debug_
private

Definition at line 33 of file DTResidualFitter.h.

Referenced by fitResiduals().