]>
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> | |
ebda4319 | 25 | #include <TH3F.h> |
e0331fd9 | 26 | #include <TRandom.h> |
27 | ||
28 | #include "AliAnalysisTaskPhiCorrelations.h" | |
29 | #include "AliAnalyseLeadingTrackUE.h" | |
30 | #include "AliUEHistograms.h" | |
31 | #include "AliUEHist.h" | |
32 | ||
e0331fd9 | 33 | #include "AliAnalysisManager.h" |
34 | #include "AliAODHandler.h" | |
35 | #include "AliAODInputHandler.h" | |
36 | #include "AliAODMCParticle.h" | |
e0331fd9 | 37 | #include "AliInputEventHandler.h" |
38 | #include "AliLog.h" | |
39 | #include "AliMCEventHandler.h" | |
40 | #include "AliVParticle.h" | |
2a910c25 | 41 | #include "AliCFContainer.h" |
e0331fd9 | 42 | |
43 | #include "AliESDEvent.h" | |
44 | #include "AliESDInputHandler.h" | |
45 | #include "AliMultiplicity.h" | |
2a910c25 | 46 | #include "AliCentrality.h" |
47 | #include "AliStack.h" | |
7dd4dec4 | 48 | #include "AliAODMCHeader.h" |
1ccd8a0a | 49 | #include "AliGenCocktailEventHeader.h" |
50 | #include "AliGenEventHeader.h" | |
e0331fd9 | 51 | |
2a910c25 | 52 | #include "AliEventPoolManager.h" |
e0331fd9 | 53 | |
d728f490 | 54 | #include "AliESDZDC.h" |
3bbad7c1 | 55 | #include "AliESDtrackCuts.h" |
d728f490 | 56 | |
32e49607 | 57 | #include "AliHelperPID.h" |
6e84bd0a | 58 | #include "AliAnalysisUtils.h" |
e0331fd9 | 59 | |
60 | //////////////////////////////////////////////////////////////////////// | |
61 | // | |
62 | // Analysis class for azimuthal correlation studies | |
63 | // Based on the UE task from Sara Vallero and Jan Fiete | |
64 | // | |
65 | // This class needs input AODs. | |
66 | // The output is a list of analysis-specific containers. | |
67 | // | |
68 | // The AOD can be either connected to the InputEventHandler | |
69 | // for a chain of AOD files | |
70 | // or | |
71 | // to the OutputEventHandler | |
72 | // for a chain of ESD files, | |
73 | // in this case the class should be in the train after the jet-finder | |
74 | // | |
75 | // Authors: | |
76 | // Jan Fiete Grosse-Oetringhaus | |
77 | // | |
78 | //////////////////////////////////////////////////////////////////////// | |
79 | ||
80 | ||
81 | ClassImp( AliAnalysisTaskPhiCorrelations ) | |
a1c31636 | 82 | ClassImp( AliDPhiBasicParticle ) |
e0331fd9 | 83 | |
84 | //____________________________________________________________________ | |
85 | AliAnalysisTaskPhiCorrelations:: AliAnalysisTaskPhiCorrelations(const char* name): | |
86 | AliAnalysisTask(name,""), | |
87 | // general configuration | |
88 | fDebug(0), | |
89 | fMode(0), | |
90 | fReduceMemoryFootprint(kFALSE), | |
eed401dc | 91 | fFillMixed(kTRUE), |
ac647b0f | 92 | fMixingTracks(50000), |
1bba939a | 93 | fTwoTrackEfficiencyStudy(kFALSE), |
d4b3dbfc | 94 | fTwoTrackEfficiencyCut(0), |
44af28f9 | 95 | fUseVtxAxis(kFALSE), |
9894bedd | 96 | fCourseCentralityBinning(kFALSE), |
04af8d15 | 97 | fSkipTrigger(kFALSE), |
1ccd8a0a | 98 | fInjectedSignals(kFALSE), |
e0331fd9 | 99 | // pointers to UE classes |
32e49607 | 100 | fHelperPID(0x0), |
6e84bd0a | 101 | fAnalysisUtils(0x0), |
e0331fd9 | 102 | fAnalyseUE(0x0), |
103 | fHistos(0x0), | |
104 | fHistosMixed(0), | |
418b56c5 | 105 | fEfficiencyCorrectionTriggers(0), |
106 | fEfficiencyCorrectionAssociated(0), | |
e0331fd9 | 107 | // handlers and events |
85bfac17 | 108 | fAOD(0x0), |
109 | fESD(0x0), | |
e0331fd9 | 110 | fArrayMC(0x0), |
111 | fInputHandler(0x0), | |
112 | fMcEvent(0x0), | |
113 | fMcHandler(0x0), | |
2a910c25 | 114 | fPoolMgr(0x0), |
e0331fd9 | 115 | // histogram settings |
116 | fListOfHistos(0x0), | |
117 | // event QA | |
118 | fnTracksVertex(1), // QA tracks pointing to principal vertex (= 3 default) | |
85bfac17 | 119 | fZVertex(7.), |
2a910c25 | 120 | fCentralityMethod("V0M"), |
e0331fd9 | 121 | // track cuts |
122 | fTrackEtaCut(0.8), | |
9da2f080 | 123 | fOnlyOneEtaSide(0), |
e0331fd9 | 124 | fPtMin(0.5), |
125 | fFilterBit(0xFF), | |
418b56c5 | 126 | fTrackStatus(0), |
5cabd2cd | 127 | fSelectBit(AliVEvent::kMB|AliVEvent::kUserDefined), |
2a910c25 | 128 | fUseChargeHadrons(kFALSE), |
5c9b9fa6 | 129 | fParticleSpeciesTrigger(-1), |
130 | fParticleSpeciesAssociated(-1), | |
9e35c487 | 131 | fCheckMotherPDG(kTRUE), |
c05ff6be | 132 | fSelectCharge(0), |
7a77d480 | 133 | fTriggerSelectCharge(0), |
15b0fdd0 | 134 | fAssociatedSelectCharge(0), |
d38fa455 | 135 | fTriggerRestrictEta(-1), |
00b6f3c6 | 136 | fEtaOrdering(kFALSE), |
b0d56b29 | 137 | fCutConversions(kFALSE), |
138 | fCutResonances(kFALSE), | |
a26093ba | 139 | fFillOnlyStep0(kFALSE), |
140 | fSkipStep6(kFALSE), | |
5e053cad | 141 | fRejectCentralityOutliers(kFALSE), |
f613255f | 142 | fRemoveWeakDecays(kFALSE), |
d6a8903f | 143 | fRemoveDuplicates(kFALSE), |
51d0a028 | 144 | fSkipFastCluster(kFALSE), |
8a368fc2 | 145 | fWeightPerEvent(kFALSE), |
3f3f12d9 | 146 | fCustomBinning(), |
640b9425 | 147 | fPtOrder(kTRUE), |
c05ff6be | 148 | fFillpT(kFALSE) |
e0331fd9 | 149 | { |
150 | // Default constructor | |
151 | // Define input and output slots here | |
152 | // Input slot #0 works with a TChain | |
153 | DefineInput(0, TChain::Class()); | |
154 | // Output slot #0 writes into a TList container | |
155 | DefineOutput(0, TList::Class()); | |
e0331fd9 | 156 | } |
157 | ||
158 | AliAnalysisTaskPhiCorrelations::~AliAnalysisTaskPhiCorrelations() | |
159 | { | |
160 | // destructor | |
161 | ||
162 | if (fListOfHistos && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) | |
163 | delete fListOfHistos; | |
164 | } | |
165 | ||
166 | //____________________________________________________________________ | |
167 | void AliAnalysisTaskPhiCorrelations::ConnectInputData(Option_t* /*option*/) | |
168 | { | |
169 | ||
170 | // Connect the input data | |
171 | if (fDebug > 1) AliInfo("ConnectInputData() "); | |
172 | ||
173 | // Since AODs can either be connected to the InputEventHandler | |
174 | // or to the OutputEventHandler ( the AOD is created by a previus task in the train ) | |
175 | // we need to get the pointer to the AODEvent correctly. | |
176 | ||
177 | // Delta AODs are also accepted. | |
178 | ||
179 | TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); | |
180 | ||
85bfac17 | 181 | if( handler && handler->InheritsFrom("AliAODInputHandler") ) |
182 | { // input AOD | |
183 | fAOD = ((AliAODInputHandler*)handler)->GetEvent(); | |
184 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODInputHandler"); | |
185 | } | |
186 | else | |
187 | { //output AOD | |
188 | handler = AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler(); | |
189 | if (handler && handler->InheritsFrom("AliAODHandler") ) | |
190 | { | |
191 | fAOD = ((AliAODHandler*)handler)->GetAOD(); | |
192 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliAODHandler"); | |
193 | } | |
194 | else | |
195 | { // no AOD | |
196 | AliWarning("I can't get any AOD Event Handler"); | |
197 | } | |
198 | } | |
199 | ||
200 | if (handler && handler->InheritsFrom("AliESDInputHandler") ) | |
201 | { // input ESD | |
202 | // pointer received per event in ::Exec | |
203 | if (fDebug > 1) AliInfo(" ==== Tracks and Jets from AliESDInputHandler"); | |
204 | } | |
e0331fd9 | 205 | |
206 | // Initialize common pointers | |
207 | Initialize(); | |
e0331fd9 | 208 | } |
209 | ||
210 | //____________________________________________________________________ | |
211 | void AliAnalysisTaskPhiCorrelations::CreateOutputObjects() | |
212 | { | |
213 | // Create the output container | |
214 | ||
215 | if (fDebug > 1) AliInfo("CreateOutputObjects()"); | |
216 | ||
217 | // Initialize class with main algorithms, event and track selection. | |
218 | fAnalyseUE = new AliAnalyseLeadingTrackUE(); | |
2a910c25 | 219 | fAnalyseUE->SetParticleSelectionCriteria(fFilterBit, fUseChargeHadrons, fTrackEtaCut, fPtMin); |
418b56c5 | 220 | fAnalyseUE->SetTrackStatus(fTrackStatus); |
9e35c487 | 221 | fAnalyseUE->SetCheckMotherPDG(fCheckMotherPDG); |
e0331fd9 | 222 | fAnalyseUE->SetDebug(fDebug); |
85bfac17 | 223 | fAnalyseUE->DefineESDCuts(fFilterBit); |
5cabd2cd | 224 | fAnalyseUE->SetEventSelection(fSelectBit); |
32e49607 | 225 | fAnalyseUE->SetHelperPID(fHelperPID); |
226 | if ((fParticleSpeciesTrigger != -1 || fParticleSpeciesAssociated != -1) && !fHelperPID) | |
227 | AliFatal("HelperPID object should be set in the steering macro"); | |
e0331fd9 | 228 | |
229 | // Initialize output list of containers | |
230 | if (fListOfHistos != NULL){ | |
231 | delete fListOfHistos; | |
232 | fListOfHistos = NULL; | |
233 | } | |
234 | if (!fListOfHistos){ | |
235 | fListOfHistos = new TList(); | |
236 | fListOfHistos->SetOwner(kTRUE); | |
237 | } | |
238 | ||
239 | // Initialize class to handle histograms | |
9894bedd | 240 | TString histType = "4R"; |
3bbad7c1 | 241 | if (fUseVtxAxis == 1) |
b752706a | 242 | histType = "5R"; |
3bbad7c1 | 243 | else if (fUseVtxAxis == 2) |
244 | histType = "6R"; | |
9894bedd | 245 | if (fCourseCentralityBinning) |
246 | histType += "C"; | |
3f3f12d9 | 247 | fHistos = new AliUEHistograms("AliUEHistogramsSame", histType, fCustomBinning); |
248 | fHistosMixed = new AliUEHistograms("AliUEHistogramsMixed", histType, fCustomBinning); | |
e0331fd9 | 249 | |
2a910c25 | 250 | fHistos->SetSelectCharge(fSelectCharge); |
251 | fHistosMixed->SetSelectCharge(fSelectCharge); | |
252 | ||
afe13b94 | 253 | fHistos->SetSelectTriggerCharge(fTriggerSelectCharge); |
254 | fHistosMixed->SetSelectTriggerCharge(fTriggerSelectCharge); | |
15b0fdd0 | 255 | |
256 | fHistos->SetSelectAssociatedCharge(fAssociatedSelectCharge); | |
257 | fHistosMixed->SetSelectAssociatedCharge(fAssociatedSelectCharge); | |
7a77d480 | 258 | |
d38fa455 | 259 | fHistos->SetTriggerRestrictEta(fTriggerRestrictEta); |
260 | fHistosMixed->SetTriggerRestrictEta(fTriggerRestrictEta); | |
261 | ||
9da2f080 | 262 | fHistos->SetOnlyOneEtaSide(fOnlyOneEtaSide); |
263 | fHistosMixed->SetOnlyOneEtaSide(fOnlyOneEtaSide); | |
264 | ||
00b6f3c6 | 265 | fHistos->SetEtaOrdering(fEtaOrdering); |
266 | fHistosMixed->SetEtaOrdering(fEtaOrdering); | |
267 | ||
b0d56b29 | 268 | fHistos->SetPairCuts(fCutConversions, fCutResonances); |
269 | fHistosMixed->SetPairCuts(fCutConversions, fCutResonances); | |
270 | ||
defad170 | 271 | fHistos->SetTrackEtaCut(fTrackEtaCut); |
272 | fHistosMixed->SetTrackEtaCut(fTrackEtaCut); | |
273 | ||
8a368fc2 | 274 | fHistos->SetWeightPerEvent(fWeightPerEvent); |
275 | fHistosMixed->SetWeightPerEvent(fWeightPerEvent); | |
418b56c5 | 276 | |
640b9425 | 277 | fHistos->SetPtOrder(fPtOrder); |
278 | fHistosMixed->SetPtOrder(fPtOrder); | |
279 | ||
418b56c5 | 280 | if (fEfficiencyCorrectionTriggers) |
281 | { | |
282 | fHistos->SetEfficiencyCorrectionTriggers(fEfficiencyCorrectionTriggers); | |
283 | fHistosMixed->SetEfficiencyCorrectionTriggers((THnF*) fEfficiencyCorrectionTriggers->Clone()); | |
284 | } | |
285 | if (fEfficiencyCorrectionAssociated) | |
408d1ac9 | 286 | { |
418b56c5 | 287 | fHistos->SetEfficiencyCorrectionAssociated(fEfficiencyCorrectionAssociated); |
288 | fHistosMixed->SetEfficiencyCorrectionAssociated((THnF*) fEfficiencyCorrectionAssociated->Clone()); | |
408d1ac9 | 289 | } |
13a404ed | 290 | |
e0331fd9 | 291 | // add histograms to list |
292 | fListOfHistos->Add(fHistos); | |
293 | fListOfHistos->Add(fHistosMixed); | |
32e49607 | 294 | // add HelperPID to list |
295 | if (fHelperPID) | |
296 | fListOfHistos->Add(fHelperPID); | |
e0331fd9 | 297 | |
2a910c25 | 298 | fListOfHistos->Add(new TH2F("trackletsVsV0Cent", ";L1 clusters;v0 centrality", 100, -0.5, 9999.5, 101, 0, 101)); |
299 | 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 | 300 | fListOfHistos->Add(new TH1F("eventStat", ";;events", 4, -0.5, 3.5)); |
5614e02f | 301 | fListOfHistos->Add(new TH2F("mixedDist", ";centrality;tracks;events", 101, 0, 101, 200, 0, fMixingTracks * 1.5)); |
b0d56b29 | 302 | fListOfHistos->Add(new TH1F("pids", ";pdg;tracks", 2001, -1000.5, 1000.5)); |
f0a25b1d | 303 | fListOfHistos->Add(new TH2F("referenceMultiplicity", ";centrality;tracks;events", 101, 0, 101, 200, 0, 200)); |
e0331fd9 | 304 | |
1a32ecc0 | 305 | PostData(0,fListOfHistos); |
306 | ||
e0331fd9 | 307 | // Add task configuration to output list |
308 | AddSettingsTree(); | |
309 | ||
2a910c25 | 310 | // event mixing |
3f3f12d9 | 311 | Int_t poolsize = 1000; // Maximum number of events, ignored in the present implemention of AliEventPoolManager |
c066889a | 312 | |
2a910c25 | 313 | Int_t nCentralityBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(1); |
314 | Double_t* centralityBins = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray(); | |
315 | ||
5f54dac4 | 316 | const Int_t kNZvtxBins = 10+(1+10)*4; |
408d1ac9 | 317 | // bins for further buffers are shifted by 100 cm |
5f54dac4 | 318 | Double_t vertexBins[kNZvtxBins+1] = { -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10, |
319 | 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, | |
320 | 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, | |
321 | 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, | |
322 | 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410 }; | |
323 | ||
324 | Int_t nZvtxBins = kNZvtxBins; | |
eb88bdfe | 325 | Double_t* zvtxbin = vertexBins; |
c066889a | 326 | |
408d1ac9 | 327 | if (fMode == 0 && fHistos->GetUEHist(2)->GetEventHist()->GetNVar() > 2) |
eb88bdfe | 328 | { |
329 | nZvtxBins = fHistos->GetUEHist(2)->GetEventHist()->GetNBins(2); | |
330 | zvtxbin = (Double_t*) fHistos->GetUEHist(2)->GetEventHist()->GetAxis(2, 0)->GetXbins()->GetArray(); | |
331 | } | |
85bfac17 | 332 | |
3f3f12d9 | 333 | fPoolMgr = new AliEventPoolManager(poolsize, fMixingTracks, nCentralityBins, centralityBins, nZvtxBins, zvtxbin); |
f0df9076 | 334 | fPoolMgr->SetTargetValues(fMixingTracks, 0.1, 5); |
e0331fd9 | 335 | } |
336 | ||
337 | //____________________________________________________________________ | |
338 | void AliAnalysisTaskPhiCorrelations::Exec(Option_t */*option*/) | |
339 | { | |
416af868 | 340 | // exec (per event) |
341 | fAnalyseUE->NextEvent(); | |
342 | ||
85bfac17 | 343 | // receive ESD pointer if we are not running AOD analysis |
344 | if (!fAOD) | |
345 | { | |
346 | AliVEventHandler* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); | |
347 | if (handler && handler->InheritsFrom("AliESDInputHandler")) | |
348 | fESD = ((AliESDInputHandler*)handler)->GetEvent(); | |
349 | } | |
350 | ||
7dd4dec4 | 351 | if (fMode) |
352 | { | |
353 | // correction mode | |
354 | ||
355 | if (fMcHandler) | |
356 | fMcEvent = fMcHandler->MCEvent(); | |
357 | ||
358 | if (fAOD) | |
359 | { | |
360 | // array of MC particles | |
361 | fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName())); | |
362 | if (!fArrayMC) | |
363 | AliFatal("No array of MC particles found !!!"); | |
364 | } | |
365 | ||
366 | AnalyseCorrectionMode(); | |
367 | } | |
e0331fd9 | 368 | else AnalyseDataMode(); |
e0331fd9 | 369 | } |
370 | ||
371 | /******************** ANALYSIS METHODS *****************************/ | |
372 | ||
373 | //____________________________________________________________________ | |
374 | void AliAnalysisTaskPhiCorrelations::AddSettingsTree() | |
375 | { | |
376 | //Write settings to output list | |
377 | TTree *settingsTree = new TTree("UEAnalysisSettings","Analysis Settings in UE estimation"); | |
c05ff6be | 378 | settingsTree->Branch("fnTracksVertex", &fnTracksVertex,"nTracksVertex/I"); |
379 | settingsTree->Branch("fZVertex", &fZVertex,"ZVertex/D"); | |
380 | //settingsTree->Branch("fCentralityMethod", fCentralityMethod.Data(),"CentralityMethod/C"); | |
e0331fd9 | 381 | settingsTree->Branch("fTrackEtaCut", &fTrackEtaCut, "TrackEtaCut/D"); |
9da2f080 | 382 | settingsTree->Branch("fOnlyOneEtaSide", &fOnlyOneEtaSide,"OnlyOneEtaSide/I"); |
e0331fd9 | 383 | settingsTree->Branch("fPtMin", &fPtMin, "PtMin/D"); |
c05ff6be | 384 | settingsTree->Branch("fFilterBit", &fFilterBit,"FilterBit/I"); |
418b56c5 | 385 | settingsTree->Branch("fTrackStatus", &fTrackStatus,"TrackStatus/I"); |
c05ff6be | 386 | settingsTree->Branch("fSelectBit", &fSelectBit,"EventSelectionBit/I"); |
e0331fd9 | 387 | settingsTree->Branch("fUseChargeHadrons", &fUseChargeHadrons,"UseChHadrons/O"); |
5c9b9fa6 | 388 | settingsTree->Branch("fParticleSpeciesTrigger", &fParticleSpeciesTrigger,"ParticleSpeciesTrigger/I"); |
389 | settingsTree->Branch("fParticleSpeciesAssociated", &fParticleSpeciesAssociated,"ParticleSpeciesAssociated/I"); | |
9e35c487 | 390 | settingsTree->Branch("fCheckMotherPDG", &fCheckMotherPDG,"CheckMotherPDG/I"); |
c05ff6be | 391 | settingsTree->Branch("fSelectCharge", &fSelectCharge,"SelectCharge/I"); |
7a77d480 | 392 | settingsTree->Branch("fTriggerSelectCharge", &fTriggerSelectCharge,"TriggerSelectCharge/I"); |
15b0fdd0 | 393 | settingsTree->Branch("fAssociatedSelectCharge", &fAssociatedSelectCharge,"fAssociatedSelectCharge/I"); |
b0d56b29 | 394 | settingsTree->Branch("fTriggerRestrictEta", &fTriggerRestrictEta,"TriggerRestrictEta/D"); |
00b6f3c6 | 395 | settingsTree->Branch("fEtaOrdering", &fEtaOrdering,"EtaOrdering/O"); |
b0d56b29 | 396 | settingsTree->Branch("fCutConversions", &fCutConversions,"CutConversions/O"); |
397 | settingsTree->Branch("fCutResonances", &fCutResonances,"CutResonances/O"); | |
c05ff6be | 398 | settingsTree->Branch("fFillpT", &fFillpT,"FillpT/O"); |
ac647b0f | 399 | settingsTree->Branch("fMixingTracks", &fMixingTracks,"MixingTracks/I"); |
04af8d15 | 400 | settingsTree->Branch("fSkipTrigger", &fSkipTrigger,"SkipTrigger/O"); |
1ccd8a0a | 401 | settingsTree->Branch("fInjectedSignals", &fInjectedSignals,"SkipTrigger/O"); |
5e053cad | 402 | settingsTree->Branch("fRejectCentralityOutliers", &fRejectCentralityOutliers,"RejectCentralityOutliers/O"); |
f613255f | 403 | settingsTree->Branch("fRemoveWeakDecays", &fRemoveWeakDecays,"RemoveWeakDecays/O"); |
d6a8903f | 404 | settingsTree->Branch("fRemoveDuplicates", &fRemoveDuplicates,"RemoveDuplicates/O"); |
51d0a028 | 405 | settingsTree->Branch("fSkipFastCluster", &fSkipFastCluster,"SkipFastCluster/O"); |
8a368fc2 | 406 | settingsTree->Branch("fWeightPerEvent", &fWeightPerEvent,"WeightPerEvent/O"); |
640b9425 | 407 | settingsTree->Branch("fPtOrder", &fPtOrder,"PtOrder/O"); |
3f3f12d9 | 408 | //fCustomBinning |
04af8d15 | 409 | |
e0331fd9 | 410 | settingsTree->Fill(); |
411 | fListOfHistos->Add(settingsTree); | |
412 | } | |
413 | ||
414 | //____________________________________________________________________ | |
415 | void AliAnalysisTaskPhiCorrelations::AnalyseCorrectionMode() | |
416 | { | |
417 | // Run the analysis on MC to get the correction maps | |
418 | // | |
419 | ||
2a910c25 | 420 | if ( fDebug > 3 ) AliInfo( " Processing event in Corrections mode ..." ); |
421 | ||
422 | Double_t centrality = 0; | |
423 | ||
424 | if (fCentralityMethod.Length() > 0) | |
425 | { | |
85bfac17 | 426 | AliCentrality *centralityObj = 0; |
427 | if (fAOD) | |
428 | centralityObj = fAOD->GetHeader()->GetCentralityP(); | |
429 | else if (fESD) | |
430 | centralityObj = fESD->GetCentrality(); | |
431 | ||
2a910c25 | 432 | if (centralityObj) |
433 | { | |
434 | centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod); | |
a8583211 | 435 | AliInfo(Form("Centrality is %f", centrality)); |
2a910c25 | 436 | } |
437 | else | |
438 | { | |
439 | Printf("WARNING: Centrality object is 0"); | |
440 | centrality = -1; | |
441 | } | |
442 | } | |
443 | ||
85bfac17 | 444 | // Support for ESD and AOD based analysis |
445 | AliVEvent* inputEvent = fAOD; | |
446 | if (!inputEvent) | |
447 | inputEvent = fESD; | |
d4b3dbfc | 448 | |
932155c7 | 449 | Float_t bSign = 0; |
450 | ||
d4b3dbfc | 451 | if (inputEvent) |
932155c7 | 452 | { |
d4b3dbfc | 453 | fHistos->SetRunNumber(inputEvent->GetRunNumber()); |
932155c7 | 454 | bSign = (inputEvent->GetMagneticField() > 0) ? 1 : -1; |
455 | } | |
456 | ||
85bfac17 | 457 | TObject* mc = fArrayMC; |
458 | if (!mc) | |
459 | mc = fMcEvent; | |
460 | ||
2a910c25 | 461 | // count all events |
462 | fHistos->FillEvent(centrality, -1); | |
463 | ||
72b62cb8 | 464 | if (centrality < 0) |
465 | return; | |
466 | ||
2a910c25 | 467 | // Only consider MC events within the vtx-z region used also as cut on the reconstructed vertex |
7dd4dec4 | 468 | TObject* vertexSupplier = fMcEvent; |
469 | if (fAOD) // AOD | |
470 | vertexSupplier = fAOD->FindListObject(AliAODMCHeader::StdBranchName()); | |
471 | ||
472 | if (!fAnalyseUE->VertexSelection(vertexSupplier, 0, fZVertex)) | |
2a910c25 | 473 | return; |
85bfac17 | 474 | |
7dd4dec4 | 475 | Float_t zVtx = 0; |
476 | if (fAOD) | |
477 | zVtx = ((AliAODMCHeader*) vertexSupplier)->GetVtxZ(); | |
478 | else | |
479 | zVtx = fMcEvent->GetPrimaryVertex()->GetZ(); | |
c05ff6be | 480 | Float_t weight = 1; |
481 | if (fFillpT) | |
482 | weight = -1; | |
1ccd8a0a | 483 | |
484 | // For productions with injected signals, figure out above which label to skip particles/tracks | |
485 | Int_t skipParticlesAbove = 0; | |
486 | if (fInjectedSignals) | |
487 | { | |
488 | AliGenEventHeader* eventHeader = 0; | |
489 | Int_t headers = 0; | |
490 | ||
491 | if (fMcEvent) | |
492 | { | |
493 | // ESD | |
494 | AliHeader* header = (AliHeader*) fMcEvent->Header(); | |
495 | if (!header) | |
496 | AliFatal("fInjectedSignals set but no MC header found"); | |
497 | ||
498 | AliGenCocktailEventHeader* cocktailHeader = dynamic_cast<AliGenCocktailEventHeader*> (header->GenEventHeader()); | |
499 | if (!cocktailHeader) | |
500 | { | |
501 | header->Dump(); | |
502 | AliFatal("fInjectedSignals set but no MC cocktail header found"); | |
503 | } | |
504 | ||
505 | headers = cocktailHeader->GetHeaders()->GetEntries(); | |
506 | eventHeader = dynamic_cast<AliGenEventHeader*> (cocktailHeader->GetHeaders()->First()); | |
507 | } | |
508 | else | |
509 | { | |
510 | // AOD | |
511 | AliAODMCHeader* header = (AliAODMCHeader*) fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
512 | if (!header) | |
513 | AliFatal("fInjectedSignals set but no MC header found"); | |
514 | ||
515 | headers = header->GetNCocktailHeaders(); | |
516 | eventHeader = header->GetCocktailHeader(0); | |
517 | } | |
2a910c25 | 518 | |
1ccd8a0a | 519 | if (!eventHeader) |
46848f0b | 520 | { |
521 | // We avoid AliFatal here, because the AOD productions sometimes have events where the MC header is missing | |
522 | // (due to unreadable Kinematics) and we don't want to loose the whole job because of a few events | |
523 | AliError("First event header not found. Skipping this event."); | |
524 | fHistos->FillEvent(centrality, AliUEHist::kCFStepAnaTopology); | |
525 | return; | |
526 | } | |
1ccd8a0a | 527 | |
528 | skipParticlesAbove = eventHeader->NProduced(); | |
529 | AliInfo(Form("Injected signals in this event (%d headers). Keeping events of %s. Will skip particles/tracks above %d.", headers, eventHeader->ClassName(), skipParticlesAbove)); | |
530 | } | |
531 | ||
2a910c25 | 532 | // Get MC primaries |
3f3f12d9 | 533 | // triggers |
5c9b9fa6 | 534 | TObjArray* tmpList = fAnalyseUE->GetAcceptedParticles(mc, 0, kTRUE, fParticleSpeciesTrigger, kTRUE); |
3f3f12d9 | 535 | CleanUp(tmpList, mc, skipParticlesAbove); |
762206c7 | 536 | TObjArray* tracksMC = CloneAndReduceTrackList(tmpList); |
537 | delete tmpList; | |
2a910c25 | 538 | |
3f3f12d9 | 539 | // associated |
540 | TObjArray* tracksCorrelateMC = tracksMC; | |
5c9b9fa6 | 541 | if (fParticleSpeciesAssociated != fParticleSpeciesTrigger) |
3f3f12d9 | 542 | { |
b54ab0b1 | 543 | tmpList = fAnalyseUE->GetAcceptedParticles(mc, 0, kTRUE, fParticleSpeciesAssociated, kTRUE); |
544 | CleanUp(tmpList, mc, skipParticlesAbove); | |
545 | tracksCorrelateMC = CloneAndReduceTrackList(tmpList); | |
546 | delete tmpList; | |
3f3f12d9 | 547 | } |
548 | ||
1ccd8a0a | 549 | /* |
b0d56b29 | 550 | if (fAOD) |
551 | { | |
552 | for (Int_t i=0; i<fArrayMC->GetEntriesFast(); i++) | |
553 | ((TH1F*) fListOfHistos->FindObject("pids"))->Fill(((AliAODMCParticle*) fArrayMC->At(i))->PdgCode()); | |
554 | } | |
555 | else | |
556 | { | |
557 | for (Int_t i=0; i<fMcEvent->GetNumberOfTracks(); i++) | |
558 | ((TH1F*) fListOfHistos->FindObject("pids"))->Fill(fMcEvent->GetTrack(i)->PdgCode()); | |
559 | } | |
1ccd8a0a | 560 | */ |
b0d56b29 | 561 | |
9375b5e2 | 562 | if (fFillOnlyStep0) |
563 | zVtx = 0; | |
564 | ||
2a910c25 | 565 | // (MC-true all particles) |
566 | // STEP 0 | |
3f3f12d9 | 567 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepAll, tracksMC, tracksCorrelateMC, weight); |
2a910c25 | 568 | |
7a028750 | 569 | // mixed event |
8781a433 | 570 | if (fFillMixed) |
571 | { | |
572 | AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx); | |
f0df9076 | 573 | if (pool->IsReady()) |
8781a433 | 574 | for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) |
575 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepAll, tracksMC, pool->GetEvent(jMix), 1.0 / pool->GetCurrentNEvents(), (jMix == 0)); | |
3f3f12d9 | 576 | pool->UpdatePool(CloneAndReduceTrackList(tracksCorrelateMC)); |
8781a433 | 577 | } |
7a028750 | 578 | |
04af8d15 | 579 | // Printf("trigger: %d", ((AliInputEventHandler*)fInputHandler)->IsEventSelected()); |
580 | ||
2a910c25 | 581 | // Trigger selection ************************************************ |
a26093ba | 582 | if (!fFillOnlyStep0 && (fSkipTrigger || fAnalyseUE->TriggerSelection(fInputHandler))) |
2a910c25 | 583 | { |
c32a0ca9 | 584 | // (MC-true all particles) |
585 | // STEP 1 | |
586 | if (!fReduceMemoryFootprint) | |
3f3f12d9 | 587 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTriggered, tracksMC, tracksCorrelateMC, weight); |
c32a0ca9 | 588 | else |
589 | fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered); | |
590 | ||
872dc651 | 591 | if (!inputEvent) { |
c32a0ca9 | 592 | AliFatal("UNEXPECTED: inputEvent is 0. Trigger selection should have failed"); |
872dc651 | 593 | return; |
594 | } | |
2a910c25 | 595 | |
596 | // Vertex selection ************************************************* | |
85bfac17 | 597 | if (fAnalyseUE->VertexSelection(inputEvent, fnTracksVertex, fZVertex)) |
2a910c25 | 598 | { |
599 | // fill here for tracking efficiency | |
600 | // loop over particle species | |
601 | ||
602 | for (Int_t particleSpecies = 0; particleSpecies < 4; particleSpecies++) | |
603 | { | |
85bfac17 | 604 | TObjArray* primMCParticles = fAnalyseUE->GetAcceptedParticles(mc, 0x0, kTRUE, particleSpecies, kTRUE); |
59375a30 | 605 | TObjArray* primRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, particleSpecies, kTRUE, kFALSE); |
606 | TObjArray* allRecoTracksMatched = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, particleSpecies, kTRUE, kFALSE); | |
607 | TObjArray* primRecoTracksMatchedPID = 0; | |
608 | TObjArray* allRecoTracksMatchedPID = 0; | |
609 | ||
610 | if (fHelperPID) | |
611 | { | |
612 | primRecoTracksMatchedPID = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, particleSpecies, kTRUE, kTRUE); | |
613 | allRecoTracksMatchedPID = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, particleSpecies, kTRUE, kTRUE); | |
614 | } | |
1ccd8a0a | 615 | |
3f3f12d9 | 616 | CleanUp(primMCParticles, mc, skipParticlesAbove); |
617 | CleanUp(primRecoTracksMatched, mc, skipParticlesAbove); | |
618 | CleanUp(allRecoTracksMatched, mc, skipParticlesAbove); | |
59375a30 | 619 | CleanUp(primRecoTracksMatchedPID, mc, skipParticlesAbove); |
620 | CleanUp(allRecoTracksMatchedPID, mc, skipParticlesAbove); | |
29cfdb5f | 621 | |
622 | // select charges | |
623 | if (fTriggerSelectCharge != 0) | |
624 | { | |
625 | SelectCharge(primMCParticles); | |
626 | SelectCharge(primRecoTracksMatched); | |
627 | SelectCharge(allRecoTracksMatched); | |
59375a30 | 628 | SelectCharge(primRecoTracksMatchedPID); |
629 | SelectCharge(allRecoTracksMatchedPID); | |
29cfdb5f | 630 | } |
2a910c25 | 631 | |
59375a30 | 632 | fHistos->FillTrackingEfficiency(primMCParticles, primRecoTracksMatched, allRecoTracksMatched, primRecoTracksMatchedPID, allRecoTracksMatchedPID, 0, particleSpecies, centrality, zVtx); |
2a910c25 | 633 | |
eed401dc | 634 | // Printf("%d --> %d %d %d", particleSpecies, primMCParticles->GetEntries(), primRecoTracksMatched->GetEntries(), allRecoTracksMatched->GetEntries()); |
635 | ||
636 | delete primMCParticles; | |
2a910c25 | 637 | delete primRecoTracksMatched; |
638 | delete allRecoTracksMatched; | |
639 | } | |
3f3f12d9 | 640 | |
b591fb9c | 641 | TObjArray* fakeParticles = fAnalyseUE->GetFakeParticles(inputEvent, mc, kFALSE, -1, kTRUE); |
3f3f12d9 | 642 | CleanUp((TObjArray*) fakeParticles->At(0), mc, skipParticlesAbove); |
643 | CleanUp((TObjArray*) fakeParticles->At(1), mc, skipParticlesAbove); | |
644 | ||
59375a30 | 645 | fHistos->FillTrackingEfficiency(0, 0, 0, 0, 0, (TObjArray*) fakeParticles->At(2), 0, centrality, zVtx); |
b591fb9c | 646 | fHistos->FillFakePt(fakeParticles, centrality); |
d728f490 | 647 | // Printf(">>>>> %d %d %d fakes", ((TObjArray*) fakeParticles->At(0))->GetEntriesFast(), ((TObjArray*) fakeParticles->At(1))->GetEntriesFast(), ((TObjArray*) fakeParticles->At(2))->GetEntriesFast()); |
b591fb9c | 648 | delete fakeParticles; |
2a910c25 | 649 | |
650 | // (MC-true all particles) | |
651 | // STEP 2 | |
85bfac17 | 652 | if (!fReduceMemoryFootprint) |
3f3f12d9 | 653 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepVertex, tracksMC, tracksCorrelateMC, weight); |
c32a0ca9 | 654 | else |
655 | fHistos->FillEvent(centrality, AliUEHist::kCFStepVertex); | |
2a910c25 | 656 | |
657 | // Get MC primaries that match reconstructed track | |
3f3f12d9 | 658 | // triggers |
b54ab0b1 | 659 | tmpList = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, fParticleSpeciesTrigger, kTRUE); |
660 | CleanUp(tmpList, mc, skipParticlesAbove); | |
661 | TObjArray* tracksRecoMatchedPrim = CloneAndReduceTrackList(tmpList); | |
662 | delete tmpList; | |
663 | ||
3f3f12d9 | 664 | // associated |
665 | TObjArray* tracksCorrelateRecoMatchedPrim = tracksRecoMatchedPrim; | |
5c9b9fa6 | 666 | if (fParticleSpeciesAssociated != fParticleSpeciesTrigger) |
3f3f12d9 | 667 | { |
b54ab0b1 | 668 | tmpList = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kTRUE, fParticleSpeciesAssociated, kTRUE); |
669 | CleanUp(tmpList, mc, skipParticlesAbove); | |
670 | tracksCorrelateRecoMatchedPrim = CloneAndReduceTrackList(tmpList); | |
671 | delete tmpList; | |
3f3f12d9 | 672 | } |
673 | ||
2a910c25 | 674 | // (RECO-matched (quantities from MC particle) primary particles) |
675 | // STEP 4 | |
3f3f12d9 | 676 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTrackedOnlyPrim, tracksRecoMatchedPrim, tracksCorrelateRecoMatchedPrim, weight); |
408d1ac9 | 677 | |
678 | // mixed event | |
679 | if (fFillMixed) | |
680 | { | |
681 | AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx + 200); | |
f0df9076 | 682 | if (pool->IsReady()) |
408d1ac9 | 683 | for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) |
684 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTrackedOnlyPrim, tracksRecoMatchedPrim, pool->GetEvent(jMix), 1.0 / pool->GetCurrentNEvents(), (jMix == 0)); | |
3f3f12d9 | 685 | pool->UpdatePool(CloneAndReduceTrackList(tracksCorrelateRecoMatchedPrim)); |
408d1ac9 | 686 | } |
2a910c25 | 687 | |
688 | // Get MC primaries + secondaries that match reconstructed track | |
3f3f12d9 | 689 | // triggers |
b54ab0b1 | 690 | tmpList = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, fParticleSpeciesTrigger, kTRUE); |
691 | CleanUp(tmpList, mc, skipParticlesAbove); | |
692 | TObjArray* tracksRecoMatchedAll = CloneAndReduceTrackList(tmpList); | |
693 | delete tmpList; | |
694 | ||
3f3f12d9 | 695 | // associated |
696 | TObjArray* tracksCorrelateRecoMatchedAll = tracksRecoMatchedAll; | |
5c9b9fa6 | 697 | if (fParticleSpeciesAssociated != fParticleSpeciesTrigger) |
3f3f12d9 | 698 | { |
b54ab0b1 | 699 | tmpList = fAnalyseUE->GetAcceptedParticles(inputEvent, mc, kFALSE, fParticleSpeciesAssociated, kTRUE); |
700 | CleanUp(tmpList, mc, skipParticlesAbove); | |
701 | tracksCorrelateRecoMatchedAll = CloneAndReduceTrackList(tmpList); | |
702 | delete tmpList; | |
3f3f12d9 | 703 | } |
704 | ||
2a910c25 | 705 | // (RECO-matched (quantities from MC particle) all particles) |
706 | // STEP 5 | |
3f3f12d9 | 707 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTracked, tracksRecoMatchedAll, tracksCorrelateRecoMatchedAll, weight); |
2a910c25 | 708 | |
408d1ac9 | 709 | // mixed event |
710 | if (fFillMixed) | |
711 | { | |
712 | AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx + 300); | |
f0df9076 | 713 | if (pool->IsReady()) |
408d1ac9 | 714 | for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) |
715 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepTracked, tracksRecoMatchedAll, pool->GetEvent(jMix), 1.0 / pool->GetCurrentNEvents(), (jMix == 0)); | |
3f3f12d9 | 716 | pool->UpdatePool(CloneAndReduceTrackList(tracksCorrelateRecoMatchedAll)); |
408d1ac9 | 717 | } |
718 | ||
2a910c25 | 719 | // Get RECO tracks |
3f3f12d9 | 720 | // triggers |
b54ab0b1 | 721 | tmpList = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, fParticleSpeciesTrigger, kTRUE); |
722 | CleanUp(tmpList, mc, skipParticlesAbove); | |
723 | TObjArray* tracks = CloneAndReduceTrackList(tmpList); | |
724 | delete tmpList; | |
725 | ||
3f3f12d9 | 726 | // associated |
727 | TObjArray* tracksCorrelate = tracks; | |
5c9b9fa6 | 728 | if (fParticleSpeciesAssociated != fParticleSpeciesTrigger) |
3f3f12d9 | 729 | { |
b54ab0b1 | 730 | tmpList = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, fParticleSpeciesAssociated, kTRUE); |
731 | CleanUp(tmpList, mc, skipParticlesAbove); | |
732 | tracksCorrelate = CloneAndReduceTrackList(tmpList); | |
733 | delete tmpList; | |
3f3f12d9 | 734 | } |
1ccd8a0a | 735 | |
2a910c25 | 736 | // (RECO all tracks) |
737 | // STEP 6 | |
a26093ba | 738 | if (!fSkipStep6) |
3f3f12d9 | 739 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks, tracksCorrelate, weight); |
2a910c25 | 740 | |
932155c7 | 741 | // two track cut, STEP 8 |
742 | if (fTwoTrackEfficiencyCut > 0) | |
3f3f12d9 | 743 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracks, tracksCorrelate, weight, kTRUE, kTRUE, bSign, fTwoTrackEfficiencyCut); |
932155c7 | 744 | |
408d1ac9 | 745 | // apply correction efficiency, STEP 10 |
418b56c5 | 746 | if (fEfficiencyCorrectionTriggers || fEfficiencyCorrectionAssociated) |
408d1ac9 | 747 | { |
418b56c5 | 748 | // with or without two track efficiency depending on if fTwoTrackEfficiencyCut is set |
408d1ac9 | 749 | Bool_t twoTrackCut = (fTwoTrackEfficiencyCut > 0); |
750 | ||
3f3f12d9 | 751 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepCorrected, tracks, tracksCorrelate, weight, kTRUE, twoTrackCut, bSign, fTwoTrackEfficiencyCut, kTRUE); |
408d1ac9 | 752 | } |
418b56c5 | 753 | |
7a028750 | 754 | // mixed event |
408d1ac9 | 755 | if (fFillMixed) |
8781a433 | 756 | { |
757 | AliEventPool* pool2 = fPoolMgr->GetEventPool(centrality, zVtx + 100); | |
f0df9076 | 758 | if (pool2->IsReady()) |
408d1ac9 | 759 | { |
932155c7 | 760 | for (Int_t jMix=0; jMix<pool2->GetCurrentNEvents(); jMix++) |
761 | { | |
762 | // STEP 6 | |
408d1ac9 | 763 | if (!fSkipStep6) |
764 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks, pool2->GetEvent(jMix), 1.0 / pool2->GetCurrentNEvents(), (jMix == 0)); | |
932155c7 | 765 | |
766 | // two track cut, STEP 8 | |
767 | if (fTwoTrackEfficiencyCut > 0) | |
768 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracks, pool2->GetEvent(jMix), 1.0 / pool2->GetCurrentNEvents(), (jMix == 0), kTRUE, bSign, fTwoTrackEfficiencyCut); | |
408d1ac9 | 769 | |
770 | // apply correction efficiency, STEP 10 | |
418b56c5 | 771 | if (fEfficiencyCorrectionTriggers || fEfficiencyCorrectionAssociated) |
408d1ac9 | 772 | { |
773 | // with or without two track efficiency depending on if fTwoTrackEfficiencyCut is set | |
774 | Bool_t twoTrackCut = (fTwoTrackEfficiencyCut > 0); | |
775 | ||
776 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepCorrected, tracks, pool2->GetEvent(jMix), 1.0 / pool2->GetCurrentNEvents(), (jMix == 0), twoTrackCut, bSign, fTwoTrackEfficiencyCut, kTRUE); | |
777 | } | |
932155c7 | 778 | } |
408d1ac9 | 779 | } |
3f3f12d9 | 780 | pool2->UpdatePool(CloneAndReduceTrackList(tracksCorrelate)); |
8781a433 | 781 | } |
408d1ac9 | 782 | |
85bfac17 | 783 | if (0 && !fReduceMemoryFootprint) |
2a910c25 | 784 | { |
785 | // make list of secondaries (matched with MC) | |
786 | TObjArray* tracksRecoMatchedSecondaries = new TObjArray; | |
b0d56b29 | 787 | for (Int_t i=0; i<tracksRecoMatchedAll->GetEntriesFast(); i++) |
2a910c25 | 788 | if (((AliAODMCParticle*)tracksRecoMatchedAll->At(i))->IsPhysicalPrimary() == kFALSE) |
789 | tracksRecoMatchedSecondaries->Add(tracksRecoMatchedAll->At(i)); | |
790 | ||
791 | // Study: Use only secondaries as trigger particles and plot the correlation vs. all particles; store in step 9 | |
c05ff6be | 792 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy2, tracksRecoMatchedSecondaries, tracksRecoMatchedAll, weight); |
2a910c25 | 793 | |
794 | // Study: Use only primaries as trigger particles and plot the correlation vs. secondaries; store in step 8 | |
c05ff6be | 795 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksRecoMatchedPrim, tracksRecoMatchedSecondaries, weight); |
2a910c25 | 796 | |
797 | // plot delta phi vs process id of secondaries | |
798 | // trigger particles: primaries in 4 < pT < 10 | |
799 | // associated particles: secondaries in 1 < pT < 10 | |
800 | ||
b0d56b29 | 801 | for (Int_t i=0; i<tracksRecoMatchedPrim->GetEntriesFast(); i++) |
2a910c25 | 802 | { |
803 | AliVParticle* triggerParticle = (AliVParticle*) tracksRecoMatchedPrim->At(i); | |
804 | ||
805 | if (triggerParticle->Pt() < 4 || triggerParticle->Pt() > 10) | |
806 | continue; | |
807 | ||
b0d56b29 | 808 | for (Int_t j=0; j<tracksRecoMatchedSecondaries->GetEntriesFast(); j++) |
2a910c25 | 809 | { |
810 | AliAODMCParticle* particle = (AliAODMCParticle*) tracksRecoMatchedSecondaries->At(j); | |
811 | ||
812 | if (particle->Pt() < 1 || particle->Pt() > 10) | |
813 | continue; | |
814 | ||
815 | if (particle->Pt() > triggerParticle->Pt()) | |
816 | continue; | |
817 | ||
818 | Double_t deltaPhi = triggerParticle->Phi() - particle->Phi(); | |
819 | if (deltaPhi > 1.5 * TMath::Pi()) | |
820 | deltaPhi -= TMath::TwoPi(); | |
821 | if (deltaPhi < -0.5 * TMath::Pi()) | |
822 | deltaPhi += TMath::TwoPi(); | |
823 | ||
824 | Int_t processID = fMcEvent->Stack()->Particle(particle->GetLabel())->GetUniqueID(); | |
825 | ||
826 | ((TH2F*) fListOfHistos->FindObject("processIDs"))->Fill(deltaPhi, processID); | |
827 | } | |
828 | } | |
829 | ||
830 | delete tracksRecoMatchedSecondaries; | |
831 | } | |
832 | ||
3f3f12d9 | 833 | if (tracksCorrelateRecoMatchedPrim != tracksRecoMatchedPrim) |
834 | delete tracksCorrelateRecoMatchedPrim; | |
2a910c25 | 835 | delete tracksRecoMatchedPrim; |
3f3f12d9 | 836 | |
837 | if (tracksCorrelateRecoMatchedAll != tracksRecoMatchedAll) | |
838 | delete tracksCorrelateRecoMatchedAll; | |
2a910c25 | 839 | delete tracksRecoMatchedAll; |
3f3f12d9 | 840 | |
841 | if (tracksCorrelate != tracks) | |
842 | delete tracksCorrelate; | |
2a910c25 | 843 | delete tracks; |
844 | } | |
845 | } | |
846 | ||
3f3f12d9 | 847 | if (tracksMC != tracksCorrelateMC) |
848 | delete tracksCorrelateMC; | |
2a910c25 | 849 | delete tracksMC; |
e0331fd9 | 850 | } |
851 | ||
852 | //____________________________________________________________________ | |
853 | void AliAnalysisTaskPhiCorrelations::AnalyseDataMode() | |
854 | { | |
855 | ||
856 | // Run the analysis on DATA or MC to get raw distributions | |
857 | ||
e0331fd9 | 858 | if ( fDebug > 3 ) AliInfo( " Processing event in Data mode ..." ); |
e0331fd9 | 859 | |
c066889a | 860 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(0); |
861 | ||
2a910c25 | 862 | if (!fInputHandler) |
863 | return; | |
864 | ||
5e053cad | 865 | // skip not selected events here (the AOD is not updated for those) |
d728f490 | 866 | if (!fSkipTrigger && !(fInputHandler->IsEventSelected() & fSelectBit)) |
2a910c25 | 867 | return; |
51d0a028 | 868 | |
869 | // skip fast cluster events here if requested | |
8a368fc2 | 870 | if (fSkipFastCluster && (fInputHandler->IsEventSelected() & AliVEvent::kFastOnly)) |
51d0a028 | 871 | return; |
6e84bd0a | 872 | |
72b62cb8 | 873 | // Support for ESD and AOD based analysis |
874 | AliVEvent* inputEvent = fAOD; | |
875 | if (!inputEvent) | |
876 | inputEvent = fESD; | |
877 | ||
2a910c25 | 878 | Double_t centrality = 0; |
879 | ||
c3294f09 | 880 | AliCentrality *centralityObj = 0; |
2a910c25 | 881 | if (fCentralityMethod.Length() > 0) |
882 | { | |
d728f490 | 883 | if (fCentralityMethod == "ZNA_MANUAL") |
884 | { | |
9894bedd | 885 | Bool_t zna = kFALSE; |
886 | for(Int_t j = 0; j < 4; ++j) { | |
887 | if (fESD->GetZDCData()->GetZDCTDCData(12,j) != 0) { | |
888 | zna = kTRUE; | |
889 | } | |
890 | } | |
891 | ||
892 | // Printf("%d %f", zna, fZNAtower[0]); | |
893 | if (zna) | |
894 | { | |
895 | // code from Chiara O (23.10.12) | |
896 | const Double_t *fZNAtower = fESD->GetZDCData()->GetZN2TowerEnergy(); | |
72b62cb8 | 897 | Float_t znacut[4] = {681., 563., 413., 191.}; |
898 | ||
9894bedd | 899 | if(fZNAtower[0]>znacut[0]) centrality = 1; |
72b62cb8 | 900 | else if(fZNAtower[0]>znacut[1]) centrality = 21; |
901 | else if(fZNAtower[0]>znacut[2]) centrality = 41; | |
902 | else if(fZNAtower[0]>znacut[3]) centrality = 61; | |
903 | else centrality = 81; | |
9894bedd | 904 | } |
905 | else | |
906 | centrality = -1; | |
d728f490 | 907 | } |
72b62cb8 | 908 | else if (fCentralityMethod == "TRACKS_MANUAL") |
909 | { | |
910 | // for pp | |
911 | TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, -1, kTRUE); | |
912 | centrality = tracks->GetEntriesFast(); | |
913 | if (centrality > 40) | |
914 | centrality = 41; | |
915 | // Printf("%d %f", tracks->GetEntriesFast(), centrality); | |
916 | delete tracks; | |
917 | } | |
2a910c25 | 918 | else |
a6d82f4e | 919 | { |
d728f490 | 920 | if (fAOD) |
921 | centralityObj = fAOD->GetHeader()->GetCentralityP(); | |
922 | else if (fESD) | |
923 | centralityObj = fESD->GetCentrality(); | |
924 | ||
925 | if (centralityObj) | |
926 | centrality = centralityObj->GetCentralityPercentile(fCentralityMethod); | |
927 | //centrality = centralityObj->GetCentralityPercentileUnchecked(fCentralityMethod); | |
928 | else | |
929 | centrality = -1; | |
930 | ||
931 | if (fAOD) | |
a6d82f4e | 932 | { |
d728f490 | 933 | // remove outliers |
934 | if (centrality == 0) | |
a6d82f4e | 935 | { |
d728f490 | 936 | if (fAOD->GetVZEROData()) |
a6d82f4e | 937 | { |
d728f490 | 938 | Float_t multV0 = 0; |
939 | for (Int_t i=0; i<64; i++) | |
940 | multV0 += fAOD->GetVZEROData()->GetMultiplicity(i); | |
941 | if (multV0 < 19500) | |
942 | { | |
943 | centrality = -1; | |
944 | AliInfo("Rejecting event due to too small V0 multiplicity"); | |
945 | } | |
a6d82f4e | 946 | } |
947 | } | |
948 | } | |
949 | } | |
950 | ||
a8583211 | 951 | AliInfo(Form("Centrality is %f", centrality)); |
2a910c25 | 952 | } |
953 | ||
04af8d15 | 954 | Float_t bSign = (inputEvent->GetMagneticField() > 0) ? 1 : -1; |
955 | ||
85bfac17 | 956 | fHistos->SetRunNumber(inputEvent->GetRunNumber()); |
957 | ||
2a910c25 | 958 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut |
959 | fHistos->FillEvent(centrality, AliUEHist::kCFStepAll); | |
960 | ||
e0331fd9 | 961 | // Trigger selection ************************************************ |
d728f490 | 962 | if (!fSkipTrigger && !fAnalyseUE->TriggerSelection(fInputHandler)) return; |
6e84bd0a | 963 | |
e0331fd9 | 964 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut |
2a910c25 | 965 | fHistos->FillEvent(centrality, AliUEHist::kCFStepTriggered); |
e0331fd9 | 966 | |
6e84bd0a | 967 | // Pileup selection ************************************************ |
968 | if (fAnalysisUtils && fAnalysisUtils->IsPileUpEvent(inputEvent)) | |
969 | { | |
970 | // count the removed events | |
971 | fHistos->FillEvent(centrality, AliUEHist::kCFStepAnaTopology); | |
972 | ||
973 | return; | |
974 | } | |
975 | ||
e0331fd9 | 976 | // Vertex selection ************************************************* |
85bfac17 | 977 | if(!fAnalyseUE->VertexSelection(inputEvent, fnTracksVertex, fZVertex)) return; |
e0331fd9 | 978 | |
979 | // Fill the "event-counting-container", it is needed to get the number of events remaining after each event-selection cut | |
2a910c25 | 980 | fHistos->FillEvent(centrality, AliUEHist::kCFStepVertex); |
e0331fd9 | 981 | |
c3294f09 | 982 | // optimization |
1d53fb34 | 983 | if (centrality < 0) |
2a910c25 | 984 | return; |
e0331fd9 | 985 | |
5c9b9fa6 | 986 | TObjArray* tracks = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, fParticleSpeciesTrigger, kTRUE); |
636a6c1d | 987 | //Printf("Accepted %d tracks", tracks->GetEntries()); |
5e053cad | 988 | |
989 | // check for outlier in centrality vs number of tracks (rough constants extracted from correlation histgram) | |
990 | Bool_t reject = kFALSE; | |
991 | if (fRejectCentralityOutliers) | |
992 | { | |
993 | if (centrality > 40 && centrality <= 50 && tracks->GetEntriesFast() > 1160) | |
994 | reject = kTRUE; | |
995 | if (centrality > 50 && centrality <= 60 && tracks->GetEntriesFast() > 650) | |
996 | reject = kTRUE; | |
997 | if (centrality > 60 && centrality <= 70 && tracks->GetEntriesFast() > 370) | |
998 | reject = kTRUE; | |
999 | if (centrality > 70 && centrality <= 80 && tracks->GetEntriesFast() > 220) | |
1000 | reject = kTRUE; | |
1001 | if (centrality > 80 && centrality <= 90 && tracks->GetEntriesFast() > 130) | |
1002 | reject = kTRUE; | |
1003 | if (centrality > 90 && tracks->GetEntriesFast() > 75) | |
1004 | reject = kTRUE; | |
1005 | } | |
1006 | ||
1007 | if (reject) | |
1008 | { | |
1009 | AliInfo(Form("Rejecting event due to centrality vs tracks correlation: %f %d", centrality, tracks->GetEntriesFast())); | |
1010 | fHistos->FillEvent(centrality, AliUEHist::kCFStepAnaTopology); | |
1011 | delete tracks; | |
1012 | return; | |
1013 | } | |
3bbad7c1 | 1014 | |
636a6c1d | 1015 | // correlate particles with... |
1016 | TObjArray* tracksCorrelate = 0; | |
5c9b9fa6 | 1017 | if (fParticleSpeciesAssociated != fParticleSpeciesTrigger) |
1018 | tracksCorrelate = fAnalyseUE->GetAcceptedParticles(inputEvent, 0, kTRUE, fParticleSpeciesAssociated, kTRUE); | |
636a6c1d | 1019 | |
3bbad7c1 | 1020 | // reference multiplicity |
1021 | Int_t referenceMultiplicity = -1; | |
1022 | if (fESD) | |
1023 | referenceMultiplicity = AliESDtrackCuts::GetReferenceMultiplicity(fESD); | |
3f3f12d9 | 1024 | else if (fAOD) |
1025 | referenceMultiplicity = tracks->GetEntriesFast(); // TODO to be replaced by the estimator once available in the AOD | |
418b56c5 | 1026 | // referenceMultiplicity = fAOD->GetHeader()->GetRefMultiplicityComb05(); |
5e053cad | 1027 | |
3bbad7c1 | 1028 | ((TH2F*) fListOfHistos->FindObject("referenceMultiplicity"))->Fill(centrality, referenceMultiplicity); |
5e053cad | 1029 | |
85bfac17 | 1030 | const AliVVertex* vertex = inputEvent->GetPrimaryVertex(); |
2a910c25 | 1031 | Double_t zVtx = vertex->GetZ(); |
1032 | ||
c05ff6be | 1033 | Float_t weight = 1; |
1034 | if (fFillpT) | |
1035 | weight = -1; | |
1036 | ||
c3294f09 | 1037 | // Fill containers at STEP 6 (reconstructed) |
1038 | if (centrality >= 0) | |
c066889a | 1039 | { |
a26093ba | 1040 | if (!fSkipStep6) |
636a6c1d | 1041 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracks, tracksCorrelate, weight, kTRUE, kFALSE, 0, 0.02, kTRUE); |
a26093ba | 1042 | |
c066889a | 1043 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(1); |
04af8d15 | 1044 | |
d4b3dbfc | 1045 | if (fTwoTrackEfficiencyCut > 0) |
636a6c1d | 1046 | fHistos->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracks, tracksCorrelate, weight, kTRUE, kTRUE, bSign, fTwoTrackEfficiencyCut, kTRUE); |
c066889a | 1047 | } |
c3294f09 | 1048 | |
636a6c1d | 1049 | // create a list of reduced objects. This speeds up processing and reduces memory consumption for the event pool |
1050 | TObjArray* tracksClone = CloneAndReduceTrackList(tracks); | |
1051 | delete tracks; | |
1052 | ||
eed401dc | 1053 | if (fFillMixed) |
e0331fd9 | 1054 | { |
eed401dc | 1055 | // event mixing |
2a910c25 | 1056 | |
eed401dc | 1057 | // 1. First get an event pool corresponding in mult (cent) and |
1058 | // zvertex to the current event. Once initialized, the pool | |
1059 | // should contain nMix (reduced) events. This routine does not | |
1060 | // pre-scan the chain. The first several events of every chain | |
1061 | // will be skipped until the needed pools are filled to the | |
1062 | // specified depth. If the pool categories are not too rare, this | |
1063 | // should not be a problem. If they are rare, you could lose | |
1064 | // statistics. | |
1065 | ||
1066 | // 2. Collect the whole pool's content of tracks into one TObjArray | |
1067 | // (bgTracks), which is effectively a single background super-event. | |
1068 | ||
1069 | // 3. The reduced and bgTracks arrays must both be passed into | |
1070 | // FillCorrelations(). Also nMix should be passed in, so a weight | |
1071 | // of 1./nMix can be applied. | |
1072 | ||
1073 | AliEventPool* pool = fPoolMgr->GetEventPool(centrality, zVtx); | |
1074 | ||
1075 | if (!pool) | |
1076 | AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centrality, zVtx)); | |
1077 | ||
f0df9076 | 1078 | // pool->SetDebug(1); |
2d7827bf | 1079 | |
f0df9076 | 1080 | if (pool->IsReady()) |
eed401dc | 1081 | { |
1082 | ||
1083 | Int_t nMix = pool->GetCurrentNEvents(); | |
a1c31636 | 1084 | // cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl; |
c066889a | 1085 | |
1086 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(2); | |
5614e02f | 1087 | ((TH2F*) fListOfHistos->FindObject("mixedDist"))->Fill(centrality, pool->NTracksInPool()); |
c066889a | 1088 | if (pool->IsReady()) |
1089 | ((TH1F*) fListOfHistos->FindObject("eventStat"))->Fill(3); | |
eed401dc | 1090 | |
1091 | // Fill mixed-event histos here | |
c05ff6be | 1092 | for (Int_t jMix=0; jMix<nMix; jMix++) |
1093 | { | |
eed401dc | 1094 | TObjArray* bgTracks = pool->GetEvent(jMix); |
c5c840c5 | 1095 | |
a26093ba | 1096 | if (!fSkipStep6) |
408d1ac9 | 1097 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepReconstructed, tracksClone, bgTracks, 1.0 / nMix, (jMix == 0), kFALSE, 0, 0.02, kTRUE); |
c5c840c5 | 1098 | |
d4b3dbfc | 1099 | if (fTwoTrackEfficiencyCut > 0) |
408d1ac9 | 1100 | fHistosMixed->FillCorrelations(centrality, zVtx, AliUEHist::kCFStepBiasStudy, tracksClone, bgTracks, 1.0 / nMix, (jMix == 0), kTRUE, bSign, fTwoTrackEfficiencyCut, kTRUE); |
eed401dc | 1101 | } |
e0331fd9 | 1102 | } |
eed401dc | 1103 | |
04af8d15 | 1104 | // ownership is with the pool now |
636a6c1d | 1105 | if (tracksCorrelate) |
1106 | { | |
1107 | pool->UpdatePool(CloneAndReduceTrackList(tracksCorrelate)); | |
1108 | delete tracksClone; | |
1109 | } | |
1110 | else | |
1111 | pool->UpdatePool(tracksClone); | |
eed401dc | 1112 | //pool->PrintInfo(); |
e0331fd9 | 1113 | } |
04af8d15 | 1114 | else |
636a6c1d | 1115 | { |
04af8d15 | 1116 | delete tracksClone; |
636a6c1d | 1117 | if (tracksCorrelate) |
1118 | delete tracksCorrelate; | |
1119 | } | |
e0331fd9 | 1120 | } |
1121 | ||
7a028750 | 1122 | TObjArray* AliAnalysisTaskPhiCorrelations::CloneAndReduceTrackList(TObjArray* tracks) |
1123 | { | |
1124 | // clones a track list by using AliDPhiBasicParticle which uses much less memory (used for event mixing) | |
1125 | ||
1126 | TObjArray* tracksClone = new TObjArray; | |
1127 | tracksClone->SetOwner(kTRUE); | |
1128 | ||
b0d56b29 | 1129 | for (Int_t i=0; i<tracks->GetEntriesFast(); i++) |
7a028750 | 1130 | { |
1d53fb34 | 1131 | AliVParticle* particle = (AliVParticle*) tracks->UncheckedAt(i); |
1132 | AliDPhiBasicParticle* copy = new AliDPhiBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge()); | |
1133 | copy->SetUniqueID(particle->GetUniqueID()); | |
1134 | tracksClone->Add(copy); | |
7a028750 | 1135 | } |
1136 | ||
1137 | return tracksClone; | |
1138 | } | |
1139 | ||
e0331fd9 | 1140 | //____________________________________________________________________ |
1141 | void AliAnalysisTaskPhiCorrelations::Initialize() | |
1142 | { | |
1143 | // input handler | |
1144 | fInputHandler = (AliInputEventHandler*) | |
1145 | ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); | |
1146 | // MC handler | |
1147 | fMcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
1148 | } | |
d6a8903f | 1149 | |
1150 | //____________________________________________________________________ | |
1151 | void AliAnalysisTaskPhiCorrelations::RemoveDuplicates(TObjArray* tracks) | |
1152 | { | |
1153 | // remove particles with the same label | |
1154 | ||
1155 | Int_t before = tracks->GetEntriesFast(); | |
1156 | ||
1157 | for (Int_t i=0; i<before; ++i) | |
1158 | { | |
1159 | AliVParticle* part = (AliVParticle*) tracks->At(i); | |
1160 | ||
1161 | for (Int_t j=i+1; j<before; ++j) | |
1162 | { | |
1163 | AliVParticle* part2 = (AliVParticle*) tracks->At(j); | |
1164 | ||
1165 | if (part->GetLabel() == part2->GetLabel()) | |
1166 | { | |
1167 | Printf("Removing %d with label %d (duplicated in %d)", i, part->GetLabel(), j); part->Dump(); part2->Dump(); | |
1168 | TObject* object = tracks->RemoveAt(i); | |
1169 | if (tracks->IsOwner()) | |
1170 | delete object; | |
1171 | break; | |
1172 | } | |
1173 | } | |
1174 | } | |
1175 | ||
1176 | tracks->Compress(); | |
1177 | ||
1178 | if (before > tracks->GetEntriesFast()) | |
1179 | AliInfo(Form("Reduced from %d to %d", before, tracks->GetEntriesFast())); | |
1180 | } | |
3f3f12d9 | 1181 | |
1182 | void AliAnalysisTaskPhiCorrelations::CleanUp(TObjArray* tracks, TObject* mcObj, Int_t maxLabel) | |
1183 | { | |
1184 | // calls RemoveInjectedSignals, RemoveWeakDecays and RemoveDuplicates | |
1185 | ||
59375a30 | 1186 | if (!tracks) |
1187 | return; | |
1188 | ||
3f3f12d9 | 1189 | if (fInjectedSignals) |
1190 | fAnalyseUE->RemoveInjectedSignals(tracks, mcObj, maxLabel); | |
1191 | if (fRemoveWeakDecays) | |
1192 | fAnalyseUE->RemoveWeakDecays(tracks, mcObj); | |
1193 | if (fRemoveDuplicates) | |
1194 | RemoveDuplicates(tracks); | |
1195 | } | |
29cfdb5f | 1196 | |
1197 | //____________________________________________________________________ | |
1198 | void AliAnalysisTaskPhiCorrelations::SelectCharge(TObjArray* tracks) | |
1199 | { | |
1200 | // remove particles with charge not selected (depending on fTriggerSelectCharge) | |
1201 | ||
59375a30 | 1202 | if (!tracks) |
1203 | return; | |
1204 | ||
29cfdb5f | 1205 | Int_t before = tracks->GetEntriesFast(); |
1206 | ||
1207 | for (Int_t i=0; i<before; ++i) | |
1208 | { | |
1209 | AliVParticle* part = (AliVParticle*) tracks->At(i); | |
1210 | ||
1211 | if (part->Charge() * fTriggerSelectCharge < -1) | |
1212 | { | |
1213 | // Printf("Removing %d with charge %d", i, part->Charge()); | |
1214 | TObject* object = tracks->RemoveAt(i); | |
1215 | if (tracks->IsOwner()) | |
1216 | delete object; | |
1217 | } | |
1218 | } | |
1219 | ||
1220 | tracks->Compress(); | |
1221 | ||
1222 | if (before > tracks->GetEntriesFast()) | |
1223 | AliInfo(Form("Reduced from %d to %d", before, tracks->GetEntriesFast())); | |
1224 | } |