Added computation of mothers in acceptance (Massimo) + macros for D0 analysis updated
[u/mrichter/AliRoot.git] / PWGCF / EBYE / PIDFluctuation / task / AliEbyEPidRatioPhy.cxx
CommitLineData
0a28d543 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: ALICE Offline. *
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// AliEbyE Analysis for Particle Ratio Fluctuation //
19// Deepika Rathee | Satyajit Jena //
20// drathee@cern.ch | sjena@cern.ch //
21// Date: Wed Jul 9 18:38:30 CEST 2014 //
22// New approch to find particle ratio to reduce memory //
23// (Test Only) //
24//=========================================================================//
25
26#include "TMath.h"
27#include "TAxis.h"
28#include "TProfile.h"
29#include "TProfile2D.h"
30#include "TH2D.h"
31#include "TH3D.h"
32
33#include "AliStack.h"
34#include "AliMCEvent.h"
35#include "AliMCParticle.h"
36#include "AliESDEvent.h"
37#include "AliESDtrackCuts.h"
38
39#include "AliCentrality.h"
40#include "AliTracker.h"
41
42#include "AliAODEvent.h"
43#include "AliAODTrack.h"
44#include "AliAODMCParticle.h"
45
46#include "AliEbyEPidRatioPhy.h"
47
48using namespace std;
49
50ClassImp(AliEbyEPidRatioPhy)
51//________________________________________________________________________
52AliEbyEPidRatioPhy::AliEbyEPidRatioPhy() :
53 AliEbyEPidRatioBase("Dist", "Dist"),
54 fOutList(NULL),
55 fOrder(8),
56 fNNp(6),
57 fNp(NULL),
58 fNMCNp(7),
59 fMCNp(NULL),
60 fRedFactp(NULL) {
61 AliLog::SetClassDebugLevel("AliEbyEPidRatioPhy",10);
62}
63
64//________________________________________________________________________
65AliEbyEPidRatioPhy::~AliEbyEPidRatioPhy() {
66 // Destructor
67
68 for (Int_t ii = 0; ii < fNNp; ++ii) {
69 for (Int_t kk = 0; kk < 2; ++kk)
70 if (fNp[ii][kk]) delete[] fNp[ii][kk];
71 if (fNp[ii]) delete[] fNp[ii];
72 }
73 if (fNp) delete[] fNp;
74
75 for (Int_t ii = 0; ii < fNMCNp; ++ii) {
76 for (Int_t kk = 0; kk < 2; ++kk)
77 if (fMCNp[ii][kk]) delete[] fMCNp[ii][kk];
78 if (fMCNp[ii]) delete[] fMCNp[ii];
79 }
80 if (fMCNp) delete[] fMCNp;
81
82 for (Int_t ii = 0; ii <= fOrder; ++ii)
83 if (fRedFactp[ii]) delete[] fRedFactp[ii];
84 if (fRedFactp) delete[] fRedFactp;
85
86 return;
87}
88
89//________________________________________________________________________
90void AliEbyEPidRatioPhy::Process() {
91 ProcessTracks();
92 if (fIsMC)
93 ProcessParticles();
94 return;
95}
96
97//________________________________________________________________________
98void AliEbyEPidRatioPhy::Init() {
99 fNp = new Int_t**[fNNp];
100 for (Int_t ii = 0 ; ii < fNNp; ++ii) {
101 fNp[ii] = new Int_t*[4];
102 for (Int_t kk = 0 ; kk < 4; ++kk)
103 fNp[ii][kk] = new Int_t[2];
104 }
105
106 fMCNp = new Int_t**[fNMCNp];
107 for (Int_t ii = 0 ; ii < fNMCNp; ++ii) {
108 fMCNp[ii] = new Int_t*[4];
109 for (Int_t kk = 0 ; kk < 4; ++kk)
110 fMCNp[ii][kk] = new Int_t[2];
111 }
112
113 fRedFactp = new Double_t*[fOrder+1];
114 for (Int_t ii = 0 ; ii <= fOrder; ++ii)
115 fRedFactp[ii] = new Double_t[2];
116}
117
118//________________________________________________________________________
119void AliEbyEPidRatioPhy::Reset() {
120 for (Int_t ii = 0; ii < fNNp; ++ii)
121 for (Int_t kk = 0; kk < 4; ++kk)
122 for (Int_t jj = 0; jj < 2; ++jj)
123 fNp[ii][kk][jj] = 0;
124 for (Int_t ii = 0; ii < fNMCNp; ++ii)
125 for (Int_t kk = 0; kk < 4; ++kk)
126 for (Int_t jj = 0; jj < 2; ++jj)
127 fMCNp[ii][kk][jj] = 0;
128 for (Int_t ii = 0; ii <= fOrder; ++ii)
129 for (Int_t jj = 0; jj < 2; ++jj)
130 fRedFactp[ii][jj] = 1.;
131}
132
133//________________________________________________________________________
134void AliEbyEPidRatioPhy::CreateHistograms() {
135 Float_t etaRange[2];
136 fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
137
138 Float_t ptRange[2];
139 fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]);
140 TString sTitle("");
f7ea34d2 141
142 if (fIsRatio) AddHistSetRatio("Ratio", Form("%s, #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), ptRange[0], ptRange[1]));
143
0a28d543 144 AddHistSetCent("Phy", Form("%s, #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), ptRange[0], ptRange[1]));
9b5bc5a1 145 // AddHistSetCent("PhyTPC", Form("%s, #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired()));
146 // AddHistSetCent("PhyTOF", Form("%s, #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1]));
0a28d543 147
148#if USE_PHI
149 AddHistSetCent("Phyphi", Form("%s,#it{p}_{T} [%.1f,%.1f], #varphi [%.2f,%.2f]", sTitle.Data(), ptRange[0], ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax()));
9b5bc5a1 150 // AddHistSetCent("PhyTPCphi", Form("%s, #it{p}_{T} [%.1f,%.1f], #varphi [%.2f,%.2f]",sTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired(), fHelper->GetPhiMin(), fHelper->GetPhiMax()));
151 // AddHistSetCent("PhyTOFphi", Form("%s, #it{p}_{T} [%.1f,%.1f], #varphi [%.2f,%.2f]",sTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax()));
0a28d543 152#endif
153
154 if (fIsMC) {
155 TString sMCTitle("");
156
f7ea34d2 157 if (fIsRatio) AddHistSetRatio("MCRatio", Form("%s, #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), ptRange[0], ptRange[1]));
158
0a28d543 159 AddHistSetCent("MC", Form("%s", sTitle.Data()));
160 AddHistSetCent("MCpt", Form("%s, #it{p}_{T} [%.1f,%.1f]", sMCTitle.Data(), ptRange[0], ptRange[1]));
9b5bc5a1 161 // AddHistSetCent("MCTPC", Form("%s, #it{p}_{T} [%.1f,%.1f]", sMCTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired()));
162 //AddHistSetCent("MCTOF", Form("%s, #it{p}_{T} [%.1f,%.1f]", sMCTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1]));
0a28d543 163
164#if USE_PHI
165 AddHistSetCent("MCphi", Form("%s, #it{p}_{T} [%.1f,%.1f], #varphi [%.2f,%.2f]",sMCTitle.Data(), ptRange[0], ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax()));
9b5bc5a1 166 //AddHistSetCent("MCTPCphi",Form("%s, #it{p}_{T} [%.1f,%.1f], #varphi [%.2f,%.2f]",sMCTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired(), fHelper->GetPhiMin(), fHelper->GetPhiMax()));
167 //AddHistSetCent("MCTOFphi",Form("%s, #it{p}_{T} [%.1f,%.1f], #varphi [%.2f,%.2f]",sMCTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax()));
0a28d543 168#endif
169
170 }
171
172 return;
173}
174
175//________________________________________________________________________
176Int_t AliEbyEPidRatioPhy::ProcessTracks() {
177 Float_t etaRange[2];
178 fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
179
180 Float_t ptRange[2];
181 fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]);
182 // -- Track Loop
183 for (Int_t idxTrack = 0; idxTrack < fNTracks; ++idxTrack) {
184 AliVTrack *track = (fESD) ? static_cast<AliVTrack*>(fESD->GetTrack(idxTrack)) : static_cast<AliVTrack*>(fAOD->GetTrack(idxTrack));
185 // -- Check if track is accepted for basic parameters
186 if (!fHelper->IsTrackAcceptedBasicCharged(track))
187 continue;
188 // -- Check if accepted - ESD
189 if (fESD && !fESDTrackCuts->AcceptTrack(dynamic_cast<AliESDtrack*>(track)))
190 continue;
191 // -- Check if accepted - AOD
192 if (fAOD){
193 AliAODTrack * trackAOD = dynamic_cast<AliAODTrack*>(track);
194
195 if (!trackAOD) {
196 AliError("Pointer to dynamic_cast<AliAODTrack*>(track) = ZERO");
197 continue;
198 }
199 if (!trackAOD->TestFilterBit(fAODtrackCutBit))
200 continue;
201 if(!(track->Pt() > ptRange[0] && track->Pt() <= ptRange[1] && TMath::Abs(track->Eta()) <= etaRange[1]))
202 continue;
203 }
204
205 if (!fHelper->IsTrackAcceptedDCA(track))
206 continue;
207
208 Int_t iPid = 0;
209 Double_t pid[3];
210 if (fHelper->IsTrackAcceptedPID(track, pid, (AliPID::kPion))) iPid = 1;
211 else if (fHelper->IsTrackAcceptedPID(track, pid, (AliPID::kKaon))) iPid = 2;
212 else if (fHelper->IsTrackAcceptedPID(track, pid, (AliPID::kProton))) iPid = 3;
213 else iPid = 0;
214
215 Double_t yP;
216 if (iPid != 0 && !fHelper->IsTrackAcceptedRapidity(track, yP, iPid))
217 continue;
218
219 Int_t idxPart = (track->Charge() < 0) ? 0 : 1;
220 // -- in pt Range
221 fNp[0][0][idxPart] += 1;
222 if(iPid != 0) fNp[0][iPid][idxPart] += 1;
223 // -- in TPC pt Range
9b5bc5a1 224 /* if (track->Pt() <= fHelper->GetMinPtForTOFRequired()) {
0a28d543 225 fNp[1][0][idxPart] += 1;
226 if(iPid != 0) fNp[1][iPid][idxPart] += 1;
227 }
228 // -- in TPC+TOF pt Range
229 if (track->Pt() > fHelper->GetMinPtForTOFRequired()){
230 fNp[2][0][idxPart] += 1;
231 if(iPid != 0) fNp[2][iPid][idxPart] += 1;
9b5bc5a1 232 }*/
0a28d543 233
234#if USE_PHI
235 if(!fHelper->IsTrackAcceptedPhi(track))
236 continue;
237
238 // -- in pt Range
239 fNp[3][iPid][idxPart] += 1;
240 if(iPid != 0) fNp[3][0][idxPart] += 1;
241 // -- in TPC pt Range
9b5bc5a1 242 /* if (track->Pt() <= fHelper->GetMinPtForTOFRequired()) {
0a28d543 243 fNp[4][0][idxPart] += 1;
244 if(iPid != 0)fNp[4][iPid][idxPart] += 1;
245 }
246 // -- in TPC+TOF pt Range
247 if (track->Pt() > fHelper->GetMinPtForTOFRequired()) {
248 fNp[5][0][idxPart] += 1;
9b5bc5a1 249 if(iPid != 0) fNp[5][iPid][idxPart] += 1;*/
0a28d543 250 }
251#endif
252 } // for (Int_t idxTrack = 0; idxTrack < fESD->GetNumberOfTracks(); ++idxTrack) {
253
f7ea34d2 254FillHistSetCent("Phy", 0, kFALSE);
255if (fIsRatio) FillHistSetRatio("Ratio", 0, kFALSE);
9b5bc5a1 256// FillHistSetCent("PhyTPC", 1, kFALSE);
257// FillHistSetCent("PhyTOF", 2, kFALSE);
0a28d543 258
259#if USE_PHI
9b5bc5a1 260 FillHistSetCent("Phyphi", 1, kFALSE);
261// FillHistSetCent("PhyTPCphi", 4, kFALSE);
262// FillHistSetCent("PhyTOFphi", 5, kFALSE);
0a28d543 263
264 #endif
265 /* Printf("<<<<<<<<<< Inside Loop >>>>>>>>>>");
266 for (Int_t id = 0; id < 6; ++id) {
267 printf(" == %2d == ", id);
268 for (Int_t iPid = 0; iPid < 4; ++iPid) {
269 printf("%7d %7d ", fNp[id][iPid][0] , fNp[id][iPid][1]);
270 }
271 Printf("");
272 } */
273
274
275 return 0;
276}
277
278//________________________________________________________________________
279Int_t AliEbyEPidRatioPhy::ProcessParticles() {
280 // -- Process primary particles from the stack and fill histograms
281
282 Float_t etaRange[2];
283 fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
284
285 Float_t ptRange[2];
286 fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]);
287
288 for (Int_t idxMC = 0; idxMC < fStack->GetNprimary(); ++idxMC) {
289 AliVParticle* particle = (fESD) ? fMCEvent->GetTrack(idxMC) : NULL;
290
291 if (!particle)
292 continue;
293 if (!fHelper->IsParticleAcceptedBasicCharged(particle, idxMC))
294 continue;
295
296 Int_t iPid = 0;
297 if (TMath::Abs(particle->PdgCode()) == 211) iPid = 1; // pion
298 else if (TMath::Abs(particle->PdgCode()) == 321) iPid = 2; // kaon
299 else if (TMath::Abs(particle->PdgCode()) == 2212) iPid = 3; // proton
300 else iPid = 0;
301
302 Double_t yMC;
303 if ((iPid != 0) && !fHelper->IsParticleAcceptedRapidity(particle, yMC, iPid))
304 continue;
305
306 // -- Check eta window -- for charged particles
307 if ((iPid == 0) && TMath::Abs(particle->Eta()) > etaRange[1])
308 continue;
309
310 Int_t idxPart = (particle->PdgCode() < 0) ? 0 : 1;
311
312 fMCNp[0][0][idxPart] += 1.;
313 if(iPid != 0) fMCNp[0][iPid][idxPart] += 1.;
314
315 // -- Check main pt window
316 if (!(particle->Pt() > ptRange[0] && particle->Pt() <= ptRange[1]))
317 continue;
318
319 // -- in pt Range
320 fMCNp[1][0][idxPart] += 1.;
321 if(iPid != 0)fMCNp[1][iPid][idxPart] += 1.;
322
323 // -- in TPC pt Range
9b5bc5a1 324 /* if (particle->Pt() <= fHelper->GetMinPtForTOFRequired()) {
0a28d543 325 fMCNp[2][0][idxPart] += 1;
326 if(iPid != 0)fMCNp[2][iPid][idxPart] += 1;
327 }
328 // -- in TPC+TOF pt Range
329 if (particle->Pt() > fHelper->GetMinPtForTOFRequired()) {
330 fMCNp[3][0][idxPart] += 1;
331 if(iPid != 0) fMCNp[3][iPid][idxPart] += 1;
9b5bc5a1 332 }*/
0a28d543 333
334#if USE_PHI
335 if(!fHelper->IsParticleAcceptedPhi(particle))
336 continue;
337 // idxPhi = 1;
338
339 // -- in pt Range
340 fMCNp[4][0][idxPart] += 1;
341 if(iPid != 0)fMCNp[4][iPid][idxPart] += 1;
342
9b5bc5a1 343 /* // -- in TPC pt Range
0a28d543 344 if (particle->Pt() <= fHelper->GetMinPtForTOFRequired()) {
345 fMCNp[5][0][idxPart] += 1;
346 if(iPid != 0)fMCNp[5][iPid][idxPart] += 1;
347 }
348
349 // -- in TPC+TOF pt Range
350 if (particle->Pt() > fHelper->GetMinPtForTOFRequired()){
351 fMCNp[6][0][idxPart] += 1;
352 if(iPid != 0)fMCNp[6][iPid][idxPart] += 1;
9b5bc5a1 353 }*/
0a28d543 354#endif
355 } // for (Int_t idxMC = 0; idxMC < nPart; ++idxMC) {
356
357 FillHistSetCent("MC", 0, kTRUE);
f7ea34d2 358 if (fIsRatio) FillHistSetRatio("MCRatio", 0, kTRUE);
0a28d543 359 FillHistSetCent("MCpt", 1, kTRUE);
9b5bc5a1 360 // FillHistSetCent("MCTPC", 2, kTRUE);
361 // FillHistSetCent("MCTOF", 3, kTRUE);
0a28d543 362
363#if USE_PHI
9b5bc5a1 364 FillHistSetCent("MCphi", 2, kTRUE);
f7ea34d2 365
9b5bc5a1 366 // FillHistSetCent("MCTPCphi", 5, kTRUE);
367 // FillHistSetCent("MCTOFphi", 6, kTRUE);
0a28d543 368
369
370#endif
371
372 return 0;
373}
374
375//________________________________________________________________________
376void AliEbyEPidRatioPhy::AddHistSetCent(const Char_t *name, const Char_t *title) {
377 TString sName(name);
378 TString sTitle(title);
30f94f08 379
0a28d543 380 Float_t etaRange[2];
381 fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
382
30f94f08 383 //TList *list[4];
384 fOutList->Add(new TList);
385 TList *list = static_cast<TList*>(fOutList->Last());
386 list->SetName(Form("f%s", name));
387 list->SetOwner(kTRUE);
388
eda5b3c1 389
390 Int_t nBinsCent = AliEbyEPidRatioHelper::fgkfHistNBinsCent;
391 Double_t centBinRange[] = {AliEbyEPidRatioHelper::fgkfHistRangeCent[0], AliEbyEPidRatioHelper::fgkfHistRangeCent[1]};
392
eda5b3c1 393
0a28d543 394 for (Int_t iPid = 0; iPid < 4; ++iPid) {
30f94f08 395 // fOutList->Add(new TList);
396 // list[iPid] = static_cast<TList*>(fOutList->Last());
397 // list[iPid]->SetName(Form("f%s_%s", name,AliEbyEPidRatioHelper::fgkPidName[iPid]));
398 // list[iPid]->SetOwner(kTRUE);
399
0a28d543 400 TString sNetTitle(Form("%s - %s", AliEbyEPidRatioHelper::fgkPidLatex[iPid][1], AliEbyEPidRatioHelper::fgkPidLatex[iPid][0]));
401
402 sTitle = (iPid != 0 ) ? Form("|y| < %.1f", fHelper->GetRapidityMax()) : Form(" |#eta|<%.1f", etaRange[1]);
403
404 for (Int_t idx = 1; idx <= fOrder; ++idx) {
30f94f08 405 list->Add(new TProfile(Form("fProf%s%sNet%dM", AliEbyEPidRatioHelper::fgkPidName[iPid],name, idx),
0a28d543 406 Form("(%s)^{%d} : %s;Centrality(100);(%s)^{%d}",sNetTitle.Data(), idx, sTitle.Data(), sNetTitle.Data(), idx),
407 100,-0.5,99.5));
408 }
409
410 for (Int_t ii = 0; ii <= fOrder; ++ii) {
411 for (Int_t kk = 0; kk <= fOrder; ++kk) {
30f94f08 412 list->Add(new TProfile(Form("fProf%s%sNetF%02d%02d", AliEbyEPidRatioHelper::fgkPidName[iPid], name, ii, kk),
0a28d543 413 Form("f_{%02d%02d} : %s;Centrality(100);f_{%02d%02d}", ii, kk, sTitle.Data(), ii, kk),
414 100,-0.5,99.5));
415 }
416 }
417
418 }
419
30f94f08 420 /* fOutList->Add(new TList);
421 TList *list_nu = static_cast<TList*>(fOutList->Last());
422 list_nu->SetName(Form("f%s_nu", name));
423 list_nu->SetOwner(kTRUE);
424 */
425
0a28d543 426 for (Int_t iPhy = 0; iPhy < 46; ++iPhy) {
30f94f08 427 list->Add(new TProfile(Form("fProf%sNu%02d",name,iPhy),Form("Physics Variable for index %d | %s ; Centrality;",iPhy,name),100,-0.5,99.5));
0a28d543 428 }
429
eda5b3c1 430
0a28d543 431 for (Int_t iPid = 0; iPid < 4; ++iPid) {
432 TString sNetTitle(Form("%s - %s", AliEbyEPidRatioHelper::fgkPidLatex[iPid][1], AliEbyEPidRatioHelper::fgkPidLatex[iPid][0]));
433 sTitle = (iPid != 0 ) ? Form(" |y|<%.1f", fHelper->GetRapidityMax()) : Form(" |#eta| < %.1f", etaRange[1]);
434
435 for (Int_t idx = 1; idx <= fOrder; ++idx) {
30f94f08 436 list->Add(new TProfile(Form("fProfBin%s%sNet%dM", AliEbyEPidRatioHelper::fgkPidName[iPid],name, idx),
0a28d543 437 Form("(%s)^{%d} : %s;Centrality(11);(%s)^{%d}", sNetTitle.Data(), idx, sTitle.Data(), sNetTitle.Data(), idx),
438 nBinsCent, centBinRange[0], centBinRange[1]));
439 }
440
441 for (Int_t ii = 0; ii <= fOrder; ++ii) {
442 for (Int_t kk = 0; kk <= fOrder; ++kk) {
30f94f08 443 list->Add(new TProfile(Form("fProfBin%s%sNetF%02d%02d", AliEbyEPidRatioHelper::fgkPidName[iPid], name, ii, kk),
0a28d543 444 Form("f_{%02d%02d} : %s;Centrality(11);f_{%02d%02d}", ii, kk, sTitle.Data(), ii, kk),
445 nBinsCent, centBinRange[0], centBinRange[1]));
446 }
447 }
448
449 }
450
451
452 for (Int_t iPhy = 0; iPhy < 46; ++iPhy) {
30f94f08 453 list->Add(new TProfile(Form("fProfBin%sNu%02d",name,iPhy),Form("Physics Variable for index %d | %s ; Centrality;",iPhy,name),nBinsCent, centBinRange[0], centBinRange[1]));
454 }
455
0a28d543 456 return;
457}
458
f7ea34d2 459
460
461//________________________________________________________________________
462void AliEbyEPidRatioPhy::AddHistSetRatio(const Char_t *name, const Char_t *title) {
463 TString sName(name);
464 TString sTitle(title);
465
466 Float_t etaRange[2];
467 fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]);
468
469 //TList *list[4];
470 fOutList->Add(new TList);
471 TList *list = static_cast<TList*>(fOutList->Last());
472 list->SetName(Form("f%s", name));
473 list->SetOwner(kTRUE);
474
475
476 Int_t nBinsCent = AliEbyEPidRatioHelper::fgkfHistNBinsCent;
477 Double_t centBinRange[] = {AliEbyEPidRatioHelper::fgkfHistRangeCent[0], AliEbyEPidRatioHelper::fgkfHistRangeCent[1]};
478
479 TString xyz = Form("|y| < %.1f",fHelper->GetRapidityMax());
480
481 list->Add(new TH2F(Form("fHistRatioKPi%s",name),
482 Form("(%s %s) : K/#pi;Centrality(11);K/#pi", xyz.Data(), sTitle.Data()),
483 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
484
485 list->Add(new TH2F(Form("fHistRatioKpPip%s",name),
486 Form("(%s %s) : K^{+}/#pi^{+};Centrality(11);K^{+}/#pi^{+}", xyz.Data(), sTitle.Data()),
487 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
488
489 list->Add(new TH2F(Form("fHistRatioKmPip%s",name),
490 Form("(%s %s) : K^{-}/#pi^{+};Centrality(11);K^{-}/#pi^{+}", xyz.Data(), sTitle.Data()),
491 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
492
493 list->Add(new TH2F(Form("fHistRatioKmPim%s",name),
494 Form("(%s %s) : K^{-}/#pi^{-};Centrality(11);K^{-}/#pi^{-}", xyz.Data(), sTitle.Data()),
495 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
496
497
498
499 list->Add(new TH2F(Form("fHistRatioPK%s",name),
500 Form("(%s %s) : P/K;Centrality(11);P/K", xyz.Data(), sTitle.Data()),
501 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
502
503 list->Add(new TH2F(Form("fHistRatioPpKp%s",name),
504 Form("(%s %s) : P/K^{+};Centrality(11);P/K^{+}", xyz.Data(), sTitle.Data()),
505 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
506
507 list->Add(new TH2F(Form("fHistRatioPmKp%s",name),
508 Form("(%s %s) : #bar{P}/K^{+};Centrality(11);#bar{P}/K^{+}", xyz.Data(), sTitle.Data()),
509 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
510
511 list->Add(new TH2F(Form("fHistRatioPmKm%s",name),
512 Form("(%s %s) : #bar{P}/K^{-};Centrality(11);#bar{P}/K^{-}", xyz.Data(), sTitle.Data()),
513 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
514
515
516
517 list->Add(new TH2F(Form("fHistRatioPPi%s",name),
518 Form("(%s %s) : P/#pi;Centrality(11);K/#pi", xyz.Data(), sTitle.Data()),
519 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
520
521 list->Add(new TH2F(Form("fHistRatioPpPip%s",name),
522 Form("(%s %s) : P/#pi^{+};Centrality(11);P/#pi^{+}", xyz.Data(), sTitle.Data()),
523 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
524
525 list->Add(new TH2F(Form("fHistRatioPmPip%s",name),
526 Form("(%s %s) : #bar{P}/#pi^{+};Centrality(11);#bar{P}/#pi^{+}", xyz.Data(), sTitle.Data()),
527 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
528
529 list->Add(new TH2F(Form("fHistRatioPmPim%s",name),
530 Form("(%s %s) : #bar{P}/#pi^{-};Centrality(11);#bar{P}/#pi^{-}", xyz.Data(), sTitle.Data()),
531 nBinsCent, centBinRange[0], centBinRange[1], 2500,0,0.25));
532
533
534
535 return;
536}
537
538
539
540
0a28d543 541//________________________________________________________________________
542void AliEbyEPidRatioPhy::FillHistSetCent(const Char_t *name, Int_t idx, Bool_t isMC) {
30f94f08 543 /*
544 printf(" !! %2d !! ", idx);
0a28d543 545 for (Int_t iPid = 0; iPid < 4; ++iPid) {
30f94f08 546 printf("%7d %7d ", fNp[idx][iPid][0] , fNp[idx][iPid][1]);
0a28d543 547 }
30f94f08 548 Printf("");
549 */
550
551 Int_t ***np = (isMC) ? fMCNp : fNp;
552
553 /*
554 printf(" ** %2d ** ", idx);
555 for (Int_t iPid = 0; iPid < 4; ++iPid) {
556 printf("%7d %7d ", np[idx][iPid][0] , np[idx][iPid][1]);
557 }
558 Printf("");
559 */
560
561 // TList *list[4];
0a28d543 562
0a28d543 563 Float_t centralityBin = fHelper->GetCentralityBin();
564 Float_t centralityPer = fHelper->GetCentralityPercentile();//fHelper->GetCentralityBin();
565
30f94f08 566 TList *list = static_cast<TList*>(fOutList->FindObject(Form("f%s",name)));
567
eda5b3c1 568
569
0a28d543 570 for (Int_t iPid = 0; iPid < 4; ++iPid) {
0a28d543 571 Int_t deltaNp = np[idx][iPid][1]-np[idx][iPid][0];
0a28d543 572 Double_t delta = 1.;
573 for (Int_t idxOrder = 1; idxOrder <= fOrder; ++idxOrder) {
574 delta *= deltaNp;
30f94f08 575 (static_cast<TProfile*>(list->FindObject(Form("fProfBin%s%sNet%dM", AliEbyEPidRatioHelper::fgkPidName[iPid], name, idxOrder))))->Fill(centralityBin, delta);
576 (static_cast<TProfile*>(list->FindObject(Form("fProf%s%sNet%dM", AliEbyEPidRatioHelper::fgkPidName[iPid], name, idxOrder))))->Fill(centralityPer, delta);
0a28d543 577 }
30f94f08 578
0a28d543 579 for (Int_t idxOrder = 0; idxOrder <= fOrder; ++ idxOrder) {
580 fRedFactp[idxOrder][0] = 1.;
581 fRedFactp[idxOrder][1] = 1.;
582 }
583
584 for (Int_t idxOrder = 1; idxOrder <= fOrder; ++ idxOrder) {
585 fRedFactp[idxOrder][0] = fRedFactp[idxOrder-1][0] * Double_t(np[idx][iPid][0]-(idxOrder-1));
586 fRedFactp[idxOrder][1] = fRedFactp[idxOrder-1][1] * Double_t(np[idx][iPid][1]-(idxOrder-1));
587 }
588
589 for (Int_t ii = 0; ii <= fOrder; ++ii) { // ii -> p -> n1
590 for (Int_t kk = 0; kk <= fOrder; ++kk) { // kk -> pbar -> n2
591 Double_t fik = fRedFactp[ii][1] * fRedFactp[kk][0]; // n1 *n2 -> p * pbar
30f94f08 592 (static_cast<TProfile*>(list->FindObject(Form("fProfBin%s%sNetF%02d%02d", AliEbyEPidRatioHelper::fgkPidName[iPid], name, ii, kk))))->Fill(centralityBin, fik);
593 (static_cast<TProfile*>(list->FindObject(Form("fProf%s%sNetF%02d%02d", AliEbyEPidRatioHelper::fgkPidName[iPid], name, ii, kk))))->Fill(centralityPer, fik);
0a28d543 594 }
595 }
596 }
eda5b3c1 597
fa4f1804 598
0a28d543 599 Double_t a[6][4]; Double_t b[22];
600 for (Int_t iPid = 0; iPid < 4; ++iPid) {
601 a[0][iPid] = np[idx][iPid][1]+np[idx][iPid][0]; // 0 n+ + n-
602 a[1][iPid] = np[idx][iPid][1]; // 1 n+
603 a[2][iPid] = np[idx][iPid][0]; // 2 n-
604 a[3][iPid] = np[idx][iPid][1]*np[idx][iPid][0]; // 3 n+ . n-
605 a[4][iPid] = np[idx][iPid][1]*(np[idx][iPid][1]-1); // 4 n+ (n+ - 1)
606 a[5][iPid] = np[idx][iPid][0]*(np[idx][iPid][0]-1); // 5 n- (n- - 1)
607 }
608
609 b[0] = a[0][0]*a[0][2]; // 24 N K
610 b[1] = a[0][1]*a[0][2]; // 25 Pi K
611 b[2] = a[1][1]*a[1][2]; // 26 pi+ k+
612 b[3] = a[1][1]*a[2][2]; // 27 pi+ k-
613 b[4] = a[2][1]*a[1][2]; // 28 pi- k+
614 b[5] = a[2][1]*a[2][2]; // 29 pi- k-
615
616 b[6] = a[0][0]*a[0][3]; // 30 N P
617 b[7] = a[0][2]*a[0][3]; // 31 K P
618 b[8] = a[1][2]*a[1][3]; // 32 k+ p+
619 b[9] = a[1][2]*a[2][3]; // 33 k+ p-
620 b[10] = a[2][2]*a[1][3]; // 34 k- p+
621 b[11] = a[2][2]*a[2][3]; // 35 k- p-
622
623 b[12] = a[0][0]*a[0][1]; // 36 N Pi
624 b[13] = a[0][3]*a[0][1]; // 37 P Pi
625 b[14] = a[1][3]*a[1][1]; // 38 p+ pi+
626 b[15] = a[1][3]*a[2][1]; // 39 p+ pi-
627 b[16] = a[2][3]*a[1][1]; // 40 p- pi+
628 b[17] = a[2][3]*a[2][1]; // 41 p- pi-
629
630 b[18] = a[0][0]*(a[0][0] - 1); // 42 N ( N - 1 )
631 b[19] = a[0][1]*(a[0][1] - 1); // 43 Pi( Pi- 1 )
632 b[20] = a[0][2]*(a[0][1] - 1); // 44 K ( K - 1 )
633 b[21] = a[0][3]*(a[0][3] - 1); // 45 P ( P - 1 )
30f94f08 634 // TList *list_nu = static_cast<TList*>(fOutList->FindObject(Form("f%s_nu",name)));
0a28d543 635 Int_t k = 0;
636 for (Int_t i = 0; i < 6; i++) {
637 for (Int_t j = 0; j < 4; j++) {
30f94f08 638 (static_cast<TProfile*>(list->FindObject(Form("fProfBin%sNu%02d", name,k))))->Fill(centralityBin,a[i][j]);
639 (static_cast<TProfile*>(list->FindObject(Form("fProf%sNu%02d", name,k))))->Fill(centralityPer,a[i][j]);
0a28d543 640 k++;
641 }
642 }
643
644 for (Int_t j = 0; j < 22; j++) {
9b5bc5a1 645 (static_cast<TProfile*>(list->FindObject(Form("fProfBin%sNu%02d", name,j+24))))->Fill(centralityBin,b[j]);
646 (static_cast<TProfile*>(list->FindObject(Form("fProf%sNu%02d", name,j+24))))->Fill(centralityPer,b[j]);
0a28d543 647 }
648
649 return;
650}
eda5b3c1 651
652
f7ea34d2 653//________________________________________________________________________
654void AliEbyEPidRatioPhy::FillHistSetRatio(const Char_t *name, Int_t idx, Bool_t isMC) {
655
656 Int_t ***np = (isMC) ? fMCNp : fNp;
657 Float_t centralityBin = fHelper->GetCentralityBin();
658
659 TList *list = static_cast<TList*>(fOutList->FindObject(Form("f%s",name)));
660
661 Double_t KPi = -1; if(np[idx][1][1]+np[idx][1][0] != 0 ) KPi = (np[idx][2][1]+np[idx][2][0])/(np[idx][1][1]+np[idx][1][0]);
662 Double_t KpPip = -1;
663 Double_t KmPip = -1;if (np[idx][1][1] != 0 ) { KpPip = (np[idx][2][1])/(np[idx][1][1]); KmPip = (np[idx][2][0])/(np[idx][1][1]); }
664 Double_t KmPim = -1;if (np[idx][1][0] != 0) KmPim = (np[idx][2][0])/(np[idx][1][0]);
665
666 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioKPi%s",name))))->Fill(centralityBin, KPi);
667 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioKpPip%s",name))))->Fill(centralityBin, KpPip);
668 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioKmPip%s",name))))->Fill(centralityBin, KmPip);
669 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioKmPim%s",name))))->Fill(centralityBin, KmPim);
670
671 Double_t PK = -1; if(np[idx][2][1]+np[idx][2][0] != 0 ) PK = (np[idx][3][1]+np[idx][3][0])/(np[idx][2][1]+np[idx][2][0]);
672 Double_t PpKp = -1;
673 Double_t PmKp = -1;if (np[idx][2][1] != 0 ) { PpKp = (np[idx][3][1])/(np[idx][2][1]); PmKp = (np[idx][3][0])/(np[idx][2][1]); }
674 Double_t PmKm = -1;if (np[idx][2][0] != 0) PmKm = (np[idx][3][0])/(np[idx][2][0]);
675
676 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPK%s",name))))->Fill(centralityBin, PK);
677 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPpKp%s",name))))->Fill(centralityBin, PpKp);
678 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPmKp%s",name))))->Fill(centralityBin, PmKp);
679 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPmKm%s",name))))->Fill(centralityBin, PmKm);
680
681 Double_t PPi = -1; if(np[idx][1][1]+np[idx][1][0] != 0 ) PPi = (np[idx][3][1]+np[idx][3][0])/(np[idx][1][1]+np[idx][1][0]);
682 Double_t PpPip = -1;
683 Double_t PmPip = -1;if (np[idx][1][1] != 0 ) { PpPip = (np[idx][3][1])/(np[idx][1][1]); PmPip = (np[idx][3][0])/(np[idx][1][1]); }
684 Double_t PmPim = -1;if (np[idx][1][0] != 0) PmPim = (np[idx][3][0])/(np[idx][1][0]);
685
686 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPPi%s",name))))->Fill(centralityBin, PPi);
687 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPpPip%s",name))))->Fill(centralityBin, PpPip);
688 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPmPip%s",name))))->Fill(centralityBin, PmPip);
689 (static_cast<TProfile*>(list->FindObject(Form("fHistRatioPmPim%s",name))))->Fill(centralityBin, PmPim);
690
691 return;
692}
693
694
eda5b3c1 695
696