]>
Commit | Line | Data |
---|---|---|
cb68eb1d | 1 | //-*- Mode: C++ -*- |
2 | ||
3 | #include "TMath.h" | |
4 | #include "TAxis.h" | |
5 | #include "TSystem.h" | |
6 | #include "TProfile.h" | |
7 | #include "TH2F.h" | |
8 | #include "TH3F.h" | |
9 | #include "TFile.h" | |
10 | #include "TPRegexp.h" | |
11 | ||
12 | #include "AliStack.h" | |
13 | #include "AliMCEvent.h" | |
14 | #include "AliMCParticle.h" | |
15 | #include "AliESDtrackCuts.h" | |
16 | #include "AliESDInputHandler.h" | |
17 | #include "AliESDpid.h" | |
18 | #include "AliCentrality.h" | |
19 | #include "AliTracker.h" | |
9be43c8e | 20 | #include "AliAODInputHandler.h" |
21 | #include "AliAODEvent.h" | |
22 | #include "AliAODTrack.h" | |
5de3d4d1 | 23 | #include "AliAODMCParticle.h" |
cb68eb1d | 24 | |
25 | #include "AliAnalysisNetParticleDistribution.h" | |
26 | ||
27 | using namespace std; | |
28 | ||
4918c45f | 29 | /** |
30 | * Class for for NetParticle Distributions | |
31 | * -- Create input for distributions | |
32 | * Authors: Jochen Thaeder <jochen@thaeder.de> | |
33 | * Michael Weber <m.weber@cern.ch> | |
34 | */ | |
cb68eb1d | 35 | |
36 | ClassImp(AliAnalysisNetParticleDistribution) | |
37 | ||
38 | /* | |
39 | * --------------------------------------------------------------------------------- | |
40 | * Constructor / Destructor | |
41 | * --------------------------------------------------------------------------------- | |
42 | */ | |
43 | ||
44 | //________________________________________________________________________ | |
45 | AliAnalysisNetParticleDistribution::AliAnalysisNetParticleDistribution() : | |
46 | fHelper(NULL), | |
5de3d4d1 | 47 | fPdgCode(2212), |
cb68eb1d | 48 | fOutList(NULL), |
5de3d4d1 | 49 | |
cb68eb1d | 50 | fESD(NULL), |
5de3d4d1 | 51 | fESDTrackCuts(NULL), |
52 | fPIDResponse(NULL), | |
9be43c8e | 53 | fAOD(NULL), |
5de3d4d1 | 54 | fArrayMC(NULL), |
55 | fAODtrackCutBit(1024), | |
cb68eb1d | 56 | fIsMC(kFALSE), |
57 | fMCEvent(NULL), | |
58 | fStack(NULL), | |
5de3d4d1 | 59 | |
60 | fOrder(12), | |
61 | fNNp(6), | |
cb68eb1d | 62 | fNp(NULL), |
5de3d4d1 | 63 | fNMCNp(7), |
cb68eb1d | 64 | fMCNp(NULL), |
5de3d4d1 | 65 | fFactp(NULL), |
66 | ||
67 | fCentralityBin(-1.), | |
68 | fNTracks(0), | |
69 | ||
cb68eb1d | 70 | fHnTrackUnCorr(NULL) { |
71 | // Constructor | |
72 | ||
73 | AliLog::SetClassDebugLevel("AliAnalysisNetParticleDistribution",10); | |
74 | } | |
75 | ||
76 | //________________________________________________________________________ | |
77 | AliAnalysisNetParticleDistribution::~AliAnalysisNetParticleDistribution() { | |
78 | // Destructor | |
79 | ||
4918c45f | 80 | for (Int_t ii = 0; ii < fNNp; ++ii) |
81 | if (fNp[ii]) delete[] fNp[ii]; | |
82 | if (fNp) delete[] fNp; | |
cb68eb1d | 83 | |
84 | for (Int_t ii = 0; ii < fNMCNp; ++ii) | |
85 | if (fMCNp[ii]) delete[] fMCNp[ii]; | |
86 | if (fMCNp) delete[] fMCNp; | |
87 | ||
5de3d4d1 | 88 | for (Int_t ii = 0; ii <= fOrder; ++ii) |
89 | if (fFactp[ii]) delete[] fFactp[ii]; | |
90 | if (fFactp) delete[] fFactp; | |
91 | ||
cb68eb1d | 92 | return; |
93 | } | |
94 | ||
95 | /* | |
96 | * --------------------------------------------------------------------------------- | |
97 | * Public Methods | |
98 | * --------------------------------------------------------------------------------- | |
99 | */ | |
100 | ||
101 | //________________________________________________________________________ | |
5de3d4d1 | 102 | Int_t AliAnalysisNetParticleDistribution::Initialize(AliAnalysisNetParticleHelper* helper, AliESDtrackCuts* cuts, Bool_t isMC, Int_t trackCutBit) { |
cb68eb1d | 103 | // -- Initialize |
5de3d4d1 | 104 | |
105 | // -- Get Helper | |
106 | // --------------- | |
107 | fHelper = helper; | |
108 | ||
109 | // -- ESD track cuts | |
110 | // ------------------- | |
111 | fESDTrackCuts = cuts; | |
112 | ||
113 | // -- Is MC | |
114 | // ---------- | |
115 | fIsMC = isMC; | |
116 | ||
117 | // -- AOD track filter bit | |
118 | // ------------------------- | |
119 | fAODtrackCutBit = trackCutBit; | |
120 | ||
121 | // -- Get particle species / pdgCode | |
122 | // ------------------------- | |
123 | if (fIsMC) | |
124 | fPdgCode = AliPID::ParticleCode(fHelper->GetParticleSpecies()); | |
cb68eb1d | 125 | |
126 | // ------------------------------------------------------------------ | |
127 | // -- N particles / N anti-particles | |
128 | // ------------------------------------------------------------------ | |
4918c45f | 129 | // Np : arr[set][particle] |
130 | // MCNp : arr[set][particle] - MC | |
5de3d4d1 | 131 | // Factorials : arr[order][particle] |
132 | ||
133 | fNp = new Double_t*[fNNp]; | |
4918c45f | 134 | for (Int_t ii = 0 ; ii < fNNp; ++ii) |
5de3d4d1 | 135 | fNp[ii] = new Double_t[2]; |
cb68eb1d | 136 | |
5de3d4d1 | 137 | fMCNp = new Double_t*[fNMCNp]; |
cb68eb1d | 138 | for (Int_t ii = 0 ; ii < fNMCNp; ++ii) |
5de3d4d1 | 139 | fMCNp[ii] = new Double_t[2]; |
140 | ||
141 | fFactp = new Double_t*[fOrder+1]; | |
142 | for (Int_t ii = 0 ; ii <= fOrder; ++ii) | |
143 | fFactp[ii] = new Double_t[2]; | |
cb68eb1d | 144 | |
cb68eb1d | 145 | ResetEvent(); |
146 | ||
147 | return 0; | |
148 | } | |
149 | ||
150 | //________________________________________________________________________ | |
151 | void AliAnalysisNetParticleDistribution::CreateHistograms(TList* outList) { | |
152 | // -- Add histograms to outlist | |
153 | ||
154 | fOutList = outList; | |
5de3d4d1 | 155 | |
156 | // -- Get ranges for pt and eta | |
157 | Float_t etaRange[2]; | |
158 | fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]); | |
159 | ||
160 | Float_t ptRange[2]; | |
161 | fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]); | |
162 | ||
cb68eb1d | 163 | // ------------------------------------------------------------------ |
164 | // -- Get Probe Particle Container | |
165 | // ------------------------------------------------------------------ | |
166 | ||
4918c45f | 167 | Int_t binHnUnCorr[6] = {AliAnalysisNetParticleHelper::fgkfHistNBinsCent, AliAnalysisNetParticleHelper::fgkfHistNBinsEta, // cent | eta |
168 | AliAnalysisNetParticleHelper::fgkfHistNBinsRap, AliAnalysisNetParticleHelper::fgkfHistNBinsPhi, // y | phi | |
169 | AliAnalysisNetParticleHelper::fgkfHistNBinsPt, AliAnalysisNetParticleHelper::fgkfHistNBinsSign}; // pt | sign | |
170 | ||
171 | Double_t minHnUnCorr[6] = {AliAnalysisNetParticleHelper::fgkfHistRangeCent[0], AliAnalysisNetParticleHelper::fgkfHistRangeEta[0], | |
172 | AliAnalysisNetParticleHelper::fgkfHistRangeRap[0], AliAnalysisNetParticleHelper::fgkfHistRangePhi[0], | |
173 | AliAnalysisNetParticleHelper::fgkfHistRangePt[0], AliAnalysisNetParticleHelper::fgkfHistRangeSign[0]}; | |
174 | ||
175 | Double_t maxHnUnCorr[6] = {AliAnalysisNetParticleHelper::fgkfHistRangeCent[1], AliAnalysisNetParticleHelper::fgkfHistRangeEta[1], | |
176 | AliAnalysisNetParticleHelper::fgkfHistRangeRap[1], AliAnalysisNetParticleHelper::fgkfHistRangePhi[1], | |
177 | AliAnalysisNetParticleHelper::fgkfHistRangePt[1], AliAnalysisNetParticleHelper::fgkfHistRangeSign[1]}; | |
cb68eb1d | 178 | |
cb68eb1d | 179 | // -- UnCorrected |
4918c45f | 180 | fOutList->Add(new THnSparseF("fHnTrackUnCorr", "cent:eta:y:phi:pt:sign", 6, binHnUnCorr, minHnUnCorr, maxHnUnCorr)); |
cb68eb1d | 181 | fHnTrackUnCorr = static_cast<THnSparseF*>(fOutList->Last()); |
4918c45f | 182 | fHnTrackUnCorr->Sumw2(); |
cb68eb1d | 183 | fHnTrackUnCorr->GetAxis(0)->SetTitle("centrality"); |
4918c45f | 184 | fHnTrackUnCorr->GetAxis(1)->SetTitle("#eta"); |
185 | fHnTrackUnCorr->GetAxis(2)->SetTitle("#it{y}"); | |
186 | fHnTrackUnCorr->GetAxis(3)->SetTitle("#varphi"); | |
187 | fHnTrackUnCorr->GetAxis(4)->SetTitle("#it{p}_{T} (GeV/#it{c})"); | |
188 | fHnTrackUnCorr->GetAxis(5)->SetTitle("sign"); | |
cb68eb1d | 189 | |
190 | fHelper->BinLogAxis(fHnTrackUnCorr, 1); | |
191 | ||
4918c45f | 192 | // ------------------------------------------------------------------ |
193 | // -- Create net particle histograms | |
194 | // ------------------------------------------------------------------ | |
195 | ||
196 | TString sTitle(""); | |
5de3d4d1 | 197 | sTitle = (fHelper->GetUsePID()) ? Form("Uncorrected in |y| < %.1f", fHelper->GetRapidityMax()) : Form("Uncorrected in |#eta| < %.1f", etaRange[1]); |
198 | ||
199 | AddHistSet("fHDist", Form("%s + #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), ptRange[0], ptRange[1])); | |
200 | AddHistSet("fHDistTPC", Form("%s + #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired())); | |
201 | AddHistSet("fHDistTOF", Form("%s + #it{p}_{T} [%.1f,%.1f]", sTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1])); | |
4918c45f | 202 | |
4918c45f | 203 | AddHistSet("fHDistphi", Form("%s + #it{p}_{T} [%.1f,%.1f] + #varphi [%.1f,%.1f]", |
5de3d4d1 | 204 | sTitle.Data(), ptRange[0], ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax())); |
4918c45f | 205 | AddHistSet("fHDistTPCphi", Form("%s + #it{p}_{T} [%.1f,%.1f] + #varphi [%.1f,%.1f]", |
5de3d4d1 | 206 | sTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired(), fHelper->GetPhiMin(), fHelper->GetPhiMax())); |
207 | AddHistSet("fHDistTOFphi", Form("%s + #it{p}_{T} [%.1f,%.1f] + #varphi [%.1f,%.1f]", | |
208 | sTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax())); | |
4918c45f | 209 | |
210 | if (fIsMC) { | |
211 | TString sMCTitle(""); | |
5de3d4d1 | 212 | sMCTitle = (fHelper->GetUsePID()) ? Form("MC primary in |y| < %.1f", fHelper->GetRapidityMax()) : Form("MC primary in |#eta| < %.1f", etaRange[1]); |
4918c45f | 213 | |
214 | AddHistSet("fHMC", Form("%s", sTitle.Data())); | |
5de3d4d1 | 215 | AddHistSet("fHMCpt", Form("%s + #it{p}_{T} [%.1f,%.1f]", sMCTitle.Data(), ptRange[0], ptRange[1])); |
216 | AddHistSet("fHMCptTPC", Form("%s + #it{p}_{T} [%.1f,%.1f]", sMCTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired())); | |
217 | AddHistSet("fHMCptTOF", Form("%s + #it{p}_{T} [%.1f,%.1f]", sMCTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1])); | |
218 | ||
4918c45f | 219 | AddHistSet("fHMCptphi", Form("%s + #it{p}_{T} [%.1f,%.1f] + #varphi [%.1f,%.1f]", |
5de3d4d1 | 220 | sMCTitle.Data(), ptRange[0], ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax())); |
4918c45f | 221 | AddHistSet("fHMCptTPCphi", Form("%s + #it{p}_{T} [%.1f,%.1f] + #varphi [%.1f,%.1f]", |
5de3d4d1 | 222 | sMCTitle.Data(), ptRange[0], fHelper->GetMinPtForTOFRequired(), fHelper->GetPhiMin(), fHelper->GetPhiMax())); |
223 | AddHistSet("fHMCptTOFphi", Form("%s + #it{p}_{T} [%.1f,%.1f] + #varphi [%.1f,%.1f]", | |
224 | sMCTitle.Data(), fHelper->GetMinPtForTOFRequired(), ptRange[1], fHelper->GetPhiMin(), fHelper->GetPhiMax())); | |
4918c45f | 225 | } |
226 | ||
cb68eb1d | 227 | // ------------------------------------------------------------------ |
228 | ||
229 | return; | |
230 | } | |
231 | ||
232 | //________________________________________________________________________ | |
9be43c8e | 233 | Int_t AliAnalysisNetParticleDistribution::SetupEvent(AliESDInputHandler *esdHandler, AliAODInputHandler *aodHandler, AliMCEvent *mcEvent) { |
cb68eb1d | 234 | // -- Setup Event |
478c95cf | 235 | |
cb68eb1d | 236 | ResetEvent(); |
237 | ||
238 | // -- Get ESD objects | |
9be43c8e | 239 | if(esdHandler){ |
9be43c8e | 240 | fPIDResponse = esdHandler->GetPIDResponse(); |
5de3d4d1 | 241 | fESD = esdHandler->GetEvent(); |
242 | fNTracks = fESD->GetNumberOfTracks(); | |
9be43c8e | 243 | } |
244 | ||
245 | // -- Get AOD objects | |
246 | else if(aodHandler){ | |
9be43c8e | 247 | fPIDResponse = aodHandler->GetPIDResponse(); |
5de3d4d1 | 248 | fAOD = aodHandler->GetEvent(); |
249 | fNTracks = fAOD->GetNumberOfTracks(); | |
250 | ||
251 | if (fIsMC) { | |
252 | fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName())); | |
253 | if (!fArrayMC) | |
254 | AliFatal("No array of MC particles found !!!"); // MW no AliFatal use return values | |
255 | } | |
9be43c8e | 256 | } |
cb68eb1d | 257 | |
258 | // -- Get MC objects | |
5de3d4d1 | 259 | if (fIsMC && mcEvent) { |
260 | fMCEvent = mcEvent; | |
261 | if (fMCEvent) | |
262 | fStack = fMCEvent->Stack(); | |
263 | } | |
264 | ||
265 | // -- Get CentralityBin | |
266 | fCentralityBin = fHelper->GetCentralityBin(); | |
cb68eb1d | 267 | |
268 | return 0; | |
269 | } | |
270 | ||
271 | //________________________________________________________________________ | |
272 | void AliAnalysisNetParticleDistribution::ResetEvent() { | |
273 | // -- Reset event | |
274 | ||
275 | // -- Reset ESD Event | |
276 | fESD = NULL; | |
277 | ||
9be43c8e | 278 | // -- Reset AOD Event |
279 | fAOD = NULL; | |
280 | ||
cb68eb1d | 281 | // -- Reset MC Event |
282 | if (fIsMC) | |
283 | fMCEvent = NULL; | |
284 | ||
285 | // -- Reset N particles/anti-particles | |
4918c45f | 286 | for (Int_t ii = 0; ii < fNNp; ++ii) |
cb68eb1d | 287 | for (Int_t jj = 0; jj < 2; ++jj) |
4918c45f | 288 | fNp[ii][jj] = 0.; |
289 | ||
cb68eb1d | 290 | // -- Reset N MC particles/anti-particles |
291 | for (Int_t ii = 0; ii < fNMCNp; ++ii) | |
292 | for (Int_t jj = 0; jj < 2; ++jj) | |
293 | fMCNp[ii][jj] = 0.; | |
5de3d4d1 | 294 | |
295 | // -- Reset factorials for particles/anti-particles | |
296 | for (Int_t ii = 0; ii <= fOrder; ++ii) | |
297 | for (Int_t jj = 0; jj < 2; ++jj) | |
298 | fFactp[ii][jj] = 0.; | |
cb68eb1d | 299 | } |
300 | ||
301 | //________________________________________________________________________ | |
302 | Int_t AliAnalysisNetParticleDistribution::Process() { | |
303 | // -- Process NetParticle Distributions | |
9be43c8e | 304 | |
5de3d4d1 | 305 | // -- Fill ESD/AOD tracks |
306 | ProcessTracks(); | |
307 | ||
fbb73c19 | 308 | // -- Fill MC truth particles (missing for AOD MW - However AliVParticle already used) |
4918c45f | 309 | if (fIsMC) |
fbb73c19 | 310 | ProcessParticles(); |
cb68eb1d | 311 | |
312 | return 0; | |
313 | } | |
314 | ||
315 | //________________________________________________________________________ | |
5de3d4d1 | 316 | Int_t AliAnalysisNetParticleDistribution::ProcessTracks() { |
317 | // -- Process ESD/AOD tracks and fill QA histogram | |
cb68eb1d | 318 | |
5de3d4d1 | 319 | // -- Get ranges for AOD particles |
320 | Float_t etaRange[2]; | |
321 | fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]); | |
322 | ||
323 | Float_t ptRange[2]; | |
324 | fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]); | |
325 | ||
326 | // -- Track Loop | |
327 | for (Int_t idxTrack = 0; idxTrack < fNTracks; ++idxTrack) { | |
328 | ||
329 | AliVTrack *track = (fESD) ? static_cast<AliVTrack*>(fESD->GetTrack(idxTrack)) : static_cast<AliVTrack*>(fAOD->GetTrack(idxTrack)); | |
cb68eb1d | 330 | |
331 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
332 | // -- Check track cuts | |
333 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
5de3d4d1 | 334 | |
335 | // -- Check if track is accepted for basic parameters | |
cb68eb1d | 336 | if (!fHelper->IsTrackAcceptedBasicCharged(track)) |
337 | continue; | |
338 | ||
5de3d4d1 | 339 | // -- Check if accepted - ESD |
340 | if (fESD && !fESDTrackCuts->AcceptTrack(dynamic_cast<AliESDtrack*>(track))) | |
cb68eb1d | 341 | continue; |
5de3d4d1 | 342 | |
343 | // -- Check if accepted - AOD | |
344 | if (fAOD){ | |
345 | AliAODTrack * trackAOD = dynamic_cast<AliAODTrack*>(track); | |
346 | ||
347 | if (!trackAOD) { | |
348 | AliError("Pointer to dynamic_cast<AliAODTrack*>(track) = ZERO"); | |
349 | continue; | |
350 | } | |
351 | if (!trackAOD->TestFilterBit(fAODtrackCutBit)) | |
352 | continue; | |
353 | ||
354 | // -- Check if in pT and eta range (is done in ESDTrackCuts for ESDs) | |
355 | if(!(track->Pt() > ptRange[0] && track->Pt() <= ptRange[1] && TMath::Abs(track->Eta()) <= etaRange[1])) | |
356 | continue; | |
357 | } | |
358 | ||
4918c45f | 359 | // -- Check if accepted in rapidity window -- for identified particles |
360 | // for charged - eta check is done in the trackcuts | |
cb68eb1d | 361 | Double_t yP; |
4918c45f | 362 | if (fHelper->GetUsePID() && !fHelper->IsTrackAcceptedRapidity(track, yP)) |
cb68eb1d | 363 | continue; |
364 | ||
cb68eb1d | 365 | // -- Check if accepted with thighter DCA cuts |
5de3d4d1 | 366 | // -- returns kTRUE for AODs for now : MW |
478c95cf | 367 | if (!fHelper->IsTrackAcceptedDCA(track)) |
cb68eb1d | 368 | continue; |
478c95cf | 369 | |
5de3d4d1 | 370 | // -- Check if accepted by PID from TPC or TPC+TOF |
371 | Double_t pid[2]; | |
372 | if (!fHelper->IsTrackAcceptedPID(track, pid)) | |
373 | continue; | |
374 | ||
cb68eb1d | 375 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
376 | // -- Fill Probe Particle | |
377 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
378 | ||
4918c45f | 379 | if (!fHelper->GetUsePID()) |
380 | yP = track->Eta(); | |
381 | ||
cb68eb1d | 382 | Double_t aTrack[6] = { |
5de3d4d1 | 383 | Double_t(fCentralityBin), // 0 centrality |
4918c45f | 384 | track->Eta(), // 1 eta |
385 | yP, // 2 rapidity | |
386 | track->Phi(), // 3 phi | |
387 | track->Pt(), // 4 pt | |
2942f542 | 388 | static_cast<Double_t>(track->Charge()) // 5 sign |
cb68eb1d | 389 | }; |
390 | ||
391 | fHnTrackUnCorr->Fill(aTrack); | |
392 | ||
393 | // -- Count particle / anti-particle | |
394 | // ------------------------------------------------------------------ | |
395 | // idxPart = 0 -> anti particle | |
396 | // idxPart = 1 -> particle | |
397 | ||
4918c45f | 398 | Int_t idxPart = (track->Charge() < 0) ? 0 : 1; |
399 | ||
400 | // -- in pt Range | |
401 | fNp[0][idxPart] += 1.; | |
402 | ||
403 | // -- in TPC pt Range | |
404 | if (track->Pt() <= fHelper->GetMinPtForTOFRequired()) | |
405 | fNp[1][idxPart] += 1.; | |
9be43c8e | 406 | |
5de3d4d1 | 407 | // -- in TPC+TOF pt Range |
408 | if (track->Pt() > fHelper->GetMinPtForTOFRequired()) | |
409 | fNp[2][idxPart] += 1.; | |
4918c45f | 410 | |
5de3d4d1 | 411 | // -- check phi range ---------------------------------------------------------- |
4918c45f | 412 | if(!fHelper->IsTrackAcceptedPhi(track)) |
413 | continue; | |
414 | ||
415 | // -- in pt Range | |
5de3d4d1 | 416 | fNp[3][idxPart] += 1.; |
4918c45f | 417 | |
418 | // -- in TPC pt Range | |
419 | if (track->Pt() <= fHelper->GetMinPtForTOFRequired()) | |
5de3d4d1 | 420 | fNp[4][idxPart] += 1.; |
4918c45f | 421 | |
5de3d4d1 | 422 | // -- in TPC+TOF pt Range |
423 | if (track->Pt() > fHelper->GetMinPtForTOFRequired()) | |
424 | fNp[5][idxPart] += 1.; | |
425 | ||
cb68eb1d | 426 | } // for (Int_t idxTrack = 0; idxTrack < fESD->GetNumberOfTracks(); ++idxTrack) { |
427 | ||
428 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
429 | // -- Fill Particle Fluctuation Histograms | |
430 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
431 | ||
4918c45f | 432 | FillHistSet("fHDist", fNp[0]); |
433 | FillHistSet("fHDistTPC", fNp[1]); | |
5de3d4d1 | 434 | FillHistSet("fHDistTOF", fNp[2]); |
435 | FillHistSet("fHDistphi", fNp[3]); | |
436 | FillHistSet("fHDistTPCphi", fNp[4]); | |
437 | FillHistSet("fHDistTOFphi", fNp[5]); | |
cb68eb1d | 438 | |
cb68eb1d | 439 | return 0; |
440 | } | |
441 | ||
442 | //________________________________________________________________________ | |
fbb73c19 | 443 | Int_t AliAnalysisNetParticleDistribution::ProcessParticles() { |
cb68eb1d | 444 | // -- Process primary particles from the stack and fill histograms |
cb68eb1d | 445 | |
5de3d4d1 | 446 | Float_t etaRange[2]; |
447 | fESDTrackCuts->GetEtaRange(etaRange[0],etaRange[1]); | |
448 | ||
449 | Float_t ptRange[2]; | |
450 | fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]); | |
451 | ||
cb68eb1d | 452 | for (Int_t idxMC = 0; idxMC < fStack->GetNprimary(); ++idxMC) { |
fbb73c19 | 453 | AliVParticle* particle = (fESD) ? fMCEvent->GetTrack(idxMC) : NULL; |
454 | ||
cb68eb1d | 455 | if (!particle) |
456 | continue; | |
457 | ||
458 | // -- Check basic MC properties -> charged physical primary | |
459 | if (!fHelper->IsParticleAcceptedBasicCharged(particle, idxMC)) | |
460 | continue; | |
461 | ||
462 | // -- Check if particle / anti-particle | |
5de3d4d1 | 463 | if (fHelper->GetUsePID() && TMath::Abs(particle->PdgCode()) != fPdgCode) |
cb68eb1d | 464 | continue; |
465 | ||
4918c45f | 466 | // -- Check rapidity window -- for identfied particles |
cb68eb1d | 467 | Double_t yMC; |
4918c45f | 468 | if (fHelper->GetUsePID() && !fHelper->IsParticleAcceptedRapidity(particle, yMC)) |
cb68eb1d | 469 | continue; |
cb68eb1d | 470 | |
4918c45f | 471 | // -- Check eta window -- for charged particles |
5de3d4d1 | 472 | if (!fHelper->GetUsePID() && TMath::Abs(particle->Eta()) > etaRange[1]) |
cb68eb1d | 473 | continue; |
474 | ||
4918c45f | 475 | // -- Count particle / anti-particle |
476 | // ------------------------------------------------------------------ | |
477 | // idxPart = 0 -> anti particle | |
478 | // idxPart = 1 -> particle | |
cb68eb1d | 479 | |
fbb73c19 | 480 | Int_t idxPart = (particle->PdgCode() < 0) ? 0 : 1; |
cb68eb1d | 481 | |
4918c45f | 482 | // -- MCrapidity for identfied particles |
483 | // MCeta for charged particles | |
484 | fMCNp[0][idxPart] += 1.; | |
cb68eb1d | 485 | |
4918c45f | 486 | // -- in pt Range |
5de3d4d1 | 487 | if (particle->Pt() > ptRange[0] && particle->Pt() <= ptRange[1]) |
4918c45f | 488 | fMCNp[1][idxPart] += 1.; |
489 | ||
490 | // -- in TPC pt Range | |
5de3d4d1 | 491 | if (particle->Pt() > ptRange[0] && particle->Pt() <= fHelper->GetMinPtForTOFRequired()) |
492 | fMCNp[2][idxPart] += 1.; | |
493 | ||
494 | // -- in TPC+TOF pt Range | |
495 | if (particle->Pt() > fHelper->GetMinPtForTOFRequired() && particle->Pt() <= ptRange[1]) | |
496 | fMCNp[3][idxPart] += 1.; | |
4918c45f | 497 | |
5de3d4d1 | 498 | // -- check phi range ---------------------------------------------------------- |
4918c45f | 499 | if(!fHelper->IsParticleAcceptedPhi(particle)) |
500 | continue; | |
cb68eb1d | 501 | |
4918c45f | 502 | // -- in pt Range |
5de3d4d1 | 503 | if (particle->Pt() > ptRange[0] && particle->Pt() <= ptRange[1]) |
504 | fMCNp[4][idxPart] += 1.; | |
cb68eb1d | 505 | |
4918c45f | 506 | // -- in TPC pt Range |
5de3d4d1 | 507 | if (particle->Pt() > ptRange[0] && particle->Pt() <= fHelper->GetMinPtForTOFRequired()) |
508 | fMCNp[5][idxPart] += 1.; | |
509 | ||
510 | // -- in TPC+TOF pt Range | |
511 | if (particle->Pt() > fHelper->GetMinPtForTOFRequired() && particle->Pt() <= ptRange[1]) | |
512 | fMCNp[6][idxPart] += 1.; | |
4918c45f | 513 | |
514 | } // for (Int_t idxMC = 0; idxMC < nPart; ++idxMC) { | |
515 | ||
cb68eb1d | 516 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
517 | // -- Fill Particle Fluctuation Histograms | |
518 | // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
519 | ||
4918c45f | 520 | FillHistSet("fHMC", fMCNp[0]); |
521 | FillHistSet("fHMCpt", fMCNp[1]); | |
522 | FillHistSet("fHMCptTPC", fMCNp[2]); | |
5de3d4d1 | 523 | FillHistSet("fHMCptTOF", fMCNp[3]); |
524 | FillHistSet("fHMCptphi", fMCNp[4]); | |
525 | FillHistSet("fHMCptTPCphi", fMCNp[5]); | |
526 | FillHistSet("fHMCptTOFphi", fMCNp[6]); | |
cb68eb1d | 527 | |
528 | return 0; | |
529 | } | |
530 | ||
478c95cf | 531 | /* |
532 | * --------------------------------------------------------------------------------- | |
533 | * Helper Methods - private | |
534 | * --------------------------------------------------------------------------------- | |
535 | */ | |
cb68eb1d | 536 | |
537 | //________________________________________________________________________ | |
538 | void AliAnalysisNetParticleDistribution::AddHistSet(const Char_t *name, const Char_t *title) { | |
539 | // -- Add histogram sets for particle and anti-particle | |
cb68eb1d | 540 | |
cb68eb1d | 541 | fOutList->Add(new TList); |
542 | TList *list = static_cast<TList*>(fOutList->Last()); | |
4918c45f | 543 | list->SetName(name); |
cb68eb1d | 544 | list->SetOwner(kTRUE); |
545 | ||
546 | TString sName(name); | |
5de3d4d1 | 547 | TString sTitle(title); |
548 | ||
549 | Float_t ptRange[2]; | |
550 | fESDTrackCuts->GetPtRange(ptRange[0],ptRange[1]); | |
cb68eb1d | 551 | |
552 | TString sPtTitle(""); | |
4918c45f | 553 | if (!sName.Contains("fHMC")) |
5de3d4d1 | 554 | sPtTitle += Form("#it{p}_{T} [%.1f,%.1f]", ptRange[0], ptRange[1]); |
cb68eb1d | 555 | |
5de3d4d1 | 556 | TString sNetTitle(Form("N_{%s} - N_{%s}", fHelper->GetParticleTitleLatex(0).Data(), fHelper->GetParticleTitleLatex(1).Data())); |
557 | TString sSumTitle(Form("N_{%s} + N_{%s}", fHelper->GetParticleTitleLatex(0).Data(), fHelper->GetParticleTitleLatex(1).Data())); | |
558 | ||
4918c45f | 559 | // -- Add Particle / Anti-Particle Distributions |
cb68eb1d | 560 | for (Int_t idxPart = 0; idxPart < 2; ++idxPart) { |
3aa68b92 | 561 | list->Add(new TH2F(Form("%s%s", name, fHelper->GetParticleName(idxPart).Data()), |
5de3d4d1 | 562 | Form("N_{%s} : %s;Centrality;N_{%s}", fHelper->GetParticleTitleLatex(idxPart).Data(), sTitle.Data(), |
563 | fHelper->GetParticleTitleLatex(idxPart).Data()), 24, -0.5, 11.5, 2601, -0.5, 2600.49)); | |
cb68eb1d | 564 | } // for (Int_t idxPart = 0; idxPart < 2; ++idxPart) { |
565 | ||
4918c45f | 566 | // -- Add NetParticle Distributions |
3aa68b92 | 567 | list->Add(new TH2F(Form("%sNet%s", name, fHelper->GetParticleName(1).Data()), |
5de3d4d1 | 568 | Form("%s : %s;Centrality;%s", sNetTitle.Data(), sTitle.Data(), sNetTitle.Data()), |
569 | 24, -0.5, 11.5, 601, -300.5, 300.49)); | |
3aa68b92 | 570 | |
4918c45f | 571 | // -- Add NetParticle vs SumParticle |
3aa68b92 | 572 | list->Add(new TH2F(Form("%sNet%sOverSum", name, fHelper->GetParticleName(1).Data()), |
5de3d4d1 | 573 | Form("(%s)/(%s) : %s;Centrality;(%s)/(%s)", sNetTitle.Data(), sSumTitle.Data(), sTitle.Data(), |
574 | sNetTitle.Data(), sSumTitle.Data()), 24, -0.5, 11.5, 801, -20.5, 20.49)); | |
4918c45f | 575 | |
576 | // -- Add TProfiles for <NetParticle^k> | |
577 | for (Int_t idx = 1; idx <= fOrder; ++idx) { | |
578 | list->Add(new TProfile(Form("%sNet%s%dM", name, fHelper->GetParticleName(1).Data(), idx), | |
5de3d4d1 | 579 | Form("(%s)^{%d} : %s;Centrality;(%s)^{%d}", sNetTitle.Data(), idx, sTitle.Data(), sNetTitle.Data(), idx), |
580 | 24, -0.5, 11.5)); | |
4918c45f | 581 | } |
5de3d4d1 | 582 | |
4918c45f | 583 | // -- Add TProfiles for <f_ik> |
584 | list->Add(new TList); | |
585 | TList *fikList = static_cast<TList*>(list->Last()); | |
586 | fikList->SetName(Form("%sFik",name)); | |
587 | fikList->SetOwner(kTRUE); | |
588 | ||
589 | for (Int_t ii = 0; ii <= fOrder; ++ii) { | |
590 | for (Int_t kk = 0; kk <= fOrder; ++kk) { | |
5de3d4d1 | 591 | fikList->Add(new TProfile(Form("%sNet%sF%02d%02d", name, fHelper->GetParticleName(1).Data(), ii, kk), |
592 | Form("f_{%d%d} : %s;Centrality;f_{%d%d}", ii, kk, sTitle.Data(), ii, kk), 24, -0.5, 11.5)); | |
4918c45f | 593 | } |
cb68eb1d | 594 | } |
4918c45f | 595 | |
cb68eb1d | 596 | return; |
597 | } | |
598 | ||
599 | //________________________________________________________________________ | |
5de3d4d1 | 600 | void AliAnalysisNetParticleDistribution::FillHistSet(const Char_t *name, Double_t *np) { |
cb68eb1d | 601 | // -- Add histogram sets for particle and anti-particle |
602 | ||
603 | TList *list = static_cast<TList*>(fOutList->FindObject(name)); | |
604 | ||
605 | Float_t centralityBin = fHelper->GetCentralityBin(); | |
606 | ||
3aa68b92 | 607 | (static_cast<TH2F*>(list->FindObject(Form("%s%s", name, fHelper->GetParticleName(0).Data()))))->Fill(centralityBin, np[0]); |
608 | (static_cast<TH2F*>(list->FindObject(Form("%s%s", name, fHelper->GetParticleName(1).Data()))))->Fill(centralityBin, np[1]); | |
cb68eb1d | 609 | |
5de3d4d1 | 610 | Double_t sumNp = np[1]+np[0]; |
611 | Double_t deltaNp = np[1]-np[0]; | |
cb68eb1d | 612 | |
3aa68b92 | 613 | (static_cast<TH2F*>(list->FindObject(Form("%sNet%s", name, fHelper->GetParticleName(1).Data()))))->Fill(centralityBin, deltaNp); |
3aa68b92 | 614 | (static_cast<TH2F*>(list->FindObject(Form("%sNet%sOverSum", name, fHelper->GetParticleName(1).Data()))))->Fill(centralityBin, deltaNp/sumNp); |
cb68eb1d | 615 | |
4918c45f | 616 | // -- Fill TProfile for <NetParticle^k> |
5de3d4d1 | 617 | Double_t delta = 1.; |
4918c45f | 618 | for (Int_t idx = 1; idx <= fOrder; ++idx) { |
619 | delta *= deltaNp; | |
620 | (static_cast<TProfile*>(list->FindObject(Form("%sNet%s%dM", name, fHelper->GetParticleName(1).Data(), idx))))->Fill(centralityBin, delta); | |
cb68eb1d | 621 | } |
622 | ||
5de3d4d1 | 623 | // -- Calculate all factorials only once before filling |
624 | for (Int_t idx = 0; idx <= fOrder; ++ idx) { | |
625 | fFactp[idx][0] = TMath::Factorial(np[0] - idx); | |
626 | fFactp[idx][1] = TMath::Factorial(np[1] - idx); | |
627 | } | |
628 | ||
629 | // -- Fill TProfiles for <f_ik> | |
4918c45f | 630 | TList *fikList = static_cast<TList*>(list->FindObject(Form("%sFik",name))); |
5de3d4d1 | 631 | for (Int_t ii = 0; ii <= fOrder; ++ii) { |
632 | for (Int_t kk = 0; kk <= fOrder; ++kk) { | |
633 | Double_t fik = fFactp[0][1]*fFactp[0][0]/(fFactp[ii][1]*fFactp[kk][0]); | |
634 | (static_cast<TProfile*>(fikList->FindObject(Form("%sNet%sF%02d%02d", name, fHelper->GetParticleName(1).Data(), ii, kk))))->Fill(centralityBin, fik); | |
635 | } | |
636 | } | |
4918c45f | 637 | |
cb68eb1d | 638 | return; |
639 | } | |
640 |