ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/JetFitAnalyzer/interface/HistoFitter.h
(Generate patch)

Comparing UserCode/JetFitAnalyzer/interface/HistoFitter.h (file contents):
Revision 1.2 by dnisson, Thu Nov 26 21:06:02 2009 UTC vs.
Revision 1.4 by dnisson, Sun Dec 13 19:24:40 2009 UTC

# Line 4 | Line 4
4   #ifndef UserCode_JetFitAnalyzer_HistoFitter_h
5   #define UserCode_JetFitAnalyzer_HistoFitter_h
6  
7 + #include <TH2.h>
8 + #include <vector>
9 + #include <string>
10 + #include <TString.h>
11 + #include <TFormula.h>
12 + #include <TMinuit.h>
13 +
14   class HistoFitter {
15   public:
16 <
17 <  static double fcn(int &, double *, double &, double *, int);
16 >  // the objective function that gets minimized by TMinuit
17 >  static void fcn(int&, double *, double&, double *, int);
18 >  // the correction to Gaussians drifting outside of histogram
19 >  static double outsiderCorrection(double *, double XbinSize,
20 >                                   double YbinSize,
21 >                                   double cutoffRad = 0.2);
22  
23    enum TroubleStage {
24      T_NULL = 0,
# Line 19 | Line 30 | public:
30    struct VectorHisto {
31      std::vector< std::vector<double> > bins;
32      double Xlo, Xhi, Ylo, Yhi;
33 <  } energy;
33 >  };
34  
35    struct Trouble {
36      TroubleStage occ;
# Line 49 | Line 60 | public:
60  
61      double fitFunction(double, double, double *);
62  
63 <    TFormula *getFormula();
63 >    TFormula *indivFormula();
64      void setFormula(TFormula *);
65      void indivParameter(int, std::string&, double&, double&, double&, double&);
66      void setIndivParameter(int, std::string, double, double, double, double);
# Line 61 | Line 72 | public:
72      void setIndivMeanY(unsigned);
73      virtual double chisquareSigma(double) = 0;
74      double formulaIntegral(double, double, double, double,
75 <                       double*, double, double, double*);
76 <    std::vector< std::vector< double > > subtractCurrentFit(VectorHisto);
75 >                       double*, double, double);
76 >    std::vector< std::vector< double > > subtractCurrentFit(VectorHisto,
77 >                                                            FitResults);
78      void initParsFromModelDef(std::vector<TString> &,
79                                double *, double *, double *, double *,
80                                int, FitResults);
81      void findInitialValues(std::vector<TString> &,
82                             double *, double *, double *, double *,
83 <                           int);
84 <    double initNewN();
85 <    double initNewMeanX();
86 <    double initNewMeanY();
83 >                           int, FitResults);
84 >    double initNewN(FitResults);
85 >    double initNewMeanX(FitResults);
86 >    double initNewMeanY(FitResults);
87      void initParameters(TH2 *, TMinuit *, std::vector<TString> &,
88                    double *, double *, double *, double *,
89                    int, FitResults);
# Line 81 | Line 93 | public:
93      TFormula *theIndivFormula; // formula for individual Gaussian
94      std::vector<std::string> indivParNames;
95      std::vector<double> indivParStarts;
96 <    std::vector<double> indivParStartSteps;
96 >    std::vector<double> indivParStartingStepSizes;
97      std::vector<double> indivParLowerLimit;
98      std::vector<double> indivParUpperLimit;
99      unsigned theIndivEnergy;
# Line 93 | Line 105 | public:
105  
106    int getNumberOfDegreesOfFreedom(VectorHisto, int);
107  
108 +  FitResults putParsInFitResults(std::vector<TString>,
109 +                                 double *, double *, double *, double *);
110 +  static VectorHisto loadTH2IntoVectorHisto(TH2*);
111 +  Trouble minimize(TMinuit*, VectorHisto, int);
112 +
113    FitResults fit_histo(TH2 *hist,
114                          std::vector<Trouble> &t,
115                      int start_theNumberOfGaussians = 1,
# Line 105 | Line 122 | public:
122   protected:
123    ModelDefinition *mdef;
124    static ModelDefinition *static_mdef;
125 +  static VectorHisto energy;
126   };
127  
128 + HistoFitter::ModelDefinition * HistoFitter::static_mdef;
129 + HistoFitter::VectorHisto HistoFitter::energy;
130 +
131   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines