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] = 100.;
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] = 100.;
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 //fPtBinEdges[region][0] = ptmax of region ; fPtBinEdges[region][1] = binWidth of region
258 const Float_t ptmin1 = fgkPtMin;
259 const Float_t ptmax1 = fPtBinEdges[0][0];
260 const Float_t ptmin2 = ptmax1 ;
261 const Float_t ptmax2 = fPtBinEdges[1][0];
262 const Float_t ptmin3 = ptmax2 ;
263 const Float_t ptmax3 = fPtBinEdges[2][0];//fgkPtMax;
264 const Int_t nbin11 = (int)((ptmax1-ptmin1)/fPtBinEdges[0][1]);
265 const Int_t nbin12 = (int)((ptmax2-ptmin2)/fPtBinEdges[1][1])+nbin11;
266 const Int_t nbin13 = (int)((ptmax3-ptmin3)/fPtBinEdges[2][1])+nbin12;
267 Int_t fgkNPtBins=nbin13;
268 //Create array with low edges of each bin
269 Double_t *binsPt=new Double_t[fgkNPtBins+1];
270 for(Int_t i=0; i<=fgkNPtBins; i++) {
271 if(i<=nbin11) binsPt[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;
272 if(i<=nbin12 && i>nbin11) binsPt[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
273 if(i<=nbin13 && i>nbin12) binsPt[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
276 Int_t fgkNPhiBins = 18*6;
277 Float_t kMinPhi = 0.;
278 Float_t kMaxPhi = 2.*TMath::Pi();
279 Double_t *binsPhi = new Double_t[fgkNPhiBins+1];
280 for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ;
282 Int_t fgkNEtaBins=20;
283 Float_t fgkEtaMin = -1.;
284 Float_t fgkEtaMax = 1.;
285 Double_t *binsEta=new Double_t[fgkNEtaBins+1];
286 for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ;
288 Int_t fgkNNClustersTPCBins=80;
289 Float_t fgkNClustersTPCMin = 0.5;
290 Float_t fgkNClustersTPCMax = 160.5;
291 Double_t *binsNClustersTPC=new Double_t[fgkNNClustersTPCBins+1];
292 for(Int_t i=0; i<=fgkNNClustersTPCBins; i++) binsNClustersTPC[i]=(Double_t)fgkNClustersTPCMin + (fgkNClustersTPCMax-fgkNClustersTPCMin)/fgkNNClustersTPCBins*(Double_t)i ;
294 Int_t fgkNDCA2DBins=80;
295 Float_t fgkDCA2DMin = -0.2;
296 Float_t fgkDCA2DMax = 0.2;
297 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
301 Double_t *binsDCA2D=new Double_t[fgkNDCA2DBins+1];
302 for(Int_t i=0; i<=fgkNDCA2DBins; i++) binsDCA2D[i]=(Double_t)fgkDCA2DMin + (fgkDCA2DMax-fgkDCA2DMin)/fgkNDCA2DBins*(Double_t)i ;
304 Int_t fgkNDCAZBins=80;
305 Float_t fgkDCAZMin = -2.;
306 Float_t fgkDCAZMax = 2.;
307 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
311 Double_t *binsDCAZ=new Double_t[fgkNDCAZBins+1];
312 for(Int_t i=0; i<=fgkNDCAZBins; i++) binsDCAZ[i]=(Double_t)fgkDCAZMin + (fgkDCAZMax-fgkDCAZMin)/fgkNDCAZBins*(Double_t)i ;
314 Int_t fgkNNPointITSBins=9;
315 Float_t fgkNPointITSMin = -0.5;
316 Float_t fgkNPointITSMax = 8.5;
317 Double_t *binsNPointITS=new Double_t[fgkNNPointITSBins+1];
318 for(Int_t i=0; i<=fgkNNPointITSBins; i++) binsNPointITS[i]=(Double_t)fgkNPointITSMin + (fgkNPointITSMax-fgkNPointITSMin)/fgkNNPointITSBins*(Double_t)i ;
320 Int_t fgkNNSigmaToVertexBins=20;
321 Float_t fgkNSigmaToVertexMin = 0.;
322 Float_t fgkNSigmaToVertexMax = 8.;
323 Double_t *binsNSigmaToVertex=new Double_t[fgkNNSigmaToVertexBins+1];
324 for(Int_t i=0; i<=fgkNNSigmaToVertexBins; i++) binsNSigmaToVertex[i]=(Double_t)fgkNSigmaToVertexMin + (fgkNSigmaToVertexMax-fgkNSigmaToVertexMin)/fgkNNSigmaToVertexBins*(Double_t)i ;
326 Int_t fgkNChi2CBins=20;
327 Float_t fgkChi2CMin = 0.;
328 Float_t fgkChi2CMax = 100.;
329 Double_t *binsChi2C=new Double_t[fgkNChi2CBins+1];
330 for(Int_t i=0; i<=fgkNChi2CBins; i++) binsChi2C[i]=(Double_t)fgkChi2CMin + (fgkChi2CMax-fgkChi2CMin)/fgkNChi2CBins*(Double_t)i ;
332 Int_t fgkNRel1PtUncertaintyBins=30;
333 Float_t fgkRel1PtUncertaintyMin = 0.;
334 Float_t fgkRel1PtUncertaintyMax = 0.3;
335 if(fTrackType!=0 && fTrackType!=3) {
336 fgkNRel1PtUncertaintyBins = 50;
337 fgkRel1PtUncertaintyMax = 1.;
339 Double_t *binsRel1PtUncertainty=new Double_t[fgkNRel1PtUncertaintyBins+1];
340 for(Int_t i=0; i<=fgkNRel1PtUncertaintyBins; i++) binsRel1PtUncertainty[i]=(Double_t)fgkRel1PtUncertaintyMin + (fgkRel1PtUncertaintyMax-fgkRel1PtUncertaintyMin)/fgkNRel1PtUncertaintyBins*(Double_t)i ;
342 Int_t fgkNUncertainty1PtBins = 30;
343 Float_t fgkUncertainty1PtMin = 0.;
344 Float_t fgkUncertainty1PtMax = 0.1;
345 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
346 fgkUncertainty1PtMax = 0.2;
347 Double_t *binsUncertainty1Pt=new Double_t[fgkNUncertainty1PtBins+1];
348 for(Int_t i=0; i<=fgkNUncertainty1PtBins; i++) binsUncertainty1Pt[i]=(Double_t)fgkUncertainty1PtMin + (fgkUncertainty1PtMax-fgkUncertainty1PtMin)/fgkNUncertainty1PtBins*(Double_t)i ;
350 Float_t fgkChi2PerClusMin = 0.;
351 Float_t fgkChi2PerClusMax = 4.;
352 Int_t fgkNChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
353 Double_t *binsChi2PerClus=new Double_t[fgkNChi2PerClusBins+1];
354 for(Int_t i=0; i<=fgkNChi2PerClusBins; i++) binsChi2PerClus[i]=(Double_t)fgkChi2PerClusMin + (fgkChi2PerClusMax-fgkChi2PerClusMin)/fgkNChi2PerClusBins*(Double_t)i ;
356 Int_t fgkNCrossedRowsNClusFBins = 50;
357 Float_t fgkNCrossedRowsNClusFMin = 0.;
358 Float_t fgkNCrossedRowsNClusFMax = 1.;
359 Double_t *binsNCrossedRowsNClusF=new Double_t[fgkNCrossedRowsNClusFBins+1];
360 for(Int_t i=0; i<=fgkNCrossedRowsNClusFBins; i++) binsNCrossedRowsNClusF[i]=(Double_t)fgkNCrossedRowsNClusFMin + (fgkNCrossedRowsNClusFMax-fgkNCrossedRowsNClusFMin)/fgkNCrossedRowsNClusFBins*(Double_t)i ;
362 Float_t fgk1PtMin = 0.;
363 Float_t fgk1PtMax = 6.;
364 Float_t binEdge1Pt1 = 1.;
365 Float_t binWidth1Pt1 = 0.05;
366 Int_t fgkN1PtBins1 = (int)((binEdge1Pt1-fgk1PtMin)/binWidth1Pt1);
367 Float_t binWidth1Pt2 = 0.1;
368 Int_t fgkN1PtBins2 = (int)((fgk1PtMax-binEdge1Pt1)/binWidth1Pt2);
369 Int_t fgkN1PtBins = fgkN1PtBins1+fgkN1PtBins2;
370 Double_t *bins1Pt=new Double_t[fgkN1PtBins+1];
372 for(Int_t i=0; i<=fgkN1PtBins; i++) {
374 bins1Pt[i]=(Double_t)fgk1PtMin + (Double_t)(binEdge1Pt1-fgk1PtMin)/(Double_t)fgkN1PtBins1*(Double_t)i;
375 if(i<=fgkN1PtBins && i>fgkN1PtBins1)
376 bins1Pt[i]=(Double_t)binEdge1Pt1 + (Double_t)(fgk1PtMax-binEdge1Pt1)/(Double_t)fgkN1PtBins2*(Double_t)(i-fgkN1PtBins1);
379 Int_t fgkNSigmaY2Bins = 50;
380 Float_t fgkSigmaY2Min = 0.;
381 Float_t fgkSigmaY2Max = 1.;
382 if(fTrackType==1) fgkSigmaY2Max = 4.;
383 if(fTrackType==2 || fTrackType==4) fgkSigmaY2Max = 0.1;
384 Double_t *binsSigmaY2=new Double_t[fgkNSigmaY2Bins+1];
385 for(Int_t i=0; i<=fgkNSigmaY2Bins; i++) binsSigmaY2[i]=(Double_t)fgkSigmaY2Min + (fgkSigmaY2Max-fgkSigmaY2Min)/fgkNSigmaY2Bins*(Double_t)i ;
387 Int_t fgkNSigmaZ2Bins = 50;
388 Float_t fgkSigmaZ2Min = 0.;
389 Float_t fgkSigmaZ2Max = 0.4;
390 Double_t *binsSigmaZ2=new Double_t[fgkNSigmaZ2Bins+1];
391 for(Int_t i=0; i<=fgkNSigmaZ2Bins; i++) binsSigmaZ2[i]=(Double_t)fgkSigmaZ2Min + (fgkSigmaZ2Max-fgkSigmaZ2Min)/fgkNSigmaZ2Bins*(Double_t)i ;
393 Int_t fgkNSigmaSnp2Bins = 50;
394 Float_t fgkSigmaSnp2Min = 0.;
395 Float_t fgkSigmaSnp2Max = 0.05;
396 if(fTrackType==1) fgkSigmaSnp2Max = 0.2;
397 if(fTrackType==2 || fTrackType==4) fgkSigmaSnp2Max = 0.1;
398 Double_t *binsSigmaSnp2=new Double_t[fgkNSigmaSnp2Bins+1];
399 for(Int_t i=0; i<=fgkNSigmaSnp2Bins; i++) binsSigmaSnp2[i]=(Double_t)fgkSigmaSnp2Min + (fgkSigmaSnp2Max-fgkSigmaSnp2Min)/fgkNSigmaSnp2Bins*(Double_t)i ;
401 Int_t fgkNSigmaTgl2Bins = 50;
402 Float_t fgkSigmaTgl2Min = 0.;
403 Float_t fgkSigmaTgl2Max = 0.1;
404 if(fTrackType==1) fgkSigmaTgl2Max = 0.2;
405 if(fTrackType==2 || fTrackType==4) fgkSigmaTgl2Max = 0.1;
406 Double_t *binsSigmaTgl2=new Double_t[fgkNSigmaTgl2Bins+1];
407 for(Int_t i=0; i<=fgkNSigmaTgl2Bins; i++) binsSigmaTgl2[i]=(Double_t)fgkSigmaTgl2Min + (fgkSigmaTgl2Max-fgkSigmaTgl2Min)/fgkNSigmaTgl2Bins*(Double_t)i ;
409 Int_t fgkNSigma1Pt2Bins = 50;
410 Float_t fgkSigma1Pt2Min = 0.;
411 Float_t fgkSigma1Pt2Max = 1.;
412 Double_t *binsSigma1Pt2=new Double_t[fgkNSigma1Pt2Bins+1];
413 for(Int_t i=0; i<=fgkNSigma1Pt2Bins; i++) binsSigma1Pt2[i]=(Double_t)fgkSigma1Pt2Min + (fgkSigma1Pt2Max-fgkSigma1Pt2Min)/fgkNSigma1Pt2Bins*(Double_t)i ;
416 fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
417 fHistList->Add(fNEventAll);
418 fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
419 fHistList->Add(fNEventSel);
420 fNEventReject = new TH1F("fNEventReject","Reason events are rejectected for analysis",20,0,20);
422 fNEventReject->Fill("noESD",0);
423 fNEventReject->Fill("Trigger",0);
424 fNEventReject->Fill("NTracks<2",0);
425 fNEventReject->Fill("noVTX",0);
426 fNEventReject->Fill("VtxStatus",0);
427 fNEventReject->Fill("NCont<2",0);
428 fNEventReject->Fill("ZVTX>10",0);
429 fNEventReject->Fill("cent",0);
430 fNEventReject->Fill("cent>90",0);
431 fHistList->Add(fNEventReject);
433 fh1Centrality = new TH1F("fh1Centrality","fh1Centrality; Centrality %",100,0,100);
434 fHistList->Add(fh1Centrality);
436 fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
437 fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
438 fHistList->Add(fh1Xsec);
440 fh1Trials = new TH1F("fh1Trials","trials root file",1,0,1);
441 fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
442 fHistList->Add(fh1Trials);
444 fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
445 fHistList->Add(fh1PtHard);
446 fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
447 fHistList->Add(fh1PtHardTrials);
449 fh1NTracksAll = new TH1F("fh1NTracksAll","fh1NTracksAll",1,-0.5,0.5);
450 fHistList->Add(fh1NTracksAll);
452 fh1NTracksReject = new TH1F("fh1NTracksReject","fh1NTracksReject",1,-0.5,0.5);
453 fh1NTracksReject->Fill("noESDtrack",0);
454 fh1NTracksReject->Fill("noTPCInner",0);
455 fh1NTracksReject->Fill("FillTPC",0);
456 fh1NTracksReject->Fill("noTPConly",0);
457 fh1NTracksReject->Fill("relate",0);
458 fh1NTracksReject->Fill("trackCuts",0);
459 fh1NTracksReject->Fill("laser",0);
460 fh1NTracksReject->Fill("chi2",0);
461 fHistList->Add(fh1NTracksReject);
463 fh1NTracksSel = new TH1F("fh1NTracksSel","fh1NTracksSel",1,-0.5,0.5);
464 fHistList->Add(fh1NTracksSel);
466 fSystTrackCuts = new TH1F("fSystTrackCuts","fSystTrackCuts",1,-0.5,0.5);
467 fSystTrackCuts->Fill("noCut",0);
468 fSystTrackCuts->Fill("eta",0);
469 fSystTrackCuts->Fill("0.15<pT<1e10",0);
470 fSystTrackCuts->Fill("kink",0);
471 fSystTrackCuts->Fill("NClusterTPC",0);
472 fSystTrackCuts->Fill("Chi2PerNClusTPC",0);
473 fSystTrackCuts->Fill("DCA2D",0);
474 fHistList->Add(fSystTrackCuts);
477 fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, binsPt);
478 fHistList->Add(fPtAll);
479 fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, binsPt);
480 fHistList->Add(fPtSel);
482 fPtPhi = new TH2F("fPtPhi","fPtPhi",fgkNPtBins,binsPt,fgkNPhiBins,binsPhi);
483 fHistList->Add(fPtPhi);
485 fPtEta = new TH2F("fPtEta","fPtEta",fgkNPtBins,binsPt,fgkNEtaBins,binsEta);
486 fHistList->Add(fPtEta);
488 fPtDCA2D = new TH2F("fPtDCA2D","fPtDCA2D",fgkNPtBins,binsPt,fgkNDCA2DBins,binsDCA2D);
489 fHistList->Add(fPtDCA2D);
491 fPtDCAZ = new TH2F("fPtDCAZ","fPtDCAZ",fgkNPtBins,binsPt,fgkNDCAZBins,binsDCAZ);
492 fHistList->Add(fPtDCAZ);
494 fPtNClustersTPC = new TH2F("fPtNClustersTPC","fPtNClustersTPC",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
495 fHistList->Add(fPtNClustersTPC);
497 fPtNClustersTPCIter1 = new TH2F("fPtNClustersTPCIter1","fPtNClustersTPCIter1",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
498 fHistList->Add(fPtNClustersTPCIter1);
500 fPtNPointITS = new TH2F("fPtNPointITS","fPtNPointITS",fgkNPtBins,binsPt,fgkNNPointITSBins,binsNPointITS);
501 fHistList->Add(fPtNPointITS);
503 fPtChi2C = new TH2F("fPtChi2C","fPtChi2C",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
504 fHistList->Add(fPtChi2C);
506 fPtNSigmaToVertex = new TH2F("fPtNSigmaToVertex","fPtNSigmaToVertex",fgkNPtBins,binsPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
507 fHistList->Add(fPtNSigmaToVertex);
509 fPtRelUncertainty1Pt = new TH2F("fPtRelUncertainty1Pt","fPtRelUncertainty1Pt",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
510 fHistList->Add(fPtRelUncertainty1Pt);
512 fPtRelUncertainty1PtNClus = new TH3F("fPtRelUncertainty1PtNClus","fPtRelUncertainty1PtNClus",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
513 fHistList->Add(fPtRelUncertainty1PtNClus);
515 fPtRelUncertainty1PtNClusIter1 = new TH3F("fPtRelUncertainty1PtNClusIter1","fPtRelUncertainty1PtNClusIter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
516 fHistList->Add(fPtRelUncertainty1PtNClusIter1);
518 fPtRelUncertainty1PtChi2 = new TH3F("fPtRelUncertainty1PtChi2","fPtRelUncertainty1PtChi2",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
519 fHistList->Add(fPtRelUncertainty1PtChi2);
521 fPtRelUncertainty1PtChi2Iter1 = new TH3F("fPtRelUncertainty1PtChi2Iter1","fPtRelUncertainty1PtChi2Iter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
522 fHistList->Add(fPtRelUncertainty1PtChi2Iter1);
524 fPtRelUncertainty1PtPhi = new TH3F("fPtRelUncertainty1PtPhi","fPtRelUncertainty1PtPhi",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNPhiBins,binsPhi);
525 fHistList->Add(fPtRelUncertainty1PtPhi);
527 fPtRelUncertainty1PtTrkLength = new TH3F("fPtRelUncertainty1PtTrkLength","fPtRelUncertainty1PtTrkLength",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
528 fHistList->Add(fPtRelUncertainty1PtTrkLength);
530 fPtUncertainty1Pt = new TH2F("fPtUncertainty1Pt","fPtUncertainty1Pt",fgkNPtBins,binsPt,fgkNUncertainty1PtBins,binsUncertainty1Pt);
531 fHistList->Add(fPtUncertainty1Pt);
533 fPtChi2PerClusterTPC = new TH2F("fPtChi2PerClusterTPC","fPtChi2PerClusterTPC",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
534 fHistList->Add(fPtChi2PerClusterTPC);
536 fPtChi2PerClusterTPCIter1 = new TH2F("fPtChi2PerClusterTPCIter1","fPtChi2PerClusterTPCIter1",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
537 fHistList->Add(fPtChi2PerClusterTPCIter1);
539 fPtNCrossedRows = new TH2F("fPtNCrossedRows","fPtNCrossedRows",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
540 fHistList->Add(fPtNCrossedRows);
542 fPtNCrossedRowsNClusF = new TH2F("fPtNCrossedRowsNClusF","fPtNCrossedRowsNClusF",fgkNPtBins,binsPt,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
543 fHistList->Add(fPtNCrossedRowsNClusF);
545 fPtNCrRNCrRNClusF = new TH3F("fPtNCrRNCrRNClusF","fPtNCrRNCrRNClusF",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
546 fHistList->Add(fPtNCrRNCrRNClusF);
548 fPtSigmaY2 = new TH2F("fPtSigmaY2","fPtSigmaY2",fgkN1PtBins,bins1Pt,fgkNSigmaY2Bins,binsSigmaY2);
549 fHistList->Add(fPtSigmaY2);
551 fPtSigmaZ2 = new TH2F("fPtSigmaZ2","fPtSigmaZ2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaZ2);
552 fHistList->Add(fPtSigmaZ2);
554 fPtSigmaSnp2 = new TH2F("fPtSigmaSnp2","fPtSigmaSnp2",fgkN1PtBins,bins1Pt,fgkNSigmaSnp2Bins,binsSigmaSnp2);
555 fHistList->Add(fPtSigmaSnp2);
557 fPtSigmaTgl2 = new TH2F("fPtSigmaTgl2","fPtSigmaTgl2",fgkN1PtBins,bins1Pt,fgkNSigmaTgl2Bins,binsSigmaTgl2);
558 fHistList->Add(fPtSigmaTgl2);
560 fPtSigma1Pt2 = new TH2F("fPtSigma1Pt2","fPtSigma1Pt2",fgkN1PtBins,bins1Pt,fgkNSigma1Pt2Bins,binsSigma1Pt2);
561 fHistList->Add(fPtSigma1Pt2);
563 fProfPtSigmaY2 = new TProfile("fProfPtSigmaY2","fProfPtSigmaY2",fgkN1PtBins,bins1Pt);
564 fHistList->Add(fProfPtSigmaY2);
566 fProfPtSigmaZ2 = new TProfile("fProfPtSigmaZ2","fProfPtSigmaZ2",fgkN1PtBins,bins1Pt);
567 fHistList->Add(fProfPtSigmaZ2);
569 fProfPtSigmaSnp2 = new TProfile("fProfPtSigmaSnp2","fProfPtSigmaSnp2",fgkN1PtBins,bins1Pt);
570 fHistList->Add(fProfPtSigmaSnp2);
572 fProfPtSigmaTgl2 = new TProfile("fProfPtSigmaTgl2","fProfPtSigmaTgl2",fgkN1PtBins,bins1Pt);
573 fHistList->Add(fProfPtSigmaTgl2);
575 fProfPtSigma1Pt2 = new TProfile("fProfPtSigma1Pt2","fProfPtSigma1Pt2",fgkN1PtBins,bins1Pt);
576 fHistList->Add(fProfPtSigma1Pt2);
578 fProfPtSigma1Pt = new TProfile("fProfPtSigma1Pt","fProfPtSigma1Pt;p_{T};#sigma(1/p_{T})",fgkNPtBins,binsPt);
579 fHistList->Add(fProfPtSigma1Pt);
581 fProfPtPtSigma1Pt = new TProfile("fProfPtPtSigma1Pt","fProfPtPtSigma1Pt;p_{T};p_{T}#sigma(1/p_{T})",fgkNPtBins,binsPt);
582 fHistList->Add(fProfPtPtSigma1Pt);
584 TH1::AddDirectory(oldStatus);
586 PostData(1, fHistList);
588 if(binsPhi) delete [] binsPhi;
589 if(binsPt) delete [] binsPt;
590 if(binsNClustersTPC) delete [] binsNClustersTPC;
591 if(binsDCA2D) delete [] binsDCA2D;
592 if(binsDCAZ) delete [] binsDCAZ;
593 if(binsNPointITS) delete [] binsNPointITS;
594 if(binsNSigmaToVertex) delete [] binsNSigmaToVertex;
595 if(binsChi2C) delete [] binsChi2C;
596 if(binsEta) delete [] binsEta;
597 if(binsRel1PtUncertainty) delete [] binsRel1PtUncertainty;
598 if(binsUncertainty1Pt) delete [] binsUncertainty1Pt;
599 if(binsChi2PerClus) delete [] binsChi2PerClus;
600 if(binsChi2PerClus) delete [] binsNCrossedRowsNClusF;
601 if(bins1Pt) delete [] bins1Pt;
602 if(binsSigmaY2) delete [] binsSigmaY2;
603 if(binsSigmaZ2) delete [] binsSigmaZ2;
604 if(binsSigmaSnp2) delete [] binsSigmaSnp2;
605 if(binsSigmaTgl2) delete [] binsSigmaTgl2;
606 if(binsSigma1Pt2) delete [] binsSigma1Pt2;
609 //________________________________________________________________________
610 Bool_t AliPWG4HighPtTrackQA::SelectEvent() {
612 // Decide if event should be selected for analysis
615 // Checks following requirements:
616 // - fEvent available
617 // - trigger info from AliPhysicsSelection
618 // - MCevent available
619 // - number of reconstructed tracks > 1
620 // - primary vertex reconstructed
621 // - z-vertex < 10 cm
622 // - centrality in case of PbPb
624 Bool_t selectEvent = kTRUE;
626 //fEvent object available?
628 AliDebug(2,Form("ERROR: fInputEvent not available\n"));
629 fNEventReject->Fill("noAliVEvent",1);
630 selectEvent = kFALSE;
634 //Check if number of reconstructed tracks is larger than 1
635 if(!fEvent->GetNumberOfTracks() || fEvent->GetNumberOfTracks()<2) {
636 fNEventReject->Fill("NTracks<2",1);
637 selectEvent = kFALSE;
641 //Check if vertex is reconstructed
642 if(fDataType==kESD&&dynamic_cast<AliESDEvent*>(fEvent)) {
643 fVtx = ((AliESDEvent*)fEvent)->GetPrimaryVertexSPD();
646 fNEventReject->Fill("noVTX",1);
647 selectEvent = kFALSE;
651 if(!fVtx->GetStatus()) {
652 fNEventReject->Fill("VtxStatus",1);
653 selectEvent = kFALSE;
658 if(fVtx->GetNContributors()<2) {
659 fNEventReject->Fill("NCont<2",1);
660 selectEvent = kFALSE;
664 //Check if z-vertex < 10 cm
666 fVtx->GetXYZ(primVtx);
667 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
668 fNEventReject->Fill("ZVTX>10",1);
669 selectEvent = kFALSE;
673 else if(fDataType==kAOD&&dynamic_cast<AliAODEvent*>(fEvent)) {
674 const AliAODVertex *vtx = ((AliAODEvent*)fEvent)->GetPrimaryVertexSPD();
676 fNEventReject->Fill("noVTX",1);
677 selectEvent = kFALSE;
682 if(vtx->GetNContributors()<2) {
683 fNEventReject->Fill("NCont<2",1);
684 selectEvent = kFALSE;
688 //Check if z-vertex < 10 cm
690 vtx->GetXYZ(primVtx);
691 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
692 fNEventReject->Fill("ZVTX>10",1);
693 selectEvent = kFALSE;
699 //Centrality selection should only be done in case of PbPb
702 if(fCentClass!=CalculateCentrality(fEvent) && fCentClass!=10) {
703 fNEventReject->Fill("cent",1);
704 selectEvent = kFALSE;
708 if(fDataType==kESD) {
709 if(dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()) {
710 cent = dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()->GetCentralityPercentile("V0M");
713 else if(fDataType==kAOD) {
714 if(dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality())
715 cent = dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality();
718 fNEventReject->Fill("cent>90",1);
719 selectEvent = kFALSE;
722 fh1Centrality->Fill(cent);
730 //________________________________________________________________________
731 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliVEvent *ev){
733 // Get centrality from ESD or AOD
737 return CalculateCentrality(dynamic_cast<AliESDEvent*>(ev));
738 else if(fDataType==kAOD)
739 return CalculateCentrality(dynamic_cast<AliAODEvent*>(ev));
744 //________________________________________________________________________
745 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliESDEvent *esd){
747 // Get centrality from ESD
753 if(esd->GetCentrality()){
754 cent = esd->GetCentrality()->GetCentralityPercentile("V0M");
755 if(fDebug>3) printf("centrality: %f\n",cent);
759 return GetCentralityClass(cent);
763 //________________________________________________________________________
764 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliAODEvent *aod){
766 // Get centrality from AOD
770 Float_t cent = aod->GetHeader()->GetCentrality();
771 if(fDebug>3) printf("centrality: %f\n",cent);
773 return GetCentralityClass(cent);
777 //________________________________________________________________________
778 Int_t AliPWG4HighPtTrackQA::GetCentralityClass(Float_t cent) {
780 // Get centrality class
783 if(cent<0) return 5; // OB - cent sometimes negative
784 if(cent>80) return 4;
785 if(cent>50) return 3;
786 if(cent>30) return 2;
787 if(cent>10) return 1;
792 //________________________________________________________________________
793 void AliPWG4HighPtTrackQA::UserExec(Option_t *) {
795 // Called for each event
796 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserExec \n"));
798 fEvent = InputEvent();
799 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
801 // All events without selection
802 fNEventAll->Fill(0.);
806 PostData(1, fHistList);
811 //Need to keep track of selected events
812 fNEventSel->Fill(0.);
814 fVariables = new TArrayF(fNVariables);
816 if(fDataType==kESD) DoAnalysisESD();
817 if(fDataType==kAOD) DoAnalysisAOD();
819 //Delete old fVariables
820 if(fVariables) delete fVariables;
823 PostData(1, fHistList);
827 //________________________________________________________________________
828 void AliPWG4HighPtTrackQA::DoAnalysisESD() {
830 // Run analysis on ESD
834 PostData(1, fHistList);
838 // ---- Get MC Header information (for MC productions in pThard bins) ----
839 Double_t ptHard = 0.;
840 Double_t nTrials = 1; // trials for MC trigger weight for real data
842 AliMCEventHandler *eventHandlerMC = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
843 if (eventHandlerMC) {
845 if(eventHandlerMC->MCEvent()){
846 AliGenPythiaEventHeader* pythiaGenHeader = GetPythiaEventHeader(eventHandlerMC->MCEvent());
848 nTrials = pythiaGenHeader->Trials();
849 ptHard = pythiaGenHeader->GetPtHard();
851 fh1PtHard->Fill(ptHard);
852 fh1PtHardTrials->Fill(ptHard,nTrials);
854 fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
859 Int_t nTracks = fESD->GetNumberOfTracks();
860 AliDebug(2,Form("nTracks ESD%d", nTracks));
863 Variables to be put in fVariables
874 10: chi2PerClusterTPC
876 12: (#crossed rows)/(#findable clusters)
882 18: NClustersTPCIter1
886 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
887 fh1NTracksAll->Fill(0.);
889 //Get track for analysis
890 AliESDtrack *track = 0x0;
891 AliESDtrack *esdtrack = fESD->GetTrack(iTrack);
893 fh1NTracksReject->Fill("noESDtrack",1);
898 FillSystematicCutHist(esdtrack);
899 if (!(fTrackCuts->AcceptTrack(esdtrack))) {
900 fh1NTracksReject->Fill("trackCuts",1);
906 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
907 else if(fTrackType==2 || fTrackType==4) {
908 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
910 fh1NTracksReject->Fill("noTPConly",1);
913 AliExternalTrackParam exParam;
914 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
916 fh1NTracksReject->Fill("relate",1);
917 if(track) delete track;
920 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
922 else if(fTrackType==5 || fTrackType==6) {
923 if(fTrackCuts->AcceptTrack(esdtrack)) {
927 if( !(fTrackCutsITSLoose->AcceptTrack(esdtrack)) && fTrackCutsTPConly->AcceptTrack(esdtrack) ) {
930 //use TPConly constrained track
931 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
933 fh1NTracksReject->Fill("noTPConly",1);
936 AliExternalTrackParam exParam;
937 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
939 fh1NTracksReject->Fill("relate",1);
940 if(track) delete track;
943 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
945 else if(fTrackType==6) {
946 //use global constrained track
948 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
954 else if(fTrackType==7) {
955 //use global constrained track
957 // track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
966 if(fTrackType==2 || fTrackType==4 || fTrackType==5) {
967 //Cut on chi2 of constrained fit
968 if(track->GetConstrainedChi2TPC() > fSigmaConstrainedMax*fSigmaConstrainedMax && fSigmaConstrainedMax>0.) {
969 fh1NTracksReject->Fill("chi2",1);
970 if(track) delete track;
976 FillSystematicCutHist(track);
978 fPtAll->Fill(track->Pt());
980 if (!(fTrackCuts->AcceptTrack(track)) && fTrackType!=4 && fTrackType!=5 && fTrackType!=6) {
981 fh1NTracksReject->Fill("trackCuts",1);
982 if(fTrackType==1 || fTrackType==2) {
983 if(track) delete track;
989 if(fTrackCutsITSLoose ) {
990 if(fTrackCutsITSLoose->AcceptTrack(track) )
994 if(esdtrack->GetConstrainedParam())
995 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
1000 fh1NTracksSel->Fill(0.);
1002 fVariables->Reset(0.);
1004 fVariables->SetAt(track->Pt(),0);
1005 fVariables->SetAt(track->Phi(),1);
1006 fVariables->SetAt(track->Eta(),2);
1011 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
1012 track->GetImpactParametersTPC(dca2D,dcaz); //TPConly
1015 track->GetImpactParameters(dca2D,dcaz); //Global
1017 fVariables->SetAt(dca2D,3);
1018 fVariables->SetAt(dcaz,5);
1020 fVariables->SetAt((float)track->GetTPCNcls(),5);
1022 Int_t nPointITS = 0;
1023 UChar_t itsMap = track->GetITSClusterMap();
1024 for (Int_t i=0; i < 6; i++) {
1025 if (itsMap & (1 << i))
1028 fVariables->SetAt((float)nPointITS,6);
1029 Float_t chi2C = (float)track->GetConstrainedChi2();
1030 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
1031 chi2C = (float)track->GetConstrainedChi2TPC();
1032 fVariables->SetAt(chi2C,7);
1033 fVariables->SetAt(fTrackCuts->GetSigmaToVertex(track),8);// Calculates the number of sigma to the vertex for a track.
1035 fVariables->SetAt(GetTrackLengthTPC(track),9);
1037 if(fVariables->At(5)>0.) fVariables->SetAt(track->GetTPCchi2()/fVariables->At(5),10);
1039 fVariables->SetAt(track->GetTPCClusterInfo(2,1),11); //#crossed rows
1040 Float_t crossedRowsTPCNClsF = 1.;//track->GetTPCClusterInfo(2,0);
1041 if(track->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/track->GetTPCNclsF();
1042 fVariables->SetAt(crossedRowsTPCNClsF,12);//(#crossed rows)/(#findable clusters)
1043 fVariables->SetAt(track->GetSigmaY2(),13);
1044 fVariables->SetAt(track->GetSigmaZ2(),14);
1045 fVariables->SetAt(track->GetSigmaSnp2(),15);
1046 fVariables->SetAt(track->GetSigmaTgl2(),16);
1047 fVariables->SetAt(track->GetSigma1Pt2(),17);
1049 fVariables->SetAt(track->GetTPCNclsIter1(),18);
1050 fVariables->SetAt(track->GetTPCchi2Iter1(),19);
1054 // int mult = fTrackCuts->CountAcceptedTracks(fESD);
1056 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==5) {
1057 if(track) delete track;
1064 //________________________________________________________________________
1065 void AliPWG4HighPtTrackQA::DoAnalysisAOD() {
1067 AliAODEvent *aod = dynamic_cast<AliAODEvent*>(fEvent);
1069 AliExternalTrackParam *exParam = new AliExternalTrackParam();
1070 for (Int_t iTrack = 0; iTrack < fEvent->GetNumberOfTracks(); iTrack++) {
1072 AliAODTrack *aodtrack = aod->GetTrack(iTrack);
1073 if( !aodtrack->TestFilterMask(fFilterMask) ) continue;
1075 fVariables->Reset(0.);
1077 fVariables->SetAt(aodtrack->Pt(),0);
1078 fVariables->SetAt(aodtrack->Phi(),1);
1079 fVariables->SetAt(aodtrack->Eta(),2);
1081 Double_t dca[2] = {1e6,1e6};
1082 Double_t covar[3] = {1e6,1e6,1e6};
1083 if(aodtrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),100.,dca,covar)) {
1084 fVariables->SetAt(dca[0],3);
1085 fVariables->SetAt(dca[1],4);
1088 fVariables->SetAt((float)aodtrack->GetTPCNcls(),5);
1089 fVariables->SetAt((float)aodtrack->GetITSNcls(),6);
1090 fVariables->SetAt(aodtrack->Chi2perNDF(),7);
1091 fVariables->SetAt(0.,8);
1092 fVariables->SetAt(GetTrackLengthTPC(aodtrack),9);
1093 fVariables->SetAt(aodtrack->Chi2perNDF(),10);
1094 fVariables->SetAt(GetTPCClusterInfo(aodtrack,2),11);
1095 Float_t crossedRowsTPCNClsF = 0.;
1096 if(aodtrack->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/aodtrack->GetTPCNclsF();
1097 fVariables->SetAt(crossedRowsTPCNClsF,12);
1099 //get covariance matrix
1100 Double_t cov[21] = {0,};
1101 aodtrack->GetCovMatrix(cov);
1102 Double_t pxpypz[3] = {0,};
1103 aodtrack->PxPyPz(pxpypz);
1104 Double_t xyz[3] = {0,};
1105 aodtrack->GetXYZ(xyz);
1106 Short_t sign = aodtrack->Charge();
1107 exParam->Set(xyz,pxpypz,cov,sign);
1109 fVariables->SetAt(exParam->GetSigmaY2(),13);
1110 fVariables->SetAt(exParam->GetSigmaZ2(),14);
1111 fVariables->SetAt(exParam->GetSigmaSnp2(),15);
1112 fVariables->SetAt(exParam->GetSigmaTgl2(),16);
1113 fVariables->SetAt(exParam->GetSigma1Pt2(),17);
1115 fVariables->SetAt(0.,18);
1116 fVariables->SetAt(0.,19);
1118 fPtAll->Fill(fVariables->At(0));
1126 //________________________________________________________________________
1127 void AliPWG4HighPtTrackQA::FillHistograms() {
1129 fPtSel->Fill(fVariables->At(0));
1130 fPtPhi->Fill(fVariables->At(0),fVariables->At(1));
1131 fPtEta->Fill(fVariables->At(0),fVariables->At(2));
1132 fPtDCA2D->Fill(fVariables->At(0),fVariables->At(3));
1133 fPtDCAZ->Fill(fVariables->At(0),fVariables->At(4));
1134 fPtNClustersTPC->Fill(fVariables->At(0),fVariables->At(5));
1135 fPtNPointITS->Fill(fVariables->At(0),fVariables->At(6));
1138 fPtNClustersTPCIter1->Fill(fVariables->At(0),fVariables->At(18));
1139 if(fVariables->At(18)>0.)
1140 fPtChi2PerClusterTPCIter1->Fill(fVariables->At(0),fVariables->At(19)/fVariables->At(18));
1142 fPtChi2C->Fill(fVariables->At(0),fVariables->At(7));
1143 fPtNSigmaToVertex->Fill(fVariables->At(0),fVariables->At(8));
1144 fPtRelUncertainty1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1145 fPtRelUncertainty1PtNClus->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(5));
1146 fPtRelUncertainty1PtNClusIter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(18));
1147 fPtRelUncertainty1PtChi2->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(10));
1148 if(fVariables->At(18)>0.)
1149 fPtRelUncertainty1PtChi2Iter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(19)/fVariables->At(18));
1150 fPtRelUncertainty1PtPhi->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(1));
1151 fPtRelUncertainty1PtTrkLength->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(9));
1153 fPtUncertainty1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1154 fPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1155 fPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1156 fPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1157 fPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1158 fPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1160 fProfPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1161 fProfPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1162 fProfPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1163 fProfPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1164 fProfPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1165 fProfPtSigma1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1166 fProfPtPtSigma1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1168 fPtChi2PerClusterTPC->Fill(fVariables->At(0),fVariables->At(10));
1169 fPtNCrossedRows->Fill(fVariables->At(0),fVariables->At(11));
1170 fPtNCrossedRowsNClusF->Fill(fVariables->At(0),fVariables->At(12));
1171 fPtNCrRNCrRNClusF->Fill(fVariables->At(0),fVariables->At(11),fVariables->At(12));
1174 //________________________________________________________________________
1175 Bool_t AliPWG4HighPtTrackQA::PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials){
1177 // get the cross section and the trails either from pyxsec.root or from pysec_hists.root
1178 // This is to called in Notify and should provide the path to the AOD/ESD file
1179 // Copied from AliAnalysisTaskJetSpectrum2
1182 TString file(currFile);
1186 if(file.Contains("root_archive.zip#")){
1187 Ssiz_t pos1 = file.Index("root_archive",12,TString::kExact);
1188 Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
1189 file.Replace(pos+1,20,"");
1192 // not an archive take the basename....
1193 file.ReplaceAll(gSystem->BaseName(file.Data()),"");
1195 // Printf("%s",file.Data());
1198 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
1200 // next trial fetch the histgram file
1201 fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root"));
1203 // not a severe condition but inciate that we have no information
1207 // find the tlist we want to be independtent of the name so use the Tkey
1208 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
1213 TList *list = dynamic_cast<TList*>(key->ReadObj());
1218 fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
1219 fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
1222 } // no tree pyxsec.root
1224 TTree *xtree = (TTree*)fxsec->Get("Xsection");
1230 Double_t xsection = 0;
1231 xtree->SetBranchAddress("xsection",&xsection);
1232 xtree->SetBranchAddress("ntrials",&ntrials);
1240 //________________________________________________________________________
1241 Bool_t AliPWG4HighPtTrackQA::Notify()
1244 // Implemented Notify() to read the cross sections
1245 // and number of trials from pyxsec.root
1246 // Copied from AliAnalysisTaskJetSpectrum2
1249 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
1250 Float_t xsection = 0;
1251 Float_t ftrials = 1;
1255 TFile *curfile = tree->GetCurrentFile();
1257 Error("Notify","No current file");
1260 if(!fh1Xsec||!fh1Trials){
1261 // Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
1264 PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
1265 fh1Xsec->Fill("<#sigma>",xsection);
1266 // construct a poor man average trials
1267 Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
1268 if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
1273 //________________________________________________________________________
1274 AliGenPythiaEventHeader* AliPWG4HighPtTrackQA::GetPythiaEventHeader(AliMCEvent *mcEvent){
1276 if(!mcEvent)return 0;
1277 AliGenEventHeader* genHeader = mcEvent->GenEventHeader();
1278 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
1279 if(!pythiaGenHeader){
1281 AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader);
1283 if (!genCocktailHeader) {
1284 // AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Unknown header type (not Pythia or Cocktail)");
1285 // AliWarning(Form("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__));
1288 TList* headerList = genCocktailHeader->GetHeaders();
1289 for (Int_t i=0; i<headerList->GetEntries(); i++) {
1290 pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
1291 if (pythiaGenHeader)
1294 if(!pythiaGenHeader){
1295 AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Pythia event header not found");
1299 return pythiaGenHeader;
1303 //_______________________________________________________________________
1304 Float_t AliPWG4HighPtTrackQA::GetTPCClusterInfo(AliAODTrack *tr,Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const
1306 //MV: copied from AliESDtrack since method is not available in AliAODTrack
1309 // TPC cluster information
1310 // type 0: get fraction of found/findable clusters with neighbourhood definition
1311 // 1: findable clusters with neighbourhood definition
1312 // 2: found clusters
1314 // definition of findable clusters:
1315 // a cluster is defined as findable if there is another cluster
1316 // within +- nNeighbours pad rows. The idea is to overcome threshold
1317 // effects with a very simple algorithm.
1320 TBits fTPCClusterMap = tr->GetTPCClusterMap();
1321 if (type==2) return fTPCClusterMap.CountBits();
1325 Int_t last=-nNeighbours;
1327 for (Int_t i=row0; i<row1; ++i){
1328 //look to current row
1329 if (fTPCClusterMap[i]) {
1335 //look to nNeighbours before
1336 if ((i-last)<=nNeighbours) {
1340 //look to nNeighbours after
1341 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1342 if (fTPCClusterMap[j]){
1348 if (type==1) return findable;
1353 fraction=(Float_t)found/(Float_t)findable;
1358 return 0; // undefined type - default value
1361 //_______________________________________________________________________
1362 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(AliESDtrack *track) {
1364 // returns distance between 1st and last hit in TPC
1365 // distance given in number of padrows
1368 TBits fTPCClusterMap = track->GetTPCClusterMap();
1372 for(int i=0; i<=159; i++) {
1373 if(fTPCClusterMap[i]>0) firstHit = i;
1375 for(int i=159; i>=0; i--) {
1376 if(fTPCClusterMap[i]>0) lastHit = i;
1379 Int_t trackLength = lastHit - firstHit;
1384 //_______________________________________________________________________
1385 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(AliAODTrack *track) {
1387 // returns distance between 1st and last hit in TPC
1388 // distance given in number of padrows
1391 TBits fTPCClusterMap = track->GetTPCClusterMap();
1395 for(int i=0; i<=159; i++) {
1396 if(fTPCClusterMap[i]>0) firstHit = i;
1398 for(int i=159; i>=0; i--) {
1399 if(fTPCClusterMap[i]>0) lastHit = i;
1402 Int_t trackLength = lastHit - firstHit;
1407 //_______________________________________________________________________
1408 void AliPWG4HighPtTrackQA::FillSystematicCutHist(AliESDtrack *track) {
1410 fSystTrackCuts->Fill("noCut",1);
1411 if(TMath::Abs(track->Eta())>0.9)
1412 fSystTrackCuts->Fill("eta",1);
1413 if(track->Pt()<0.15 || track->Pt()>1e10)
1414 fSystTrackCuts->Fill("0.15<pT<1e10",1);
1415 if(track->GetKinkIndex(0)>0)
1416 fSystTrackCuts->Fill("kink",1);
1417 if(track->GetTPCclusters(0)<70)
1418 fSystTrackCuts->Fill("NClusterTPC",1);
1419 if(track->GetTPCclusters(0)>0.) {
1420 if(track->GetTPCchi2()/Float_t(track->GetTPCclusters(0))>4.)
1421 fSystTrackCuts->Fill("Chi2PerNClusTPC",1);
1424 Float_t dcaToVertexXY = 0.;
1425 Float_t dcaToVertexZ = 0.;
1426 track->GetImpactParameters(dcaToVertexXY,dcaToVertexZ);
1427 Float_t fCutMaxDCAToVertexXY = 2.4;
1428 Float_t fCutMaxDCAToVertexZ = 3.2;
1429 Float_t dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY/fCutMaxDCAToVertexXY/fCutMaxDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMaxDCAToVertexZ/fCutMaxDCAToVertexZ);
1431 fSystTrackCuts->Fill("DCA2D",1);
1435 //________________________________________________________________________
1436 void AliPWG4HighPtTrackQA::Terminate(Option_t *)
1438 // The Terminate() function is the last function to be called during
1439 // a query. It always runs on the client, it can be used to present
1440 // the results graphically or save the results to file.