]>
Commit | Line | Data |
---|---|---|
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 | ||
11 | class TGraph; | |
12 | class 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 | ||
18 | class AliAnaChargedJetResponseMaker { | |
19 | public: | |
20 | AliAnaChargedJetResponseMaker(); | |
21 | AliAnaChargedJetResponseMaker(const AliAnaChargedJetResponseMaker& obj); // copy constructor | |
22 | AliAnaChargedJetResponseMaker& operator=(const AliAnaChargedJetResponseMaker& other); // assignment | |
23 | virtual ~AliAnaChargedJetResponseMaker() {;} | |
24 | ||
25 | // kParam = use parametrization of response | |
26 | // kResiduals = use response as measured, w/o statistical error propagation | |
27 | // kResidualsErr = use response as measured, with statistical error propagation | |
28 | enum ResolutionType {kParam,kResiduals,kResidualsErr}; | |
29 | ||
30 | //Setters | |
31 | virtual void SetDebugMode(Bool_t b) {fDebug=b;} | |
32 | ||
33 | virtual void SetResolutionType(ResolutionType r) {fResolutionType=r;} | |
34 | ||
35 | virtual void SetDeltaPtJetsFunc(TF1 *f1) {fDeltaPt=f1;} | |
36 | virtual void SetDeltaPtJetsHist(TH1D *h1) {fhDeltaPt=h1;} | |
37 | virtual void SetNDimensions(Int_t dim) {fDimensions = dim;} | |
38 | virtual void SetMeasuredSpectrum(TH1D *hPtMeasured); | |
39 | virtual void SetMeasuredSpectrumTruncated(TH1D *h1) {fh1MeasuredTruncated=h1;} | |
40 | ||
41 | virtual void SetDetectorResponse(TH2 *h2) {fh2DetectorResponse=(TH2D*)h2;} | |
42 | virtual void SetDetectorEfficiency(TH1D *h1) {fhEfficiencyDet=h1;} | |
43 | ||
44 | virtual void SetFlatEfficiency(Double_t eff); | |
45 | virtual void SetEfficiency(TGraphErrors *grEff); | |
46 | ||
47 | virtual void SetPtMinUnfolded(Double_t ptmin) {fPtMinUnfolded = ptmin;} | |
48 | virtual void SetPtMaxUnfolded(Double_t ptmax) {fPtMaxUnfolded = ptmax;} | |
49 | virtual void SetPtMaxUnfoldedHigh(Double_t ptmaxh) {fPtMaxUnfoldedHigh = ptmaxh;} | |
50 | virtual void SetBinWidthFactorUnfolded(Int_t fac) {fBinWidthFactorUnfolded = fac;} | |
51 | virtual void SetSkipBinsUnfolded(Int_t skip) {fSkipBinsUnfolded=skip;} | |
52 | virtual void SetExtraBinsUnfolded(Int_t extra) {fExtraBinsUnfolded=extra;} | |
53 | virtual void SetVariableBinning(Bool_t b, double ptmax) { | |
54 | fbVariableBinning=b; | |
55 | fPtMaxUnfVarBinning=ptmax; | |
56 | } | |
57 | virtual void SetCalcErrors(Bool_t b) {fbCalcErrors=b;} | |
58 | ||
59 | //Setters for merging fine to normal response matrix | |
60 | virtual void SetFineFrac(Int_t i = 10) {fFineFrac = i;} | |
61 | virtual void SetRMMergeWeightFunction(TF1 *f1) {f1MergeFunction = f1;} | |
62 | ||
63 | //Getters | |
64 | virtual TF1 *GetDeltaPtJetsFunc() {return fDeltaPt;} | |
65 | virtual TH1D *GetDeltaPtJetsHist() {return fhDeltaPt;} | |
66 | virtual THnSparse *GetMeasuredSpectrum() {return fPtMeasured;} | |
67 | virtual THnSparse *GetEfficiency() {return fEfficiency;} | |
68 | virtual THnSparse *GetEfficiencyFine() {return fEfficiencyFine;} | |
69 | virtual THnSparse *GetResponseMatrix() {return fResponseMatrix;} | |
70 | virtual THnSparse *GetResponseMatrixFine() {return fResponseMatrixFine;} | |
71 | ||
72 | virtual TH2D *GetDetectorResponseRebin() {return fh2DetectorResponseRebin;} | |
73 | ||
74 | virtual Bool_t CheckInputForCombinedResponse(); | |
75 | ||
76 | virtual TH2D *GetResponseCombinedFineFull() {return fh2ResponseMatrixCombinedFineFull;} | |
77 | virtual TH2D *GetResponseCombinedFull() {return fh2ResponseMatrixCombinedFull;} | |
78 | ||
79 | virtual TH2D *GetResponseCombined() {return fh2ResponseMatrixCombined;} | |
80 | virtual TH1D *GetEfficiencyCombined() {return fhEfficiencyCombined;} | |
81 | ||
82 | static Double_t GetBetaPerDOFValue(Int_t betaColl = 0, Int_t betaOpt= 0); | |
83 | ||
84 | //Utility functions | |
85 | virtual Double_t InterpolateFast(TGraph *gr, Double_t x); | |
86 | virtual Double_t InterpolateFast(TH1 *h, Double_t x); | |
87 | ||
88 | virtual TH1D *MultiplyResponseGenerated(TH1 *hGen=0, TH2 *hResponse=0,TH1 *hEfficiency=0,Bool_t bDrawSlices=kFALSE); | |
89 | virtual TH1D *MultiplyResponseGenerated(TF1 *fGen, TH2 *hResponse,TH1 *hEfficiency); | |
90 | ||
91 | virtual void MakeResponseMatrixCombined(Int_t skipBins =0, Int_t binWidthFactor = 2, Int_t extraBins = 0, Bool_t bVariableBinning = kFALSE, Double_t ptmin = 0.); | |
92 | ||
93 | virtual void MakeResponseMatrixJetsFineMerged(Int_t skipBins =0, Int_t binWidthFactor = 2, Int_t extraBins = 0, Bool_t bVariableBinning = kFALSE, Double_t ptmin = 0.); | |
94 | ||
95 | virtual void InitializeResponseMatrix(); | |
96 | virtual void InitializeResponseMatrixFine(); | |
97 | ||
98 | virtual void InitializeEfficiency(); | |
99 | virtual void InitializeEfficiencyFine(); | |
100 | ||
101 | virtual void FillResponseMatrixFineAndMerge(); | |
102 | ||
103 | virtual TH2* MakeResponseMatrixRebin(TH2 *hRMFine = 0, TH2 *hRM = 0, Bool_t useFunctionWeight = kFALSE); | |
104 | ||
105 | virtual TH2* CreateTruncated2DHisto(TH2 *h2=0, Double_t xmin=-1, Double_t xmax=-1, Double_t ymin=-1, Double_t ymax=-1); | |
106 | virtual TH2* TruncateAxisRangeResponseMatrix(TH2 *hRMOrig=0, Double_t xmin=-1, Double_t xmax=-1, Double_t ymin=-1, Double_t ymax=-1); | |
107 | ||
108 | virtual TH2* MultiplityResponseMatrices(TH2 *h2RMDeltaPt, TH2 *h2RMDetector); | |
109 | ||
110 | virtual TH2* GetTransposeResponsMatrix(TH2 *h2RM); | |
111 | ||
112 | virtual TH2* NormalizeResponsMatrixYaxisWithPrior(TH2 *h2RM, TH1 *hPrior); | |
113 | ||
114 | protected: | |
115 | Bool_t fDebug; | |
116 | ResolutionType fResolutionType; | |
117 | TF1 *fDeltaPt; | |
118 | TH1D *fhDeltaPt; | |
119 | TH1D *fh1MeasuredTruncated; | |
120 | TH2D *fh2DetectorResponse; | |
121 | TH2D *fh2DetectorResponseRebin; | |
122 | TH1D *fhEfficiencyDet; | |
123 | TH2D *fh2ResponseMatrixCombinedFineFull; | |
124 | TH2D *fh2ResponseMatrixCombinedFull; | |
125 | TH2D *fh2ResponseMatrixCombined; | |
126 | TH1D *fhEfficiencyCombined; | |
127 | Int_t fDimensions; //number of dimensions to unfold (class only prepared for 1 dimension -> 2D response matrix) | |
128 | Int_t fDimRec; | |
129 | Int_t fDimGen; | |
130 | Double_t fPtMin; | |
131 | Double_t fPtMax; | |
132 | Int_t fNbins; | |
133 | Double_t *fBinArrayPtRec; | |
134 | THnSparse *fPtMeasured; | |
135 | Double_t fEffFlat; | |
136 | THnSparse *fEfficiency; | |
137 | THnSparse *fEfficiencyFine; | |
138 | THnSparse *fResponseMatrix; | |
139 | THnSparse *fResponseMatrixFine; | |
140 | Double_t fPtMinUnfolded; //Minimum pt for unfolded spectrum | |
141 | Double_t fPtMaxUnfolded; //Maximum pt for unfolded spectrum | |
142 | Double_t fPtMaxUnfoldedHigh; //Extend last bin of unfolded axis up to fPtMaxUnfoldedHigh | |
143 | Int_t fBinWidthFactorUnfolded; //Unfolded bins x times wider than measured | |
144 | Int_t fSkipBinsUnfolded; //#unfolded bins to be skipped starting from fPtMinUnfolded | |
145 | Int_t fExtraBinsUnfolded; //Extra unfolded bins for pTUnf>pTMeas | |
146 | Bool_t fbVariableBinning; //Unfolded bins 2x narrower for pTUnf<pTMaxUnfVarBinning compared to bin width for pTUnf>pTMaxUnfVarBinning | |
147 | Double_t fPtMaxUnfVarBinning; | |
148 | TF1 *f1MergeFunction; | |
149 | Int_t fFineFrac; | |
150 | Bool_t fbCalcErrors; | |
151 | ||
152 | ClassDef(AliAnaChargedJetResponseMaker,0); | |
153 | ||
154 | }; | |
155 | ||
156 | #endif |