]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
Possibility to copy the number of the TPC clusters from an AOD track to an ESD track...
[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   fCutType(1),
66   fTrackCuts(0), 
67   fTrackCutsITS(0),
68   fMaxCosmicAngle(0.002),
69   fNEventAll(0),
70   fNEventSel(0),
71   fPtAll(0),
72   fPtSel(0),
73   fPtAllminPtTPCvsPtAll(0),
74   fPtAllminPtTPCvsPtAllEtaPos(0),
75   fPtAllminPtTPCvsPtAllEtaNeg(0),
76   fPtAllminPtTPCvsPtAllNPointTPC(0),
77   fPtAllminPtTPCvsPtAllNPointTPCS(0),
78   fPtAllminPtTPCvsPtAllDCAR(0),
79   fPtAllminPtTPCvsPtAllDCAZ(0),
80   fPtAllminPtTPCvsPtAllPhi(0),
81   fPtAllminPtTPCvsPtAllNPointITS(0),
82   fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
83   fPtAllminPtTPCvsPtAllChi2C(0),
84   fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
85   fPtAllminPtTPCvsPtAllChi2PerNClusTPC(0),
86   fPtAllminPtTPCvsPtAllChi2PerNClusITS(0),
87   fPtAllminPtTPCvsNPointTPCPhi(0),
88   fPtAllminPtTPCvsNPointITSPhi(0),
89   fPtAllminPtTPCvsRel1PtUncertaintyPhi(0),
90   fEtaPhiOutliers(0),
91   fPtSelITSouter(0),
92   fPtITSouterminPtTPCvsPtAll(0),
93   fPtITSouterminPtTPCvsPtAllEtaPos(0),
94   fPtITSouterminPtTPCvsPtAllEtaNeg(0),
95   fPtITSouterminPtTPCvsPtAllNPointTPC(0),
96   fPtITSouterminPtTPCvsPtAllNPointTPCS(0),
97   fPtITSouterminPtTPCvsPtAllDCAR(0),
98   fPtITSouterminPtTPCvsPtAllDCAZ(0),
99   fPtITSouterminPtTPCvsPtAllPhi(0),
100   fPtITSouterminPtTPCvsPtAllNPointITS(0),
101   fPtITSouterminPtTPCvsPtAllNSigmaToVertex(0),
102   fPtITSouterminPtTPCvsPtAllChi2C(0),
103   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty(0),
104   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC(0),
105   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS(0),
106   fPtITSouterminPtTPCvsPtAllITSLayer0(0),
107   fPtITSouterminPtTPCvsPtAllITSLayer1(0),
108   fPtITSouterminPtTPCvsPtAllITSLayer2(0),
109   fPtITSouterminPtTPCvsPtAllITSLayer3(0),
110   fPtITSouterminPtTPCvsPtAllITSLayer4(0),
111   fPtITSouterminPtTPCvsPtAllITSLayer5(0),
112   fPtITSouterminPtTPCvsPtAllNoSPD(0),
113   fPtITSouterminPtTPCvsPtAllNoSDD(0),
114   fPtITSouterminPtTPCvsPtAllNoSSD(0),
115   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0(0),
116   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1(0),
117   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2(0),
118   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3(0),
119   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4(0),
120   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5(0),
121   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD(0),
122   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD(0),
123   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD(0),
124   fHistList(0),
125   fPtAllTPC(0),
126   fPtSelTPC(0),
127   fPtSelTPCITS(0),
128   fHistListTPC(0),
129   fPtSelITS(0),
130   fPtITSminPtTPCvsPtITS(0),
131   fPtITSminPtTPCvsPtITSEtaPos(0),
132   fPtITSminPtTPCvsPtITSEtaNeg(0),
133   fPtITSminPtTPCvsPtITSNPointTPC(0),
134   fPtITSminPtTPCvsPtITSNPointTPCS(0),
135   fPtITSminPtTPCvsPtITSDCAR(0),
136   fPtITSminPtTPCvsPtITSDCAZ(0),
137   fPtITSminPtTPCvsPtITSPhi(0),
138   fPtITSminPtTPCvsPtITSNPointITS(0),
139   fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
140   fPtITSminPtTPCvsPtITSChi2C(0),
141   fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
142   fPtITSminPtTPCvsPtITSChi2PerNClusTPC(0),
143   fPtITSminPtTPCvsPtITSChi2PerNClusITS(0),
144   fPtITSminPtTPCvsNPointTPCPhi(0),
145   fPtITSminPtTPCvsNPointITSPhi(0),
146   fPtITSminPtTPCvsRel1PtUncertaintyPhi(0),
147   fPtRel1PtUncertaintyChi2PerClusTPC(0),
148   fPtNPointTPCSChi2PerClusTPC(0),
149   fPtNPointTPCSRel1PtUncertainty(0),
150   fPtRel1PtUncertaintyChi2PerClusTPCSharedSel(0),
151   fHistListITS(0),
152   fPtSignedCosmicCandidates(0),
153   fDeltaPtCosmicCandidates(0),
154   fDeltaPhiSumEta(0),
155   fDCAZCosmicCandidates(0),
156   fDCARCosmicCandidates(0),
157   fTheta(0),
158   fThetaZoom(0),
159   fThetaPt1Pt2(0),
160   fDeltaPhiSumEtaPt1(0),
161   fDeltaPhiSumEtaPt2(0),
162   fThetaDCAZ1DCAZ2(0),
163   fHistListCosmics(0)
164   
165 {
166
167 }
168 //________________________________________________________________________
169 AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(const char *name): 
170   AliAnalysisTask(name, ""), 
171   fESD(0),
172   fESDfriend(0), 
173   fMC(0),
174   fCutType(1),  
175   fTrackCuts(),
176   fTrackCutsITS(),
177   fMaxCosmicAngle(0.002),
178   fNEventAll(0),
179   fNEventSel(0),
180   fPtAll(0),
181   fPtSel(0),
182   fPtAllminPtTPCvsPtAll(0),
183   fPtAllminPtTPCvsPtAllEtaPos(0),
184   fPtAllminPtTPCvsPtAllEtaNeg(0),
185   fPtAllminPtTPCvsPtAllNPointTPC(0),
186   fPtAllminPtTPCvsPtAllNPointTPCS(0),
187   fPtAllminPtTPCvsPtAllDCAR(0),
188   fPtAllminPtTPCvsPtAllDCAZ(0),
189   fPtAllminPtTPCvsPtAllPhi(0),
190   fPtAllminPtTPCvsPtAllNPointITS(0),
191   fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
192   fPtAllminPtTPCvsPtAllChi2C(0),
193   fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
194   fPtAllminPtTPCvsPtAllChi2PerNClusTPC(0),
195   fPtAllminPtTPCvsPtAllChi2PerNClusITS(0),
196   fPtAllminPtTPCvsNPointTPCPhi(0),
197   fPtAllminPtTPCvsNPointITSPhi(0),
198   fPtAllminPtTPCvsRel1PtUncertaintyPhi(0),
199   fEtaPhiOutliers(0),
200   fPtSelITSouter(0),
201   fPtITSouterminPtTPCvsPtAll(0),
202   fPtITSouterminPtTPCvsPtAllEtaPos(0),
203   fPtITSouterminPtTPCvsPtAllEtaNeg(0),
204   fPtITSouterminPtTPCvsPtAllNPointTPC(0),
205   fPtITSouterminPtTPCvsPtAllNPointTPCS(0),
206   fPtITSouterminPtTPCvsPtAllDCAR(0),
207   fPtITSouterminPtTPCvsPtAllDCAZ(0),
208   fPtITSouterminPtTPCvsPtAllPhi(0),
209   fPtITSouterminPtTPCvsPtAllNPointITS(0),
210   fPtITSouterminPtTPCvsPtAllNSigmaToVertex(0),
211   fPtITSouterminPtTPCvsPtAllChi2C(0),
212   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty(0),
213   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC(0),
214   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS(0),
215   fPtITSouterminPtTPCvsPtAllITSLayer0(0),
216   fPtITSouterminPtTPCvsPtAllITSLayer1(0),
217   fPtITSouterminPtTPCvsPtAllITSLayer2(0),
218   fPtITSouterminPtTPCvsPtAllITSLayer3(0),
219   fPtITSouterminPtTPCvsPtAllITSLayer4(0),
220   fPtITSouterminPtTPCvsPtAllITSLayer5(0),
221   fPtITSouterminPtTPCvsPtAllNoSPD(0),
222   fPtITSouterminPtTPCvsPtAllNoSDD(0),
223   fPtITSouterminPtTPCvsPtAllNoSSD(0),
224   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0(0),
225   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1(0),
226   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2(0),
227   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3(0),
228   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4(0),
229   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5(0),
230   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD(0),
231   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD(0),
232   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD(0),
233   fHistList(0),
234   fPtAllTPC(0),
235   fPtSelTPC(0),
236   fPtSelTPCITS(0),
237   fHistListTPC(0),
238   fPtSelITS(0),
239   fPtITSminPtTPCvsPtITS(0),
240   fPtITSminPtTPCvsPtITSEtaPos(0),
241   fPtITSminPtTPCvsPtITSEtaNeg(0),
242   fPtITSminPtTPCvsPtITSNPointTPC(0),
243   fPtITSminPtTPCvsPtITSNPointTPCS(0),
244   fPtITSminPtTPCvsPtITSDCAR(0),
245   fPtITSminPtTPCvsPtITSDCAZ(0),
246   fPtITSminPtTPCvsPtITSPhi(0),
247   fPtITSminPtTPCvsPtITSNPointITS(0),
248   fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
249   fPtITSminPtTPCvsPtITSChi2C(0),
250   fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
251   fPtITSminPtTPCvsPtITSChi2PerNClusTPC(0),
252   fPtITSminPtTPCvsPtITSChi2PerNClusITS(0),
253   fPtITSminPtTPCvsNPointTPCPhi(0),
254   fPtITSminPtTPCvsNPointITSPhi(0),
255   fPtITSminPtTPCvsRel1PtUncertaintyPhi(0),
256   fPtRel1PtUncertaintyChi2PerClusTPC(0),
257   fPtNPointTPCSChi2PerClusTPC(0),
258   fPtNPointTPCSRel1PtUncertainty(0),
259   fPtRel1PtUncertaintyChi2PerClusTPCSharedSel(0),
260   fHistListITS(0),
261   fPtSignedCosmicCandidates(0),
262   fDeltaPtCosmicCandidates(0),
263   fDeltaPhiSumEta(0),
264   fDCAZCosmicCandidates(0),
265   fDCARCosmicCandidates(0),
266   fTheta(0),
267   fThetaZoom(0),
268   fThetaPt1Pt2(0),
269   fDeltaPhiSumEtaPt1(0),
270   fDeltaPhiSumEtaPt2(0),
271   fThetaDCAZ1DCAZ2(0),
272   fHistListCosmics(0)
273 {
274   //
275   // Constructor. Initialization of Inputs and Outputs
276   //
277   Info("AliPWG4HighPtQATPConly","Calling Constructor");
278   // Input slot #0 works with a TChain ESD
279   DefineInput(0, TChain::Class());
280   // Output slot #0, #1, #2 and #3 writes into a TList
281   DefineOutput(0, TList::Class());
282   DefineOutput(1, TList::Class());
283   DefineOutput(2, TList::Class());
284   DefineOutput(3, TList::Class());
285   
286   // Output slot #4 and #5 writes into a AliESDtrackCuts
287   DefineOutput(4, AliESDtrackCuts::Class());
288   DefineOutput(5, AliESDtrackCuts::Class());
289
290 }
291
292 //________________________________________________________________________
293 void AliPWG4HighPtQATPConly::LocalInit()
294 {
295   //
296   // Only called once at beginning
297   //
298   PostData(4,fTrackCuts);
299   PostData(5,fTrackCutsITS);
300 }
301
302 //________________________________________________________________________
303 void AliPWG4HighPtQATPConly::ConnectInputData(Option_t *) 
304 {
305   // Connect ESD here
306   // Called once
307   AliDebug(2,Form(">> AliPWG4HighPtSpectra::ConnectInputData \n"));
308   TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
309   if (!tree) {
310     AliDebug(2,Form( "ERROR: Could not read chain from input slot 0 \n"));
311     return;
312   } 
313   
314   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
315   
316   if (!esdH) {
317     AliDebug(2,Form("ERROR: Could not get ESDInputHandler")); 
318     return;
319   } else
320     fESD = esdH->GetEvent();
321   
322  AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
323  // AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*>
324  //                        (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
325   if (!eventHandler) {
326     AliDebug(2,Form( "ERROR: Could not retrieve MC event handler \n"));
327   }
328   else
329     fMC = eventHandler->MCEvent();
330
331   //attach the ESD friend
332    //  tree->SetBranchStatus("*", kTRUE);
333 //   tree->SetBranchStatus("Tracks*", kTRUE);
334 //   tree->SetBranchStatus("ESDfriend*", kTRUE);
335   //  fESD->ReadFromTree(tree);
336
337   //old
338 //   fESDfriend = (AliESDfriend*)fESD->FindListObject("AliESDfriend");
339 //   if (!fESDfriend)
340 //     {
341 //       // works for both, we just want to avoid setting the branch adress twice
342 //       // in case of the new ESD
343 //       tree->SetBranchAddress("ESDfriend.",&fESDfriend);
344 //     }
345   
346   fESDfriend = esdH->GetESDfriend();
347
348 }
349
350 //________________________________________________________________________
351 void AliPWG4HighPtQATPConly::CreateOutputObjects() {
352   //Create output objects
353   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::CreateOutputObjects \n")); 
354
355   Bool_t oldStatus = TH1::AddDirectoryStatus();
356   TH1::AddDirectory(kFALSE); 
357
358   OpenFile(0);
359   fHistList = new TList();
360   OpenFile(1);
361   fHistListTPC = new TList();
362   OpenFile(2);
363   fHistListITS = new TList();
364   OpenFile(3);
365   fHistListCosmics = new TList();
366
367   Int_t fgkNPhiBins=18;
368   Float_t kMinPhi = 0.;
369   Float_t kMaxPhi = 2.*TMath::Pi();
370   Double_t *binsPhi=new Double_t[fgkNPhiBins+1];
371   for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ;
372   
373   Float_t fgkPtMin=0.;
374   Float_t fgkPtMax=100.;
375
376   const Float_t ptmin1 =  fgkPtMin;
377   const Float_t ptmax1 =  10.0 ;
378   const Float_t ptmin2 =  ptmax1 ;
379   const Float_t ptmax2 =  20.0 ;
380   const Float_t ptmin3 =  ptmax2 ;
381   const Float_t ptmax3 =  fgkPtMax;
382   const Int_t nbin11 = (int)(ptmax1-ptmin1);
383   const Int_t nbin12 = (int)((ptmax2-ptmin2)/2.)+nbin11;
384   const Int_t nbin13 = (int)((ptmax3-ptmin3)/5.)+nbin12;
385   Int_t fgkNPtBins=nbin13;
386   //Create array with low edges of each bin
387   Double_t *binsPt=new Double_t[fgkNPtBins+1];
388   for(Int_t i=0; i<=fgkNPtBins; i++) {
389     if(i<=nbin11) binsPt[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;  
390     if(i<=nbin12 && i>nbin11) binsPt[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;  
391     if(i<=nbin13 && i>nbin12) binsPt[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;  
392   }
393
394   Float_t fgkChi2PerClusMin = 0.;
395   Float_t fgkChi2PerClusMax = 4.;
396   Int_t fgkNChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
397   Double_t *binsChi2PerClus=new Double_t[fgkNChi2PerClusBins+1];
398   for(Int_t i=0; i<=fgkNChi2PerClusBins; i++) binsChi2PerClus[i]=(Double_t)fgkChi2PerClusMin + (fgkChi2PerClusMax-fgkChi2PerClusMin)/fgkNChi2PerClusBins*(Double_t)i ;
399
400   Int_t fgkNResPtBins=80;
401   Float_t fgkResPtMin = -1.;
402   Float_t fgkResPtMax = 1.;
403   Double_t *binsResPt=new Double_t[fgkNResPtBins+1];
404   for(Int_t i=0; i<=fgkNResPtBins; i++) binsResPt[i]=(Double_t)fgkResPtMin + (fgkResPtMax-fgkResPtMin)/fgkNResPtBins*(Double_t)i ;
405
406   Int_t fgkNEtaBins=20;
407   Float_t fgkEtaMin = -1.;
408   Float_t fgkEtaMax = 1.;
409   Double_t *binsEta=new Double_t[fgkNEtaBins+1];
410   for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ;
411
412   Int_t fgkNNPointTPCBins=80;
413   Float_t fgkNPointTPCMin = 0.5;
414   Float_t fgkNPointTPCMax = 160.5;
415   Double_t *binsNPointTPC=new Double_t[fgkNNPointTPCBins+1];
416   for(Int_t i=0; i<=fgkNNPointTPCBins; i++) binsNPointTPC[i]=(Double_t)fgkNPointTPCMin + (fgkNPointTPCMax-fgkNPointTPCMin)/fgkNNPointTPCBins*(Double_t)i ;
417
418   Int_t fgkNNPointTPCSBins=50;
419   Float_t fgkNPointTPCSMin = 0.;
420   Float_t fgkNPointTPCSMax = 1.;
421   Double_t *binsNPointTPCS=new Double_t[fgkNNPointTPCSBins+1];
422   for(Int_t i=0; i<=fgkNNPointTPCSBins; i++) binsNPointTPCS[i]=(Double_t)fgkNPointTPCSMin + (fgkNPointTPCSMax-fgkNPointTPCSMin)/fgkNNPointTPCSBins*(Double_t)i ;
423
424   Int_t fgkNDCARBins=80;
425   Float_t fgkDCARMin = -0.2;
426   Float_t fgkDCARMax = 0.2;
427   Double_t *binsDCAR=new Double_t[fgkNDCARBins+1];
428   for(Int_t i=0; i<=fgkNDCARBins; i++) binsDCAR[i]=(Double_t)fgkDCARMin + (fgkDCARMax-fgkDCARMin)/fgkNDCARBins*(Double_t)i ;
429
430   Int_t fgkNDCAZBins=80;
431   Float_t fgkDCAZMin = -2.;
432   Float_t fgkDCAZMax = 2.;
433   Double_t *binsDCAZ=new Double_t[fgkNDCAZBins+1];
434   for(Int_t i=0; i<=fgkNDCAZBins; i++) binsDCAZ[i]=(Double_t)fgkDCAZMin + (fgkDCAZMax-fgkDCAZMin)/fgkNDCAZBins*(Double_t)i ;
435
436   Int_t fgkNNPointITSBins=9;
437   Float_t fgkNPointITSMin = -0.5;
438   Float_t fgkNPointITSMax = 8.5;
439   Double_t *binsNPointITS=new Double_t[fgkNNPointITSBins+1];
440   for(Int_t i=0; i<=fgkNNPointITSBins; i++) binsNPointITS[i]=(Double_t)fgkNPointITSMin + (fgkNPointITSMax-fgkNPointITSMin)/fgkNNPointITSBins*(Double_t)i ;
441
442   Int_t fgkNNSigmaToVertexBins=40;
443   Float_t fgkNSigmaToVertexMin = 0.;
444   Float_t fgkNSigmaToVertexMax = 8.;
445   Double_t *binsNSigmaToVertex=new Double_t[fgkNNSigmaToVertexBins+1];
446   for(Int_t i=0; i<=fgkNNSigmaToVertexBins; i++) binsNSigmaToVertex[i]=(Double_t)fgkNSigmaToVertexMin + (fgkNSigmaToVertexMax-fgkNSigmaToVertexMin)/fgkNNSigmaToVertexBins*(Double_t)i ;
447
448   Int_t fgkNChi2CBins=20;
449   Float_t fgkChi2CMin = 0.;
450   Float_t fgkChi2CMax = 10.;
451   Double_t *binsChi2C=new Double_t[fgkNChi2CBins+1];
452   for(Int_t i=0; i<=fgkNChi2CBins; i++) binsChi2C[i]=(Double_t)fgkChi2CMin + (fgkChi2CMax-fgkChi2CMin)/fgkNChi2CBins*(Double_t)i ;
453  
454   Int_t fgkNRel1PtUncertaintyBins=30;
455   Float_t fgkRel1PtUncertaintyMin = 0.;
456   Float_t fgkRel1PtUncertaintyMax = 0.3;
457   Double_t *binsRel1PtUncertainty=new Double_t[fgkNRel1PtUncertaintyBins+1];
458   for(Int_t i=0; i<=fgkNRel1PtUncertaintyBins; i++) binsRel1PtUncertainty[i]=(Double_t)fgkRel1PtUncertaintyMin + (fgkRel1PtUncertaintyMax-fgkRel1PtUncertaintyMin)/fgkNRel1PtUncertaintyBins*(Double_t)i ;
459
460   fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
461   fHistList->Add(fNEventAll);
462   fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
463   fHistList->Add(fNEventSel);
464   fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, binsPt);//fgkPtMin, fgkPtMax);
465   fHistList->Add(fPtAll);
466   fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, binsPt);//fgkPtMin, fgkPtMax);
467   fHistList->Add(fPtSel);
468  
469   fPtAllminPtTPCvsPtAll = new TH2F("fPtAllminPtTPCvsPtAll","PtAllminPtTPCvsPtAll",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
470   fPtAllminPtTPCvsPtAll->SetXTitle("p_{t}^{Global}");
471   fPtAllminPtTPCvsPtAll->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
472   fHistList->Add(fPtAllminPtTPCvsPtAll);
473   
474   fPtAllminPtTPCvsPtAllEtaPos = new TH3F("fPtAllminPtTPCvsPtAllEtaPos","PtAllminPtTPCvsPtAllEtaPos",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNEtaBins,binsEta);
475   fPtAllminPtTPCvsPtAllEtaPos->SetXTitle("p_{t}^{Global}");
476   fPtAllminPtTPCvsPtAllEtaPos->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
477   fPtAllminPtTPCvsPtAllEtaPos->SetZTitle("#eta");
478   fHistList->Add(fPtAllminPtTPCvsPtAllEtaPos);
479
480   fPtAllminPtTPCvsPtAllEtaNeg = new TH3F("fPtAllminPtTPCvsPtAllEtaNeg","PtAllminPtTPCvsPtAllEtaNeg",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNEtaBins,binsEta);
481   fPtAllminPtTPCvsPtAllEtaNeg->SetXTitle("p_{t}^{Global}");
482   fPtAllminPtTPCvsPtAllEtaNeg->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
483   fPtAllminPtTPCvsPtAllEtaNeg->SetZTitle("#eta");
484   fHistList->Add(fPtAllminPtTPCvsPtAllEtaNeg);
485
486   fPtAllminPtTPCvsPtAllNPointTPC = new TH3F("fPtAllminPtTPCvsPtAllNPointTPC","PtAllminPtTPCvsPtAllNPointTPC",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointTPCBins,binsNPointTPC);
487   fPtAllminPtTPCvsPtAllNPointTPC->SetXTitle("p_{t}^{Global}");
488   fPtAllminPtTPCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
489   fPtAllminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
490   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPC);
491
492   fPtAllminPtTPCvsPtAllNPointTPCS = new TH3F("fPtAllminPtTPCvsPtAllNPointTPCS","PtAllminPtTPCvsPtAllNPointTPCS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointTPCSBins,binsNPointTPCS);
493   fPtAllminPtTPCvsPtAllNPointTPCS->SetXTitle("p_{t}^{Global}");
494   fPtAllminPtTPCvsPtAllNPointTPCS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
495   fPtAllminPtTPCvsPtAllNPointTPCS->SetZTitle("N_{point,TPC}^{Shared}/N_{point,TPC}");
496   fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPCS);
497
498   fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNDCARBins,binsDCAR);
499   fPtAllminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{Global}");
500   fPtAllminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
501   fPtAllminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
502   fHistList->Add(fPtAllminPtTPCvsPtAllDCAR);
503
504   fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNDCAZBins,binsDCAZ);
505   fPtAllminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{Global}");
506   fPtAllminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
507   fPtAllminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
508   fHistList->Add(fPtAllminPtTPCvsPtAllDCAZ);
509
510   fPtAllminPtTPCvsPtAllPhi = new TH3F("fPtAllminPtTPCvsPtAllPhi","PtAllminPtTPCvsPtAllPhi",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNPhiBins,binsPhi);
511   fPtAllminPtTPCvsPtAllPhi->SetXTitle("p_{t}^{Global}");
512   fPtAllminPtTPCvsPtAllPhi->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
513   fPtAllminPtTPCvsPtAllPhi->SetZTitle("#phi");
514   fHistList->Add(fPtAllminPtTPCvsPtAllPhi);
515
516   fPtAllminPtTPCvsPtAllNPointITS = new TH3F("fPtAllminPtTPCvsPtAllNPointITS","PtAllminPtTPCvsPtAllNPointITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointITSBins,binsNPointITS);
517   fPtAllminPtTPCvsPtAllNPointITS->SetXTitle("p_{t}^{Global}");
518   fPtAllminPtTPCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
519   fPtAllminPtTPCvsPtAllNPointITS->SetZTitle("N_{point,ITS}");
520   fHistList->Add(fPtAllminPtTPCvsPtAllNPointITS);
521   
522   fPtAllminPtTPCvsPtAllNSigmaToVertex = new TH3F("fPtAllminPtTPCvsPtAllNSigmaToVertex","PtAllminPtTPCvsPtAllNSigmaToVertex",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
523   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{Global}");
524   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
525   fPtAllminPtTPCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
526   fHistList->Add(fPtAllminPtTPCvsPtAllNSigmaToVertex);
527
528   fPtAllminPtTPCvsPtAllChi2C = new TH3F("fPtAllminPtTPCvsPtAllChi2C","PtAllminPtTPCvsPtAllChi2C",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2CBins,binsChi2C);
529   fPtAllminPtTPCvsPtAllChi2C->SetXTitle("p_{t}^{Global}");
530   fPtAllminPtTPCvsPtAllChi2C->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
531   fPtAllminPtTPCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
532   fHistList->Add(fPtAllminPtTPCvsPtAllChi2C);
533
534   fPtAllminPtTPCvsPtAllRel1PtUncertainty = new TH3F("fPtAllminPtTPCvsPtAllRel1PtUncertainty","PtAllminPtTPCvsPtAllRel1PtUncertainty",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
535   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{Global}");
536   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
537   fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
538   fHistList->Add(fPtAllminPtTPCvsPtAllRel1PtUncertainty);
539
540   fPtAllminPtTPCvsPtAllChi2PerNClusTPC = new TH3F("fPtAllminPtTPCvsPtAllChi2PerNClusTPC","PtAllminPtTPCvsPtAllChi2PerNClusTPC",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
541   fPtAllminPtTPCvsPtAllChi2PerNClusTPC->SetXTitle("p_{t}^{Global}");
542   fPtAllminPtTPCvsPtAllChi2PerNClusTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
543   fPtAllminPtTPCvsPtAllChi2PerNClusTPC->SetZTitle("#chi^{2}/(2*NClusTPC-5)");
544   fHistList->Add(fPtAllminPtTPCvsPtAllChi2PerNClusTPC);
545
546   fPtAllminPtTPCvsPtAllChi2PerNClusITS = new TH3F("fPtAllminPtTPCvsPtAllChi2PerNClusITS","PtAllminPtTPCvsPtAllChi2PerNClusITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
547   fPtAllminPtTPCvsPtAllChi2PerNClusITS->SetXTitle("p_{t}^{Global}");
548   fPtAllminPtTPCvsPtAllChi2PerNClusITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
549   fPtAllminPtTPCvsPtAllChi2PerNClusITS->SetZTitle("#chi^{2}/(2*NClusITS-5)");
550   fHistList->Add(fPtAllminPtTPCvsPtAllChi2PerNClusITS);
551
552   fPtAllminPtTPCvsNPointTPCPhi = new TH3F("fPtAllminPtTPCvsNPointTPCPhi","PtAllminPtTPCvsNPointTPCPhi",fgkNResPtBins,binsResPt,fgkNNPointTPCBins,binsNPointTPC,fgkNPhiBins,binsPhi);
553   fPtAllminPtTPCvsNPointTPCPhi->SetXTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
554   fPtAllminPtTPCvsNPointTPCPhi->SetYTitle("N_{point,TPC}");
555   fPtAllminPtTPCvsNPointTPCPhi->SetZTitle("#phi");
556   fHistList->Add(fPtAllminPtTPCvsNPointTPCPhi);
557
558   fPtAllminPtTPCvsNPointITSPhi = new TH3F("fPtAllminPtTPCvsNPointITSPhi","PtAllminPtTPCvsNPointITSPhi",fgkNResPtBins,binsResPt,fgkNNPointITSBins,binsNPointITS,fgkNPhiBins,binsPhi);
559   fPtAllminPtTPCvsNPointITSPhi->SetXTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
560   fPtAllminPtTPCvsNPointITSPhi->SetYTitle("N_{point,ITS}");
561   fPtAllminPtTPCvsNPointITSPhi->SetZTitle("#phi");
562   fHistList->Add(fPtAllminPtTPCvsNPointITSPhi);
563
564   fPtAllminPtTPCvsRel1PtUncertaintyPhi = new TH3F("fPtAllminPtTPCvsRel1PtUncertaintyPhi","PtAllminPtTPCvsRel1PtUncertaintyPhi",fgkNResPtBins,binsResPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNPhiBins,binsPhi);
565   fPtAllminPtTPCvsRel1PtUncertaintyPhi->SetXTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
566   fPtAllminPtTPCvsRel1PtUncertaintyPhi->SetYTitle("Rel1PtUncertainty");
567   fPtAllminPtTPCvsRel1PtUncertaintyPhi->SetZTitle("#phi");
568   fHistList->Add(fPtAllminPtTPCvsRel1PtUncertaintyPhi);
569
570   fEtaPhiOutliers = new TH2F("fEtaPhiOutliers","PtAllminPtTPCvsPtAll",20, -1.,1.,fgkNPhiBins,binsPhi);
571   fEtaPhiOutliers->SetXTitle("#eta");
572   fEtaPhiOutliers->SetYTitle("#phi");
573   fHistList->Add(fEtaPhiOutliers);
574
575   //Global vs ITSouter-TPCinner
576   fPtSelITSouter = new TH1F("fPtSelITSouter","PtSelITSouter",fgkNPtBins,binsPt);
577   fHistList->Add(fPtSelITSouter);
578   
579   fPtITSouterminPtTPCvsPtAll = new TH2F("fPtITSouterminPtTPCvsPtAll","PtITSouterminPtTPCvsPtAll",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
580   fPtITSouterminPtTPCvsPtAll->SetXTitle("p_{t}^{Global}");
581   fPtITSouterminPtTPCvsPtAll->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
582   fHistList->Add(fPtITSouterminPtTPCvsPtAll);
583   
584   fPtITSouterminPtTPCvsPtAllEtaPos = new TH3F("fPtITSouterminPtTPCvsPtAllEtaPos","PtITSouterminPtTPCvsPtAllEtaPos",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNEtaBins,binsEta);
585   fPtITSouterminPtTPCvsPtAllEtaPos->SetXTitle("p_{t}^{Global}");
586   fPtITSouterminPtTPCvsPtAllEtaPos->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
587   fHistList->Add(fPtITSouterminPtTPCvsPtAllEtaPos);
588
589   fPtITSouterminPtTPCvsPtAllEtaNeg = new TH3F("fPtITSouterminPtTPCvsPtAllEtaNeg","PtITSouterminPtTPCvsPtAllEtaNeg",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNEtaBins,binsEta);
590   fPtITSouterminPtTPCvsPtAllEtaNeg->SetXTitle("p_{t}^{Global}");
591   fPtITSouterminPtTPCvsPtAllEtaNeg->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
592   fHistList->Add(fPtITSouterminPtTPCvsPtAllEtaNeg);
593
594   fPtITSouterminPtTPCvsPtAllNPointTPC = new TH3F("fPtITSouterminPtTPCvsPtAllNPointTPC","PtITSouterminPtTPCvsPtAllNPointTPC",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointTPCBins,binsNPointTPC);
595   fPtITSouterminPtTPCvsPtAllNPointTPC->SetXTitle("p_{t}^{Global}");
596   fPtITSouterminPtTPCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
597   fPtITSouterminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
598   fHistList->Add(fPtITSouterminPtTPCvsPtAllNPointTPC);
599
600   fPtITSouterminPtTPCvsPtAllNPointTPCS = new TH3F("fPtITSouterminPtTPCvsPtAllNPointTPCS","PtITSouterminPtTPCvsPtAllNPointTPCS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointTPCSBins,binsNPointTPCS);
601   fPtITSouterminPtTPCvsPtAllNPointTPCS->SetXTitle("p_{t}^{Global}");
602   fPtITSouterminPtTPCvsPtAllNPointTPCS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
603   fPtITSouterminPtTPCvsPtAllNPointTPCS->SetZTitle("N_{point,TPC}^{Shared}/N_{point,TPC}");
604   fHistList->Add(fPtITSouterminPtTPCvsPtAllNPointTPCS);
605
606   fPtITSouterminPtTPCvsPtAllDCAR = new TH3F("fPtITSouterminPtTPCvsPtAllDCAR","PtITSouterminPtTPCvsPtAllDCAR",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNDCARBins,binsDCAR);
607   fPtITSouterminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{Global}");
608   fPtITSouterminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
609   fPtITSouterminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
610   fHistList->Add(fPtITSouterminPtTPCvsPtAllDCAR);
611
612   fPtITSouterminPtTPCvsPtAllDCAZ = new TH3F("fPtITSouterminPtTPCvsPtAllDCAZ","PtITSouterminPtTPCvsPtAllDCAZ",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNDCAZBins,binsDCAZ);
613   fPtITSouterminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{Global}");
614   fPtITSouterminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
615   fPtITSouterminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
616   fHistList->Add(fPtITSouterminPtTPCvsPtAllDCAZ);
617
618   fPtITSouterminPtTPCvsPtAllPhi = new TH3F("fPtITSouterminPtTPCvsPtAllPhi","PtITSouterminPtTPCvsPtAllPhi",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNPhiBins,binsPhi);
619   fPtITSouterminPtTPCvsPtAllPhi->SetXTitle("p_{t}^{Global}");
620   fPtITSouterminPtTPCvsPtAllPhi->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
621   fPtITSouterminPtTPCvsPtAllPhi->SetZTitle("#phi");
622   fHistList->Add(fPtITSouterminPtTPCvsPtAllPhi);
623
624   fPtITSouterminPtTPCvsPtAllNPointITS = new TH3F("fPtITSouterminPtTPCvsPtAllNPointITS","PtITSouterminPtTPCvsPtAllNPointITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointITSBins,binsNPointITS);
625   fPtITSouterminPtTPCvsPtAllNPointITS->SetXTitle("p_{t}^{Global}");
626   fPtITSouterminPtTPCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
627   fPtITSouterminPtTPCvsPtAllNPointITS->SetZTitle("N_{point,ITS}");
628   fHistList->Add(fPtITSouterminPtTPCvsPtAllNPointITS);
629   
630   fPtITSouterminPtTPCvsPtAllNSigmaToVertex = new TH3F("fPtITSouterminPtTPCvsPtAllNSigmaToVertex","PtITSouterminPtTPCvsPtAllNSigmaToVertex",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
631   fPtITSouterminPtTPCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{Global}");
632   fPtITSouterminPtTPCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
633   fPtITSouterminPtTPCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
634   fHistList->Add(fPtITSouterminPtTPCvsPtAllNSigmaToVertex);
635
636   fPtITSouterminPtTPCvsPtAllChi2C = new TH3F("fPtITSouterminPtTPCvsPtAllChi2C","PtITSouterminPtTPCvsPtAllChi2C",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2CBins,binsChi2C);
637   fPtITSouterminPtTPCvsPtAllChi2C->SetXTitle("p_{t}^{Global}");
638   fPtITSouterminPtTPCvsPtAllChi2C->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
639   fPtITSouterminPtTPCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
640   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2C);
641
642   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty = new TH3F("fPtITSouterminPtTPCvsPtAllRel1PtUncertainty","PtITSouterminPtTPCvsPtAllRel1PtUncertainty",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
643   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{Global}");
644   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
645   fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
646   fHistList->Add(fPtITSouterminPtTPCvsPtAllRel1PtUncertainty);
647
648   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC","PtITSouterminPtTPCvsPtAllChi2PerNClusTPC",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
649   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->SetXTitle("p_{t}^{Global}");
650   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
651   fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->SetZTitle("#chi^{2}/(2*NClusTPC-5)");
652   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC);
653
654   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITS","PtITSouterminPtTPCvsPtAllChi2PerNClusITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
655   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->SetXTitle("p_{t}^{Global}");
656   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
657   fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->SetZTitle("#chi^{2}/(2*NClusITS-5)");
658   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITS);
659
660   //As function of ITS layers
661   fPtITSouterminPtTPCvsPtAllITSLayer0 = new TH2F("fPtITSouterminPtTPCvsPtAllITSLayer0","PtITSouterminPtTPCvsPtAllITSLayer0",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
662   fPtITSouterminPtTPCvsPtAllITSLayer0->SetXTitle("p_{t}^{Global}");
663   fPtITSouterminPtTPCvsPtAllITSLayer0->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
664   fHistList->Add(fPtITSouterminPtTPCvsPtAllITSLayer0);
665
666   fPtITSouterminPtTPCvsPtAllITSLayer1 = new TH2F("fPtITSouterminPtTPCvsPtAllITSLayer1","PtITSouterminPtTPCvsPtAllITSLayer1",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
667   fPtITSouterminPtTPCvsPtAllITSLayer1->SetXTitle("p_{t}^{Global}");
668   fPtITSouterminPtTPCvsPtAllITSLayer1->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
669   fHistList->Add(fPtITSouterminPtTPCvsPtAllITSLayer1);
670
671   fPtITSouterminPtTPCvsPtAllITSLayer2 = new TH2F("fPtITSouterminPtTPCvsPtAllITSLayer2","PtITSouterminPtTPCvsPtAllITSLayer2",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
672   fPtITSouterminPtTPCvsPtAllITSLayer2->SetXTitle("p_{t}^{Global}");
673   fPtITSouterminPtTPCvsPtAllITSLayer2->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
674   fHistList->Add(fPtITSouterminPtTPCvsPtAllITSLayer2);
675
676   fPtITSouterminPtTPCvsPtAllITSLayer3 = new TH2F("fPtITSouterminPtTPCvsPtAllITSLayer3","PtITSouterminPtTPCvsPtAllITSLayer3",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
677   fPtITSouterminPtTPCvsPtAllITSLayer3->SetXTitle("p_{t}^{Global}");
678   fPtITSouterminPtTPCvsPtAllITSLayer3->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
679   fHistList->Add(fPtITSouterminPtTPCvsPtAllITSLayer3);
680
681   fPtITSouterminPtTPCvsPtAllITSLayer4 = new TH2F("fPtITSouterminPtTPCvsPtAllITSLayer4","PtITSouterminPtTPCvsPtAllITSLayer4",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
682   fPtITSouterminPtTPCvsPtAllITSLayer4->SetXTitle("p_{t}^{Global}");
683   fPtITSouterminPtTPCvsPtAllITSLayer4->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
684   fHistList->Add(fPtITSouterminPtTPCvsPtAllITSLayer4);
685
686   fPtITSouterminPtTPCvsPtAllITSLayer5 = new TH2F("fPtITSouterminPtTPCvsPtAllITSLayer5","PtITSouterminPtTPCvsPtAllITSLayer5",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
687   fPtITSouterminPtTPCvsPtAllITSLayer5->SetXTitle("p_{t}^{Global}");
688   fPtITSouterminPtTPCvsPtAllITSLayer5->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
689   fHistList->Add(fPtITSouterminPtTPCvsPtAllITSLayer5);
690
691   fPtITSouterminPtTPCvsPtAllNoSPD = new TH2F("fPtITSouterminPtTPCvsPtAllNoSPD","PtITSouterminPtTPCvsPtAllNoSPD",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
692   fPtITSouterminPtTPCvsPtAllNoSPD->SetXTitle("p_{t}^{Global}");
693   fPtITSouterminPtTPCvsPtAllNoSPD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
694   fHistList->Add(fPtITSouterminPtTPCvsPtAllNoSPD);
695
696   fPtITSouterminPtTPCvsPtAllNoSDD = new TH2F("fPtITSouterminPtTPCvsPtAllNoSDD","PtITSouterminPtTPCvsPtAllNoSDD",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
697   fPtITSouterminPtTPCvsPtAllNoSDD->SetXTitle("p_{t}^{Global}");
698   fPtITSouterminPtTPCvsPtAllNoSDD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
699   fHistList->Add(fPtITSouterminPtTPCvsPtAllNoSDD);
700
701   fPtITSouterminPtTPCvsPtAllNoSSD = new TH2F("fPtITSouterminPtTPCvsPtAllNoSSD","PtITSouterminPtTPCvsPtAllNoSSD",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
702   fPtITSouterminPtTPCvsPtAllNoSSD->SetXTitle("p_{t}^{Global}");
703   fPtITSouterminPtTPCvsPtAllNoSSD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
704   fHistList->Add(fPtITSouterminPtTPCvsPtAllNoSSD);
705
706   //
707   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0","PtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
708   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0->SetXTitle("p_{t}^{Global}");
709   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
710   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0->SetZTitle("#chi^{2}/NPointITS");
711   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0);
712
713   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1","PtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
714   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1->SetXTitle("p_{t}^{Global}");
715   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
716   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1->SetZTitle("#chi^{2}/NPointITS");
717   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1);
718
719   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2","PtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
720   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2->SetXTitle("p_{t}^{Global}");
721   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
722   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2->SetZTitle("#chi^{2}/NPointITS");
723   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2);
724
725   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3","PtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
726   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3->SetXTitle("p_{t}^{Global}");
727   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
728   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3->SetZTitle("#chi^{2}/NPointITS");
729   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3);
730
731   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4","PtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
732   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4->SetXTitle("p_{t}^{Global}");
733   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
734   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4->SetZTitle("#chi^{2}/NPointITS");
735   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4);
736
737   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5 = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5","PtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
738   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5->SetXTitle("p_{t}^{Global}");
739   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
740   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5->SetZTitle("#chi^{2}/NPointITS");
741   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5);
742
743   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD","PtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
744   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD->SetXTitle("p_{t}^{Global}");
745   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
746   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD->SetZTitle("#chi^{2}/(2*NPointITS-5)");
747   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD);
748
749   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD","PtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
750   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD->SetXTitle("p_{t}^{Global}");
751   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
752   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD->SetZTitle("#chi^{2}/(2*NPointITS-5)");
753   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD);
754
755   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD = new TH3F("fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD","PtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
756   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD->SetXTitle("p_{t}^{Global}");
757   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD->SetYTitle("(1/p_{t}^{ITSouter}-1/p_{t}^{TPCinner})/(1/p_{t}^{ITSouter})");
758   fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD->SetZTitle("#chi^{2}/(2*NPointITS-5)");
759   fHistList->Add(fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD);
760
761
762   //ITSrefit
763   fPtSelITS = new TH1F("fPtSelITSrefit","PtSel",fgkNPtBins, binsPt);
764   fHistListITS->Add(fPtSelITS);
765   
766   fPtITSminPtTPCvsPtITS = new TH2F("fPtITSminPtTPCvsPtITS","PtITSminPtTPCvsPtITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt);
767   fPtITSminPtTPCvsPtITS->SetXTitle("p_{t}^{Global}");
768   fPtITSminPtTPCvsPtITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
769   fHistListITS->Add(fPtITSminPtTPCvsPtITS);
770
771   fPtITSminPtTPCvsPtITSEtaPos = new TH3F("fPtITSminPtTPCvsPtITSEtaPos","PtITSminPtTPCvsPtITSEtaPos",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNEtaBins,binsEta);
772   fPtITSminPtTPCvsPtITSEtaPos->SetXTitle("p_{t}^{Global}");
773   fPtITSminPtTPCvsPtITSEtaPos->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
774   fHistListITS->Add(fPtITSminPtTPCvsPtITSEtaPos);
775
776   fPtITSminPtTPCvsPtITSEtaNeg = new TH3F("fPtITSminPtTPCvsPtITSEtaNeg","PtITSminPtTPCvsPtITSEtaNeg",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNEtaBins,binsEta);
777   fPtITSminPtTPCvsPtITSEtaNeg->SetXTitle("p_{t}^{Global}");
778   fPtITSminPtTPCvsPtITSEtaNeg->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
779   fHistListITS->Add(fPtITSminPtTPCvsPtITSEtaNeg);
780   
781   fPtITSminPtTPCvsPtITSNPointTPC = new TH3F("fPtITSminPtTPCvsPtITSNPointTPC","PtITSminPtTPCvsPtITSNPointTPC",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointTPCBins,binsNPointTPC);
782   fPtITSminPtTPCvsPtITSNPointTPC->SetXTitle("p_{t}^{Global}");
783   fPtITSminPtTPCvsPtITSNPointTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
784   fPtITSminPtTPCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
785   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPC);
786
787   fPtITSminPtTPCvsPtITSNPointTPCS = new TH3F("fPtITSminPtTPCvsPtITSNPointTPCS","PtITSminPtTPCvsPtITSNPointTPCS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointTPCSBins,binsNPointTPCS);
788   fPtITSminPtTPCvsPtITSNPointTPCS->SetXTitle("p_{t}^{Global}");
789   fPtITSminPtTPCvsPtITSNPointTPCS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
790   fPtITSminPtTPCvsPtITSNPointTPCS->SetZTitle("N_{point,TPC}^{Shared}/N_{point,TPC}");
791   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPCS);    
792
793   fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNDCARBins,binsDCAR);
794   fPtITSminPtTPCvsPtITSDCAR->SetXTitle("p_{t}^{Global}");
795   fPtITSminPtTPCvsPtITSDCAR->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
796   fPtITSminPtTPCvsPtITSDCAR->SetZTitle("DCA_{R}");
797   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAR);
798   
799   fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNDCAZBins,binsDCAZ);
800   fPtITSminPtTPCvsPtITSDCAZ->SetXTitle("p_{t}^{Global}");
801   fPtITSminPtTPCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
802   fPtITSminPtTPCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
803   fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAZ);
804   
805   fPtITSminPtTPCvsPtITSPhi = new TH3F("fPtITSminPtTPCvsPtITSPhi","PtITSminPtTPCvsPtITSPhi",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNPhiBins,binsPhi);
806   fPtITSminPtTPCvsPtITSPhi->SetXTitle("p_{t}^{Global}");
807   fPtITSminPtTPCvsPtITSPhi->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
808   fPtITSminPtTPCvsPtITSPhi->SetZTitle("#phi");
809   fHistListITS->Add(fPtITSminPtTPCvsPtITSPhi);
810   
811   fPtITSminPtTPCvsPtITSNPointITS = new TH3F("fPtITSminPtTPCvsPtITSNPointITS","PtITSminPtTPCvsPtITSNPointITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNPointITSBins,binsNPointITS);
812   fPtITSminPtTPCvsPtITSNPointITS->SetXTitle("p_{t}^{Global}");
813   fPtITSminPtTPCvsPtITSNPointITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
814   fPtITSminPtTPCvsPtITSNPointITS->SetZTitle("N_{point,ITS}");
815   fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointITS); 
816   
817   fPtITSminPtTPCvsPtITSNSigmaToVertex = new TH3F("fPtITSminPtTPCvsPtITSNSigmaToVertex","PtITSminPtTPCvsPtITSNSigmaToVertex",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
818   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetXTitle("p_{t}^{Global}");
819   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
820   fPtITSminPtTPCvsPtITSNSigmaToVertex->SetZTitle("N#sigma to vertex");
821   fHistListITS->Add(fPtITSminPtTPCvsPtITSNSigmaToVertex);
822
823   fPtITSminPtTPCvsPtITSChi2C = new TH3F("fPtITSminPtTPCvsPtITSChi2C","PtITSminPtTPCvsPtITSChi2C",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2CBins,binsChi2C);
824   fPtITSminPtTPCvsPtITSChi2C->SetXTitle("p_{t}^{Global}");
825   fPtITSminPtTPCvsPtITSChi2C->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
826   fPtITSminPtTPCvsPtITSChi2C->SetZTitle("Constrained #chi^{2}");
827   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2C);
828
829   fPtITSminPtTPCvsPtITSRel1PtUncertainty = new TH3F("fPtITSminPtTPCvsPtITSRel1PtUncertainty","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
830   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetXTitle("p_{t}^{Global}");
831   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
832   fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
833   fHistListITS->Add(fPtITSminPtTPCvsPtITSRel1PtUncertainty);
834
835   fPtITSminPtTPCvsPtITSChi2PerNClusTPC = new TH3F("fPtITSminPtTPCvsPtITSChi2PerNClusTPC","PtITSminPtTPCvsPtITSChi2PerNClusTPC",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
836   fPtITSminPtTPCvsPtITSChi2PerNClusTPC->SetXTitle("p_{t}^{Global}");
837   fPtITSminPtTPCvsPtITSChi2PerNClusTPC->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
838   fPtITSminPtTPCvsPtITSChi2PerNClusTPC->SetZTitle("#chi^{2}/(2*NClusTPC-5)");
839   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2PerNClusTPC);
840
841   fPtITSminPtTPCvsPtITSChi2PerNClusITS = new TH3F("fPtITSminPtTPCvsPtITSChi2PerNClusITS","PtITSminPtTPCvsPtITSChi2PerNClusITS",fgkNPtBins, binsPt,fgkNResPtBins,binsResPt,fgkNChi2PerClusBins,binsChi2PerClus);
842   fPtITSminPtTPCvsPtITSChi2PerNClusITS->SetXTitle("p_{t}^{Global}");
843   fPtITSminPtTPCvsPtITSChi2PerNClusITS->SetYTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
844   fPtITSminPtTPCvsPtITSChi2PerNClusITS->SetZTitle("#chi^{2}/(2*NClusITS-5)");
845   fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2PerNClusITS);
846
847   fPtITSminPtTPCvsNPointTPCPhi = new TH3F("fPtITSminPtTPCvsNPointTPCPhi","PtITSminPtTPCvsNPointTPCPhi",fgkNResPtBins,binsResPt,fgkNNPointTPCBins,binsNPointTPC,fgkNPhiBins,binsPhi);
848   fPtITSminPtTPCvsNPointTPCPhi->SetXTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
849   fPtITSminPtTPCvsNPointTPCPhi->SetYTitle("N_{point,TPC}");
850   fPtITSminPtTPCvsNPointTPCPhi->SetZTitle("#phi");
851   fHistListITS->Add(fPtITSminPtTPCvsNPointTPCPhi);
852
853   fPtITSminPtTPCvsNPointITSPhi = new TH3F("fPtITSminPtTPCvsNPointITSPhi","PtITSminPtTPCvsNPointITSPhi",fgkNResPtBins,binsResPt,fgkNNPointITSBins,binsNPointITS,fgkNPhiBins,binsPhi);
854   fPtITSminPtTPCvsNPointITSPhi->SetXTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
855   fPtITSminPtTPCvsNPointITSPhi->SetYTitle("N_{point,ITS}");
856   fPtITSminPtTPCvsNPointITSPhi->SetZTitle("#phi");
857   fHistListITS->Add(fPtITSminPtTPCvsNPointITSPhi);
858
859   fPtITSminPtTPCvsRel1PtUncertaintyPhi = new TH3F("fPtITSminPtTPCvsRel1PtUncertaintyPhi","PtITSminPtTPCvsRel1PtUncertaintyPhi",fgkNResPtBins,binsResPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNPhiBins,binsPhi);
860   fPtITSminPtTPCvsRel1PtUncertaintyPhi->SetXTitle("(1/p_{t}^{Global}-1/p_{t}^{TPC})/(1/p_{t}^{Global})");
861   fPtITSminPtTPCvsRel1PtUncertaintyPhi->SetYTitle("Rel1PtUncertainty");
862   fPtITSminPtTPCvsRel1PtUncertaintyPhi->SetZTitle("#phi");
863   fHistListITS->Add(fPtITSminPtTPCvsRel1PtUncertaintyPhi);
864
865   fPtRel1PtUncertaintyChi2PerClusTPC = new TH3F("fPtRel1PtUncertaintyChi2PerClusTPC","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
866   fPtRel1PtUncertaintyChi2PerClusTPC->SetXTitle("p_{t}^{global}");
867   fPtRel1PtUncertaintyChi2PerClusTPC->SetYTitle("Rel1PtUncertainty");
868   fPtRel1PtUncertaintyChi2PerClusTPC->SetZTitle("#chi^{2}/(2*N_{clusters}^{TPC}-5)");
869   fHistListITS->Add(fPtRel1PtUncertaintyChi2PerClusTPC);
870
871   fPtNPointTPCSChi2PerClusTPC = new TH3F("fPtNPointTPCSChi2PerClusTPC","PtITSminPtTPCvsPtITSNPointTPCS",fgkNPtBins, binsPt,fgkNNPointTPCSBins,binsNPointTPCS,fgkNChi2PerClusBins,binsChi2PerClus);
872   fPtNPointTPCSChi2PerClusTPC->SetXTitle("p_{t}^{global}");
873   fPtNPointTPCSChi2PerClusTPC->SetYTitle("N_{Point,TPC}^{Shared}/N_{Point,TPC}");
874   fPtNPointTPCSChi2PerClusTPC->SetZTitle("#chi^{2}/(2*N_{clusters}^{TPC}-5)");
875   fHistListITS->Add(fPtNPointTPCSChi2PerClusTPC);
876
877   fPtNPointTPCSRel1PtUncertainty = new TH3F("fPtNPointTPCSRel1PtUncertainty","PtITSminPtTPCvsPtITSNPointTPCS",fgkNPtBins, binsPt,fgkNNPointTPCSBins,binsNPointTPCS,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
878   fPtNPointTPCSRel1PtUncertainty->SetXTitle("p_{t}^{global}");
879   fPtNPointTPCSRel1PtUncertainty->SetYTitle("N_{Point,TPC}^{Shared}/N_{Point,TPC}");
880   fPtNPointTPCSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
881   fHistListITS->Add(fPtNPointTPCSRel1PtUncertainty);
882
883   fPtRel1PtUncertaintyChi2PerClusTPCSharedSel = new TH3F("fPtRel1PtUncertaintyChi2PerClusTPCSharedSel","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
884   fPtRel1PtUncertaintyChi2PerClusTPCSharedSel->SetXTitle("p_{t}^{global}");
885   fPtRel1PtUncertaintyChi2PerClusTPCSharedSel->SetYTitle("Rel1PtUncertainty");
886   fPtRel1PtUncertaintyChi2PerClusTPCSharedSel->SetZTitle("#chi^{2}/(2*N_{clusters}^{TPC}-5)");
887   fHistListITS->Add(fPtRel1PtUncertaintyChi2PerClusTPCSharedSel);
888   
889   fPtAllTPC = new TH1F("fPtAllTPC","PtAll",fgkNPtBins,binsPt);
890   fHistListTPC->Add(fPtAllTPC);
891   fPtSelTPC = new TH1F("fPtSelTPC","PtSel",fgkNPtBins,binsPt);
892   fHistListTPC->Add(fPtSelTPC);
893   fPtSelTPCITS = new TH1F("fPtSelTPCITS","PtSel",fgkNPtBins,binsPt);
894   fHistListTPC->Add(fPtSelTPCITS);
895
896   //****************************************************************************************************************//
897   //                                              Cosmic Candidates                                                 //
898   //****************************************************************************************************************//
899   fPtSignedCosmicCandidates = new TH1F("fPtSignedCosmicCandidates","fPtSignedCosmicCandidates",2*(int)(fgkPtMax-fgkPtMin), -1.*fgkPtMax, fgkPtMax);
900   fHistListCosmics->Add(fPtSignedCosmicCandidates);  
901   fDeltaPtCosmicCandidates = new TH1F("fDeltaPtCosmicCandidates","fDeltaPtCosmicCandidates",fgkNPtBins, -50., 50.);
902   fHistListCosmics->Add(fDeltaPtCosmicCandidates);  
903   fDeltaPhiSumEta = new TH2F("fDeltaPhiSumEta","fDeltaPhiSumEta",fgkNPhiBins*4,0.,kMaxPhi,80, -2.,2.);
904   fHistListCosmics->Add(fDeltaPhiSumEta);  
905   fDCAZCosmicCandidates = new TH2F("fDCAZCosmicCandidates","fDCAZCosmicCandidates",fgkNDCAZBins,binsDCAZ,fgkNDCAZBins,binsDCAZ);
906   fHistListCosmics->Add(fDCAZCosmicCandidates);
907   fDCARCosmicCandidates = new TH2F("fDCARCosmicCandidates","fDCARCosmicCandidates",fgkNDCARBins,binsDCAR,fgkNDCARBins,binsDCAR);
908   fHistListCosmics->Add(fDCARCosmicCandidates);
909   fTheta = new TH1F("fTheta","fTheta",fgkNPhiBins*8,0.,kMaxPhi);
910   fHistListCosmics->Add(fTheta);
911   fThetaZoom = new TH1F("fThetaZoom","fThetaZoom",100,TMath::Pi()-1.,TMath::Pi()+1.);
912   fHistListCosmics->Add(fThetaZoom);
913   fThetaPt1Pt2 = new TH3F("fThetaPt1Pt2","fThetaPt1Pt2",fgkNPhiBins*8,0.,kMaxPhi,(int)(fgkPtMax-fgkPtMin),fgkPtMin,fgkPtMax,(int)(fgkPtMax-fgkPtMin),fgkPtMin,fgkPtMax);
914   fHistListCosmics->Add(fThetaPt1Pt2);
915   fDeltaPhiSumEtaPt1 = new TH3F("fDeltaPhiSumEtaPt1","fDeltaPhiSumEtaPt1",fgkNPhiBins*4,0.,kMaxPhi,80, -2.,2.,(int)(fgkPtMax-fgkPtMin),fgkPtMin,fgkPtMax);
916   fHistListCosmics->Add(fDeltaPhiSumEtaPt1);
917   fDeltaPhiSumEtaPt2 = new TH3F("fDeltaPhiSumEtaPt2","fDeltaPhiSumEtaPt2",fgkNPhiBins*4,0.,kMaxPhi,80, -2.,2.,(int)(fgkPtMax-fgkPtMin),fgkPtMin,fgkPtMax);
918   fHistListCosmics->Add(fDeltaPhiSumEtaPt2);
919   fThetaDCAZ1DCAZ2 = new TH3F("fThetaDCAZ1DCAZ2","fThetaDCAZ1DCAZ2",fgkNPhiBins*8,0.,kMaxPhi,fgkNDCAZBins,-2.,2.,fgkNDCAZBins,-2.,2.);
920   fHistListCosmics->Add(fThetaDCAZ1DCAZ2);
921
922   TH1::AddDirectory(oldStatus);   
923
924   if(binsPhi) delete [] binsPhi;
925   if(binsChi2PerClus) delete [] binsChi2PerClus;
926   if(binsPt) delete [] binsPt;
927   if(binsResPt) delete [] binsResPt;
928   if(binsNPointTPC) delete [] binsNPointTPC;
929   if(binsNPointTPCS) delete [] binsNPointTPCS;
930   if(binsDCAR) delete [] binsDCAR;
931   if(binsDCAZ) delete [] binsDCAZ;
932   if(binsNPointITS) delete [] binsNPointITS;
933   if(binsNSigmaToVertex) delete [] binsNSigmaToVertex;
934   if(binsChi2C) delete [] binsChi2C;
935   if(binsEta) delete [] binsEta;
936   if(binsRel1PtUncertainty) delete [] binsRel1PtUncertainty;
937
938
939 }
940 //________________________________________________________________________
941 void AliPWG4HighPtQATPConly::Exec(Option_t *) {  
942   // Main loop
943   // Called for each event
944   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::Exec \n"));  
945
946   // All events without selection
947   fNEventAll->Fill(0.);
948
949   if (!fESD) {
950     AliDebug(2,Form("ERROR: fESD not available"));
951     // Post output data
952      PostData(0, fHistList);
953      PostData(1, fHistListTPC);
954      PostData(2, fHistListITS);
955      PostData(3, fHistListCosmics);
956     return;
957   }
958
959 //   fESD->SetESDfriend(fESDfriend); //Attach the friend to the ESD
960 //   if (!fESDfriend) {
961 //     AliDebug(2,Form("ERROR: fESDfriend not available"));
962 //     // Post output data
963 //      PostData(0, fHistList);
964 //      PostData(1, fHistListTPC);
965 //      PostData(2, fHistListITS);
966 //      PostData(3, fHistListCosmics);
967 //     return;
968 //   }
969
970   Bool_t isSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
971   if(!isSelected) { //Select collison candidates
972     AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
973     // Post output data
974      PostData(0, fHistList);
975      PostData(1, fHistListTPC);
976      PostData(2, fHistListITS);
977      PostData(3, fHistListCosmics);
978     return;
979   }
980
981   //  AliMCEventHandler *eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
982 //   //  AliMCEventHandler* eventHandler = (AliMCEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
983   
984   AliStack* stack = 0x0;
985   AliMCEvent* mcEvent = 0x0;
986   
987   if(fMC) {
988     mcEvent = fMC;
989     if (!mcEvent) {
990       AliDebug(2,Form("ERROR: Could not retrieve MC event"));
991       PostData(0, fHistList);
992       PostData(1, fHistListTPC);
993       PostData(2, fHistListITS);
994       PostData(3, fHistListCosmics);
995       return;
996     }
997     
998     AliDebug(2,Form("MC particles: %d", mcEvent->GetNumberOfTracks()));
999     
1000     stack = mcEvent->Stack();                //Particles Stack
1001     
1002     AliDebug(2,Form("MC particles stack: %d", stack->GetNtrack()));
1003   }
1004   
1005
1006  const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks();
1007  if(vertex->GetNContributors()<1) {
1008    // SPD vertex
1009    vertex = fESD->GetPrimaryVertexSPD();
1010    if(vertex->GetNContributors()<1) vertex = 0x0;
1011  }
1012
1013   const AliESDVertex *vtx = fESD->GetPrimaryVertexTracks();
1014   // Need vertex cut
1015   if (vtx->GetNContributors() < 2) {
1016     // SPD vertex
1017     vtx = fESD->GetPrimaryVertexSPD();
1018     if(vtx->GetNContributors()<2) {
1019       vertex = 0x0;
1020       // Post output data
1021       PostData(0, fHistList);
1022       PostData(1, fHistListTPC);
1023       PostData(2, fHistListITS);
1024       PostData(3, fHistListCosmics);
1025       return;
1026     }
1027   }
1028
1029   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
1030   double primVtx[3];
1031   vtx->GetXYZ(primVtx);
1032   //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
1033   if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
1034     // Post output data
1035     PostData(0, fHistList);
1036     PostData(1, fHistListTPC);
1037     PostData(2, fHistListITS);
1038     PostData(3, fHistListCosmics);
1039     return;
1040   }
1041   if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2){ 
1042     // Post output data
1043     PostData(0, fHistList);
1044     PostData(1, fHistListTPC);
1045     PostData(2, fHistListITS);
1046     PostData(3, fHistListCosmics);
1047     return;
1048   }
1049   Int_t nTracks = fESD->GetNumberOfTracks();
1050   AliDebug(2,Form("nTracks %d\n", nTracks));
1051
1052   if(!fTrackCuts) {
1053    // Post output data
1054     PostData(0, fHistList);
1055     PostData(1, fHistListTPC);
1056     PostData(2, fHistListITS);
1057     PostData(3, fHistListCosmics);
1058     return;
1059   }
1060
1061   // Selected events for analysis
1062   fNEventSel->Fill(0.);
1063
1064   for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
1065
1066     AliESDtrack *track = fESD->GetTrack(iTrack);
1067     AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
1068     if(!track || !trackTPC) continue;
1069
1070     const AliESDfriendTrack* constfriendtrack = track->GetFriendTrack();
1071     //if (!constfriendtrack) { continue;}
1072     //    AliESDfriendTrack friendtrack(*constfriendtrack);
1073  
1074     Float_t pt = track->Pt();
1075     Float_t ptTPC = trackTPC->Pt();
1076     Float_t phi = track->Phi();
1077     Float_t dca2D, dcaZ;
1078     track->GetImpactParameters(dca2D,dcaZ);
1079     // Float_t dca2DTPC, dcaZTPC;
1080     //track->GetImpactParametersTPC(dca2DTPC,dcaZTPC);
1081     UChar_t itsMap = track->GetITSClusterMap();
1082     Int_t nPointITS = 0;
1083     for (Int_t i=0; i < 6; i++) {
1084       if (itsMap & (1 << i))
1085         nPointITS ++;
1086     }
1087     double mom[3];
1088     track->GetPxPyPz(mom);
1089     double momTPC[3];
1090     trackTPC->GetPxPyPz(momTPC);
1091     Float_t nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track.
1092     Float_t chi2C = track->GetConstrainedChi2();
1093     Float_t relUncertainty1Pt = TMath::Sqrt(TMath::Abs(track->GetSigma1Pt2()))*pt;
1094     Float_t chi2PerClusterTPC = -1.;
1095     Float_t nClustersTPC = track->GetTPCNcls();
1096     if(nClustersTPC>0.) chi2PerClusterTPC = track->GetTPCchi2()/(2.*nClustersTPC-5.);
1097     Float_t chi2PerNPointITS = -1.;
1098     if(nPointITS>3) chi2PerNPointITS = track->GetITSchi2()/(2.*(float)nPointITS-5.);
1099
1100     fPtAll->Fill(pt);
1101     fPtAllTPC->Fill(ptTPC);
1102
1103     Bool_t cosmic = kFALSE;    
1104     if(GetCutType()==2) { if(pt>6.) { cosmic = IsCosmic(track,iTrack,4.); } }
1105
1106     if (fTrackCuts->AcceptTrack(track)) {
1107       if(GetCutType()==1) {   if(pt>6.) { cosmic = IsCosmic(track,iTrack,4.); } }
1108       //    if(cosmic) continue;
1109
1110       fPtSel->Fill(pt);
1111       fPtSelTPC->Fill(ptTPC);
1112       if(ptTPC==0. || pt==0.) continue;
1113       fPtAllminPtTPCvsPtAll->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
1114
1115       if(track->GetSign()>0.) fPtAllminPtTPCvsPtAllEtaPos->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->Eta());
1116       if(track->GetSign()<0.) fPtAllminPtTPCvsPtAllEtaNeg->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->Eta());
1117
1118       fPtAllminPtTPCvsPtAllNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nClustersTPC);
1119       if(nClustersTPC>0.) fPtAllminPtTPCvsPtAllNPointTPCS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCnclsS()/nClustersTPC);
1120       fPtAllminPtTPCvsPtAllDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
1121       fPtAllminPtTPCvsPtAllDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
1122       fPtAllminPtTPCvsPtAllPhi->Fill(pt,(1./pt-1./ptTPC)/(1./pt),phi);
1123       fPtAllminPtTPCvsPtAllNPointITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nPointITS);
1124       fPtAllminPtTPCvsPtAllNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
1125       fPtAllminPtTPCvsPtAllChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
1126       fPtAllminPtTPCvsPtAllRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
1127       fPtAllminPtTPCvsPtAllChi2PerNClusTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerClusterTPC);
1128       if(nPointITS>3) fPtAllminPtTPCvsPtAllChi2PerNClusITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerNPointITS);
1129       fPtAllminPtTPCvsNPointTPCPhi->Fill((1./pt-1./ptTPC)/(1./pt),nClustersTPC,phi);
1130       fPtAllminPtTPCvsNPointITSPhi->Fill((1./pt-1./ptTPC)/(1./pt),nPointITS,phi);
1131       fPtAllminPtTPCvsRel1PtUncertaintyPhi->Fill((1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt,phi);
1132
1133       if(TMath::Abs((1./pt-1./ptTPC)/(1./pt))>0.8) fEtaPhiOutliers->Fill(track->Eta(),phi);
1134       
1135       if (constfriendtrack) { 
1136         AliESDfriendTrack friendtrack(*constfriendtrack);
1137         if (friendtrack.GetITSOut()) {
1138           AliExternalTrackParam trackITSouter(*(friendtrack.GetITSOut())); 
1139           Float_t ptITSouter = trackITSouter.Pt();
1140           if(ptITSouter==0.) continue;
1141           fPtSelITSouter->Fill(ptITSouter);
1142           fPtITSouterminPtTPCvsPtAll->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter) );
1143
1144           if(trackITSouter.GetSign()>0.) fPtITSouterminPtTPCvsPtAllEtaPos->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),trackITSouter.Eta());
1145           if(trackITSouter.GetSign()<0.) fPtITSouterminPtTPCvsPtAllEtaNeg->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),trackITSouter.Eta());
1146
1147           fPtITSouterminPtTPCvsPtAllNPointTPC->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),nClustersTPC);
1148           if(nClustersTPC>0.) fPtITSouterminPtTPCvsPtAllNPointTPCS->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),track->GetTPCnclsS()/nClustersTPC);
1149           fPtITSouterminPtTPCvsPtAllDCAR->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),dca2D);
1150           fPtITSouterminPtTPCvsPtAllDCAZ->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),dcaZ);
1151           fPtITSouterminPtTPCvsPtAllPhi->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),phi);
1152           fPtITSouterminPtTPCvsPtAllNPointITS->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),nPointITS);
1153           fPtITSouterminPtTPCvsPtAllNSigmaToVertex->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),nSigmaToVertex);
1154           fPtITSouterminPtTPCvsPtAllChi2C->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2C);
1155           fPtITSouterminPtTPCvsPtAllRel1PtUncertainty->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),relUncertainty1Pt);
1156           fPtITSouterminPtTPCvsPtAllChi2PerNClusTPC->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerClusterTPC);
1157           if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITS->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1158           if(track->HasPointOnITSLayer(0)) {
1159             fPtITSouterminPtTPCvsPtAllITSLayer0->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1160             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer0->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1161           }
1162           if(!track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)) {
1163             fPtITSouterminPtTPCvsPtAllITSLayer1->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1164             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer1->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1165           }
1166           if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && track->HasPointOnITSLayer(2)) {
1167             fPtITSouterminPtTPCvsPtAllITSLayer2->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1168             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer2->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1169           }
1170           if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && !track->HasPointOnITSLayer(2) && track->HasPointOnITSLayer(3)) {
1171             fPtITSouterminPtTPCvsPtAllITSLayer3->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1172             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer3->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1173           }
1174           if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && !track->HasPointOnITSLayer(2) && !track->HasPointOnITSLayer(3) && track->HasPointOnITSLayer(4)) {
1175             fPtITSouterminPtTPCvsPtAllITSLayer4->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1176             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer4->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1177           }
1178           if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1) && !track->HasPointOnITSLayer(2) && !track->HasPointOnITSLayer(3) && !track->HasPointOnITSLayer(4) && track->HasPointOnITSLayer(5)) {
1179             fPtITSouterminPtTPCvsPtAllITSLayer5->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1180             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSLayer5->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1181           }
1182
1183           if(!track->HasPointOnITSLayer(0) && !track->HasPointOnITSLayer(1)) {
1184             fPtITSouterminPtTPCvsPtAllNoSPD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1185             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSPD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1186           }
1187           if(!track->HasPointOnITSLayer(2) && !track->HasPointOnITSLayer(3)) {
1188             fPtITSouterminPtTPCvsPtAllNoSDD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1189             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSDD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1190           }
1191           if(!track->HasPointOnITSLayer(4) && !track->HasPointOnITSLayer(5)) {
1192             fPtITSouterminPtTPCvsPtAllNoSSD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter));
1193             if(nPointITS>3) fPtITSouterminPtTPCvsPtAllChi2PerNClusITSNoSSD->Fill(pt,(1./ptITSouter-1./ptTPC)/(1./ptITSouter),chi2PerNPointITS);
1194           }
1195         }
1196       }
1197     }//fTrackCuts selection
1198     
1199     
1200     //ITSrefit selection
1201     if (fTrackCutsITS->AcceptTrack(track)) {
1202       
1203       fPtSelITS->Fill(pt);
1204       fPtSelTPCITS->Fill(ptTPC);
1205       fPtITSminPtTPCvsPtITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
1206       if(track->GetSign()>0.) fPtITSminPtTPCvsPtITSEtaPos->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->Eta());
1207       if(track->GetSign()<0.) fPtITSminPtTPCvsPtITSEtaNeg->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->Eta());
1208       fPtITSminPtTPCvsPtITSNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nClustersTPC);
1209       if(nClustersTPC>0.) fPtITSminPtTPCvsPtITSNPointTPCS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCnclsS()/nClustersTPC);
1210       fPtITSminPtTPCvsPtITSDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
1211       fPtITSminPtTPCvsPtITSDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
1212       fPtITSminPtTPCvsPtITSPhi->Fill(pt,(1./pt-1./ptTPC)/(1./pt),phi);
1213       fPtITSminPtTPCvsPtITSNPointITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nPointITS);
1214       fPtITSminPtTPCvsPtITSNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
1215       fPtITSminPtTPCvsPtITSChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
1216       fPtITSminPtTPCvsPtITSRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
1217       fPtITSminPtTPCvsPtITSChi2PerNClusTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerClusterTPC);
1218       if(nPointITS>3) fPtITSminPtTPCvsPtITSChi2PerNClusITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2PerNPointITS);
1219       fPtITSminPtTPCvsNPointTPCPhi->Fill((1./pt-1./ptTPC)/(1./pt),nClustersTPC,phi);
1220       fPtITSminPtTPCvsNPointITSPhi->Fill((1./pt-1./ptTPC)/(1./pt),nPointITS,phi);
1221       fPtITSminPtTPCvsRel1PtUncertaintyPhi->Fill((1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt,phi);
1222
1223       fPtRel1PtUncertaintyChi2PerClusTPC->Fill(pt,relUncertainty1Pt,chi2PerClusterTPC);
1224       fPtNPointTPCSChi2PerClusTPC->Fill(pt,track->GetTPCnclsS()/nClustersTPC,chi2PerClusterTPC);
1225       fPtNPointTPCSRel1PtUncertainty->Fill(pt,track->GetTPCnclsS()/nClustersTPC,relUncertainty1Pt);
1226       if(track->GetTPCnclsS()/nClustersTPC>0.05) fPtRel1PtUncertaintyChi2PerClusTPCSharedSel->Fill(pt,relUncertainty1Pt,chi2PerClusterTPC);
1227     }//fTrackCutsITS loop
1228       
1229   }//ESD track loop
1230    
1231   // Post output data
1232   PostData(0, fHistList);
1233   PostData(1, fHistListTPC);
1234   PostData(2, fHistListITS);
1235   PostData(3, fHistListCosmics);
1236
1237 }
1238 //________________________________________________________________________
1239 Bool_t AliPWG4HighPtQATPConly::IsCosmic(const AliESDtrack *track1 , Int_t trackNumber, Double_t ptMin)
1240 {
1241   Bool_t candidate1 = kFALSE;
1242   Bool_t candidate2 = kFALSE;
1243   if(!track1) return candidate1;
1244
1245   Int_t nTracks = fESD->GetNumberOfTracks();
1246
1247   Float_t dcaR[2] = {0.,0.};
1248   Float_t dcaZ[2] = {0.,0.};
1249  
1250   for (Int_t iTrack2 = trackNumber+1; iTrack2 < nTracks; iTrack2++) {
1251     candidate2 = kFALSE;
1252     AliESDtrack *track2 = fESD->GetTrack(iTrack2);
1253     if(!track2) continue;
1254     if(GetCutType()==1 && !(fTrackCuts->AcceptTrack(track2))) { continue; }
1255     if(track2->Pt()<ptMin) continue;
1256     
1257     //Check if same charge. If not same charge, pair is cosmic candidate
1258     //Removed condition for time being. Not so clear how well we can measure curvature at high momenta
1259     // if( (track1->GetSign()*track2->GetSign()) > 0. ) continue;
1260     
1261     //Check if back-to-back
1262     Double_t mom1[3],mom2[3];
1263     track1->GetPxPyPz(mom1);
1264     track2->GetPxPyPz(mom2);
1265     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]) );
1266     Double_t theta = TMath::ACos(cosTheta);
1267     if(cosTheta<0.) theta+=TMath::Pi();
1268    //if(TMath::Abs(TMath::Pi()-theta)<fMaxCosmicAngle) { candidate1 = kTRUE; candidate2 = kTRUE;}
1269     
1270 //    Double_t cosMaxCosmicAngle[2] = {TMath::Cos(TMath::Pi()-fMaxCosmicAngle),TMath::Cos(TMath::Pi()+fMaxCosmicAngle)};
1271 //    if(cosTheta >= cosMaxCosmicAngle[0] && cosTheta <= cosMaxCosmicAngle[1]) { 
1272     candidate1 = kTRUE; candidate2 = kTRUE;//}
1273     if(candidate2) {
1274       fDeltaPtCosmicCandidates->Fill(track1->Pt()-track2->Pt());
1275       Float_t deltaPhi = track1->Phi()-track2->Phi();
1276       if(deltaPhi<0.) deltaPhi+=2.*TMath::Pi();
1277       fDeltaPhiSumEta->Fill(deltaPhi,track1->Eta()+track2->Eta());
1278
1279       track1->GetImpactParameters(dcaR[0],dcaZ[0]);
1280       track2->GetImpactParameters(dcaR[1],dcaZ[1]);
1281       fDCAZCosmicCandidates->Fill(dcaZ[0],dcaZ[1]);
1282       fDCARCosmicCandidates->Fill(dcaR[0],dcaR[1]);
1283       fTheta->Fill(theta);
1284       fThetaZoom->Fill(theta);
1285       fThetaPt1Pt2->Fill(theta,track1->Pt(),track2->Pt());
1286       fDeltaPhiSumEtaPt1->Fill(deltaPhi,track1->Eta()+track2->Eta(),track1->Pt());
1287       fDeltaPhiSumEtaPt2->Fill(deltaPhi,track1->Eta()+track2->Eta(),track2->Pt());
1288       fThetaDCAZ1DCAZ2->Fill(theta,dcaZ[0],dcaZ[1]);
1289     }
1290
1291   }
1292
1293   if(candidate1) {
1294     fPtSignedCosmicCandidates->Fill(track1->GetSign()*track1->Pt());
1295   }
1296
1297    return candidate1;
1298 }
1299
1300 //________________________________________________________________________
1301 void AliPWG4HighPtQATPConly::Terminate(Option_t *)
1302 {
1303
1304 }
1305
1306 #endif