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),
98 fPtNClustersTPCShared(0x0),
99 fPtNClustersTPCSharedFrac(0x0),
102 fPtNSigmaToVertex(0x0),
103 fPtRelUncertainty1Pt(0x0),
104 fPtRelUncertainty1PtNClus(0x0),
105 fPtRelUncertainty1PtNClusIter1(0x0),
106 fPtRelUncertainty1PtChi2(0x0),
107 fPtRelUncertainty1PtChi2Iter1(0x0),
108 fPtRelUncertainty1PtPhi(0x0),
109 fPtUncertainty1Pt(0x0),
110 fPtChi2PerClusterTPC(0x0),
111 fPtChi2PerClusterTPCIter1(0x0),
112 fPtNCrossedRows(0x0),
113 fPtNCrossedRowsNClusF(0x0),
114 fPtNCrRNCrRNClusF(0x0),
119 fChi2GoldChi2GGC(0x0),
127 fProfPtSigmaSnp2(0x0),
128 fProfPtSigmaTgl2(0x0),
129 fProfPtSigma1Pt2(0x0),
130 fProfPtSigma1Pt(0x0),
131 fProfPtPtSigma1Pt(0x0),
137 fPtBinEdges[0][0] = 10.;
138 fPtBinEdges[0][1] = 1.;
139 fPtBinEdges[1][0] = 20.;
140 fPtBinEdges[1][1] = 2.;
141 fPtBinEdges[2][0] = 100.;
142 fPtBinEdges[2][1] = 5.;
145 //________________________________________________________________________
146 AliPWG4HighPtTrackQA::AliPWG4HighPtTrackQA(const char *name):
147 AliAnalysisTaskSE(name),
153 fTrackCutsITSLoose(0x0),
154 fTrackCutsTPConly(0x0),
157 fSigmaConstrainedMax(-1.),
173 fh1NTracksReject(0x0),
181 fPtNClustersTPC(0x0),
182 fPtNClustersTPCIter1(0x0),
183 fPtNClustersTPCShared(0x0),
184 fPtNClustersTPCSharedFrac(0x0),
187 fPtNSigmaToVertex(0x0),
188 fPtRelUncertainty1Pt(0x0),
189 fPtRelUncertainty1PtNClus(0x0),
190 fPtRelUncertainty1PtNClusIter1(0x0),
191 fPtRelUncertainty1PtChi2(0x0),
192 fPtRelUncertainty1PtChi2Iter1(0x0),
193 fPtRelUncertainty1PtPhi(0x0),
194 fPtUncertainty1Pt(0x0),
195 fPtChi2PerClusterTPC(0x0),
196 fPtChi2PerClusterTPCIter1(0x0),
197 fPtNCrossedRows(0x0),
198 fPtNCrossedRowsNClusF(0x0),
199 fPtNCrRNCrRNClusF(0x0),
204 fChi2GoldChi2GGC(0x0),
212 fProfPtSigmaSnp2(0x0),
213 fProfPtSigmaTgl2(0x0),
214 fProfPtSigma1Pt2(0x0),
215 fProfPtSigma1Pt(0x0),
216 fProfPtPtSigma1Pt(0x0),
221 // Constructor. Initialization of Inputs and Outputs
223 AliDebug(2,Form("AliPWG4HighPtTrackQA Calling Constructor"));
227 fPtBinEdges[0][0] = 10.;
228 fPtBinEdges[0][1] = 1.;
229 fPtBinEdges[1][0] = 20.;
230 fPtBinEdges[1][1] = 2.;
231 fPtBinEdges[2][0] = 100.;
232 fPtBinEdges[2][1] = 5.;
234 // Input slot #0 works with a TChain ESD
235 DefineInput(0, TChain::Class());
236 // Output slot #1 write into a TList
237 DefineOutput(1, TList::Class());
240 //________________________________________________________________________
241 void AliPWG4HighPtTrackQA::SetPtBinEdges(Int_t region, Double_t ptmax, Double_t ptBinWidth) {
244 fPtBinEdges[region][0] = ptmax;
245 fPtBinEdges[region][1] = ptBinWidth;
248 AliError("Only 3 regions alowed. Use region 0/1/2\n");
254 //________________________________________________________________________
255 void AliPWG4HighPtTrackQA::UserCreateOutputObjects() {
256 //Create output objects
257 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserCreateOutputObjects \n"));
259 Bool_t oldStatus = TH1::AddDirectoryStatus();
260 TH1::AddDirectory(kFALSE);
263 fHistList = new TList();
264 fHistList->SetOwner(kTRUE);
266 Float_t fgkPtMin = 0.;
267 // Float_t fgkPtMax = fPtMax;
269 //fPtBinEdges[region][0] = ptmax of region ; fPtBinEdges[region][1] = binWidth of region
270 const Float_t ptmin1 = fgkPtMin;
271 const Float_t ptmax1 = fPtBinEdges[0][0];
272 const Float_t ptmin2 = ptmax1 ;
273 const Float_t ptmax2 = fPtBinEdges[1][0];
274 const Float_t ptmin3 = ptmax2 ;
275 const Float_t ptmax3 = fPtBinEdges[2][0];//fgkPtMax;
276 const Int_t nbin11 = (int)((ptmax1-ptmin1)/fPtBinEdges[0][1]);
277 const Int_t nbin12 = (int)((ptmax2-ptmin2)/fPtBinEdges[1][1])+nbin11;
278 const Int_t nbin13 = (int)((ptmax3-ptmin3)/fPtBinEdges[2][1])+nbin12;
279 Int_t fgkNPtBins=nbin13;
280 //Create array with low edges of each bin
281 Double_t *binsPt=new Double_t[fgkNPtBins+1];
282 for(Int_t i=0; i<=fgkNPtBins; i++) {
283 if(i<=nbin11) binsPt[i]=(Double_t)ptmin1 + (ptmax1-ptmin1)/nbin11*(Double_t)i ;
284 if(i<=nbin12 && i>nbin11) binsPt[i]=(Double_t)ptmin2 + (ptmax2-ptmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
285 if(i<=nbin13 && i>nbin12) binsPt[i]=(Double_t)ptmin3 + (ptmax3-ptmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
288 Int_t fgkNPhiBins = 18*6;
289 Float_t kMinPhi = 0.;
290 Float_t kMaxPhi = 2.*TMath::Pi();
291 Double_t *binsPhi = new Double_t[fgkNPhiBins+1];
292 for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ;
294 Int_t fgkNEtaBins=20;
295 Float_t fgkEtaMin = -1.;
296 Float_t fgkEtaMax = 1.;
297 Double_t *binsEta=new Double_t[fgkNEtaBins+1];
298 for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ;
300 Int_t fgkNNClustersTPCBins=80;
301 Float_t fgkNClustersTPCMin = 0.5;
302 Float_t fgkNClustersTPCMax = 160.5;
303 Double_t *binsNClustersTPC=new Double_t[fgkNNClustersTPCBins+1];
304 for(Int_t i=0; i<=fgkNNClustersTPCBins; i++) binsNClustersTPC[i]=(Double_t)fgkNClustersTPCMin + (fgkNClustersTPCMax-fgkNClustersTPCMin)/fgkNNClustersTPCBins*(Double_t)i ;
306 Int_t fgkNDCA2DBins=80;
307 Float_t fgkDCA2DMin = -0.2;
308 Float_t fgkDCA2DMax = 0.2;
309 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==7) {
313 Double_t *binsDCA2D=new Double_t[fgkNDCA2DBins+1];
314 for(Int_t i=0; i<=fgkNDCA2DBins; i++) binsDCA2D[i]=(Double_t)fgkDCA2DMin + (fgkDCA2DMax-fgkDCA2DMin)/fgkNDCA2DBins*(Double_t)i ;
316 Int_t fgkNDCAZBins=80;
317 Float_t fgkDCAZMin = -2.;
318 Float_t fgkDCAZMax = 2.;
319 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
323 Double_t *binsDCAZ=new Double_t[fgkNDCAZBins+1];
324 for(Int_t i=0; i<=fgkNDCAZBins; i++) binsDCAZ[i]=(Double_t)fgkDCAZMin + (fgkDCAZMax-fgkDCAZMin)/fgkNDCAZBins*(Double_t)i ;
326 Int_t fgkNNPointITSBins=9;
327 Float_t fgkNPointITSMin = -0.5;
328 Float_t fgkNPointITSMax = 8.5;
329 Double_t *binsNPointITS=new Double_t[fgkNNPointITSBins+1];
330 for(Int_t i=0; i<=fgkNNPointITSBins; i++) binsNPointITS[i]=(Double_t)fgkNPointITSMin + (fgkNPointITSMax-fgkNPointITSMin)/fgkNNPointITSBins*(Double_t)i ;
332 Int_t fgkNNSigmaToVertexBins=9;
333 Float_t fgkNSigmaToVertexMin = 0.;
334 Float_t fgkNSigmaToVertexMax = 9.;
335 Double_t *binsNSigmaToVertex=new Double_t[fgkNNSigmaToVertexBins+1];
336 for(Int_t i=0; i<=fgkNNSigmaToVertexBins; i++) binsNSigmaToVertex[i]=(Double_t)fgkNSigmaToVertexMin + (fgkNSigmaToVertexMax-fgkNSigmaToVertexMin)/fgkNNSigmaToVertexBins*(Double_t)i ;
338 Int_t fgkNChi2CBins=10;
339 // Float_t fgkChi2CMin = 0.;
340 // Float_t fgkChi2CMax = 100.; //10 sigma
341 Double_t *binsChi2C=new Double_t[fgkNChi2CBins+1];
342 for(Int_t i=0; i<=fgkNChi2CBins; i++) binsChi2C[i] = (Double_t)i * (Double_t)i;
344 Int_t fgkNRel1PtUncertaintyBins=50;
345 Float_t fgkRel1PtUncertaintyMin = 0.;
346 Float_t fgkRel1PtUncertaintyMax = 1.;
347 if(fTrackType!=0 && fTrackType!=3) {
348 fgkNRel1PtUncertaintyBins = 50;
349 fgkRel1PtUncertaintyMax = 1.;
351 Double_t *binsRel1PtUncertainty=new Double_t[fgkNRel1PtUncertaintyBins+1];
352 for(Int_t i=0; i<=fgkNRel1PtUncertaintyBins; i++) binsRel1PtUncertainty[i]=(Double_t)fgkRel1PtUncertaintyMin + (fgkRel1PtUncertaintyMax-fgkRel1PtUncertaintyMin)/fgkNRel1PtUncertaintyBins*(Double_t)i ;
354 Int_t fgkNUncertainty1PtBins = 30;
355 Float_t fgkUncertainty1PtMin = 0.;
356 Float_t fgkUncertainty1PtMax = 0.1;
357 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
358 fgkUncertainty1PtMax = 0.2;
359 Double_t *binsUncertainty1Pt=new Double_t[fgkNUncertainty1PtBins+1];
360 for(Int_t i=0; i<=fgkNUncertainty1PtBins; i++) binsUncertainty1Pt[i]=(Double_t)fgkUncertainty1PtMin + (fgkUncertainty1PtMax-fgkUncertainty1PtMin)/fgkNUncertainty1PtBins*(Double_t)i ;
362 Float_t fgkChi2PerClusMin = 0.;
363 Float_t fgkChi2PerClusMax = 4.;
364 Int_t fgkNChi2PerClusBins = (int)(fgkChi2PerClusMax*10.);
365 Double_t *binsChi2PerClus=new Double_t[fgkNChi2PerClusBins+1];
366 for(Int_t i=0; i<=fgkNChi2PerClusBins; i++) binsChi2PerClus[i]=(Double_t)fgkChi2PerClusMin + (fgkChi2PerClusMax-fgkChi2PerClusMin)/fgkNChi2PerClusBins*(Double_t)i ;
368 Int_t fgkNCrossedRowsNClusFBins = 50;
369 Float_t fgkNCrossedRowsNClusFMin = 0.;
370 Float_t fgkNCrossedRowsNClusFMax = 1.;
371 Double_t *binsNCrossedRowsNClusF=new Double_t[fgkNCrossedRowsNClusFBins+1];
372 for(Int_t i=0; i<=fgkNCrossedRowsNClusFBins; i++) binsNCrossedRowsNClusF[i]=(Double_t)fgkNCrossedRowsNClusFMin + (fgkNCrossedRowsNClusFMax-fgkNCrossedRowsNClusFMin)/fgkNCrossedRowsNClusFBins*(Double_t)i ;
374 Float_t fgk1PtMin = 0.;
375 Float_t fgk1PtMax = 6.;
376 Float_t binEdge1Pt1 = 1.;
377 Float_t binWidth1Pt1 = 0.05;
378 Int_t fgkN1PtBins1 = (int)((binEdge1Pt1-fgk1PtMin)/binWidth1Pt1);
379 Float_t binWidth1Pt2 = 0.1;
380 Int_t fgkN1PtBins2 = (int)((fgk1PtMax-binEdge1Pt1)/binWidth1Pt2);
381 Int_t fgkN1PtBins = fgkN1PtBins1+fgkN1PtBins2;
382 Double_t *bins1Pt=new Double_t[fgkN1PtBins+1];
384 for(Int_t i=0; i<=fgkN1PtBins; i++) {
386 bins1Pt[i]=(Double_t)fgk1PtMin + (Double_t)(binEdge1Pt1-fgk1PtMin)/(Double_t)fgkN1PtBins1*(Double_t)i;
387 if(i<=fgkN1PtBins && i>fgkN1PtBins1)
388 bins1Pt[i]=(Double_t)binEdge1Pt1 + (Double_t)(fgk1PtMax-binEdge1Pt1)/(Double_t)fgkN1PtBins2*(Double_t)(i-fgkN1PtBins1);
391 Int_t fgkNSigmaY2Bins = 50;
392 Float_t fgkSigmaY2Min = 0.;
393 Float_t fgkSigmaY2Max = 1.;
394 if(fTrackType==1) fgkSigmaY2Max = 4.;
395 if(fTrackType==2 || fTrackType==4) fgkSigmaY2Max = 0.1;
396 Double_t *binsSigmaY2=new Double_t[fgkNSigmaY2Bins+1];
397 for(Int_t i=0; i<=fgkNSigmaY2Bins; i++) binsSigmaY2[i]=(Double_t)fgkSigmaY2Min + (fgkSigmaY2Max-fgkSigmaY2Min)/fgkNSigmaY2Bins*(Double_t)i ;
399 Int_t fgkNSigmaZ2Bins = 50;
400 Float_t fgkSigmaZ2Min = 0.;
401 Float_t fgkSigmaZ2Max = 0.4;
402 Double_t *binsSigmaZ2=new Double_t[fgkNSigmaZ2Bins+1];
403 for(Int_t i=0; i<=fgkNSigmaZ2Bins; i++) binsSigmaZ2[i]=(Double_t)fgkSigmaZ2Min + (fgkSigmaZ2Max-fgkSigmaZ2Min)/fgkNSigmaZ2Bins*(Double_t)i ;
405 Int_t fgkNSigmaSnp2Bins = 50;
406 Float_t fgkSigmaSnp2Min = 0.;
407 Float_t fgkSigmaSnp2Max = 0.05;
408 if(fTrackType==1) fgkSigmaSnp2Max = 0.2;
409 if(fTrackType==2 || fTrackType==4) fgkSigmaSnp2Max = 0.1;
410 Double_t *binsSigmaSnp2=new Double_t[fgkNSigmaSnp2Bins+1];
411 for(Int_t i=0; i<=fgkNSigmaSnp2Bins; i++) binsSigmaSnp2[i]=(Double_t)fgkSigmaSnp2Min + (fgkSigmaSnp2Max-fgkSigmaSnp2Min)/fgkNSigmaSnp2Bins*(Double_t)i ;
413 Int_t fgkNSigmaTgl2Bins = 50;
414 Float_t fgkSigmaTgl2Min = 0.;
415 Float_t fgkSigmaTgl2Max = 0.1;
416 if(fTrackType==1) fgkSigmaTgl2Max = 0.2;
417 if(fTrackType==2 || fTrackType==4) fgkSigmaTgl2Max = 0.1;
418 Double_t *binsSigmaTgl2=new Double_t[fgkNSigmaTgl2Bins+1];
419 for(Int_t i=0; i<=fgkNSigmaTgl2Bins; i++) binsSigmaTgl2[i]=(Double_t)fgkSigmaTgl2Min + (fgkSigmaTgl2Max-fgkSigmaTgl2Min)/fgkNSigmaTgl2Bins*(Double_t)i ;
421 Int_t fgkNSigma1Pt2Bins = 50;
422 Float_t fgkSigma1Pt2Min = 0.;
423 Float_t fgkSigma1Pt2Max = 1.;
424 Double_t *binsSigma1Pt2=new Double_t[fgkNSigma1Pt2Bins+1];
425 for(Int_t i=0; i<=fgkNSigma1Pt2Bins; i++) binsSigma1Pt2[i]=(Double_t)fgkSigma1Pt2Min + (fgkSigma1Pt2Max-fgkSigma1Pt2Min)/fgkNSigma1Pt2Bins*(Double_t)i ;
428 fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
429 fHistList->Add(fNEventAll);
430 fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
431 fHistList->Add(fNEventSel);
432 fNEventReject = new TH1F("fNEventReject","Reason events are rejectected for analysis",20,0,20);
434 fNEventReject->Fill("noESD",0);
435 fNEventReject->Fill("Trigger",0);
436 fNEventReject->Fill("NTracks<2",0);
437 fNEventReject->Fill("noVTX",0);
438 fNEventReject->Fill("VtxStatus",0);
439 fNEventReject->Fill("NCont<2",0);
440 fNEventReject->Fill("ZVTX>10",0);
441 fNEventReject->Fill("cent",0);
442 fNEventReject->Fill("cent>90",0);
443 fHistList->Add(fNEventReject);
445 fh1Centrality = new TH1F("fh1Centrality","fh1Centrality; Centrality %",100,0,100);
446 fHistList->Add(fh1Centrality);
448 fh1Xsec = new TProfile("fh1Xsec","xsec from pyxsec.root",1,0,1);
449 fh1Xsec->GetXaxis()->SetBinLabel(1,"<#sigma>");
450 fHistList->Add(fh1Xsec);
452 fh1Trials = new TH1F("fh1Trials","trials root file",1,0,1);
453 fh1Trials->GetXaxis()->SetBinLabel(1,"#sum{ntrials}");
454 fHistList->Add(fh1Trials);
456 fh1PtHard = new TH1F("fh1PtHard","PYTHIA Pt hard;p_{T,hard}",350,-.5,349.5);
457 fHistList->Add(fh1PtHard);
458 fh1PtHardTrials = new TH1F("fh1PtHardTrials","PYTHIA Pt hard weight with trials;p_{T,hard}",350,-.5,349.5);
459 fHistList->Add(fh1PtHardTrials);
461 fh1NTracksAll = new TH1F("fh1NTracksAll","fh1NTracksAll",1,-0.5,0.5);
462 fHistList->Add(fh1NTracksAll);
464 fh1NTracksReject = new TH1F("fh1NTracksReject","fh1NTracksReject",1,-0.5,0.5);
465 fh1NTracksReject->Fill("noESDtrack",0);
466 fh1NTracksReject->Fill("noTPCInner",0);
467 fh1NTracksReject->Fill("FillTPC",0);
468 fh1NTracksReject->Fill("noTPConly",0);
469 fh1NTracksReject->Fill("relate",0);
470 fh1NTracksReject->Fill("trackCuts",0);
471 fh1NTracksReject->Fill("laser",0);
472 fh1NTracksReject->Fill("chi2",0);
473 fHistList->Add(fh1NTracksReject);
475 fh1NTracksSel = new TH1F("fh1NTracksSel","fh1NTracksSel",1,-0.5,0.5);
476 fHistList->Add(fh1NTracksSel);
478 fSystTrackCuts = new TH1F("fSystTrackCuts","fSystTrackCuts",1,-0.5,0.5);
479 fSystTrackCuts->Fill("noCut",0);
480 fSystTrackCuts->Fill("eta",0);
481 fSystTrackCuts->Fill("0.15<pT<1e10",0);
482 fSystTrackCuts->Fill("kink",0);
483 fSystTrackCuts->Fill("NClusterTPC",0);
484 fSystTrackCuts->Fill("Chi2PerNClusTPC",0);
485 fSystTrackCuts->Fill("DCA2D",0);
486 fHistList->Add(fSystTrackCuts);
489 fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, binsPt);
490 fHistList->Add(fPtAll);
491 fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, binsPt);
492 fHistList->Add(fPtSel);
494 fPtPhi = new TH2F("fPtPhi","fPtPhi",fgkNPtBins,binsPt,fgkNPhiBins,binsPhi);
495 fHistList->Add(fPtPhi);
497 fPtEta = new TH2F("fPtEta","fPtEta",fgkNPtBins,binsPt,fgkNEtaBins,binsEta);
498 fHistList->Add(fPtEta);
500 fPtDCA2D = new TH2F("fPtDCA2D","fPtDCA2D",fgkNPtBins,binsPt,fgkNDCA2DBins,binsDCA2D);
501 fHistList->Add(fPtDCA2D);
503 fPtDCAZ = new TH2F("fPtDCAZ","fPtDCAZ",fgkNPtBins,binsPt,fgkNDCAZBins,binsDCAZ);
504 fHistList->Add(fPtDCAZ);
506 fPtNClustersTPC = new TH2F("fPtNClustersTPC","fPtNClustersTPC",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
507 fHistList->Add(fPtNClustersTPC);
509 fPtNClustersTPCIter1 = new TH2F("fPtNClustersTPCIter1","fPtNClustersTPCIter1",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
510 fHistList->Add(fPtNClustersTPCIter1);
512 fPtNClustersTPCShared = new TH2F("fPtNClustersTPCShared","fPtNClustersTPCShared",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
513 fHistList->Add(fPtNClustersTPCShared);
515 fPtNClustersTPCSharedFrac = new TH2F("fPtNClustersTPCSharedFrac","fPtNClustersTPCSharedFrac",fgkNPtBins,binsPt,fgkNSigma1Pt2Bins,binsSigma1Pt2);
516 fHistList->Add(fPtNClustersTPCSharedFrac);
518 fPtNPointITS = new TH2F("fPtNPointITS","fPtNPointITS",fgkNPtBins,binsPt,fgkNNPointITSBins,binsNPointITS);
519 fHistList->Add(fPtNPointITS);
521 fPtChi2C = new TH2F("fPtChi2C","fPtChi2C",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
522 fHistList->Add(fPtChi2C);
524 fPtNSigmaToVertex = new TH2F("fPtNSigmaToVertex","fPtNSigmaToVertex",fgkNPtBins,binsPt,fgkNNSigmaToVertexBins,binsNSigmaToVertex);
525 fHistList->Add(fPtNSigmaToVertex);
527 fPtRelUncertainty1Pt = new TH2F("fPtRelUncertainty1Pt","fPtRelUncertainty1Pt",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty);
528 fHistList->Add(fPtRelUncertainty1Pt);
530 fPtRelUncertainty1PtNClus = new TH3F("fPtRelUncertainty1PtNClus","fPtRelUncertainty1PtNClus",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
531 fHistList->Add(fPtRelUncertainty1PtNClus);
533 fPtRelUncertainty1PtNClusIter1 = new TH3F("fPtRelUncertainty1PtNClusIter1","fPtRelUncertainty1PtNClusIter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNNClustersTPCBins,binsNClustersTPC);
534 fHistList->Add(fPtRelUncertainty1PtNClusIter1);
536 fPtRelUncertainty1PtChi2 = new TH3F("fPtRelUncertainty1PtChi2","fPtRelUncertainty1PtChi2",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
537 fHistList->Add(fPtRelUncertainty1PtChi2);
539 fPtRelUncertainty1PtChi2Iter1 = new TH3F("fPtRelUncertainty1PtChi2Iter1","fPtRelUncertainty1PtChi2Iter1",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNChi2PerClusBins,binsChi2PerClus);
540 fHistList->Add(fPtRelUncertainty1PtChi2Iter1);
542 fPtRelUncertainty1PtPhi = new TH3F("fPtRelUncertainty1PtPhi","fPtRelUncertainty1PtPhi",fgkNPtBins,binsPt,fgkNRel1PtUncertaintyBins,binsRel1PtUncertainty,fgkNPhiBins,binsPhi);
543 fHistList->Add(fPtRelUncertainty1PtPhi);
545 fPtUncertainty1Pt = new TH2F("fPtUncertainty1Pt","fPtUncertainty1Pt",fgkNPtBins,binsPt,fgkNUncertainty1PtBins,binsUncertainty1Pt);
546 fHistList->Add(fPtUncertainty1Pt);
548 fPtChi2PerClusterTPC = new TH2F("fPtChi2PerClusterTPC","fPtChi2PerClusterTPC",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
549 fHistList->Add(fPtChi2PerClusterTPC);
551 fPtChi2PerClusterTPCIter1 = new TH2F("fPtChi2PerClusterTPCIter1","fPtChi2PerClusterTPCIter1",fgkNPtBins,binsPt,fgkNChi2PerClusBins,binsChi2PerClus);
552 fHistList->Add(fPtChi2PerClusterTPCIter1);
554 fPtNCrossedRows = new TH2F("fPtNCrossedRows","fPtNCrossedRows",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC);
555 fHistList->Add(fPtNCrossedRows);
557 fPtNCrossedRowsNClusF = new TH2F("fPtNCrossedRowsNClusF","fPtNCrossedRowsNClusF",fgkNPtBins,binsPt,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
558 fHistList->Add(fPtNCrossedRowsNClusF);
560 fPtNCrRNCrRNClusF = new TH3F("fPtNCrRNCrRNClusF","fPtNCrRNCrRNClusF",fgkNPtBins,binsPt,fgkNNClustersTPCBins,binsNClustersTPC,fgkNCrossedRowsNClusFBins,binsNCrossedRowsNClusF);
561 fHistList->Add(fPtNCrRNCrRNClusF);
563 fPtChi2Gold = new TH2F("fPtChi2Gold","fPtChi2Gold",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
564 fHistList->Add(fPtChi2Gold);
566 fPtChi2GGC = new TH2F("fPtChi2GGC","fPtChi2GGC",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C);
567 fHistList->Add(fPtChi2GGC);
569 fPtChi2GoldPhi = new TH3F("fPtChi2GoldPhi","fPtChi2GoldPhi",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C,fgkNPhiBins,binsPhi);
570 fHistList->Add(fPtChi2GoldPhi);
572 fPtChi2GGCPhi = new TH3F("fPtChi2GGCPhi","fPtChi2GGCPhi",fgkNPtBins,binsPt,fgkNChi2CBins,binsChi2C,fgkNPhiBins,binsPhi);
573 fHistList->Add(fPtChi2GGCPhi);
575 fChi2GoldChi2GGC = new TH2F("fChi2GoldChi2GGC","fChi2GoldChi2GGC;#chi^{2}_{gold};#chi^{2}_{ggc}",fgkNChi2CBins,binsChi2C,fgkNChi2CBins,binsChi2C);
576 fHistList->Add(fChi2GoldChi2GGC);
579 fPtSigmaY2 = new TH2F("fPtSigmaY2","fPtSigmaY2",fgkN1PtBins,bins1Pt,fgkNSigmaY2Bins,binsSigmaY2);
580 fHistList->Add(fPtSigmaY2);
582 fPtSigmaZ2 = new TH2F("fPtSigmaZ2","fPtSigmaZ2",fgkN1PtBins,bins1Pt,fgkNSigmaZ2Bins,binsSigmaZ2);
583 fHistList->Add(fPtSigmaZ2);
585 fPtSigmaSnp2 = new TH2F("fPtSigmaSnp2","fPtSigmaSnp2",fgkN1PtBins,bins1Pt,fgkNSigmaSnp2Bins,binsSigmaSnp2);
586 fHistList->Add(fPtSigmaSnp2);
588 fPtSigmaTgl2 = new TH2F("fPtSigmaTgl2","fPtSigmaTgl2",fgkN1PtBins,bins1Pt,fgkNSigmaTgl2Bins,binsSigmaTgl2);
589 fHistList->Add(fPtSigmaTgl2);
591 fPtSigma1Pt2 = new TH2F("fPtSigma1Pt2","fPtSigma1Pt2",fgkN1PtBins,bins1Pt,fgkNSigma1Pt2Bins,binsSigma1Pt2);
592 fHistList->Add(fPtSigma1Pt2);
594 fProfPtSigmaY2 = new TProfile("fProfPtSigmaY2","fProfPtSigmaY2",fgkN1PtBins,bins1Pt);
595 fHistList->Add(fProfPtSigmaY2);
597 fProfPtSigmaZ2 = new TProfile("fProfPtSigmaZ2","fProfPtSigmaZ2",fgkN1PtBins,bins1Pt);
598 fHistList->Add(fProfPtSigmaZ2);
600 fProfPtSigmaSnp2 = new TProfile("fProfPtSigmaSnp2","fProfPtSigmaSnp2",fgkN1PtBins,bins1Pt);
601 fHistList->Add(fProfPtSigmaSnp2);
603 fProfPtSigmaTgl2 = new TProfile("fProfPtSigmaTgl2","fProfPtSigmaTgl2",fgkN1PtBins,bins1Pt);
604 fHistList->Add(fProfPtSigmaTgl2);
606 fProfPtSigma1Pt2 = new TProfile("fProfPtSigma1Pt2","fProfPtSigma1Pt2",fgkN1PtBins,bins1Pt);
607 fHistList->Add(fProfPtSigma1Pt2);
609 fProfPtSigma1Pt = new TProfile("fProfPtSigma1Pt","fProfPtSigma1Pt;p_{T};#sigma(1/p_{T})",fgkNPtBins,binsPt);
610 fHistList->Add(fProfPtSigma1Pt);
612 fProfPtPtSigma1Pt = new TProfile("fProfPtPtSigma1Pt","fProfPtPtSigma1Pt;p_{T};p_{T}#sigma(1/p_{T})",fgkNPtBins,binsPt);
613 fHistList->Add(fProfPtPtSigma1Pt);
615 TH1::AddDirectory(oldStatus);
617 PostData(1, fHistList);
619 if(binsPhi) delete [] binsPhi;
620 if(binsPt) delete [] binsPt;
621 if(binsNClustersTPC) delete [] binsNClustersTPC;
622 if(binsDCA2D) delete [] binsDCA2D;
623 if(binsDCAZ) delete [] binsDCAZ;
624 if(binsNPointITS) delete [] binsNPointITS;
625 if(binsNSigmaToVertex) delete [] binsNSigmaToVertex;
626 if(binsChi2C) delete [] binsChi2C;
627 if(binsEta) delete [] binsEta;
628 if(binsRel1PtUncertainty) delete [] binsRel1PtUncertainty;
629 if(binsUncertainty1Pt) delete [] binsUncertainty1Pt;
630 if(binsChi2PerClus) delete [] binsChi2PerClus;
631 if(binsChi2PerClus) delete [] binsNCrossedRowsNClusF;
632 if(bins1Pt) delete [] bins1Pt;
633 if(binsSigmaY2) delete [] binsSigmaY2;
634 if(binsSigmaZ2) delete [] binsSigmaZ2;
635 if(binsSigmaSnp2) delete [] binsSigmaSnp2;
636 if(binsSigmaTgl2) delete [] binsSigmaTgl2;
637 if(binsSigma1Pt2) delete [] binsSigma1Pt2;
640 //________________________________________________________________________
641 Bool_t AliPWG4HighPtTrackQA::SelectEvent() {
643 // Decide if event should be selected for analysis
646 // Checks following requirements:
647 // - fEvent available
648 // - trigger info from AliPhysicsSelection
649 // - MCevent available
650 // - number of reconstructed tracks > 1
651 // - primary vertex reconstructed
652 // - z-vertex < 10 cm
653 // - centrality in case of PbPb
655 Bool_t selectEvent = kTRUE;
657 //fEvent object available?
659 AliDebug(2,Form("ERROR: fInputEvent not available\n"));
660 fNEventReject->Fill("noAliVEvent",1);
661 selectEvent = kFALSE;
665 //Check if number of reconstructed tracks is larger than 1
666 if(!fEvent->GetNumberOfTracks() || fEvent->GetNumberOfTracks()<2) {
667 fNEventReject->Fill("NTracks<2",1);
668 selectEvent = kFALSE;
672 //Check if vertex is reconstructed
673 if(fDataType==kESD&&dynamic_cast<AliESDEvent*>(fEvent)) {
674 fVtx = ((AliESDEvent*)fEvent)->GetPrimaryVertexSPD();
677 fNEventReject->Fill("noVTX",1);
678 selectEvent = kFALSE;
682 if(!fVtx->GetStatus()) {
683 fNEventReject->Fill("VtxStatus",1);
684 selectEvent = kFALSE;
689 if(fVtx->GetNContributors()<2) {
690 fNEventReject->Fill("NCont<2",1);
691 selectEvent = kFALSE;
695 //Check if z-vertex < 10 cm
697 fVtx->GetXYZ(primVtx);
698 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
699 fNEventReject->Fill("ZVTX>10",1);
700 selectEvent = kFALSE;
704 else if(fDataType==kAOD&&dynamic_cast<AliAODEvent*>(fEvent)) {
705 const AliAODVertex *vtx = ((AliAODEvent*)fEvent)->GetPrimaryVertexSPD();
707 fNEventReject->Fill("noVTX",1);
708 selectEvent = kFALSE;
713 if(vtx->GetNContributors()<2) {
714 fNEventReject->Fill("NCont<2",1);
715 selectEvent = kFALSE;
719 //Check if z-vertex < 10 cm
721 vtx->GetXYZ(primVtx);
722 if(TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2]>10.)){
723 fNEventReject->Fill("ZVTX>10",1);
724 selectEvent = kFALSE;
730 //Centrality selection should only be done in case of PbPb
733 if(fCentClass!=CalculateCentrality(fEvent) && fCentClass!=10) {
734 fNEventReject->Fill("cent",1);
735 selectEvent = kFALSE;
739 if(fDataType==kESD) {
740 if(dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()) {
741 cent = dynamic_cast<AliESDEvent*>(fEvent)->GetCentrality()->GetCentralityPercentile("V0M");
744 else if(fDataType==kAOD) {
745 if(dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality())
746 cent = dynamic_cast<AliAODEvent*>(fEvent)->GetHeader()->GetCentrality();
749 fNEventReject->Fill("cent>90",1);
750 selectEvent = kFALSE;
753 fh1Centrality->Fill(cent);
761 //________________________________________________________________________
762 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliVEvent *ev){
764 // Get centrality from ESD or AOD
768 return CalculateCentrality(dynamic_cast<AliESDEvent*>(ev));
769 else if(fDataType==kAOD)
770 return CalculateCentrality(dynamic_cast<AliAODEvent*>(ev));
775 //________________________________________________________________________
776 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliESDEvent *esd){
778 // Get centrality from ESD
784 if(esd->GetCentrality()){
785 cent = esd->GetCentrality()->GetCentralityPercentile("V0M");
786 if(fDebug>3) printf("centrality: %f\n",cent);
790 return GetCentralityClass(cent);
794 //________________________________________________________________________
795 Int_t AliPWG4HighPtTrackQA::CalculateCentrality(AliAODEvent *aod){
797 // Get centrality from AOD
801 Float_t cent = aod->GetHeader()->GetCentrality();
802 if(fDebug>3) printf("centrality: %f\n",cent);
804 return GetCentralityClass(cent);
808 //________________________________________________________________________
809 Int_t AliPWG4HighPtTrackQA::GetCentralityClass(Float_t cent) {
811 // Get centrality class
814 if(cent<0) return 5; // OB - cent sometimes negative
815 if(cent>80) return 4;
816 if(cent>50) return 3;
817 if(cent>30) return 2;
818 if(cent>10) return 1;
823 //________________________________________________________________________
824 void AliPWG4HighPtTrackQA::UserExec(Option_t *) {
826 // Called for each event
827 AliDebug(2,Form(">> AliPWG4HighPtTrackQA::UserExec \n"));
829 fEvent = InputEvent();
830 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
832 // All events without selection
833 fNEventAll->Fill(0.);
837 PostData(1, fHistList);
842 //Need to keep track of selected events
843 fNEventSel->Fill(0.);
845 fVariables = new TArrayF(fNVariables);
847 if(fDataType==kESD) DoAnalysisESD();
848 if(fDataType==kAOD) DoAnalysisAOD();
850 //Delete old fVariables
851 if(fVariables) delete fVariables;
854 PostData(1, fHistList);
858 //________________________________________________________________________
859 void AliPWG4HighPtTrackQA::DoAnalysisESD() {
861 // Run analysis on ESD
865 PostData(1, fHistList);
869 // ---- Get MC Header information (for MC productions in pThard bins) ----
870 Double_t ptHard = 0.;
871 Double_t nTrials = 1; // trials for MC trigger weight for real data
873 AliMCEventHandler *eventHandlerMC = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
874 if (eventHandlerMC) {
876 if(eventHandlerMC->MCEvent()){
877 AliGenPythiaEventHeader* pythiaGenHeader = GetPythiaEventHeader(eventHandlerMC->MCEvent());
879 nTrials = pythiaGenHeader->Trials();
880 ptHard = pythiaGenHeader->GetPtHard();
882 fh1PtHard->Fill(ptHard);
883 fh1PtHardTrials->Fill(ptHard,nTrials);
885 fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
890 Int_t nTracks = fESD->GetNumberOfTracks();
891 AliDebug(2,Form("nTracks ESD%d", nTracks));
894 Variables to be put in fVariables
905 10: chi2PerClusterTPC
907 12: (#crossed rows)/(#findable clusters)
913 18: NClustersTPCIter1
915 20: nClustersTPCShared
916 21: Golden Chi2 - global vs TPC constrained
917 22: Chi2 between global and global constrained
920 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
921 fh1NTracksAll->Fill(0.);
923 //Get track for analysis
924 AliESDtrack *track = 0x0;
925 AliESDtrack *esdtrack = fESD->GetTrack(iTrack);
926 AliESDtrack *origtrack = new AliESDtrack(*esdtrack);
928 fh1NTracksReject->Fill("noESDtrack",1);
929 if(origtrack) delete origtrack;
934 FillSystematicCutHist(esdtrack);
935 if (!(fTrackCuts->AcceptTrack(esdtrack))) {
936 fh1NTracksReject->Fill("trackCuts",1);
937 if(origtrack) delete origtrack;
943 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
944 else if(fTrackType==2 || fTrackType==4) {
945 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
947 fh1NTracksReject->Fill("noTPConly",1);
948 if(origtrack) delete origtrack;
951 AliExternalTrackParam exParam;
952 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
954 fh1NTracksReject->Fill("relate",1);
955 if(track) delete track;
956 if(origtrack) delete origtrack;
959 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
961 else if(fTrackType==5 || fTrackType==6) {
962 if(fTrackCuts->AcceptTrack(esdtrack)) {
963 if(origtrack) delete origtrack;
967 if( !(fTrackCutsITSLoose->AcceptTrack(esdtrack)) && fTrackCutsTPConly->AcceptTrack(esdtrack) ) {
970 //use TPConly constrained track
971 track = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID());
973 fh1NTracksReject->Fill("noTPConly",1);
974 if(origtrack) delete origtrack;
977 AliExternalTrackParam exParam;
978 Bool_t relate = track->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
980 fh1NTracksReject->Fill("relate",1);
981 if(track) delete track;
982 if(origtrack) delete origtrack;
985 track->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
987 else if(fTrackType==6) {
988 //use global constrained track
989 track = new AliESDtrack(*esdtrack);
990 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
996 else if(fTrackType==7) {
997 //use global constrained track
998 track = new AliESDtrack(*esdtrack);
1004 if(origtrack) delete origtrack;
1008 if(fTrackType==2 || fTrackType==4 || fTrackType==5) {
1009 //Cut on chi2 of constrained fit
1010 if(track->GetConstrainedChi2TPC() > fSigmaConstrainedMax*fSigmaConstrainedMax && fSigmaConstrainedMax>0.) {
1011 fh1NTracksReject->Fill("chi2",1);
1012 if(track) delete track;
1013 if(origtrack) delete origtrack;
1019 FillSystematicCutHist(track);
1021 fPtAll->Fill(track->Pt());
1023 if (!(fTrackCuts->AcceptTrack(track)) && fTrackType!=4 && fTrackType!=5 && fTrackType!=6) {
1024 fh1NTracksReject->Fill("trackCuts",1);
1025 if(fTrackType==1 || fTrackType==2 || fTrackType==7) {
1026 if(track) delete track;
1028 if(origtrack) delete origtrack;
1033 if(fTrackCutsITSLoose ) {
1034 if(fTrackCutsITSLoose->AcceptTrack(track) ) {
1035 if(track) delete track;
1036 if(origtrack) delete origtrack;
1041 if(esdtrack->GetConstrainedParam())
1042 track->Set(esdtrack->GetConstrainedParam()->GetX(),esdtrack->GetConstrainedParam()->GetAlpha(),esdtrack->GetConstrainedParam()->GetParameter(),esdtrack->GetConstrainedParam()->GetCovariance());
1046 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==5 || fTrackType==6 || fTrackType==7) {
1047 if(track) delete track;
1049 if(origtrack) delete origtrack;
1053 fh1NTracksSel->Fill(0.);
1055 fVariables->Reset(0.);
1057 fVariables->SetAt(track->Pt(),0);
1058 fVariables->SetAt(track->Phi(),1);
1059 fVariables->SetAt(track->Eta(),2);
1064 if(fTrackType==1 || fTrackType==2 || fTrackType==4) {
1065 track->GetImpactParametersTPC(dca2D,dcaz); //TPConly
1068 track->GetImpactParameters(dca2D,dcaz); //Global
1070 fVariables->SetAt(dca2D,3);
1071 fVariables->SetAt(dcaz,4);
1073 fVariables->SetAt((float)track->GetTPCNcls(),5);
1075 Int_t nPointITS = 0;
1076 UChar_t itsMap = track->GetITSClusterMap();
1077 for (Int_t i=0; i < 6; i++) {
1078 if (itsMap & (1 << i))
1081 fVariables->SetAt((float)nPointITS,6);
1082 Float_t chi2C = (float)track->GetConstrainedChi2();
1083 if(fTrackType==1 || fTrackType==2 || fTrackType==4)
1084 chi2C = (float)track->GetConstrainedChi2TPC();
1085 fVariables->SetAt(chi2C,7);
1086 fVariables->SetAt(fTrackCuts->GetSigmaToVertex(track),8);// Calculates the number of sigma to the vertex for a track.
1088 fVariables->SetAt(GetTrackLengthTPC(track),9);
1090 if(fVariables->At(5)>0.) fVariables->SetAt(track->GetTPCchi2()/fVariables->At(5),10);
1092 fVariables->SetAt(track->GetTPCClusterInfo(2,1),11); //#crossed rows
1093 Float_t crossedRowsTPCNClsF = 1.;//track->GetTPCClusterInfo(2,0);
1094 if(track->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/track->GetTPCNclsF();
1095 fVariables->SetAt(crossedRowsTPCNClsF,12);//(#crossed rows)/(#findable clusters)
1096 fVariables->SetAt(track->GetSigmaY2(),13);
1097 fVariables->SetAt(track->GetSigmaZ2(),14);
1098 fVariables->SetAt(track->GetSigmaSnp2(),15);
1099 fVariables->SetAt(track->GetSigmaTgl2(),16);
1100 fVariables->SetAt(track->GetSigma1Pt2(),17);
1102 fVariables->SetAt(track->GetTPCNclsIter1(),18);
1103 fVariables->SetAt(track->GetTPCchi2Iter1(),19);
1105 fVariables->SetAt(track->GetTPCnclsS(),20);
1107 Float_t chi2Gold = GetGoldenChi2(origtrack);
1108 Float_t chi2GGC = GetGGCChi2(origtrack);
1110 fVariables->SetAt(chi2Gold,21);
1111 fVariables->SetAt(chi2GGC,22);
1115 // int mult = fTrackCuts->CountAcceptedTracks(fESD);
1117 if(fTrackType==1 || fTrackType==2 || fTrackType==4 || fTrackType==5 || fTrackType==6 || fTrackType==7) {
1118 if(track) delete track;
1125 //________________________________________________________________________
1126 void AliPWG4HighPtTrackQA::DoAnalysisAOD() {
1128 AliAODEvent *aod = dynamic_cast<AliAODEvent*>(fEvent);
1130 AliExternalTrackParam *exParam = new AliExternalTrackParam();
1131 for (Int_t iTrack = 0; iTrack < fEvent->GetNumberOfTracks(); iTrack++) {
1133 AliAODTrack *aodtrack = aod->GetTrack(iTrack);
1134 if( !aodtrack->TestFilterMask(fFilterMask) ) continue;
1136 fVariables->Reset(0.);
1138 fVariables->SetAt(aodtrack->Pt(),0);
1139 fVariables->SetAt(aodtrack->Phi(),1);
1140 fVariables->SetAt(aodtrack->Eta(),2);
1142 Double_t dca[2] = {1e6,1e6};
1143 Double_t covar[3] = {1e6,1e6,1e6};
1144 if(aodtrack->PropagateToDCA(fEvent->GetPrimaryVertex(),fEvent->GetMagneticField(),100.,dca,covar)) {
1145 fVariables->SetAt(dca[0],3);
1146 fVariables->SetAt(dca[1],4);
1149 fVariables->SetAt((float)aodtrack->GetTPCNcls(),5);
1150 fVariables->SetAt((float)aodtrack->GetITSNcls(),6);
1151 fVariables->SetAt(aodtrack->Chi2perNDF(),7);
1152 fVariables->SetAt(0.,8);
1153 fVariables->SetAt(GetTrackLengthTPC(aodtrack),9);
1154 fVariables->SetAt(aodtrack->Chi2perNDF(),10);
1155 fVariables->SetAt(GetTPCClusterInfo(aodtrack,2),11);
1156 Float_t crossedRowsTPCNClsF = 0.;
1157 if(aodtrack->GetTPCNclsF()>0.) crossedRowsTPCNClsF = fVariables->At(11)/aodtrack->GetTPCNclsF();
1158 fVariables->SetAt(crossedRowsTPCNClsF,12);
1160 //get covariance matrix
1161 Double_t cov[21] = {0,};
1162 aodtrack->GetCovMatrix(cov);
1163 Double_t pxpypz[3] = {0,};
1164 aodtrack->PxPyPz(pxpypz);
1165 Double_t xyz[3] = {0,};
1166 aodtrack->GetXYZ(xyz);
1167 Short_t sign = aodtrack->Charge();
1168 exParam->Set(xyz,pxpypz,cov,sign);
1170 fVariables->SetAt(exParam->GetSigmaY2(),13);
1171 fVariables->SetAt(exParam->GetSigmaZ2(),14);
1172 fVariables->SetAt(exParam->GetSigmaSnp2(),15);
1173 fVariables->SetAt(exParam->GetSigmaTgl2(),16);
1174 fVariables->SetAt(exParam->GetSigma1Pt2(),17);
1176 fVariables->SetAt(0.,18);
1177 fVariables->SetAt(0.,19);
1179 TBits sharedClusterMap = aodtrack->GetTPCSharedMap();
1180 fVariables->SetAt(sharedClusterMap.CountBits(),20);
1182 fVariables->SetAt(0.,21); //not available in AOD
1183 fVariables->SetAt(0.,22); //not available in AOD
1185 fPtAll->Fill(fVariables->At(0));
1193 //________________________________________________________________________
1194 void AliPWG4HighPtTrackQA::FillHistograms() {
1196 fPtSel->Fill(fVariables->At(0));
1197 fPtPhi->Fill(fVariables->At(0),fVariables->At(1));
1198 fPtEta->Fill(fVariables->At(0),fVariables->At(2));
1199 fPtDCA2D->Fill(fVariables->At(0),fVariables->At(3));
1200 fPtDCAZ->Fill(fVariables->At(0),fVariables->At(4));
1201 fPtNClustersTPC->Fill(fVariables->At(0),fVariables->At(5));
1202 fPtNPointITS->Fill(fVariables->At(0),fVariables->At(6));
1205 fPtNClustersTPCIter1->Fill(fVariables->At(0),fVariables->At(18));
1206 fPtNClustersTPCShared->Fill(fVariables->At(0),fVariables->At(20));
1207 if(fVariables->At(5)>0.)
1208 fPtNClustersTPCSharedFrac->Fill(fVariables->At(0),fVariables->At(20)/fVariables->At(5));
1210 if(fVariables->At(18)>0.)
1211 fPtChi2PerClusterTPCIter1->Fill(fVariables->At(0),fVariables->At(19)/fVariables->At(18));
1213 fPtChi2C->Fill(fVariables->At(0),fVariables->At(7));
1214 fPtNSigmaToVertex->Fill(fVariables->At(0),fVariables->At(8));
1215 fPtRelUncertainty1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1216 fPtRelUncertainty1PtNClus->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(5));
1217 fPtRelUncertainty1PtNClusIter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(18));
1218 fPtRelUncertainty1PtChi2->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(10));
1219 if(fVariables->At(18)>0.)
1220 fPtRelUncertainty1PtChi2Iter1->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(19)/fVariables->At(18));
1221 fPtRelUncertainty1PtPhi->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)),fVariables->At(1));
1223 fPtUncertainty1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1224 fPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1225 fPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1226 fPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1227 fPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1228 fPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1230 fProfPtSigmaY2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(13)));
1231 fProfPtSigmaZ2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(14)));
1232 fProfPtSigmaSnp2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(15)));
1233 fProfPtSigmaTgl2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(16)));
1234 fProfPtSigma1Pt2->Fill(1./fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1235 fProfPtSigma1Pt->Fill(fVariables->At(0),TMath::Sqrt(fVariables->At(17)));
1236 fProfPtPtSigma1Pt->Fill(fVariables->At(0),fVariables->At(0)*TMath::Sqrt(fVariables->At(17)));
1238 fPtChi2PerClusterTPC->Fill(fVariables->At(0),fVariables->At(10));
1239 fPtNCrossedRows->Fill(fVariables->At(0),fVariables->At(11));
1240 fPtNCrossedRowsNClusF->Fill(fVariables->At(0),fVariables->At(12));
1241 fPtNCrRNCrRNClusF->Fill(fVariables->At(0),fVariables->At(11),fVariables->At(12));
1243 fPtChi2Gold->Fill(fVariables->At(0),fVariables->At(21));
1244 fPtChi2GGC->Fill(fVariables->At(0),fVariables->At(22));
1246 fPtChi2GoldPhi->Fill(fVariables->At(0),fVariables->At(21),fVariables->At(1));
1247 fPtChi2GGCPhi->Fill(fVariables->At(0),fVariables->At(22),fVariables->At(1));
1249 fChi2GoldChi2GGC->Fill(fVariables->At(21),fVariables->At(22));
1254 //________________________________________________________________________
1255 Bool_t AliPWG4HighPtTrackQA::PythiaInfoFromFile(const char* currFile,Float_t &fXsec,Float_t &fTrials){
1257 // get the cross section and the trails either from pyxsec.root or from pysec_hists.root
1258 // This is to called in Notify and should provide the path to the AOD/ESD file
1259 // Copied from AliAnalysisTaskJetSpectrum2
1262 TString file(currFile);
1266 if(file.Contains("root_archive.zip#")){
1267 Ssiz_t pos1 = file.Index("root_archive",12,TString::kExact);
1268 Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
1269 file.Replace(pos+1,20,"");
1272 // not an archive take the basename....
1273 file.ReplaceAll(gSystem->BaseName(file.Data()),"");
1275 // Printf("%s",file.Data());
1278 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
1280 // next trial fetch the histgram file
1281 fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root"));
1283 // not a severe condition but inciate that we have no information
1287 // find the tlist we want to be independtent of the name so use the Tkey
1288 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
1293 TList *list = dynamic_cast<TList*>(key->ReadObj());
1298 fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
1299 fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
1302 } // no tree pyxsec.root
1304 TTree *xtree = (TTree*)fxsec->Get("Xsection");
1310 Double_t xsection = 0;
1311 xtree->SetBranchAddress("xsection",&xsection);
1312 xtree->SetBranchAddress("ntrials",&ntrials);
1320 //________________________________________________________________________
1321 Bool_t AliPWG4HighPtTrackQA::Notify()
1324 // Implemented Notify() to read the cross sections
1325 // and number of trials from pyxsec.root
1326 // Copied from AliAnalysisTaskJetSpectrum2
1329 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
1330 Float_t xsection = 0;
1331 Float_t ftrials = 1;
1335 TFile *curfile = tree->GetCurrentFile();
1337 Error("Notify","No current file");
1340 if(!fh1Xsec||!fh1Trials){
1341 // Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
1344 PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
1345 fh1Xsec->Fill("<#sigma>",xsection);
1346 // construct a poor man average trials
1347 Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
1348 if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
1353 //________________________________________________________________________
1354 AliGenPythiaEventHeader* AliPWG4HighPtTrackQA::GetPythiaEventHeader(AliMCEvent *mcEvent){
1356 if(!mcEvent)return 0;
1357 AliGenEventHeader* genHeader = mcEvent->GenEventHeader();
1358 AliGenPythiaEventHeader* pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(genHeader);
1359 if(!pythiaGenHeader){
1361 AliGenCocktailEventHeader* genCocktailHeader = dynamic_cast<AliGenCocktailEventHeader*>(genHeader);
1363 if (!genCocktailHeader) {
1364 // AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Unknown header type (not Pythia or Cocktail)");
1365 // AliWarning(Form("%s %d: Unknown header type (not Pythia or Cocktail)",(char*)__FILE__,__LINE__));
1368 TList* headerList = genCocktailHeader->GetHeaders();
1369 for (Int_t i=0; i<headerList->GetEntries(); i++) {
1370 pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(headerList->At(i));
1371 if (pythiaGenHeader)
1374 if(!pythiaGenHeader){
1375 AliWarningGeneral(Form(" %s:%d",(char*)__FILE__,__LINE__),"Pythia event header not found");
1379 return pythiaGenHeader;
1383 //_______________________________________________________________________
1384 Float_t AliPWG4HighPtTrackQA::GetTPCClusterInfo(AliAODTrack *tr,Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const
1386 //MV: copied from AliESDtrack since method is not available in AliAODTrack
1389 // TPC cluster information
1390 // type 0: get fraction of found/findable clusters with neighbourhood definition
1391 // 1: findable clusters with neighbourhood definition
1392 // 2: found clusters
1394 // definition of findable clusters:
1395 // a cluster is defined as findable if there is another cluster
1396 // within +- nNeighbours pad rows. The idea is to overcome threshold
1397 // effects with a very simple algorithm.
1400 TBits fTPCClusterMap = tr->GetTPCClusterMap();
1401 if (type==2) return fTPCClusterMap.CountBits();
1405 Int_t last=-nNeighbours;
1407 for (Int_t i=row0; i<row1; ++i){
1408 //look to current row
1409 if (fTPCClusterMap[i]) {
1415 //look to nNeighbours before
1416 if ((i-last)<=nNeighbours) {
1420 //look to nNeighbours after
1421 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1422 if (fTPCClusterMap[j]){
1428 if (type==1) return findable;
1433 fraction=(Float_t)found/(Float_t)findable;
1438 return 0; // undefined type - default value
1441 //_______________________________________________________________________
1442 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(AliESDtrack *track) {
1444 // returns distance between 1st and last hit in TPC
1445 // distance given in number of padrows
1448 TBits fTPCClusterMap = track->GetTPCClusterMap();
1452 for(int i=0; i<=159; i++) {
1453 if(fTPCClusterMap[i]>0) firstHit = i;
1455 for(int i=159; i>=0; i--) {
1456 if(fTPCClusterMap[i]>0) lastHit = i;
1459 Int_t trackLength = lastHit - firstHit;
1464 //_______________________________________________________________________
1465 Int_t AliPWG4HighPtTrackQA::GetTrackLengthTPC(AliAODTrack *track) {
1467 // returns distance between 1st and last hit in TPC
1468 // distance given in number of padrows
1471 TBits fTPCClusterMap = track->GetTPCClusterMap();
1475 for(int i=0; i<=159; i++) {
1476 if(fTPCClusterMap[i]>0) firstHit = i;
1478 for(int i=159; i>=0; i--) {
1479 if(fTPCClusterMap[i]>0) lastHit = i;
1482 Int_t trackLength = lastHit - firstHit;
1487 //_______________________________________________________________________
1488 Float_t AliPWG4HighPtTrackQA::GetGoldenChi2(AliESDtrack *origtrack) {
1490 // Return chi2 between global and TPC constrained track
1491 // track should be the global unconstrained track
1494 Float_t chi2Gold = 0.;
1496 AliESDtrack *tpcTrack = 0x0;
1497 tpcTrack = AliESDtrackCuts::GetTPCOnlyTrack(fESD,origtrack->GetID());
1499 AliExternalTrackParam exParam;
1500 Bool_t relate = tpcTrack->RelateToVertexTPC(fVtx,fESD->GetMagneticField(),kVeryBig,&exParam);
1502 tpcTrack->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance());
1503 // Double_t pTPC[2],covTPC[3]; tpcTrack->PropagateToDCA(fVtx, fESD->GetMagneticField(), 10000, pTPC, covTPC);
1506 tpcTrack->Propagate(origtrack->GetAlpha(), origtrack->GetX(), fESD->GetMagneticField());
1507 chi2Gold = (Float_t)origtrack->GetPredictedChi2(tpcTrack);
1510 if(tpcTrack) delete tpcTrack;
1516 //_______________________________________________________________________
1517 Float_t AliPWG4HighPtTrackQA::GetGGCChi2(AliESDtrack *origtrack) {
1519 // Return chi2 between global and global constrained track
1520 // track should be the global unconstrained track
1523 Float_t chi2GGC = 0.;
1525 AliESDtrack *esdtrackC = new AliESDtrack(*origtrack);
1527 if(origtrack->GetConstrainedParam()) {
1528 esdtrackC->Set(origtrack->GetConstrainedParam()->GetX(),origtrack->GetConstrainedParam()->GetAlpha(),origtrack->GetConstrainedParam()->GetParameter(),origtrack->GetConstrainedParam()->GetCovariance());
1529 chi2GGC = (Float_t)origtrack->GetPredictedChi2(esdtrackC);
1538 //_______________________________________________________________________
1539 void AliPWG4HighPtTrackQA::FillSystematicCutHist(AliESDtrack *track) {
1541 fSystTrackCuts->Fill("noCut",1);
1542 if(TMath::Abs(track->Eta())>0.9)
1543 fSystTrackCuts->Fill("eta",1);
1544 if(track->Pt()<0.15 || track->Pt()>1e10)
1545 fSystTrackCuts->Fill("0.15<pT<1e10",1);
1546 if(track->GetKinkIndex(0)>0)
1547 fSystTrackCuts->Fill("kink",1);
1548 if(track->GetTPCclusters(0)<70)
1549 fSystTrackCuts->Fill("NClusterTPC",1);
1550 if(track->GetTPCclusters(0)>0.) {
1551 if(track->GetTPCchi2()/Float_t(track->GetTPCclusters(0))>4.)
1552 fSystTrackCuts->Fill("Chi2PerNClusTPC",1);
1555 Float_t dcaToVertexXY = 0.;
1556 Float_t dcaToVertexZ = 0.;
1557 track->GetImpactParameters(dcaToVertexXY,dcaToVertexZ);
1558 Float_t fCutMaxDCAToVertexXY = 2.4;
1559 Float_t fCutMaxDCAToVertexZ = 3.2;
1560 Float_t dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY/fCutMaxDCAToVertexXY/fCutMaxDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMaxDCAToVertexZ/fCutMaxDCAToVertexZ);
1562 fSystTrackCuts->Fill("DCA2D",1);
1566 //________________________________________________________________________
1567 void AliPWG4HighPtTrackQA::Terminate(Option_t *)
1569 // The Terminate() function is the last function to be called during
1570 // a query. It always runs on the client, it can be used to present
1571 // the results graphically or save the results to file.