]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
c3c82e17c22fc9e0d6997e0bdae54ff445b39d46
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliPWG4HighPtQATPConly.cxx
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 compares the global reconstruction with the TPConly 
18 // reconstruction
19 // Momentum resolution is stored as function of track cuts and pt.
20 // Output: Histograms for different set of cuts
21 //-----------------------------------------------------------------------
22 // Author : Marta Verweij - UU
23 //-----------------------------------------------------------------------
24
25 #ifndef ALIPWG4HIGHPTQATPCONLY_CXX
26 #define ALIPWG4HIGHPTQATPCONLY_CXX
27
28 #include "AliPWG4HighPtQATPConly.h"
29
30 #include "TVector3.h"
31 #include <iostream>
32 #include "TH1.h"
33 #include "TH2.h"
34 #include "TH3.h"
35 #include "TList.h"
36 #include "TChain.h"
37 #include "TH3F.h"
38
39 #include "AliAnalysisManager.h"
40 #include "AliESDInputHandler.h"
41 #include "AliESDtrack.h"
42 #include "AliESDtrackCuts.h"
43 #include "AliExternalTrackParam.h"
44 #include "AliLog.h"
45 //#include "AliAnalysisHelperJetTasks.h"
46
47 using namespace std; //required for resolving the 'cout' symbol
48
49 ClassImp(AliPWG4HighPtQATPConly)
50
51 AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(): AliAnalysisTask("AliPWG4HighPtQATPConly", ""), 
52   fESD(0), 
53   fTrackCuts(0), 
54   fTrackCutsITS(0),
55   fTrigger(0),
56   fNEventAll(0),
57   fNEventSel(0),
58   fPtAll(0),
59   fPtSel(0),
60   fPtAllminPtTPCvsPtAll(0),
61   fPtAllminPtTPCvsPtAllNPointTPC(0),
62   fPtAllminPtTPCvsPtAllDCAR(0),
63   fPtAllminPtTPCvsPtAllDCAZ(0),
64   fPtAllminPtTPCvsPtAllPhi(0),
65   fPtAllminPtTPCvsPtAllNPointITS(0),
66   fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
67   fPtAllminPtTPCvsPtAllChi2C(0),
68   fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
69   fHistList(0),
70   fPtAllTPC(0),
71   fPtSelTPC(0),
72   fPtSelTPCITS(0),
73   fHistListTPC(0),
74   fPtSelITS(0),
75   fPtITSminPtTPCvsPtITS(0),
76   fPtITSminPtTPCvsPtITSNPointTPC(0),
77   fPtITSminPtTPCvsPtITSDCAR(0),
78   fPtITSminPtTPCvsPtITSDCAZ(0),
79   fPtITSminPtTPCvsPtITSPhi(0),
80   fPtITSminPtTPCvsPtITSNPointITS(0),
81   fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
82   fPtITSminPtTPCvsPtITSChi2C(0),
83   fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
84   fHistListITS(0)
85 {
86
87 }
88 //________________________________________________________________________
89 AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(const char *name): 
90   AliAnalysisTask(name, ""), 
91   fESD(0),
92   fTrackCuts(),
93   fTrackCutsITS(),
94   fTrigger(0),
95   fNEventAll(0),
96   fNEventSel(0),
97   fPtAll(0),
98   fPtSel(0),
99   fPtAllminPtTPCvsPtAll(0),
100   fPtAllminPtTPCvsPtAllNPointTPC(0),
101   fPtAllminPtTPCvsPtAllDCAR(0),
102   fPtAllminPtTPCvsPtAllDCAZ(0),
103   fPtAllminPtTPCvsPtAllPhi(0),
104   fPtAllminPtTPCvsPtAllNPointITS(0),
105   fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
106   fPtAllminPtTPCvsPtAllChi2C(0),
107   fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
108   fHistList(0),
109   fPtAllTPC(0),
110   fPtSelTPC(0),
111   fPtSelTPCITS(0),
112   fHistListTPC(0),
113   fPtSelITS(0),
114   fPtITSminPtTPCvsPtITS(0),
115   fPtITSminPtTPCvsPtITSNPointTPC(0),
116   fPtITSminPtTPCvsPtITSDCAR(0),
117   fPtITSminPtTPCvsPtITSDCAZ(0),
118   fPtITSminPtTPCvsPtITSPhi(0),
119   fPtITSminPtTPCvsPtITSNPointITS(0),
120   fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
121   fPtITSminPtTPCvsPtITSChi2C(0),
122   fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
123   fHistListITS(0)
124 {
125   //
126   // Constructor. Initialization of Inputs and Outputs
127   //
128   Info("AliPWG4HighPtQATPConly","Calling Constructor");
129   // Input slot #0 works with a TChain ESD
130   DefineInput(0, TChain::Class());
131   // Output slot #0 writes into a TList
132   DefineOutput(0, TList::Class());
133   // Output slot #1 writes into a TList
134   DefineOutput(1, TList::Class());
135   // Output slot #2 writes into a TList
136   DefineOutput(2, TList::Class());
137 }
138
139 //________________________________________________________________________
140 void AliPWG4HighPtQATPConly::ConnectInputData(Option_t *) 
141 {
142   // Connect ESD here
143   // Called once
144   AliDebug(2,Form(">> AliPWG4HighPtSpectra::ConnectInputData \n"));
145   TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
146   if (!tree) {
147     Printf("ERROR: Could not read chain from input slot 0");
148   } else {
149     
150     AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
151     
152     if (!esdH) {
153       AliDebug(2,Form("ERROR: Could not get ESDInputHandler")); 
154     } else {
155       fESD = esdH->GetEvent();
156     }
157   }
158 }
159
160 //________________________________________________________________________
161 void AliPWG4HighPtQATPConly::CreateOutputObjects() {
162   //Create output objects
163   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::CreateOutputObjects \n")); 
164
165   Bool_t oldStatus = TH1::AddDirectoryStatus();
166   TH1::AddDirectory(kFALSE); 
167
168   OpenFile(0);
169   fHistList = new TList();
170   OpenFile(1);
171   fHistListTPC = new TList();
172   OpenFile(2);
173   fHistListITS = new TList();
174
175   Int_t fgkNPhiBins=18;
176   Float_t kMinPhi = 0.;
177   Float_t kMaxPhi = 2.*TMath::Pi();
178   
179   Int_t fgkNPtBins=98;
180   Float_t fgkPtMin=2.;
181   Float_t fgkPtMax=100.;
182   Int_t fgkResPtBins=80;
183
184   fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
185   fHistList->Add(fNEventAll);
186   fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
187   fHistList->Add(fNEventSel);
188   fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
189   fHistList->Add(fPtAll);
190   fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
191   fHistList->Add(fPtSel);
192   
193   fPtAllminPtTPCvsPtAll = new TH2F("fPtAllminPtTPCvsPtAll","PtAllminPtTPCvsPtAll",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
194   fPtAllminPtTPCvsPtAll->SetXTitle("p_{t}^{All}");
195   fPtAllminPtTPCvsPtAll->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
196   fHistList->Add(fPtAllminPtTPCvsPtAll);
197   
198   fPtAllminPtTPCvsPtAllNPointTPC = new TH3F("fPtAllminPtTPCvsPtAllNPointTPC","PtAllminPtTPCvsPtAllNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
199   fPtAllminPtTPCvsPtAllNPointTPC->SetXTitle("p_{t}^{All}");
200   fPtAllminPtTPCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
201   fPtAllminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
202   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPC);
203
204   fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
205   fPtAllminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{All}");
206   fPtAllminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
207   fPtAllminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
208   fHistList->Add(fPtAllminPtTPCvsPtAllDCAR);
209
210   fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
211   fPtAllminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{All}");
212   fPtAllminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
213   fPtAllminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
214   fHistList->Add(fPtAllminPtTPCvsPtAllDCAZ);
215
216   fPtAllminPtTPCvsPtAllPhi = new TH3F("fPtAllminPtTPCvsPtAllPhi","PtAllminPtTPCvsPtAllPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
217   fPtAllminPtTPCvsPtAllPhi->SetXTitle("p_{t}^{All}");
218   fPtAllminPtTPCvsPtAllPhi->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
219   fPtAllminPtTPCvsPtAllPhi->SetZTitle("#phi");
220   fHistList->Add(fPtAllminPtTPCvsPtAllPhi);
221
222   fPtAllminPtTPCvsPtAllNPointITS = new TH3F("fPtAllminPtTPCvsPtAllNPointITS","PtAllminPtTPCvsPtAllNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
223   fPtAllminPtTPCvsPtAllNPointITS->SetXTitle("p_{t}^{All}");
224   fPtAllminPtTPCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
225   fPtAllminPtTPCvsPtAllNPointITS->SetZTitle("N_{point,ITS}}");
226   fHistList->Add(fPtAllminPtTPCvsPtAllNPointITS);
227   
228   fPtAllminPtTPCvsPtAllNSigmaToVertex = new TH3F("fPtAllminPtTPCvsPtAllNSigmaToVertex","PtAllminPtTPCvsPtAllNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
229   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{All}");
230   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
231   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
232   fHistList->Add(fPtAllminPtTPCvsPtAllNSigmaToVertex);
233
234   fPtAllminPtTPCvsPtAllChi2C = new TH3F("fPtAllminPtTPCvsPtAllChi2C","PtAllminPtTPCvsPtAllChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
235   fPtAllminPtTPCvsPtAllChi2C->SetXTitle("p_{t}^{All}");
236   fPtAllminPtTPCvsPtAllChi2C->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
237   fPtAllminPtTPCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
238   fHistList->Add(fPtAllminPtTPCvsPtAllChi2C);
239
240   fPtAllminPtTPCvsPtAllRel1PtUncertainty = new TH3F("fPtAllminPtTPCvsPtAllRel1PtUncertainty","PtAllminPtTPCvsPtAllRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
241   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{All}");
242   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
243   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
244   fHistList->Add(fPtAllminPtTPCvsPtAllRel1PtUncertainty);
245
246   //ITSrefit
247   fPtSelITS = new TH1F("fPtSelITSrefit","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
248   fHistListITS->Add(fPtSelITS);
249   
250   fPtITSminPtTPCvsPtITS = new TH2F("fPtITSminPtTPCvsPtITS","PtITSminPtTPCvsPtITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
251   fPtITSminPtTPCvsPtITS->SetXTitle("p_{t}^{ITS}");
252   fPtITSminPtTPCvsPtITS->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
253   fHistListITS->Add(fPtITSminPtTPCvsPtITS);
254   
255   fPtITSminPtTPCvsPtITSNPointTPC = new TH3F("fPtITSminPtTPCvsPtITSNPointTPC","PtITSminPtTPCvsPtITSNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
256   fPtITSminPtTPCvsPtITSNPointTPC->SetXTitle("p_{t}^{ITSrefit}");
257   fPtITSminPtTPCvsPtITSNPointTPC->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
258   fPtITSminPtTPCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
259   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPC);
260     
261   fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
262   fPtITSminPtTPCvsPtITSDCAR->SetXTitle("p_{t}^{ITSrefit}");
263   fPtITSminPtTPCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
264   fPtITSminPtTPCvsPtITSDCAR->SetZTitle("DCA_{R}");
265   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAR);
266   
267   fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
268   fPtITSminPtTPCvsPtITSDCAZ->SetXTitle("p_{t}^{ITSrefit}");
269   fPtITSminPtTPCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
270   fPtITSminPtTPCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
271   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAZ);
272   
273   fPtITSminPtTPCvsPtITSPhi = new TH3F("fPtITSminPtTPCvsPtITSPhi","PtITSminPtTPCvsPtITSPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
274   fPtITSminPtTPCvsPtITSPhi->SetXTitle("p_{t}^{ITSrefit}");
275   fPtITSminPtTPCvsPtITSPhi->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
276   fPtITSminPtTPCvsPtITSPhi->SetZTitle("#phi");
277   fHistListITS->Add(fPtITSminPtTPCvsPtITSPhi);
278   
279   fPtITSminPtTPCvsPtITSNPointITS = new TH3F("fPtITSminPtTPCvsPtITSNPointITS","PtITSminPtTPCvsPtITSNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
280   fPtITSminPtTPCvsPtITSNPointITS->SetXTitle("p_{t}^{ITSrefit}");
281   fPtITSminPtTPCvsPtITSNPointITS->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
282   fPtITSminPtTPCvsPtITSNPointITS->SetZTitle("N_{point,ITS}}");
283   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointITS); 
284   
285   fPtITSminPtTPCvsPtITSNSigmaToVertex = new TH3F("fPtITSminPtTPCvsPtITSNSigmaToVertex","PtITSminPtTPCvsPtITSNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
286   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetXTitle("p_{t}^{ITS}");
287   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
288   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetZTitle("N#sigma to vertex");
289   fHistListITS->Add(fPtITSminPtTPCvsPtITSNSigmaToVertex);
290
291   fPtITSminPtTPCvsPtITSChi2C = new TH3F("fPtITSminPtTPCvsPtITSChi2C","PtITSminPtTPCvsPtITSChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
292   fPtITSminPtTPCvsPtITSChi2C->SetXTitle("p_{t}^{ITS}");
293   fPtITSminPtTPCvsPtITSChi2C->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
294   fPtITSminPtTPCvsPtITSChi2C->SetZTitle("Constrained #chi^{2}");
295   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2C);
296
297   fPtITSminPtTPCvsPtITSRel1PtUncertainty = new TH3F("fPtITSminPtTPCvsPtITSRel1PtUncertainty","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
298   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetXTitle("p_{t}^{ITS}");
299   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
300   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
301   fHistListITS->Add(fPtITSminPtTPCvsPtITSRel1PtUncertainty);
302
303   fPtAllTPC = new TH1F("fPtAllTPC","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
304   fHistListTPC->Add(fPtAllTPC);
305   fPtSelTPC = new TH1F("fPtSelTPC","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
306   fHistListTPC->Add(fPtSelTPC);
307   fPtSelTPCITS = new TH1F("fPtSelTPCITS","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
308   fHistListTPC->Add(fPtSelTPCITS);
309
310   TH1::AddDirectory(oldStatus);   
311
312 }
313 //________________________________________________________________________
314 void AliPWG4HighPtQATPConly::Exec(Option_t *) {  
315   // Main loop
316   // Called for each event
317   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::Exec \n"));  
318
319   // All events without selection
320   fNEventAll->Fill(0.);
321
322   if (!fESD) {
323     AliDebug(2,Form("ERROR: fESD not available"));
324     // Post output data
325      PostData(0, fHistList);
326      PostData(1, fHistListTPC);
327      PostData(2, fHistListITS);
328     return;
329   }
330
331   Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
332   if(!isSelected) { //Select collison candidates
333     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
334     // Post output data
335      PostData(0, fHistList);
336      PostData(1, fHistListTPC);
337      PostData(2, fHistListITS);
338     return;
339   }
340
341   const AliESDVertex *vtx = fESD->GetPrimaryVertexTracks();
342   // Need vertex cut
343   if (vtx->GetNContributors() < 2) {
344     // Post output data
345     PostData(0, fHistList);
346     PostData(1, fHistListTPC);
347     PostData(2, fHistListITS);
348     return;
349   }
350
351   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
352   double primVtx[3];
353   vtx->GetXYZ(primVtx);
354   //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
355   if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
356     // Post output data
357     PostData(0, fHistList);
358     PostData(1, fHistListTPC);
359     PostData(2, fHistListITS);
360     return;
361   }
362   if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2){ 
363     // Post output data
364     PostData(0, fHistList);
365     PostData(1, fHistListTPC);
366     PostData(2, fHistListITS);
367     return;
368   }
369   Int_t nTracks = fESD->GetNumberOfTracks();
370   AliDebug(2,Form("nTracks %d\n", nTracks));
371
372   if(!fTrackCuts) return;
373
374   // Selected events for analysis
375   fNEventSel->Fill(0.);
376
377   for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
378     
379     AliESDtrack *track = fESD->GetTrack(iTrack);
380     AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
381     if(!track || !trackTPC) continue;
382     Float_t pt = track->Pt();
383     Float_t ptTPC = trackTPC->Pt();
384     Float_t phi = track->Phi();
385     Float_t dca2D, dcaZ;
386     track->GetImpactParameters(dca2D,dcaZ);
387     // Float_t dca2DTPC, dcaZTPC;
388     //track->GetImpactParametersTPC(dca2DTPC,dcaZTPC);
389     UChar_t itsMap = track->GetITSClusterMap();
390     Int_t nPointITS = 0;
391     for (Int_t i=0; i < 6; i++) {
392       if (itsMap & (1 << i))
393         nPointITS ++;
394     }
395     double mom[3];
396     track->GetPxPyPz(mom);
397     Float_t nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track.
398     Float_t chi2C = track->GetConstrainedChi2();
399     Float_t relUncertainty1Pt = TMath::Sqrt(TMath::Abs(track->GetSigma1Pt2()))*pt;
400
401     fPtAll->Fill(pt);
402     fPtAllTPC->Fill(ptTPC);
403     
404     if (fTrackCuts->AcceptTrack(track)) {
405
406       fPtSel->Fill(pt);
407       fPtSelTPC->Fill(ptTPC);
408       fPtAllminPtTPCvsPtAll->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
409       fPtAllminPtTPCvsPtAllNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCNcls());
410       fPtAllminPtTPCvsPtAllDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
411       fPtAllminPtTPCvsPtAllDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
412       fPtAllminPtTPCvsPtAllPhi->Fill(pt,(1./pt-1./ptTPC)/(1./pt),phi);
413       fPtAllminPtTPCvsPtAllNPointITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nPointITS);
414       fPtAllminPtTPCvsPtAllNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
415       fPtAllminPtTPCvsPtAllChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
416       fPtAllminPtTPCvsPtAllRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
417     }//fTrackCuts selection
418     
419     
420     //ITSrefit selection
421     if (fTrackCutsITS->AcceptTrack(track)) {
422       
423       fPtSelITS->Fill(pt);
424       fPtSelTPCITS->Fill(ptTPC);
425       fPtITSminPtTPCvsPtITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
426       fPtITSminPtTPCvsPtITSNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCNcls());
427       fPtITSminPtTPCvsPtITSDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
428       fPtITSminPtTPCvsPtITSDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
429       fPtITSminPtTPCvsPtITSPhi->Fill(pt,(pt-ptTPC)/(pt),phi);
430       fPtITSminPtTPCvsPtITSNPointITS->Fill(pt,(pt-ptTPC)/(pt),nPointITS);
431       fPtITSminPtTPCvsPtITSNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
432       fPtITSminPtTPCvsPtITSChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
433       fPtITSminPtTPCvsPtITSRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
434     }//fTrackCutsITS loop
435       
436 }//ESD track loop
437    
438   // Post output data
439   PostData(0, fHistList);
440   PostData(1, fHistListTPC);
441   PostData(2, fHistListITS);
442
443 }
444 //________________________________________________________________________
445 void AliPWG4HighPtQATPConly::Terminate(Option_t *)
446 {
447
448 }
449
450 #endif