]>
Commit | Line | Data |
---|---|---|
e0331fd9 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
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 | /* $Id:$ */ | |
17 | ||
18 | #include <TROOT.h> | |
19 | #include <TChain.h> | |
20 | #include <TFile.h> | |
21 | #include <TList.h> | |
22 | #include <TMath.h> | |
23 | #include <TTree.h> | |
24 | #include <TH2F.h> | |
25 | #include <TRandom.h> | |
26 | ||
27 | #include "AliAnalysisTaskPhiCorrelations.h" | |
28 | #include "AliAnalyseLeadingTrackUE.h" | |
29 | #include "AliUEHistograms.h" | |
30 | #include "AliUEHist.h" | |
31 | ||
e0331fd9 | 32 | #include "AliAnalysisManager.h" |
33 | #include "AliAODHandler.h" | |
34 | #include "AliAODInputHandler.h" | |
35 | #include "AliAODMCParticle.h" | |
e0331fd9 | 36 | #include "AliInputEventHandler.h" |
37 | #include "AliLog.h" | |
38 | #include "AliMCEventHandler.h" | |
39 | #include "AliVParticle.h" | |
2a910c25 | 40 | #include "AliCFContainer.h" |
e0331fd9 | 41 | |
42 | #include "AliESDEvent.h" | |
43 | #include "AliESDInputHandler.h" | |
44 | #include "AliMultiplicity.h" | |
2a910c25 | 45 | #include "AliCentrality.h" |
46 | #include "AliStack.h" | |
7dd4dec4 | 47 | #include "AliAODMCHeader.h" |
e0331fd9 | 48 | |
2a910c25 | 49 | #include "AliEventPoolManager.h" |
e0331fd9 | 50 | |
51 | ||
52 | //////////////////////////////////////////////////////////////////////// | |
53 | // | |
54 | // Analysis class for azimuthal correlation studies | |
55 | // Based on the UE task from Sara Vallero and Jan Fiete | |
56 | // | |
57 | // This class needs input AODs. | |
58 | // The output is a list of analysis-specific containers. | |
59 | // | |
60 | // The AOD can be either connected to the InputEventHandler | |
61 | // for a chain of AOD files | |
62 | // or | |
63 | // to the OutputEventHandler | |
64 | // for a chain of ESD files, | |
65 | // in this case the class should be in the train after the jet-finder | |
66 | // | |
67 | // Authors: | |
68 | // Jan Fiete Grosse-Oetringhaus | |
69 | // | |
70 | //////////////////////////////////////////////////////////////////////// | |
71 | ||
72 | ||
73 | ClassImp( AliAnalysisTaskPhiCorrelations ) | |
a1c31636 | 74 | ClassImp( AliDPhiBasicParticle ) |
e0331fd9 | 75 | |
76 | //____________________________________________________________________ | |
77 | AliAnalysisTaskPhiCorrelations:: AliAnalysisTaskPhiCorrelations(const char* name): | |
78 | AliAnalysisTask(name,""), | |
79 | // general configuration | |
80 | fDebug(0), | |
81 | fMode(0), | |
82 | fReduceMemoryFootprint(kFALSE), | |
eed401dc | 83 | fFillMixed(kTRUE), |
ac647b0f | 84 | fMixingTracks(50000), |
c3294f09 | 85 | fCompareCentralities(kFALSE), |
1bba939a | 86 | fTwoTrackEfficiencyStudy(kFALSE), |
04af8d15 | 87 | fTwoTrackEfficiencyCut(kFALSE), |
44af28f9 | 88 | fUseVtxAxis(kFALSE), |
04af8d15 | 89 | fSkipTrigger(kFALSE), |
e0331fd9 | 90 | // pointers to UE classes |
91 | fAnalyseUE(0x0), | |
92 | fHistos(0x0), | |
93 | fHistosMixed(0), | |
94 | fkTrackingEfficiency(0x0), | |
95 | // handlers and events | |
85bfac17 | 96 | fAOD(0x0), |
97 | fESD(0x0), | |
e0331fd9 | 98 | fArrayMC(0x0), |
99 | fInputHandler(0x0), | |
100 | fMcEvent(0x0), | |
101 | fMcHandler(0x0), | |
2a910c25 | 102 | fPoolMgr(0x0), |
e0331fd9 | 103 | // histogram settings |
104 | fListOfHistos(0x0), | |
105 | // event QA | |
106 | fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default) | |
85bfac17 | 107 | fZVertex(7.), |
2a910c25 | 108 | fCentralityMethod("V0M"), |
e0331fd9 | 109 | // track cuts |
110 | fTrackEtaCut(0.8), | |
111 | fPtMin(0.5), | |
112 | fFilterBit(0xFF), | |
113 | fSelectBit(0), | |
2a910c25 | 114 | fUseChargeHadrons(kFALSE), |
c05ff6be | 115 | fSelectCharge(0), |
d38fa455 | 116 | fTriggerRestrictEta(-1), |
00b6f3c6 | 117 | fEtaOrdering(kFALSE), |
b0d56b29 | 118 | fCutConversions(kFALSE), |
119 | fCutResonances(kFALSE), | |
c05ff6be | 120 | fFillpT(kFALSE) |
e0331fd9 | 121 | { |
122 | // Default constructor | |
123 | // Define input and output slots here | |
124 | // Input slot #0 works with a TChain | |
125 | DefineInput(0, TChain::Class()); | |
126 | // Output slot #0 writes into a TList container | |
127 | DefineOutput(0, TList::Class()); | |
e0331fd9 | 128 | } |
129 | ||
130 | AliAnalysisTaskPhiCorrelations::~AliAnalysisTaskPhiCorrelations() | |
131 | { | |
132 | // destructor | |
133 | ||
134 | if (fListOfHistos && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) | |
135 | delete fListOfHistos; | |
136 | } | |
137 | ||
138 | //____________________________________________________________________ | |
139 | void AliAnalysisTaskPhiCorrelations::ConnectInputData(Option_t* /*option*/) | |
140 | { | |
141 | ||
142 | // Connect the input data | |
143 | if (fDebug > 1) AliInfo("ConnectInputData() "); | |
144 | ||
145 | // Since AODs can either be connected to the InputEventHandler | |
146 | // or to the OutputEventHandler ( the AOD is created by a previus task in the train ) | |
147 | // we need to get the pointer to the AODEvent correctly. | |
148 | ||
149 | // Delta AODs are also accepted. | |
150 | ||
151 | TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); | |
152 | ||
85bfac17 | 153 | if( handler && handler->InheritsFrom("AliAODInputHandler") ) |
154 | { // input AOD | |
155 | fAOD = ((AliAODInputHandler*)handler)->GetEvent(); | |
156 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODInputHandler"); | |
157 | } | |
158 | else | |
159 | { //output AOD | |
160 | handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler(); | |
161 | if (handler && handler->InheritsFrom("AliAODHandler") ) | |
162 | { | |
163 | fAOD = ((AliAODHandler*)handler)->GetAOD(); | |
164 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODHandler"); | |
165 | } | |
166 | else | |
167 | { // no AOD | |
168 | AliWarning("I can't get any AOD Event Handler"); | |
169 | } | |
170 | } | |
171 | ||
172 | if (handler && handler->InheritsFrom("AliESDInputHandler") ) | |
173 | { // input ESD | |
174 | // pointer received per event in ::Exec | |
175 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliESDInputHandler"); | |
176 | } | |
e0331fd9 | 177 | |
178 | // Initialize common pointers | |
179 | Initialize(); | |
e0331fd9 | 180 | } |
181 | ||
182 | //____________________________________________________________________ | |
183 | void AliAnalysisTaskPhiCorrelations::CreateOutputObjects() | |
184 | { | |
185 | // Create the output container | |
186 | ||
187 | if (fDebug > 1) AliInfo("CreateOutputObjects()"); | |
188 | ||
189 | // Initialize class with main algorithms, event and track selection. | |
190 | fAnalyseUE = new AliAnalyseLeadingTrackUE(); | |
2a910c25 | 191 | fAnalyseUE->SetParticleSelectionCriteria(fFilterBit, fUseChargeHadrons, fTrackEtaCut, fPtMin); |
e0331fd9 | 192 | fAnalyseUE->SetDebug(fDebug); |
85bfac17 | 193 | fAnalyseUE->DefineESDCuts(fFilterBit); |
e0331fd9 | 194 | |
195 | // Initialize output list of containers | |
196 | if (fListOfHistos != NULL){ | |
197 | delete fListOfHistos; | |
198 | fListOfHistos = NULL; | |
199 | } | |
200 | if (!fListOfHistos){ | |
201 | fListOfHistos = new TList(); | |
202 | fListOfHistos->SetOwner(kTRUE); | |
203 | } | |
204 | ||
205 | // Initialize class to handle histograms | |
44af28f9 | 206 | const char* histType = "4"; |
207 | if (fUseVtxAxis) | |
208 | histType = "5"; | |
209 | fHistos = new AliUEHistograms("AliUEHistogramsSame", histType); | |
210 | fHistosMixed = new AliUEHistograms("AliUEHistogramsMixed", histType); | |
e0331fd9 | 211 | |
2a910c25 | 212 | fHistos->SetSelectCharge(fSelectCharge); |
213 | fHistosMixed->SetSelectCharge(fSelectCharge); | |
214 | ||
d38fa455 | 215 | fHistos->SetTriggerRestrictEta(fTriggerRestrictEta); |
216 | fHistosMixed->SetTriggerRestrictEta(fTriggerRestrictEta); | |
217 | ||
00b6f3c6 | 218 | fHistos->SetEtaOrdering(fEtaOrdering); |
219 | fHistosMixed->SetEtaOrdering(fEtaOrdering); | |
220 | ||
b0d56b29 | 221 | fHistos->SetPairCuts(fCutConversions, fCutResonances); |
222 | fHistosMixed->SetPairCuts(fCutConversions, fCutResonances); | |
223 | ||
e0331fd9 | 224 | // add histograms to list |
225 | fListOfHistos->Add(fHistos); | |
226 | fListOfHistos->Add(fHistosMixed); | |
227 | ||
2a910c25 | 228 | fListOfHistos->Add(new TH2F("trackletsVsV0Cent", ";L1 clusters;v0 centrality", 100, -0.5, 9999.5, 101, 0, 101)); |
229 | fListOfHistos->Add(new TH2F("processIDs", ";#Delta#phi;process id", 100, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), kPNoProcess + 1, -0.5, kPNoProcess + 0.5)); | |
c066889a | 230 | fListOfHistos->Add(new TH1F("eventStat", ";;events", 4, -0.5, 3.5)); |
5614e02f | 231 | fListOfHistos->Add(new TH2F("mixedDist", ";centrality;tracks;events", 101, 0, 101, 200, 0, fMixingTracks * 1.5)); |
b0d56b29 | 232 | fListOfHistos->Add(new TH1F("pids", ";pdg;tracks", 2001, -1000.5, 1000.5)); |
e0331fd9 | 233 | |
1a32ecc0 | 234 | PostData(0,fListOfHistos); |
235 | ||
e0331fd9 | 236 | // Add task configuration to output list |
237 | AddSettingsTree(); | |
238 | ||
2a910c25 | 239 | // event mixing |
ac647b0f | 240 | Int_t trackDepth = fMixingTracks; |
a1c31636 | 241 | Int_t poolsize = 1000; // Maximum number of events, ignored in the present implemented of AliEventPool |
c066889a | 242 | |
2a910c25 | 243 | Int_t nCentralityBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(1); |
244 | Double_t* centralityBins = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray(); | |
245 | ||
7a028750 | 246 | Int_t nZvtxBins = 7+1+7; |
247 | // bins for second buffer are shifted by 100 cm | |
248 | Double_t vertexBins[] = { -7, -5, -3, -1, 1, 3, 5, 7, 93, 95, 97, 99, 101, 103, 105, 107 }; | |
eb88bdfe | 249 | Double_t* zvtxbin = vertexBins; |
c066889a | 250 | |
eb88bdfe | 251 | if (fHistos->GetUEHist(2)->GetEventHist()->GetNVar() > 2) |
252 | { | |
253 | nZvtxBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(2); | |
254 | zvtxbin = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(2, 0)->GetXbins()->GetArray(); | |
255 | } | |
85bfac17 | 256 | |
2a910c25 | 257 | fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, centralityBins, nZvtxBins, zvtxbin); |
e0331fd9 | 258 | } |
259 | ||
260 | //____________________________________________________________________ | |
261 | void AliAnalysisTaskPhiCorrelations::Exec(Option_t */*option*/) | |
262 | { | |
85bfac17 | 263 | // receive ESD pointer if we are not running AOD analysis |
264 | if (!fAOD) | |
265 | { | |
266 | AliVEventHandler* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); | |
267 | if (handler && handler->InheritsFrom("AliESDInputHandler")) | |
268 | fESD = ((AliESDInputHandler*)handler)->GetEvent(); | |
269 | } | |
270 | ||
7dd4dec4 | 271 | if (fMode) |
272 | { | |
273 | // correction mode | |
274 | ||
275 | if (fMcHandler) | |
276 | fMcEvent = fMcHandler->MCEvent(); | |
277 | ||
278 | if (fAOD) | |
279 | { | |
280 | // array of MC particles | |
281 | fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName())); | |
282 | if (!fArrayMC) | |
283 | AliFatal("No array of MC particles found !!!"); | |
284 | } | |
285 | ||
286 | AnalyseCorrectionMode(); | |
287 | } | |
e0331fd9 | 288 | else AnalyseDataMode(); |
e0331fd9 | 289 | } |
290 | ||
291 | /******************** ANALYSIS METHODS *****************************/ | |
292 | ||
293 | //____________________________________________________________________ | |
294 | void AliAnalysisTaskPhiCorrelations::AddSettingsTree() | |
295 | { | |
296 | //Write settings to output list | |
297 | TTree *settingsTree = new TTree("UEAnalysisSettings","Analysis Settings in UE estimation"); | |
c05ff6be | 298 | settingsTree->Branch("fnTracksVertex", &fnTracksVertex,"nTracksVertex/I"); |
299 | settingsTree->Branch("fZVertex", &fZVertex,"ZVertex/D"); | |
300 | //settingsTree->Branch("fCentralityMethod", fCentralityMethod.Data(),"CentralityMethod/C"); | |
e0331fd9 | 301 | settingsTree->Branch("fTrackEtaCut", &fTrackEtaCut, "TrackEtaCut/D"); |
302 | settingsTree->Branch("fPtMin", &fPtMin, "PtMin/D"); | |
c05ff6be | 303 | settingsTree->Branch("fFilterBit", &fFilterBit,"FilterBit/I"); |
304 | settingsTree->Branch("fSelectBit", &fSelectBit,"EventSelectionBit/I"); | |
e0331fd9 | 305 | settingsTree->Branch("fUseChargeHadrons", &fUseChargeHadrons,"UseChHadrons/O"); |
c05ff6be | 306 | settingsTree->Branch("fSelectCharge", &fSelectCharge,"SelectCharge/I"); |
b0d56b29 | 307 | settingsTree->Branch("fTriggerRestrictEta", &fTriggerRestrictEta,"TriggerRestrictEta/D"); |
00b6f3c6 | 308 | settingsTree->Branch("fEtaOrdering", &fEtaOrdering,"EtaOrdering/O"); |
b0d56b29 | 309 | settingsTree->Branch("fCutConversions", &fCutConversions,"CutConversions/O"); |
310 | settingsTree->Branch("fCutResonances", &fCutResonances,"CutResonances/O"); | |
c05ff6be | 311 | settingsTree->Branch("fFillpT", &fFillpT,"FillpT/O"); |
e0331fd9 | 312 | settingsTree->Branch("fkTrackingEfficiency", "TH1D", &fkTrackingEfficiency); |
ac647b0f | 313 | settingsTree->Branch("fMixingTracks", &fMixingTracks,"MixingTracks/I"); |
04af8d15 | 314 | settingsTree->Branch("fSkipTrigger", &fSkipTrigger,"SkipTrigger/O"); |
315 | ||
e0331fd9 | 316 | settingsTree->Fill(); |
317 | fListOfHistos->Add(settingsTree); | |
318 | } | |
319 | ||
320 | //____________________________________________________________________ | |
321 | void AliAnalysisTaskPhiCorrelations::AnalyseCorrectionMode() | |
322 | { | |
323 | // Run the analysis on MC to get the correction maps | |
324 | // | |
325 | ||
2a910c25 | 326 | if ( fDebug > 3 ) AliInfo( " Processing event in Corrections mode ..." ); |
327 | ||
328 | Double_t centrality = 0; | |
329 | ||
330 | if (fCentralityMethod.Length() > 0) | |
331 | { | |
85bfac17 | 332 | AliCentrality *centralityObj = 0; |
333 | if (fAOD) | |
334 | centralityObj = fAOD->GetHeader()->GetCentralityP(); | |
335 | else if (fESD) | |
336 | centralityObj = fESD->GetCentrality(); | |
337 | ||
2a910c25 | 338 | if (centralityObj) |
339 | { | |
340 | centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod); | |
a8583211 | 341 | AliInfo(Form("Centrality is %f", centrality)); |
2a910c25 | 342 | } |
343 | else | |
344 | { | |
345 | Printf("WARNING: Centrality object is 0"); | |
346 | centrality = -1; | |
347 | } | |
348 | } | |
349 | ||
85bfac17 | 350 | // Support for ESD and AOD based analysis |
351 | AliVEvent* inputEvent = fAOD; | |
352 | if (!inputEvent) | |
353 | inputEvent = fESD; | |
354 | ||
355 | TObject* mc = fArrayMC; | |
356 | if (!mc) | |
357 | mc = fMcEvent; | |
358 | ||
2a910c25 | 359 | // count all events |
360 | fHistos->FillEvent(centrality, -1); | |
361 | ||
362 | // Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex | |
7dd4dec4 | 363 | TObject* vertexSupplier = fMcEvent; |
364 | if (fAOD) // AOD | |
365 | vertexSupplier = fAOD->FindListObject(AliAODMCHeader::StdBranchName()); | |
366 | ||
367 | if (!fAnalyseUE->VertexSelection(vertexSupplier, 0, fZVertex)) | |
2a910c25 | 368 | return; |
85bfac17 | 369 | |
7dd4dec4 | 370 | Float_t zVtx = 0; |
371 | if (fAOD) | |
372 | zVtx = ((AliAODMCHeader*) vertexSupplier)->GetVtxZ(); | |
373 | else | |
374 | zVtx = fMcEvent->GetPrimaryVertex()->GetZ(); | |
c05ff6be | 375 | Float_t weight = 1; |
376 | if (fFillpT) | |
377 | weight = -1; | |
2a910c25 | 378 | |
379 | // Get MC primaries | |
85bfac17 | 380 | TObjArray* tracksMC = fAnalyseUE->GetAcceptedParticles(mc, 0, kTRUE, -1, kTRUE); |
2a910c25 | 381 | |
b0d56b29 | 382 | if (fAOD) |
383 | { | |
384 | for (Int_t i=0; i<fArrayMC->GetEntriesFast(); i++) | |
385 | ((TH1F*) fListOfHistos->FindObject("pids"))->Fill(((AliAODMCParticle*) fArrayMC->At(i))->PdgCode()); | |
386 | } | |
387 | else | |
388 | { | |
389 | for (Int_t i=0; i<fMcEvent->GetNumberOfTracks(); i++) | |
390 | ((TH1F*) fListOfHistos->FindObject("pids"))->Fill(fMcEvent->GetTrack(i)->PdgCode()); | |
391 | } | |
392 | ||
2a910c25 | 393 | // (MC-true all particles) |
394 | // STEP 0 | |
c05ff6be | 395 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepAll, tracksMC, 0, weight); |
2a910c25 | 396 | |
7a028750 | 397 | // mixed event |
8781a433 | 398 | if (fFillMixed) |
399 | { | |
400 | AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx); | |
401 | //pool->PrintInfo(); | |
402 | if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5) | |
403 | for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) | |
404 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepAll, tracksMC, pool->GetEvent(jMix), 1.0 / pool->GetCurrentNEvents(), (jMix == 0)); | |
405 | pool->UpdatePool(CloneAndReduceTrackList(tracksMC)); | |
406 | } | |
7a028750 | 407 | |
04af8d15 | 408 | // Printf("trigger: %d", ((AliInputEventHandler*)fInputHandler)->IsEventSelected()); |
409 | ||
2a910c25 | 410 | // Trigger selection ************************************************ |
04af8d15 | 411 | if (fSkipTrigger || fAnalyseUE->TriggerSelection(fInputHandler)) |
2a910c25 | 412 | { |
c32a0ca9 | 413 | // (MC-true all particles) |
414 | // STEP 1 | |
415 | if (!fReduceMemoryFootprint) | |
c05ff6be | 416 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTriggered, tracksMC, 0, weight); |
c32a0ca9 | 417 | else |
418 | fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered); | |
419 | ||
872dc651 | 420 | if (!inputEvent) { |
c32a0ca9 | 421 | AliFatal("UNEXPECTED: inputEvent is 0. Trigger selection should have failed"); |
872dc651 | 422 | return; |
423 | } | |
2a910c25 | 424 | |
425 | // Vertex selection ************************************************* | |
85bfac17 | 426 | if (fAnalyseUE->VertexSelection(inputEvent, fnTracksVertex, fZVertex)) |
2a910c25 | 427 | { |
428 | // fill here for tracking efficiency | |
429 | // loop over particle species | |
430 | ||
431 | for (Int_t particleSpecies = 0; particleSpecies < 4; particleSpecies++) | |
432 | { | |
85bfac17 | 433 | TObjArray* primMCParticles = fAnalyseUE->GetAcceptedParticles(mc, 0x0, kTRUE, particleSpecies, kTRUE); |
434 | TObjArray* primRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, particleSpecies, kTRUE); | |
435 | TObjArray* allRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, particleSpecies, kTRUE); | |
2a910c25 | 436 | |
437 | fHistos->FillTrackingEfficiency(primMCParticles, primRecoTracksMatched, allRecoTracksMatched, particleSpecies, centrality); | |
438 | ||
eed401dc | 439 | // Printf("%d --> %d %d %d", particleSpecies, primMCParticles->GetEntries(), primRecoTracksMatched->GetEntries(), allRecoTracksMatched->GetEntries()); |
440 | ||
441 | delete primMCParticles; | |
2a910c25 | 442 | delete primRecoTracksMatched; |
443 | delete allRecoTracksMatched; | |
444 | } | |
445 | ||
446 | // (MC-true all particles) | |
447 | // STEP 2 | |
85bfac17 | 448 | if (!fReduceMemoryFootprint) |
c05ff6be | 449 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepVertex, tracksMC, 0, weight); |
c32a0ca9 | 450 | else |
451 | fHistos->FillEvent(centrality, AliUEHist::kCFStepVertex); | |
2a910c25 | 452 | |
453 | // Get MC primaries that match reconstructed track | |
85bfac17 | 454 | TObjArray* tracksRecoMatchedPrim = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, -1, kTRUE); |
2a910c25 | 455 | |
456 | // (RECO-matched (quantities from MC particle) primary particles) | |
457 | // STEP 4 | |
c05ff6be | 458 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTrackedOnlyPrim, tracksRecoMatchedPrim, 0, weight); |
2a910c25 | 459 | |
460 | // Get MC primaries + secondaries that match reconstructed track | |
85bfac17 | 461 | TObjArray* tracksRecoMatchedAll = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, -1, kTRUE); |
2a910c25 | 462 | |
463 | // (RECO-matched (quantities from MC particle) all particles) | |
464 | // STEP 5 | |
c05ff6be | 465 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTracked, tracksRecoMatchedAll, 0, weight); |
2a910c25 | 466 | |
467 | // Get RECO tracks | |
85bfac17 | 468 | TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, -1, kTRUE); |
2a910c25 | 469 | |
470 | // (RECO all tracks) | |
471 | // STEP 6 | |
c05ff6be | 472 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks, 0, weight); |
2a910c25 | 473 | |
7a028750 | 474 | // mixed event |
8781a433 | 475 | if (fFillMixed) |
476 | { | |
477 | AliEventPool* pool2 = fPoolMgr->GetEventPool(centrality, zVtx + 100); | |
478 | //pool2->PrintInfo(); | |
479 | if (pool2->IsReady() || pool2->NTracksInPool() > fMixingTracks / 10 || pool2->GetCurrentNEvents() >= 5) | |
480 | for (Int_t jMix=0; jMix<pool2->GetCurrentNEvents(); jMix++) | |
481 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks, pool2->GetEvent(jMix), 1.0 / pool2->GetCurrentNEvents(), (jMix == 0)); | |
482 | pool2->UpdatePool(CloneAndReduceTrackList(tracks)); | |
483 | } | |
7a028750 | 484 | |
85bfac17 | 485 | if (0 && !fReduceMemoryFootprint) |
2a910c25 | 486 | { |
487 | // make list of secondaries (matched with MC) | |
488 | TObjArray* tracksRecoMatchedSecondaries = new TObjArray; | |
b0d56b29 | 489 | for (Int_t i=0; i<tracksRecoMatchedAll->GetEntriesFast(); i++) |
2a910c25 | 490 | if (((AliAODMCParticle*)tracksRecoMatchedAll->At(i))->IsPhysicalPrimary() == kFALSE) |
491 | tracksRecoMatchedSecondaries->Add(tracksRecoMatchedAll->At(i)); | |
492 | ||
493 | // Study: Use only secondaries as trigger particles and plot the correlation vs. all particles; store in step 9 | |
c05ff6be | 494 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy2, tracksRecoMatchedSecondaries, tracksRecoMatchedAll, weight); |
2a910c25 | 495 | |
496 | // Study: Use only primaries as trigger particles and plot the correlation vs. secondaries; store in step 8 | |
c05ff6be | 497 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksRecoMatchedPrim, tracksRecoMatchedSecondaries, weight); |
2a910c25 | 498 | |
499 | // plot delta phi vs process id of secondaries | |
500 | // trigger particles: primaries in 4 < pT < 10 | |
501 | // associated particles: secondaries in 1 < pT < 10 | |
502 | ||
b0d56b29 | 503 | for (Int_t i=0; i<tracksRecoMatchedPrim->GetEntriesFast(); i++) |
2a910c25 | 504 | { |
505 | AliVParticle* triggerParticle = (AliVParticle*) tracksRecoMatchedPrim->At(i); | |
506 | ||
507 | if (triggerParticle->Pt() < 4 || triggerParticle->Pt() > 10) | |
508 | continue; | |
509 | ||
b0d56b29 | 510 | for (Int_t j=0; j<tracksRecoMatchedSecondaries->GetEntriesFast(); j++) |
2a910c25 | 511 | { |
512 | AliAODMCParticle* particle = (AliAODMCParticle*) tracksRecoMatchedSecondaries->At(j); | |
513 | ||
514 | if (particle->Pt() < 1 || particle->Pt() > 10) | |
515 | continue; | |
516 | ||
517 | if (particle->Pt() > triggerParticle->Pt()) | |
518 | continue; | |
519 | ||
520 | Double_t deltaPhi = triggerParticle->Phi() - particle->Phi(); | |
521 | if (deltaPhi > 1.5 * TMath::Pi()) | |
522 | deltaPhi -= TMath::TwoPi(); | |
523 | if (deltaPhi < -0.5 * TMath::Pi()) | |
524 | deltaPhi += TMath::TwoPi(); | |
525 | ||
526 | Int_t processID = fMcEvent->Stack()->Particle(particle->GetLabel())->GetUniqueID(); | |
527 | ||
528 | ((TH2F*) fListOfHistos->FindObject("processIDs"))->Fill(deltaPhi, processID); | |
529 | } | |
530 | } | |
531 | ||
532 | delete tracksRecoMatchedSecondaries; | |
533 | } | |
534 | ||
535 | delete tracksRecoMatchedPrim; | |
536 | delete tracksRecoMatchedAll; | |
537 | delete tracks; | |
538 | } | |
539 | } | |
540 | ||
541 | delete tracksMC; | |
e0331fd9 | 542 | } |
543 | ||
544 | //____________________________________________________________________ | |
545 | void AliAnalysisTaskPhiCorrelations::AnalyseDataMode() | |
546 | { | |
547 | ||
548 | // Run the analysis on DATA or MC to get raw distributions | |
549 | ||
e0331fd9 | 550 | if ( fDebug > 3 ) AliInfo( " Processing event in Data mode ..." ); |
e0331fd9 | 551 | |
c066889a | 552 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(0); |
553 | ||
2a910c25 | 554 | // skip not selected events here (the AOD is not updated for those) |
555 | if (!fInputHandler) | |
556 | return; | |
557 | ||
85bfac17 | 558 | if (!(fInputHandler->IsEventSelected() & (AliVEvent::kMB | AliVEvent::kUserDefined))) |
2a910c25 | 559 | return; |
e0331fd9 | 560 | |
2a910c25 | 561 | Double_t centrality = 0; |
562 | ||
c3294f09 | 563 | AliCentrality *centralityObj = 0; |
2a910c25 | 564 | if (fCentralityMethod.Length() > 0) |
565 | { | |
85bfac17 | 566 | if (fAOD) |
567 | centralityObj = fAOD->GetHeader()->GetCentralityP(); | |
568 | else if (fESD) | |
569 | centralityObj = fESD->GetCentrality(); | |
570 | ||
2a910c25 | 571 | if (centralityObj) |
572 | centrality = centralityObj->GetCentralityPercentile(fCentralityMethod); | |
573 | //centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod); | |
574 | else | |
575 | centrality = -1; | |
a6d82f4e | 576 | |
577 | if (fAOD) | |
578 | { | |
579 | // remove outliers | |
580 | if (centrality == 0) | |
581 | { | |
582 | if (fAOD->GetVZEROData()) | |
583 | { | |
584 | Float_t multV0 = 0; | |
585 | for (Int_t i=0; i<64; i++) | |
586 | multV0 += fAOD->GetVZEROData()->GetMultiplicity(i); | |
587 | if (multV0 < 19500) | |
588 | { | |
589 | centrality = -1; | |
590 | AliInfo("Rejecting event due to too small V0 multiplicity"); | |
591 | } | |
592 | } | |
593 | } | |
594 | } | |
595 | ||
a8583211 | 596 | AliInfo(Form("Centrality is %f", centrality)); |
2a910c25 | 597 | } |
598 | ||
85bfac17 | 599 | // Support for ESD and AOD based analysis |
600 | AliVEvent* inputEvent = fAOD; | |
601 | if (!inputEvent) | |
602 | inputEvent = fESD; | |
603 | ||
04af8d15 | 604 | Float_t bSign = (inputEvent->GetMagneticField() > 0) ? 1 : -1; |
605 | ||
85bfac17 | 606 | fHistos->SetRunNumber(inputEvent->GetRunNumber()); |
607 | ||
2a910c25 | 608 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut |
609 | fHistos->FillEvent(centrality, AliUEHist::kCFStepAll); | |
610 | ||
e0331fd9 | 611 | // Trigger selection ************************************************ |
612 | if (!fAnalyseUE->TriggerSelection(fInputHandler)) return; | |
613 | ||
614 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
2a910c25 | 615 | fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered); |
e0331fd9 | 616 | |
617 | // Vertex selection ************************************************* | |
85bfac17 | 618 | if(!fAnalyseUE->VertexSelection(inputEvent, fnTracksVertex, fZVertex)) return; |
e0331fd9 | 619 | |
620 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
2a910c25 | 621 | fHistos->FillEvent(centrality, AliUEHist::kCFStepVertex); |
e0331fd9 | 622 | |
c3294f09 | 623 | // optimization |
624 | if (centrality < 0 && !fCompareCentralities) | |
2a910c25 | 625 | return; |
e0331fd9 | 626 | |
85bfac17 | 627 | TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, -1, kTRUE); |
04af8d15 | 628 | // create a list of reduced objects. This speeds up processing and reduces memory consumption for the event pool |
629 | TObjArray* tracksClone = CloneAndReduceTrackList(tracks); | |
630 | delete tracks; | |
631 | ||
2a910c25 | 632 | //Printf("Accepted %d tracks", tracks->GetEntries()); |
e0331fd9 | 633 | |
85bfac17 | 634 | const AliVVertex* vertex = inputEvent->GetPrimaryVertex(); |
2a910c25 | 635 | Double_t zVtx = vertex->GetZ(); |
636 | ||
c05ff6be | 637 | Float_t weight = 1; |
638 | if (fFillpT) | |
639 | weight = -1; | |
640 | ||
c3294f09 | 641 | // fill two different centralities (syst study) |
642 | // the zvtx axis is used to distinguish the results of both centralities: configured centrality in zvtx = 0, SPD in zvtx = 2 | |
643 | if (fCompareCentralities) | |
644 | zVtx = 0; | |
2a910c25 | 645 | |
c3294f09 | 646 | // Fill containers at STEP 6 (reconstructed) |
647 | if (centrality >= 0) | |
c066889a | 648 | { |
04af8d15 | 649 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracksClone, 0, weight); |
c066889a | 650 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(1); |
04af8d15 | 651 | |
652 | if (fTwoTrackEfficiencyCut) | |
653 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksClone, 0, weight, kTRUE, bSign); | |
c066889a | 654 | } |
c3294f09 | 655 | |
1bba939a | 656 | // Two-track effect study |
657 | if (fTwoTrackEfficiencyStudy) | |
04af8d15 | 658 | fHistos->TwoTrackEfficiency(tracksClone, 0, bSign); |
1bba939a | 659 | |
c3294f09 | 660 | // fill second time with SPD centrality |
661 | if (fCompareCentralities && centralityObj) | |
662 | { | |
663 | centrality = centralityObj->GetCentralityPercentile("CL1"); | |
664 | if (centrality >= 0) | |
04af8d15 | 665 | fHistos->FillCorrelations(centrality, 2, AliUEHist::kCFStepReconstructed, tracksClone, 0, weight); |
c3294f09 | 666 | } |
667 | ||
eed401dc | 668 | if (fFillMixed) |
e0331fd9 | 669 | { |
eed401dc | 670 | // event mixing |
2a910c25 | 671 | |
eed401dc | 672 | // 1. First get an event pool corresponding in mult (cent) and |
673 | // zvertex to the current event. Once initialized, the pool | |
674 | // should contain nMix (reduced) events. This routine does not | |
675 | // pre-scan the chain. The first several events of every chain | |
676 | // will be skipped until the needed pools are filled to the | |
677 | // specified depth. If the pool categories are not too rare, this | |
678 | // should not be a problem. If they are rare, you could lose | |
679 | // statistics. | |
680 | ||
681 | // 2. Collect the whole pool's content of tracks into one TObjArray | |
682 | // (bgTracks), which is effectively a single background super-event. | |
683 | ||
684 | // 3. The reduced and bgTracks arrays must both be passed into | |
685 | // FillCorrelations(). Also nMix should be passed in, so a weight | |
686 | // of 1./nMix can be applied. | |
687 | ||
688 | AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx); | |
689 | ||
690 | if (!pool) | |
691 | AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centrality, zVtx)); | |
692 | ||
693 | //pool->SetDebug(1); | |
2d7827bf | 694 | |
695 | if (pool->IsReady() || pool->NTracksInPool() > fMixingTracks / 10 || pool->GetCurrentNEvents() >= 5) | |
eed401dc | 696 | { |
697 | ||
698 | Int_t nMix = pool->GetCurrentNEvents(); | |
a1c31636 | 699 | // cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl; |
c066889a | 700 | |
701 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(2); | |
5614e02f | 702 | ((TH2F*) fListOfHistos->FindObject("mixedDist"))->Fill(centrality, pool->NTracksInPool()); |
c066889a | 703 | if (pool->IsReady()) |
704 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(3); | |
eed401dc | 705 | |
706 | // Fill mixed-event histos here | |
c05ff6be | 707 | for (Int_t jMix=0; jMix<nMix; jMix++) |
708 | { | |
eed401dc | 709 | TObjArray* bgTracks = pool->GetEvent(jMix); |
c5c840c5 | 710 | |
711 | if (fTwoTrackEfficiencyStudy) | |
04af8d15 | 712 | fHistos->TwoTrackEfficiency(tracksClone, bgTracks, bSign); |
713 | ||
714 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracksClone, bgTracks, 1.0 / nMix, (jMix == 0)); | |
c5c840c5 | 715 | |
04af8d15 | 716 | if (fTwoTrackEfficiencyCut) |
717 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksClone, bgTracks, 1.0 / nMix, (jMix == 0), kTRUE, bSign); | |
eed401dc | 718 | } |
e0331fd9 | 719 | } |
eed401dc | 720 | |
04af8d15 | 721 | // ownership is with the pool now |
eed401dc | 722 | pool->UpdatePool(tracksClone); |
723 | //pool->PrintInfo(); | |
e0331fd9 | 724 | } |
04af8d15 | 725 | else |
726 | delete tracksClone; | |
e0331fd9 | 727 | } |
728 | ||
7a028750 | 729 | TObjArray* AliAnalysisTaskPhiCorrelations::CloneAndReduceTrackList(TObjArray* tracks) |
730 | { | |
731 | // clones a track list by using AliDPhiBasicParticle which uses much less memory (used for event mixing) | |
732 | ||
733 | TObjArray* tracksClone = new TObjArray; | |
734 | tracksClone->SetOwner(kTRUE); | |
735 | ||
b0d56b29 | 736 | for (Int_t i=0; i<tracks->GetEntriesFast(); i++) |
7a028750 | 737 | { |
738 | AliVParticle* particle = (AliVParticle*) tracks->At(i); | |
739 | tracksClone->Add(new AliDPhiBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge())); | |
740 | } | |
741 | ||
742 | return tracksClone; | |
743 | } | |
744 | ||
e0331fd9 | 745 | //____________________________________________________________________ |
746 | void AliAnalysisTaskPhiCorrelations::Initialize() | |
747 | { | |
748 | // input handler | |
749 | fInputHandler = (AliInputEventHandler*) | |
750 | ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); | |
751 | // MC handler | |
752 | fMcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
753 | } |