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