Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:25

0001 #ifndef CalibMuon_DTTimeBoxFitter_H
0002 #define CalibMuon_DTTimeBoxFitter_H
0003 
0004 /** \class DTTimeBoxFitter
0005  *  Fit the rising edge of the time box with the integral
0006  *  of a gaussian returning the mean value and the sigma.
0007  *
0008  *  \author G. Cerminara - INFN Torino
0009  */
0010 
0011 #include <utility>
0012 
0013 class TH1F;
0014 class TFile;
0015 #include "TString.h"
0016 
0017 class DTTimeBoxFitter {
0018 public:
0019   /// Constructor
0020   DTTimeBoxFitter(const TString& debugFileName = TString(""));
0021 
0022   /// Destructor
0023   virtual ~DTTimeBoxFitter();
0024 
0025   // Operations
0026 
0027   /// Fit the rising edge of the time box returning mean value and sigma (first and second respectively)
0028   std::pair<double, double> fitTimeBox(TH1F* hTimeBox);
0029 
0030   /// Automatically compute the seeds the range to be used for time box fit
0031   void getFitSeeds(TH1F* hTBox, double& mean, double& sigma, double& tBoxMax, double& xFitMin, double& xFitMax);
0032 
0033   /// Ask the user to provide the seeds
0034   void getInteractiveFitSeeds(
0035       TH1F* hTBox, double& mean, double& sigma, double& tBoxMax, double& xFitMin, double& xFitMax);
0036 
0037   /// Set the verbosity of the output: 0 = silent, 1 = info, 2 = debug
0038   void setVerbosity(unsigned int lvl) { theVerbosityLevel = lvl; }
0039 
0040   /// Switch to interactive fit
0041   void setInteractiveFit(bool isInteractive) { interactiveFit = isInteractive; }
0042 
0043   /// Set the rebin
0044   void setRebinning(int reb) { rebin = reb; }
0045 
0046   void setFitSigma(double sigma) { theSigma = sigma; }
0047 
0048 protected:
0049 private:
0050   TFile* hDebugFile;
0051 
0052   unsigned int theVerbosityLevel;
0053   bool interactiveFit;
0054   int rebin;
0055   double theSigma;
0056 };
0057 
0058 // Define the integral of the gaussian to be used in the fit
0059 double intGauss(double* x, double* par);
0060 
0061 #endif