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