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 : Marta 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"
55 //#include "AliAnalysisHelperJetTasks.h"
57 using namespace std; //required for resolving the 'cout' symbol
59 ClassImp(AliPWG4HighPtTrackQA)
61 AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA()
62 : AliAnalysisTaskSE(),
68 fTrackCutsITSLoose(0x0),
69 fTrackCutsTPConly(0x0),
72 fSigmaConstrainedMax(-1.),
88 fh1NTracksReject(0x0),
97 fPtNClustersTPCIter1(0x0),
100 fPtNSigmaToVertex(0x0),
101 fPtRelUncertainty1Pt(0x0),
102 fPtRelUncertainty1PtNClus(0x0),
103 fPtRelUncertainty1PtNClusIter1(0x0),
104 fPtRelUncertainty1PtChi2(0x0),
105 fPtRelUncertainty1PtChi2Iter1(0x0),
106 fPtRelUncertainty1PtPhi(0x0),
107 fPtRelUncertainty1PtTrkLength(0x0),
108 fPtUncertainty1Pt(0x0),
109 fPtChi2PerClusterTPC(0x0),
110 fPtChi2PerClusterTPCIter1(0x0),
111 fPtNCrossedRows(0x0),
112 fPtNCrossedRowsNClusF(0x0),
113 fPtNCrRNCrRNClusF(0x0),
121 fProfPtSigmaSnp2(0x0),
122 fProfPtSigmaTgl2(0x0),
123 fProfPtSigma1Pt2(0x0),
124 fProfPtSigma1Pt(0x0),
125 fProfPtPtSigma1Pt(0x0),
131 fPtBinEdges[0][0] = 10.;
132 fPtBinEdges[0][1] = 1.;
133 fPtBinEdges[1][0] = 20.;
134 fPtBinEdges[1][1] = 2.;
135 fPtBinEdges[2][0] = 50.;
136 fPtBinEdges[2][1] = 5.;
139 //________________________________________________________________________
140 AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name):
141 AliAnalysisTaskSE(name),
147 fTrackCutsITSLoose(0x0),
148 fTrackCutsTPConly(0x0),
151 fSigmaConstrainedMax(-1.),
167 fh1NTracksReject(0x0),
175 fPtNClustersTPC(0x0),
176 fPtNClustersTPCIter1(0x0),
179 fPtNSigmaToVertex(0x0),
180 fPtRelUncertainty1Pt(0x0),
181 fPtRelUncertainty1PtNClus(0x0),
182 fPtRelUncertainty1PtNClusIter1(0x0),
183 fPtRelUncertainty1PtChi2(0x0),
184 fPtRelUncertainty1PtChi2Iter1(0x0),
185 fPtRelUncertainty1PtPhi(0x0),
186 fPtRelUncertainty1PtTrkLength(0x0),
187 fPtUncertainty1Pt(0x0),
188 fPtChi2PerClusterTPC(0x0),
189 fPtChi2PerClusterTPCIter1(0x0),
190 fPtNCrossedRows(0x0),
191 fPtNCrossedRowsNClusF(0x0),
192 fPtNCrRNCrRNClusF(0x0),
200 fProfPtSigmaSnp2(0x0),
201 fProfPtSigmaTgl2(0x0),
202 fProfPtSigma1Pt2(0x0),
203 fProfPtSigma1Pt(0x0),
204 fProfPtPtSigma1Pt(0x0),
209 // Constructor. Initialization of Inputs and Outputs
211 AliDebug(2,Form("AliPWG4HighPtTrackQA Calling Constructor"));
215 fPtBinEdges[0][0] = 10.;
216 fPtBinEdges[0][1] = 1.;
217 fPtBinEdges[1][0] = 20.;
218 fPtBinEdges[1][1] = 2.;
219 fPtBinEdges[2][0] = 50.;
220 fPtBinEdges[2][1] = 5.;
222 // Input slot #0 works with a TChain ESD
223 DefineInput(0, TChain::Class());
224 // Output slot #1 write into a TList
225 DefineOutput(1, TList::Class());
228 //________________________________________________________________________
229 void AliPWG4HighPtTrackQA::SetPtBinEdges(Int_t region, Double_t ptmax, Double_t ptBinWidth) {
232 fPtBinEdges[region][0] = ptmax;
233 fPtBinEdges[region][1] = ptBinWidth;
236 AliError("Only 3 regions alowed. Use region 0/1/2\n");
242 //________________________________________________________________________
243 void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
244 //Create output objects
245 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserCreateOutputObjects \n"));
247 Bool_t oldStatus = TH1::AddDirectoryStatus();
248 TH1::AddDirectory(kFALSE);
251 fHistList = new TList();
252 fHistList->SetOwner(kTRUE);
254 Float_t fgkPtMin = 0.;
255 Float_t fgkPtMax = fPtMax;
257 // Float_t ptBinEdges[2][2];
258 // ptBinEdges[0][0] = 10.;
259 // ptBinEdges[0][1] = 1.;
260 // ptBinEdges[1][0] = 20.;
261 // ptBinEdges[1][1] = 2.;
262 // Float_t binWidth3 = 5.;
264 // ptBinEdges[0][0] = 100.;
265 // ptBinEdges[0][1] = 5.;
266 // ptBinEdges[1][0] = 300.;
267 // ptBinEdges[1][1] = 10.;
271 //fPtBinEdges[region][0] = ptmax of region ; fPtBinEdges[region][1] = binWidth of region
272 const Float_t ptmin1 = fgkPtMin;
273 const Float_t ptmax1 = fPtBinEdges[0][0];
274 const Float_t ptmin2 = ptmax1 ;
275 const Float_t ptmax2 = fPtBinEdges[1][0];
276 const Float_t ptmin3 = ptmax2 ;
277 const Float_t ptmax3 = fgkPtMax;
278 const Int_t nbin11 = (int)((ptmax1-ptmin1)/fPtBinEdges[0][1]);
279 const Int_t nbin12 = (int)((ptmax2-ptmin2)/fPtBinEdges[1][1])+nbin11;
280 const Int_t nbin13 = (int)((ptmax3-ptmin3)/fPtBinEdges[2][1])+nbin12;
281 Int_t fgkNPtBins=nbin13;
282 //Create array with low edges of each bin
283 Double_t *binsPt=new Double_t[fgkNPtBins+1];
284 for(Int_t i=0; i<=fgkNPtBins; i++) {
285 if(i<=nbin11) binsPt[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;
286 if(i<=nbin12 && i>nbin11) binsPt[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
287 if(i<=nbin13 && i>nbin12) binsPt[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
290 Int_t fgkNPhiBins = 18*6;
291 Float_t kMinPhi = 0.;
292 Float_t kMaxPhi = 2.*TMath::Pi();
293 Double_t *binsPhi = new Double_t[fgkNPhiBins+1];
294 for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ;
296 Int_t fgkNEtaBins=20;
297 Float_t fgkEtaMin = -1.;
298 Float_t fgkEtaMax = 1.;
299 Double_t *binsEta=new Double_t[fgkNEtaBins+1];
300 for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ;
302 Int_t fgkNNClustersTPCBins=80;
303 Float_t fgkNClustersTPCMin = 0.5;
304 Float_t fgkNClustersTPCMax = 160.5;
305 Double_t *binsNClustersTPC=new Double_t[fgkNNClustersTPCBins+1];
306 for(Int_t i=0; i<=fgkNNClustersTPCBins; i++) binsNClustersTPC[i]=(Double_t)fgkNClustersTPCMin + (fgkNClustersTPCMax-fgkNClustersTPCMin)/fgkNNClustersTPCBins*(Double_t)i ;
308 Int_t fgkNDCA2DBins=80;
309 Float_t fgkDCA2DMin = -0.2;
310 Float_t fgkDCA2DMax = 0.2;
311 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
315 Double_t *binsDCA2D=new Double_t[fgkNDCA2DBins+1];
316 for(Int_t i=0; i<=fgkNDCA2DBins; i++) binsDCA2D[i]=(Double_t)fgkDCA2DMin + (fgkDCA2DMax-fgkDCA2DMin)/fgkNDCA2DBins*(Double_t)i ;
318 Int_t fgkNDCAZBins=80;
319 Float_t fgkDCAZMin = -2.;
320 Float_t fgkDCAZMax = 2.;
321 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
325 Double_t *binsDCAZ=new Double_t[fgkNDCAZBins+1];
326 for(Int_t i=0; i<=fgkNDCAZBins; i++) binsDCAZ[i]=(Double_t)fgkDCAZMin + (fgkDCAZMax-fgkDCAZMin)/fgkNDCAZBins*(Double_t)i ;
328 Int_t fgkNNPointITSBins=9;
329 Float_t fgkNPointITSMin = -0.5;
330 Float_t fgkNPointITSMax = 8.5;
331 Double_t *binsNPointITS=new Double_t[fgkNNPointITSBins+1];
332 for(Int_t i=0; i<=fgkNNPointITSBins; i++) binsNPointITS[i]=(Double_t)fgkNPointITSMin + (fgkNPointITSMax-fgkNPointITSMin)/fgkNNPointITSBins*(Double_t)i ;
334 Int_t fgkNNSigmaToVertexBins=20;
335 Float_t fgkNSigmaToVertexMin = 0.;
336 Float_t fgkNSigmaToVertexMax = 8.;
337 Double_t *binsNSigmaToVertex=new Double_t[fgkNNSigmaToVertexBins+1];
338 for(Int_t i=0; i<=fgkNNSigmaToVertexBins; i++) binsNSigmaToVertex[i]=(Double_t)fgkNSigmaToVertexMin + (fgkNSigmaToVertexMax-fgkNSigmaToVertexMin)/fgkNNSigmaToVertexBins*(Double_t)i ;
340 Int_t fgkNChi2CBins=20;
341 Float_t fgkChi2CMin = 0.;
342 Float_t fgkChi2CMax = 100.;
343 Double_t *binsChi2C=new Double_t[fgkNChi2CBins+1];
344 for(Int_t i=0; i<=fgkNChi2CBins; i++) binsChi2C[i]=(Double_t)fgkChi2CMin + (fgkChi2CMax-fgkChi2CMin)/fgkNChi2CBins*(Double_t)i ;
346 Int_t fgkNRel1PtUncertaintyBins=30;
347 Float_t fgkRel1PtUncertaintyMin = 0.;
348 Float_t fgkRel1PtUncertaintyMax = 0.3;
349 if(fTrackType!=0 && fTrackType!=3) {
350 fgkNRel1PtUncertaintyBins = 50;
351 fgkRel1PtUncertaintyMax = 1.;
353 Double_t *binsRel1PtUncertainty=new Double_t[fgkNRel1PtUncertaintyBins+1];
354 for(Int_t i=0; i<=fgkNRel1PtUncertaintyBins; i++) binsRel1PtUncertainty[i]=(Double_t)fgkRel1PtUncertaintyMin + (fgkRel1PtUncertaintyMax-fgkRel1PtUncertaintyMin)/fgkNRel1PtUncertaintyBins*(Double_t)i ;
356 Int_t fgkNUncertainty1PtBins = 30;
357 Float_t fgkUncertainty1PtMin = 0.;
358 Float_t fgkUncertainty1PtMax = 0.1;
359 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
360 fgkUncertainty1PtMax = 0.2;
361 Double_t *binsUncertainty1Pt=new Double_t[fgkNUncertainty1PtBins+1];
362 for(Int_t i=0; i<=fgkNUncertainty1PtBins; i++) binsUncertainty1Pt[i]=(Double_t)fgkUncertainty1PtMin + (fgkUncertainty1PtMax-fgkUncertainty1PtMin)/fgkNUncertainty1PtBins*(Double_t)i ;
364 Float_t fgkChi2PerClusMin = 0.;
365 Float_t fgkChi2PerClusMax = 4.;
366 Int_t fgkNChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
367 Double_t *binsChi2PerClus=new Double_t[fgkNChi2PerClusBins+1];
368 for(Int_t i=0; i<=fgkNChi2PerClusBins; i++) binsChi2PerClus[i]=(Double_t)fgkChi2PerClusMin + (fgkChi2PerClusMax-fgkChi2PerClusMin)/fgkNChi2PerClusBins*(Double_t)i ;
370 Int_t fgkNCrossedRowsNClusFBins = 50;
371 Float_t fgkNCrossedRowsNClusFMin = 0.;
372 Float_t fgkNCrossedRowsNClusFMax = 1.;
373 Double_t *binsNCrossedRowsNClusF=new Double_t[fgkNCrossedRowsNClusFBins+1];
374 for(Int_t i=0; i<=fgkNCrossedRowsNClusFBins; i++) binsNCrossedRowsNClusF[i]=(Double_t)fgkNCrossedRowsNClusFMin + (fgkNCrossedRowsNClusFMax-fgkNCrossedRowsNClusFMin)/fgkNCrossedRowsNClusFBins*(Double_t)i ;
376 Float_t fgk1PtMin = 0.;
377 Float_t fgk1PtMax = 6.;
378 Float_t binEdge1Pt1 = 1.;
379 Float_t binWidth1Pt1 = 0.05;
380 Int_t fgkN1PtBins1 = (int)((binEdge1Pt1-fgk1PtMin)/binWidth1Pt1);
381 Float_t binWidth1Pt2 = 0.1;
382 Int_t fgkN1PtBins2 = (int)((fgk1PtMax-binEdge1Pt1)/binWidth1Pt2);
383 Int_t fgkN1PtBins = fgkN1PtBins1+fgkN1PtBins2;
384 Double_t *bins1Pt=new Double_t[fgkN1PtBins+1];
386 for(Int_t i=0; i<=fgkN1PtBins; i++) {
388 bins1Pt[i]=(Double_t)fgk1PtMin + (Double_t)(binEdge1Pt1-fgk1PtMin)/(Double_t)fgkN1PtBins1*(Double_t)i;
389 if(i<=fgkN1PtBins && i>fgkN1PtBins1)
390 bins1Pt[i]=(Double_t)binEdge1Pt1 + (Double_t)(fgk1PtMax-binEdge1Pt1)/(Double_t)fgkN1PtBins2*(Double_t)(i-fgkN1PtBins1);
393 Int_t fgkNSigmaY2Bins = 50;
394 Float_t fgkSigmaY2Min = 0.;
395 Float_t fgkSigmaY2Max = 1.;
396 if(fTrackType==1) fgkSigmaY2Max = 4.;
397 if(fTrackType==2 || fTrackType==4) fgkSigmaY2Max = 0.1;
398 Double_t *binsSigmaY2=new Double_t[fgkNSigmaY2Bins+1];
399 for(Int_t i=0; i<=fgkNSigmaY2Bins; i++) binsSigmaY2[i]=(Double_t)fgkSigmaY2Min + (fgkSigmaY2Max-fgkSigmaY2Min)/fgkNSigmaY2Bins*(Double_t)i ;
401 Int_t fgkNSigmaZ2Bins = 50;
402 Float_t fgkSigmaZ2Min = 0.;
403 Float_t fgkSigmaZ2Max = 0.4;
404 Double_t *binsSigmaZ2=new Double_t[fgkNSigmaZ2Bins+1];
405 for(Int_t i=0; i<=fgkNSigmaZ2Bins; i++) binsSigmaZ2[i]=(Double_t)fgkSigmaZ2Min + (fgkSigmaZ2Max-fgkSigmaZ2Min)/fgkNSigmaZ2Bins*(Double_t)i ;
407 Int_t fgkNSigmaSnp2Bins = 50;
408 Float_t fgkSigmaSnp2Min = 0.;
409 Float_t fgkSigmaSnp2Max = 0.05;
410 if(fTrackType==1) fgkSigmaSnp2Max = 0.2;
411 if(fTrackType==2 || fTrackType==4) fgkSigmaSnp2Max = 0.1;
412 Double_t *binsSigmaSnp2=new Double_t[fgkNSigmaSnp2Bins+1];
413 for(Int_t i=0; i<=fgkNSigmaSnp2Bins; i++) binsSigmaSnp2[i]=(Double_t)fgkSigmaSnp2Min + (fgkSigmaSnp2Max-fgkSigmaSnp2Min)/fgkNSigmaSnp2Bins*(Double_t)i ;
415 Int_t fgkNSigmaTgl2Bins = 50;
416 Float_t fgkSigmaTgl2Min = 0.;
417 Float_t fgkSigmaTgl2Max = 0.1;
418 if(fTrackType==1) fgkSigmaTgl2Max = 0.2;
419 if(fTrackType==2 || fTrackType==4) fgkSigmaTgl2Max = 0.1;
420 Double_t *binsSigmaTgl2=new Double_t[fgkNSigmaTgl2Bins+1];
421 for(Int_t i=0; i<=fgkNSigmaTgl2Bins; i++) binsSigmaTgl2[i]=(Double_t)fgkSigmaTgl2Min + (fgkSigmaTgl2Max-fgkSigmaTgl2Min)/fgkNSigmaTgl2Bins*(Double_t)i ;
423 Int_t fgkNSigma1Pt2Bins = 50;
424 Float_t fgkSigma1Pt2Min = 0.;
425 Float_t fgkSigma1Pt2Max = 1.;
426 Double_t *binsSigma1Pt2=new Double_t[fgkNSigma1Pt2Bins+1];
427 for(Int_t i=0; i<=fgkNSigma1Pt2Bins; i++) binsSigma1Pt2[i]=(Double_t)fgkSigma1Pt2Min + (fgkSigma1Pt2Max-fgkSigma1Pt2Min)/fgkNSigma1Pt2Bins*(Double_t)i ;
430 fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
431 fHistList->Add(fNEventAll);
432 fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
433 fHistList->Add(fNEventSel);
434 fNEventReject = new TH1F("fNEventReject","Reason events are rejectected for analysis",20,0,20);
436 fNEventReject->Fill("noESD",0);
437 fNEventReject->Fill("Trigger",0);
438 fNEventReject->Fill("NTracks<2",0);
439 fNEventReject->Fill("noVTX",0);
440 fNEventReject->Fill("VtxStatus",0);
441 fNEventReject->Fill("NCont<2",0);
442 fNEventReject->Fill("ZVTX>10",0);
443 fNEventReject->Fill("cent",0);
444 fNEventReject->Fill("cent>90",0);
445 fHistList->Add(fNEventReject);
447 fh1Centrality = new TH1F("fh1Centrality","fh1Centrality; Centrality %",100,0,100);
448 fHistList->Add(fh1Centrality);
450 fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
451 fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
452 fHistList->Add(fh1Xsec);
454 fh1Trials = new TH1F("fh1Trials","trials root file",1,0,1);
455 fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
456 fHistList->Add(fh1Trials);
458 fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
459 fHistList->Add(fh1PtHard);
460 fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
461 fHistList->Add(fh1PtHardTrials);
463 fh1NTracksAll = new TH1F("fh1NTracksAll","fh1NTracksAll",1,-0.5,0.5);
464 fHistList->Add(fh1NTracksAll);
466 fh1NTracksReject = new TH1F("fh1NTracksReject","fh1NTracksReject",1,-0.5,0.5);
467 fh1NTracksReject->Fill("noESDtrack",0);
468 fh1NTracksReject->Fill("noTPCInner",0);
469 fh1NTracksReject->Fill("FillTPC",0);
470 fh1NTracksReject->Fill("noTPConly",0);
471 fh1NTracksReject->Fill("relate",0);
472 fh1NTracksReject->Fill("trackCuts",0);
473 fh1NTracksReject->Fill("laser",0);
474 fh1NTracksReject->Fill("chi2",0);
475 fHistList->Add(fh1NTracksReject);
477 fh1NTracksSel = new TH1F("fh1NTracksSel","fh1NTracksSel",1,-0.5,0.5);
478 fHistList->Add(fh1NTracksSel);
480 fSystTrackCuts = new TH1F("fSystTrackCuts","fSystTrackCuts",1,-0.5,0.5);
481 fSystTrackCuts->Fill("noCut",0);
482 fSystTrackCuts->Fill("eta",0);
483 fSystTrackCuts->Fill("0.15<pT<1e10",0);
484 fSystTrackCuts->Fill("kink",0);
485 fSystTrackCuts->Fill("NClusterTPC",0);
486 fSystTrackCuts->Fill("Chi2PerNClusTPC",0);
487 fSystTrackCuts->Fill("DCA2D",0);
488 fHistList->Add(fSystTrackCuts);
491 fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, binsPt);
492 fHistList->Add(fPtAll);
493 fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, binsPt);
494 fHistList->Add(fPtSel);
496 fPtPhi = new TH2F("fPtPhi","fPtPhi",fgkNPtBins,binsPt,fgkNPhiBins,binsPhi);
497 fHistList->Add(fPtPhi);
499 fPtEta = new TH2F("fPtEta","fPtEta",fgkNPtBins,binsPt,fgkNEtaBins,binsEta);
500 fHistList->Add(fPtEta);
502 fPtDCA2D = new TH2F("fPtDCA2D","fPtDCA2D",fgkNPtBins,binsPt,fgkNDCA2DBins,binsDCA2D);
503 fHistList->Add(fPtDCA2D);
505 fPtDCAZ = new TH2F("fPtDCAZ","fPtDCAZ",fgkNPtBins,binsPt,fgkNDCAZBins,binsDCAZ);
506 fHistList->Add(fPtDCAZ);
508 fPtNClustersTPC = new TH2F("fPtNClustersTPC","fPtNClustersTPC",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
509 fHistList->Add(fPtNClustersTPC);
511 fPtNClustersTPCIter1 = new TH2F("fPtNClustersTPCIter1","fPtNClustersTPCIter1",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
512 fHistList->Add(fPtNClustersTPCIter1);
514 fPtNPointITS = new TH2F("fPtNPointITS","fPtNPointITS",fgkNPtBins,binsPt,fgkNNPointITSBins,binsNPointITS);
515 fHistList->Add(fPtNPointITS);
517 fPtChi2C = new TH2F("fPtChi2C","fPtChi2C",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
518 fHistList->Add(fPtChi2C);
520 fPtNSigmaToVertex = new TH2F("fPtNSigmaToVertex","fPtNSigmaToVertex",fgkNPtBins,binsPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
521 fHistList->Add(fPtNSigmaToVertex);
523 fPtRelUncertainty1Pt = new TH2F("fPtRelUncertainty1Pt","fPtRelUncertainty1Pt",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
524 fHistList->Add(fPtRelUncertainty1Pt);
526 fPtRelUncertainty1PtNClus = new TH3F("fPtRelUncertainty1PtNClus","fPtRelUncertainty1PtNClus",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
527 fHistList->Add(fPtRelUncertainty1PtNClus);
529 fPtRelUncertainty1PtNClusIter1 = new TH3F("fPtRelUncertainty1PtNClusIter1","fPtRelUncertainty1PtNClusIter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
530 fHistList->Add(fPtRelUncertainty1PtNClusIter1);
532 fPtRelUncertainty1PtChi2 = new TH3F("fPtRelUncertainty1PtChi2","fPtRelUncertainty1PtChi2",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
533 fHistList->Add(fPtRelUncertainty1PtChi2);
535 fPtRelUncertainty1PtChi2Iter1 = new TH3F("fPtRelUncertainty1PtChi2Iter1","fPtRelUncertainty1PtChi2Iter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
536 fHistList->Add(fPtRelUncertainty1PtChi2Iter1);
538 fPtRelUncertainty1PtPhi = new TH3F("fPtRelUncertainty1PtPhi","fPtRelUncertainty1PtPhi",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNPhiBins,binsPhi);
539 fHistList->Add(fPtRelUncertainty1PtPhi);
541 fPtRelUncertainty1PtTrkLength = new TH3F("fPtRelUncertainty1PtTrkLength","fPtRelUncertainty1PtTrkLength",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
542 fHistList->Add(fPtRelUncertainty1PtTrkLength);
544 fPtUncertainty1Pt = new TH2F("fPtUncertainty1Pt","fPtUncertainty1Pt",fgkNPtBins,binsPt,fgkNUncertainty1PtBins,binsUncertainty1Pt);
545 fHistList->Add(fPtUncertainty1Pt);
547 fPtChi2PerClusterTPC = new TH2F("fPtChi2PerClusterTPC","fPtChi2PerClusterTPC",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
548 fHistList->Add(fPtChi2PerClusterTPC);
550 fPtChi2PerClusterTPCIter1 = new TH2F("fPtChi2PerClusterTPCIter1","fPtChi2PerClusterTPCIter1",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
551 fHistList->Add(fPtChi2PerClusterTPCIter1);
553 fPtNCrossedRows = new TH2F("fPtNCrossedRows","fPtNCrossedRows",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
554 fHistList->Add(fPtNCrossedRows);
556 fPtNCrossedRowsNClusF = new TH2F("fPtNCrossedRowsNClusF","fPtNCrossedRowsNClusF",fgkNPtBins,binsPt,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
557 fHistList->Add(fPtNCrossedRowsNClusF);
559 fPtNCrRNCrRNClusF = new TH3F("fPtNCrRNCrRNClusF","fPtNCrRNCrRNClusF",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
560 fHistList->Add(fPtNCrRNCrRNClusF);
562 fPtSigmaY2 = new TH2F("fPtSigmaY2","fPtSigmaY2",fgkN1PtBins,bins1Pt,fgkNSigmaY2Bins,binsSigmaY2);
563 fHistList->Add(fPtSigmaY2);
565 fPtSigmaZ2 = new TH2F("fPtSigmaZ2","fPtSigmaZ2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaZ2);
566 fHistList->Add(fPtSigmaZ2);
568 fPtSigmaSnp2 = new TH2F("fPtSigmaSnp2","fPtSigmaSnp2",fgkN1PtBins,bins1Pt,fgkNSigmaSnp2Bins,binsSigmaSnp2);
569 fHistList->Add(fPtSigmaSnp2);
571 fPtSigmaTgl2 = new TH2F("fPtSigmaTgl2","fPtSigmaTgl2",fgkN1PtBins,bins1Pt,fgkNSigmaTgl2Bins,binsSigmaTgl2);
572 fHistList->Add(fPtSigmaTgl2);
574 fPtSigma1Pt2 = new TH2F("fPtSigma1Pt2","fPtSigma1Pt2",fgkN1PtBins,bins1Pt,fgkNSigma1Pt2Bins,binsSigma1Pt2);
575 fHistList->Add(fPtSigma1Pt2);
577 fProfPtSigmaY2 = new TProfile("fProfPtSigmaY2","fProfPtSigmaY2",fgkN1PtBins,bins1Pt);
578 fHistList->Add(fProfPtSigmaY2);
580 fProfPtSigmaZ2 = new TProfile("fProfPtSigmaZ2","fProfPtSigmaZ2",fgkN1PtBins,bins1Pt);
581 fHistList->Add(fProfPtSigmaZ2);
583 fProfPtSigmaSnp2 = new TProfile("fProfPtSigmaSnp2","fProfPtSigmaSnp2",fgkN1PtBins,bins1Pt);
584 fHistList->Add(fProfPtSigmaSnp2);
586 fProfPtSigmaTgl2 = new TProfile("fProfPtSigmaTgl2","fProfPtSigmaTgl2",fgkN1PtBins,bins1Pt);
587 fHistList->Add(fProfPtSigmaTgl2);
589 fProfPtSigma1Pt2 = new TProfile("fProfPtSigma1Pt2","fProfPtSigma1Pt2",fgkN1PtBins,bins1Pt);
590 fHistList->Add(fProfPtSigma1Pt2);
592 fProfPtSigma1Pt = new TProfile("fProfPtSigma1Pt","fProfPtSigma1Pt;p_{T};#sigma(1/p_{T})",fgkNPtBins,binsPt);
593 fHistList->Add(fProfPtSigma1Pt);
595 fProfPtPtSigma1Pt = new TProfile("fProfPtPtSigma1Pt","fProfPtPtSigma1Pt;p_{T};p_{T}#sigma(1/p_{T})",fgkNPtBins,binsPt);
596 fHistList->Add(fProfPtPtSigma1Pt);
598 TH1::AddDirectory(oldStatus);
600 PostData(1, fHistList);
602 if(binsPhi) delete [] binsPhi;
603 if(binsPt) delete [] binsPt;
604 if(binsNClustersTPC) delete [] binsNClustersTPC;
605 if(binsDCA2D) delete [] binsDCA2D;
606 if(binsDCAZ) delete [] binsDCAZ;
607 if(binsNPointITS) delete [] binsNPointITS;
608 if(binsNSigmaToVertex) delete [] binsNSigmaToVertex;
609 if(binsChi2C) delete [] binsChi2C;
610 if(binsEta) delete [] binsEta;
611 if(binsRel1PtUncertainty) delete [] binsRel1PtUncertainty;
612 if(binsUncertainty1Pt) delete [] binsUncertainty1Pt;
613 if(binsChi2PerClus) delete [] binsChi2PerClus;
614 if(binsChi2PerClus) delete [] binsNCrossedRowsNClusF;
615 if(bins1Pt) delete [] bins1Pt;
616 if(binsSigmaY2) delete [] binsSigmaY2;
617 if(binsSigmaZ2) delete [] binsSigmaZ2;
618 if(binsSigmaSnp2) delete [] binsSigmaSnp2;
619 if(binsSigmaTgl2) delete [] binsSigmaTgl2;
620 if(binsSigma1Pt2) delete [] binsSigma1Pt2;
623 //________________________________________________________________________
624 Bool_t AliPWG4HighPtTrackQA::SelectEvent() {
626 // Decide if event should be selected for analysis
629 // Checks following requirements:
630 // - fEvent available
631 // - trigger info from AliPhysicsSelection
632 // - MCevent available
633 // - number of reconstructed tracks > 1
634 // - primary vertex reconstructed
635 // - z-vertex < 10 cm
636 // - centrality in case of PbPb
638 Bool_t selectEvent = kTRUE;
640 //fEvent object available?
642 AliDebug(2,Form("ERROR: fInputEvent not available\n"));
643 fNEventReject->Fill("noAliVEvent",1);
644 selectEvent = kFALSE;
648 //Check if number of reconstructed tracks is larger than 1
649 if(!fEvent->GetNumberOfTracks() || fEvent->GetNumberOfTracks()<2) {
650 fNEventReject->Fill("NTracks<2",1);
651 selectEvent = kFALSE;
655 //Check if vertex is reconstructed
656 if(fDataType==kESD&&dynamic_cast<AliESDEvent*>(fEvent)) {
657 fVtx = ((AliESDEvent*)fEvent)->GetPrimaryVertexSPD();
660 fNEventReject->Fill("noVTX",1);
661 selectEvent = kFALSE;
665 if(!fVtx->GetStatus()) {
666 fNEventReject->Fill("VtxStatus",1);
667 selectEvent = kFALSE;
672 if(fVtx->GetNContributors()<2) {
673 fNEventReject->Fill("NCont<2",1);
674 selectEvent = kFALSE;
678 //Check if z-vertex < 10 cm
680 fVtx->GetXYZ(primVtx);
681 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
682 fNEventReject->Fill("ZVTX>10",1);
683 selectEvent = kFALSE;
687 else if(fDataType==kAOD&&dynamic_cast<AliAODEvent*>(fEvent)) {
688 const AliAODVertex *vtx = ((AliAODEvent*)fEvent)->GetPrimaryVertexSPD();
690 fNEventReject->Fill("noVTX",1);
691 selectEvent = kFALSE;
696 if(vtx->GetNContributors()<2) {
697 fNEventReject->Fill("NCont<2",1);
698 selectEvent = kFALSE;
702 //Check if z-vertex < 10 cm
704 vtx->GetXYZ(primVtx);
705 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
706 fNEventReject->Fill("ZVTX>10",1);
707 selectEvent = kFALSE;
713 //Centrality selection should only be done in case of PbPb
716 if(fCentClass!=CalculateCentrality(fEvent) && fCentClass!=10) {
717 fNEventReject->Fill("cent",1);
718 selectEvent = kFALSE;
722 if(fDataType==kESD) {
723 if(dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()) {
724 cent = dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()->GetCentralityPercentile("V0M");
727 else if(fDataType==kAOD) {
728 if(dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality())
729 cent = dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality();
732 fNEventReject->Fill("cent>90",1);
733 selectEvent = kFALSE;
736 fh1Centrality->Fill(cent);
744 //________________________________________________________________________
745 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliVEvent *ev){
747 // Get centrality from ESD or AOD
751 return CalculateCentrality(dynamic_cast<AliESDEvent*>(ev));
752 else if(fDataType==kAOD)
753 return CalculateCentrality(dynamic_cast<AliAODEvent*>(ev));
758 //________________________________________________________________________
759 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliESDEvent *esd){
761 // Get centrality from ESD
767 if(esd->GetCentrality()){
768 cent = esd->GetCentrality()->GetCentralityPercentile("V0M");
769 if(fDebug>3) printf("centrality: %f\n",cent);
773 return GetCentralityClass(cent);
777 //________________________________________________________________________
778 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliAODEvent *aod){
780 // Get centrality from AOD
784 Float_t cent = aod->GetHeader()->GetCentrality();
785 if(fDebug>3) printf("centrality: %f\n",cent);
787 return GetCentralityClass(cent);
791 //________________________________________________________________________
792 Int_t AliPWG4HighPtTrackQA::GetCentralityClass(Float_t cent) {
794 // Get centrality class
797 if(cent<0) return 5; // OB - cent sometimes negative
798 if(cent>80) return 4;
799 if(cent>50) return 3;
800 if(cent>30) return 2;
801 if(cent>10) return 1;
806 //________________________________________________________________________
807 void AliPWG4HighPtTrackQA::UserExec(Option_t *) {
809 // Called for each event
810 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserExec \n"));
812 fEvent = InputEvent();
813 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
815 // All events without selection
816 fNEventAll->Fill(0.);
820 PostData(1, fHistList);
825 //Need to keep track of selected events
826 fNEventSel->Fill(0.);
828 fVariables = new TArrayF(fNVariables);
830 if(fDataType==kESD) DoAnalysisESD();
831 if(fDataType==kAOD) DoAnalysisAOD();
833 //Delete old fVariables
834 if(fVariables) delete fVariables;
837 PostData(1, fHistList);
841 //________________________________________________________________________
842 void AliPWG4HighPtTrackQA::DoAnalysisESD() {
844 // Run analysis on ESD
848 PostData(1, fHistList);
852 // ---- Get MC Header information (for MC productions in pThard bins) ----
853 Double_t ptHard = 0.;
854 Double_t nTrials = 1; // trials for MC trigger weight for real data
856 AliMCEventHandler *eventHandlerMC = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
857 if (eventHandlerMC) {
859 if(eventHandlerMC->MCEvent()){
860 AliGenPythiaEventHeader* pythiaGenHeader = GetPythiaEventHeader(eventHandlerMC->MCEvent());
862 nTrials = pythiaGenHeader->Trials();
863 ptHard = pythiaGenHeader->GetPtHard();
865 fh1PtHard->Fill(ptHard);
866 fh1PtHardTrials->Fill(ptHard,nTrials);
868 fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
873 Int_t nTracks = fESD->GetNumberOfTracks();
874 AliDebug(2,Form("nTracks ESD%d", nTracks));
877 Variables to be put in fVariables
888 10: chi2PerClusterTPC
890 12: (#crossed rows)/(#findable clusters)
896 18: NClustersTPCIter1
900 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
901 fh1NTracksAll->Fill(0.);
903 //Get track for analysis
904 AliESDtrack *track = 0x0;
905 AliESDtrack *esdtrack = fESD->GetTrack(iTrack);
907 fh1NTracksReject->Fill("noESDtrack",1);
912 FillSystematicCutHist(esdtrack);
913 if (!(fTrackCuts->AcceptTrack(esdtrack))) {
914 fh1NTracksReject->Fill("trackCuts",1);
920 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
921 else if(fTrackType==2 || fTrackType==4) {
922 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
924 fh1NTracksReject->Fill("noTPConly",1);
927 AliExternalTrackParam exParam;
928 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
930 fh1NTracksReject->Fill("relate",1);
931 if(track) delete track;
934 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
936 else if(fTrackType==5 || fTrackType==6) {
937 if(fTrackCuts->AcceptTrack(esdtrack)) {
941 if( !(fTrackCutsITSLoose->AcceptTrack(esdtrack)) && fTrackCutsTPConly->AcceptTrack(esdtrack) ) {
944 //use TPConly constrained track
945 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
947 fh1NTracksReject->Fill("noTPConly",1);
950 AliExternalTrackParam exParam;
951 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
953 fh1NTracksReject->Fill("relate",1);
954 if(track) delete track;
957 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
959 else if(fTrackType==6) {
960 //use global constrained track
962 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
975 if(fTrackType==2 || fTrackType==4 || fTrackType==5) {
976 //Cut on chi2 of constrained fit
977 if(track->GetConstrainedChi2TPC() > fSigmaConstrainedMax*fSigmaConstrainedMax && fSigmaConstrainedMax>0.) {
978 fh1NTracksReject->Fill("chi2",1);
979 if(track) delete track;
985 FillSystematicCutHist(track);
987 fPtAll->Fill(track->Pt());
989 if (!(fTrackCuts->AcceptTrack(track)) && fTrackType!=4 && fTrackType!=5 && fTrackType!=6) {
990 fh1NTracksReject->Fill("trackCuts",1);
991 if(fTrackType==1 || fTrackType==2) {
992 if(track) delete track;
997 fh1NTracksSel->Fill(0.);
999 fVariables->Reset(0.);
1001 fVariables->SetAt(track->Pt(),0);
1002 fVariables->SetAt(track->Phi(),1);
1003 fVariables->SetAt(track->Eta(),2);
1007 if(fTrackType==0) { //Global
1008 track->GetImpactParameters(dca2D,dcaz);
1010 else if(fTrackType==1 || fTrackType==2 || fTrackType==4) { //TPConly
1011 track->GetImpactParametersTPC(dca2D,dcaz);
1013 fVariables->SetAt(dca2D,3);
1014 fVariables->SetAt(dcaz,5);
1016 fVariables->SetAt((float)track->GetTPCNcls(),5);
1018 Int_t nPointITS = 0;
1019 UChar_t itsMap = track->GetITSClusterMap();
1020 for (Int_t i=0; i < 6; i++) {
1021 if (itsMap & (1 << i))
1024 fVariables->SetAt((float)nPointITS,6);
1025 Float_t chi2C = (float)track->GetConstrainedChi2();
1026 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
1027 chi2C = (float)track->GetConstrainedChi2TPC();
1028 fVariables->SetAt(chi2C,7);
1029 fVariables->SetAt(fTrackCuts->GetSigmaToVertex(track),8);// Calculates the number of sigma to the vertex for a track.
1031 fVariables->SetAt(GetTrackLengthTPC(track),9);
1033 if(fVariables->At(5)>0.) fVariables->SetAt(track->GetTPCchi2()/fVariables->At(5),10);
1035 fVariables->SetAt(track->GetTPCClusterInfo(2,1),11); //#crossed rows
1036 Float_t crossedRowsTPCNClsF = 1.;//track->GetTPCClusterInfo(2,0);
1037 if(track->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/track->GetTPCNclsF();
1038 fVariables->SetAt(crossedRowsTPCNClsF,12);//(#crossed rows)/(#findable clusters)
1039 fVariables->SetAt(track->GetSigmaY2(),13);
1040 fVariables->SetAt(track->GetSigmaZ2(),14);
1041 fVariables->SetAt(track->GetSigmaSnp2(),15);
1042 fVariables->SetAt(track->GetSigmaTgl2(),16);
1043 fVariables->SetAt(track->GetSigma1Pt2(),17);
1045 fVariables->SetAt(track->GetTPCNclsIter1(),18);
1046 fVariables->SetAt(track->GetTPCchi2Iter1(),19);
1050 // int mult = fTrackCuts->CountAcceptedTracks(fESD);
1052 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==5) {
1053 if(track) delete track;
1060 //________________________________________________________________________
1061 void AliPWG4HighPtTrackQA::DoAnalysisAOD() {
1063 AliAODEvent *aod = dynamic_cast<AliAODEvent*>(fEvent);
1065 AliExternalTrackParam *exParam = new AliExternalTrackParam();
1066 for (Int_t iTrack = 0; iTrack < fEvent->GetNumberOfTracks(); iTrack++) {
1068 AliAODTrack *aodtrack = aod->GetTrack(iTrack);
1069 if( !aodtrack->TestFilterMask(fFilterMask) ) continue;
1071 fVariables->Reset(0.);
1073 fVariables->SetAt(aodtrack->Pt(),0);
1074 fVariables->SetAt(aodtrack->Phi(),1);
1075 fVariables->SetAt(aodtrack->Eta(),2);
1077 Double_t dca[2] = {1e6,1e6};
1078 Double_t covar[3] = {1e6,1e6,1e6};
1079 if(aodtrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),100.,dca,covar)) {
1080 fVariables->SetAt(dca[0],3);
1081 fVariables->SetAt(dca[1],4);
1084 fVariables->SetAt((float)aodtrack->GetTPCNcls(),5);
1085 fVariables->SetAt((float)aodtrack->GetITSNcls(),6);
1086 fVariables->SetAt(aodtrack->Chi2perNDF(),7);
1087 fVariables->SetAt(0.,8);
1088 fVariables->SetAt(GetTrackLengthTPC(aodtrack),9);
1089 fVariables->SetAt(aodtrack->Chi2perNDF(),10);
1090 fVariables->SetAt(GetTPCClusterInfo(aodtrack,2),11);
1091 Float_t crossedRowsTPCNClsF = 0.;
1092 if(aodtrack->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/aodtrack->GetTPCNclsF();
1093 fVariables->SetAt(crossedRowsTPCNClsF,12);
1095 //get covariance matrix
1096 Double_t cov[21] = {0,};
1097 aodtrack->GetCovMatrix(cov);
1098 Double_t pxpypz[3] = {0,};
1099 aodtrack->PxPyPz(pxpypz);
1100 Double_t xyz[3] = {0,};
1101 aodtrack->GetXYZ(xyz);
1102 Short_t sign = aodtrack->Charge();
1103 exParam->Set(xyz,pxpypz,cov,sign);
1105 fVariables->SetAt(exParam->GetSigmaY2(),13);
1106 fVariables->SetAt(exParam->GetSigmaZ2(),14);
1107 fVariables->SetAt(exParam->GetSigmaSnp2(),15);
1108 fVariables->SetAt(exParam->GetSigmaTgl2(),16);
1109 fVariables->SetAt(exParam->GetSigma1Pt2(),17);
1111 fVariables->SetAt(0.,18);
1112 fVariables->SetAt(0.,19);
1114 fPtAll->Fill(fVariables->At(0));
1122 //________________________________________________________________________
1123 void AliPWG4HighPtTrackQA::FillHistograms() {
1125 fPtSel->Fill(fVariables->At(0));
1126 fPtPhi->Fill(fVariables->At(0),fVariables->At(1));
1127 fPtEta->Fill(fVariables->At(0),fVariables->At(2));
1128 fPtDCA2D->Fill(fVariables->At(0),fVariables->At(3));
1129 fPtDCAZ->Fill(fVariables->At(0),fVariables->At(4));
1130 fPtNClustersTPC->Fill(fVariables->At(0),fVariables->At(5));
1131 fPtNPointITS->Fill(fVariables->At(0),fVariables->At(6));
1134 fPtNClustersTPCIter1->Fill(fVariables->At(0),fVariables->At(18));
1135 if(fVariables->At(18)>0.)
1136 fPtChi2PerClusterTPCIter1->Fill(fVariables->At(0),fVariables->At(19)/fVariables->At(18));
1138 fPtChi2C->Fill(fVariables->At(0),fVariables->At(7));
1139 fPtNSigmaToVertex->Fill(fVariables->At(0),fVariables->At(8));
1140 fPtRelUncertainty1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1141 fPtRelUncertainty1PtNClus->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(5));
1142 fPtRelUncertainty1PtNClusIter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(18));
1143 fPtRelUncertainty1PtChi2->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(10));
1144 if(fVariables->At(18)>0.)
1145 fPtRelUncertainty1PtChi2Iter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(19)/fVariables->At(18));
1146 fPtRelUncertainty1PtPhi->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(1));
1147 fPtRelUncertainty1PtTrkLength->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(9));
1149 fPtUncertainty1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1150 fPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1151 fPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1152 fPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1153 fPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1154 fPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1156 fProfPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1157 fProfPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1158 fProfPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1159 fProfPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1160 fProfPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1161 fProfPtSigma1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1162 fProfPtPtSigma1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1164 fPtChi2PerClusterTPC->Fill(fVariables->At(0),fVariables->At(10));
1165 fPtNCrossedRows->Fill(fVariables->At(0),fVariables->At(11));
1166 fPtNCrossedRowsNClusF->Fill(fVariables->At(0),fVariables->At(12));
1167 fPtNCrRNCrRNClusF->Fill(fVariables->At(0),fVariables->At(11),fVariables->At(12));
1170 //________________________________________________________________________
1171 Bool_t AliPWG4HighPtTrackQA::PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials){
1173 // get the cross section and the trails either from pyxsec.root or from pysec_hists.root
1174 // This is to called in Notify and should provide the path to the AOD/ESD file
1175 // Copied from AliAnalysisTaskJetSpectrum2
1178 TString file(currFile);
1182 if(file.Contains("root_archive.zip#")){
1183 Ssiz_t pos1 = file.Index("root_archive",12,TString::kExact);
1184 Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
1185 file.Replace(pos+1,20,"");
1188 // not an archive take the basename....
1189 file.ReplaceAll(gSystem->BaseName(file.Data()),"");
1191 // Printf("%s",file.Data());
1194 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
1196 // next trial fetch the histgram file
1197 fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root"));
1199 // not a severe condition but inciate that we have no information
1203 // find the tlist we want to be independtent of the name so use the Tkey
1204 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
1209 TList *list = dynamic_cast<TList*>(key->ReadObj());
1214 fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
1215 fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
1218 } // no tree pyxsec.root
1220 TTree *xtree = (TTree*)fxsec->Get("Xsection");
1226 Double_t xsection = 0;
1227 xtree->SetBranchAddress("xsection",&xsection);
1228 xtree->SetBranchAddress("ntrials",&ntrials);
1236 //________________________________________________________________________
1237 Bool_t AliPWG4HighPtTrackQA::Notify()
1240 // Implemented Notify() to read the cross sections
1241 // and number of trials from pyxsec.root
1242 // Copied from AliAnalysisTaskJetSpectrum2
1245 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
1246 Float_t xsection = 0;
1247 Float_t ftrials = 1;
1251 TFile *curfile = tree->GetCurrentFile();
1253 Error("Notify","No current file");
1256 if(!fh1Xsec||!fh1Trials){
1257 // Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
1260 PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
1261 fh1Xsec->Fill("<#sigma>",xsection);
1262 // construct a poor man average trials
1263 Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
1264 if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
1269 //________________________________________________________________________
1270 AliGenPythiaEventHeader* AliPWG4HighPtTrackQA::GetPythiaEventHeader(AliMCEvent *mcEvent){
1272 if(!mcEvent)return 0;
1273 AliGenEventHeader* genHeader = mcEvent->GenEventHeader();
1274 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
1275 if(!pythiaGenHeader){
1277 AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader);
1279 if (!genCocktailHeader) {
1280 // AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Unknown header type (not Pythia or Cocktail)");
1281 // AliWarning(Form("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__));
1284 TList* headerList = genCocktailHeader->GetHeaders();
1285 for (Int_t i=0; i<headerList->GetEntries(); i++) {
1286 pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
1287 if (pythiaGenHeader)
1290 if(!pythiaGenHeader){
1291 AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Pythia event header not found");
1295 return pythiaGenHeader;
1299 //_______________________________________________________________________
1300 Float_t AliPWG4HighPtTrackQA::GetTPCClusterInfo(AliAODTrack *tr,Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const
1302 //MV: copied from AliESDtrack since method is not available in AliAODTrack
1305 // TPC cluster information
1306 // type 0: get fraction of found/findable clusters with neighbourhood definition
1307 // 1: findable clusters with neighbourhood definition
1308 // 2: found clusters
1310 // definition of findable clusters:
1311 // a cluster is defined as findable if there is another cluster
1312 // within +- nNeighbours pad rows. The idea is to overcome threshold
1313 // effects with a very simple algorithm.
1316 TBits fTPCClusterMap = tr->GetTPCClusterMap();
1317 if (type==2) return fTPCClusterMap.CountBits();
1321 Int_t last=-nNeighbours;
1323 for (Int_t i=row0; i<row1; ++i){
1324 //look to current row
1325 if (fTPCClusterMap[i]) {
1331 //look to nNeighbours before
1332 if ((i-last)<=nNeighbours) {
1336 //look to nNeighbours after
1337 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1338 if (fTPCClusterMap[j]){
1344 if (type==1) return findable;
1349 fraction=(Float_t)found/(Float_t)findable;
1354 return 0; // undefined type - default value
1357 //_______________________________________________________________________
1358 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(AliESDtrack *track) {
1360 // returns distance between 1st and last hit in TPC
1361 // distance given in number of padrows
1364 TBits fTPCClusterMap = track->GetTPCClusterMap();
1368 for(int i=0; i<=159; i++) {
1369 if(fTPCClusterMap[i]>0) firstHit = i;
1371 for(int i=159; i>=0; i--) {
1372 if(fTPCClusterMap[i]>0) lastHit = i;
1375 Int_t trackLength = lastHit - firstHit;
1380 //_______________________________________________________________________
1381 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(AliAODTrack *track) {
1383 // returns distance between 1st and last hit in TPC
1384 // distance given in number of padrows
1387 TBits fTPCClusterMap = track->GetTPCClusterMap();
1391 for(int i=0; i<=159; i++) {
1392 if(fTPCClusterMap[i]>0) firstHit = i;
1394 for(int i=159; i>=0; i--) {
1395 if(fTPCClusterMap[i]>0) lastHit = i;
1398 Int_t trackLength = lastHit - firstHit;
1403 //_______________________________________________________________________
1404 void AliPWG4HighPtTrackQA::FillSystematicCutHist(AliESDtrack *track) {
1406 fSystTrackCuts->Fill("noCut",1);
1407 if(TMath::Abs(track->Eta())>0.9)
1408 fSystTrackCuts->Fill("eta",1);
1409 if(track->Pt()<0.15 || track->Pt()>1e10)
1410 fSystTrackCuts->Fill("0.15<pT<1e10",1);
1411 if(track->GetKinkIndex(0)>0)
1412 fSystTrackCuts->Fill("kink",1);
1413 if(track->GetTPCclusters(0)<70)
1414 fSystTrackCuts->Fill("NClusterTPC",1);
1415 if(track->GetTPCclusters(0)>0.) {
1416 if(track->GetTPCchi2()/Float_t(track->GetTPCclusters(0))>4.)
1417 fSystTrackCuts->Fill("Chi2PerNClusTPC",1);
1420 Float_t dcaToVertexXY = 0.;
1421 Float_t dcaToVertexZ = 0.;
1422 track->GetImpactParameters(dcaToVertexXY,dcaToVertexZ);
1423 Float_t fCutMaxDCAToVertexXY = 2.4;
1424 Float_t fCutMaxDCAToVertexZ = 3.2;
1425 Float_t dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY/fCutMaxDCAToVertexXY/fCutMaxDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMaxDCAToVertexZ/fCutMaxDCAToVertexZ);
1427 fSystTrackCuts->Fill("DCA2D",1);
1431 //________________________________________________________________________
1432 void AliPWG4HighPtTrackQA::Terminate(Option_t *)
1434 // The Terminate() function is the last function to be called during
1435 // a query. It always runs on the client, it can be used to present
1436 // the results graphically or save the results to file.