]>
Commit | Line | Data |
---|---|---|
bcb6ffdb | 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 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
17 | // | |
18 | // Modified version of AliAnalysisTaskCheckCascade.cxx. | |
19 | // This is a 'hybrid' output version, in that it uses a classic TTree | |
20 | // ROOT object to store the candidates, plus a couple of histograms filled on | |
21 | // a per-event basis for storing variables too numerous to put in a tree. | |
22 | // | |
23 | // --- Adapted to look for lambdas as well, using code from | |
24 | // AliAnalysisTaskCheckPerformanceStrange.cxx | |
25 | // | |
26 | // --- Algorithm Description | |
27 | // 1. Loop over primaries in stack to acquire generated charged Xi | |
28 | // 2. Loop over stack to find V0s, fill TH3Fs "PrimRawPt"s for Efficiency | |
29 | // 3. Perform Physics Selection | |
30 | // 4. Perform Primary Vertex |z|<10cm selection | |
31 | // 5. Perform Primary Vertex NoTPCOnly vertexing selection (>0 contrib.) | |
32 | // 6. Perform Pileup Rejection | |
33 | // 7. Analysis Loops: | |
34 | // 7a. Fill TH3Fs "PrimAnalysisPt" for control purposes only | |
35 | // 7b. Fill TTree object with V0 information, candidates | |
36 | // | |
37 | // Please Report Any Bugs! | |
38 | // | |
39 | // --- David Dobrigkeit Chinellato | |
40 | // (david.chinellato@gmail.com) | |
41 | // | |
42 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
43 | ||
44 | class TTree; | |
45 | class TParticle; | |
46 | class TVector3; | |
47 | ||
48 | //class AliMCEventHandler; | |
49 | //class AliMCEvent; | |
50 | //class AliStack; | |
51 | ||
52 | class AliESDVertex; | |
53 | class AliAODVertex; | |
54 | class AliESDv0; | |
55 | class AliAODv0; | |
56 | ||
57 | #include <Riostream.h> | |
58 | #include "TList.h" | |
59 | #include "TH1.h" | |
60 | #include "TH2.h" | |
61 | #include "TH3.h" | |
62 | #include "TFile.h" | |
63 | #include "THnSparse.h" | |
64 | #include "TVector3.h" | |
65 | #include "TCanvas.h" | |
66 | #include "TMath.h" | |
67 | #include "TLegend.h" | |
68 | #include "AliLog.h" | |
69 | ||
70 | #include "AliESDEvent.h" | |
71 | #include "AliAODEvent.h" | |
72 | #include "AliV0vertexer.h" | |
73 | #include "AliCascadeVertexer.h" | |
74 | #include "AliESDpid.h" | |
75 | #include "AliESDtrack.h" | |
76 | #include "AliESDtrackCuts.h" | |
77 | #include "AliInputEventHandler.h" | |
78 | #include "AliAnalysisManager.h" | |
79 | #include "AliMCEventHandler.h" | |
80 | #include "AliMCEvent.h" | |
81 | #include "AliStack.h" | |
82 | ||
83 | #include "AliCFContainer.h" | |
84 | #include "AliMultiplicity.h" | |
85 | #include "AliAODMCParticle.h" | |
86 | #include "AliESDcascade.h" | |
87 | #include "AliAODcascade.h" | |
88 | #include "AliESDUtils.h" | |
89 | ||
90 | #include "AliAnalysisTaskExtractPerformanceV0.h" | |
91 | ||
c64cb1f6 | 92 | using std::cout; |
93 | using std::endl; | |
94 | ||
bcb6ffdb | 95 | ClassImp(AliAnalysisTaskExtractPerformanceV0) |
96 | ||
97 | AliAnalysisTaskExtractPerformanceV0::AliAnalysisTaskExtractPerformanceV0() | |
548bd092 | 98 | : AliAnalysisTaskSE(), fListHistV0(0), fTree(0), fPIDResponse(0), |
99 | fkIsNuclear ( kFALSE ), | |
100 | fkLowEnergyPP ( kFALSE ), | |
101 | fkUseOnTheFly ( kFALSE ), | |
bcb6ffdb | 102 | |
103 | //------------------------------------------------ | |
104 | // HISTOGRAMS | |
105 | // --- Filled on an Event-by-event basis | |
106 | //------------------------------------------------ | |
107 | fHistV0MultiplicityBeforeTrigSel(0), | |
108 | fHistV0MultiplicityForTrigEvt(0), | |
109 | fHistV0MultiplicityForSelEvt(0), | |
110 | fHistV0MultiplicityForSelEvtNoTPCOnly(0), | |
111 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0), | |
ac159816 | 112 | fHistMultiplicityBeforeTrigSel(0), |
113 | fHistMultiplicityForTrigEvt(0), | |
bcb6ffdb | 114 | fHistMultiplicity(0), |
115 | fHistMultiplicityNoTPCOnly(0), | |
116 | fHistMultiplicityNoTPCOnlyNoPileup(0), | |
117 | ||
118 | //------------------------------------------------ | |
119 | // PARTICLE HISTOGRAMS | |
120 | // --- Filled on a Particle-by-Particle basis | |
121 | //------------------------------------------------ | |
122 | f3dHistPrimAnalysisPtVsYVsMultLambda(0), | |
123 | f3dHistPrimAnalysisPtVsYVsMultAntiLambda(0), | |
124 | f3dHistPrimAnalysisPtVsYVsMultK0Short(0), | |
125 | f3dHistPrimRawPtVsYVsMultLambda(0), | |
126 | f3dHistPrimRawPtVsYVsMultAntiLambda(0), | |
127 | f3dHistPrimRawPtVsYVsMultK0Short(0), | |
128 | f3dHistPrimRawPtVsYVsDecayLengthLambda(0), | |
129 | f3dHistPrimRawPtVsYVsDecayLengthAntiLambda(0), | |
130 | f3dHistPrimRawPtVsYVsDecayLengthK0Short(0), | |
131 | f3dHistGenPtVsYVsMultXiMinus(0), | |
132 | f3dHistGenPtVsYVsMultXiPlus(0), | |
133 | fHistPVx(0), | |
134 | fHistPVy(0), | |
135 | fHistPVz(0), | |
136 | fHistPVxAnalysis(0), | |
137 | fHistPVyAnalysis(0), | |
138 | fHistPVzAnalysis(0), | |
139 | fHistPVxAnalysisHasHighPtLambda(0), | |
140 | fHistPVyAnalysisHasHighPtLambda(0), | |
4f8ed367 | 141 | fHistPVzAnalysisHasHighPtLambda(0), |
142 | fHistSwappedV0Counter(0) | |
bcb6ffdb | 143 | { |
144 | // Dummy Constructor | |
145 | } | |
146 | ||
147 | AliAnalysisTaskExtractPerformanceV0::AliAnalysisTaskExtractPerformanceV0(const char *name) | |
548bd092 | 148 | : AliAnalysisTaskSE(name), fListHistV0(0), fTree(0), fPIDResponse(0), |
149 | fkIsNuclear ( kFALSE ), | |
150 | fkLowEnergyPP ( kFALSE ), | |
151 | fkUseOnTheFly ( kFALSE ), | |
bcb6ffdb | 152 | |
153 | //------------------------------------------------ | |
154 | // HISTOGRAMS | |
155 | // --- Filled on an Event-by-event basis | |
156 | //------------------------------------------------ | |
157 | fHistV0MultiplicityBeforeTrigSel(0), | |
158 | fHistV0MultiplicityForTrigEvt(0), | |
159 | fHistV0MultiplicityForSelEvt(0), | |
160 | fHistV0MultiplicityForSelEvtNoTPCOnly(0), | |
161 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0), | |
ac159816 | 162 | fHistMultiplicityBeforeTrigSel(0), |
163 | fHistMultiplicityForTrigEvt(0), | |
bcb6ffdb | 164 | fHistMultiplicity(0), |
165 | fHistMultiplicityNoTPCOnly(0), | |
166 | fHistMultiplicityNoTPCOnlyNoPileup(0), | |
167 | ||
168 | ||
169 | //------------------------------------------------ | |
170 | // PARTICLE HISTOGRAMS | |
171 | // --- Filled on a Particle-by-Particle basis | |
172 | //------------------------------------------------ | |
173 | f3dHistPrimAnalysisPtVsYVsMultLambda(0), | |
174 | f3dHistPrimAnalysisPtVsYVsMultAntiLambda(0), | |
175 | f3dHistPrimAnalysisPtVsYVsMultK0Short(0), | |
176 | f3dHistPrimRawPtVsYVsMultLambda(0), | |
177 | f3dHistPrimRawPtVsYVsMultAntiLambda(0), | |
178 | f3dHistPrimRawPtVsYVsMultK0Short(0), | |
179 | f3dHistPrimRawPtVsYVsDecayLengthLambda(0), | |
180 | f3dHistPrimRawPtVsYVsDecayLengthAntiLambda(0), | |
181 | f3dHistPrimRawPtVsYVsDecayLengthK0Short(0), | |
182 | f3dHistGenPtVsYVsMultXiMinus(0), | |
183 | f3dHistGenPtVsYVsMultXiPlus(0), | |
184 | fHistPVx(0), | |
185 | fHistPVy(0), | |
186 | fHistPVz(0), | |
187 | fHistPVxAnalysis(0), | |
188 | fHistPVyAnalysis(0), | |
189 | fHistPVzAnalysis(0), | |
190 | fHistPVxAnalysisHasHighPtLambda(0), | |
191 | fHistPVyAnalysisHasHighPtLambda(0), | |
4f8ed367 | 192 | fHistPVzAnalysisHasHighPtLambda(0), |
193 | fHistSwappedV0Counter(0) | |
bcb6ffdb | 194 | { |
195 | // Constructor | |
196 | // Output slot #0 writes into a TList container (Cascade) | |
197 | DefineOutput(1, TList::Class()); | |
198 | DefineOutput(2, TTree::Class()); | |
199 | } | |
200 | ||
201 | ||
202 | AliAnalysisTaskExtractPerformanceV0::~AliAnalysisTaskExtractPerformanceV0() | |
203 | { | |
204 | //------------------------------------------------ | |
205 | // DESTRUCTOR | |
206 | //------------------------------------------------ | |
207 | ||
208 | if (fListHistV0){ | |
209 | delete fListHistV0; | |
210 | fListHistV0 = 0x0; | |
211 | } | |
212 | if (fTree){ | |
213 | delete fTree; | |
214 | fTree = 0x0; | |
215 | } | |
216 | } | |
217 | ||
218 | //________________________________________________________________________ | |
219 | void AliAnalysisTaskExtractPerformanceV0::UserCreateOutputObjects() | |
220 | { | |
bcb6ffdb | 221 | |
eff0b6fc | 222 | OpenFile(2); |
bcb6ffdb | 223 | // Called once |
eff0b6fc | 224 | fTree = new TTree("fTree","V0Candidates"); |
bcb6ffdb | 225 | |
226 | //------------------------------------------------ | |
227 | // fTree Branch definitions | |
228 | //------------------------------------------------ | |
229 | ||
230 | //-----------BASIC-INFO--------------------------- | |
231 | /* 1*/ fTree->Branch("fTreeVariablePrimaryStatus",&fTreeVariablePrimaryStatus,"fTreeVariablePrimaryStatus/I"); | |
232 | /* 1*/ fTree->Branch("fTreeVariablePrimaryStatusMother",&fTreeVariablePrimaryStatusMother,"fTreeVariablePrimaryStatusMother/I"); | |
233 | /* 2*/ fTree->Branch("fTreeVariableChi2V0",&fTreeVariableChi2V0,"Chi2V0/F"); | |
234 | /* 3*/ fTree->Branch("fTreeVariableDcaV0Daughters",&fTreeVariableDcaV0Daughters,"fTreeVariableDcaV0Daughters/F"); | |
235 | /* 4*/ fTree->Branch("fTreeVariableDcaPosToPrimVertex",&fTreeVariableDcaPosToPrimVertex,"fTreeVariableDcaPosToPrimVertex/F"); | |
236 | /* 5*/ fTree->Branch("fTreeVariableDcaNegToPrimVertex",&fTreeVariableDcaNegToPrimVertex,"fTreeVariableDcaNegToPrimVertex/F"); | |
237 | /* 6*/ fTree->Branch("fTreeVariableV0Radius",&fTreeVariableV0Radius,"fTreeVariableV0Radius/F"); | |
238 | /* 7*/ fTree->Branch("fTreeVariablePt",&fTreeVariablePt,"fTreeVariablePt/F"); | |
239 | /* 7*/ fTree->Branch("fTreeVariablePtMC",&fTreeVariablePtMC,"fTreeVariablePtMC/F"); | |
240 | /* 8*/ fTree->Branch("fTreeVariableRapK0Short",&fTreeVariableRapK0Short,"fTreeVariableRapK0Short/F"); | |
241 | /* 9*/ fTree->Branch("fTreeVariableRapLambda",&fTreeVariableRapLambda,"fTreeVariableRapLambda/F"); | |
242 | /*10*/ fTree->Branch("fTreeVariableRapMC",&fTreeVariableRapMC,"fTreeVariableRapMC/F"); | |
243 | /*11*/ fTree->Branch("fTreeVariableInvMassK0s",&fTreeVariableInvMassK0s,"fTreeVariableInvMassK0s/F"); | |
244 | /*12*/ fTree->Branch("fTreeVariableInvMassLambda",&fTreeVariableInvMassLambda,"fTreeVariableInvMassLambda/F"); | |
245 | /*13*/ fTree->Branch("fTreeVariableInvMassAntiLambda",&fTreeVariableInvMassAntiLambda,"fTreeVariableInvMassAntiLambda/F"); | |
246 | /*14*/ fTree->Branch("fTreeVariableAlphaV0",&fTreeVariableAlphaV0,"fTreeVariableAlphaV0/F"); | |
247 | /*15*/ fTree->Branch("fTreeVariablePtArmV0",&fTreeVariablePtArmV0,"fTreeVariablePtArmV0/F"); | |
248 | /*16*/ fTree->Branch("fTreeVariableNegTransvMomentum",&fTreeVariableNegTransvMomentum,"fTreeVariableNegTransvMomentum/F"); | |
249 | /*17*/ fTree->Branch("fTreeVariablePosTransvMomentum",&fTreeVariablePosTransvMomentum,"fTreeVariablePosTransvMomentum/F"); | |
250 | /*18*/ fTree->Branch("fTreeVariableNegTransvMomentumMC",&fTreeVariableNegTransvMomentumMC,"fTreeVariableNegTransvMomentumMC/F"); | |
251 | /*19*/ fTree->Branch("fTreeVariablePosTransvMomentumMC",&fTreeVariablePosTransvMomentumMC,"fTreeVariablePosTransvMomentumMC/F"); | |
252 | /*20*/ fTree->Branch("fTreeVariableLeastNbrCrossedRows",&fTreeVariableLeastNbrCrossedRows,"fTreeVariableLeastNbrCrossedRows/I"); | |
253 | /*21*/ fTree->Branch("fTreeVariableLeastRatioCrossedRowsOverFindable",&fTreeVariableLeastRatioCrossedRowsOverFindable,"fTreeVariableLeastRatioCrossedRowsOverFindable/F"); | |
254 | /*22*/ fTree->Branch("fTreeVariablePID",&fTreeVariablePID,"fTreeVariablePID/I"); | |
255 | /*23*/ fTree->Branch("fTreeVariablePIDPositive",&fTreeVariablePIDPositive,"fTreeVariablePIDPositive/I"); | |
256 | /*24*/ fTree->Branch("fTreeVariablePIDNegative",&fTreeVariablePIDNegative,"fTreeVariablePIDNegative/I"); | |
257 | /*25*/ fTree->Branch("fTreeVariablePIDMother",&fTreeVariablePIDMother,"fTreeVariablePIDMother/I"); | |
258 | /*26*/ fTree->Branch("fTreeVariablePtXiMother",&fTreeVariablePtMother,"fTreeVariablePtMother/F"); | |
259 | /*27*/ fTree->Branch("fTreeVariableV0CosineOfPointingAngle",&fTreeVariableV0CosineOfPointingAngle,"fTreeVariableV0CosineOfPointingAngle/F"); | |
260 | //-----------MULTIPLICITY-INFO-------------------- | |
261 | /*28*/ fTree->Branch("fTreeVariableMultiplicity",&fTreeVariableMultiplicity,"fTreeVariableMultiplicity/I"); | |
262 | //------------------------------------------------ | |
263 | /*29*/ fTree->Branch("fTreeVariableDistOverTotMom",&fTreeVariableDistOverTotMom,"fTreeVariableDistOverTotMom/F"); | |
264 | /*30*/ fTree->Branch("fTreeVariableNSigmasPosProton",&fTreeVariableNSigmasPosProton,"fTreeVariableNSigmasPosProton/F"); | |
265 | /*31*/ fTree->Branch("fTreeVariableNSigmasPosPion",&fTreeVariableNSigmasPosPion,"fTreeVariableNSigmasPosPion/F"); | |
266 | /*32*/ fTree->Branch("fTreeVariableNSigmasNegProton",&fTreeVariableNSigmasNegProton,"fTreeVariableNSigmasNegProton/F"); | |
267 | /*33*/ fTree->Branch("fTreeVariableNSigmasNegPion",&fTreeVariableNSigmasNegPion,"fTreeVariableNSigmasNegPion/F"); | |
268 | //------------------------------------------------ | |
269 | /*34*/ fTree->Branch("fTreeVariableNegEta",&fTreeVariableNegEta,"fTreeVariableNegEta/F"); | |
270 | /*35*/ fTree->Branch("fTreeVariablePosEta",&fTreeVariablePosEta,"fTreeVariablePosEta/F"); | |
271 | /*36*/ fTree->Branch("fTreeVariableV0CreationRadius",&fTreeVariableV0CreationRadius,"fTreeVariableV0CreationRadius/F"); | |
272 | /*37*/ fTree->Branch("fTreeVariableIndexStatus",&fTreeVariableIndexStatus,"fTreeVariableIndexStatus/I"); | |
273 | /*38*/ fTree->Branch("fTreeVariableIndexStatusMother",&fTreeVariableIndexStatusMother,"fTreeVariableIndexStatusMother/I"); | |
274 | ||
bcb6ffdb | 275 | //------------------------------------------------ |
276 | // Particle Identification Setup | |
277 | //------------------------------------------------ | |
278 | ||
279 | AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager(); | |
280 | AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler()); | |
281 | fPIDResponse = inputHandler->GetPIDResponse(); | |
282 | ||
283 | //------------------------------------------------ | |
284 | // V0 Multiplicity Histograms | |
285 | //------------------------------------------------ | |
286 | ||
eff0b6fc | 287 | // Create histograms |
288 | OpenFile(1); | |
289 | fListHistV0 = new TList(); | |
290 | fListHistV0->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner | |
291 | ||
292 | ||
bcb6ffdb | 293 | if(! fHistV0MultiplicityBeforeTrigSel) { |
294 | fHistV0MultiplicityBeforeTrigSel = new TH1F("fHistV0MultiplicityBeforeTrigSel", | |
295 | "V0s per event (before Trig. Sel.);Nbr of V0s/Evt;Events", | |
296 | 25, 0, 25); | |
297 | fListHistV0->Add(fHistV0MultiplicityBeforeTrigSel); | |
298 | } | |
299 | ||
300 | if(! fHistV0MultiplicityForTrigEvt) { | |
301 | fHistV0MultiplicityForTrigEvt = new TH1F("fHistV0MultiplicityForTrigEvt", | |
302 | "V0s per event (for triggered evt);Nbr of V0s/Evt;Events", | |
303 | 25, 0, 25); | |
304 | fListHistV0->Add(fHistV0MultiplicityForTrigEvt); | |
305 | } | |
306 | ||
307 | if(! fHistV0MultiplicityForSelEvt) { | |
308 | fHistV0MultiplicityForSelEvt = new TH1F("fHistV0MultiplicityForSelEvt", | |
309 | "V0s per event;Nbr of V0s/Evt;Events", | |
310 | 25, 0, 25); | |
311 | fListHistV0->Add(fHistV0MultiplicityForSelEvt); | |
312 | } | |
313 | ||
314 | if(! fHistV0MultiplicityForSelEvtNoTPCOnly) { | |
315 | fHistV0MultiplicityForSelEvtNoTPCOnly = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnly", | |
316 | "V0s per event;Nbr of V0s/Evt;Events", | |
317 | 25, 0, 25); | |
318 | fListHistV0->Add(fHistV0MultiplicityForSelEvtNoTPCOnly); | |
319 | } | |
320 | if(! fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup) { | |
321 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup", | |
322 | "V0s per event;Nbr of V0s/Evt;Events", | |
323 | 25, 0, 25); | |
324 | fListHistV0->Add(fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup); | |
325 | } | |
326 | ||
327 | //------------------------------------------------ | |
328 | // Track Multiplicity Histograms | |
329 | //------------------------------------------------ | |
330 | ||
331 | if(! fHistMultiplicityBeforeTrigSel) { | |
332 | fHistMultiplicityBeforeTrigSel = new TH1F("fHistMultiplicityBeforeTrigSel", | |
333 | "Tracks per event;Nbr of Tracks;Events", | |
334 | 200, 0, 200); | |
335 | fListHistV0->Add(fHistMultiplicityBeforeTrigSel); | |
336 | } | |
337 | if(! fHistMultiplicityForTrigEvt) { | |
338 | fHistMultiplicityForTrigEvt = new TH1F("fHistMultiplicityForTrigEvt", | |
339 | "Tracks per event;Nbr of Tracks;Events", | |
340 | 200, 0, 200); | |
341 | fListHistV0->Add(fHistMultiplicityForTrigEvt); | |
342 | } | |
343 | if(! fHistMultiplicity) { | |
344 | fHistMultiplicity = new TH1F("fHistMultiplicity", | |
345 | "Tracks per event;Nbr of Tracks;Events", | |
346 | 200, 0, 200); | |
347 | fListHistV0->Add(fHistMultiplicity); | |
348 | } | |
349 | if(! fHistMultiplicityNoTPCOnly) { | |
350 | fHistMultiplicityNoTPCOnly = new TH1F("fHistMultiplicityNoTPCOnly", | |
351 | "Tracks per event;Nbr of Tracks;Events", | |
352 | 200, 0, 200); | |
353 | fListHistV0->Add(fHistMultiplicityNoTPCOnly); | |
354 | } | |
355 | if(! fHistMultiplicityNoTPCOnlyNoPileup) { | |
356 | fHistMultiplicityNoTPCOnlyNoPileup = new TH1F("fHistMultiplicityNoTPCOnlyNoPileup", | |
357 | "Tracks per event;Nbr of Tracks;Events", | |
358 | 200, 0, 200); | |
359 | fListHistV0->Add(fHistMultiplicityNoTPCOnlyNoPileup); | |
360 | } | |
361 | ||
362 | //------------------------------------------------ | |
363 | // Generated Particle Histograms | |
364 | //------------------------------------------------ | |
365 | ||
366 | Int_t lCustomNBins = 200; | |
367 | Double_t lCustomPtUpperLimit = 20; | |
368 | Int_t lCustomNBinsMultiplicity = 100; | |
369 | ||
370 | //---------------------------------- | |
371 | // Raw Generated (Pre-physics-selection) | |
372 | //---------------------------------- | |
373 | ||
374 | //--- 3D Histo (Pt, Y, Multiplicity) | |
375 | ||
376 | if(! f3dHistPrimRawPtVsYVsMultLambda) { | |
377 | f3dHistPrimRawPtVsYVsMultLambda = new TH3F( "f3dHistPrimRawPtVsYVsMultLambda", "Pt_{lambda} Vs Y_{#Lambda} Vs Multiplicity; Pt_{lambda} (GeV/c); Y_{#Lambda} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
378 | fListHistV0->Add(f3dHistPrimRawPtVsYVsMultLambda); | |
379 | } | |
380 | if(! f3dHistPrimRawPtVsYVsMultAntiLambda) { | |
381 | f3dHistPrimRawPtVsYVsMultAntiLambda = new TH3F( "f3dHistPrimRawPtVsYVsMultAntiLambda", "Pt_{antilambda} Vs Y_{#Lambda} Vs Multiplicity; Pt_{antilambda} (GeV/c); Y_{#Lambda} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
382 | fListHistV0->Add(f3dHistPrimRawPtVsYVsMultAntiLambda); | |
383 | } | |
384 | if(! f3dHistPrimRawPtVsYVsMultK0Short) { | |
385 | f3dHistPrimRawPtVsYVsMultK0Short = new TH3F( "f3dHistPrimRawPtVsYVsMultK0Short", "Pt_{K0S} Vs Y_{K0S} Vs Multiplicity; Pt_{K0S} (GeV/c); Y_{K0S} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
386 | fListHistV0->Add(f3dHistPrimRawPtVsYVsMultK0Short); | |
387 | } | |
388 | ||
389 | //--- 3D Histo (Pt, Y, Proper Decay Length) | |
390 | ||
391 | if(! f3dHistPrimRawPtVsYVsDecayLengthLambda) { | |
392 | f3dHistPrimRawPtVsYVsDecayLengthLambda = new TH3F( "f3dHistPrimRawPtVsYVsDecayLengthLambda", "Pt_{lambda} Vs Y_{#Lambda} Vs DecayLength; Pt_{lambda} (GeV/c); Y_{#Lambda} ; DecayLength", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,200,0,50); | |
393 | fListHistV0->Add(f3dHistPrimRawPtVsYVsDecayLengthLambda); | |
394 | } | |
395 | if(! f3dHistPrimRawPtVsYVsDecayLengthAntiLambda) { | |
396 | f3dHistPrimRawPtVsYVsDecayLengthAntiLambda = new TH3F( "f3dHistPrimRawPtVsYVsDecayLengthAntiLambda", "Pt_{antilambda} Vs Y_{#Lambda} Vs DecayLength; Pt_{antilambda} (GeV/c); Y_{#Lambda} ; DecayLength", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,200,0,50); | |
397 | fListHistV0->Add(f3dHistPrimRawPtVsYVsDecayLengthAntiLambda); | |
398 | } | |
399 | if(! f3dHistPrimRawPtVsYVsDecayLengthK0Short) { | |
400 | f3dHistPrimRawPtVsYVsDecayLengthK0Short = new TH3F( "f3dHistPrimRawPtVsYVsDecayLengthK0Short", "Pt_{K0S} Vs Y_{K0S} Vs DecayLength; Pt_{K0S} (GeV/c); Y_{K0S} ; DecayLength", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,200,0,50); | |
401 | fListHistV0->Add(f3dHistPrimRawPtVsYVsDecayLengthK0Short); | |
402 | } | |
403 | ||
404 | //--- 3D Histo (Pt, Y, Multiplicity) for generated charged Xi (feeddown) | |
405 | ||
406 | if(! f3dHistGenPtVsYVsMultXiMinus) { | |
407 | f3dHistGenPtVsYVsMultXiMinus = new TH3F( "f3dHistGenPtVsYVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
408 | fListHistV0->Add(f3dHistGenPtVsYVsMultXiMinus); | |
409 | } | |
410 | if(! f3dHistGenPtVsYVsMultXiPlus) { | |
411 | f3dHistGenPtVsYVsMultXiPlus = new TH3F( "f3dHistGenPtVsYVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
412 | fListHistV0->Add(f3dHistGenPtVsYVsMultXiPlus); | |
413 | } | |
414 | ||
415 | //---------------------------------- | |
416 | // Histos at analysis level | |
417 | //---------------------------------- | |
418 | ||
419 | if(! f3dHistPrimAnalysisPtVsYVsMultLambda) { | |
420 | f3dHistPrimAnalysisPtVsYVsMultLambda = new TH3F( "f3dHistPrimAnalysisPtVsYVsMultLambda", "Pt_{lambda} Vs Y_{#Lambda} Vs Multiplicity; Pt_{lambda} (GeV/c); Y_{#Lambda} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
421 | fListHistV0->Add(f3dHistPrimAnalysisPtVsYVsMultLambda); | |
422 | } | |
423 | if(! f3dHistPrimAnalysisPtVsYVsMultAntiLambda) { | |
424 | f3dHistPrimAnalysisPtVsYVsMultAntiLambda = new TH3F( "f3dHistPrimAnalysisPtVsYVsMultAntiLambda", "Pt_{antilambda} Vs Y_{#Lambda} Vs Multiplicity; Pt_{antilambda} (GeV/c); Y_{#Lambda} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
425 | fListHistV0->Add(f3dHistPrimAnalysisPtVsYVsMultAntiLambda); | |
426 | } | |
427 | if(! f3dHistPrimAnalysisPtVsYVsMultK0Short) { | |
428 | f3dHistPrimAnalysisPtVsYVsMultK0Short = new TH3F( "f3dHistPrimAnalysisPtVsYVsMultK0Short", "Pt_{K0S} Vs Y_{K0S} Vs Multiplicity; Pt_{K0S} (GeV/c); Y_{K0S} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity); | |
429 | fListHistV0->Add(f3dHistPrimAnalysisPtVsYVsMultK0Short); | |
430 | } | |
431 | ||
432 | //---------------------------------- | |
433 | // Primary Vertex Position Histos | |
434 | //---------------------------------- | |
435 | ||
436 | if(! fHistPVx) { | |
437 | fHistPVx = new TH1F("fHistPVx", | |
438 | "PV x position;Nbr of Evts;x", | |
439 | 2000, -0.5, 0.5); | |
440 | fListHistV0->Add(fHistPVx); | |
441 | } | |
442 | if(! fHistPVy) { | |
443 | fHistPVy = new TH1F("fHistPVy", | |
444 | "PV y position;Nbr of Evts;y", | |
445 | 2000, -0.5, 0.5); | |
446 | fListHistV0->Add(fHistPVy); | |
447 | } | |
448 | if(! fHistPVz) { | |
449 | fHistPVz = new TH1F("fHistPVz", | |
450 | "PV z position;Nbr of Evts;z", | |
451 | 400, -20, 20); | |
452 | fListHistV0->Add(fHistPVz); | |
453 | } | |
454 | ||
455 | if(! fHistPVxAnalysis) { | |
456 | fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", | |
457 | "PV x position;Nbr of Evts;x", | |
458 | 2000, -0.5, 0.5); | |
459 | fListHistV0->Add(fHistPVxAnalysis); | |
460 | } | |
461 | if(! fHistPVyAnalysis) { | |
462 | fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", | |
463 | "PV y position;Nbr of Evts;y", | |
464 | 2000, -0.5, 0.5); | |
465 | fListHistV0->Add(fHistPVyAnalysis); | |
466 | } | |
467 | if(! fHistPVzAnalysis) { | |
468 | fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", | |
469 | "PV z position;Nbr of Evts;z", | |
470 | 400, -20, 20); | |
471 | fListHistV0->Add(fHistPVzAnalysis); | |
472 | } | |
473 | ||
474 | if(! fHistPVxAnalysisHasHighPtLambda) { | |
475 | fHistPVxAnalysisHasHighPtLambda = new TH1F("fHistPVxAnalysisHasHighPtLambda", | |
476 | "PV x position;Nbr of Evts;x", | |
477 | 2000, -0.5, 0.5); | |
478 | fListHistV0->Add(fHistPVxAnalysisHasHighPtLambda); | |
479 | } | |
480 | if(! fHistPVyAnalysisHasHighPtLambda) { | |
481 | fHistPVyAnalysisHasHighPtLambda = new TH1F("fHistPVyAnalysisHasHighPtLambda", | |
482 | "PV y position;Nbr of Evts;y", | |
483 | 2000, -0.5, 0.5); | |
484 | fListHistV0->Add(fHistPVyAnalysisHasHighPtLambda); | |
485 | } | |
486 | if(! fHistPVzAnalysisHasHighPtLambda) { | |
487 | fHistPVzAnalysisHasHighPtLambda = new TH1F("fHistPVzAnalysisHasHighPtLambda", | |
488 | "PV z position;Nbr of Evts;z", | |
489 | 400, -20, 20); | |
490 | fListHistV0->Add(fHistPVzAnalysisHasHighPtLambda); | |
491 | } | |
4f8ed367 | 492 | if(! fHistSwappedV0Counter) { |
493 | fHistSwappedV0Counter = new TH1F("fHistSwappedV0Counter", | |
494 | "Swap or not histo;Swapped (1) or not (0); count", | |
495 | 2, 0, 2); | |
496 | fListHistV0->Add(fHistSwappedV0Counter); | |
497 | } | |
498 | ||
bcb6ffdb | 499 | //List of Histograms: Normal |
500 | PostData(1, fListHistV0); | |
501 | ||
502 | //TTree Object: Saved to base directory. Should cache to disk while saving. | |
503 | //(Important to avoid excessive memory usage, particularly when merging) | |
504 | PostData(2, fTree); | |
505 | ||
506 | }// end UserCreateOutputObjects | |
507 | ||
508 | ||
509 | //________________________________________________________________________ | |
510 | void AliAnalysisTaskExtractPerformanceV0::UserExec(Option_t *) | |
511 | { | |
512 | // Main loop | |
513 | // Called for each event | |
514 | ||
515 | AliESDEvent *lESDevent = 0x0; | |
516 | AliMCEvent *lMCevent = 0x0; | |
517 | AliStack *lMCstack = 0x0; | |
518 | ||
519 | Int_t lNumberOfV0s = -1; | |
520 | Double_t lTrkgPrimaryVtxPos[3] = {-100.0, -100.0, -100.0}; | |
521 | Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0}; | |
522 | Double_t lMagneticField = -10.; | |
523 | ||
524 | // Connect to the InputEvent | |
525 | // After these lines, we should have an ESD/AOD event + the number of V0s in it. | |
526 | ||
527 | // Appropriate for ESD analysis! | |
528 | ||
529 | lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() ); | |
530 | if (!lESDevent) { | |
531 | AliWarning("ERROR: lESDevent not available \n"); | |
532 | return; | |
533 | } | |
534 | ||
535 | lMCevent = MCEvent(); | |
536 | if (!lMCevent) { | |
537 | Printf("ERROR: Could not retrieve MC event \n"); | |
538 | cout << "Name of the file with pb :" << fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl; | |
539 | return; | |
540 | } | |
541 | ||
542 | lMCstack = lMCevent->Stack(); | |
543 | if (!lMCstack) { | |
544 | Printf("ERROR: Could not retrieve MC stack \n"); | |
545 | cout << "Name of the file with pb :" << fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl; | |
546 | return; | |
547 | } | |
548 | ||
549 | //------------------------------------------------ | |
550 | // Multiplicity Information Acquistion | |
551 | //------------------------------------------------ | |
552 | ||
4f8ed367 | 553 | //REVISED multiplicity estimator after 'multiplicity day' (2011) |
554 | Int_t lMultiplicity = -100; | |
555 | ||
ad0d3645 | 556 | //testing purposes |
4f8ed367 | 557 | if(fkIsNuclear == kFALSE) lMultiplicity = AliESDtrackCuts::GetReferenceMultiplicity( lESDevent ); |
bcb6ffdb | 558 | |
548bd092 | 559 | //---> If this is a nuclear collision, then go nuclear on "multiplicity" variable... |
560 | //---> Warning: Experimental | |
561 | if(fkIsNuclear == kTRUE){ | |
562 | AliCentrality* centrality; | |
563 | centrality = lESDevent->GetCentrality(); | |
564 | lMultiplicity = ( ( Int_t ) ( centrality->GetCentralityPercentile( "V0M" ) ) ); | |
565 | if (centrality->GetQuality()>1) { | |
566 | PostData(1, fListHistV0); | |
567 | PostData(2, fTree); | |
568 | return; | |
569 | } | |
570 | } | |
571 | ||
572 | //Set variable for filling tree afterwards! | |
573 | //---> pp case......: GetReferenceMultiplicity | |
574 | //---> Pb-Pb case...: Centrality by V0M | |
575 | fTreeVariableMultiplicity = lMultiplicity; | |
576 | ||
bcb6ffdb | 577 | fHistV0MultiplicityBeforeTrigSel->Fill ( lESDevent->GetNumberOfV0s() ); |
578 | fHistMultiplicityBeforeTrigSel->Fill ( lMultiplicity ); | |
579 | ||
580 | //------------------------------------------------ | |
581 | // MC Information Acquistion | |
582 | //------------------------------------------------ | |
583 | ||
584 | Int_t iNumberOfPrimaries = -1; | |
585 | iNumberOfPrimaries = lMCstack->GetNprimary(); | |
586 | if(iNumberOfPrimaries < 1) return; | |
587 | Bool_t lHasHighPtLambda = kFALSE; | |
588 | ||
589 | //------------------------------------------------ | |
590 | // Variable Definition | |
591 | //------------------------------------------------ | |
592 | ||
593 | Int_t lNbMCPrimary = 0; | |
594 | ||
595 | Int_t lPdgcodeCurrentPart = 0; | |
596 | Double_t lRapCurrentPart = 0; | |
597 | Double_t lPtCurrentPart = 0; | |
598 | ||
599 | //Int_t lComeFromSigma = 0; | |
600 | ||
601 | // current mc particle 's mother | |
602 | //Int_t iCurrentMother = 0; | |
603 | lNbMCPrimary = lMCstack->GetNprimary(); | |
604 | ||
605 | //------------------------------------------------ | |
606 | // Pre-Physics Selection | |
607 | //------------------------------------------------ | |
608 | ||
609 | //----- Loop on primary Xi, Omega -------------------------------------------------------------- | |
610 | for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++) | |
611 | {// This is the begining of the loop on primaries | |
612 | ||
613 | TParticle* lCurrentParticlePrimary = 0x0; | |
614 | lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack ); | |
615 | if(!lCurrentParticlePrimary){ | |
616 | Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack ); | |
617 | continue; | |
618 | } | |
ad0d3645 | 619 | if ( TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3312 ) { |
620 | Double_t lRapXiMCPrimary = -100; | |
621 | if( (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) != 0 ) { | |
622 | if ( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) !=0 ){ | |
623 | lRapXiMCPrimary = 0.5*TMath::Log( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) ); | |
624 | } | |
625 | } | |
bcb6ffdb | 626 | |
627 | //================================================================================= | |
628 | // Xi Histograms for Feeddown - Primary Charged Xis | |
629 | if( lCurrentParticlePrimary->GetPdgCode() == 3312 ){ | |
630 | lPtCurrentPart = lCurrentParticlePrimary->Pt(); | |
631 | f3dHistGenPtVsYVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity); | |
632 | } | |
633 | if( lCurrentParticlePrimary->GetPdgCode() == -3312 ){ | |
634 | lPtCurrentPart = lCurrentParticlePrimary->Pt(); | |
635 | f3dHistGenPtVsYVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity); | |
636 | } | |
637 | } | |
638 | } | |
639 | //----- End Loop on primary Xi, Omega ---------------------------------------------------------- | |
640 | ||
641 | //----- Loop on Lambda, K0Short ---------------------------------------------------------------- | |
642 | for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < (lMCstack->GetNtrack()); iCurrentLabelStack++) | |
643 | {// This is the begining of the loop on tracks | |
644 | ||
645 | TParticle* lCurrentParticleForLambdaCheck = 0x0; | |
646 | lCurrentParticleForLambdaCheck = lMCstack->Particle( iCurrentLabelStack ); | |
647 | if(!lCurrentParticleForLambdaCheck){ | |
648 | Printf("V0s loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack ); | |
649 | continue; | |
650 | } | |
651 | ||
652 | //================================================================================= | |
653 | //Single-Strange checks | |
654 | // Keep only K0s, Lambda and AntiLambda: | |
655 | lPdgcodeCurrentPart = lCurrentParticleForLambdaCheck->GetPdgCode(); | |
656 | ||
657 | if ( (lCurrentParticleForLambdaCheck->GetPdgCode() == 310 ) || | |
658 | (lCurrentParticleForLambdaCheck->GetPdgCode() == 3122 ) || | |
659 | (lCurrentParticleForLambdaCheck->GetPdgCode() == -3122 ) ) | |
660 | { | |
661 | lRapCurrentPart = MyRapidity(lCurrentParticleForLambdaCheck->Energy(),lCurrentParticleForLambdaCheck->Pz()); | |
662 | lPtCurrentPart = lCurrentParticleForLambdaCheck->Pt(); | |
663 | ||
664 | //Use Physical Primaries only for filling PrimRaw Histograms! | |
665 | if ( lMCstack->IsPhysicalPrimary(iCurrentLabelStack)!=kTRUE ) continue; | |
666 | ||
667 | if( lPdgcodeCurrentPart == 3122 ){ | |
668 | f3dHistPrimRawPtVsYVsMultLambda->Fill(lPtCurrentPart, lRapCurrentPart, lMultiplicity); | |
669 | if( TMath::Abs( lCurrentParticleForLambdaCheck->Eta() )<1.2 && lPtCurrentPart>2 ){ | |
670 | lHasHighPtLambda = kTRUE; //Keep track of events with Lambda within |eta|<1.2 and pt>2 | |
671 | } | |
672 | } | |
673 | if( lPdgcodeCurrentPart == -3122 ){ | |
674 | f3dHistPrimRawPtVsYVsMultAntiLambda->Fill(lPtCurrentPart, lRapCurrentPart, lMultiplicity); | |
675 | } | |
676 | if( lPdgcodeCurrentPart == 310 ){ | |
677 | f3dHistPrimRawPtVsYVsMultK0Short->Fill(lPtCurrentPart, lRapCurrentPart, lMultiplicity); | |
678 | } | |
679 | //Decay Length Acquisition===================================================== | |
680 | Double_t decaylength = -1; | |
681 | Double_t lV0Mass = -1; | |
682 | ||
683 | if( !(lCurrentParticleForLambdaCheck->GetDaughter(0) < 0) ) { | |
684 | TParticle* lDght0ofV0 = lMCstack->Particle( lCurrentParticleForLambdaCheck->GetDaughter(0) ); //get first daughter | |
685 | if(lDght0ofV0){ // skip if not defined. | |
686 | decaylength = TMath::Sqrt( | |
687 | TMath::Power( lCurrentParticleForLambdaCheck->Vx() - lDght0ofV0->Vx() , 2) + | |
688 | TMath::Power( lCurrentParticleForLambdaCheck->Vy() - lDght0ofV0->Vy() , 2) + | |
689 | TMath::Power( lCurrentParticleForLambdaCheck->Vz() - lDght0ofV0->Vz() , 2) | |
690 | ); | |
691 | //Need to correct for relativitity! Involves multiplying by mass and dividing by momentum. | |
692 | if(TMath::Abs( lPdgcodeCurrentPart ) == 3122 ) { lV0Mass = 1.115683; } | |
693 | if(TMath::Abs( lPdgcodeCurrentPart ) == 310 ) { lV0Mass = 0.497614; } | |
ad0d3645 | 694 | if( lCurrentParticleForLambdaCheck->P() + 1e-10 != 0 ) decaylength = ( lV0Mass * decaylength ) / ( lCurrentParticleForLambdaCheck->P() + 1e-10 ); |
695 | if( lCurrentParticleForLambdaCheck->P() + 1e-10 == 0 ) decaylength = 1e+5; | |
bcb6ffdb | 696 | } |
697 | } | |
698 | if( lPdgcodeCurrentPart == 3122) f3dHistPrimRawPtVsYVsDecayLengthLambda ->Fill( lPtCurrentPart, lRapCurrentPart , decaylength ); | |
699 | if( lPdgcodeCurrentPart == -3122) f3dHistPrimRawPtVsYVsDecayLengthAntiLambda ->Fill( lPtCurrentPart, lRapCurrentPart , decaylength ); | |
700 | if( lPdgcodeCurrentPart == 310) f3dHistPrimRawPtVsYVsDecayLengthK0Short ->Fill( lPtCurrentPart, lRapCurrentPart , decaylength ); | |
701 | } | |
702 | }//End of loop on tracks | |
703 | //----- End Loop on Lambda, K0Short ------------------------------------------------------------ | |
704 | ||
705 | // ---> Set Variables to Zero again | |
706 | // ---> Variable Definition | |
707 | ||
708 | lPdgcodeCurrentPart = 0; | |
709 | lRapCurrentPart = 0; | |
710 | lPtCurrentPart = 0; | |
711 | ||
712 | //------------------------------------------------ | |
713 | // Physics Selection | |
714 | //------------------------------------------------ | |
715 | ||
716 | UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected(); | |
717 | Bool_t isSelected = 0; | |
718 | isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB; | |
548bd092 | 719 | |
720 | //pp at 2.76TeV: special case, ignore FastOnly | |
721 | if ( (fkLowEnergyPP == kTRUE) && (maskIsSelected& AliVEvent::kFastOnly) ){ | |
722 | PostData(1, fListHistV0); | |
723 | PostData(2, fTree); | |
724 | return; | |
725 | } | |
726 | //Standard Min-Bias Selection | |
bcb6ffdb | 727 | if ( ! isSelected ) { |
728 | PostData(1, fListHistV0); | |
729 | PostData(2, fTree); | |
730 | return; | |
731 | } | |
732 | ||
733 | //------------------------------------------------ | |
734 | // After Trigger Selection | |
735 | //------------------------------------------------ | |
736 | ||
737 | lNumberOfV0s = lESDevent->GetNumberOfV0s(); | |
738 | ||
739 | //Set variable for filling tree afterwards! | |
bcb6ffdb | 740 | fHistV0MultiplicityForTrigEvt->Fill(lNumberOfV0s); |
741 | fHistMultiplicityForTrigEvt->Fill ( lMultiplicity ); | |
742 | ||
743 | //------------------------------------------------ | |
744 | // Getting: Primary Vertex + MagField Info | |
745 | //------------------------------------------------ | |
746 | ||
747 | const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks(); | |
748 | // get the vtx stored in ESD found with tracks | |
749 | lPrimaryTrackingESDVtx->GetXYZ( lTrkgPrimaryVtxPos ); | |
750 | ||
751 | const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex(); | |
752 | // get the best primary vertex available for the event | |
753 | // As done in AliCascadeVertexer, we keep the one which is the best one available. | |
754 | // between : Tracking vertex > SPD vertex > TPC vertex > default SPD vertex | |
755 | // This one will be used for next calculations (DCA essentially) | |
756 | lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos ); | |
757 | ||
758 | Double_t lPrimaryVtxPosition[3]; | |
759 | const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex(); | |
760 | lPrimaryVtxPosition[0] = primaryVtx->GetX(); | |
761 | lPrimaryVtxPosition[1] = primaryVtx->GetY(); | |
762 | lPrimaryVtxPosition[2] = primaryVtx->GetZ(); | |
763 | fHistPVx->Fill( lPrimaryVtxPosition[0] ); | |
764 | fHistPVy->Fill( lPrimaryVtxPosition[1] ); | |
765 | fHistPVz->Fill( lPrimaryVtxPosition[2] ); | |
766 | ||
767 | //------------------------------------------------ | |
768 | // Primary Vertex Z position: SKIP | |
769 | //------------------------------------------------ | |
770 | ||
771 | if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0 ) { | |
772 | AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !"); | |
773 | PostData(1, fListHistV0); | |
774 | PostData(2, fTree); | |
775 | return; | |
776 | } | |
777 | ||
778 | lMagneticField = lESDevent->GetMagneticField( ); | |
779 | fHistV0MultiplicityForSelEvt ->Fill( lNumberOfV0s ); | |
780 | fHistMultiplicity->Fill(lMultiplicity); | |
781 | ||
782 | //------------------------------------------------ | |
783 | // SKIP: Events with well-established PVtx | |
784 | //------------------------------------------------ | |
785 | ||
786 | const AliESDVertex *lPrimaryTrackingESDVtxCheck = lESDevent->GetPrimaryVertexTracks(); | |
787 | const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD(); | |
788 | if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtxCheck->GetStatus() ){ | |
789 | AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !"); | |
790 | PostData(1, fListHistV0); | |
791 | PostData(2, fTree); | |
792 | return; | |
793 | } | |
794 | fHistV0MultiplicityForSelEvtNoTPCOnly ->Fill( lNumberOfV0s ); | |
795 | fHistMultiplicityNoTPCOnly->Fill(lMultiplicity); | |
796 | ||
797 | //------------------------------------------------ | |
798 | // Pileup Rejection Studies | |
799 | //------------------------------------------------ | |
800 | ||
801 | // FIXME : quality selection regarding pile-up rejection | |
4f8ed367 | 802 | if(lESDevent->IsPileupFromSPD() && !fkIsNuclear ){// minContributors=3, minZdist=0.8, nSigmaZdist=3., nSigmaDiamXY=2., nSigmaDiamZ=5. -> see http://alisoft.cern.ch/viewvc/trunk/STEER/AliESDEvent.h?root=AliRoot&r1=41914&r2=42199&pathrev=42199 |
bcb6ffdb | 803 | AliWarning("Pb / This is tagged as Pileup from SPD... return !"); |
804 | PostData(1, fListHistV0); | |
805 | PostData(2, fTree); | |
806 | return; | |
807 | } | |
808 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup ->Fill( lNumberOfV0s ); | |
809 | fHistMultiplicityNoTPCOnlyNoPileup->Fill(lMultiplicity); | |
810 | ||
811 | //Do control histograms without the IsFromVertexerZ events, but consider them in analysis... | |
812 | if( ! (lESDevent->GetPrimaryVertex()->IsFromVertexerZ() ) ){ | |
813 | fHistPVxAnalysis->Fill( lPrimaryVtxPosition[0] ); | |
814 | fHistPVyAnalysis->Fill( lPrimaryVtxPosition[1] ); | |
815 | fHistPVzAnalysis->Fill( lPrimaryVtxPosition[2] ); | |
816 | if ( lHasHighPtLambda == kTRUE ){ | |
817 | fHistPVxAnalysisHasHighPtLambda->Fill( lPrimaryVtxPosition[0] ); | |
818 | fHistPVyAnalysisHasHighPtLambda->Fill( lPrimaryVtxPosition[1] ); | |
819 | fHistPVzAnalysisHasHighPtLambda->Fill( lPrimaryVtxPosition[2] ); | |
820 | } | |
821 | } | |
822 | ||
823 | //------------------------------------------------ | |
824 | // stack loop starts here | |
825 | //------------------------------------------------ | |
826 | ||
827 | //---> Loop over ALL PARTICLES | |
828 | ||
829 | for (Int_t iMc = 0; iMc < (lMCstack->GetNtrack()); iMc++) { | |
830 | TParticle *p0 = lMCstack->Particle(iMc); | |
831 | if (!p0) { | |
832 | //Printf("ERROR: particle with label %d not found in lMCstack (mc loop)", iMc); | |
833 | continue; | |
834 | } | |
835 | lPdgcodeCurrentPart = p0->GetPdgCode(); | |
836 | ||
837 | // Keep only K0s, Lambda and AntiLambda: | |
838 | if ( (lPdgcodeCurrentPart != 310 ) && (lPdgcodeCurrentPart != 3122 ) && (lPdgcodeCurrentPart != -3122 ) ) continue; | |
839 | ||
840 | lRapCurrentPart = MyRapidity(p0->Energy(),p0->Pz()); | |
841 | lPtCurrentPart = p0->Pt(); | |
842 | ||
843 | //Use Physical Primaries only for filling PrimRaw Histograms! | |
844 | if ( lMCstack->IsPhysicalPrimary(iMc)!=kTRUE ) continue; | |
845 | ||
846 | if( lPdgcodeCurrentPart == 3122 ){ | |
847 | f3dHistPrimAnalysisPtVsYVsMultLambda->Fill(lPtCurrentPart, lRapCurrentPart, lMultiplicity); | |
848 | } | |
849 | if( lPdgcodeCurrentPart == -3122 ){ | |
850 | f3dHistPrimAnalysisPtVsYVsMultAntiLambda->Fill(lPtCurrentPart, lRapCurrentPart, lMultiplicity); | |
851 | } | |
852 | if( lPdgcodeCurrentPart == 310 ){ | |
853 | f3dHistPrimAnalysisPtVsYVsMultK0Short->Fill(lPtCurrentPart, lRapCurrentPart, lMultiplicity); | |
854 | } | |
855 | } | |
856 | ||
857 | //------------------------------------------------ | |
858 | // MAIN LAMBDA LOOP STARTS HERE | |
859 | //------------------------------------------------ | |
860 | ||
861 | //Variable definition | |
862 | Int_t lOnFlyStatus = 0; | |
863 | Double_t lChi2V0 = 0; | |
864 | Double_t lDcaV0Daughters = 0, lDcaV0ToPrimVertex = 0; | |
865 | Double_t lDcaPosToPrimVertex = 0, lDcaNegToPrimVertex = 0; | |
866 | Double_t lV0CosineOfPointingAngle = 0; | |
867 | Double_t lV0Radius = 0, lPt = 0; | |
868 | Double_t lRapK0Short = 0, lRapLambda = 0; | |
869 | Double_t lInvMassK0s = 0, lInvMassLambda = 0, lInvMassAntiLambda = 0; | |
870 | Double_t lAlphaV0 = 0, lPtArmV0 = 0; | |
871 | Double_t fMinV0Pt = 0; | |
872 | Double_t fMaxV0Pt = 100; | |
873 | ||
874 | Int_t nv0s = 0; | |
875 | nv0s = lESDevent->GetNumberOfV0s(); | |
876 | ||
877 | for (Int_t iV0 = 0; iV0 < nv0s; iV0++) | |
878 | {// This is the begining of the V0 loop | |
879 | AliESDv0 *v0 = ((AliESDEvent*)lESDevent)->GetV0(iV0); | |
880 | if (!v0) continue; | |
881 | ||
4f8ed367 | 882 | //---> Fix On-the-Fly candidates |
883 | if( v0->GetParamN()->Charge() > 0 && v0->GetParamP()->Charge() < 0 ){ | |
884 | fHistSwappedV0Counter -> Fill( 1 ); | |
885 | }else{ | |
886 | fHistSwappedV0Counter -> Fill( 0 ); | |
887 | } | |
888 | if ( fkUseOnTheFly ) CheckChargeV0(v0); | |
889 | ||
890 | ||
bcb6ffdb | 891 | Double_t tV0mom[3]; |
892 | v0->GetPxPyPz( tV0mom[0],tV0mom[1],tV0mom[2] ); | |
893 | Double_t lV0TotalMomentum = TMath::Sqrt( | |
894 | tV0mom[0]*tV0mom[0]+tV0mom[1]*tV0mom[1]+tV0mom[2]*tV0mom[2] ); | |
895 | ||
896 | Double_t tDecayVertexV0[3]; v0->GetXYZ(tDecayVertexV0[0],tDecayVertexV0[1],tDecayVertexV0[2]); | |
897 | lV0Radius = TMath::Sqrt(tDecayVertexV0[0]*tDecayVertexV0[0]+tDecayVertexV0[1]*tDecayVertexV0[1]); | |
898 | lPt = v0->Pt(); | |
899 | lRapK0Short = v0->RapK0Short(); | |
900 | lRapLambda = v0->RapLambda(); | |
901 | if ((lPt<fMinV0Pt)||(fMaxV0Pt<lPt)) continue; | |
902 | ||
903 | UInt_t lKeyPos = (UInt_t)TMath::Abs(v0->GetPindex()); | |
904 | UInt_t lKeyNeg = (UInt_t)TMath::Abs(v0->GetNindex()); | |
905 | ||
906 | Double_t lMomPos[3]; v0->GetPPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]); | |
907 | Double_t lMomNeg[3]; v0->GetNPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]); | |
908 | ||
909 | AliESDtrack *pTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyPos); | |
910 | AliESDtrack *nTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyNeg); | |
911 | if (!pTrack || !nTrack) { | |
912 | Printf("ERROR: Could not retreive one of the daughter track"); | |
913 | continue; | |
914 | } | |
915 | ||
916 | fTreeVariableNegEta = nTrack->Eta(); | |
917 | fTreeVariablePosEta = pTrack->Eta(); | |
918 | ||
919 | // Filter like-sign V0 (next: add counter and distribution) | |
920 | if ( pTrack->GetSign() == nTrack->GetSign()){ | |
921 | continue; | |
922 | } | |
923 | ||
924 | //________________________________________________________________________ | |
925 | // Track quality cuts | |
926 | Float_t lPosTrackCrossedRows = pTrack->GetTPCClusterInfo(2,1); | |
927 | Float_t lNegTrackCrossedRows = nTrack->GetTPCClusterInfo(2,1); | |
4f8ed367 | 928 | fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows; |
bcb6ffdb | 929 | if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows ) |
4f8ed367 | 930 | fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows; |
bcb6ffdb | 931 | |
932 | // TPC refit condition (done during reconstruction for Offline but not for On-the-fly) | |
933 | if( !(pTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
934 | if( !(nTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
935 | ||
936 | if ( ( ( pTrack->GetTPCClusterInfo(2,1) ) < 70 ) || ( ( nTrack->GetTPCClusterInfo(2,1) ) < 70 ) ) continue; | |
937 | ||
938 | //GetKinkIndex condition | |
939 | if( pTrack->GetKinkIndex(0)>0 || nTrack->GetKinkIndex(0)>0 ) continue; | |
940 | ||
941 | //Findable clusters > 0 condition | |
942 | if( pTrack->GetTPCNclsF()<=0 || nTrack->GetTPCNclsF()<=0 ) continue; | |
943 | ||
944 | //Compute ratio Crossed Rows / Findable clusters | |
945 | //Note: above test avoids division by zero! | |
ad0d3645 | 946 | Float_t lPosTrackCrossedRowsOverFindable = -1; |
947 | Float_t lNegTrackCrossedRowsOverFindable = -1; | |
948 | if ( ((double)(pTrack->GetTPCNclsF()) ) != 0 ) lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF())); | |
949 | if ( ((double)(nTrack->GetTPCNclsF()) ) != 0 ) lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF())); | |
bcb6ffdb | 950 | |
951 | fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable; | |
952 | if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable ) | |
953 | fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable; | |
954 | ||
955 | //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here | |
956 | if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) continue; | |
957 | ||
958 | //End track Quality Cuts | |
959 | //________________________________________________________________________ | |
960 | ||
961 | lDcaPosToPrimVertex = TMath::Abs(pTrack->GetD(lPrimaryVtxPosition[0], | |
962 | lPrimaryVtxPosition[1], | |
963 | lMagneticField) ); | |
964 | ||
965 | lDcaNegToPrimVertex = TMath::Abs(nTrack->GetD(lPrimaryVtxPosition[0], | |
966 | lPrimaryVtxPosition[1], | |
967 | lMagneticField) ); | |
968 | ||
969 | lOnFlyStatus = v0->GetOnFlyStatus(); | |
970 | lChi2V0 = v0->GetChi2V0(); | |
971 | lDcaV0Daughters = v0->GetDcaV0Daughters(); | |
972 | lDcaV0ToPrimVertex = v0->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lPrimaryVtxPosition[2]); | |
973 | lV0CosineOfPointingAngle = v0->GetV0CosineOfPointingAngle(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lPrimaryVtxPosition[2]); | |
974 | fTreeVariableV0CosineOfPointingAngle=lV0CosineOfPointingAngle; | |
975 | ||
976 | // Getting invariant mass infos directly from ESD | |
977 | v0->ChangeMassHypothesis(310); | |
978 | lInvMassK0s = v0->GetEffMass(); | |
979 | v0->ChangeMassHypothesis(3122); | |
980 | lInvMassLambda = v0->GetEffMass(); | |
981 | v0->ChangeMassHypothesis(-3122); | |
982 | lInvMassAntiLambda = v0->GetEffMass(); | |
983 | lAlphaV0 = v0->AlphaV0(); | |
984 | lPtArmV0 = v0->PtArmV0(); | |
985 | ||
986 | //fTreeVariableOnFlyStatus = lOnFlyStatus; | |
987 | //fHistV0OnFlyStatus->Fill(lOnFlyStatus); | |
988 | ||
989 | //=============================================== | |
990 | // Monte Carlo Association starts here | |
991 | //=============================================== | |
992 | ||
993 | //---> Set Everything to "I don't know" before starting | |
994 | ||
995 | fTreeVariablePIDPositive = 0; | |
996 | fTreeVariablePIDNegative = 0; | |
997 | ||
998 | fTreeVariableIndexStatus = 0; | |
999 | fTreeVariableIndexStatusMother = 0; | |
1000 | ||
1001 | fTreeVariablePtMother = -1; | |
1002 | fTreeVariablePtMC = -1; | |
1003 | fTreeVariableRapMC = -100; | |
1004 | ||
1005 | fTreeVariablePID = -1; | |
1006 | fTreeVariablePIDMother = -1; | |
1007 | ||
1008 | fTreeVariablePrimaryStatus = 0; | |
1009 | fTreeVariablePrimaryStatusMother = 0; | |
1010 | fTreeVariableV0CreationRadius = -1; | |
1011 | ||
1012 | Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrack->GetLabel() ); | |
1013 | Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrack->GetLabel() ); | |
1014 | ||
1015 | TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter ); | |
1016 | TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter ); | |
1017 | ||
1018 | fTreeVariablePosTransvMomentumMC = mcPosV0Dghter->Pt(); | |
1019 | fTreeVariableNegTransvMomentumMC = mcNegV0Dghter->Pt(); | |
1020 | ||
1021 | Int_t lPIDPositive = mcPosV0Dghter -> GetPdgCode(); | |
1022 | Int_t lPIDNegative = mcNegV0Dghter -> GetPdgCode(); | |
1023 | ||
1024 | fTreeVariablePIDPositive = lPIDPositive; | |
1025 | fTreeVariablePIDNegative = lPIDNegative; | |
1026 | ||
1027 | Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ; | |
1028 | Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother(); | |
1029 | ||
1030 | if( lblMotherPosV0Dghter == lblMotherNegV0Dghter && lblMotherPosV0Dghter > -1 ){ | |
1031 | //either label is fine, they're equal at this stage | |
1032 | TParticle* pThisV0 = lMCstack->Particle( lblMotherPosV0Dghter ); | |
1033 | //Set tree variables | |
1034 | fTreeVariablePID = pThisV0->GetPdgCode(); //PDG Code | |
1035 | fTreeVariablePtMC = pThisV0->Pt(); //Perfect Pt | |
1036 | //Only Interested if it's a Lambda, AntiLambda or K0s | |
1037 | //Avoid the Junction Bug! PYTHIA has particles with Px=Py=Pz=E=0 occasionally, | |
1038 | //having particle code 88 (unrecognized by PDG), for documentation purposes. | |
1039 | //Even ROOT's TParticle::Y() is not prepared to deal with that exception! | |
1040 | //Note that TParticle::Pt() is immune (that would just return 0)... | |
1041 | //Though granted that that should be extremely rare in this precise condition... | |
1042 | if( TMath::Abs(fTreeVariablePID) == 3122 || fTreeVariablePID==310 ){ | |
1043 | fTreeVariableRapMC = pThisV0->Y(); //Perfect Y | |
1044 | } | |
1045 | fTreeVariableV0CreationRadius = pThisV0->R(); // Creation Radius | |
1046 | if( lblMotherPosV0Dghter < lNbMCPrimary ) fTreeVariableIndexStatus = 1; //looks primary | |
1047 | if( lblMotherPosV0Dghter >= lNbMCPrimary ) fTreeVariableIndexStatus = 2; //looks secondary | |
1048 | if( lMCstack->IsPhysicalPrimary (lblMotherPosV0Dghter) ) fTreeVariablePrimaryStatus = 1; //Is Primary! | |
1049 | if( lMCstack->IsSecondaryFromWeakDecay(lblMotherPosV0Dghter) ) fTreeVariablePrimaryStatus = 2; //Weak Decay! | |
1050 | if( lMCstack->IsSecondaryFromMaterial (lblMotherPosV0Dghter) ) fTreeVariablePrimaryStatus = 3; //Material Int! | |
1051 | ||
1052 | //Now we try to acquire the V0 parent particle, if possible | |
1053 | Int_t lblThisV0Parent = pThisV0->GetFirstMother(); | |
1054 | if ( lblThisV0Parent > -1 ){ //if it has a parent, get it and store specs | |
1055 | TParticle* pThisV0Parent = lMCstack->Particle( lblThisV0Parent ); | |
1056 | fTreeVariablePIDMother = pThisV0Parent->GetPdgCode(); //V0 Mother PDG | |
1057 | fTreeVariablePtMother = pThisV0Parent->Pt(); //V0 Mother Pt | |
1058 | //Primary Status for the V0 Mother particle | |
1059 | if( lblThisV0Parent < lNbMCPrimary ) fTreeVariableIndexStatusMother = 1; //looks primary | |
1060 | if( lblThisV0Parent >= lNbMCPrimary ) fTreeVariableIndexStatusMother = 2; //looks secondary | |
1061 | if( lMCstack->IsPhysicalPrimary (lblThisV0Parent) ) fTreeVariablePrimaryStatusMother = 1; //Is Primary! | |
1062 | if( lMCstack->IsSecondaryFromWeakDecay(lblThisV0Parent) ) fTreeVariablePrimaryStatusMother = 2; //Weak Decay! | |
1063 | if( lMCstack->IsSecondaryFromMaterial (lblThisV0Parent) ) fTreeVariablePrimaryStatusMother = 3; //Material Int! | |
1064 | } | |
1065 | } | |
1066 | ||
1067 | fTreeVariablePt = v0->Pt(); | |
1068 | fTreeVariableChi2V0 = lChi2V0; | |
1069 | fTreeVariableDcaV0ToPrimVertex = lDcaV0ToPrimVertex; | |
1070 | fTreeVariableDcaV0Daughters = lDcaV0Daughters; | |
1071 | fTreeVariableV0CosineOfPointingAngle = lV0CosineOfPointingAngle; | |
1072 | fTreeVariableV0Radius = lV0Radius; | |
1073 | fTreeVariableDcaPosToPrimVertex = lDcaPosToPrimVertex; | |
1074 | fTreeVariableDcaNegToPrimVertex = lDcaNegToPrimVertex; | |
1075 | fTreeVariableInvMassK0s = lInvMassK0s; | |
1076 | fTreeVariableInvMassLambda = lInvMassLambda; | |
1077 | fTreeVariableInvMassAntiLambda = lInvMassAntiLambda; | |
1078 | fTreeVariableRapK0Short = lRapK0Short; | |
1079 | ||
1080 | fTreeVariableRapLambda = lRapLambda; | |
1081 | fTreeVariableAlphaV0 = lAlphaV0; | |
1082 | fTreeVariablePtArmV0 = lPtArmV0; | |
1083 | ||
1084 | //Official means of acquiring N-sigmas | |
1085 | fTreeVariableNSigmasPosProton = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kProton ); | |
1086 | fTreeVariableNSigmasPosPion = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kPion ); | |
1087 | fTreeVariableNSigmasNegProton = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kProton ); | |
1088 | fTreeVariableNSigmasNegPion = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kPion ); | |
1089 | ||
1090 | //tDecayVertexV0[0],tDecayVertexV0[1],tDecayVertexV0[2] | |
1091 | fTreeVariableDistOverTotMom = TMath::Sqrt( | |
1092 | TMath::Power( tDecayVertexV0[0] - lBestPrimaryVtxPos[0] , 2) + | |
1093 | TMath::Power( tDecayVertexV0[1] - lBestPrimaryVtxPos[1] , 2) + | |
1094 | TMath::Power( tDecayVertexV0[2] - lBestPrimaryVtxPos[2] , 2) | |
1095 | ); | |
ad0d3645 | 1096 | fTreeVariableDistOverTotMom = 1e+5; |
1097 | if( lV0TotalMomentum + 1e-10 != 0 ) fTreeVariableDistOverTotMom /= (lV0TotalMomentum + 1e-10); //avoid division by zero, to be sure | |
bcb6ffdb | 1098 | |
1099 | Double_t lMomentumPosTemp[3]; | |
1100 | pTrack->GetPxPyPz(lMomentumPosTemp); | |
1101 | Double_t lPtPosTemporary = sqrt(pow(lMomentumPosTemp[0],2) + pow(lMomentumPosTemp[1],2)); | |
1102 | ||
1103 | Double_t lMomentumNegTemp[3]; | |
1104 | nTrack->GetPxPyPz(lMomentumNegTemp); | |
1105 | Double_t lPtNegTemporary = sqrt(pow(lMomentumNegTemp[0],2) + pow(lMomentumNegTemp[1],2)); | |
1106 | ||
1107 | fTreeVariablePosTransvMomentum = lPtPosTemporary; | |
1108 | fTreeVariableNegTransvMomentum = lPtNegTemporary; | |
1109 | ||
1110 | ||
1111 | //------------------------------------------------ | |
1112 | // Fill Tree! | |
1113 | //------------------------------------------------ | |
1114 | ||
1115 | // The conditionals are meant to decrease excessive | |
1116 | // memory usage! | |
1117 | ||
1118 | //Modified version: Keep only OnFlyStatus == 0 | |
1119 | //Keep only if included in a parametric InvMass Region 20 sigmas away from peak | |
1120 | ||
1121 | //First Selection: Reject OnFly | |
4f8ed367 | 1122 | if( (lOnFlyStatus == 0 && fkUseOnTheFly == kFALSE) || (lOnFlyStatus != 0 && fkUseOnTheFly == kTRUE ) ){ |
bcb6ffdb | 1123 | //Second Selection: rough 20-sigma band, parametric. |
1124 | //K0Short: Enough to parametrize peak broadening with linear function. | |
1125 | Double_t lUpperLimitK0Short = (5.63707e-01) + (1.14979e-02)*fTreeVariablePt; | |
1126 | Double_t lLowerLimitK0Short = (4.30006e-01) - (1.10029e-02)*fTreeVariablePt; | |
1127 | //Lambda: Linear (for higher pt) plus exponential (for low-pt broadening) | |
1128 | //[0]+[1]*x+[2]*TMath::Exp(-[3]*x) | |
1129 | Double_t lUpperLimitLambda = (1.13688e+00) + (5.27838e-03)*fTreeVariablePt + (8.42220e-02)*TMath::Exp(-(3.80595e+00)*fTreeVariablePt); | |
1130 | Double_t lLowerLimitLambda = (1.09501e+00) - (5.23272e-03)*fTreeVariablePt - (7.52690e-02)*TMath::Exp(-(3.46339e+00)*fTreeVariablePt); | |
1131 | //Do Selection | |
1132 | if( (fTreeVariableInvMassLambda < lUpperLimitLambda && fTreeVariableInvMassLambda > lLowerLimitLambda ) || | |
1133 | (fTreeVariableInvMassAntiLambda < lUpperLimitLambda && fTreeVariableInvMassAntiLambda > lLowerLimitLambda ) || | |
1134 | (fTreeVariableInvMassK0s < lUpperLimitK0Short && fTreeVariableInvMassK0s > lLowerLimitK0Short ) ){ | |
4f8ed367 | 1135 | //Pre-selection in case this is AA... |
1136 | if( fkIsNuclear == kFALSE ) fTree->Fill(); | |
1137 | if( fkIsNuclear == kTRUE){ | |
1138 | //If this is a nuclear collision___________________ | |
1139 | // ... pre-filter with daughter eta selection only (not TPC) | |
1140 | if ( TMath::Abs(fTreeVariableNegEta)<0.8 && TMath::Abs(fTreeVariablePosEta)<0.8 ) fTree->Fill(); | |
1141 | }//end nuclear_____________________________________ | |
bcb6ffdb | 1142 | } |
1143 | } | |
1144 | ||
1145 | //------------------------------------------------ | |
1146 | // Fill tree over. | |
1147 | //------------------------------------------------ | |
1148 | ||
1149 | ||
1150 | }// This is the end of the V0 loop | |
1151 | ||
1152 | // Post output data. | |
1153 | PostData(1, fListHistV0); | |
1154 | PostData(2, fTree); | |
1155 | } | |
1156 | ||
1157 | //________________________________________________________________________ | |
1158 | void AliAnalysisTaskExtractPerformanceV0::Terminate(Option_t *) | |
1159 | { | |
1160 | // Draw result to the screen | |
1161 | // Called once at the end of the query | |
1162 | ||
1163 | TList *cRetrievedList = 0x0; | |
1164 | cRetrievedList = (TList*)GetOutputData(1); | |
1165 | if(!cRetrievedList){ | |
1166 | Printf("ERROR - AliAnalysisTaskExtractV0 : ouput data container list not available\n"); | |
1167 | return; | |
1168 | } | |
1169 | ||
1170 | fHistV0MultiplicityForTrigEvt = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistV0MultiplicityForTrigEvt") ); | |
1171 | if (!fHistV0MultiplicityForTrigEvt) { | |
1172 | Printf("ERROR - AliAnalysisTaskExtractV0 : fHistV0MultiplicityForTrigEvt not available"); | |
1173 | return; | |
1174 | } | |
1175 | ||
1176 | TCanvas *canCheck = new TCanvas("AliAnalysisTaskExtractV0","V0 Multiplicity",10,10,510,510); | |
1177 | canCheck->cd(1)->SetLogy(); | |
1178 | ||
1179 | fHistV0MultiplicityForTrigEvt->SetMarkerStyle(22); | |
1180 | fHistV0MultiplicityForTrigEvt->DrawCopy("E"); | |
1181 | } | |
1182 | ||
1183 | //---------------------------------------------------------------------------- | |
1184 | ||
1185 | Double_t AliAnalysisTaskExtractPerformanceV0::MyRapidity(Double_t rE, Double_t rPz) const | |
1186 | { | |
1187 | // Local calculation for rapidity | |
ad0d3645 | 1188 | Double_t ReturnValue = -100; |
1189 | if( (rE-rPz+1.e-13) != 0 && (rE+rPz) != 0 ){ | |
1190 | ReturnValue = 0.5*TMath::Log((rE+rPz)/(rE-rPz+1.e-13)); | |
1191 | } | |
1192 | return ReturnValue; | |
bcb6ffdb | 1193 | } |
4f8ed367 | 1194 | |
1195 | //________________________________________________________________________ | |
1196 | void AliAnalysisTaskExtractPerformanceV0::CheckChargeV0(AliESDv0 *v0) | |
1197 | { | |
1198 | // This function checks charge of negative and positive daughter tracks. | |
1199 | // If incorrectly defined (onfly vertexer), swaps out. | |
1200 | if( v0->GetParamN()->Charge() > 0 && v0->GetParamP()->Charge() < 0 ){ | |
1201 | //V0 daughter track swapping is required! Note: everything is swapped here... P->N, N->P | |
1202 | Long_t lCorrectNidx = v0->GetPindex(); | |
1203 | Long_t lCorrectPidx = v0->GetNindex(); | |
1204 | Double32_t lCorrectNmom[3]; | |
1205 | Double32_t lCorrectPmom[3]; | |
1206 | v0->GetPPxPyPz( lCorrectNmom[0], lCorrectNmom[1], lCorrectNmom[2] ); | |
1207 | v0->GetNPxPyPz( lCorrectPmom[0], lCorrectPmom[1], lCorrectPmom[2] ); | |
1208 | ||
1209 | AliExternalTrackParam lCorrectParamN( | |
1210 | v0->GetParamP()->GetX() , | |
1211 | v0->GetParamP()->GetAlpha() , | |
1212 | v0->GetParamP()->GetParameter() , | |
1213 | v0->GetParamP()->GetCovariance() | |
1214 | ); | |
1215 | AliExternalTrackParam lCorrectParamP( | |
1216 | v0->GetParamN()->GetX() , | |
1217 | v0->GetParamN()->GetAlpha() , | |
1218 | v0->GetParamN()->GetParameter() , | |
1219 | v0->GetParamN()->GetCovariance() | |
1220 | ); | |
1221 | lCorrectParamN.SetMostProbablePt( v0->GetParamP()->GetMostProbablePt() ); | |
1222 | lCorrectParamP.SetMostProbablePt( v0->GetParamN()->GetMostProbablePt() ); | |
1223 | ||
1224 | //Get Variables___________________________________________________ | |
1225 | Double_t lDcaV0Daughters = v0 -> GetDcaV0Daughters(); | |
1226 | Double_t lCosPALocal = v0 -> GetV0CosineOfPointingAngle(); | |
1227 | Bool_t lOnFlyStatusLocal = v0 -> GetOnFlyStatus(); | |
1228 | ||
1229 | //Create Replacement Object_______________________________________ | |
1230 | AliESDv0 *v0correct = new AliESDv0(lCorrectParamN,lCorrectNidx,lCorrectParamP,lCorrectPidx); | |
1231 | v0correct->SetDcaV0Daughters ( lDcaV0Daughters ); | |
1232 | v0correct->SetV0CosineOfPointingAngle ( lCosPALocal ); | |
1233 | v0correct->ChangeMassHypothesis ( kK0Short ); | |
1234 | v0correct->SetOnFlyStatus ( lOnFlyStatusLocal ); | |
1235 | ||
1236 | //Reverse Cluster info..._________________________________________ | |
1237 | v0correct->SetClusters( v0->GetClusters( 1 ), v0->GetClusters ( 0 ) ); | |
1238 | ||
1239 | *v0 = *v0correct; | |
1240 | //Proper cleanup..._______________________________________________ | |
1241 | v0correct->Delete(); | |
1242 | v0correct = 0x0; | |
1243 | ||
1244 | //Just another cross-check and output_____________________________ | |
1245 | if( v0->GetParamN()->Charge() > 0 && v0->GetParamP()->Charge() < 0 ) { | |
1246 | AliWarning("Found Swapped Charges, tried to correct but something FAILED!"); | |
1247 | }else{ | |
1248 | //AliWarning("Found Swapped Charges and fixed."); | |
1249 | } | |
1250 | //________________________________________________________________ | |
1251 | }else{ | |
1252 | //Don't touch it! --- | |
1253 | //Printf("Ah, nice. Charges are already ordered..."); | |
1254 | } | |
1255 | return; | |
1256 | } | |
bcb6ffdb | 1257 |