- introduction of gain scenarios (e.g. OROC only - for homogeneous gain in 11h)
[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
ef62323a 85 virtual TH2* MakeResponseMatrixRebin(TH2 *hRMFine, TH2 *hRM);
86
275d3481 87 virtual TH2* MultiplityResponseMatrices(TH2 *h2RMDeltaPt, TH2 *h2RMDetector);
88
31d3e4f0 89 protected:
90 Bool_t fDebug;
91 ResolutionType fResolutionType;
92 TF1 *fDeltaPt;
93 TH1D *fhDeltaPt;
94 Int_t fDimensions; //number of dimensions to unfold (class only prepared for 1 dimension -> 2D response matrix)
95 Int_t fDimRec;
96 Int_t fDimGen;
97 Double_t fPtMin;
98 Double_t fPtMax;
99 Int_t fNbins;
100 Double_t *fBinArrayPtRec;
101 THnSparse *fPtMeasured;
102 Double_t fEffFlat;
103 THnSparse *fEfficiency;
104 THnSparse *fEfficiencyFine;
105 THnSparse *fResponseMatrix;
106 THnSparse *fResponseMatrixFine;
107 Double_t fPtMinUnfolded; //Minimum pt for unfolded spectrum
108 Double_t fPtMaxUnfolded; //Maximum pt for unfolded spectrum
109 Double_t fPtMaxUnfoldedHigh; //Extend last bin of unfolded axis up to fPtMaxUnfoldedHigh
110 Int_t fBinWidthFactorUnfolded; //Unfolded bins x times wider than measured
111 Int_t fSkipBinsUnfolded; //#unfolded bins to be skipped starting from fPtMinUnfolded
112 Int_t fExtraBinsUnfolded; //Extra unfolded bins for pTUnf>pTMeas
113 Bool_t fbVariableBinning; //Unfolded bins 2x narrower for pTUnf<pTMaxUnfVarBinning compared to bin width for pTUnf>pTMaxUnfVarBinning
114 Double_t fPtMaxUnfVarBinning;
115 TF1 *f1MergeFunction;
116 Int_t fFineFrac;
117 Bool_t fbCalcErrors;
118
119 ClassDef(AliAnaChargedJetResponseMaker,0);
120
121};
122
123#endif