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