forked from lucamicheletti93/dq_fit_library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDQFitter.h
executable file
·102 lines (83 loc) · 2.11 KB
/
DQFitter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// \author Luca Micheletti <luca.micheletti@cern.ch>
#ifndef DQFITTER_H
#define DQFITTER_H
#include "TObject.h"
#include "TH1.h"
#include "TH2.h"
#include "TF1.h"
#include "TString.h"
#include "TTree.h"
#include <string>
#include <vector>
// RooFit includes
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooWorkspace.h"
#include "RooAddPdf.h"
#include "RooExtendPdf.h"
#include "RooPlot.h"
using namespace RooFit;
using namespace std;
class DQFitter : public TObject
{
public:
DQFitter();
DQFitter(TString);
virtual ~DQFitter();
void OpenOutputFile(TString pathToFile);
void CloseOutputFile();
void SetHistogram(TH1F* hist);
void SetTree(TTree *tree);
void SetUserFunction(const char *nameFunc[3], Int_t nParams[3]);
void SetUserPDF(const char *nameFunc[3], Int_t nParams[3]);
void InitParameters(Int_t nParams, Double_t *params, Double_t *minParamLimits, Double_t *maxParamLimits, TString *nameParams);
void SetFitRange(Double_t minFitRange, Double_t maxFitRange);
void SetFitMethod(TString fitMethod);
void BinnedFitInvMassSpectrum(TString trialName);
void UnbinnedFitInvMassSpectrum(TString trialName);
protected:
void SaveResults();
private:
// Configurations
Bool_t fDoRooFit;
// Files
TFile* fFile;
TString fPathToFile;
// Histograms
TH1F* fHist;
TH1F* fHistBkg;
TH1F* fHistResiduals;
TH1F* fHistRatio;
TH1F* fHistResults;
// Trees
TTree* fTree;
// Fitting functions
TF1* fFuncTot;
TF1* fFuncBkg;
TF1* fFuncSig;
Int_t fNParBkg;
Int_t fNParSig;
Int_t fMaxFitIterations;
// Fit parameters
TString fTrialName;
TString fFitStatus;
Int_t fNParams;
Double_t* fParams;
Double_t* fMinParamLimits;
Double_t* fMaxParamLimits;
TString* fParamNames;
Double_t fMinFitRange;
Double_t fMaxFitRange;
TString fFitMethod;
Double_t fChiSquareNDF;
Double_t fErrorChiSquareNDF;
Double_t fSignal;
Double_t fErrorSignal;
// RooFit variables
RooRealVar fRooMass;
RooWorkspace fRooWorkspace;
RooRealVar* fRooParameters[100];
RooPlot* fRooPlot;
ClassDef(DQFitter,1)
};
#endif