]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
addedd new histos for cosmics
[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 #include <Bytes.h>
39 #include <TTree.h>
40
41 #include "AliAnalysisManager.h"
42 #include "AliESDInputHandler.h"
43 #include "AliESDtrack.h"
44 #include "AliESDfriend.h"
45 #include "AliESDfriendTrack.h"
46 #include "AliESDtrackCuts.h"
47 #include "AliExternalTrackParam.h"
48 #include "AliLog.h"
49 //#include "AliAnalysisHelperJetTasks.h"
50
51 #include "AliStack.h"
52 #include "TParticle.h"
53 #include "TH1I.h"
54 #include "AliMCEvent.h"
55 #include "AliMCEventHandler.h"
56
57 using namespace std; //required for resolving the 'cout' symbol
58
59 ClassImp(AliPWG4HighPtQATPConly)
60
61 AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(): AliAnalysisTask("AliPWG4HighPtQATPConly", ""), 
62   fESD(0), 
63   fESDfriend(0), 
64   fMC(0),
65   fTrackCuts(0), 
66   fTrackCutsITS(0),
67   fNEventAll(0),
68   fNEventSel(0),
69   fPtAll(0),
70   fPtSel(0),
71   fPtAllminPtTPCvsPtAll(0),
72   fPtAllminPtTPCvsPtAllNPointTPC(0),
73   fPtAllminPtTPCvsPtAllNPointTPCS(0),
74   fPtAllminPtTPCvsPtAllDCAR(0),
75   fPtAllminPtTPCvsPtAllDCAZ(0),
76   fPtAllminPtTPCvsPtAllPhi(0),
77   fPtAllminPtTPCvsPtAllNPointITS(0),
78   fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
79   fPtAllminPtTPCvsPtAllChi2C(0),
80   fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
81   fPtAllminPtTPCvsPtAllChi2PerNClusTPC(0),
82   fPtAllminPtTPCvsPtAllChi2PerNClusITS(0),
83   fEtaPhiOutliers(0),
84   fPtSelITSouter(0),
85   fPtITSouterminPtTPCvsPtAll(0),
86   fPtITSouterminPtTPCvsPtAllNPointTPC(0),
87   fPtITSouterminPtTPCvsPtAllNPointTPCS(0),
88   fPtITSouterminPtTPCvsPtAllDCAR(0),
89   fPtITSouterminPtTPCvsPtAllDCAZ(0),
90   fPtITSouterminPtTPCvsPtAllPhi(0),
91   fPtITSouterminPtTPCvsPtAllNPointITS(0),
92   fPtITSouterminPtTPCvsPtAllNSigmaToVertex(0),
93   fPtITSouterminPtTPCvsPtAllChi2C(0),
94   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty(0),
95   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC(0),
96   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS(0),
97   fPtITSouterminPtTPCvsPtAll_ITSLayer0(0),
98   fPtITSouterminPtTPCvsPtAll_ITSLayer1(0),
99   fPtITSouterminPtTPCvsPtAll_ITSLayer2(0),
100   fPtITSouterminPtTPCvsPtAll_ITSLayer3(0),
101   fPtITSouterminPtTPCvsPtAll_ITSLayer4(0),
102   fPtITSouterminPtTPCvsPtAll_ITSLayer5(0),
103   fPtITSouterminPtTPCvsPtAll_NoSPD(0),
104   fPtITSouterminPtTPCvsPtAll_NoSDD(0),
105   fPtITSouterminPtTPCvsPtAll_NoSSD(0),
106   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0(0),
107   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1(0),
108   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2(0),
109   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3(0),
110   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4(0),
111   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5(0),
112   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD(0),
113   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD(0),
114   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD(0),
115   fHistList(0),
116   fPtAllTPC(0),
117   fPtSelTPC(0),
118   fPtSelTPCITS(0),
119   fHistListTPC(0),
120   fPtSelITS(0),
121   fPtITSminPtTPCvsPtITS(0),
122   fPtITSminPtTPCvsPtITSNPointTPC(0),
123   fPtITSminPtTPCvsPtITSNPointTPCS(0),
124   fPtITSminPtTPCvsPtITSDCAR(0),
125   fPtITSminPtTPCvsPtITSDCAZ(0),
126   fPtITSminPtTPCvsPtITSPhi(0),
127   fPtITSminPtTPCvsPtITSNPointITS(0),
128   fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
129   fPtITSminPtTPCvsPtITSChi2C(0),
130   fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
131   fPtITSminPtTPCvsPtITSChi2PerNClusTPC(0),
132   fPtITSminPtTPCvsPtITSChi2PerNClusITS(0),
133   fPtRel1PtUncertaintyChi2PerClusTPC(0),
134   fPtNPointTPCSChi2PerClusTPC(0),
135   fPtNPointTPCSRel1PtUncertainty(0),
136   fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel(0),
137   fHistListITS(0),
138   fPtCosmicCandidates(0),
139   fDeltaPtCosmicCandidates(0),
140   fDeltaPhi(0),
141   fDeltaEta(0),
142   fHistListCosmics(0)
143 {
144
145 }
146 //________________________________________________________________________
147 AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(const char *name): 
148   AliAnalysisTask(name, ""), 
149   fESD(0),
150   fESDfriend(0), 
151   fMC(0),
152   fTrackCuts(),
153   fTrackCutsITS(),
154   fNEventAll(0),
155   fNEventSel(0),
156   fPtAll(0),
157   fPtSel(0),
158   fPtAllminPtTPCvsPtAll(0),
159   fPtAllminPtTPCvsPtAllNPointTPC(0),
160   fPtAllminPtTPCvsPtAllNPointTPCS(0),
161   fPtAllminPtTPCvsPtAllDCAR(0),
162   fPtAllminPtTPCvsPtAllDCAZ(0),
163   fPtAllminPtTPCvsPtAllPhi(0),
164   fPtAllminPtTPCvsPtAllNPointITS(0),
165   fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
166   fPtAllminPtTPCvsPtAllChi2C(0),
167   fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
168   fPtAllminPtTPCvsPtAllChi2PerNClusTPC(0),
169   fPtAllminPtTPCvsPtAllChi2PerNClusITS(0),
170   fEtaPhiOutliers(0),
171   fPtSelITSouter(0),
172   fPtITSouterminPtTPCvsPtAll(0),
173   fPtITSouterminPtTPCvsPtAllNPointTPC(0),
174   fPtITSouterminPtTPCvsPtAllNPointTPCS(0),
175   fPtITSouterminPtTPCvsPtAllDCAR(0),
176   fPtITSouterminPtTPCvsPtAllDCAZ(0),
177   fPtITSouterminPtTPCvsPtAllPhi(0),
178   fPtITSouterminPtTPCvsPtAllNPointITS(0),
179   fPtITSouterminPtTPCvsPtAllNSigmaToVertex(0),
180   fPtITSouterminPtTPCvsPtAllChi2C(0),
181   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty(0),
182   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC(0),
183   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS(0),
184   fPtITSouterminPtTPCvsPtAll_ITSLayer0(0),
185   fPtITSouterminPtTPCvsPtAll_ITSLayer1(0),
186   fPtITSouterminPtTPCvsPtAll_ITSLayer2(0),
187   fPtITSouterminPtTPCvsPtAll_ITSLayer3(0),
188   fPtITSouterminPtTPCvsPtAll_ITSLayer4(0),
189   fPtITSouterminPtTPCvsPtAll_ITSLayer5(0),
190   fPtITSouterminPtTPCvsPtAll_NoSPD(0),
191   fPtITSouterminPtTPCvsPtAll_NoSDD(0),
192   fPtITSouterminPtTPCvsPtAll_NoSSD(0),
193   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0(0),
194   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1(0),
195   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2(0),
196   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3(0),
197   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4(0),
198   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5(0),
199   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD(0),
200   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD(0),
201   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD(0),
202   fHistList(0),
203   fPtAllTPC(0),
204   fPtSelTPC(0),
205   fPtSelTPCITS(0),
206   fHistListTPC(0),
207   fPtSelITS(0),
208   fPtITSminPtTPCvsPtITS(0),
209   fPtITSminPtTPCvsPtITSNPointTPC(0),
210   fPtITSminPtTPCvsPtITSNPointTPCS(0),
211   fPtITSminPtTPCvsPtITSDCAR(0),
212   fPtITSminPtTPCvsPtITSDCAZ(0),
213   fPtITSminPtTPCvsPtITSPhi(0),
214   fPtITSminPtTPCvsPtITSNPointITS(0),
215   fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
216   fPtITSminPtTPCvsPtITSChi2C(0),
217   fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
218   fPtITSminPtTPCvsPtITSChi2PerNClusTPC(0),
219   fPtITSminPtTPCvsPtITSChi2PerNClusITS(0),
220   fPtRel1PtUncertaintyChi2PerClusTPC(0),
221   fPtNPointTPCSChi2PerClusTPC(0),
222   fPtNPointTPCSRel1PtUncertainty(0),
223   fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel(0),
224   fHistListITS(0),
225   fPtCosmicCandidates(0),
226   fDeltaPtCosmicCandidates(0),
227   fDeltaPhi(0),
228   fDeltaEta(0),
229   fHistListCosmics(0)
230 {
231   //
232   // Constructor. Initialization of Inputs and Outputs
233   //
234   Info("AliPWG4HighPtQATPConly","Calling Constructor");
235   // Input slot #0 works with a TChain ESD
236   DefineInput(0, TChain::Class());
237   // Output slot #0 writes into a TList
238   DefineOutput(0, TList::Class());
239   // Output slot #1 writes into a TList
240   DefineOutput(1, TList::Class());
241   // Output slot #2 writes into a TList
242   DefineOutput(2, TList::Class());
243   // Output slot #3 writes into a TList
244   DefineOutput(3, TList::Class());
245 }
246
247 //________________________________________________________________________
248 void AliPWG4HighPtQATPConly::ConnectInputData(Option_t *) 
249 {
250   // Connect ESD here
251   // Called once
252   AliDebug(2,Form(">> AliPWG4HighPtSpectra::ConnectInputData \n"));
253   TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
254   if (!tree) {
255     AliDebug(2,Form( "ERROR: Could not read chain from input slot 0 \n"));
256     return;
257   } 
258   
259   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
260   
261   if (!esdH) {
262     AliDebug(2,Form("ERROR: Could not get ESDInputHandler")); 
263     return;
264   } else
265     fESD = esdH->GetEvent();
266   
267  AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
268  // AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*>
269  //                        (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
270   if (!eventHandler) {
271     AliDebug(2,Form( "ERROR: Could not retrieve MC event handler \n"));
272   }
273   else
274     fMC = eventHandler->MCEvent();
275
276   //attach the ESD friend
277    //  tree->SetBranchStatus("*", kTRUE);
278 //   tree->SetBranchStatus("Tracks*", kTRUE);
279 //   tree->SetBranchStatus("ESDfriend*", kTRUE);
280   //  fESD->ReadFromTree(tree);
281
282   fESDfriend = (AliESDfriend*)fESD->FindListObject("AliESDfriend");
283   if (!fESDfriend)
284     {
285       // works for both, we just want to avoid setting the branch adress twice
286       // in case of the new ESD
287       tree->SetBranchAddress("ESDfriend.",&fESDfriend);
288     }
289   
290 }
291
292 //________________________________________________________________________
293 void AliPWG4HighPtQATPConly::CreateOutputObjects() {
294   //Create output objects
295   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::CreateOutputObjects \n")); 
296
297   Bool_t oldStatus = TH1::AddDirectoryStatus();
298   TH1::AddDirectory(kFALSE); 
299
300   OpenFile(0);
301   fHistList = new TList();
302   OpenFile(1);
303   fHistListTPC = new TList();
304   OpenFile(2);
305   fHistListITS = new TList();
306   OpenFile(3);
307   fHistListCosmics = new TList();
308
309
310   Int_t fgkNPhiBins=18;
311   Float_t kMinPhi = 0.;
312   Float_t kMaxPhi = 2.*TMath::Pi();
313   
314   Float_t fgkPtMin=0.;
315   Float_t fgkPtMax=100.;
316   Int_t fgkNPtBins=(int)(fgkPtMax-fgkPtMin);
317
318   Float_t fgkChi2PerClusMin = 0.;
319   Float_t fgkChi2PerClusMax = 3.5;
320   Int_t fgkChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
321   
322
323   Int_t fgkResPtBins=80;
324
325   fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
326   fHistList->Add(fNEventAll);
327   fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
328   fHistList->Add(fNEventSel);
329   fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
330   fHistList->Add(fPtAll);
331   fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
332   fHistList->Add(fPtSel);
333  
334   fPtAllminPtTPCvsPtAll = new TH2F("fPtAllminPtTPCvsPtAll","PtAllminPtTPCvsPtAll",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
335   fPtAllminPtTPCvsPtAll->SetXTitle("p_{t}^{Global}");
336   fPtAllminPtTPCvsPtAll->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
337   fHistList->Add(fPtAllminPtTPCvsPtAll);
338   
339   fPtAllminPtTPCvsPtAllNPointTPC = new TH3F("fPtAllminPtTPCvsPtAllNPointTPC","PtAllminPtTPCvsPtAllNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
340   fPtAllminPtTPCvsPtAllNPointTPC->SetXTitle("p_{t}^{Global}");
341   fPtAllminPtTPCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
342   fPtAllminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
343   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPC);
344
345   fPtAllminPtTPCvsPtAllNPointTPCS = new TH3F("fPtAllminPtTPCvsPtAllNPointTPCS","PtAllminPtTPCvsPtAllNPointTPCS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,100,0.,1.);
346   fPtAllminPtTPCvsPtAllNPointTPCS->SetXTitle("p_{t}^{Global}");
347   fPtAllminPtTPCvsPtAllNPointTPCS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
348   fPtAllminPtTPCvsPtAllNPointTPCS->SetZTitle("N_{point,TPC}^{Shared}/N_{point,TPC}");
349   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPCS);
350
351   fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
352   fPtAllminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{Global}");
353   fPtAllminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
354   fPtAllminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
355   fHistList->Add(fPtAllminPtTPCvsPtAllDCAR);
356
357   fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
358   fPtAllminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{Global}");
359   fPtAllminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
360   fPtAllminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
361   fHistList->Add(fPtAllminPtTPCvsPtAllDCAZ);
362
363   fPtAllminPtTPCvsPtAllPhi = new TH3F("fPtAllminPtTPCvsPtAllPhi","PtAllminPtTPCvsPtAllPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
364   fPtAllminPtTPCvsPtAllPhi->SetXTitle("p_{t}^{Global}");
365   fPtAllminPtTPCvsPtAllPhi->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
366   fPtAllminPtTPCvsPtAllPhi->SetZTitle("#phi");
367   fHistList->Add(fPtAllminPtTPCvsPtAllPhi);
368
369   fPtAllminPtTPCvsPtAllNPointITS = new TH3F("fPtAllminPtTPCvsPtAllNPointITS","PtAllminPtTPCvsPtAllNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
370   fPtAllminPtTPCvsPtAllNPointITS->SetXTitle("p_{t}^{Global}");
371   fPtAllminPtTPCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
372   fPtAllminPtTPCvsPtAllNPointITS->SetZTitle("N_{point,ITS}");
373   fHistList->Add(fPtAllminPtTPCvsPtAllNPointITS);
374   
375   fPtAllminPtTPCvsPtAllNSigmaToVertex = new TH3F("fPtAllminPtTPCvsPtAllNSigmaToVertex","PtAllminPtTPCvsPtAllNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
376   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{Global}");
377   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
378   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
379   fHistList->Add(fPtAllminPtTPCvsPtAllNSigmaToVertex);
380
381   fPtAllminPtTPCvsPtAllChi2C = new TH3F("fPtAllminPtTPCvsPtAllChi2C","PtAllminPtTPCvsPtAllChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
382   fPtAllminPtTPCvsPtAllChi2C->SetXTitle("p_{t}^{Global}");
383   fPtAllminPtTPCvsPtAllChi2C->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
384   fPtAllminPtTPCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
385   fHistList->Add(fPtAllminPtTPCvsPtAllChi2C);
386
387   fPtAllminPtTPCvsPtAllRel1PtUncertainty = new TH3F("fPtAllminPtTPCvsPtAllRel1PtUncertainty","PtAllminPtTPCvsPtAllRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
388   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{Global}");
389   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
390   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
391   fHistList->Add(fPtAllminPtTPCvsPtAllRel1PtUncertainty);
392
393   fPtAllminPtTPCvsPtAllChi2PerNClusTPC = new TH3F("fPtAllminPtTPCvsPtAllChi2PerNClusTPC","PtAllminPtTPCvsPtAllChi2PerNClusTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
394   fPtAllminPtTPCvsPtAllChi2PerNClusTPC->SetXTitle("p_{t}^{Global}");
395   fPtAllminPtTPCvsPtAllChi2PerNClusTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
396   fPtAllminPtTPCvsPtAllChi2PerNClusTPC->SetZTitle("#chi^{2}/(2*NClusTPC-5)");
397   fHistList->Add(fPtAllminPtTPCvsPtAllChi2PerNClusTPC);
398
399   fPtAllminPtTPCvsPtAllChi2PerNClusITS = new TH3F("fPtAllminPtTPCvsPtAllChi2PerNClusITS","PtAllminPtTPCvsPtAllChi2PerNClusITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
400   fPtAllminPtTPCvsPtAllChi2PerNClusITS->SetXTitle("p_{t}^{Global}");
401   fPtAllminPtTPCvsPtAllChi2PerNClusITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
402   fPtAllminPtTPCvsPtAllChi2PerNClusITS->SetZTitle("#chi^{2}/(2*NClusITS-5)");
403   fHistList->Add(fPtAllminPtTPCvsPtAllChi2PerNClusITS);
404
405   fEtaPhiOutliers = new TH2F("fEtaPhiOutliers","PtAllminPtTPCvsPtAll",20, -1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
406   fEtaPhiOutliers->SetXTitle("#eta");
407   fEtaPhiOutliers->SetYTitle("#phi");
408   fHistList->Add(fEtaPhiOutliers);
409
410   //Global vs ITSouter-TPCinner
411   fPtSelITSouter = new TH1F("fPtSelITSouter","PtSelITSouter",fgkNPtBins,fgkPtMin,fgkPtMax);
412   fHistList->Add(fPtSelITSouter);
413   
414   fPtITSouterminPtTPCvsPtAll = new TH2F("fPtITSouterminPtTPCvsPtAll","PtAllminPtTPCvsPtAll",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
415   fPtITSouterminPtTPCvsPtAll->SetXTitle("p_{t}^{Global}");
416   fPtITSouterminPtTPCvsPtAll->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
417   fHistList->Add(fPtITSouterminPtTPCvsPtAll);
418   
419   fPtITSouterminPtTPCvsPtAllNPointTPC = new TH3F("fPtITSouterminPtTPCvsPtAllNPointTPC","PtAllminPtTPCvsPtAllNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
420   fPtITSouterminPtTPCvsPtAllNPointTPC->SetXTitle("p_{t}^{Global}");
421   fPtITSouterminPtTPCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
422   fPtITSouterminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
423   fHistList->Add(fPtITSouterminPtTPCvsPtAllNPointTPC);
424
425   fPtITSouterminPtTPCvsPtAllNPointTPCS = new TH3F("fPtITSouterminPtTPCvsPtAllNPointTPCS","PtAllminPtTPCvsPtAllNPointTPCS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,100,0.,1.);
426   fPtITSouterminPtTPCvsPtAllNPointTPCS->SetXTitle("p_{t}^{Global}");
427   fPtITSouterminPtTPCvsPtAllNPointTPCS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
428   fPtITSouterminPtTPCvsPtAllNPointTPCS->SetZTitle("N_{point,TPC}^{Shared}/N_{point,TPC}");
429   fHistList->Add(fPtITSouterminPtTPCvsPtAllNPointTPCS);
430
431   fPtITSouterminPtTPCvsPtAllDCAR = new TH3F("fPtITSouterminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
432   fPtITSouterminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{Global}");
433   fPtITSouterminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
434   fPtITSouterminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
435   fHistList->Add(fPtITSouterminPtTPCvsPtAllDCAR);
436
437   fPtITSouterminPtTPCvsPtAllDCAZ = new TH3F("fPtITSouterminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
438   fPtITSouterminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{Global}");
439   fPtITSouterminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
440   fPtITSouterminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
441   fHistList->Add(fPtITSouterminPtTPCvsPtAllDCAZ);
442
443   fPtITSouterminPtTPCvsPtAllPhi = new TH3F("fPtITSouterminPtTPCvsPtAllPhi","PtAllminPtTPCvsPtAllPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
444   fPtITSouterminPtTPCvsPtAllPhi->SetXTitle("p_{t}^{Global}");
445   fPtITSouterminPtTPCvsPtAllPhi->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
446   fPtITSouterminPtTPCvsPtAllPhi->SetZTitle("#phi");
447   fHistList->Add(fPtITSouterminPtTPCvsPtAllPhi);
448
449   fPtITSouterminPtTPCvsPtAllNPointITS = new TH3F("fPtITSouterminPtTPCvsPtAllNPointITS","PtAllminPtTPCvsPtAllNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
450   fPtITSouterminPtTPCvsPtAllNPointITS->SetXTitle("p_{t}^{Global}");
451   fPtITSouterminPtTPCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
452   fPtITSouterminPtTPCvsPtAllNPointITS->SetZTitle("N_{point,ITS}");
453   fHistList->Add(fPtITSouterminPtTPCvsPtAllNPointITS);
454   
455   fPtITSouterminPtTPCvsPtAllNSigmaToVertex = new TH3F("fPtITSouterminPtTPCvsPtAllNSigmaToVertex","PtAllminPtTPCvsPtAllNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
456   fPtITSouterminPtTPCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{Global}");
457   fPtITSouterminPtTPCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
458   fPtITSouterminPtTPCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
459   fHistList->Add(fPtITSouterminPtTPCvsPtAllNSigmaToVertex);
460
461   fPtITSouterminPtTPCvsPtAllChi2C = new TH3F("fPtITSouterminPtTPCvsPtAllChi2C","PtAllminPtTPCvsPtAllChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
462   fPtITSouterminPtTPCvsPtAllChi2C->SetXTitle("p_{t}^{Global}");
463   fPtITSouterminPtTPCvsPtAllChi2C->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
464   fPtITSouterminPtTPCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
465   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2C);
466
467   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty = new TH3F("fPtITSouterminPtTPCvsPtAllRel1PtUncertainty","PtAllminPtTPCvsPtAllRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
468   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{Global}");
469   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
470   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
471   fHistList->Add(fPtITSouterminPtTPCvsPtAllRel1PtUncertainty);
472
473   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC","PtAllminPtTPCvsPtAllChi2PerNClusTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,35,0.,3.5);
474   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->SetXTitle("p_{t}^{Global}");
475   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
476   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->SetZTitle("#chi^{2}/(2*NClusTPC-5)");
477   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC);
478
479   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS","PtAllminPtTPCvsPtAllChi2PerNClusITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,35,0.,3.5);
480   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->SetXTitle("p_{t}^{Global}");
481   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
482   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->SetZTitle("#chi^{2}/(2*NClusITS-5)");
483   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS);
484
485   //As function of ITS layers
486   fPtITSouterminPtTPCvsPtAll_ITSLayer0 = new TH2F("fPtITSouterminPtTPCvsPtAll_ITSLayer0","PtAllminPtTPCvsPtAll_ITSLayer0",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
487   fPtITSouterminPtTPCvsPtAll_ITSLayer0->SetXTitle("p_{t}^{Global}");
488   fPtITSouterminPtTPCvsPtAll_ITSLayer0->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
489   fHistList->Add(fPtITSouterminPtTPCvsPtAll_ITSLayer0);
490
491   fPtITSouterminPtTPCvsPtAll_ITSLayer1 = new TH2F("fPtITSouterminPtTPCvsPtAll_ITSLayer1","PtAllminPtTPCvsPtAll_ITSLayer1",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
492   fPtITSouterminPtTPCvsPtAll_ITSLayer1->SetXTitle("p_{t}^{Global}");
493   fPtITSouterminPtTPCvsPtAll_ITSLayer1->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
494   fHistList->Add(fPtITSouterminPtTPCvsPtAll_ITSLayer1);
495
496   fPtITSouterminPtTPCvsPtAll_ITSLayer2 = new TH2F("fPtITSouterminPtTPCvsPtAll_ITSLayer2","PtAllminPtTPCvsPtAll_ITSLayer2",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
497   fPtITSouterminPtTPCvsPtAll_ITSLayer2->SetXTitle("p_{t}^{Global}");
498   fPtITSouterminPtTPCvsPtAll_ITSLayer2->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
499   fHistList->Add(fPtITSouterminPtTPCvsPtAll_ITSLayer2);
500
501   fPtITSouterminPtTPCvsPtAll_ITSLayer3 = new TH2F("fPtITSouterminPtTPCvsPtAll_ITSLayer3","PtAllminPtTPCvsPtAll_ITSLayer3",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
502   fPtITSouterminPtTPCvsPtAll_ITSLayer3->SetXTitle("p_{t}^{Global}");
503   fPtITSouterminPtTPCvsPtAll_ITSLayer3->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
504   fHistList->Add(fPtITSouterminPtTPCvsPtAll_ITSLayer3);
505
506   fPtITSouterminPtTPCvsPtAll_ITSLayer4 = new TH2F("fPtITSouterminPtTPCvsPtAll_ITSLayer4","PtAllminPtTPCvsPtAll_ITSLayer4",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
507   fPtITSouterminPtTPCvsPtAll_ITSLayer4->SetXTitle("p_{t}^{Global}");
508   fPtITSouterminPtTPCvsPtAll_ITSLayer4->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
509   fHistList->Add(fPtITSouterminPtTPCvsPtAll_ITSLayer4);
510
511   fPtITSouterminPtTPCvsPtAll_ITSLayer5 = new TH2F("fPtITSouterminPtTPCvsPtAll_ITSLayer5","PtAllminPtTPCvsPtAll_ITSLayer5",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
512   fPtITSouterminPtTPCvsPtAll_ITSLayer5->SetXTitle("p_{t}^{Global}");
513   fPtITSouterminPtTPCvsPtAll_ITSLayer5->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
514   fHistList->Add(fPtITSouterminPtTPCvsPtAll_ITSLayer5);
515
516   fPtITSouterminPtTPCvsPtAll_NoSPD = new TH2F("fPtITSouterminPtTPCvsPtAll_NoSPD","PtAllminPtTPCvsPtAll_NoSPD",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
517   fPtITSouterminPtTPCvsPtAll_NoSPD->SetXTitle("p_{t}^{Global}");
518   fPtITSouterminPtTPCvsPtAll_NoSPD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
519   fHistList->Add(fPtITSouterminPtTPCvsPtAll_NoSPD);
520
521   fPtITSouterminPtTPCvsPtAll_NoSDD = new TH2F("fPtITSouterminPtTPCvsPtAll_NoSDD","PtAllminPtTPCvsPtAll_NoSDD",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
522   fPtITSouterminPtTPCvsPtAll_NoSDD->SetXTitle("p_{t}^{Global}");
523   fPtITSouterminPtTPCvsPtAll_NoSDD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
524   fHistList->Add(fPtITSouterminPtTPCvsPtAll_NoSDD);
525
526   fPtITSouterminPtTPCvsPtAll_NoSSD = new TH2F("fPtITSouterminPtTPCvsPtAll_NoSSD","PtAllminPtTPCvsPtAll_NoSSD",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
527   fPtITSouterminPtTPCvsPtAll_NoSSD->SetXTitle("p_{t}^{Global}");
528   fPtITSouterminPtTPCvsPtAll_NoSSD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
529   fHistList->Add(fPtITSouterminPtTPCvsPtAll_NoSSD);
530
531   //
532   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0","PtAllminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
533   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0->SetXTitle("p_{t}^{Global}");
534   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
535   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0->SetZTitle("#chi^{2}/NPointITS");
536   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0);
537
538   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1","PtAllminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
539   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1->SetXTitle("p_{t}^{Global}");
540   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
541   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1->SetZTitle("#chi^{2}/NPointITS");
542   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1);
543
544   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2","PtAllminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
545   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2->SetXTitle("p_{t}^{Global}");
546   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
547   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2->SetZTitle("#chi^{2}/NPointITS");
548   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2);
549
550   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3","PtAllminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
551   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3->SetXTitle("p_{t}^{Global}");
552   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
553   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3->SetZTitle("#chi^{2}/NPointITS");
554   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3);
555
556   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4","PtAllminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
557   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4->SetXTitle("p_{t}^{Global}");
558   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
559   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4->SetZTitle("#chi^{2}/NPointITS");
560   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4);
561
562   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5","PtAllminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
563   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5->SetXTitle("p_{t}^{Global}");
564   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
565   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5->SetZTitle("#chi^{2}/NPointITS");
566   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5);
567
568   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD","PtAllminPtTPCvsPtAllChi2PerNClusITS_NoSPD",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
569   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD->SetXTitle("p_{t}^{Global}");
570   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
571   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD->SetZTitle("#chi^{2}/(2*NPointITS-5)");
572   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD);
573
574   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD","PtAllminPtTPCvsPtAllChi2PerNClusITS_NoSDD",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
575   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD->SetXTitle("p_{t}^{Global}");
576   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
577   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD->SetZTitle("#chi^{2}/(2*NPointITS-5)");
578   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD);
579
580   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD","PtAllminPtTPCvsPtAllChi2PerNClusITS_NoSSD",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkChi2PerClusBins,fgkChi2PerClusMin,fgkChi2PerClusMax);
581   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD->SetXTitle("p_{t}^{Global}");
582   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
583   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD->SetZTitle("#chi^{2}/(2*NPointITS-5)");
584   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD);
585
586
587   //ITSrefit
588   fPtSelITS = new TH1F("fPtSelITSrefit","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
589   fHistListITS->Add(fPtSelITS);
590   
591   fPtITSminPtTPCvsPtITS = new TH2F("fPtITSminPtTPCvsPtITS","PtITSminPtTPCvsPtITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
592   fPtITSminPtTPCvsPtITS->SetXTitle("p_{t}^{Global}");
593   fPtITSminPtTPCvsPtITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
594   fHistListITS->Add(fPtITSminPtTPCvsPtITS);
595   
596   fPtITSminPtTPCvsPtITSNPointTPC = new TH3F("fPtITSminPtTPCvsPtITSNPointTPC","PtITSminPtTPCvsPtITSNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
597   fPtITSminPtTPCvsPtITSNPointTPC->SetXTitle("p_{t}^{Global}");
598   fPtITSminPtTPCvsPtITSNPointTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
599   fPtITSminPtTPCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
600   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPC);
601
602   fPtITSminPtTPCvsPtITSNPointTPCS = new TH3F("fPtITSminPtTPCvsPtITSNPointTPCS","PtITSminPtTPCvsPtITSNPointTPCS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,100,0.,1.);
603   fPtITSminPtTPCvsPtITSNPointTPCS->SetXTitle("p_{t}^{Global}");
604   fPtITSminPtTPCvsPtITSNPointTPCS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
605   fPtITSminPtTPCvsPtITSNPointTPCS->SetZTitle("N_{point,TPC}^{Shared}/N_{point,TPC}");
606   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPCS);    
607
608   fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-0.2,0.2);
609   fPtITSminPtTPCvsPtITSDCAR->SetXTitle("p_{t}^{Global}");
610   fPtITSminPtTPCvsPtITSDCAR->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
611   fPtITSminPtTPCvsPtITSDCAR->SetZTitle("DCA_{R}");
612   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAR);
613   
614   fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,80,-2.,2.);
615   fPtITSminPtTPCvsPtITSDCAZ->SetXTitle("p_{t}^{Global}");
616   fPtITSminPtTPCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
617   fPtITSminPtTPCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
618   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAZ);
619   
620   fPtITSminPtTPCvsPtITSPhi = new TH3F("fPtITSminPtTPCvsPtITSPhi","PtITSminPtTPCvsPtITSPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
621   fPtITSminPtTPCvsPtITSPhi->SetXTitle("p_{t}^{Global}");
622   fPtITSminPtTPCvsPtITSPhi->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
623   fPtITSminPtTPCvsPtITSPhi->SetZTitle("#phi");
624   fHistListITS->Add(fPtITSminPtTPCvsPtITSPhi);
625   
626   fPtITSminPtTPCvsPtITSNPointITS = new TH3F("fPtITSminPtTPCvsPtITSNPointITS","PtITSminPtTPCvsPtITSNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
627   fPtITSminPtTPCvsPtITSNPointITS->SetXTitle("p_{t}^{Global}");
628   fPtITSminPtTPCvsPtITSNPointITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
629   fPtITSminPtTPCvsPtITSNPointITS->SetZTitle("N_{point,ITS}");
630   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointITS); 
631   
632   fPtITSminPtTPCvsPtITSNSigmaToVertex = new TH3F("fPtITSminPtTPCvsPtITSNSigmaToVertex","PtITSminPtTPCvsPtITSNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
633   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetXTitle("p_{t}^{Global}");
634   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
635   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetZTitle("N#sigma to vertex");
636   fHistListITS->Add(fPtITSminPtTPCvsPtITSNSigmaToVertex);
637
638   fPtITSminPtTPCvsPtITSChi2C = new TH3F("fPtITSminPtTPCvsPtITSChi2C","PtITSminPtTPCvsPtITSChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
639   fPtITSminPtTPCvsPtITSChi2C->SetXTitle("p_{t}^{Global}");
640   fPtITSminPtTPCvsPtITSChi2C->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
641   fPtITSminPtTPCvsPtITSChi2C->SetZTitle("Constrained #chi^{2}");
642   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2C);
643
644   fPtITSminPtTPCvsPtITSRel1PtUncertainty = new TH3F("fPtITSminPtTPCvsPtITSRel1PtUncertainty","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
645   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetXTitle("p_{t}^{Global}");
646   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
647   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
648   fHistListITS->Add(fPtITSminPtTPCvsPtITSRel1PtUncertainty);
649
650   fPtITSminPtTPCvsPtITSChi2PerNClusTPC = new TH3F("fPtITSminPtTPCvsPtITSChi2PerNClusTPC","PtITSminPtTPCvsPtITSChi2PerNClusTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,35,0.,3.5);
651   fPtITSminPtTPCvsPtITSChi2PerNClusTPC->SetXTitle("p_{t}^{Global}");
652   fPtITSminPtTPCvsPtITSChi2PerNClusTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
653   fPtITSminPtTPCvsPtITSChi2PerNClusTPC->SetZTitle("#chi^{2}/(2*NClusTPC-5)");
654   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2PerNClusTPC);
655
656   fPtITSminPtTPCvsPtITSChi2PerNClusITS = new TH3F("fPtITSminPtTPCvsPtITSChi2PerNClusITS","PtITSminPtTPCvsPtITSChi2PerNClusITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,35,0.,3.5);
657   fPtITSminPtTPCvsPtITSChi2PerNClusITS->SetXTitle("p_{t}^{Global}");
658   fPtITSminPtTPCvsPtITSChi2PerNClusITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
659   fPtITSminPtTPCvsPtITSChi2PerNClusITS->SetZTitle("#chi^{2}/(2*NClusITS-5)");
660   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2PerNClusITS);
661
662   fPtRel1PtUncertaintyChi2PerClusTPC = new TH3F("fPtRel1PtUncertaintyChi2PerClusTPC","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,30,0.,0.3,35,0.,3.5);
663   fPtRel1PtUncertaintyChi2PerClusTPC->SetXTitle("p_{t}^{global}");
664   fPtRel1PtUncertaintyChi2PerClusTPC->SetYTitle("Rel1PtUncertainty");
665   fPtRel1PtUncertaintyChi2PerClusTPC->SetZTitle("#chi^{2}/(2*N_{clusters}^{TPC}-5)");
666   fHistListITS->Add(fPtRel1PtUncertaintyChi2PerClusTPC);
667
668   fPtNPointTPCSChi2PerClusTPC = new TH3F("fPtNPointTPCSChi2PerClusTPC","PtITSminPtTPCvsPtITSNPointTPCS",fgkNPtBins, fgkPtMin,fgkPtMax,100,0.,1.,35,0.,3.5);
669   fPtNPointTPCSChi2PerClusTPC->SetXTitle("p_{t}^{global}");
670   fPtNPointTPCSChi2PerClusTPC->SetYTitle("N_{Point,TPC}^{Shared}/N_{Point,TPC}");
671   fPtNPointTPCSChi2PerClusTPC->SetZTitle("#chi^{2}/(2*N_{clusters}^{TPC}-5)");
672   fHistListITS->Add(fPtNPointTPCSChi2PerClusTPC);
673
674   fPtNPointTPCSRel1PtUncertainty = new TH3F("fPtNPointTPCSRel1PtUncertainty","PtITSminPtTPCvsPtITSNPointTPCS",fgkNPtBins, fgkPtMin,fgkPtMax,100,0.,1.,30,0.,0.3);
675   fPtNPointTPCSRel1PtUncertainty->SetXTitle("p_{t}^{global}");
676   fPtNPointTPCSRel1PtUncertainty->SetYTitle("N_{Point,TPC}^{Shared}/N_{Point,TPC}");
677   fPtNPointTPCSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
678   fHistListITS->Add(fPtNPointTPCSRel1PtUncertainty);
679
680   fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel = new TH3F("fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,30,0.,0.3,35,0.,3.5);
681   fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel->SetXTitle("p_{t}^{global}");
682   fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel->SetYTitle("Rel1PtUncertainty");
683   fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel->SetZTitle("#chi^{2}/(2*N_{clusters}^{TPC}-5)");
684   fHistListITS->Add(fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel);
685
686   fPtAllTPC = new TH1F("fPtAllTPC","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
687   fHistListTPC->Add(fPtAllTPC);
688   fPtSelTPC = new TH1F("fPtSelTPC","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
689   fHistListTPC->Add(fPtSelTPC);
690   fPtSelTPCITS = new TH1F("fPtSelTPCITS","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
691   fHistListTPC->Add(fPtSelTPCITS);
692
693   //****************************************************************************************************************//
694   //                                              Cosmic Candidates                                                 //
695   //****************************************************************************************************************//
696   fPtCosmicCandidates = new TH1F("fPtCosmicCandidates","fPtCosmicCandidates",fgkNPtBins, fgkPtMin, fgkPtMax);
697   fHistListCosmics->Add(fPtCosmicCandidates);  
698   fDeltaPtCosmicCandidates = new TH1F("fDeltaPtCosmicCandidates","fDeltaPtCosmicCandidates",fgkNPtBins, -50., 50.);
699   fHistListCosmics->Add(fDeltaPtCosmicCandidates);  
700   fDeltaPhi = new TH1F("fDeltaPhi","fDeltaPhi",fgkNPhiBins*2,-1*kMaxPhi,kMaxPhi);
701   fHistListCosmics->Add(fDeltaPhi);  
702   fDeltaEta = new TH1F("fDeltaEta","fDeltaEta",20, -2.,2.);
703   fHistListCosmics->Add(fDeltaEta);  
704
705   TH1::AddDirectory(oldStatus);   
706
707 }
708 //________________________________________________________________________
709 void AliPWG4HighPtQATPConly::Exec(Option_t *) {  
710   // Main loop
711   // Called for each event
712   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::Exec \n"));  
713
714   // All events without selection
715   fNEventAll->Fill(0.);
716
717   if (!fESD) {
718     AliDebug(2,Form("ERROR: fESD not available"));
719     // Post output data
720      PostData(0, fHistList);
721      PostData(1, fHistListTPC);
722      PostData(2, fHistListITS);
723      PostData(3, fHistListCosmics);
724     return;
725   }
726
727   fESD->SetESDfriend(fESDfriend); //Attach the friend to the ESD
728   if (!fESDfriend) {
729     AliDebug(2,Form("ERROR: fESDfriend not available"));
730     // Post output data
731      PostData(0, fHistList);
732      PostData(1, fHistListTPC);
733      PostData(2, fHistListITS);
734      PostData(3, fHistListCosmics);
735     return;
736   }
737
738   Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
739   if(!isSelected) { //Select collison candidates
740     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
741     // Post output data
742      PostData(0, fHistList);
743      PostData(1, fHistListTPC);
744      PostData(2, fHistListITS);
745      PostData(3, fHistListCosmics);
746     return;
747   }
748
749   //  AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
750 //   //  AliMCEventHandler* eventHandler = (AliMCEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
751   
752   AliStack* stack = 0x0;
753   AliMCEvent* mcEvent = 0x0;
754   
755   if(fMC) {
756     mcEvent = fMC;
757     if (!mcEvent) {
758       AliDebug(2,Form("ERROR: Could not retrieve MC event"));
759       PostData(0, fHistList);
760       PostData(1, fHistListTPC);
761       PostData(2, fHistListITS);
762       PostData(3, fHistListCosmics);
763       return;
764     }
765     
766     AliDebug(2,Form("MC particles: %d", mcEvent->GetNumberOfTracks()));
767     
768     stack = mcEvent->Stack();                //Particles Stack
769     
770     AliDebug(2,Form("MC particles stack: %d", stack->GetNtrack()));
771   }
772   
773
774   const AliESDVertex *vtx = fESD->GetPrimaryVertexTracks();
775   // Need vertex cut
776   if (vtx->GetNContributors() < 2) {
777     // Post output data
778     PostData(0, fHistList);
779     PostData(1, fHistListTPC);
780     PostData(2, fHistListITS);
781     PostData(3, fHistListCosmics);
782     return;
783   }
784
785   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
786   double primVtx[3];
787   vtx->GetXYZ(primVtx);
788   //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
789   if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
790     // Post output data
791     PostData(0, fHistList);
792     PostData(1, fHistListTPC);
793     PostData(2, fHistListITS);
794     PostData(3, fHistListCosmics);
795     return;
796   }
797   if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2){ 
798     // Post output data
799     PostData(0, fHistList);
800     PostData(1, fHistListTPC);
801     PostData(2, fHistListITS);
802     PostData(3, fHistListCosmics);
803     return;
804   }
805   Int_t nTracks = fESD->GetNumberOfTracks();
806   AliDebug(2,Form("nTracks %d\n", nTracks));
807
808   if(!fTrackCuts) return;
809
810   // Selected events for analysis
811   fNEventSel->Fill(0.);
812
813   for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
814     
815     AliESDtrack *track = fESD->GetTrack(iTrack);
816     AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
817     if(!track || !trackTPC) continue;
818     const AliESDfriendTrack* constfriendtrack = track->GetFriendTrack();
819     if (!constfriendtrack) { continue;}
820     AliESDfriendTrack friendtrack(*constfriendtrack);
821  
822     Float_t pt = track->Pt();
823     Float_t ptTPC = trackTPC->Pt();
824     Float_t phi = track->Phi();
825     Float_t dca2D, dcaZ;
826     track->GetImpactParameters(dca2D,dcaZ);
827     // Float_t dca2DTPC, dcaZTPC;
828     //track->GetImpactParametersTPC(dca2DTPC,dcaZTPC);
829     UChar_t itsMap = track->GetITSClusterMap();
830     Int_t nPointITS = 0;
831     for (Int_t i=0; i < 6; i++) {
832       if (itsMap & (1 << i))
833         nPointITS ++;
834     }
835     double mom[3];
836     track->GetPxPyPz(mom);
837     double momTPC[3];
838     trackTPC->GetPxPyPz(momTPC);
839     Float_t nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track.
840     Float_t chi2C = track->GetConstrainedChi2();
841     Float_t relUncertainty1Pt = TMath::Sqrt(TMath::Abs(track->GetSigma1Pt2()))*pt;
842     Float_t chi2PerClusterTPC = -1.;
843     Float_t nClustersTPC = track->GetTPCNcls();
844     if(nClustersTPC>0.) chi2PerClusterTPC = track->GetTPCchi2()/(2.*nClustersTPC-5.);
845     Float_t chi2PerNPointITS = -1.;
846     if(nPointITS>3) chi2PerNPointITS = track->GetITSchi2()/(2.*(float)nPointITS-5.);
847
848     fPtAll->Fill(pt);
849     fPtAllTPC->Fill(ptTPC);
850
851
852     if (fTrackCuts->AcceptTrack(track)) {
853
854       Bool_t cosmic = kFALSE;    
855       if(pt>6.) { cosmic = IsCosmic(track,iTrack,6.); }
856       //    if(cosmic) continue;
857
858       fPtSel->Fill(pt);
859       fPtSelTPC->Fill(ptTPC);
860       if(ptTPC==0. || pt==0.) continue;
861       fPtAllminPtTPCvsPtAll->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
862       fPtAllminPtTPCvsPtAllNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nClustersTPC);
863       if(nClustersTPC>0.) fPtAllminPtTPCvsPtAllNPointTPCS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCnclsS()/nClustersTPC);
864       fPtAllminPtTPCvsPtAllDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
865       fPtAllminPtTPCvsPtAllDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
866       fPtAllminPtTPCvsPtAllPhi->Fill(pt,(1./pt-1./ptTPC)/(1./pt),phi);
867       fPtAllminPtTPCvsPtAllNPointITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nPointITS);
868       fPtAllminPtTPCvsPtAllNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
869       fPtAllminPtTPCvsPtAllChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
870       fPtAllminPtTPCvsPtAllRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
871       fPtAllminPtTPCvsPtAllChi2PerNClusTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerClusterTPC);
872       if(nPointITS>3) fPtAllminPtTPCvsPtAllChi2PerNClusITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerNPointITS);
873       if(TMath::Abs((1./pt-1./ptTPC)/(1./pt))>0.8) fEtaPhiOutliers->Fill(track->Eta(),phi);
874       if (friendtrack.GetITSOut()) {
875         AliExternalTrackParam trackITSouter(*(friendtrack.GetITSOut())); 
876         Float_t ptITSouter = trackITSouter.Pt();
877         if(ptITSouter==0.) continue;
878         fPtSelITSouter->Fill(ptITSouter);
879         fPtITSouterminPtTPCvsPtAll->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter) );
880         fPtITSouterminPtTPCvsPtAllNPointTPC->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),nClustersTPC);
881         if(nClustersTPC>0.) fPtITSouterminPtTPCvsPtAllNPointTPCS->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),track->GetTPCnclsS()/nClustersTPC);
882         fPtITSouterminPtTPCvsPtAllDCAR->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),dca2D);
883         fPtITSouterminPtTPCvsPtAllDCAZ->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),dcaZ);
884         fPtITSouterminPtTPCvsPtAllPhi->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),phi);
885         fPtITSouterminPtTPCvsPtAllNPointITS->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),nPointITS);
886         fPtITSouterminPtTPCvsPtAllNSigmaToVertex->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),nSigmaToVertex);
887         fPtITSouterminPtTPCvsPtAllChi2C->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2C);
888         fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),relUncertainty1Pt);
889         fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerClusterTPC);
890         if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
891         if(track->HasPointOnITSLayer(0)) {
892           fPtITSouterminPtTPCvsPtAll_ITSLayer0->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
893           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer0->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
894         }
895         if(!track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)) {
896           fPtITSouterminPtTPCvsPtAll_ITSLayer1->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
897           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer1->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
898         }
899         if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && track->HasPointOnITSLayer(2)) {
900           fPtITSouterminPtTPCvsPtAll_ITSLayer2->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
901           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer2->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
902         }
903         if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && !track->HasPointOnITSLayer(2) && track->HasPointOnITSLayer(3)) {
904           fPtITSouterminPtTPCvsPtAll_ITSLayer3->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
905           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer3->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
906         }
907         if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && !track->HasPointOnITSLayer(2) && !track->HasPointOnITSLayer(3) && track->HasPointOnITSLayer(4)) {
908           fPtITSouterminPtTPCvsPtAll_ITSLayer4->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
909           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer4->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
910         }
911         if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && !track->HasPointOnITSLayer(2) && !track->HasPointOnITSLayer(3) && !track->HasPointOnITSLayer(4) && track->HasPointOnITSLayer(5)) {
912           fPtITSouterminPtTPCvsPtAll_ITSLayer5->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
913           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_ITSLayer5->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
914         }
915
916         if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1)) {
917           fPtITSouterminPtTPCvsPtAll_NoSPD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
918           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSPD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
919         }
920         if(!track->HasPointOnITSLayer(2) && !track->HasPointOnITSLayer(3)) {
921           fPtITSouterminPtTPCvsPtAll_NoSDD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
922           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSDD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
923         }
924         if(!track->HasPointOnITSLayer(4) && !track->HasPointOnITSLayer(5)) {
925           fPtITSouterminPtTPCvsPtAll_NoSSD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
926           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS_NoSSD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
927         }
928       }
929
930     }//fTrackCuts selection
931     
932     
933     //ITSrefit selection
934     if (fTrackCutsITS->AcceptTrack(track)) {
935       
936       fPtSelITS->Fill(pt);
937       fPtSelTPCITS->Fill(ptTPC);
938       fPtITSminPtTPCvsPtITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
939       fPtITSminPtTPCvsPtITSNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nClustersTPC);
940       if(nClustersTPC>0.) fPtITSminPtTPCvsPtITSNPointTPCS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCnclsS()/nClustersTPC);
941       fPtITSminPtTPCvsPtITSDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
942       fPtITSminPtTPCvsPtITSDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
943       fPtITSminPtTPCvsPtITSPhi->Fill(pt,(pt-ptTPC)/(pt),phi);
944       fPtITSminPtTPCvsPtITSNPointITS->Fill(pt,(pt-ptTPC)/(pt),nPointITS);
945       fPtITSminPtTPCvsPtITSNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
946       fPtITSminPtTPCvsPtITSChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
947       fPtITSminPtTPCvsPtITSRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
948       fPtITSminPtTPCvsPtITSChi2PerNClusTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerClusterTPC);
949       if(nPointITS>3) fPtITSminPtTPCvsPtITSChi2PerNClusITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerNPointITS);
950
951       fPtRel1PtUncertaintyChi2PerClusTPC->Fill(pt,relUncertainty1Pt,chi2PerClusterTPC);
952       fPtNPointTPCSChi2PerClusTPC->Fill(pt,track->GetTPCnclsS()/nClustersTPC,chi2PerClusterTPC);
953       fPtNPointTPCSRel1PtUncertainty->Fill(pt,track->GetTPCnclsS()/nClustersTPC,relUncertainty1Pt);
954       if(track->GetTPCnclsS()/nClustersTPC>0.05) fPtRel1PtUncertaintyChi2PerClusTPC_SharedSel->Fill(pt,relUncertainty1Pt,chi2PerClusterTPC);
955     }//fTrackCutsITS loop
956       
957   }//ESD track loop
958    
959   // Post output data
960   PostData(0, fHistList);
961   PostData(1, fHistListTPC);
962   PostData(2, fHistListITS);
963   PostData(3, fHistListCosmics);
964
965 }
966 //________________________________________________________________________
967 Bool_t AliPWG4HighPtQATPConly::IsCosmic(const AliESDtrack *track1 , Int_t trackNumber, Double_t ptMin)
968 {
969   Bool_t candidate = kFALSE;
970   Bool_t candidate2 = kFALSE;
971   if(!track1) return candidate;
972
973   Int_t nTracks = fESD->GetNumberOfTracks();
974  
975   for (Int_t iTrack = trackNumber+1; iTrack < nTracks; iTrack++) {
976     candidate2 = kFALSE;
977     AliESDtrack *track2 = fESD->GetTrack(iTrack);
978     if(!track2) continue;
979     if(!(fTrackCuts->AcceptTrack(track2))) continue;
980     if(track2->Pt()<ptMin) continue;
981     
982     //Check if same charge
983     if( (track1->GetSign()*track2->GetSign()) < 0. ) continue;
984     
985     //Check if back-to-back
986     Double_t mom1[3],mom2[3];
987     track1->GetPxPyPz(mom1);
988     track2->GetPxPyPz(mom2);
989     Double_t cosTheta = (mom1[0]*mom2[0]+mom1[1]*mom2[1]+mom1[2]*mom2[2])/( TMath::Sqrt(mom1[0]*mom1[0]+mom1[1]*mom1[1]+mom1[2]*mom1[2])*TMath::Sqrt(mom2[0]*mom2[0]+mom2[1]*mom2[1]+mom2[2]*mom2[2]) );
990     Double_t theta = TMath::ACos(cosTheta);
991     if(TMath::Abs(TMath::Pi()-theta)<fMaxCosmicAngle) { candidate = kTRUE; candidate2 = kTRUE;}
992
993     if(candidate2) {
994       fDeltaPtCosmicCandidates->Fill(track1->Pt()-track2->Pt());
995       fDeltaPhi->Fill(track1->Phi()-track2->Phi());
996       fDeltaPhi->Fill(track1->Eta()-track2->Eta());
997     }
998
999   }
1000
1001   if(candidate) {
1002     fPtCosmicCandidates->Fill(track1->Pt());
1003   }
1004
1005    return candidate;
1006 }
1007
1008 //________________________________________________________________________
1009 void AliPWG4HighPtQATPConly::Terminate(Option_t *)
1010 {
1011
1012 }
1013
1014 #endif