]>
Commit | Line | Data |
---|---|---|
8768ec6a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Satyajit Jena. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ||
17 | //=========================================================================// | |
18 | // // | |
19 | // Analysis Task for Net-Charge Higher Moment Analysis // | |
20 | // Author: Satyajit Jena || Nirbhay K. Behera // | |
21 | // sjena@cern.ch || nbehera@cern.ch // | |
22 | // // | |
23 | //=========================================================================// | |
24 | ||
25 | #include "TChain.h" | |
26 | #include "TList.h" | |
27 | #include "TFile.h" | |
28 | #include "TTree.h" | |
29 | #include "TH1D.h" | |
e405901b | 30 | #include "TH2D.h" |
31 | #include "TH3D.h" | |
32 | #include "THnSparse.h" | |
8768ec6a | 33 | #include "TCanvas.h" |
34 | ||
35 | #include "AliAnalysisTaskSE.h" | |
36 | #include "AliAnalysisManager.h" | |
37 | ||
38 | #include "AliESDVertex.h" | |
39 | #include "AliESDEvent.h" | |
40 | #include "AliESDInputHandler.h" | |
41 | #include "AliAODEvent.h" | |
42 | #include "AliAODTrack.h" | |
43 | #include "AliAODInputHandler.h" | |
44 | #include "AliESD.h" | |
45 | #include "AliESDEvent.h" | |
46 | #include "AliAODEvent.h" | |
47 | #include "AliStack.h" | |
48 | #include "AliESDtrackCuts.h" | |
49 | #include "AliAODMCHeader.h" | |
50 | #include "AliAODMCParticle.h" | |
51 | #include "AliMCEventHandler.h" | |
52 | #include "AliMCEvent.h" | |
53 | #include "AliStack.h" | |
54 | #include "AliGenHijingEventHeader.h" | |
55 | #include "AliGenEventHeader.h" | |
56 | #include "AliPID.h" | |
57 | #include "AliAODPid.h" | |
58 | #include "AliPIDResponse.h" | |
59 | #include "AliAODpidUtil.h" | |
60 | #include "AliPIDCombined.h" | |
61 | ||
62 | #include "AliEbyEHigherMomentsTask.h" | |
63 | ||
64 | using std::cout; | |
65 | using std::endl; | |
66 | ||
67 | ClassImp(AliEbyEHigherMomentsTask) | |
68 | ||
69 | ||
70 | //----------------------------------------------------------------------- | |
71 | AliEbyEHigherMomentsTask::AliEbyEHigherMomentsTask( const char *name ) | |
72 | : AliAnalysisTaskSE( name ), | |
e405901b | 73 | fListOfHistosQA(0), |
8768ec6a | 74 | fListOfHistos(0), |
e405901b | 75 | fAOD(0), |
76 | fArrayMC(0), | |
77 | fPIDResponse(0), | |
78 | fParticleSpecies(AliPID::kProton), | |
beb13b6c | 79 | fAnalysisType(0), |
8768ec6a | 80 | fCentralityEstimator("V0M"), |
e405901b | 81 | fCentrality(0), |
8768ec6a | 82 | fVxMax(3.), |
83 | fVyMax(3.), | |
e405901b | 84 | fVzMax(10.), |
8768ec6a | 85 | fDCAxy(2.4), |
86 | fDCAz(3.), | |
87 | fPtLowerLimit(0.3), | |
88 | fPtHigherLimit(1.5), | |
89 | fEtaLowerLimit(-0.8), | |
90 | fEtaHigherLimit(0.8), | |
e405901b | 91 | fRapidityCut(0.5), |
92 | fNSigmaCut(3.), | |
8768ec6a | 93 | fTPCNClus(80), |
abe73236 | 94 | fChi2perNDF(4.), |
e405901b | 95 | fAODtrackCutBit(128), |
96 | fLabel(NULL), | |
97 | fUsePid(kFALSE), | |
98 | fCheckEff(kFALSE), | |
99 | fEventCounter(0), | |
100 | fHistDCA(0), | |
101 | fTPCSig(0), | |
102 | fTPCSigA(0), | |
103 | fTHnCentNplusNminusCh(0), | |
104 | fTHnCentNplusNminusChTruth(0), | |
105 | fTHnCentNplusNminus(0), | |
106 | fTHnEfficiencyHisto(0) | |
8768ec6a | 107 | { |
108 | ||
abe73236 | 109 | for ( Int_t i = 0; i < 13; i++) { |
8768ec6a | 110 | fHistQA[i] = NULL; |
111 | } | |
abe73236 | 112 | |
e405901b | 113 | for ( Int_t i = 0; i < 5; i++ ){ |
114 | fTHnCentNplusNminusPid[i] = NULL; | |
115 | fTHnCentNplusNminusPidTruth[i] = NULL; | |
116 | } | |
117 | ||
8768ec6a | 118 | DefineOutput(1, TList::Class()); // Outpput.... |
e405901b | 119 | DefineOutput(2, TList::Class()); |
8768ec6a | 120 | } |
121 | ||
122 | AliEbyEHigherMomentsTask::~AliEbyEHigherMomentsTask() { | |
e405901b | 123 | if(fListOfHistosQA) delete fListOfHistosQA; |
8768ec6a | 124 | if(fListOfHistos) delete fListOfHistos; |
e405901b | 125 | if(fLabel[0] ) delete [] (fLabel[0]); |
126 | if(fLabel[1] ) delete [] (fLabel[1]); | |
8768ec6a | 127 | } |
128 | ||
129 | //--------------------------------------------------------------------------------- | |
130 | void AliEbyEHigherMomentsTask::UserCreateOutputObjects() { | |
e405901b | 131 | |
132 | fListOfHistosQA = new TList(); | |
133 | fListOfHistosQA->SetOwner(kTRUE); | |
8768ec6a | 134 | fListOfHistos = new TList(); |
135 | fListOfHistos->SetOwner(kTRUE); | |
8768ec6a | 136 | |
e405901b | 137 | fEventCounter = new TH1D("fEventCounter","EventCounter", 10, 0.5,10.5); |
138 | fEventCounter->GetXaxis()->SetBinLabel(1,"Event Accesed"); | |
139 | fEventCounter->GetXaxis()->SetBinLabel(2,"Within 0-90% centrality"); | |
140 | fEventCounter->GetXaxis()->SetBinLabel(5,"Have a vertex"); | |
141 | fEventCounter->GetXaxis()->SetBinLabel(6,"After vertex Cut"); | |
142 | fEventCounter->GetXaxis()->SetBinLabel(7,"Event Analyzed"); | |
143 | fEventCounter->GetXaxis()->SetBinLabel(8,"Event Analysis finished"); | |
144 | fListOfHistosQA->Add(fEventCounter); | |
145 | ||
146 | //For QA-Histograms | |
8768ec6a | 147 | fHistQA[0] = new TH1D("fHistQAvx", "Histo Vx After Cut", 400, -4., 4.); |
148 | fHistQA[1] = new TH1D("fHistQAvy", "Histo Vy After Cut", 400, -4., 4.); | |
149 | fHistQA[2] = new TH1D("fHistQAvz", "Histo Vz After Cut", 500, -25., 25.); | |
150 | fHistQA[3] = new TH1D("fHistQAvxA", "Histo Vx All", 500, -5., 5.); | |
151 | fHistQA[4] = new TH1D("fHistQAvyA", "Histo Vy All", 500, -5., 5.); | |
152 | fHistQA[5] = new TH1D("fHistQAvzA", "Histo Vz All", 500, -25., 25.); | |
153 | fHistQA[6] = new TH1D("fHistQADcaXyC", "Histo DCAxy after cut", 500, -5., 5.); | |
154 | fHistQA[7] = new TH1D("fHistQADcaZC", "Histo DCAz after cut", 500, -5., 5.); | |
155 | fHistQA[8] = new TH1D("fHistQAPt","p_{T} distribution",600,0,6); | |
156 | fHistQA[9] = new TH1D("fHistQAEta","#eta distribution",240,-1.2,1.2); | |
157 | fHistQA[10] = new TH1D("fHistQAPhi","#phi distribution",340,0,6.8); | |
abe73236 | 158 | fHistQA[11] = new TH1D("fHistQANCls","Number of TPC cluster",200,0,200); |
159 | fHistQA[12] = new TH1D("fHistQAChi2","Chi2 per NDF",100,0,10); | |
abe73236 | 160 | for(Int_t i = 0; i < 13; i++) |
8768ec6a | 161 | { |
e405901b | 162 | fListOfHistosQA->Add(fHistQA[i]); |
8768ec6a | 163 | } |
abe73236 | 164 | |
e405901b | 165 | fHistDCA = new TH2D("fHistDCA","DCAxy Vs DCAz", 500, -5., 5., 500, -5., 5.); |
166 | fTPCSig = new TH2D("fTPCSig","TPC signal",200, 0.0, 10. ,1000,0.,1000); | |
167 | fTPCSig->SetMarkerColor(kRed); | |
168 | fTPCSigA = new TH2D("fTPCSigA","TPC signal all ",200, 0.0, 10. ,1000,0.,1000); | |
169 | fListOfHistosQA->Add(fHistDCA); | |
170 | fListOfHistosQA->Add(fTPCSig); | |
171 | fListOfHistosQA->Add(fTPCSigA); | |
172 | ||
173 | const Int_t nDim = 3; | |
174 | const Int_t nPid = 5; | |
175 | TString Species[nPid] = {"Electron","Muon","Pion","Kaon","Proton"}; | |
8768ec6a | 176 | |
e405901b | 177 | Int_t fBins[nPid][nDim]; |
178 | Double_t fMin[nPid][nDim]; | |
179 | Double_t fMax[nPid][nDim]; | |
8768ec6a | 180 | |
e405901b | 181 | for( Int_t i = 0; i < nPid; i++ ){ |
182 | for( Int_t j = 0; j < nDim; j++ ){ | |
183 | fBins[i][j] = 0; | |
184 | fMin[i][j] = 0.; | |
185 | fMax[i][j] = 0.; | |
186 | } | |
187 | } | |
8768ec6a | 188 | |
abe73236 | 189 | |
e405901b | 190 | Int_t fBinsCh[nDim] = {100, 1500, 1500}; |
191 | Double_t fMinCh[nDim] = { -0.5, -0.5, -0.5 }; | |
192 | Double_t fMaxCh[nDim] = { 99.5, 1499.5, 1499.5}; | |
193 | ||
194 | fTHnCentNplusNminusCh = new THnSparseD("fTHnCentNplusNminusCh","Cent-NplusChrg-NminusChrg", nDim, fBinsCh, fMinCh, fMaxCh); | |
195 | fTHnCentNplusNminusCh->GetAxis(0)->SetTitle("Centrality"); | |
196 | fTHnCentNplusNminusCh->GetAxis(1)->SetTitle("Nplus"); | |
197 | fTHnCentNplusNminusCh->GetAxis(2)->SetTitle("Nminus"); | |
198 | fListOfHistos->Add(fTHnCentNplusNminusCh); | |
199 | ||
200 | if( fAnalysisType == "MCAOD" ){ | |
201 | ||
202 | fTHnCentNplusNminusChTruth = new THnSparseD("fTHnCentNplusNminusChTruth","Cent-NplusChrg-NminusChrg", nDim, fBinsCh, fMinCh, fMaxCh); | |
203 | fTHnCentNplusNminusChTruth->GetAxis(0)->SetTitle("Centrality"); | |
204 | fTHnCentNplusNminusChTruth->GetAxis(1)->SetTitle("Nplus"); | |
205 | fTHnCentNplusNminusChTruth->GetAxis(2)->SetTitle("Nminus"); | |
206 | fListOfHistos->Add(fTHnCentNplusNminusChTruth); | |
207 | ||
208 | if(fCheckEff){ | |
209 | ||
210 | Int_t effBin[10] = { 100, 3, 2, 2, 49, 180, 100, 49, 180, 100}; | |
211 | Double_t effBinL[10] = { -0.5, -1.5, -0.5, -0.5, 0.1, -0.9, 0., 0.1, -0.9, 0.}; | |
212 | Double_t effBinH[10] = { 99.5, 1.5, 1.5, 1.5, 5.0, 0.9, 6.8, 5.0, 0.9, 6.8 }; | |
213 | ||
214 | fTHnEfficiencyHisto = new THnSparseD("fTHnEfficiencyHisto","Cent-charge-pid-pt-eta-phi", 10, effBin, effBinL, effBinH); | |
8de47121 | 215 | fTHnEfficiencyHisto->Sumw2(); |
e405901b | 216 | fTHnEfficiencyHisto->GetAxis(0)->SetTitle("Centrality"); |
217 | fTHnEfficiencyHisto->GetAxis(1)->SetTitle("Charge"); | |
218 | fTHnEfficiencyHisto->GetAxis(2)->SetTitle("RecStatus"); | |
219 | fTHnEfficiencyHisto->GetAxis(3)->SetTitle("PidRecStatus"); | |
220 | fTHnEfficiencyHisto->GetAxis(4)->SetTitle("P_{T}MC"); | |
221 | fTHnEfficiencyHisto->GetAxis(5)->SetTitle("#eta_{MC}"); | |
222 | fTHnEfficiencyHisto->GetAxis(6)->SetTitle("#phi_{MC}"); | |
223 | fTHnEfficiencyHisto->GetAxis(7)->SetTitle("P_{T}Rec"); | |
224 | fTHnEfficiencyHisto->GetAxis(8)->SetTitle("#eta_{Rec}"); | |
225 | fTHnEfficiencyHisto->GetAxis(9)->SetTitle("#phi_{Rec}"); | |
226 | fListOfHistos->Add(fTHnEfficiencyHisto); | |
8de47121 | 227 | }//Efficiency Sparse--- |
e405901b | 228 | |
229 | }//MCAOD--- | |
230 | ||
231 | TString hname1, hname11; | |
232 | TString htitle1, axisTitle1, axisTitle2; | |
233 | ||
234 | ||
235 | if( fUsePid ){ | |
236 | ||
237 | Int_t gPid = (Int_t)fParticleSpecies; | |
238 | ||
239 | if( gPid > 1 && gPid < 5 ){ | |
240 | //Pion---- | |
241 | fBins[2][0] = 100; fBins[2][1] = 1000; fBins[2][2] = 1000; | |
242 | fMin[2][0] = -0.5; fMin[2][1] = -0.5; fMin[2][2] = -0.5; | |
243 | fMax[2][0] = 99.5; fMax[2][1] = 999.5; fMax[2][2] = 999.5; | |
244 | //Kaon------ | |
245 | fBins[3][0] = 100; fBins[3][1] = 600; fBins[3][2] = 600; | |
246 | fMin[3][0] = -0.5; fMin[3][1] = -0.5; fMin[3][2] = -0.5; | |
247 | fMax[3][0] = 99.5; fMax[3][1] = 599.5; fMax[3][2] = 599.5; | |
248 | //Proton----- | |
249 | fBins[4][0] = 100; fBins[4][1] = 400; fBins[4][2] = 400; | |
250 | fMin[4][0] = -0.5; fMin[4][1] = -0.5; fMin[4][2] = -0.5; | |
251 | fMax[4][0] = 99.5; fMax[4][1] = 399.5; fMax[4][2] = 399.5; | |
252 | ||
253 | hname1 = "fCentNplusNminusPid"; hname1 +=gPid; | |
254 | htitle1 = Species[gPid]; htitle1 +=" And Neg-"; htitle1 +=Species[gPid]; | |
255 | axisTitle1 ="Pos-"; axisTitle1 += Species[gPid]; | |
256 | axisTitle2 ="Neg-"; axisTitle2 += Species[gPid]; | |
257 | ||
258 | fTHnCentNplusNminusPid[gPid] = new THnSparseD(hname1.Data(),htitle1.Data(), nDim, fBins[gPid], fMin[gPid],fMax[gPid]); | |
259 | ||
260 | fTHnCentNplusNminusPid[gPid]->GetAxis(0)->SetTitle("Centrality"); | |
261 | fTHnCentNplusNminusPid[gPid]->GetAxis(1)->SetTitle(axisTitle1.Data()); | |
262 | fTHnCentNplusNminusPid[gPid]->GetAxis(2)->SetTitle(axisTitle2.Data()); | |
263 | ||
264 | fListOfHistos->Add(fTHnCentNplusNminusPid[gPid]); | |
265 | ||
266 | if( fAnalysisType == "MCAOD" ){ | |
267 | ||
268 | hname11 = "fCentNplusNminusPidTruth"; hname11 +=gPid; | |
269 | fTHnCentNplusNminusPidTruth[gPid] = new THnSparseD(hname11.Data(),htitle1.Data(), nDim, fBins[gPid], fMin[gPid],fMax[gPid]); | |
270 | ||
271 | fTHnCentNplusNminusPidTruth[gPid]->GetAxis(0)->SetTitle("Centrality"); | |
272 | fTHnCentNplusNminusPidTruth[gPid]->GetAxis(1)->SetTitle(axisTitle1.Data()); | |
273 | fTHnCentNplusNminusPidTruth[gPid]->GetAxis(2)->SetTitle(axisTitle2.Data()); | |
274 | fListOfHistos->Add(fTHnCentNplusNminusPidTruth[gPid]); | |
275 | ||
276 | }//MCAOD----- | |
277 | }//Pion, Koan and Proton------- | |
278 | else{ | |
279 | ||
280 | Int_t fBinsX[nDim] = {100, 1500, 1500}; | |
281 | Double_t fMinX[nDim] = { -0.5, -0.5, -0.5 }; | |
282 | Double_t fMaxX[nDim] = { 99.5, 1499.5, 1499.5}; | |
283 | ||
284 | fTHnCentNplusNminus = new THnSparseD("fTHnCentNplusNminus","Cent-NplusChrg-NminusChrg", nDim, fBinsX, fMinX, fMaxX); | |
285 | fTHnCentNplusNminus->GetAxis(0)->SetTitle("Centrality"); | |
286 | fTHnCentNplusNminus->GetAxis(1)->SetTitle("UnwantedPlus"); | |
287 | fTHnCentNplusNminus->GetAxis(2)->SetTitle("UnwantedMinus"); | |
288 | fListOfHistos->Add(fTHnCentNplusNminus); | |
289 | ||
290 | }//Unwanted particle -(other than pi, K or proton) | |
291 | ||
292 | }//fUsePid------- | |
293 | ||
294 | PostData(1, fListOfHistosQA); | |
295 | PostData(2, fListOfHistos); | |
296 | ||
abe73236 | 297 | |
8768ec6a | 298 | } |
299 | ||
300 | ||
301 | //---------------------------------------------------------------------------------- | |
302 | void AliEbyEHigherMomentsTask::UserExec( Option_t * ){ | |
abe73236 | 303 | |
8768ec6a | 304 | fEventCounter->Fill(1); |
e405901b | 305 | |
306 | if(fAnalysisType == "AOD") { | |
307 | ||
308 | doAODEvent(); | |
309 | ||
310 | }//AOD--analysis----- | |
311 | ||
312 | else if(fAnalysisType == "MCAOD") { | |
313 | ||
314 | doMCAODEvent(); | |
315 | ||
316 | } | |
317 | ||
318 | else return; | |
319 | ||
320 | fEventCounter->Fill(8); | |
321 | ||
322 | PostData(1, fListOfHistosQA); | |
323 | PostData(2, fListOfHistos); | |
324 | ||
325 | } | |
326 | ||
327 | //-------------------------------------------------------------------------------------- | |
328 | void AliEbyEHigherMomentsTask::doAODEvent(){ | |
329 | ||
8768ec6a | 330 | Double_t nPlusCharge = 0.; |
331 | Double_t nMinusCharge = 0.; | |
e405901b | 332 | Double_t nParticle = 0.; |
333 | Double_t nAntiParticle = 0.; | |
334 | Int_t gPid = 0; | |
8768ec6a | 335 | |
e405901b | 336 | AliAnalysisManager* manager = AliAnalysisManager::GetAnalysisManager(); |
337 | if (!manager) { | |
338 | cout<<"ERROR: Analysis manager not found."<<endl; | |
8768ec6a | 339 | return; |
340 | } | |
e405901b | 341 | //coneect to the inputHandler------------ |
342 | AliAODInputHandler* inputHandler = dynamic_cast<AliAODInputHandler*> (manager->GetInputEventHandler()); | |
343 | if (!inputHandler) { | |
344 | cout<<"ERROR: Input handler not found."<<endl; | |
345 | return; | |
346 | } | |
347 | ||
348 | fAOD = dynamic_cast<AliAODEvent*>(InputEvent()); | |
349 | if (!fAOD) | |
350 | { | |
351 | cout<< "ERROR 01: AOD not found " <<endl; | |
352 | return; | |
353 | } | |
8768ec6a | 354 | |
e405901b | 355 | fPIDResponse =inputHandler->GetPIDResponse(); |
8768ec6a | 356 | |
e405901b | 357 | |
358 | if (!fPIDResponse){ | |
359 | AliFatal("This Task needs the PID response attached to the inputHandler"); | |
360 | return; | |
361 | } | |
362 | ||
363 | AliAODHeader *aodHeader = fAOD->GetHeader(); | |
364 | ||
365 | fCentrality = (Int_t)aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data()); | |
366 | ||
367 | if(fCentrality < 0 || fCentrality >= 91) return; | |
368 | ||
369 | ||
370 | ||
371 | fEventCounter->Fill(2); | |
372 | ||
373 | if(!ProperVertex()) return; | |
374 | ||
375 | Int_t nTracks = fAOD->GetNumberOfTracks(); | |
376 | ||
377 | TExMap *trackMap = new TExMap();//Mapping matrix---- | |
378 | ||
379 | for(Int_t i = 0; i < nTracks; i++) { | |
8768ec6a | 380 | |
e405901b | 381 | AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(fAOD->GetTrack(i)); |
abe73236 | 382 | |
e405901b | 383 | if(!aodTrack) { |
384 | AliError(Form("ERROR: Could not retrieve AODtrack %d",i)); | |
385 | continue; | |
386 | } | |
abe73236 | 387 | |
e405901b | 388 | Double_t tpcSignalAll = aodTrack->GetTPCsignal(); |
389 | fTPCSigA->Fill(aodTrack->GetTPCmomentum(),tpcSignalAll); | |
abe73236 | 390 | |
e405901b | 391 | Int_t gID = aodTrack->GetID(); |
abe73236 | 392 | |
e405901b | 393 | if (aodTrack->TestFilterBit(1)) trackMap->Add(gID, i);//Global tracks----- |
394 | }//1st track loop---- | |
395 | ||
396 | AliAODTrack* newAodTrack; | |
397 | ||
398 | for( Int_t j = 0; j < nTracks; j++ ) | |
399 | { | |
400 | ||
401 | AliAODTrack* aodTrack1 = dynamic_cast<AliAODTrack *>(fAOD->GetTrack(j)); | |
402 | ||
403 | if(!aodTrack1) { | |
404 | AliError(Form("ERROR: Could not retrieve AODtrack %d",j)); | |
405 | continue; | |
406 | } | |
407 | ||
408 | ||
409 | if(!aodTrack1->TestFilterBit(fAODtrackCutBit)) continue; | |
410 | ||
411 | Int_t gID = aodTrack1->GetID(); | |
412 | ||
413 | //if( aodTrack->GetID() != (-aodTrack1->GetID() -1) ) continue; | |
414 | newAodTrack = gID >= 0 ? aodTrack1 : fAOD->GetTrack(trackMap->GetValue(-1-gID)); //Take those global track who corresponds to TPC only track | |
415 | ||
416 | ||
417 | Double_t pt = aodTrack1->Pt(); | |
418 | Double_t eta = aodTrack1->Eta(); | |
419 | Double_t nclus = aodTrack1->GetTPCClusterInfo(2,1); | |
420 | Double_t chi2ndf = aodTrack1->Chi2perNDF(); | |
421 | ||
422 | if( pt < fPtLowerLimit || pt > fPtHigherLimit ) continue; | |
423 | if( eta < fEtaLowerLimit || eta > fEtaHigherLimit ) continue; | |
424 | if( nclus < fTPCNClus ) continue; | |
425 | if( chi2ndf > fChi2perNDF ) continue; | |
426 | ||
427 | if( fAODtrackCutBit == 128 ){ | |
428 | //TPC only tracks---- | |
429 | Float_t dxy = 0., dz = 0.; | |
430 | dxy = aodTrack1->DCA(); | |
431 | dz = aodTrack1->ZAtDCA(); | |
432 | ||
433 | if( fabs(dxy) > fDCAxy ) continue; | |
434 | if( fabs(dz) > fDCAz ) continue; | |
435 | //Extra cut on DCA---( Similar to BF Task.. ) | |
436 | if( fDCAxy !=0 && fDCAz !=0 ){ | |
437 | if( TMath::Sqrt((dxy*dxy)/(fDCAxy*fDCAxy)+(dz*dz)/(fDCAz*fDCAz)) > 1. ) continue; | |
438 | } | |
439 | ||
440 | fHistQA[6]->Fill(dxy); | |
441 | fHistQA[7]->Fill(dz); | |
442 | fHistDCA->Fill(dxy,dz); | |
443 | ||
444 | } | |
445 | ||
446 | fHistQA[8]->Fill(pt); | |
447 | fHistQA[9]->Fill(eta); | |
448 | fHistQA[10]->Fill(aodTrack1->Phi()); | |
449 | fHistQA[11]->Fill(nclus); | |
450 | fHistQA[12]->Fill(chi2ndf); | |
451 | ||
452 | Short_t gCharge = aodTrack1->Charge(); | |
453 | ||
454 | if(gCharge > 0) nPlusCharge += 1.; | |
455 | if(gCharge < 0) nMinusCharge += 1.; | |
456 | ||
457 | if( fUsePid ) { | |
458 | ||
459 | gPid = (Int_t)fParticleSpecies; | |
460 | ||
461 | Double_t rap = newAodTrack->Y(AliPID::ParticleMass(fParticleSpecies)); | |
462 | Double_t tpcSignal = newAodTrack->GetTPCsignal(); | |
463 | //Double_t rap = aodTrack1->Y(AliPID::ParticleMass(fParticleSpecies)); | |
464 | //Double_t tpcSignal = aodTrack1->GetTPCsignal(); | |
465 | ||
466 | if( fabs(rap ) > fRapidityCut ) continue;//Rapidity cut | |
467 | ||
468 | fTPCSig->Fill(newAodTrack->GetTPCmomentum(),tpcSignal); | |
469 | ||
470 | Float_t nsigmaTPCPID = -999.; | |
471 | Float_t nsigmaTOFPID = -999.; | |
472 | //Float_t nsigmaTPCTOFPID = -999.; | |
473 | ||
474 | nsigmaTPCPID = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,fParticleSpecies)); | |
475 | nsigmaTOFPID = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(newAodTrack,fParticleSpecies)); | |
476 | ||
477 | if ( nsigmaTPCPID < fNSigmaCut ){ | |
abe73236 | 478 | |
e405901b | 479 | if (gCharge > 0) nParticle +=1.; |
480 | if( gCharge < 0 ) nAntiParticle +=1.; | |
abe73236 | 481 | |
e405901b | 482 | } |
483 | }//fUsepid----- | |
484 | ||
485 | }//--------- Track Loop to select with filterbit | |
8768ec6a | 486 | |
e405901b | 487 | |
488 | //cout << fCentrality <<" "<< nPlusCharge << " " << nMinusCharge << endl; | |
489 | //cout << fCentrality <<" "<< nParticle << " " << nAntiParticle << endl; | |
490 | ||
491 | Double_t fContainerCh[3] = { fCentrality, nPlusCharge, nMinusCharge}; | |
492 | Double_t fContainerPid[3] = { fCentrality, nParticle, nAntiParticle}; | |
493 | ||
494 | ||
495 | fTHnCentNplusNminusCh->Fill(fContainerCh); | |
496 | ||
497 | if( fUsePid ){ | |
498 | gPid = (Int_t)fParticleSpecies; | |
499 | fTHnCentNplusNminusPid[gPid]->Fill(fContainerPid); | |
500 | } | |
501 | ||
502 | fEventCounter->Fill(7); | |
503 | ||
504 | return; | |
505 | ||
506 | } | |
507 | //-------------------------------------------------------------------------------------- | |
508 | //-------------------------------------------------------------------------------------- | |
509 | void AliEbyEHigherMomentsTask::doMCAODEvent(){ | |
510 | ||
511 | ||
512 | //--------- | |
513 | Double_t nPlusCharge = 0.; | |
514 | Double_t nMinusCharge = 0.; | |
515 | ||
516 | Double_t nPlusChargeTruth = 0.; | |
517 | Double_t nMinusChargeTruth = 0.; | |
518 | ||
519 | ||
520 | Double_t nParticle = 0.; | |
521 | Double_t nAntiParticle = 0.; | |
522 | Double_t nParticleTruth = 0.; | |
523 | Double_t nAntiParticleTruth = 0.; | |
524 | ||
525 | ||
526 | Int_t gPid = 0; | |
527 | Int_t gPdgCode = AliPID::ParticleCode(fParticleSpecies); | |
528 | ||
529 | //Connect to Anlaysis manager------ | |
530 | AliAnalysisManager* manager = AliAnalysisManager::GetAnalysisManager(); | |
531 | if (!manager) { | |
532 | cout<<"ERROR: Analysis manager not found."<<endl; | |
533 | return; | |
534 | } | |
535 | ||
536 | AliAODInputHandler* inputHandler = dynamic_cast<AliAODInputHandler*> (manager->GetInputEventHandler()); | |
537 | if (!inputHandler) { | |
538 | cout<<"ERROR: Input handler not found."<<endl; | |
539 | return; | |
540 | } | |
541 | ||
542 | //AOD event------ | |
543 | fAOD = dynamic_cast<AliAODEvent*>(InputEvent()); | |
544 | if (!fAOD) | |
545 | { | |
546 | cout<< "ERROR 01: AOD not found " <<endl; | |
beb13b6c | 547 | return; |
8768ec6a | 548 | } |
e405901b | 549 | |
550 | fPIDResponse =inputHandler->GetPIDResponse(); | |
551 | ||
552 | ||
553 | if (!fPIDResponse){ | |
554 | AliFatal("This Task needs the PID response attached to the inputHandler"); | |
555 | return; | |
556 | } | |
557 | ||
558 | // -- Get MC header | |
559 | // ------------------------------------------------------------------ | |
560 | ||
561 | fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName())); | |
562 | if (!fArrayMC) { | |
563 | AliFatal("Error: MC particles branch not found!\n"); | |
564 | return; | |
565 | } | |
566 | ||
567 | AliAODMCHeader *mcHdr=NULL; | |
568 | mcHdr=(AliAODMCHeader*)fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
569 | if(!mcHdr) { | |
570 | printf("MC header branch not found!\n"); | |
571 | return; | |
572 | } | |
573 | ||
574 | AliAODHeader *aodHeader = fAOD->GetHeader(); | |
575 | ||
576 | fCentrality = (Int_t)aodHeader->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data()); | |
577 | ||
578 | ||
579 | ||
580 | if( fCentrality < 0 || fCentrality >= 91) return; | |
581 | ||
582 | fEventCounter->Fill(2); | |
583 | ||
584 | if(!ProperVertex()) return; | |
585 | ||
586 | Int_t nTracks = fAOD->GetNumberOfTracks(); | |
587 | ||
588 | fLabel = new Int_t*[2]; | |
589 | fLabel[0] = new Int_t[nTracks]; //All charged hadrons---- | |
590 | fLabel[1] = new Int_t[nTracks]; //For Pid----------- | |
591 | //Initialize labels---- | |
592 | ||
593 | if(!fLabel[0]){ | |
594 | AliError("Can't Get fLabel[0] "); | |
595 | return; | |
596 | } | |
597 | if(!fLabel[1]){ | |
598 | AliError("Can't Get fLabel[1] "); | |
599 | return; | |
600 | } | |
601 | ||
602 | for(Int_t i=0; i < 2; i++){ | |
603 | for(Int_t j=0; j < nTracks; j++){ | |
604 | fLabel[i][j] = 0; | |
8768ec6a | 605 | } |
e405901b | 606 | } |
607 | ||
608 | ||
609 | TExMap *trackMap = new TExMap();//Mapping matrix---- | |
610 | ||
611 | for(Int_t i = 0; i < nTracks; i++) { | |
8768ec6a | 612 | |
e405901b | 613 | AliAODTrack* aodTrack = dynamic_cast<AliAODTrack *>(fAOD->GetTrack(i)); |
8768ec6a | 614 | |
e405901b | 615 | if(!aodTrack) { |
616 | AliError(Form("ERROR: Could not retrieve AODtrack %d",i)); | |
617 | continue; | |
618 | } | |
8768ec6a | 619 | |
e405901b | 620 | Double_t tpcSignalAll = aodTrack->GetTPCsignal(); |
621 | fTPCSigA->Fill(aodTrack->GetTPCmomentum(),tpcSignalAll); | |
622 | ||
623 | Int_t gID = aodTrack->GetID(); | |
624 | ||
625 | if (aodTrack->TestFilterBit(1)) trackMap->Add(gID, i);//Global(primary) tracks----- | |
626 | ||
627 | }//1st track loop---- | |
628 | ||
629 | AliAODTrack* newAodTrack; | |
630 | ||
631 | for( Int_t j = 0; j < nTracks; j++ ){ | |
632 | ||
633 | AliAODTrack* aodTrack1 = dynamic_cast<AliAODTrack *>(fAOD->GetTrack(j)); | |
634 | ||
635 | if(!aodTrack1) { | |
636 | AliError(Form("ERROR: Could not retrieve AODtrack %d",j)); | |
637 | continue; | |
abe73236 | 638 | } |
8768ec6a | 639 | |
e405901b | 640 | |
641 | if(!aodTrack1->TestFilterBit(fAODtrackCutBit)) continue; | |
642 | ||
643 | Int_t gID = aodTrack1->GetID(); | |
644 | ||
645 | //if( aodTrack->GetID() != (-aodTrack1->GetID() -1) ) continue; | |
646 | ||
647 | newAodTrack = gID >= 0 ? aodTrack1 : fAOD->GetTrack(trackMap->GetValue(-1-gID)); //Take those global track who corresponds to TPC only track | |
648 | ||
649 | ||
650 | //cout << dxy << endl; | |
651 | Double_t pt = aodTrack1->Pt(); | |
652 | Double_t eta = aodTrack1->Eta(); | |
653 | Double_t nclus = aodTrack1->GetTPCClusterInfo(2,1); | |
654 | Double_t chi2ndf = aodTrack1->Chi2perNDF(); | |
655 | ||
656 | if( pt < fPtLowerLimit || pt > fPtHigherLimit ) continue; | |
657 | if( eta < fEtaLowerLimit || eta > fEtaHigherLimit ) continue; | |
658 | if( nclus < fTPCNClus ) continue; | |
659 | if( chi2ndf > fChi2perNDF ) continue; | |
660 | ||
661 | if( fAODtrackCutBit == 128 ){ | |
662 | Float_t dxy = 0., dz = 0.; | |
663 | dxy = aodTrack1->DCA(); | |
664 | dz = aodTrack1->ZAtDCA(); | |
665 | ||
666 | if( fabs(dxy) > fDCAxy ) continue; | |
667 | if( fabs(dz) > fDCAz ) continue; | |
668 | //Extra cut on DCA---( Similar to BF Task.. ) | |
669 | if( fDCAxy !=0 && fDCAz !=0 ){ | |
670 | if( TMath::Sqrt((dxy*dxy)/(fDCAxy*fDCAxy)+(dz*dz)/(fDCAz*fDCAz)) > 1. ) continue; | |
beb13b6c | 671 | } |
8768ec6a | 672 | |
e405901b | 673 | fHistQA[6]->Fill(dxy); |
674 | fHistQA[7]->Fill(dz); | |
675 | fHistDCA->Fill(dxy,dz); | |
abe73236 | 676 | |
e405901b | 677 | } |
678 | ||
679 | ||
680 | ||
681 | fHistQA[8]->Fill(pt); | |
682 | fHistQA[9]->Fill(eta); | |
683 | fHistQA[10]->Fill(aodTrack1->Phi()); | |
684 | fHistQA[11]->Fill(nclus); | |
685 | fHistQA[12]->Fill(chi2ndf); | |
686 | ||
687 | ||
688 | Short_t gCharge = aodTrack1->Charge(); | |
689 | ||
690 | if( gCharge == 0 ) continue; | |
abe73236 | 691 | |
e405901b | 692 | //Check the labels---------- |
693 | Int_t label = TMath::Abs(aodTrack1->GetLabel()); | |
694 | //fill the labels-------- | |
695 | fLabel[0][j] = label;//charged particle--- | |
696 | ||
697 | AliAODMCParticle* particle = (AliAODMCParticle*)fArrayMC->At(label); | |
698 | if (!particle) return; | |
699 | ||
700 | if(gCharge > 0) nPlusCharge += 1.; | |
701 | if(gCharge < 0) nMinusCharge += 1.; | |
702 | ||
703 | if( fUsePid ) { | |
704 | ||
705 | gPid = (Int_t)fParticleSpecies; | |
706 | Double_t rap = newAodTrack->Y(AliPID::ParticleMass(fParticleSpecies)); | |
707 | Double_t tpcSignal = newAodTrack->GetTPCsignal(); | |
708 | ||
709 | if( fabs(rap ) > fRapidityCut ) continue;//Rapidity cut | |
710 | ||
711 | fTPCSig->Fill(newAodTrack->GetTPCmomentum(),tpcSignal); | |
712 | ||
713 | Float_t nsigmaTPCPID = -999.; | |
714 | Float_t nsigmaTOFPID = -999.; | |
715 | //Float_t nsigmaTPCTOFPID = -999.; | |
716 | ||
717 | nsigmaTPCPID = TMath::Abs(fPIDResponse->NumberOfSigmasTPC(newAodTrack,fParticleSpecies)); | |
718 | nsigmaTOFPID = TMath::Abs(fPIDResponse->NumberOfSigmasTOF(newAodTrack,fParticleSpecies)); | |
719 | ||
720 | if( nsigmaTPCPID < fNSigmaCut ){ | |
721 | fLabel[1][j] = label;//pid labels---- | |
722 | if (gCharge > 0) nParticle +=1; | |
723 | if( gCharge < 0 ) nAntiParticle +=1.; | |
724 | }//nSigmaCut----- | |
725 | }//fUsepid----- | |
726 | ||
727 | }//--------- Track Loop to select with filterbit | |
abe73236 | 728 | |
e405901b | 729 | |
730 | Double_t fContainerCh[3] = { fCentrality, nPlusCharge, nMinusCharge};//Reco. values ch. hadrons | |
731 | Double_t fContainerPid[3] = { fCentrality, nParticle, nAntiParticle};//Reco. values pid. | |
732 | ||
bed5186b | 733 | fTHnCentNplusNminusCh->Fill(fContainerCh);//Fill the rec. ch. particles--- |
e405901b | 734 | if( fUsePid ){ |
735 | gPid = (Int_t)fParticleSpecies; | |
bed5186b | 736 | fTHnCentNplusNminusPid[gPid]->Fill(fContainerPid);//Fill the rec. pid tracks |
e405901b | 737 | } |
738 | ||
739 | ||
740 | //cout << fCentrality << " "<< nPlusCharge << " "<< nMinusCharge << endl; | |
741 | //cout << nParticle <<" And " << nAntiParticle << endl; | |
742 | //=========================================== | |
743 | //--------MC Truth--------------------------- | |
744 | //=========================================== | |
745 | ||
746 | Int_t nMCTrack = fArrayMC->GetEntriesFast(); | |
747 | ||
748 | for (Int_t iMC = 0; iMC < nMCTrack; iMC++) { | |
beb13b6c | 749 | |
e405901b | 750 | AliAODMCParticle *partMC = (AliAODMCParticle*) fArrayMC->At(iMC); |
751 | ||
752 | if(!partMC){ | |
753 | AliError(Form("ERROR: Could not retrieve AODMCtrack %d",iMC)); | |
754 | continue; | |
755 | } | |
756 | ||
757 | if(partMC->Charge() == 0) continue; | |
758 | if(!partMC->IsPhysicalPrimary()) continue; | |
759 | ||
760 | if (partMC->Eta() < fEtaLowerLimit || partMC->Eta() > fEtaHigherLimit) continue; | |
761 | if (partMC->Pt() < fPtLowerLimit || partMC->Pt() > fPtHigherLimit) continue; | |
762 | ||
763 | Short_t gCharge = partMC->Charge(); | |
764 | Int_t chargeState = ( gCharge < 0)? -1 : 1 ; | |
765 | if(gCharge > 0) nPlusChargeTruth += 1.; | |
766 | if(gCharge < 0) nMinusChargeTruth += 1.; | |
767 | ||
768 | if(fUsePid){ | |
769 | ||
770 | Double_t rap = partMC->Y(); | |
771 | if( fabs(rap ) > fRapidityCut ) continue;//Rapidity cut | |
772 | if(TMath::Abs(partMC->GetPdgCode()) != gPdgCode) continue; | |
773 | ||
774 | if(gCharge > 0) nParticleTruth += 1.; | |
775 | if(gCharge < 0) nAntiParticleTruth += 1.; | |
776 | ||
777 | }//if(fUsePid) ---- | |
778 | ||
779 | if( fCheckEff ){ | |
780 | ||
781 | Int_t chrgRecStatus = 0; | |
782 | Int_t pidRecStatus = 0; | |
783 | ||
784 | Double_t ptRec = 0.; | |
785 | Double_t etaRec = 0.; | |
786 | Double_t phiRec = 0.; | |
787 | ||
788 | for( Int_t iRec = 0; iRec < nTracks; iRec++ ){ | |
789 | ||
790 | if( iMC == fLabel[0][iRec] ){ | |
bed5186b | 791 | chrgRecStatus = 1; |
792 | if(fUsePid){ | |
793 | ||
794 | if( iMC == fLabel[1][iRec] ){ | |
795 | pidRecStatus = 1; | |
796 | ||
797 | } | |
798 | }//fUsePid-- | |
e405901b | 799 | |
800 | AliAODTrack* aodTrack = NULL; | |
801 | if(fAOD) | |
802 | aodTrack = fAOD->GetTrack(iRec); | |
803 | if(aodTrack){ | |
bed5186b | 804 | |
805 | ptRec = aodTrack->Pt(); | |
806 | etaRec = aodTrack->Eta(); | |
807 | phiRec = aodTrack->Phi(); | |
e405901b | 808 | |
809 | }//aodTrack | |
810 | ||
811 | break; | |
812 | ||
bed5186b | 813 | }//Check the rec. |
e405901b | 814 | |
bed5186b | 815 | }//loop over all Reconstd track-- |
e405901b | 816 | |
817 | Double_t effContainer[10] = { fCentrality, chargeState, chrgRecStatus, pidRecStatus, partMC->Pt(), partMC->Eta(), partMC->Phi(), ptRec, etaRec, phiRec }; | |
818 | ||
819 | fTHnEfficiencyHisto->Fill(effContainer); | |
bed5186b | 820 | }//if( fCheckEff ){... |
e405901b | 821 | |
822 | }//MC-Truth Track loop-- | |
823 | ||
824 | Double_t fContainerChTruth[3] = { fCentrality, nPlusChargeTruth, nMinusChargeTruth }; | |
825 | Double_t fContainerPidTruth[3] = { fCentrality, nParticleTruth, nAntiParticleTruth }; | |
826 | ||
827 | fTHnCentNplusNminusChTruth->Fill(fContainerChTruth);//MC -Truth ch. particles | |
828 | ||
829 | if( fUsePid ){ | |
830 | gPid = (Int_t)fParticleSpecies; | |
831 | fTHnCentNplusNminusPidTruth[gPid]->Fill(fContainerPidTruth);//MC-Truth pid | |
832 | } | |
833 | ||
834 | fEventCounter->Fill(7); | |
835 | ||
836 | return; | |
8768ec6a | 837 | |
838 | } | |
839 | ||
e405901b | 840 | //--------------------------------------------------------------------------------------- |
841 | Bool_t AliEbyEHigherMomentsTask::ProperVertex(){ | |
842 | ||
843 | Bool_t IsVtx = kFALSE; | |
844 | ||
845 | const AliAODVertex *vertex = fAOD->GetPrimaryVertex(); | |
846 | ||
847 | if(vertex) { | |
848 | Double32_t fCov[6]; | |
849 | vertex->GetCovarianceMatrix(fCov); | |
850 | if(vertex->GetNContributors() > 0) { | |
851 | if(fCov[5] != 0) { | |
852 | ||
853 | Double_t lvx = vertex->GetX(); | |
854 | Double_t lvy = vertex->GetY(); | |
855 | Double_t lvz = vertex->GetZ(); | |
856 | ||
857 | fEventCounter->Fill(5); | |
858 | ||
859 | fHistQA[3]->Fill(lvx);fHistQA[4]->Fill(lvy);fHistQA[5]->Fill(lvz); | |
860 | ||
861 | if(TMath::Abs(lvx) < fVxMax) { | |
862 | if(TMath::Abs(lvy) < fVyMax) { | |
863 | if(TMath::Abs(lvz) < fVzMax) { | |
864 | ||
865 | fEventCounter->Fill(6); | |
866 | fHistQA[0]->Fill(lvx);fHistQA[1]->Fill(lvy);fHistQA[2]->Fill(lvz); | |
867 | ||
868 | IsVtx = kTRUE; | |
869 | ||
870 | }//Z-Vertex cut--- | |
871 | }//Y-vertex cut-- | |
872 | }//X-vertex cut--- | |
873 | }//Covariance------ | |
874 | }//Contributors check--- | |
875 | }//If vertex----------- | |
876 | ||
877 | return IsVtx; | |
878 | } | |
879 | //--------------------------------------------------------------------------------------- | |
8768ec6a | 880 | |
881 | //------------------------------------------------------------------------ | |
882 | void AliEbyEHigherMomentsTask::Terminate( Option_t * ){ | |
883 | ||
884 | Info("AliEbyEHigherMomentTask"," Task Successfully finished"); | |
885 | ||
886 | } | |
887 | ||
888 | //------------------------------------------------------------------------ |