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