coverity fixes
[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();
fa7c34ba 21 AliAnaChargedJetResponseMaker(const AliAnaChargedJetResponseMaker& obj); // copy constructor
22 AliAnaChargedJetResponseMaker& operator=(const AliAnaChargedJetResponseMaker& other); // assignment
23 virtual ~AliAnaChargedJetResponseMaker() {;}
31d3e4f0 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
fa7c34ba 31 virtual void SetDebugMode(Bool_t b) {fDebug=b;}
31d3e4f0 32
fa7c34ba 33 virtual void SetResolutionType(ResolutionType r) {fResolutionType=r;}
31d3e4f0 34
fa7c34ba 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);
31d3e4f0 39
fa7c34ba 40 virtual void SetFlatEfficiency(Double_t eff);
41 virtual void SetEfficiency(TGraphErrors *grEff);
31d3e4f0 42
fa7c34ba 43 virtual void SetPtMinUnfolded(Double_t ptmin) {fPtMinUnfolded = ptmin;}
44 virtual void SetPtMaxUnfolded(Double_t ptmax) {fPtMaxUnfolded = ptmax;}
45 virtual void SetPtMaxUnfoldedHigh(Double_t ptmaxh) {fPtMaxUnfoldedHigh = ptmaxh;}
46 virtual void SetBinWidthFactorUnfolded(Int_t fac) {fBinWidthFactorUnfolded = fac;}
47 virtual void SetSkipBinsUnfolded(Int_t skip) {fSkipBinsUnfolded=skip;}
48 virtual void SetExtraBinsUnfolded(Int_t extra) {fExtraBinsUnfolded=extra;}
49 virtual void SetVariableBinning(Bool_t b, double ptmax) {
31d3e4f0 50 fbVariableBinning=b;
51 fPtMaxUnfVarBinning=ptmax;
52 }
fa7c34ba 53 virtual void SetCalcErrors(Bool_t b) {fbCalcErrors=b;}
31d3e4f0 54
55 //Setters for merging fine to normal response matrix
fa7c34ba 56 virtual void SetFineFrac(Int_t i = 10) {fFineFrac = i;}
57 virtual void SetRMMergeWeightFunction(TF1 *f1) {f1MergeFunction = f1;}
31d3e4f0 58
59 //Getters
fa7c34ba 60 virtual TF1 *GetDeltaPtJetsFunc() {return fDeltaPt;}
61 virtual TH1D *GetDeltaPtJetsHist() {return fhDeltaPt;}
62 virtual THnSparse *GetMeasuredSpectrum() {return fPtMeasured;}
63 virtual THnSparse *GetEfficiency() {return fEfficiency;}
64 virtual THnSparse *GetEfficiencyFine() {return fEfficiencyFine;}
65 virtual THnSparse *GetResponseMatrix() {return fResponseMatrix;}
66 virtual THnSparse *GetResponseMatrixFine() {return fResponseMatrixFine;}
31d3e4f0 67
68 //Utility functions
fa7c34ba 69 virtual Double_t InterpolateFast(TGraph *gr, Double_t x);
70 virtual Double_t InterpolateFast(TH1 *h, Double_t x);
31d3e4f0 71
fa7c34ba 72 virtual TH1D *MultiplyResponseGenerated(TH1 *hGen=0, TH2 *hResponse=0,TH1 *hEfficiency=0,Bool_t bDrawSlices=kFALSE);
73 virtual TH1D *MultiplyResponseGenerated(TF1 *fGen, TH2 *hResponse,TH1 *hEfficiency);
31d3e4f0 74
fa7c34ba 75 virtual void MakeResponseMatrixJetsFineMerged(Int_t skipBins =0, Int_t binWidthFactor = 2, Int_t extraBins = 0, Bool_t bVariableBinning = kFALSE, Double_t ptmin = 0.);
31d3e4f0 76
fa7c34ba 77 virtual void InitializeResponseMatrix();
78 virtual void InitializeResponseMatrixFine();
31d3e4f0 79
fa7c34ba 80 virtual void InitializeEfficiency();
81 virtual void InitializeEfficiencyFine();
31d3e4f0 82
fa7c34ba 83 virtual void FillResponseMatrixFineAndMerge();
31d3e4f0 84
03372fd1 85 virtual TH2* MakeResponseMatrixRebin(TH2 *hRMFine = 0, TH2 *hRM = 0, Bool_t useFunctionWeight = kFALSE);
86
87 virtual TH2* CreateTruncated2DHisto(TH2 *h2=0, Double_t xmin=-1, Double_t xmax=-1, Double_t ymin=-1, Double_t ymax=-1);
88 virtual TH2* TruncateAxisRangeResponseMatrix(TH2 *hRMOrig=0, Double_t xmin=-1, Double_t xmax=-1, Double_t ymin=-1, Double_t ymax=-1);
ef62323a 89
275d3481 90 virtual TH2* MultiplityResponseMatrices(TH2 *h2RMDeltaPt, TH2 *h2RMDetector);
91
5d87a047 92 virtual TH2* GetTransposeResponsMatrix(TH2 *h2RM);
93
94 virtual TH2* NormalizeResponsMatrixYaxisWithPrior(TH2 *h2RM, TH1 *hPrior);
95
31d3e4f0 96 protected:
97 Bool_t fDebug;
98 ResolutionType fResolutionType;
99 TF1 *fDeltaPt;
100 TH1D *fhDeltaPt;
101 Int_t fDimensions; //number of dimensions to unfold (class only prepared for 1 dimension -> 2D response matrix)
102 Int_t fDimRec;
103 Int_t fDimGen;
104 Double_t fPtMin;
105 Double_t fPtMax;
106 Int_t fNbins;
107 Double_t *fBinArrayPtRec;
108 THnSparse *fPtMeasured;
109 Double_t fEffFlat;
110 THnSparse *fEfficiency;
111 THnSparse *fEfficiencyFine;
112 THnSparse *fResponseMatrix;
113 THnSparse *fResponseMatrixFine;
114 Double_t fPtMinUnfolded; //Minimum pt for unfolded spectrum
115 Double_t fPtMaxUnfolded; //Maximum pt for unfolded spectrum
116 Double_t fPtMaxUnfoldedHigh; //Extend last bin of unfolded axis up to fPtMaxUnfoldedHigh
117 Int_t fBinWidthFactorUnfolded; //Unfolded bins x times wider than measured
118 Int_t fSkipBinsUnfolded; //#unfolded bins to be skipped starting from fPtMinUnfolded
119 Int_t fExtraBinsUnfolded; //Extra unfolded bins for pTUnf>pTMeas
120 Bool_t fbVariableBinning; //Unfolded bins 2x narrower for pTUnf<pTMaxUnfVarBinning compared to bin width for pTUnf>pTMaxUnfVarBinning
121 Double_t fPtMaxUnfVarBinning;
122 TF1 *f1MergeFunction;
123 Int_t fFineFrac;
124 Bool_t fbCalcErrors;
125
126 ClassDef(AliAnaChargedJetResponseMaker,0);
127
128};
129
130#endif