]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/QA/Tracking/ExpertQA/AliHighPtTreeAnalysis.h
c77f811d08741711065c0c70d11c0906f3b07908
[u/mrichter/AliRoot.git] / PWGPP / QA / Tracking / ExpertQA / AliHighPtTreeAnalysis.h
1 //////////////////////////////////////////////////////////
2
3 #ifndef AliHighPtTreeAnalysis_h
4 #define AliHighPtTreeAnalysis_h
5
6 #include <inttypes.h>
7 #include <iostream>
8 #include <fstream>
9 #include <TROOT.h>
10 #include <TChain.h>
11 #include <TFile.h>
12 #include <TPaveStats.h>
13 #include <TVectorT.h>
14 #include <TH1.h>
15 #include <TH2.h>
16 #include <TF1.h>
17 #include <TH3.h>
18 #include <TGraphErrors.h>
19 #include <TObjString.h>
20 #include <TObject.h>
21 #include "AliESDVertex.h"
22 #include <TNamed.h>
23 #include "AliVertex.h"
24 #include "AliESDtrack.h"
25 #include "AliESDv0.h"
26 #include "AliExternalTrackParam.h"
27 #include <TBits.h>
28 #include <TParticle.h>
29 #include <TStyle.h>
30 #include <TLegend.h>
31 #include <TTreeStream.h>
32 #include "TString.h"
33 #include "TSystem.h"
34 #include "TMinuit.h"
35 #include "TCanvas.h"
36
37
38 // Fixed size dimensions of array or collections stored in the TTree if any.
39 const Int_t kMaxfileName = 1;
40 const Int_t kMaxvtxESD = 1;
41 const Int_t kMaxesdTrack = 1;
42 const Int_t kMaxextTPCInnerC = 1;
43 const Int_t kMaxextInnerParamC = 1;
44 const Int_t kMaxextInnerParam = 1;
45 const Int_t kMaxextInnerParamRef = 1;
46
47 class AliHighPtTreeAnalysis {
48 public :
49
50   
51    AliHighPtTreeAnalysis( );
52    AliHighPtTreeAnalysis( TString file );
53    virtual ~AliHighPtTreeAnalysis();
54    virtual Int_t         GetEntry(Long64_t entry);
55    virtual Long64_t      LoadTree(Long64_t entry);
56    virtual Long64_t      LoadV0Tree(Long64_t entry);
57    virtual void          Init(TTree *tree);
58    virtual void          InitV0tree(TTree *tree);
59    virtual void          Loop();
60    virtual Bool_t        BaseCut(); // returns true if track passes baseCut
61    virtual void          BookHistos();
62    virtual void          FillHistos();
63    virtual void          Terminate();
64    virtual TGraphErrors* Calc2DProfileContent(TH3D *h1, const char *projAxisName);
65    virtual void          MakeDCArPullFits();
66    virtual void          MakeDCArResFits();
67    virtual void          MakePhiFits();
68    virtual void          Make1pTresCovFits();
69    virtual void          MakeTPCITSMatchingEff();
70    virtual void          MakeK0trends();
71    virtual Double_t      qoverptCorr(Double_t trEta, Double_t trPhi, Int_t type);
72    virtual Bool_t        ConnectGenericHistos( const char *genericHistoFile );
73    virtual void          RunPeriod();
74    virtual void          SetApplyCorrections( const char *correctionFile );
75    virtual void          MakePowerFit(Int_t entries);  // make power fit
76    virtual Bool_t        GetK0TrendFitFunction(TF1 *fLinearFitK0sShift, TF1 *fLinearFitK0sSigma, Int_t Type, Int_t Charge);
77    virtual void          MakedcaRTrends();
78    virtual void          MakeDeltaPhiTrends();
79    virtual void          MakeEfficiencyTrends();
80     
81    virtual void          Plot1D(TH3D *h1, const char *projAxisName, Int_t histoType, Int_t logX, const char *xaxisName, const char *plotName);
82    virtual void          Plot2D(TH3D *h1, const char *projAxisName, Int_t histoType, Int_t logX, const char *xaxisName, const char *plotName);
83    virtual void          Plot2DK0s(TH3D *h1, const char *projAxisName, Int_t histoType, Int_t logX, const char *xaxisName, const char *plotName);
84    virtual void          Plot1PtRes(TH3D *h1, const char *projAxisName, Int_t histoType, Int_t logX,  const char *xaxisName, const char *plotName);
85    virtual void          PlotEff(TH3D *hTPCITS, TH3D *hTPC, const char *projAxisName, Int_t histoType, Int_t logX, const char *xaxisName ,const char *plotName);
86    virtual void          SetHistoProperties(TH1D *hist, Int_t marker, Int_t color, Double_t yMin, Double_t yMax);
87    virtual void          MakeAllPlots();
88
89    virtual void          SetMakePlots(Bool_t makeAllPlots);
90    virtual void          SetHighPtTree(TTree *HighPtTree) { Init(HighPtTree); };
91    virtual void          SetV0Tree(TTree *V0Tree) { InitV0tree(V0Tree); fV0s = kTRUE; };
92    virtual void          SetRunV0s(Bool_t bV0s )  { fV0s = bV0s; };
93    virtual void          SetPeriodName( const char *ch ) {  fPeriodName = new TString( ch ); };
94    virtual void          SetMakeFitPerfomancePlots( Bool_t bFPP ) { fMakeFitPerfomancePlots = bFPP; }
95    
96 private:
97     
98    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
99    TTree          *fV0Chain;
100    
101    TTree          *OutTree;
102     
103    Bool_t          fApplyCorrections;
104    Bool_t          fMakePlots;
105    Bool_t          fV0s;
106    Bool_t          fZipIn;
107    Bool_t          fMakeFitPerfomancePlots;
108    
109    Double_t       *fCorrectionAside;
110    Double_t       *fCorrectionCside;
111    Double_t       *fCorrectionAsideTPCInner;
112    Double_t       *fCorrectionCsideTPCInner;
113    Double_t       *fCorrectionAsideTPCInnerC;
114    Double_t       *fCorrectionCsideTPCInnerC;
115    
116    Int_t fNtracks_TPCLowPt;   
117    Int_t fNtracks_TPCHighPt;
118    Int_t fNtracks_TPCITSLowPt;
119    Int_t fNtracks_TPCITSHighPt;
120     
121    TString        *fPeriodName;
122    Bool_t          fPeriod;
123    Bool_t          hasMC;
124    Double_t        pTcut;
125    Int_t           fBfield;
126     // Declaration of leaf types
127   TObjString            *fileName;
128   Double_t               runNumber;
129   Int_t                  runNumberInt;
130   Int_t                  mult;
131   TObjString            *triggerClass;
132   Double_t               Bz;
133   Int_t                  BzInt;
134   AliESDVertex          *vtxESD;
135   AliESDtrack           *esdTrack;
136   TParticle             *particle;
137   AliExternalTrackParam *extTPCInnerC;
138   AliExternalTrackParam *extInnerParamC;
139   AliExternalTrackParam *extInnerParam;
140   AliExternalTrackParam *extInnerParamRef;
141   Double_t               chi2TPCInnerC;
142   Double_t               chi2InnerC;
143
144   // Declaration of V0 data members
145   AliESDv0              *v0;
146   AliESDtrack           *v0track0;
147   AliESDtrack           *v0track1;
148   
149   
150    // Histos
151  
152   TH3D *hPulldcaRTPConly_vs_eta_1pT;          TH3D *hPulldcaRcomb_vs_eta_1pT;
153   TH3D *hResdcaRTPConly_vs_eta_1pT;           TH3D *hResdcaRcomb_vs_eta_1pT;
154   
155   TH3D *hphiPull_vs_eta_1pT;                  
156   TH3D *hphiRes_vs_eta_1pT; 
157  
158   TH3D *hPulldcaR_vs_eta_pT_Aside;            TH3D *hPulldcaR_vs_eta_pT_Cside;
159   TH3D *hPulldcaRTPCInner_vs_eta_pT_Aside;    TH3D *hPulldcaRTPCInner_vs_eta_pT_Cside;
160   TH3D *hResdcaR_vs_eta_pT_Aside;             TH3D *hResdcaR_vs_eta_pT_Cside;
161   TH3D *hResdcaRTPCInner_vs_eta_pT_Aside;     TH3D *hResdcaRTPCInner_vs_eta_pT_Cside;
162   TH3D *hphiPull_vs_eta_pT_Aside;             TH3D *hphiPull_vs_eta_pT_Cside;
163   TH3D *hphiRes_vs_eta_pT_Aside;              TH3D *hphiRes_vs_eta_pT_Cside;
164   TH3D *hPulldcaR_vs_phi_pT_Aside;            TH3D *hPulldcaR_vs_phi_pT_Cside;
165   TH3D *hPulldcaRTPCInner_vs_phi_pT_Aside;    TH3D *hPulldcaRTPCInner_vs_phi_pT_Cside;
166   TH3D *hResdcaR_vs_phi_pT_Aside;             TH3D *hResdcaR_vs_phi_pT_Cside;
167   TH3D *hResdcaRTPCInner_vs_phi_pT_Aside;     TH3D *hResdcaRTPCInner_vs_phi_pT_Cside;
168   TH3D *hphiPull_vs_phi_pT_Aside;             TH3D *hphiPull_vs_phi_pT_Cside;
169   TH3D *hphiRes_vs_phi_pT_Aside;              TH3D *hphiRes_vs_phi_pT_Cside;
170   TH3D *heta_phi_pT;
171   TH3D *hphi_vs_eta_pT_cutTPC;                TH3D *hphi_vs_eta_pT_cutTPCITS;
172
173
174 // histogram for 1/pt shift calculation
175   TH3F *h1pt_vs_eta_phi;
176   TH3D *h1ptRes_vs_phi_pT_Aside;        TH3D *h1ptRes_vs_phi_pT_Cside;        // 1/pT resolution from cov. matrix
177   TH3D *h1ptRes_vs_mult_pT_Aside;       TH3D *h1ptRes_vs_mult_pT_Cside;           // 1/pT resolution from cov. matrix vs mult.
178   TH3D *h1ptSigma_vs_phi_pT_Aside;      TH3D *h1ptSigma_vs_phi_pT_Cside;      // sigma 1/pT from cov. matrix
179   TH3D *h1ptSigma_vs_mult_pT_Aside;     TH3D *h1ptSigma_vs_mult_pT_Cside;      // sigma 1/pT from cov. matrix vs mult.
180
181 // histogram for 1/pt shift calculation for TPCInnerC
182   TH3F *h1ptTPCInnerC_vs_eta_phi;
183   TH3D *h1ptResTPCInnerC_vs_phi_pT_Aside;    TH3D *h1ptResTPCInnerC_vs_phi_pT_Cside;  // 1/pT resolution from cov. matrix TPCInnerC
184   TH3D *h1ptResTPCInnerC_vs_mult_pT_Aside;   TH3D *h1ptResTPCInnerC_vs_mult_pT_Cside;  // 1/pT resolution from cov. matrix vs mult. TPCInnerC
185   TH3D *h1ptSigmaTPCInnerC_vs_phi_pT_Aside;  TH3D *h1ptSigmaTPCInnerC_vs_phi_pT_Cside; // 1/pT sigma from cov. matrix TPCInnerC
186   TH3D *h1ptSigmaTPCInnerC_vs_mult_pT_Aside; TH3D *h1ptSigmaTPCInnerC_vs_mult_pT_Cside; // 1/pT sigma from cov. matrix vs mult. TPCInnerC
187
188 // histogram for 1/pt shift calculation for TPCInner
189   TH3F *h1ptTPCInner_vs_eta_phi; 
190   TH3D *h1ptResTPCInner_vs_phi_pT_Aside;    TH3D *h1ptResTPCInner_vs_phi_pT_Cside;     // 1/pT resolution from cov. matrix TPCInner
191   TH3D *h1ptResTPCInner_vs_mult_pT_Aside;   TH3D *h1ptResTPCInner_vs_mult_pT_Cside;   // 1/pT resolution from cov. matrix vs mult. TPCInner
192   TH3D *h1ptSigmaTPCInner_vs_phi_pT_Aside;  TH3D *h1ptSigmaTPCInner_vs_phi_pT_Cside;   // 1/pT sigma from cov. matrix TPCInner
193   TH3D *h1ptSigmaTPCInner_vs_mult_pT_Aside; TH3D *h1ptSigmaTPCInner_vs_mult_pT_Cside;   // 1/pT sigma from cov. matrix vs mult. TPCInner
194 // Histogramm for V0s
195   TH3D *hK0sPull_vs_alpha_1pT_pos;
196   TH3D *hK0sRes_vs_alpha_1pT_pos;
197   TH3D *hK0sPull_vs_alpha_1pT_neg;
198   TH3D *hK0sRes_vs_alpha_1pT_neg;
199 // MC info
200   TH3D *hptPull_vs_eta_pT;
201   TH3D *hptRes_vs_eta_pT;
202   TH3D *hptPullTPCInnerC_vs_eta_pT;
203   TH3D *hptResTPCInnerC_vs_eta_pT;
204   TH3D *hptPullTPCInner_vs_eta_pT;
205   TH3D *hptResTPCInner_vs_eta_pT;
206
207   TH3D *hptPull_vs_phi_pT;
208   TH3D *hptRes_vs_phi_pT;
209   TH3D *hptPullTPCInnerC_vs_phi_pT;
210   TH3D *hptResTPCInnerC_vs_phi_pT;
211   TH3D *hptPullTPCInner_vs_phi_pT;
212   TH3D *hptResTPCInner_vs_phi_pT;
213   
214   ClassDef(AliHighPtTreeAnalysis, 1); // example of analysis
215 };
216
217 #endif