1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-----------------------------------------------------------------------
17 // This class stores QA variables as function of pT for different type
18 // of tracks and track selection criteria
19 // Output: Histograms for different set of cuts
20 //-----------------------------------------------------------------------
21 // Author : M. Verweij - UU
22 //-----------------------------------------------------------------------
24 #ifndef ALIPWG4HIGHPTTRACKQA_CXX
25 #define ALIPWG4HIGHPTTRACKQA_CXX
27 #include "AliPWG4HighPtTrackQA.h"
41 #include "AliAnalysisManager.h"
42 #include "AliESDInputHandler.h"
43 #include "AliMCEvent.h"
44 #include "AliMCEventHandler.h"
46 #include "AliESDtrack.h"
47 #include "AliESDtrackCuts.h"
48 #include "AliExternalTrackParam.h"
50 #include "AliGenPythiaEventHeader.h"
51 #include "AliGenCocktailEventHeader.h"
52 #include "AliCentrality.h"
53 #include "AliAODVertex.h"
54 #include "AliAODEvent.h"
56 using namespace std; //required for resolving the 'cout' symbol
58 ClassImp(AliPWG4HighPtTrackQA)
60 AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA()
61 : AliAnalysisTaskSE(),
68 fTrackCutsITSLoose(0x0),
69 fTrackCutsTPConly(0x0),
72 fIncludeNoITS(kFALSE),
73 fSigmaConstrainedMax(-1.),
90 fh1NTracksReject(0x0),
100 fPtNClustersTPCIter1(0x0),
101 fPtNClustersTPCIter1Phi(0x0),
102 fPtNClustersTPCShared(0x0),
103 fPtNClustersTPCSharedFrac(0x0),
105 fPtNPointITSPhi(0x0),
107 fPtNSigmaToVertex(0x0),
108 fPtRelUncertainty1Pt(0x0),
109 fPtRelUncertainty1PtNClus(0x0),
110 fPtRelUncertainty1PtNClusIter1(0x0),
111 fPtRelUncertainty1PtNPointITS(0x0),
112 fPtRelUncertainty1PtITSClusterMap(0x0),
113 fPtRelUncertainty1PtChi2(0x0),
114 fPtRelUncertainty1PtChi2Iter1(0x0),
115 fPtRelUncertainty1PtPhi(0x0),
116 fPtChi2PerClusterTPC(0x0),
117 fPtChi2PerClusterTPCIter1(0x0),
118 fPtNCrossedRows(0x0),
119 fPtNCrossedRowsPhi(0x0),
120 fPtNCrossedRowsNClusFPhi(0x0),
121 fPtNCrRNCrRNClusF(0x0),
122 fPtNCrossedRowsFit(0x0),
123 fPtNCrossedRowsFitPhi(0x0),
124 fPtNCrossedRowsNClusFFitPhi(0x0),
125 fNCrossedRowsNCrossedRowsFit(0x0),
126 fNClustersNCrossedRows(0x0),
127 fNClustersNCrossedRowsFit(0x0),
128 fPtNClustersNClustersFitMap(0x0),
129 fPtRelUncertainty1PtNCrossedRows(0x0),
130 fPtRelUncertainty1PtNCrossedRowsFit(0x0),
135 fChi2GoldChi2GGC(0x0),
144 fProfPtSigmaSnp2(0x0),
145 fProfPtSigmaTgl2(0x0),
146 fProfPtSigma1Pt2(0x0),
147 fProfPtSigma1Pt(0x0),
148 fProfPtPtSigma1Pt(0x0),
156 fPtBinEdges[0][0] = 10.;
157 fPtBinEdges[0][1] = 1.;
158 fPtBinEdges[1][0] = 20.;
159 fPtBinEdges[1][1] = 2.;
160 fPtBinEdges[2][0] = 100.;
161 fPtBinEdges[2][1] = 5.;
164 //________________________________________________________________________
165 AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name):
166 AliAnalysisTaskSE(name),
173 fTrackCutsITSLoose(0x0),
174 fTrackCutsTPConly(0x0),
177 fIncludeNoITS(kFALSE),
178 fSigmaConstrainedMax(-1.),
195 fh1NTracksReject(0x0),
204 fPtNClustersTPC(0x0),
205 fPtNClustersTPCIter1(0x0),
206 fPtNClustersTPCIter1Phi(0x0),
207 fPtNClustersTPCShared(0x0),
208 fPtNClustersTPCSharedFrac(0x0),
210 fPtNPointITSPhi(0x0),
212 fPtNSigmaToVertex(0x0),
213 fPtRelUncertainty1Pt(0x0),
214 fPtRelUncertainty1PtNClus(0x0),
215 fPtRelUncertainty1PtNClusIter1(0x0),
216 fPtRelUncertainty1PtNPointITS(0x0),
217 fPtRelUncertainty1PtITSClusterMap(0x0),
218 fPtRelUncertainty1PtChi2(0x0),
219 fPtRelUncertainty1PtChi2Iter1(0x0),
220 fPtRelUncertainty1PtPhi(0x0),
221 fPtChi2PerClusterTPC(0x0),
222 fPtChi2PerClusterTPCIter1(0x0),
223 fPtNCrossedRows(0x0),
224 fPtNCrossedRowsPhi(0x0),
225 fPtNCrossedRowsNClusFPhi(0x0),
226 fPtNCrRNCrRNClusF(0x0),
227 fPtNCrossedRowsFit(0x0),
228 fPtNCrossedRowsFitPhi(0x0),
229 fPtNCrossedRowsNClusFFitPhi(0x0),
230 fNCrossedRowsNCrossedRowsFit(0x0),
231 fNClustersNCrossedRows(0x0),
232 fNClustersNCrossedRowsFit(0x0),
233 fPtNClustersNClustersFitMap(0x0),
234 fPtRelUncertainty1PtNCrossedRows(0x0),
235 fPtRelUncertainty1PtNCrossedRowsFit(0x0),
240 fChi2GoldChi2GGC(0x0),
249 fProfPtSigmaSnp2(0x0),
250 fProfPtSigmaTgl2(0x0),
251 fProfPtSigma1Pt2(0x0),
252 fProfPtSigma1Pt(0x0),
253 fProfPtPtSigma1Pt(0x0),
257 // Constructor. Initialization of Inputs and Outputs
259 AliDebug(2,Form("AliPWG4HighPtTrackQA Calling Constructor"));
263 fPtBinEdges[0][0] = 10.;
264 fPtBinEdges[0][1] = 1.;
265 fPtBinEdges[1][0] = 20.;
266 fPtBinEdges[1][1] = 2.;
267 fPtBinEdges[2][0] = 100.;
268 fPtBinEdges[2][1] = 5.;
270 // Input slot #0 works with a TChain ESD
271 DefineInput(0, TChain::Class());
272 // Output slot #1 write into a TList
273 DefineOutput(1, TList::Class());
276 //________________________________________________________________________
277 void AliPWG4HighPtTrackQA::SetPtBinEdges(Int_t region, Double_t ptmax, Double_t ptBinWidth) {
279 // Set variable bin sizes for pT axis in histos
283 fPtBinEdges[region][0] = ptmax;
284 fPtBinEdges[region][1] = ptBinWidth;
287 AliError("Only 3 regions alowed. Use region 0/1/2\n");
293 //________________________________________________________________________
294 void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
295 //Create output objects
296 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserCreateOutputObjects \n"));
298 Bool_t oldStatus = TH1::AddDirectoryStatus();
299 TH1::AddDirectory(kFALSE);
302 fHistList = new TList();
303 fHistList->SetOwner(kTRUE);
305 Float_t fgkPtMin = 0.;
306 // Float_t fgkPtMax = fPtMax;
308 //fPtBinEdges[region][0] = ptmax of region ; fPtBinEdges[region][1] = binWidth of region
309 const Float_t ptmin1 = fgkPtMin;
310 const Float_t ptmax1 = fPtBinEdges[0][0];
311 const Float_t ptmin2 = ptmax1 ;
312 const Float_t ptmax2 = fPtBinEdges[1][0];
313 const Float_t ptmin3 = ptmax2 ;
314 const Float_t ptmax3 = fPtBinEdges[2][0];//fgkPtMax;
315 const Int_t nbin11 = (int)((ptmax1-ptmin1)/fPtBinEdges[0][1]);
316 const Int_t nbin12 = (int)((ptmax2-ptmin2)/fPtBinEdges[1][1])+nbin11;
317 const Int_t nbin13 = (int)((ptmax3-ptmin3)/fPtBinEdges[2][1])+nbin12;
318 Int_t fgkNPtBins=nbin13;
319 //Create array with low edges of each bin
320 Double_t *binsPt=new Double_t[fgkNPtBins+1];
321 for(Int_t i=0; i<=fgkNPtBins; i++) {
322 if(i<=nbin11) binsPt[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;
323 if(i<=nbin12 && i>nbin11) binsPt[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
324 if(i<=nbin13 && i>nbin12) binsPt[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
327 Int_t fgkNPhiBins = 18*6;
328 Float_t kMinPhi = 0.;
329 Float_t kMaxPhi = 2.*TMath::Pi();
330 Double_t *binsPhi = new Double_t[fgkNPhiBins+1];
331 for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ;
333 Int_t fgkNEtaBins=20;
334 Float_t fgkEtaMin = -1.;
335 Float_t fgkEtaMax = 1.;
336 Double_t *binsEta=new Double_t[fgkNEtaBins+1];
337 for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ;
339 Int_t fgkNNClustersTPCBins=80;
340 Float_t fgkNClustersTPCMin = 0.5;
341 Float_t fgkNClustersTPCMax = 160.5;
342 Double_t *binsNClustersTPC=new Double_t[fgkNNClustersTPCBins+1];
343 for(Int_t i=0; i<=fgkNNClustersTPCBins; i++) binsNClustersTPC[i]=(Double_t)fgkNClustersTPCMin + (fgkNClustersTPCMax-fgkNClustersTPCMin)/fgkNNClustersTPCBins*(Double_t)i ;
345 Int_t fgkNDCA2DBins=80;
346 Float_t fgkDCA2DMin = -0.2;
347 Float_t fgkDCA2DMax = 0.2;
348 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==7) {
352 Double_t *binsDCA2D=new Double_t[fgkNDCA2DBins+1];
353 for(Int_t i=0; i<=fgkNDCA2DBins; i++) binsDCA2D[i]=(Double_t)fgkDCA2DMin + (fgkDCA2DMax-fgkDCA2DMin)/fgkNDCA2DBins*(Double_t)i ;
355 Int_t fgkNDCAZBins=80;
356 Float_t fgkDCAZMin = -2.;
357 Float_t fgkDCAZMax = 2.;
358 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
362 Double_t *binsDCAZ=new Double_t[fgkNDCAZBins+1];
363 for(Int_t i=0; i<=fgkNDCAZBins; i++) binsDCAZ[i]=(Double_t)fgkDCAZMin + (fgkDCAZMax-fgkDCAZMin)/fgkNDCAZBins*(Double_t)i ;
365 Int_t fgkNNPointITSBins=9;
366 Float_t fgkNPointITSMin = -0.5;
367 Float_t fgkNPointITSMax = 8.5;
368 Double_t *binsNPointITS=new Double_t[fgkNNPointITSBins+1];
369 for(Int_t i=0; i<=fgkNNPointITSBins; i++) binsNPointITS[i]=(Double_t)fgkNPointITSMin + (fgkNPointITSMax-fgkNPointITSMin)/fgkNNPointITSBins*(Double_t)i ;
371 Int_t fgkNITSClusterMapBins=65;
372 Float_t fgkITSClusterMapMin = -0.5;
373 Float_t fgkITSClusterMapMax = 64.5;
374 Double_t *binsITSClusterMap=new Double_t[fgkNITSClusterMapBins+1];
375 for(Int_t i=0; i<=fgkNITSClusterMapBins; i++) binsITSClusterMap[i]=(Double_t)fgkITSClusterMapMin + (fgkITSClusterMapMax-fgkITSClusterMapMin)/fgkNITSClusterMapBins*(Double_t)i ;
378 Int_t fgkNNSigmaToVertexBins=9;
379 Float_t fgkNSigmaToVertexMin = 0.;
380 Float_t fgkNSigmaToVertexMax = 9.;
381 Double_t *binsNSigmaToVertex=new Double_t[fgkNNSigmaToVertexBins+1];
382 for(Int_t i=0; i<=fgkNNSigmaToVertexBins; i++) binsNSigmaToVertex[i]=(Double_t)fgkNSigmaToVertexMin + (fgkNSigmaToVertexMax-fgkNSigmaToVertexMin)/fgkNNSigmaToVertexBins*(Double_t)i ;
384 Int_t fgkNChi2CBins=10;
385 // Float_t fgkChi2CMin = 0.;
386 // Float_t fgkChi2CMax = 100.; //10 sigma
387 Double_t *binsChi2C=new Double_t[fgkNChi2CBins+1];
388 for(Int_t i=0; i<=fgkNChi2CBins; i++) binsChi2C[i] = (Double_t)i * (Double_t)i;
390 Float_t fgkRel1PtUncertaintyMin = 0.;
391 Float_t fgkRel1PtUncertaintyMax = 1.;
392 Float_t binEdgeRel1PtUncertainty1= 0.3;
393 Int_t fgkNRel1PtUncertaintyBins1 = 45;
394 Float_t binWidthRel1PtUncertainty1 = (binEdgeRel1PtUncertainty1-fgkRel1PtUncertaintyMin)/((Float_t)fgkNRel1PtUncertaintyBins1);
395 Int_t fgkNRel1PtUncertaintyBins2 = 35;
396 Float_t binWidthRel1PtUncertainty2 = (fgkRel1PtUncertaintyMax-binEdgeRel1PtUncertainty1)/((Float_t)fgkNRel1PtUncertaintyBins2);
397 Int_t fgkNRel1PtUncertaintyBins = fgkNRel1PtUncertaintyBins1 + fgkNRel1PtUncertaintyBins2;
399 Double_t *binsRel1PtUncertainty=new Double_t[fgkNRel1PtUncertaintyBins+1];
400 for(Int_t i=0; i<=fgkNRel1PtUncertaintyBins; i++) {
401 if(i<=fgkNRel1PtUncertaintyBins1)
402 binsRel1PtUncertainty[i]=(Double_t)fgkRel1PtUncertaintyMin + (Double_t)binWidthRel1PtUncertainty1*(Double_t)i ;
403 if(i<=fgkNRel1PtUncertaintyBins && i>fgkNRel1PtUncertaintyBins1)
404 binsRel1PtUncertainty[i]=(Double_t)binEdgeRel1PtUncertainty1 + (Double_t)binWidthRel1PtUncertainty2*(Double_t)(i-fgkNRel1PtUncertaintyBins1);
407 Int_t fgkNUncertainty1PtBins = 30;
408 Float_t fgkUncertainty1PtMin = 0.;
409 Float_t fgkUncertainty1PtMax = 0.1;
410 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
411 fgkUncertainty1PtMax = 0.2;
412 Double_t *binsUncertainty1Pt=new Double_t[fgkNUncertainty1PtBins+1];
413 for(Int_t i=0; i<=fgkNUncertainty1PtBins; i++) binsUncertainty1Pt[i]=(Double_t)fgkUncertainty1PtMin + (fgkUncertainty1PtMax-fgkUncertainty1PtMin)/fgkNUncertainty1PtBins*(Double_t)i ;
415 Float_t fgkChi2PerClusMin = 0.;
416 Float_t fgkChi2PerClusMax = 4.;
417 Int_t fgkNChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
418 Double_t *binsChi2PerClus=new Double_t[fgkNChi2PerClusBins+1];
419 for(Int_t i=0; i<=fgkNChi2PerClusBins; i++) binsChi2PerClus[i]=(Double_t)fgkChi2PerClusMin + (fgkChi2PerClusMax-fgkChi2PerClusMin)/fgkNChi2PerClusBins*(Double_t)i ;
421 Int_t fgkNCrossedRowsNClusFBins = 45;
422 Float_t fgkNCrossedRowsNClusFMin = 0.;
423 Float_t fgkNCrossedRowsNClusFMax = 1.5;
424 Double_t *binsNCrossedRowsNClusF=new Double_t[fgkNCrossedRowsNClusFBins+1];
425 for(Int_t i=0; i<=fgkNCrossedRowsNClusFBins; i++) binsNCrossedRowsNClusF[i]=(Double_t)fgkNCrossedRowsNClusFMin + (fgkNCrossedRowsNClusFMax-fgkNCrossedRowsNClusFMin)/fgkNCrossedRowsNClusFBins*(Double_t)i ;
427 Float_t fgk1PtMin = 0.;
428 Float_t fgk1PtMax = 6.;
429 Float_t binEdge1Pt1 = 1.;
430 Float_t binWidth1Pt1 = 0.05;
431 Int_t fgkN1PtBins1 = (int)((binEdge1Pt1-fgk1PtMin)/binWidth1Pt1);
432 Float_t binWidth1Pt2 = 0.1;
433 Int_t fgkN1PtBins2 = (int)((fgk1PtMax-binEdge1Pt1)/binWidth1Pt2);
434 Int_t fgkN1PtBins = fgkN1PtBins1+fgkN1PtBins2;
435 Double_t *bins1Pt=new Double_t[fgkN1PtBins+1];
437 for(Int_t i=0; i<=fgkN1PtBins; i++) {
439 bins1Pt[i]=(Double_t)fgk1PtMin + (Double_t)(binEdge1Pt1-fgk1PtMin)/(Double_t)fgkN1PtBins1*(Double_t)i;
440 if(i<=fgkN1PtBins && i>fgkN1PtBins1)
441 bins1Pt[i]=(Double_t)binEdge1Pt1 + (Double_t)(fgk1PtMax-binEdge1Pt1)/(Double_t)fgkN1PtBins2*(Double_t)(i-fgkN1PtBins1);
444 Int_t fgkNSigmaY2Bins = 50;
445 Float_t fgkSigmaY2Min = 0.;
446 Float_t fgkSigmaY2Max = 1.;
447 if(fTrackType==1) fgkSigmaY2Max = 4.;
448 if(fTrackType==2 || fTrackType==4) fgkSigmaY2Max = 0.1;
449 Double_t *binsSigmaY2=new Double_t[fgkNSigmaY2Bins+1];
450 for(Int_t i=0; i<=fgkNSigmaY2Bins; i++) binsSigmaY2[i]=(Double_t)fgkSigmaY2Min + (fgkSigmaY2Max-fgkSigmaY2Min)/fgkNSigmaY2Bins*(Double_t)i ;
452 Int_t fgkNSigmaZ2Bins = 50;
453 Float_t fgkSigmaZ2Min = 0.;
454 Float_t fgkSigmaZ2Max = 0.4;
455 Double_t *binsSigmaZ2=new Double_t[fgkNSigmaZ2Bins+1];
456 for(Int_t i=0; i<=fgkNSigmaZ2Bins; i++) binsSigmaZ2[i]=(Double_t)fgkSigmaZ2Min + (fgkSigmaZ2Max-fgkSigmaZ2Min)/fgkNSigmaZ2Bins*(Double_t)i ;
458 Int_t fgkNSigmaSnp2Bins = 50;
459 Float_t fgkSigmaSnp2Min = 0.;
460 Float_t fgkSigmaSnp2Max = 0.05;
461 if(fTrackType==1) fgkSigmaSnp2Max = 0.2;
462 if(fTrackType==2 || fTrackType==4) fgkSigmaSnp2Max = 0.1;
463 Double_t *binsSigmaSnp2=new Double_t[fgkNSigmaSnp2Bins+1];
464 for(Int_t i=0; i<=fgkNSigmaSnp2Bins; i++) binsSigmaSnp2[i]=(Double_t)fgkSigmaSnp2Min + (fgkSigmaSnp2Max-fgkSigmaSnp2Min)/fgkNSigmaSnp2Bins*(Double_t)i ;
466 Int_t fgkNSigmaTgl2Bins = 50;
467 Float_t fgkSigmaTgl2Min = 0.;
468 Float_t fgkSigmaTgl2Max = 0.1;
469 if(fTrackType==1) fgkSigmaTgl2Max = 0.2;
470 if(fTrackType==2 || fTrackType==4) fgkSigmaTgl2Max = 0.1;
471 Double_t *binsSigmaTgl2=new Double_t[fgkNSigmaTgl2Bins+1];
472 for(Int_t i=0; i<=fgkNSigmaTgl2Bins; i++) binsSigmaTgl2[i]=(Double_t)fgkSigmaTgl2Min + (fgkSigmaTgl2Max-fgkSigmaTgl2Min)/fgkNSigmaTgl2Bins*(Double_t)i ;
474 Int_t fgkNSigma1Pt2Bins = 50;
475 Float_t fgkSigma1Pt2Min = 0.;
476 Float_t fgkSigma1Pt2Max = 1.;
477 Double_t *binsSigma1Pt2=new Double_t[fgkNSigma1Pt2Bins+1];
478 for(Int_t i=0; i<=fgkNSigma1Pt2Bins; i++) binsSigma1Pt2[i]=(Double_t)fgkSigma1Pt2Min + (fgkSigma1Pt2Max-fgkSigma1Pt2Min)/fgkNSigma1Pt2Bins*(Double_t)i ;
481 fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
482 fHistList->Add(fNEventAll);
483 fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
484 fHistList->Add(fNEventSel);
485 fNEventReject = new TH1F("fNEventReject","Reason events are rejectected for analysis",20,0,20);
487 fNEventReject->Fill("noESD",0);
488 fNEventReject->Fill("Trigger",0);
489 fNEventReject->Fill("NTracks<2",0);
490 fNEventReject->Fill("noVTX",0);
491 fNEventReject->Fill("VtxStatus",0);
492 fNEventReject->Fill("NCont<2",0);
493 fNEventReject->Fill("ZVTX>10",0);
494 fNEventReject->Fill("cent",0);
495 fNEventReject->Fill("cent>90",0);
496 fHistList->Add(fNEventReject);
498 fh1Centrality = new TH1F("fh1Centrality","fh1Centrality; Centrality %",100,0,100);
499 fHistList->Add(fh1Centrality);
501 fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
502 fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
503 fHistList->Add(fh1Xsec);
505 fh1Trials = new TH1F("fh1Trials","trials root file",1,0,1);
506 fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
507 fHistList->Add(fh1Trials);
509 fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
510 fHistList->Add(fh1PtHard);
511 fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
512 fHistList->Add(fh1PtHardTrials);
514 fh1NTracksAll = new TH1F("fh1NTracksAll","fh1NTracksAll",1,-0.5,0.5);
515 fHistList->Add(fh1NTracksAll);
517 fh1NTracksReject = new TH1F("fh1NTracksReject","fh1NTracksReject",1,-0.5,0.5);
518 fh1NTracksReject->Fill("noHybridTrack",0);
519 fh1NTracksReject->Fill("noITSrefit",0);
520 fh1NTracksReject->Fill("noESDtrack",0);
521 fh1NTracksReject->Fill("noTPCInner",0);
522 fh1NTracksReject->Fill("FillTPC",0);
523 fh1NTracksReject->Fill("noTPConly",0);
524 fh1NTracksReject->Fill("relate",0);
525 fh1NTracksReject->Fill("trackCuts",0);
526 fh1NTracksReject->Fill("laser",0);
527 fh1NTracksReject->Fill("chi2",0);
528 fHistList->Add(fh1NTracksReject);
530 fh1NTracksSel = new TH1F("fh1NTracksSel","fh1NTracksSel",1,-0.5,0.5);
531 fHistList->Add(fh1NTracksSel);
533 fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, binsPt);
534 fHistList->Add(fPtAll);
535 fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, binsPt);
536 fHistList->Add(fPtSel);
538 fPtPhi = new TH2F("fPtPhi","fPtPhi",fgkNPtBins,binsPt,fgkNPhiBins,binsPhi);
539 fHistList->Add(fPtPhi);
541 fPtEta = new TH2F("fPtEta","fPtEta",fgkNPtBins,binsPt,fgkNEtaBins,binsEta);
542 fHistList->Add(fPtEta);
544 fPtEtaPhi = new TH3F("fPtEtaPhi","fPtEtaPhi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
545 fHistList->Add(fPtEtaPhi);
547 fPtDCA2D = new TH2F("fPtDCA2D","fPtDCA2D",fgkNPtBins,binsPt,fgkNDCA2DBins,binsDCA2D);
548 fHistList->Add(fPtDCA2D);
550 fPtDCAZ = new TH2F("fPtDCAZ","fPtDCAZ",fgkNPtBins,binsPt,fgkNDCAZBins,binsDCAZ);
551 fHistList->Add(fPtDCAZ);
553 fPtNClustersTPC = new TH2F("fPtNClustersTPC","fPtNClustersTPC",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
554 fHistList->Add(fPtNClustersTPC);
556 fPtNClustersTPCIter1 = new TH2F("fPtNClustersTPCIter1","fPtNClustersTPCIter1",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
557 fHistList->Add(fPtNClustersTPCIter1);
559 fPtNClustersTPCIter1Phi = new TH3F("fPtNClustersTPCIter1Phi","fPtNClustersTPCIter1Phi",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNPhiBins,binsPhi);
560 fHistList->Add(fPtNClustersTPCIter1Phi);
562 fPtNClustersTPCShared = new TH2F("fPtNClustersTPCShared","fPtNClustersTPCShared",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
563 fHistList->Add(fPtNClustersTPCShared);
565 fPtNClustersTPCSharedFrac = new TH2F("fPtNClustersTPCSharedFrac","fPtNClustersTPCSharedFrac",fgkNPtBins,binsPt,fgkNSigma1Pt2Bins,binsSigma1Pt2);
566 fHistList->Add(fPtNClustersTPCSharedFrac);
568 fPtNPointITS = new TH2F("fPtNPointITS","fPtNPointITS",fgkNPtBins,binsPt,fgkNNPointITSBins,binsNPointITS);
569 fHistList->Add(fPtNPointITS);
571 fPtNPointITSPhi = new TH3F("fPtNPointITSPhi","fPtNPointITSPhi",fgkNPtBins,binsPt,fgkNNPointITSBins,binsNPointITS,fgkNPhiBins,binsPhi);
572 fHistList->Add(fPtNPointITSPhi);
574 fPtChi2C = new TH2F("fPtChi2C","fPtChi2C",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
575 fHistList->Add(fPtChi2C);
577 fPtNSigmaToVertex = new TH2F("fPtNSigmaToVertex","fPtNSigmaToVertex",fgkNPtBins,binsPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
578 fHistList->Add(fPtNSigmaToVertex);
580 fPtRelUncertainty1Pt = new TH2F("fPtRelUncertainty1Pt","fPtRelUncertainty1Pt",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
581 fHistList->Add(fPtRelUncertainty1Pt);
583 fPtRelUncertainty1PtNClus = new TH3F("fPtRelUncertainty1PtNClus","fPtRelUncertainty1PtNClus",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
584 fHistList->Add(fPtRelUncertainty1PtNClus);
586 fPtRelUncertainty1PtNClusIter1 = new TH3F("fPtRelUncertainty1PtNClusIter1","fPtRelUncertainty1PtNClusIter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
587 fHistList->Add(fPtRelUncertainty1PtNClusIter1);
589 fPtRelUncertainty1PtNPointITS = new TH3F("fPtRelUncertainty1PtNPointITS","fPtRelUncertainty1PtNPointITS",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNPointITSBins,binsNPointITS);
590 fHistList->Add(fPtRelUncertainty1PtNPointITS);
592 fPtRelUncertainty1PtITSClusterMap = new TH3F("fPtRelUncertainty1PtITSClusterMap","fPtRelUncertainty1PtITSClusterMap",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNITSClusterMapBins,binsITSClusterMap);
593 fHistList->Add(fPtRelUncertainty1PtITSClusterMap);
595 fPtRelUncertainty1PtChi2 = new TH3F("fPtRelUncertainty1PtChi2","fPtRelUncertainty1PtChi2",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
596 fHistList->Add(fPtRelUncertainty1PtChi2);
598 fPtRelUncertainty1PtChi2Iter1 = new TH3F("fPtRelUncertainty1PtChi2Iter1","fPtRelUncertainty1PtChi2Iter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
599 fHistList->Add(fPtRelUncertainty1PtChi2Iter1);
601 fPtRelUncertainty1PtPhi = new TH3F("fPtRelUncertainty1PtPhi","fPtRelUncertainty1PtPhi",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNPhiBins,binsPhi);
602 fHistList->Add(fPtRelUncertainty1PtPhi);
604 fPtChi2PerClusterTPC = new TH2F("fPtChi2PerClusterTPC","fPtChi2PerClusterTPC",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
605 fHistList->Add(fPtChi2PerClusterTPC);
607 fPtChi2PerClusterTPCIter1 = new TH2F("fPtChi2PerClusterTPCIter1","fPtChi2PerClusterTPCIter1",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
608 fHistList->Add(fPtChi2PerClusterTPCIter1);
610 fPtNCrossedRows = new TH2F("fPtNCrossedRows","fPtNCrossedRows",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
611 fHistList->Add(fPtNCrossedRows);
613 fPtNCrossedRowsPhi = new TH3F("fPtNCrossedRowsPhi","fPtNCrossedRowsPhi",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNPhiBins,binsPhi);
614 fHistList->Add(fPtNCrossedRowsPhi);
616 fPtNCrossedRowsNClusFPhi = new TH3F("fPtNCrossedRowsNClusFPhi","fPtNCrossedRowsNClusFPhi",fgkNPtBins,binsPt,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF,fgkNPhiBins,binsPhi);
617 fHistList->Add(fPtNCrossedRowsNClusFPhi);
619 fPtNCrRNCrRNClusF = new TH3F("fPtNCrRNCrRNClusF","fPtNCrRNCrRNClusF",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
620 fHistList->Add(fPtNCrRNCrRNClusF);
622 fPtNCrossedRowsFit = new TH2F("fPtNCrossedRowsFit","fPtNCrossedRowsFit",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
623 fHistList->Add(fPtNCrossedRowsFit);
625 fPtNCrossedRowsFitPhi = new TH3F("fPtNCrossedRowsFitPhi","fPtNCrossedRowsFitPhi",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNPhiBins,binsPhi);
626 fHistList->Add(fPtNCrossedRowsFitPhi);
628 fPtNCrossedRowsNClusFFitPhi = new TH3F("fPtNCrossedRowsNClusFFitPhi","fPtNCrossedRowsNClusFFitPhi",fgkNPtBins,binsPt,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF,fgkNPhiBins,binsPhi);
629 fHistList->Add(fPtNCrossedRowsNClusFFitPhi);
631 fNCrossedRowsNCrossedRowsFit = new TH2F("fNCrossedRowsNCrossedRowsFit","fNCrossedRowsNCrossedRowsFit",fgkNNClustersTPCBins,binsNClustersTPC,fgkNNClustersTPCBins,binsNClustersTPC);
632 fHistList->Add(fNCrossedRowsNCrossedRowsFit);
634 fNClustersNCrossedRows = new TH2F("fNClustersNCrossedRows","fNClustersNCrossedRows",fgkNNClustersTPCBins,binsNClustersTPC,fgkNNClustersTPCBins,binsNClustersTPC);
635 fHistList->Add(fNClustersNCrossedRows);
637 fNClustersNCrossedRowsFit = new TH2F("fNClustersNCrossedRowsFit","fNClustersNCrossedRowsFit",fgkNNClustersTPCBins,binsNClustersTPC,fgkNNClustersTPCBins,binsNClustersTPC);
638 fHistList->Add(fNClustersNCrossedRowsFit);
640 fPtNClustersNClustersFitMap = new TH3F("fPtNClustersNClustersFitMap","fPtNClustersNClustersFitMap;p_{T};N_{cls};N_{cls}^{fit map}",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNNClustersTPCBins,binsNClustersTPC);
641 fHistList->Add(fPtNClustersNClustersFitMap);
643 fPtRelUncertainty1PtNCrossedRows = new TH3F("fPtRelUncertainty1PtNCrossedRows","fPtRelUncertainty1PtNCrossedRows",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
644 fHistList->Add(fPtRelUncertainty1PtNCrossedRows);
646 fPtRelUncertainty1PtNCrossedRowsFit = new TH3F("fPtRelUncertainty1PtNCrossedRowsFit","fPtRelUncertainty1PtNCrossedRowsFit",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
647 fHistList->Add(fPtRelUncertainty1PtNCrossedRowsFit);
649 fPtChi2Gold = new TH2F("fPtChi2Gold","fPtChi2Gold",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
650 fHistList->Add(fPtChi2Gold);
652 fPtChi2GGC = new TH2F("fPtChi2GGC","fPtChi2GGC",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
653 fHistList->Add(fPtChi2GGC);
655 fPtChi2GoldPhi = new TH3F("fPtChi2GoldPhi","fPtChi2GoldPhi",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C,fgkNPhiBins,binsPhi);
656 fHistList->Add(fPtChi2GoldPhi);
658 fPtChi2GGCPhi = new TH3F("fPtChi2GGCPhi","fPtChi2GGCPhi",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C,fgkNPhiBins,binsPhi);
659 fHistList->Add(fPtChi2GGCPhi);
661 fChi2GoldChi2GGC = new TH2F("fChi2GoldChi2GGC","fChi2GoldChi2GGC;#chi^{2}_{gold};#chi^{2}_{ggc}",fgkNChi2CBins,binsChi2C,fgkNChi2CBins,binsChi2C);
662 fHistList->Add(fChi2GoldChi2GGC);
664 fPtChi2ITSPhi = new TH3F("fPtChi2ITSPhi","fPtChi2ITSPhi;p_{T};#chi^{2}_{ITS};#varphi",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C,fgkNPhiBins,binsPhi);
665 fHistList->Add(fPtChi2ITSPhi);
667 fPtSigmaY2 = new TH2F("fPtSigmaY2","fPtSigmaY2",fgkN1PtBins,bins1Pt,fgkNSigmaY2Bins,binsSigmaY2);
668 fHistList->Add(fPtSigmaY2);
670 fPtSigmaZ2 = new TH2F("fPtSigmaZ2","fPtSigmaZ2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaZ2);
671 fHistList->Add(fPtSigmaZ2);
673 fPtSigmaSnp2 = new TH2F("fPtSigmaSnp2","fPtSigmaSnp2",fgkN1PtBins,bins1Pt,fgkNSigmaSnp2Bins,binsSigmaSnp2);
674 fHistList->Add(fPtSigmaSnp2);
676 fPtSigmaTgl2 = new TH2F("fPtSigmaTgl2","fPtSigmaTgl2",fgkN1PtBins,bins1Pt,fgkNSigmaTgl2Bins,binsSigmaTgl2);
677 fHistList->Add(fPtSigmaTgl2);
679 fPtSigma1Pt2 = new TH2F("fPtSigma1Pt2","fPtSigma1Pt2",fgkN1PtBins,bins1Pt,fgkNSigma1Pt2Bins,binsSigma1Pt2);
680 fHistList->Add(fPtSigma1Pt2);
682 fProfPtSigmaY2 = new TProfile("fProfPtSigmaY2","fProfPtSigmaY2",fgkN1PtBins,bins1Pt);
683 fHistList->Add(fProfPtSigmaY2);
685 fProfPtSigmaZ2 = new TProfile("fProfPtSigmaZ2","fProfPtSigmaZ2",fgkN1PtBins,bins1Pt);
686 fHistList->Add(fProfPtSigmaZ2);
688 fProfPtSigmaSnp2 = new TProfile("fProfPtSigmaSnp2","fProfPtSigmaSnp2",fgkN1PtBins,bins1Pt);
689 fHistList->Add(fProfPtSigmaSnp2);
691 fProfPtSigmaTgl2 = new TProfile("fProfPtSigmaTgl2","fProfPtSigmaTgl2",fgkN1PtBins,bins1Pt);
692 fHistList->Add(fProfPtSigmaTgl2);
694 fProfPtSigma1Pt2 = new TProfile("fProfPtSigma1Pt2","fProfPtSigma1Pt2",fgkN1PtBins,bins1Pt);
695 fHistList->Add(fProfPtSigma1Pt2);
697 fProfPtSigma1Pt = new TProfile("fProfPtSigma1Pt","fProfPtSigma1Pt;p_{T};#sigma(1/p_{T})",fgkNPtBins,binsPt);
698 fHistList->Add(fProfPtSigma1Pt);
700 fProfPtPtSigma1Pt = new TProfile("fProfPtPtSigma1Pt","fProfPtPtSigma1Pt;p_{T};p_{T}#sigma(1/p_{T})",fgkNPtBins,binsPt);
701 fHistList->Add(fProfPtPtSigma1Pt);
703 TH1::AddDirectory(oldStatus);
705 PostData(1, fHistList);
707 if(binsPhi) delete [] binsPhi;
708 if(binsPt) delete [] binsPt;
709 if(binsNClustersTPC) delete [] binsNClustersTPC;
710 if(binsDCA2D) delete [] binsDCA2D;
711 if(binsDCAZ) delete [] binsDCAZ;
712 if(binsNPointITS) delete [] binsNPointITS;
713 if(binsITSClusterMap) delete [] binsITSClusterMap;
714 if(binsNSigmaToVertex) delete [] binsNSigmaToVertex;
715 if(binsChi2C) delete [] binsChi2C;
716 if(binsEta) delete [] binsEta;
717 if(binsRel1PtUncertainty) delete [] binsRel1PtUncertainty;
718 if(binsUncertainty1Pt) delete [] binsUncertainty1Pt;
719 if(binsChi2PerClus) delete [] binsChi2PerClus;
720 if(binsChi2PerClus) delete [] binsNCrossedRowsNClusF;
721 if(bins1Pt) delete [] bins1Pt;
722 if(binsSigmaY2) delete [] binsSigmaY2;
723 if(binsSigmaZ2) delete [] binsSigmaZ2;
724 if(binsSigmaSnp2) delete [] binsSigmaSnp2;
725 if(binsSigmaTgl2) delete [] binsSigmaTgl2;
726 if(binsSigma1Pt2) delete [] binsSigma1Pt2;
729 //________________________________________________________________________
730 Bool_t AliPWG4HighPtTrackQA::SelectEvent() {
732 // Decide if event should be selected for analysis
735 // Checks following requirements:
736 // - fEvent available
737 // - trigger info from AliPhysicsSelection
738 // - MCevent available
739 // - number of reconstructed tracks > 1
740 // - primary vertex reconstructed
741 // - z-vertex < 10 cm
742 // - centrality in case of PbPb
744 Bool_t selectEvent = kTRUE;
746 //fEvent object available?
748 AliDebug(2,Form("ERROR: fInputEvent not available\n"));
749 fNEventReject->Fill("noAliVEvent",1);
750 selectEvent = kFALSE;
754 //Check if number of reconstructed tracks is larger than 1
755 if(!fEvent->GetNumberOfTracks() || fEvent->GetNumberOfTracks()<2) {
756 fNEventReject->Fill("NTracks<2",1);
757 selectEvent = kFALSE;
761 //Check if vertex is reconstructed
762 if(fDataType==kESD&&dynamic_cast<AliESDEvent*>(fEvent)) {
763 fVtx = ((AliESDEvent*)fEvent)->GetPrimaryVertexTracks();
765 if (!fVtx || !fVtx->GetStatus())
766 fVtx = ((AliESDEvent*)fEvent)->GetPrimaryVertexSPD();
769 fNEventReject->Fill("noVTX",1);
770 selectEvent = kFALSE;
774 if(!fVtx->GetStatus()) {
775 fNEventReject->Fill("VtxStatus",1);
776 selectEvent = kFALSE;
781 if(fVtx->GetNContributors()<2) {
782 fNEventReject->Fill("NCont<2",1);
783 selectEvent = kFALSE;
787 //Check if z-vertex < 10 cm
789 fVtx->GetXYZ(primVtx);
790 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
791 fNEventReject->Fill("ZVTX>10",1);
792 selectEvent = kFALSE;
796 else if(fDataType==kAOD&&dynamic_cast<AliAODEvent*>(fEvent)) {
797 fVtxAOD = ((AliAODEvent*)fEvent)->GetPrimaryVertex();
799 fNEventReject->Fill("noVTX",1);
800 selectEvent = kFALSE;
805 if(fVtxAOD->GetNContributors()<2) {
806 fNEventReject->Fill("NCont<2",1);
807 selectEvent = kFALSE;
811 //Check if z-vertex < 10 cm
813 fVtxAOD->GetXYZ(primVtx);
814 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
815 fNEventReject->Fill("ZVTX>10",1);
816 selectEvent = kFALSE;
822 //Centrality selection should only be done in case of PbPb
825 if(fCentClass!=CalculateCentrality(fEvent) && fCentClass!=10) {
826 fNEventReject->Fill("cent",1);
827 selectEvent = kFALSE;
831 if(fDataType==kESD) {
832 if(dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()) {
833 cent = dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()->GetCentralityPercentile("V0M");
836 else if(fDataType==kAOD) {
837 if(dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality())
838 cent = dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality();
841 fNEventReject->Fill("cent>90",1);
842 selectEvent = kFALSE;
845 fh1Centrality->Fill(cent);
853 //________________________________________________________________________
854 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliVEvent *ev){
856 // Get centrality from ESD or AOD
860 return CalculateCentrality(dynamic_cast<AliESDEvent*>(ev));
861 else if(fDataType==kAOD)
862 return CalculateCentrality(dynamic_cast<AliAODEvent*>(ev));
867 //________________________________________________________________________
868 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliESDEvent *esd){
870 // Get centrality from ESD
876 if(esd->GetCentrality()){
877 cent = esd->GetCentrality()->GetCentralityPercentile("V0M");
878 if(fDebug>3) printf("centrality: %f\n",cent);
882 return GetCentralityClass(cent);
886 //________________________________________________________________________
887 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(const AliAODEvent *aod){
889 // Get centrality from AOD
893 Float_t cent = aod->GetHeader()->GetCentrality();
894 if(fDebug>3) printf("centrality: %f\n",cent);
896 return GetCentralityClass(cent);
900 //________________________________________________________________________
901 Int_t AliPWG4HighPtTrackQA::GetCentralityClass(Float_t cent) const {
903 // Get centrality class
906 if(cent<0) return 5; // OB - cent sometimes negative
907 if(cent>80) return 4;
908 if(cent>50) return 3;
909 if(cent>30) return 2;
910 if(cent>10) return 1;
915 //________________________________________________________________________
916 void AliPWG4HighPtTrackQA::UserExec(Option_t *) {
918 // Called for each event
919 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserExec \n"));
921 fEvent = InputEvent();
922 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
924 // All events without selection
925 fNEventAll->Fill(0.);
929 PostData(1, fHistList);
934 //Need to keep track of selected events
935 fNEventSel->Fill(0.);
937 fVariables = new TArrayF(fNVariables);
939 if(fDataType==kESD) DoAnalysisESD();
940 if(fDataType==kAOD) DoAnalysisAOD();
942 //Delete old fVariables
943 if(fVariables) delete fVariables;
946 PostData(1, fHistList);
950 //________________________________________________________________________
951 void AliPWG4HighPtTrackQA::DoAnalysisESD() {
953 // Run analysis on ESD
957 PostData(1, fHistList);
961 // ---- Get MC Header information (for MC productions in pThard bins) ----
962 Double_t ptHard = 0.;
963 Double_t nTrials = 1; // trials for MC trigger weight for real data
965 AliMCEventHandler *eventHandlerMC = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
966 if (eventHandlerMC) {
968 if(eventHandlerMC->MCEvent()){
969 AliGenPythiaEventHeader* pythiaGenHeader = GetPythiaEventHeader(eventHandlerMC->MCEvent());
971 nTrials = pythiaGenHeader->Trials();
972 ptHard = pythiaGenHeader->GetPtHard();
974 fh1PtHard->Fill(ptHard);
975 fh1PtHardTrials->Fill(ptHard,nTrials);
977 fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
982 Int_t nTracks = fESD->GetNumberOfTracks();
983 AliDebug(2,Form("nTracks ESD%d", nTracks));
986 Variables to be put in fVariables
997 10: chi2PerClusterTPC
999 12: (#crossed rows)/(#findable clusters)
1005 18: NClustersTPCIter1
1007 20: nClustersTPCShared
1008 21: Golden Chi2 - global vs TPC constrained
1009 22: Chi2 between global and global constrained
1010 23: #crossed rows from fit map
1011 24: (#crossed rows)/(#findable clusters) from fit map
1015 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
1016 fh1NTracksAll->Fill(0.);
1018 //Get track for analysis
1019 AliESDtrack *track = 0x0;
1020 AliESDtrack *esdtrack = fESD->GetTrack(iTrack);
1022 fh1NTracksReject->Fill("noESDtrack",1);
1025 AliESDtrack *origtrack = new AliESDtrack(*esdtrack);
1030 if (!(fTrackCuts->AcceptTrack(esdtrack))) {
1031 fh1NTracksReject->Fill("trackCuts",1);
1032 if(origtrack) delete origtrack;
1038 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
1039 else if(fTrackType==2 || fTrackType==4) {
1040 track = AliESDtrackCuts::GetTPCOnlyTrack(const_cast<AliESDEvent*>(fESD),esdtrack->GetID());
1042 fh1NTracksReject->Fill("noTPConly",1);
1043 if(origtrack) delete origtrack;
1046 AliExternalTrackParam exParam;
1047 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
1049 fh1NTracksReject->Fill("relate",1);
1050 if(track) delete track;
1051 if(origtrack) delete origtrack;
1054 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
1056 else if(fTrackType==5 || fTrackType==6) {
1057 if(fTrackCuts->AcceptTrack(esdtrack)) {
1058 if(origtrack) delete origtrack;
1062 if( !(fTrackCutsITSLoose->AcceptTrack(esdtrack)) && fTrackCutsTPConly->AcceptTrack(esdtrack) ) {
1065 //use TPConly constrained track
1066 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
1068 fh1NTracksReject->Fill("noTPConly",1);
1069 if(origtrack) delete origtrack;
1072 AliExternalTrackParam exParam;
1073 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
1075 fh1NTracksReject->Fill("relate",1);
1076 if(track) delete track;
1077 if(origtrack) delete origtrack;
1080 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
1082 else if(fTrackType==6) {
1083 //use global constrained track
1084 track = new AliESDtrack(*esdtrack);
1085 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
1091 else if(fTrackType==7) {
1092 //use global constrained track
1093 track = new AliESDtrack(*esdtrack);
1099 if(origtrack) delete origtrack;
1103 if(fTrackType==2 || fTrackType==4 || fTrackType==5) {
1104 //Cut on chi2 of constrained fit
1105 if(track->GetConstrainedChi2TPC() > fSigmaConstrainedMax*fSigmaConstrainedMax && fSigmaConstrainedMax>0.) {
1106 fh1NTracksReject->Fill("chi2",1);
1107 if(track) delete track;
1108 if(origtrack) delete origtrack;
1113 fPtAll->Fill(track->Pt());
1115 if (!(fTrackCuts->AcceptTrack(track)) && fTrackType!=4 && fTrackType!=5 && fTrackType!=6) {
1116 fh1NTracksReject->Fill("trackCuts",1);
1117 if(fTrackType==1 || fTrackType==2 || fTrackType==7) {
1118 if(track) delete track;
1120 if(origtrack) delete origtrack;
1125 if(fTrackCutsITSLoose ) {
1126 if(fTrackCutsITSLoose->AcceptTrack(track) ) {
1127 if(track) delete track;
1128 if(origtrack) delete origtrack;
1133 if(esdtrack->GetConstrainedParam())
1134 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
1138 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==5 || fTrackType==6 || fTrackType==7) {
1139 if(track) delete track;
1141 if(origtrack) delete origtrack;
1145 fh1NTracksSel->Fill(0.);
1147 fVariables->Reset(0.);
1149 fVariables->SetAt(track->Pt(),0);
1150 fVariables->SetAt(track->Phi(),1);
1151 fVariables->SetAt(track->Eta(),2);
1156 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
1157 track->GetImpactParametersTPC(dca2D,dcaz); //TPConly
1160 track->GetImpactParameters(dca2D,dcaz); //Global
1162 fVariables->SetAt(dca2D,3);
1163 fVariables->SetAt(dcaz,4);
1165 fVariables->SetAt((float)track->GetTPCNcls(),5);
1167 Int_t nPointITS = 0;
1168 fITSClusterMap = track->GetITSClusterMap();
1169 UChar_t itsMap = track->GetITSClusterMap();
1170 for (Int_t i=0; i < 6; i++) {
1171 if (itsMap & (1 << i))
1174 fVariables->SetAt((float)nPointITS,6);
1175 Float_t chi2C = (float)track->GetConstrainedChi2();
1176 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
1177 chi2C = (float)track->GetConstrainedChi2TPC();
1178 fVariables->SetAt(chi2C,7);
1179 fVariables->SetAt(fTrackCuts->GetSigmaToVertex(track),8);// Calculates the number of sigma to the vertex for a track.
1181 fVariables->SetAt(GetTrackLengthTPC(track),9);
1183 if(fVariables->At(5)>0.) fVariables->SetAt(track->GetTPCchi2()/fVariables->At(5),10);
1185 //fVariables->SetAt(track->GetTPCClusterInfo(2,1),11); //#crossed rows
1186 fVariables->SetAt(track->GetTPCCrossedRows(),11); //#crossed rows
1188 Float_t crossedRowsTPCNClsF = 1.;//track->GetTPCClusterInfo(2,0);
1189 if(track->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/track->GetTPCNclsF();
1190 fVariables->SetAt(crossedRowsTPCNClsF,12);//(#crossed rows)/(#findable clusters)
1191 fVariables->SetAt(track->GetSigmaY2(),13);
1192 fVariables->SetAt(track->GetSigmaZ2(),14);
1193 fVariables->SetAt(track->GetSigmaSnp2(),15);
1194 fVariables->SetAt(track->GetSigmaTgl2(),16);
1195 fVariables->SetAt(track->GetSigma1Pt2(),17);
1197 fVariables->SetAt(track->GetTPCNclsIter1(),18);
1198 fVariables->SetAt(track->GetTPCchi2Iter1(),19);
1200 fVariables->SetAt(track->GetTPCnclsS(),20);
1202 Float_t chi2Gold = origtrack->GetChi2TPCConstrainedVsGlobal(fVtx);//GetGoldenChi2(origtrack);
1203 Float_t chi2GGC = GetGGCChi2(origtrack);
1205 fVariables->SetAt(chi2Gold,21);
1206 fVariables->SetAt(chi2GGC,22);
1208 fVariables->SetAt(GetTPCClusterInfoFitMap(track,2,1),23);
1209 Float_t crossedRowsTPCNClsFFit = 1.;
1210 if(track->GetTPCNclsF()>0.) crossedRowsTPCNClsFFit = fVariables->At(23)/track->GetTPCNclsF();
1211 fVariables->SetAt(crossedRowsTPCNClsFFit,24);
1213 fVariables->SetAt(track->GetITSchi2(),25);
1215 TBits fitmap = track->GetTPCFitMap();
1216 fPtNClustersNClustersFitMap->Fill(track->Pt(),track->GetTPCNcls(),(float)fitmap.CountBits());
1220 // int mult = fTrackCuts->CountAcceptedTracks(fESD);
1222 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==5 || fTrackType==6 || fTrackType==7) {
1223 if(track) delete track;
1225 if(origtrack) delete origtrack;
1231 //________________________________________________________________________
1232 void AliPWG4HighPtTrackQA::DoAnalysisAOD() {
1234 // Do QA on AOD input
1236 AliAODEvent *aod = dynamic_cast<AliAODEvent*>(fEvent);
1238 AliExternalTrackParam exParam;
1239 for (Int_t iTrack = 0; iTrack < fEvent->GetNumberOfTracks(); iTrack++) {
1241 AliAODTrack *aodtrack = aod->GetTrack(iTrack);
1242 if( !aodtrack->TestFilterMask(fFilterMask) ) {
1243 fh1NTracksReject->Fill("noHybridTrack",1);
1247 if(!fIncludeNoITS) {
1248 if ((aodtrack->GetStatus()&AliESDtrack::kITSrefit)==0) {
1249 fh1NTracksReject->Fill("noITSrefit",1);
1254 fVariables->Reset(0.);
1256 fVariables->SetAt(aodtrack->Pt(),0);
1257 fVariables->SetAt(aodtrack->Phi(),1);
1258 fVariables->SetAt(aodtrack->Eta(),2);
1260 Double_t dca[2] = {0.,0.};
1261 if(aodtrack->IsGlobalConstrained()) {
1262 dca[0] = aodtrack->DCA();
1263 dca[1] = aodtrack->ZAtDCA();
1265 Double_t v[3] = {0};
1266 Double_t pos[3] = {0};
1268 aodtrack->GetXYZ(pos);
1269 dca[0] = pos[0] - v[0];
1270 dca[1] = pos[1] - v[1];
1272 fVariables->SetAt(dca[0],3);
1273 fVariables->SetAt(dca[1],4);
1274 fVariables->SetAt((float)aodtrack->GetTPCNcls(),5);
1275 fVariables->SetAt((float)aodtrack->GetITSNcls(),6);
1276 fVariables->SetAt(aodtrack->Chi2perNDF(),7);
1277 fVariables->SetAt(0.,8);
1278 fVariables->SetAt(GetTrackLengthTPC(aodtrack),9);
1279 fVariables->SetAt(aodtrack->Chi2perNDF(),10);
1280 fVariables->SetAt(GetTPCClusterInfo(aodtrack,2,1,0,159,kFALSE),11);
1281 Float_t crossedRowsTPCNClsF = 0.;
1282 if(aodtrack->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/aodtrack->GetTPCNclsF();
1283 fVariables->SetAt(crossedRowsTPCNClsF,12);
1285 //get covariance matrix
1286 Double_t cov[21] = {0,};
1287 aodtrack->GetCovMatrix(cov);
1288 Double_t pxpypz[3] = {0,};
1289 aodtrack->PxPyPz(pxpypz);
1290 Double_t xyz[3] = {0,};
1291 aodtrack->GetXYZ(xyz);
1292 Short_t sign = aodtrack->Charge();
1293 exParam.Set(xyz,pxpypz,cov,sign);
1295 fVariables->SetAt(exParam.GetSigmaY2(),13);
1296 fVariables->SetAt(exParam.GetSigmaZ2(),14);
1297 fVariables->SetAt(exParam.GetSigmaSnp2(),15);
1298 fVariables->SetAt(exParam.GetSigmaTgl2(),16);
1299 fVariables->SetAt(exParam.GetSigma1Pt2(),17);
1301 fVariables->SetAt(0.,18); //NClustersTPCIter1
1302 fVariables->SetAt(0.,19); //Chi2TPCIter1
1304 TBits sharedClusterMap = aodtrack->GetTPCSharedMap();
1305 fVariables->SetAt(sharedClusterMap.CountBits(),20);
1307 fVariables->SetAt(0.,21); //not available in AOD golden chi2
1308 fVariables->SetAt(0.,22); //not available in AOD Chi2 between global and global constrained
1310 fVariables->SetAt(GetTPCClusterInfo(aodtrack,2,1,0,159,kTRUE),23); //not available in AOD #crossed rows from fit map
1311 Float_t crossedRowsTPCNClsFFit = 0.;
1312 if(aodtrack->GetTPCNclsF()>0.) crossedRowsTPCNClsFFit = fVariables->At(23)/aodtrack->GetTPCNclsF();
1313 fVariables->SetAt(crossedRowsTPCNClsFFit,24); //(#crossed rows)/(#findable clusters) from fit map
1315 fVariables->SetAt(0.,25);
1317 fPtAll->Fill(fVariables->At(0));
1323 //________________________________________________________________________
1324 void AliPWG4HighPtTrackQA::FillHistograms() {
1326 // Fill all QA histograms
1329 fPtSel->Fill(fVariables->At(0));
1330 fPtPhi->Fill(fVariables->At(0),fVariables->At(1));
1331 fPtEta->Fill(fVariables->At(0),fVariables->At(2));
1332 fPtEtaPhi->Fill(fVariables->At(0),fVariables->At(2),fVariables->At(1));
1333 fPtDCA2D->Fill(fVariables->At(0),fVariables->At(3));
1334 fPtDCAZ->Fill(fVariables->At(0),fVariables->At(4));
1335 fPtNClustersTPC->Fill(fVariables->At(0),fVariables->At(5));
1336 fPtNPointITS->Fill(fVariables->At(0),fVariables->At(6));
1337 fPtNPointITSPhi->Fill(fVariables->At(0),fVariables->At(6),fVariables->At(1));
1339 fPtNClustersTPCIter1->Fill(fVariables->At(0),fVariables->At(18));
1340 fPtNClustersTPCIter1Phi->Fill(fVariables->At(0),fVariables->At(18),fVariables->At(1));
1341 fPtNClustersTPCShared->Fill(fVariables->At(0),fVariables->At(20));
1342 if(fVariables->At(5)>0.)
1343 fPtNClustersTPCSharedFrac->Fill(fVariables->At(0),fVariables->At(20)/fVariables->At(5));
1345 if(fVariables->At(18)>0.)
1346 fPtChi2PerClusterTPCIter1->Fill(fVariables->At(0),fVariables->At(19)/fVariables->At(18));
1348 fPtChi2C->Fill(fVariables->At(0),fVariables->At(7));
1349 fPtNSigmaToVertex->Fill(fVariables->At(0),fVariables->At(8));
1350 fPtRelUncertainty1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1351 fPtRelUncertainty1PtNClus->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(5));
1352 fPtRelUncertainty1PtNClusIter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(18));
1353 fPtRelUncertainty1PtNPointITS->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(6));
1355 fPtRelUncertainty1PtITSClusterMap->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),(int)fITSClusterMap);
1357 fPtRelUncertainty1PtChi2->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(10));
1358 if(fVariables->At(18)>0.)
1359 fPtRelUncertainty1PtChi2Iter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(19)/fVariables->At(18));
1360 fPtRelUncertainty1PtPhi->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(1));
1362 fPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1363 fPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1364 fPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1365 fPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1366 fPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1368 fProfPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1369 fProfPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1370 fProfPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1371 fProfPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1372 fProfPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1373 fProfPtSigma1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1374 fProfPtPtSigma1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1376 fPtChi2PerClusterTPC->Fill(fVariables->At(0),fVariables->At(10));
1377 fPtNCrossedRows->Fill(fVariables->At(0),fVariables->At(11));
1378 fPtNCrossedRowsPhi->Fill(fVariables->At(0),fVariables->At(11),fVariables->At(1));
1379 fPtNCrossedRowsNClusFPhi->Fill(fVariables->At(0),fVariables->At(12),fVariables->At(1));
1380 fPtNCrRNCrRNClusF->Fill(fVariables->At(0),fVariables->At(11),fVariables->At(12));
1382 fPtChi2Gold->Fill(fVariables->At(0),fVariables->At(21));
1383 fPtChi2GGC->Fill(fVariables->At(0),fVariables->At(22));
1385 fPtChi2GoldPhi->Fill(fVariables->At(0),fVariables->At(21),fVariables->At(1));
1386 fPtChi2GGCPhi->Fill(fVariables->At(0),fVariables->At(22),fVariables->At(1));
1388 fChi2GoldChi2GGC->Fill(fVariables->At(21),fVariables->At(22));
1390 fPtNCrossedRowsFit->Fill(fVariables->At(0),fVariables->At(23));
1391 fPtNCrossedRowsFitPhi->Fill(fVariables->At(0),fVariables->At(23),fVariables->At(1));
1392 fPtNCrossedRowsNClusFFitPhi->Fill(fVariables->At(0),fVariables->At(24),fVariables->At(1));
1393 fNCrossedRowsNCrossedRowsFit->Fill(fVariables->At(11),fVariables->At(23));
1395 fNClustersNCrossedRows->Fill(fVariables->At(5),fVariables->At(11));
1396 fNClustersNCrossedRowsFit->Fill(fVariables->At(5),fVariables->At(23));
1398 fPtRelUncertainty1PtNCrossedRows->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(11));
1399 fPtRelUncertainty1PtNCrossedRowsFit->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(23));
1401 if(fVariables->At(6)>0.)
1402 fPtChi2ITSPhi->Fill(fVariables->At(0),fVariables->At(25)/fVariables->At(6),fVariables->At(1));
1406 //________________________________________________________________________
1407 Bool_t AliPWG4HighPtTrackQA::PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials){
1409 // get the cross section and the trails either from pyxsec.root or from pysec_hists.root
1410 // This is to called in Notify and should provide the path to the AOD/ESD file
1411 // Copied from AliAnalysisTaskJetSpectrum2
1414 TString file(currFile);
1418 if(file.Contains("root_archive.zip#")){
1419 Ssiz_t pos1 = file.Index("root_archive",12,TString::kExact);
1420 Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
1421 file.Replace(pos+1,20,"");
1424 // not an archive take the basename....
1425 file.ReplaceAll(gSystem->BaseName(file.Data()),"");
1428 TFile *fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec.root")); // problem that we cannot really test the existance of a file in a archive so we have to lvie with open error message from root
1430 // next trial fetch the histgram file
1431 fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root"));
1433 // not a severe condition but inciate that we have no information
1437 // find the tlist we want to be independtent of the name so use the Tkey
1438 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
1443 TList *list = dynamic_cast<TList*>(key->ReadObj());
1448 fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
1449 fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
1452 } // no tree pyxsec.root
1454 TTree *xtree = (TTree*)fxsec->Get("Xsection");
1460 Double_t xsection = 0;
1461 xtree->SetBranchAddress("xsection",&xsection);
1462 xtree->SetBranchAddress("ntrials",&ntrials);
1470 //________________________________________________________________________
1471 Bool_t AliPWG4HighPtTrackQA::Notify()
1474 // Implemented Notify() to read the cross sections
1475 // and number of trials from pyxsec.root
1476 // Copied from AliAnalysisTaskJetSpectrum2
1479 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
1480 Float_t xsection = 0;
1481 Float_t ftrials = 1;
1485 TFile *curfile = tree->GetCurrentFile();
1487 Error("Notify","No current file");
1490 if(!fh1Xsec||!fh1Trials){
1491 // Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
1494 PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
1495 fh1Xsec->Fill("<#sigma>",xsection);
1496 // construct a poor man average trials
1497 Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
1498 if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
1503 //________________________________________________________________________
1504 AliGenPythiaEventHeader* AliPWG4HighPtTrackQA::GetPythiaEventHeader(const AliMCEvent *mcEvent){
1506 if(!mcEvent)return 0;
1507 AliGenEventHeader* genHeader = mcEvent->GenEventHeader();
1508 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
1509 if(!pythiaGenHeader){
1511 AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader);
1513 if (!genCocktailHeader) {
1514 // AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Unknown header type (not Pythia or Cocktail)");
1515 // AliWarning(Form("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__));
1518 TList* headerList = genCocktailHeader->GetHeaders();
1519 for (Int_t i=0; i<headerList->GetEntries(); i++) {
1520 pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
1521 if (pythiaGenHeader)
1524 if(!pythiaGenHeader){
1525 AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Pythia event header not found");
1529 return pythiaGenHeader;
1533 //_______________________________________________________________________
1534 Float_t AliPWG4HighPtTrackQA::GetTPCClusterInfo(const AliAODTrack *tr,Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Bool_t useFitMap) const
1536 //MV: copied from AliESDtrack since method is not available in AliAODTrack
1539 // TPC cluster information
1540 // type 0: get fraction of found/findable clusters with neighbourhood definition
1541 // 1: findable clusters with neighbourhood definition
1542 // 2: found clusters
1544 // definition of findable clusters:
1545 // a cluster is defined as findable if there is another cluster
1546 // within +- nNeighbours pad rows. The idea is to overcome threshold
1547 // effects with a very simple algorithm.
1550 TBits fTPCClusterMap = 0;
1552 fTPCClusterMap = tr->GetTPCFitMap();
1554 fTPCClusterMap = tr->GetTPCClusterMap();
1556 if (type==2) return fTPCClusterMap.CountBits();
1560 Int_t last=-nNeighbours;
1562 for (Int_t i=row0; i<row1; ++i){
1563 //look to current row
1564 if (fTPCClusterMap[i]) {
1570 //look to nNeighbours before
1571 if ((i-last)<=nNeighbours) {
1575 //look to nNeighbours after
1576 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1577 if (fTPCClusterMap[j]){
1583 if (type==1) return findable;
1588 fraction=(Float_t)found/(Float_t)findable;
1593 return 0; // undefined type - default value
1596 //_______________________________________________________________________
1597 Float_t AliPWG4HighPtTrackQA::GetTPCClusterInfoFitMap(const AliESDtrack *tr,Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const
1600 // TPC cluster information from fit map
1601 // type 0: get fraction of found/findable clusters with neighbourhood definition
1602 // 1: findable clusters with neighbourhood definition
1603 // 2: found clusters
1605 // definition of findable clusters:
1606 // a cluster is defined as findable if there is another cluster
1607 // within +- nNeighbours pad rows. The idea is to overcome threshold
1608 // effects with a very simple algorithm.
1611 TBits fTPCFitMap = tr->GetTPCFitMap();
1612 if (type==2) return fTPCFitMap.CountBits();
1616 Int_t last=-nNeighbours;
1618 for (Int_t i=row0; i<row1; ++i){
1619 //look to current row
1620 if (fTPCFitMap[i]) {
1626 //look to nNeighbours before
1627 if ((i-last)<=nNeighbours) {
1631 //look to nNeighbours after
1632 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1639 if (type==1) return findable;
1644 fraction=(Float_t)found/(Float_t)findable;
1649 return 0; // undefined type - default value
1652 //_______________________________________________________________________
1653 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(const AliESDtrack *track) const {
1655 // returns distance between 1st and last hit in TPC
1656 // distance given in number of padrows
1659 TBits fTPCClusterMap = track->GetTPCClusterMap();
1663 for(int i=0; i<=159; i++) {
1664 if(fTPCClusterMap[i]>0) firstHit = i;
1666 for(int i=159; i>=0; i--) {
1667 if(fTPCClusterMap[i]>0) lastHit = i;
1670 Int_t trackLength = lastHit - firstHit;
1675 //_______________________________________________________________________
1676 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(const AliAODTrack *track) const {
1678 // returns distance between 1st and last hit in TPC
1679 // distance given in number of padrows
1682 TBits fTPCClusterMap = track->GetTPCClusterMap();
1686 for(int i=0; i<=159; i++) {
1687 if(fTPCClusterMap[i]>0) firstHit = i;
1689 for(int i=159; i>=0; i--) {
1690 if(fTPCClusterMap[i]>0) lastHit = i;
1693 Int_t trackLength = lastHit - firstHit;
1698 //_______________________________________________________________________
1699 Float_t AliPWG4HighPtTrackQA::GetGoldenChi2(AliESDtrack *origtrack) {
1701 // Return chi2 between global and TPC constrained track
1702 // track should be the global unconstrained track
1705 Float_t chi2Gold = 0.;
1707 AliESDtrack *tpcTrack = 0x0;
1708 tpcTrack = AliESDtrackCuts::GetTPCOnlyTrack(fESD,origtrack->GetID());
1710 AliExternalTrackParam exParam;
1711 Bool_t relate = tpcTrack->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
1713 tpcTrack->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
1714 // Double_t pTPC[2],covTPC[3]; tpcTrack->PropagateToDCA(fVtx, fESD->GetMagneticField(), 10000, pTPC, covTPC);
1717 tpcTrack->Propagate(origtrack->GetAlpha(), origtrack->GetX(), fESD->GetMagneticField());
1718 chi2Gold = (Float_t)origtrack->GetPredictedChi2(tpcTrack);
1721 if(tpcTrack) delete tpcTrack;
1727 //_______________________________________________________________________
1728 Float_t AliPWG4HighPtTrackQA::GetGGCChi2(AliESDtrack *origtrack) {
1730 // Return chi2 between global and global constrained track
1731 // track should be the global unconstrained track
1734 Float_t chi2GGC = 0.;
1736 AliESDtrack *esdtrackC = new AliESDtrack(*origtrack);
1738 if(origtrack->GetConstrainedParam()) {
1739 esdtrackC->Set(origtrack->GetConstrainedParam()->GetX(),origtrack->GetConstrainedParam()->GetAlpha(),origtrack->GetConstrainedParam()->GetParameter(),origtrack->GetConstrainedParam()->GetCovariance());
1740 chi2GGC = (Float_t)origtrack->GetPredictedChi2(esdtrackC);
1749 //________________________________________________________________________
1750 void AliPWG4HighPtTrackQA::Terminate(Option_t *)
1752 // The Terminate() function is the last function to be called during
1753 // a query. It always runs on the client, it can be used to present
1754 // the results graphically or save the results to file.