add possibility to clusterize only within a centrality bin
[u/mrichter/AliRoot.git] / PWGJE / AliAnaChargedJetResponseMaker.h
CommitLineData
31d3e4f0 1#ifndef __AliAnaChargedJetResponseMaker_h__
2#define __AliAnaChargedJetResponseMaker_h__
3#include "Rtypes.h"
4#include "TH1.h"
5#include "TCanvas.h"
6#include "TMath.h"
7#include "TH2.h"
8#include "TProfile.h"
9#include "THnSparse.h"
10
11class TGraph;
12class TGraphErrors;
13
14//
15// Measured spectrum defines minimum and maximum pT on the reconstructed axis of the response matrix. To be set with SetMeasuredSpectrum(TH1D *hPtMeasured);
16//
17
18class AliAnaChargedJetResponseMaker {
19 public:
20 AliAnaChargedJetResponseMaker();
21 ~AliAnaChargedJetResponseMaker();
22
23 // kParam = use parametrization of response
24 // kResiduals = use response as measured, w/o statistical error propagation
25 // kResidualsErr = use response as measured, with statistical error propagation
26 enum ResolutionType {kParam,kResiduals,kResidualsErr};
27
28 //Setters
29 void SetDebugMode(Bool_t b) {fDebug=b;}
30
31 void SetResolutionType(ResolutionType r) {fResolutionType=r;}
32
33 void SetDeltaPtJetsFunc(TF1 *f1) {fDeltaPt=f1;}
34 void SetDeltaPtJetsHist(TH1D *h1) {fhDeltaPt=h1;}
35 void SetNDimensions(Int_t dim) {fDimensions = dim;}
36 void SetMeasuredSpectrum(TH1D *hPtMeasured);
37
38 void SetFlatEfficiency(Double_t eff);
39 void SetEfficiency(TGraphErrors *grEff);
40
41 void SetPtMinUnfolded(Double_t ptmin) {fPtMinUnfolded = ptmin;}
42 void SetPtMaxUnfolded(Double_t ptmax) {fPtMaxUnfolded = ptmax;}
43 void SetPtMaxUnfoldedHigh(Double_t ptmaxh) {fPtMaxUnfoldedHigh = ptmaxh;}
44 void SetBinWidthFactorUnfolded(Int_t fac) {fBinWidthFactorUnfolded = fac;}
45 void SetSkipBinsUnfolded(Int_t skip) {fSkipBinsUnfolded=skip;}
46 void SetExtraBinsUnfolded(Int_t extra) {fExtraBinsUnfolded=extra;}
47 void SetVariableBinning(Bool_t b, double ptmax) {
48 fbVariableBinning=b;
49 fPtMaxUnfVarBinning=ptmax;
50 }
51 void SetCalcErrors(Bool_t b) {fbCalcErrors=b;}
52
53 //Setters for merging fine to normal response matrix
54 void SetFineFrac(Int_t i = 10) {fFineFrac = i;}
55 void SetRMMergeWeightFunction(TF1 *f1) {f1MergeFunction = f1;}
56
57 //Getters
58 TF1 *GetDeltaPtJetsFunc() {return fDeltaPt;}
59 TH1D *GetDeltaPtJetsHist() {return fhDeltaPt;}
60 THnSparse *GetMeasuredSpectrum() {return fPtMeasured;}
61 THnSparse *GetEfficiency() {return fEfficiency;}
62 THnSparse *GetEfficiencyFine() {return fEfficiencyFine;}
63 THnSparse *GetResponseMatrix() {return fResponseMatrix;}
64 THnSparse *GetResponseMatrixFine() {return fResponseMatrixFine;}
65
66 //Utility functions
67 Double_t InterpolateFast(TGraph *gr, Double_t x);
68 Double_t InterpolateFast(TH1 *h, Double_t x);
69
70 TH1D *MultiplyResponseGenerated(TH1 *hGen=0, TH2 *hResponse=0,TH1 *hEfficiency=0,Bool_t bDrawSlices=kFALSE);
71 TH1D *MultiplyResponseGenerated(TF1 *fGen, TH2 *hResponse,TH1 *hEfficiency);
72
73 void MakeResponseMatrixJetsFineMerged(Int_t skipBins =0, Int_t binWidthFactor = 2, Int_t extraBins = 0, Bool_t bVariableBinning = kFALSE, Double_t ptmin = 0.);
74
75 void InitializeResponseMatrix();
76 void InitializeResponseMatrixFine();
77
78 void InitializeEfficiency();
79 void InitializeEfficiencyFine();
80
81 void FillResponseMatrixFineAndMerge();
82
83 protected:
84 Bool_t fDebug;
85 ResolutionType fResolutionType;
86 TF1 *fDeltaPt;
87 TH1D *fhDeltaPt;
88 Int_t fDimensions; //number of dimensions to unfold (class only prepared for 1 dimension -> 2D response matrix)
89 Int_t fDimRec;
90 Int_t fDimGen;
91 Double_t fPtMin;
92 Double_t fPtMax;
93 Int_t fNbins;
94 Double_t *fBinArrayPtRec;
95 THnSparse *fPtMeasured;
96 Double_t fEffFlat;
97 THnSparse *fEfficiency;
98 THnSparse *fEfficiencyFine;
99 THnSparse *fResponseMatrix;
100 THnSparse *fResponseMatrixFine;
101 Double_t fPtMinUnfolded; //Minimum pt for unfolded spectrum
102 Double_t fPtMaxUnfolded; //Maximum pt for unfolded spectrum
103 Double_t fPtMaxUnfoldedHigh; //Extend last bin of unfolded axis up to fPtMaxUnfoldedHigh
104 Int_t fBinWidthFactorUnfolded; //Unfolded bins x times wider than measured
105 Int_t fSkipBinsUnfolded; //#unfolded bins to be skipped starting from fPtMinUnfolded
106 Int_t fExtraBinsUnfolded; //Extra unfolded bins for pTUnf>pTMeas
107 Bool_t fbVariableBinning; //Unfolded bins 2x narrower for pTUnf<pTMaxUnfVarBinning compared to bin width for pTUnf>pTMaxUnfVarBinning
108 Double_t fPtMaxUnfVarBinning;
109 TF1 *f1MergeFunction;
110 Int_t fFineFrac;
111 Bool_t fbCalcErrors;
112
113 ClassDef(AliAnaChargedJetResponseMaker,0);
114
115};
116
117#endif