extract dca for global and global contraint tracks with different methods
[u/mrichter/AliRoot.git] / PWGJE / AliPWG4HighPtTrackQA.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //-----------------------------------------------------------------------
17 // This class stores QA variables as function of pT for different type
18 // of tracks and track selection criteria
19 // Author : Marta Verweij - UU
20 //-----------------------------------------------------------------------
21
22 #ifndef ALIPWG4HIGHPTTRACKQA_H
23 #define ALIPWG4HIGHPTTRACKQA_H
24
25 #include "AliAnalysisTaskSE.h"
26
27 class TH1F;
28 class TH2F;
29 class TH3F;
30 class TProfile;
31 class TList;
32 class TArrayF;
33
34 class AliVEvent;
35 class AliESDEvent;
36 class AliESDtrackCuts;
37 class AliESDVertex;
38 class AliAODVertex;
39 class AliAODTrack;
40 class AliESDtrack;
41
42 class AliGenPythiaEventHeader;
43 class AliMCEvent;
44 //class AliAnalysisHelperJetTasks;
45
46 class AliPWG4HighPtTrackQA: public AliAnalysisTaskSE {
47
48  public:
49   AliPWG4HighPtTrackQA();
50   AliPWG4HighPtTrackQA(const char *name);
51   virtual ~AliPWG4HighPtTrackQA() {;}
52  
53   //  virtual void   ConnectInputData(Option_t *);
54   virtual void   UserCreateOutputObjects();
55   virtual void   UserExec(Option_t *option);
56   virtual void   Terminate(Option_t *);
57   virtual Bool_t Notify(); //Copied from AliAnalysisTaskJetSpectrum2
58
59   enum DataType {kESD,kAOD};
60
61   Bool_t IsPbPb() {return fIsPbPb;}  //is PbPb data?
62   Bool_t SelectEvent();              //decides if event is used for analysis
63   Int_t CalculateCentrality(AliVEvent *ev);
64   Int_t CalculateCentrality(AliESDEvent *esd);
65   Int_t CalculateCentrality(const AliAODEvent *aod);
66   Int_t GetCentralityClass(Float_t cent=-1.) const;
67   void DoAnalysisESD();
68   void DoAnalysisAOD();
69   void FillHistograms();
70
71   //Setters
72   void SetDataType(DataType d)             {fDataType = d;}
73   void SetIsPbPb(Bool_t cs)                {fIsPbPb = cs;}
74   void SetCentralityClass(int cent)        {fCentClass=cent;}
75   void SetCuts(AliESDtrackCuts* trackCuts)         {fTrackCuts         = trackCuts;}
76   void SetCutsITSLoose(AliESDtrackCuts* trackCuts) {fTrackCutsITSLoose = trackCuts;}
77   void SetCutsTPConly(AliESDtrackCuts* trackCuts)  {fTrackCutsTPConly  = trackCuts;}
78   void SetTrackType(Int_t trackType) {fTrackType = trackType;}
79   void SetFilterMask(UInt_t filterMask)    {fFilterMask    = filterMask ;}
80   void SetIncludeNoITS(Bool_t f)           {fIncludeNoITS  = f          ; }
81
82   void SetSigmaConstrainedMax(Double_t sigma) {fSigmaConstrainedMax=sigma;}
83   void SetPtMax(Float_t ptmax) {fPtMax = ptmax;}
84   void SetPtBinEdges(Int_t region, Double_t ptmax, Double_t ptBinWidth);
85   void SetNVariables(Int_t nv) {fNVariables = nv;}
86
87   Float_t GetPtMax()           {return fPtMax;}
88   Float_t GetTPCClusterInfo(const AliAODTrack *tr,Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Bool_t useFitMap=kFALSE) const;
89   Float_t GetTPCClusterInfoFitMap(const AliESDtrack *tr,Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159) const;
90   Int_t   GetTrackLengthTPC(const AliESDtrack *track) const;
91   Int_t   GetTrackLengthTPC(const AliAODTrack *track) const;
92   Float_t GetGoldenChi2(AliESDtrack *origtrack);
93   Float_t GetGGCChi2(AliESDtrack *origtrack);
94
95   static AliGenPythiaEventHeader*  GetPythiaEventHeader(const AliMCEvent *mcEvent);
96   static Bool_t PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials);// get the cross section and the trails either from pyxsec.root or from pysec_hists.root
97
98  protected:
99
100  private:
101   AliPWG4HighPtTrackQA(const AliPWG4HighPtTrackQA&);
102   AliPWG4HighPtTrackQA& operator=(const AliPWG4HighPtTrackQA&);
103
104   DataType fDataType;             // kESD or kAOD
105
106   AliVEvent   *fEvent;            //! AliVEvent object
107   AliESDEvent *fESD;              //! ESD object
108   const AliESDVertex   *fVtx;     //! vertex object
109   const AliAODVertex   *fVtxAOD;  //! vertex object AOD
110
111   AliESDtrackCuts *fTrackCuts;         // TrackCuts
112   AliESDtrackCuts *fTrackCutsITSLoose; // Loose ITS track cuts
113   AliESDtrackCuts *fTrackCutsTPConly;  // TPC track cuts
114   Int_t   fTrackType;                  // 0: global track; 1:TPConly track 2: TPConly constrained track 3: global ITSrefit 4: TPConly constrained track with QA selection based on global track
115   UInt_t fFilterMask;                  // Select tracks from specific track cuts belonging to certain filter mask for AOD analysis
116   Bool_t fIncludeNoITS;                // includes tracks with failed ITS refit
117
118   Double_t fSigmaConstrainedMax;  // max sigma on constrained fit
119   Float_t fPtMax;                 // Maximum pT for histograms
120   Float_t fPtBinEdges[3][2];      // 3 regions total with different binning for pT axis of histos
121
122   Bool_t   fIsPbPb;               // kTRUE if PbPb
123   Int_t fCentClass;               // Select only events from predefined centrality class
124   
125
126   /*
127     QA variables stored in TArrayF *fVariables
128   0: pt
129   1: phi
130   2: eta
131   3: dca2D
132   4: dcaZ 
133   5: nClustersTPC
134   6: nPointITS   
135   7: chi2C       
136   8: nSigmaToVertex
137   9: relUncertainty1Pt
138   10: chi2PerClusterTPC
139   11: #crossed rows
140   12: (#crossed rows)/(#findable clusters)
141   13: SigmaY2
142   14: SigmaZ2
143   15: SigmaSnp2
144   16: SigmaTgl2
145   17: Sigma1Pt2
146   18: NClustersTPCIter1
147   19: TPCChi2Iter1
148   20: NClustersTPCShared
149   21: Chi2Gold (TPC constrained vs global)
150   22: Chi2GGC (global constrained vs global)
151   23: NCrossed rows from fit map
152   24: (#crossed rows)/(#findable clusters) from fit map
153   */
154
155   Int_t fNVariables;             // Number of variables
156   TArrayF *fVariables;           // QA variables
157
158   UChar_t fITSClusterMap;  // map of clusters, one bit per a layer
159
160   Float_t fAvgTrials;             // Average number of trials
161   
162   TH1F *fNEventAll;                            //! Event counter
163   TH1F *fNEventSel;                            //! Event counter
164   TH1F *fNEventReject;                         //! Book keeping of reason of rejecting events
165  
166   TH1F *fh1Centrality;                         //! Centrality
167
168   TProfile*     fh1Xsec;                       //! pythia cross section and trials
169   TH1F*         fh1Trials;                     //! trials which are added
170   TH1F*         fh1PtHard;                     //! pt hard of the event
171   TH1F*         fh1PtHardTrials;               //! pt hard of the event
172
173   TH1F *fh1NTracksAll;                         //! All tracks
174   TH1F *fh1NTracksReject;                      //! Reason why track was rejected
175   TH1F *fh1NTracksSel;                         //! Number of accepted tracks
176
177   TH1F *fPtAll;                                //! Pt spectrum all charged particles
178   TH1F *fPtSel;                                //! Pt spectrum all selected charged particles by fTrackCuts
179   TH2F *fPtPhi;                                //! Pt vs Phi
180   TH2F *fPtEta;                                //! Pt vs Eta
181   TH3F *fPtEtaPhi;                             //! Pt vs Eta vs Phi
182   TH2F *fPtDCA2D;                              //! Pt vs DCA2D
183   TH2F *fPtDCAZ;                               //! Pt vs DCAZ
184   TH2F *fPtNClustersTPC;                       //! Pt vs nClustersTPC
185   TH2F *fPtNClustersTPCIter1;                  //! Pt vs nClustersTPCIter1
186   TH3F *fPtNClustersTPCIter1Phi;               //! Pt vs nClustersTPCIter1 vs Phi
187   TH2F *fPtNClustersTPCShared;                 //! Pt vs nClustersTPCShared
188   TH2F *fPtNClustersTPCSharedFrac;             //! Pt vs nClustersTPCSharedFrac
189   TH2F *fPtNPointITS;                          //! Pt vs nPointITS
190   TH3F *fPtNPointITSPhi;                       //! Pt vs nPointITS vs phi
191   TH2F *fPtChi2C;                              //! Pt vs Chi2C
192   TH2F *fPtNSigmaToVertex;                     //! Pt vs nSigmaToVertex
193
194   TH2F *fPtRelUncertainty1Pt;                  //! Pt vs relUncertainty1Pt
195   TH3F *fPtRelUncertainty1PtNClus;             //! Pt vs relUncertainty1Pt vs NClustersTPC
196   TH3F *fPtRelUncertainty1PtNClusIter1;        //! Pt vs relUncertainty1Pt vs NClustersTPCIter1
197   TH3F *fPtRelUncertainty1PtNPointITS;         //! Pt vs relUncertainty1Pt vs NPointITS
198   TH3F *fPtRelUncertainty1PtITSClusterMap;     //! Pt vs relUncertainty1Pt vs byte of ITS clustermap
199
200   TH3F *fPtRelUncertainty1PtChi2;              //! Pt vs relUncertainty1Pt vs Chi2TPC/NClus
201   TH3F *fPtRelUncertainty1PtChi2Iter1;         //! Pt vs relUncertainty1Pt vs Chi2TPC/NClusIter1
202   TH3F *fPtRelUncertainty1PtPhi;               //! Pt vs relUncertainty1PtPhi
203
204   TH2F *fPtChi2PerClusterTPC;                  //! Pt vs Chi2PerClusterTPC
205   TH2F *fPtChi2PerClusterTPCIter1;             //! Pt vs Chi2PerClusterTPCIter1
206   TH2F *fPtNCrossedRows;                       //! Pt vs NCrossedRows
207   TH3F *fPtNCrossedRowsPhi;                    //! Pt vs NCrossedRows vs Phi
208   TH3F *fPtNCrossedRowsNClusFPhi;              //! Pt vs NCrossedRows/NClusF vs Phi
209   TH3F *fPtNCrRNCrRNClusF;                     //! Pt vs NCrossedRows vs NCrossedRows/NClusF 
210   TH2F *fPtNCrossedRowsFit;                    //! Pt vs NCrossedRows from NClusterFitMap
211   TH3F *fPtNCrossedRowsFitPhi;                 //! Pt vs NCrossedRows from FitMap vs Phi
212   TH3F *fPtNCrossedRowsNClusFFitPhi;           //! Pt vs NCrossedRows/NClusF from NClusterFitMap
213   TH2F *fNCrossedRowsNCrossedRowsFit;          //! NCrossedRows from ClusterMap vs NCrossedRows from NClusterFitMap
214   TH2F *fNClustersNCrossedRows;                //! NClusters vs NCrossedRows
215   TH2F *fNClustersNCrossedRowsFit;             //! NClusters vs NCrossedRows from fit map
216   TH3F *fPtNClustersNClustersFitMap;           //! pT vs ncls vs ncls from fit map
217   TH3F *fPtRelUncertainty1PtNCrossedRows;      //! Pt vs relUncertainty1Pt vs NCrossedRows
218   TH3F *fPtRelUncertainty1PtNCrossedRowsFit;   //! Pt vs relUncertainty1Pt vs NCrossedRowsFitMap
219
220   TH2F *fPtChi2Gold;                           //! Pt vs Chi2 between global and TPC constrained track
221   TH2F *fPtChi2GGC;                            //! Pt vs Chi2 between global and global constrained track
222   TH3F *fPtChi2GoldPhi;                        //! Pt vs Chi2 between global and TPC constrained track vs phi
223   TH3F *fPtChi2GGCPhi;                         //! Pt vs Chi2 between global and global constrained track vs phi
224   TH2F *fChi2GoldChi2GGC;                      //! Correlations between gold chi2 and GGC chi2
225
226   TH3F *fPtChi2ITSPhi;                         //! Pt vs ITS chi2 vs phi
227
228   //histos for covariance matrix elements
229   TH2F *fPtSigmaY2;                            //! 1/Pt vs sigma(y) extCov[0]
230   TH2F *fPtSigmaZ2;                            //! 1/Pt vs sigma(z) extCov[2]
231   TH2F *fPtSigmaSnp2;                          //! 1/Pt vs sigma(Snp) extCov[5]
232   TH2F *fPtSigmaTgl2;                          //! 1/Pt vs sigma(Tgl) extCov[9]
233   TH2F *fPtSigma1Pt2;                          //! 1/Pt vs sigma(1/pT) extCov[14]
234
235   //profiles for covariance matrix elements
236   TProfile *fProfPtSigmaY2;                    //! 1/Pt vs sigma(y) extCov[0]
237   TProfile *fProfPtSigmaZ2;                    //! 1/Pt vs sigma(z) extCov[2]
238   TProfile *fProfPtSigmaSnp2;                  //! 1/Pt vs sigma(Snp) extCov[5]
239   TProfile *fProfPtSigmaTgl2;                  //! 1/Pt vs sigma(Tgl) extCov[9]
240   TProfile *fProfPtSigma1Pt2;                  //! 1/Pt vs sigma(1/pT) extCov[14]
241
242   TProfile *fProfPtSigma1Pt;                   //! pT vs sigma(1/Pt)
243   TProfile *fProfPtPtSigma1Pt;                 //! pT vs pT*sigma(1/Pt)
244
245   TList *fHistList; //! List of Histograms
246  
247   ClassDef(AliPWG4HighPtTrackQA,7) 
248 };
249 #endif