]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/EBYE/Fluctuations/AliEbyEMultFluctuationTask.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / EBYE / Fluctuations / AliEbyEMultFluctuationTask.cxx
CommitLineData
e70360ad 1
2#include "TChain.h"
3#include "TTree.h"
4#include "TNtuple.h"
5#include "TH1F.h"
6#include "TH2D.h"
7#include "TH1D.h"
8#include "TCanvas.h"
9#include "TArrayD.h"
10#include "AliAnalysisTask.h"
11#include "AliAnalysisManager.h"
12#include "AliAODHeader.h"
13#include "AliAODTrack.h"
14#include "AliAODTracklets.h"
15#include "AliAODpidUtil.h"
16#include "AliVTrack.h"
17#include "AliAODEvent.h"
18#include "AliAODInputHandler.h"
19#include "AliCentrality.h"
20#include "AliEbyEMultFluctuationTask.h"
21#include "AliAODVertex.h"
22#include "AliAODVZERO.h"
23#include "AliCentrality.h"
24#include "AliPID.h"
25#include "AliPIDResponse.h"
26#include "AliPIDCombined.h"
27#include "AliAODpidUtil.h"
28#include "TRandom.h"
29#include "AliTPCPIDResponse.h"
30#include "AliTRDPIDResponse.h"
31
32
33ClassImp(AliEbyEMultFluctuationTask)
34
35//________________________________________________________________________
36AliEbyEMultFluctuationTask::AliEbyEMultFluctuationTask(const char *name)
d0b37020 37: AliAnalysisTaskSE(name),fAOD(0), fAODVertex(0),fHistNchPt(0),fHistNchEta(0),fHistNchEtaCent(0),fHistNchPhi(0),fHistDCAxy(0),fHistDCAz(0),fHistnclus(0),fHistchi2ndf(0),fHistchi2ndfvscs(0),fHistVz(0),fHistMultV0A(0),fHistMultV0C(0),fHistMultV0total(0),My_ntuple(0),fOutputList(0),fCentralityEstimator("V0M"),fCentralityBins20(kFALSE),fCentralityCounter(0),fEventCounter(0),histcounter(0)
e70360ad 38
39
40{
41 // Constructor
42 for(Int_t ibin=0;ibin<91;ibin++)
43 {
44 fMult[ibin]=NULL;
45 }
46 for(Int_t jbin=0;jbin<46;jbin++)
47 {
48 fMultTwo[jbin]=NULL;
49 }
50 for(Int_t kbin=0;kbin<15;kbin++)
51 {
52 fMultFive[kbin]=NULL;
53 }
54
55
56 DefineInput(0, TChain::Class());
57
58 DefineOutput(1, TList::Class());
59}
60
61//________________________________________________________________________
62Bool_t AliEbyEMultFluctuationTask :: SelectEvent(AliAODVertex* vertex)
63{
e70360ad 64
d0b37020 65 if(vertex){
66
67 if(vertex->GetNContributors() < 0) return kFALSE;
68
69
e70360ad 70 Double_t lvx = vertex->GetX();
71 Double_t lvy = vertex->GetY();
72 Double_t lvz = vertex->GetZ();
73
74 fEventCounter->Fill(3);
75
76
77 if(TMath::Abs(lvx) > 0.3) return kFALSE;
d0b37020 78 if(TMath::Abs(lvy) > 0.3) return kFALSE;
79 if(TMath::Abs(lvz) > 10) return kFALSE;
80 if(vertex->GetType()==AliAODVertex::kPileupSPD) return kFALSE;
81
82 fEventCounter->Fill(5);
83 fHistVz->Fill(lvz);
84 return kTRUE;
85 }
86 else{
87 return kFALSE;
88 }
e70360ad 89}
90//_____________________________________________________________________________
91Int_t AliEbyEMultFluctuationTask :: SelectTrack(AliAODTrack* track)
92{
93
94 Double_t eta = track->Eta();
e70360ad 95
96 if(TMath :: Abs(eta)>0.8) return 0;
97
98 if(!track->TestFilterBit(128)) return 0;
99
100 Float_t dxy, dz;
101
102 dxy = track->DCA();
103 dz = track->ZAtDCA();
104 if(TMath ::Abs(dxy) >2.4 || TMath ::Abs(dz)>3.0) return 0;
105 // cout<<dxy<<dz<<endl;
106
107
108 Double_t nclus = track->GetTPCClusterInfo(2,1);
109 if(nclus<80) return 0;
110
111//chi2cut
112
113 Double_t chi2ndf = track->Chi2perNDF();
114 if(chi2ndf>4) return 0;
115
116return 1;
117
118
119}
120
738e4ce3 121//________________________________________________________________________________________________
e70360ad 122void AliEbyEMultFluctuationTask::UserCreateOutputObjects()
123{
124 fOutputList = new TList();
125
126
127
128 My_ntuple = new TNtuple("My_ntuple", "My_ntuple", "Mult:Mult1:Mult2:nCentrality:fV0total:nBin2:nBin5:spdmult0:spdmult1:tracklets:run");
129 fOutputList->Add(My_ntuple);
130
131fOutputList->SetOwner(kTRUE);
132fEventCounter = new TH1D("fEventCounter","EventCounter", 10, 0.5,10.5);
133fOutputList->Add(fEventCounter);
134
135
136histcounter = new TH1D("histcounter","histcounter", 10, 0.5,10.5);
137fOutputList->Add(histcounter);
138
139
140TString BinLebel;
141fCentralityCounter = new TH1D("fEventCounter","EventCounter", 100, 0.5,100.5);
142TAxis *xaxis = fCentralityCounter->GetXaxis();
143 for(Int_t ibin=0;ibin<100;ibin++)
144{
145BinLebel="cent";BinLebel+=ibin;
146xaxis->SetBinLabel(ibin,BinLebel.Data());
147
148}
149fOutputList->Add(fCentralityCounter);
150
151fHistMultV0A = new TH1F("fHistMultV0A","Mult-VOA",22000,0,22000);
152fHistMultV0C = new TH1F("fHistMultV0C","Mult-VOC",22000,0,22000);
153fHistMultV0total = new TH1F("fHistMultV0total","Mult-VOTotal",22000,0,22000);
154
155
156 fHistNchEta = new TH1D("fHistNchEta", "#eta distribution of charged tracks(for hybrid)", 200, -0.8, 0.8);
157fHistNchEta->GetXaxis()->SetTitle("#eta");
158fHistNchEta->GetYaxis()->SetTitle("dNch/d#eta");
159
160
161fHistNchEtaCent = new TH1D("fHistNchEtaCent", "Central #eta distribution of charged tracks(for hybrid)", 200, -0.8, 0.8);
162fHistNchEtaCent->GetXaxis()->SetTitle("#eta");
163fHistNchEtaCent->GetYaxis()->SetTitle("dNch/d#eta(Central)");
164
165
166
167fHistNchPhi = new TH1D("fHistNchPhi", "#phi distribution of charged tracks(for hybrid)", 200, -10, 10);
168fHistNchPhi->GetXaxis()->SetTitle("#phi");
169fHistNchPhi->GetYaxis()->SetTitle("dNch/d#phi");
170
171fHistNchPt = new TH1D("fHistNchPt", "P_{T} distribution(charged tracks for hybrid)", 150, 0.1, 3.1);
172fHistNchPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
173fHistNchPt->GetYaxis()->SetTitle("dNch/dP_{T}(c/GeV)");
174
175
176 fHistchi2ndfvscs = new TH2D("fHistchi2ndfvscs","Chi2/ndf from Gaussian fits of Multiplicity Distribution",95,0,95,60,0,6);
177 fHistchi2ndfvscs->SetXTitle("%cs");
178 fHistchi2ndfvscs->SetYTitle("Chi2/ndf");
179
180
181fHistnclus=new TH1D("no of clusters","no of tracks after TPCcluster cut",200,0,200);
182fHistchi2ndf= new TH1D("chi_square/ndf","no of tracks after chi_square/ndf cut",10,0,10);
183
184 fHistVz = new TH1D("fHistVz","Primary vertex distribution - z coordinate",90,-15,15);
185 fHistVz->SetXTitle("Vz");
186 fHistVz->SetYTitle("Entries");
187
188
189 fOutputList->Add(fHistMultV0A);
190 fOutputList->Add(fHistMultV0C);
191 fOutputList->Add(fHistMultV0total);
192 fOutputList->Add(fHistnclus);
193 fOutputList->Add(fHistchi2ndf);
194 fOutputList->Add(fHistNchPt);
195 fOutputList->Add(fHistNchEta);
196 fOutputList->Add(fHistNchEtaCent);
197
198 fOutputList->Add(fHistNchPhi);
199 fOutputList->Add(fHistVz);
200 fOutputList->Add(fHistchi2ndfvscs);
201
202
203
204TString hname;
205TString htitle;
206
207 for(Int_t i = 0; i < 25; i++) {
208 hname = "fMult"; hname+=i;
209 htitle = "Multiplicity in Cent Bin "; htitle+=i;
210 fMult[i] = new TH1F(hname.Data(),htitle.Data(),5000,0.5,5000.5);
211 fOutputList->Add(fMult[i]);
212 }
213
214 for(Int_t i = 25; i < 50; i++) {
215 hname = "fMult"; hname+=i;
216 htitle = "Multiplicity in Cent Bin "; htitle+=i;
217 fMult[i] = new TH1F(hname.Data(),htitle.Data(),3000,0.5,3000.5);
218 fOutputList->Add(fMult[i]);
219 }
220
221 for(Int_t i = 50; i < 91; i++) {
222 hname = "fMult"; hname+=i;
223 htitle = "Multiplicity in Cent Bin "; htitle+=i;
224 fMult[i] = new TH1F(hname.Data(),htitle.Data(),2000,0.5,2000.5);
225 fOutputList->Add(fMult[i]);
226 }
227
228//****************for 2% centrality bin**************************//
229for(Int_t i = 0; i < 12; i++) {
230 hname = "fMultTwo"; hname+=i;
231 htitle = "Multiplicity in Cent Bin "; htitle+=i;
232 fMultTwo[i] = new TH1F(hname.Data(),htitle.Data(),5000,0.5,5000.5);
233 fOutputList->Add(fMultTwo[i]);
234 }
235
236 for(Int_t i = 12; i < 25; i++) {
237 hname = "fMultTwo"; hname+=i;
238 htitle = "Multiplicity in Cent Bin "; htitle+=i;
239 fMultTwo[i] = new TH1F(hname.Data(),htitle.Data(),3000,0.5,3000.5);
240 fOutputList->Add(fMultTwo[i]);
241 }
242
243 for(Int_t i = 25; i <= 45; i++) {
244 hname = "fMultTwo"; hname+=i;
245 htitle = "Multiplicity in Cent Bin "; htitle+=i;
246 fMultTwo[i] = new TH1F(hname.Data(),htitle.Data(),2000,0.5,2000.5);
247 fOutputList->Add(fMultTwo[i]);
248 }
249
250
251
252//*****************************for 5 % centrality bin********************//
253for(Int_t i = 0; i < 5; i++) {
254 hname = "fMultFive"; hname+=i;
255 htitle = "Multiplicity in Cent Bin "; htitle+=i;
256 fMultFive[i] = new TH1F(hname.Data(),htitle.Data(),5000,0.5,5000.5);
257 fOutputList->Add(fMultFive[i]);
258 }
259
260 for(Int_t i = 5; i < 10; i++) {
261 hname = "fMultFive"; hname+=i;
262 htitle = "Multiplicity in Cent Bin "; htitle+=i;
263 fMultFive[i] = new TH1F(hname.Data(),htitle.Data(),3000,0.5,3000.5);
264 fOutputList->Add(fMultFive[i]);
265 }
266
267 for(Int_t i = 10; i <= 14; i++) {
268 hname = "fMultFive"; hname+=i;
269 htitle = "Multiplicity in Cent Bin "; htitle+=i;
270 fMultFive[i] = new TH1F(hname.Data(),htitle.Data(),2000,0.5,2000.5);
271 fOutputList->Add(fMultFive[i]);
272 }
273
274
275 }
276
277//________________________________________________________________________
278void AliEbyEMultFluctuationTask::UserExec(Option_t *)
279{
280
281
282
283// Post output data.
284 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
285 if (!fAOD) {
286 printf("ERROR: fAOD not available\n");
287 return;
288
289 }
290
e70360ad 291Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
292if(!isSelected) return;
293 fEventCounter->Fill(1);
294 //Counter++;
295
296
297// Get the event vertex.
298 fAODVertex = fAOD->GetPrimaryVertex();
e70360ad 299
d0b37020 300 if (!fAODVertex) {
301 return;
e70360ad 302 }
d0b37020 303
304 if(TMath::Abs((fAODVertex->GetZ())-((fAOD->GetPrimaryVertexSPD())->GetZ())) > 0.5) return;
e70360ad 305
306
307 if (!SelectEvent(fAODVertex)) return;
308
309 //***************VZERO-AMPLITUDE*************************//
310
311 AliAODVZERO *aodV0 = fAOD->GetVZEROData();
312 Float_t fV0Amult = aodV0->GetMTotV0A();
313 Float_t fV0Cmult = aodV0->GetMTotV0C();
314 Float_t fV0total = fV0Amult + fV0Cmult;
315
316 //*****************SPD-CLUSTERS*************************//
317
318
319
0a918d8d 320 AliAODHeader *fHeader = dynamic_cast<AliAODHeader*>(fAOD->GetHeader());
321 if(!fHeader) AliFatal("Not a standard AOD");
e70360ad 322 Int_t spdmult0 = fHeader->GetNumberOfITSClusters(0);
323 Int_t spdmult1 = fHeader->GetNumberOfITSClusters(1);
324 Int_t run = fHeader->GetRunNumber();
325
326 AliAODTracklets *fTracklets = fAOD->GetTracklets();
327 Int_t tracklets = fTracklets->GetNumberOfTracklets();
328
329
330 //********************CENTRALITY******************************************//
331
332 AliCentrality *centrality= fAOD->GetCentrality();
333 Double_t cent=centrality->GetCentralityPercentile("V0M");
334 // cout<<"cent= "<<cent<<endl;
335
336 if(cent < 0 || cent >= 91) return;
337
338Int_t nCentrality = (Int_t)cent;
339
340Int_t nBin2= (Int_t)( nCentrality/2.0);
341
342Int_t nBin5 = (Int_t)( nCentrality/5.0);
343 if(nBin5==0){
344
345histcounter->Fill(1);
346 }
347
348
349
350fCentralityCounter->Fill(nCentrality);
351
352fEventCounter->Fill(7);
353
354
355Double_t Mult=0.0;
356 Double_t Mult1=0.0;
357 Double_t Mult2=0.0;
358
738e4ce3 359 //printf("There are %d tracks in this event\n", fAOD->GetNumberOfTracks());
e70360ad 360
361
362 for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
f15c1f69 363 AliAODTrack* track = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iTracks));
364 if(!track) AliFatal("Not a standard AOD");
e70360ad 365 if (!track) {
366 printf("ERROR: Could not receive track %d\n", iTracks);
367 continue;
368 }
369
370
371
372
373// Find the track classification.
374Int_t tracktype = SelectTrack(track);
375
376
377 if (tracktype==0) {
378 continue;
379 }
380
381 if(track->GetType()== AliAODTrack::kPrimary)
382{
383 Short_t Charge = track->Charge();
384 Double_t eta = track->Eta();
385 if(TMath :: Abs(Charge)==1 && nBin5==0){
386 fHistNchEtaCent->Fill(eta);
387
388 }
389
390 Double_t pt = track->Pt();
391 if( pt < 0.3 || pt > 2.0 ) continue;
392 Double_t nclus = track->GetTPCClusterInfo(2,1);
393 Double_t chi2ndf = track->Chi2perNDF();
394 fHistnclus->Fill(nclus);
395 fHistchi2ndf->Fill(chi2ndf);
396 fHistchi2ndfvscs->Fill(cent,chi2ndf);
397
398 //Count the charge particles-----
399 if(TMath :: Abs(Charge)==1) Mult +=1;
400 if(Charge==1) Mult1 +=1;
401 if(Charge==-1) Mult2 +=1;
402
403
404 Double_t phi = track->Phi();
405 if(TMath :: Abs(Charge)==1) fHistNchPt->Fill(pt);
406
407
408 if(TMath :: Abs(Charge)==1) fHistNchEta->Fill(eta);
409 if(TMath :: Abs(Charge)==1) fHistNchPhi->Fill(phi);
410
411
412 }
413
414
415 } //track loop
416
417
418 //****************Filling Tree*************************//
419
420 My_ntuple->Fill(Mult,Mult1,Mult2,nCentrality,fV0total,nBin2,nBin5,spdmult0,spdmult1,tracklets,run);
421
422
423fMult[nCentrality]->Fill(Mult);
424
425if(nBin2<=45) {
426fMultTwo[nBin2]->Fill(Mult);
427 }
428if(nBin5<=14){
429fMultFive[nBin5]->Fill(Mult);
430 }
431
432 fHistMultV0A->Fill(fV0Amult);
433 fHistMultV0C->Fill(fV0Cmult);
434 fHistMultV0total->Fill(fV0total);
435
436 PostData(1, fOutputList);
437}
438//________________________________________________________________________
439void AliEbyEMultFluctuationTask::Terminate(Option_t *)
440{
441
442
443 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
444 if (!fOutputList) {
445 printf("ERROR: Output list not available\n");
446 return;
447 }
448
449}