1 |
/* jetfit.h - User-callable function prototypes from jetfit */
|
2 |
|
3 |
#ifndef UserCode_JetFitAnalyzer_jetfit_h
|
4 |
#define UserCode_JetFitAnalyzer_jetfit_h
|
5 |
|
6 |
#include <string>
|
7 |
#include <vector>
|
8 |
|
9 |
#include <TFormula.h>
|
10 |
#include <TString.h>
|
11 |
#include <TMinuit.h>
|
12 |
#include <TH2.h>
|
13 |
|
14 |
namespace jetfit {
|
15 |
|
16 |
enum TroubleStage {
|
17 |
T_NULL = 0,
|
18 |
T_SIMPLEX,
|
19 |
T_MIGRAD,
|
20 |
T_MINOS
|
21 |
};
|
22 |
|
23 |
struct VectorHisto {
|
24 |
vector< vector<double> > bins;
|
25 |
double Xlo, Xhi, Ylo, Yhi;
|
26 |
} energy;
|
27 |
|
28 |
struct Trouble {
|
29 |
TroubleStage occ;
|
30 |
int istat;
|
31 |
};
|
32 |
|
33 |
struct FitResults {
|
34 |
TH2 *rebinnedHisto;
|
35 |
std::vector< double > chisquare;
|
36 |
std::vector< std::vector<TString> > pars;
|
37 |
std::vector< std::vector<double> > pval;
|
38 |
std::vector< std::vector<double> > perr;
|
39 |
std::vector< std::vector<double> > plo;
|
40 |
std::vector< std::vector<double> > phi;
|
41 |
};
|
42 |
|
43 |
class ModelDefinition {
|
44 |
public:
|
45 |
int numberOfGaussians();
|
46 |
void setNumberOfGaussians(int);
|
47 |
|
48 |
double fitFunction(double, double, double *);
|
49 |
|
50 |
TFormula *getFormula();
|
51 |
void setFormula(TFormula *);
|
52 |
void indivParameter(int, std::string&, double&, double&, double&, double&);
|
53 |
void setIndivParameter(int, std::string, double, double, double, double);
|
54 |
void get_special_par(int, int, double&, double&, double&, double&);
|
55 |
void set_special_par(int, int, double, double, double, double);
|
56 |
unsigned get_n_special_par_sets();
|
57 |
int get_indiv_max_E();
|
58 |
void set_indiv_max_E(int);
|
59 |
int get_indiv_max_x();
|
60 |
void set_indiv_max_x(int);
|
61 |
int get_indiv_max_y();
|
62 |
void set_indiv_max_y(int);
|
63 |
virtual double chisquare_error(double) = 0;
|
64 |
double formula_int(double, double, double, double,
|
65 |
double*, double, double, double*);
|
66 |
void par_init(TH2 *, TMinuit *, std::vector<TString> &,
|
67 |
double *, double *, double *, double *,
|
68 |
int, FitResults);
|
69 |
|
70 |
|
71 |
private:
|
72 |
TFormula *indiv_formula; // formula for individual Gaussian
|
73 |
std::vector<std::string> indiv_par_names;
|
74 |
std::vector<double> indiv_par_starts;
|
75 |
std::vector<double> indiv_par_start_steps;
|
76 |
std::vector<double> indiv_par_lo;
|
77 |
std::vector<double> indiv_par_hi;
|
78 |
std::vector< std::vector<double> > special_par_starts;
|
79 |
std::vector< std::vector<double> > special_par_start_steps;
|
80 |
std::vector< std::vector<double> > special_par_lo;
|
81 |
std::vector< std::vector<double> > special_par_hi;
|
82 |
int indiv_max_E;
|
83 |
int indiv_max_x;
|
84 |
int indiv_max_y;
|
85 |
int theNumberOfGaussians;
|
86 |
};
|
87 |
|
88 |
FitResults fit_histo(TH2 *hist, std::vector<Trouble> &t,
|
89 |
void (*cc_minuit)(TMinuit *, TH2 *, int) = 0,
|
90 |
int start_ngauss = 0,
|
91 |
int rebinX = 1, int rebinY = 1,
|
92 |
double P_cutoff_val = 0.5);
|
93 |
|
94 |
ModelDefinition& curr_ModelDefinition();
|
95 |
void set_ModelDefinition(ModelDefinition *_mdef);
|
96 |
|
97 |
bool get_ignorezero();
|
98 |
void set_ignorezero(bool);
|
99 |
|
100 |
double fit_fcn_TF2(double *, double *);
|
101 |
}
|
102 |
|
103 |
#endif
|