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