]>
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 | // --- Added bits of code for checking V0s | |
24 | // (from AliAnalysisTaskCheckStrange.cxx) | |
25 | // | |
26 | // --- Algorithm Description | |
27 | // 1. Perform Physics Selection | |
28 | // 2. Perform Primary Vertex |z|<10cm selection | |
29 | // 3. Perform Primary Vertex NoTPCOnly vertexing selection (>0 contrib.) | |
30 | // 4. Perform Pileup Rejection | |
31 | // 5. Analysis Loops: | |
32 | // 5a. Fill TTree object with V0 information, candidates | |
33 | // | |
34 | // Please Report Any Bugs! | |
35 | // | |
36 | // --- David Dobrigkeit Chinellato | |
37 | // (david.chinellato@gmail.com) | |
38 | // | |
39 | // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
40 | ||
41 | class TTree; | |
42 | class TParticle; | |
43 | class TVector3; | |
44 | ||
45 | //class AliMCEventHandler; | |
46 | //class AliMCEvent; | |
47 | //class AliStack; | |
48 | ||
49 | class AliESDVertex; | |
50 | class AliAODVertex; | |
51 | class AliESDv0; | |
52 | class AliAODv0; | |
53 | ||
54 | #include <Riostream.h> | |
55 | #include "TList.h" | |
56 | #include "TH1.h" | |
57 | #include "TH2.h" | |
58 | #include "TH3.h" | |
59 | #include "THnSparse.h" | |
60 | #include "TVector3.h" | |
61 | #include "TCanvas.h" | |
62 | #include "TMath.h" | |
63 | #include "TLegend.h" | |
64 | #include "AliLog.h" | |
548bd092 | 65 | #include "AliCentrality.h" |
bcb6ffdb | 66 | #include "AliESDEvent.h" |
67 | #include "AliAODEvent.h" | |
68 | #include "AliV0vertexer.h" | |
69 | #include "AliCascadeVertexer.h" | |
70 | #include "AliESDpid.h" | |
71 | #include "AliESDtrack.h" | |
72 | #include "AliESDtrackCuts.h" | |
73 | #include "AliInputEventHandler.h" | |
74 | #include "AliAnalysisManager.h" | |
75 | #include "AliMCEventHandler.h" | |
76 | ||
77 | #include "AliCFContainer.h" | |
78 | #include "AliMultiplicity.h" | |
79 | ||
80 | #include "AliESDcascade.h" | |
81 | #include "AliAODcascade.h" | |
82 | #include "AliESDUtils.h" | |
0eebce93 | 83 | #include "AliESDHeader.h" |
bcb6ffdb | 84 | |
85 | #include "AliAnalysisTaskExtractV0.h" | |
86 | ||
4f8ed367 | 87 | //debugging purposes |
88 | #include "TObjectTable.h" | |
89 | ||
bcb6ffdb | 90 | ClassImp(AliAnalysisTaskExtractV0) |
91 | ||
92 | AliAnalysisTaskExtractV0::AliAnalysisTaskExtractV0() | |
76029adc | 93 | : AliAnalysisTaskSE(), fListHistV0(0), fTree(0), fPIDResponse(0),fESDtrackCuts(0), |
85b81f83 | 94 | fkIsNuclear ( kFALSE ), |
048f4f8f | 95 | fkSwitchINT7 ( kFALSE ), |
85b81f83 | 96 | fkUseOnTheFly ( kFALSE ), |
97 | fkTakeAllTracks ( kFALSE ), | |
e039e6b3 | 98 | fCentralityEstimator("V0M"), |
85b81f83 | 99 | //------------------------------------------------ |
100 | // Initialize | |
101 | fTreeVariableChi2V0(0), | |
102 | fTreeVariableDcaV0Daughters(0), | |
103 | fTreeVariableDcaV0ToPrimVertex(0), | |
104 | fTreeVariableDcaPosToPrimVertex(0), | |
105 | fTreeVariableDcaNegToPrimVertex(0), | |
106 | fTreeVariableV0CosineOfPointingAngle(0), | |
107 | fTreeVariableV0Radius(0), | |
108 | fTreeVariablePt(0), | |
109 | fTreeVariableRapK0Short(0), | |
110 | fTreeVariableRapLambda(0), | |
111 | fTreeVariableInvMassK0s(0), | |
112 | fTreeVariableInvMassLambda(0), | |
113 | fTreeVariableInvMassAntiLambda(0), | |
114 | fTreeVariableAlphaV0(0), | |
115 | fTreeVariablePtArmV0(0), | |
116 | fTreeVariableNegTotMomentum(0), | |
117 | fTreeVariablePosTotMomentum(0), | |
118 | fTreeVariableNegdEdxSig(0), | |
119 | fTreeVariablePosdEdxSig(0), | |
120 | fTreeVariableNegEta(0), | |
121 | fTreeVariablePosEta(0), | |
122 | ||
123 | fTreeVariableNSigmasPosProton(0), | |
124 | fTreeVariableNSigmasPosPion(0), | |
125 | fTreeVariableNSigmasNegProton(0), | |
126 | fTreeVariableNSigmasNegPion(0), | |
127 | ||
128 | fTreeVariableDistOverTotMom(0), | |
129 | fTreeVariableLeastNbrCrossedRows(0), | |
130 | fTreeVariableLeastRatioCrossedRowsOverFindable(0), | |
131 | fTreeVariableMultiplicity(0), | |
132 | ||
133 | fTreeVariableRunNumber(0), | |
134 | fTreeVariableEventNumber(0), | |
135 | ||
136 | fTreeVariableV0x(0), | |
137 | fTreeVariableV0y(0), | |
138 | fTreeVariableV0z(0), | |
139 | ||
140 | fTreeVariableV0Px(0), | |
141 | fTreeVariableV0Py(0), | |
142 | fTreeVariableV0Pz(0), | |
143 | ||
144 | fTreeVariablePVx(0), | |
145 | fTreeVariablePVy(0), | |
146 | fTreeVariablePVz(0), | |
bcb6ffdb | 147 | |
148 | //------------------------------------------------ | |
149 | // HISTOGRAMS | |
150 | // --- Filled on an Event-by-event basis | |
151 | //------------------------------------------------ | |
152 | fHistV0MultiplicityBeforeTrigSel(0), | |
153 | fHistV0MultiplicityForTrigEvt(0), | |
154 | fHistV0MultiplicityForSelEvt(0), | |
155 | fHistV0MultiplicityForSelEvtNoTPCOnly(0), | |
156 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0), | |
157 | fHistMultiplicityBeforeTrigSel(0), | |
158 | fHistMultiplicityForTrigEvt(0), | |
159 | fHistMultiplicity(0), | |
160 | fHistMultiplicityNoTPCOnly(0), | |
161 | fHistMultiplicityNoTPCOnlyNoPileup(0), | |
1d94e33b | 162 | |
163 | //Raw Data for Vertex Z position estimator change | |
164 | f2dHistMultiplicityVsVertexZBeforeTrigSel(0), | |
165 | f2dHistMultiplicityVsVertexZForTrigEvt(0), | |
166 | f2dHistMultiplicityVsVertexZ(0), | |
167 | f2dHistMultiplicityVsVertexZNoTPCOnly(0), | |
168 | f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup(0), | |
169 | ||
bcb6ffdb | 170 | fHistPVx(0), |
171 | fHistPVy(0), | |
172 | fHistPVz(0), | |
173 | fHistPVxAnalysis(0), | |
174 | fHistPVyAnalysis(0), | |
4f8ed367 | 175 | fHistPVzAnalysis(0), |
176 | fHistSwappedV0Counter(0) | |
bcb6ffdb | 177 | { |
178 | // Dummy Constructor | |
179 | } | |
180 | ||
181 | AliAnalysisTaskExtractV0::AliAnalysisTaskExtractV0(const char *name) | |
76029adc | 182 | : AliAnalysisTaskSE(name), fListHistV0(0), fTree(0), fPIDResponse(0),fESDtrackCuts(0), |
85b81f83 | 183 | fkIsNuclear ( kFALSE ), |
048f4f8f | 184 | fkSwitchINT7 ( kFALSE ), |
85b81f83 | 185 | fkUseOnTheFly ( kFALSE ), |
186 | fkTakeAllTracks ( kFALSE ), | |
e039e6b3 | 187 | fCentralityEstimator("V0M"), |
85b81f83 | 188 | //------------------------------------------------ |
189 | // Initialize | |
190 | fTreeVariableChi2V0(0), | |
191 | fTreeVariableDcaV0Daughters(0), | |
192 | fTreeVariableDcaV0ToPrimVertex(0), | |
193 | fTreeVariableDcaPosToPrimVertex(0), | |
194 | fTreeVariableDcaNegToPrimVertex(0), | |
195 | fTreeVariableV0CosineOfPointingAngle(0), | |
196 | fTreeVariableV0Radius(0), | |
197 | fTreeVariablePt(0), | |
198 | fTreeVariableRapK0Short(0), | |
199 | fTreeVariableRapLambda(0), | |
200 | fTreeVariableInvMassK0s(0), | |
201 | fTreeVariableInvMassLambda(0), | |
202 | fTreeVariableInvMassAntiLambda(0), | |
203 | fTreeVariableAlphaV0(0), | |
204 | fTreeVariablePtArmV0(0), | |
205 | fTreeVariableNegTotMomentum(0), | |
206 | fTreeVariablePosTotMomentum(0), | |
207 | fTreeVariableNegdEdxSig(0), | |
208 | fTreeVariablePosdEdxSig(0), | |
209 | fTreeVariableNegEta(0), | |
210 | fTreeVariablePosEta(0), | |
211 | ||
212 | fTreeVariableNSigmasPosProton(0), | |
213 | fTreeVariableNSigmasPosPion(0), | |
214 | fTreeVariableNSigmasNegProton(0), | |
215 | fTreeVariableNSigmasNegPion(0), | |
216 | ||
217 | fTreeVariableDistOverTotMom(0), | |
218 | fTreeVariableLeastNbrCrossedRows(0), | |
219 | fTreeVariableLeastRatioCrossedRowsOverFindable(0), | |
220 | fTreeVariableMultiplicity(0), | |
221 | ||
222 | fTreeVariableRunNumber(0), | |
223 | fTreeVariableEventNumber(0), | |
224 | ||
225 | fTreeVariableV0x(0), | |
226 | fTreeVariableV0y(0), | |
227 | fTreeVariableV0z(0), | |
228 | ||
229 | fTreeVariableV0Px(0), | |
230 | fTreeVariableV0Py(0), | |
231 | fTreeVariableV0Pz(0), | |
232 | ||
233 | fTreeVariablePVx(0), | |
234 | fTreeVariablePVy(0), | |
235 | fTreeVariablePVz(0), | |
236 | ||
bcb6ffdb | 237 | //------------------------------------------------ |
238 | // HISTOGRAMS | |
239 | // --- Filled on an Event-by-event basis | |
240 | //------------------------------------------------ | |
241 | fHistV0MultiplicityBeforeTrigSel(0), | |
242 | fHistV0MultiplicityForTrigEvt(0), | |
243 | fHistV0MultiplicityForSelEvt(0), | |
244 | fHistV0MultiplicityForSelEvtNoTPCOnly(0), | |
245 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0), | |
246 | fHistMultiplicityBeforeTrigSel(0), | |
247 | fHistMultiplicityForTrigEvt(0), | |
248 | fHistMultiplicity(0), | |
249 | fHistMultiplicityNoTPCOnly(0), | |
250 | fHistMultiplicityNoTPCOnlyNoPileup(0), | |
1d94e33b | 251 | |
252 | //Raw Data for Vertex Z position estimator change | |
253 | f2dHistMultiplicityVsVertexZBeforeTrigSel(0), | |
254 | f2dHistMultiplicityVsVertexZForTrigEvt(0), | |
255 | f2dHistMultiplicityVsVertexZ(0), | |
256 | f2dHistMultiplicityVsVertexZNoTPCOnly(0), | |
257 | f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup(0), | |
258 | ||
bcb6ffdb | 259 | fHistPVx(0), |
260 | fHistPVy(0), | |
261 | fHistPVz(0), | |
262 | fHistPVxAnalysis(0), | |
263 | fHistPVyAnalysis(0), | |
4f8ed367 | 264 | fHistPVzAnalysis(0), |
265 | fHistSwappedV0Counter(0) | |
bcb6ffdb | 266 | { |
267 | // Constructor | |
268 | // Output slot #0 writes into a TList container (Lambda Histos and fTree) | |
269 | DefineOutput(1, TList::Class()); | |
270 | DefineOutput(2, TTree::Class()); | |
271 | } | |
272 | ||
273 | ||
274 | AliAnalysisTaskExtractV0::~AliAnalysisTaskExtractV0() | |
275 | { | |
276 | //------------------------------------------------ | |
277 | // DESTRUCTOR | |
278 | //------------------------------------------------ | |
279 | ||
280 | if (fListHistV0){ | |
281 | delete fListHistV0; | |
282 | fListHistV0 = 0x0; | |
283 | } | |
284 | if (fTree){ | |
285 | delete fTree; | |
286 | fTree = 0x0; | |
287 | } | |
76029adc | 288 | //cleanup esd track cuts object too... |
289 | if (fESDtrackCuts){ | |
290 | delete fESDtrackCuts; | |
291 | fESDtrackCuts = 0x0; | |
292 | } | |
293 | ||
294 | ||
bcb6ffdb | 295 | } |
296 | ||
297 | ||
298 | ||
299 | //________________________________________________________________________ | |
300 | void AliAnalysisTaskExtractV0::UserCreateOutputObjects() | |
301 | { | |
bcb6ffdb | 302 | |
eff0b6fc | 303 | //Create File-resident Tree, please. |
304 | OpenFile(2); | |
bcb6ffdb | 305 | // Called once |
eff0b6fc | 306 | fTree = new TTree("fTree","V0Candidates"); |
bcb6ffdb | 307 | |
308 | //------------------------------------------------ | |
309 | // fTree Branch definitions | |
310 | //------------------------------------------------ | |
311 | ||
312 | //-----------BASIC-INFO--------------------------- | |
eff0b6fc | 313 | /* 1*/ fTree->Branch("fTreeVariableChi2V0",&fTreeVariableChi2V0,"fTreeVariableChi2V0/F"); |
314 | /* 2*/ fTree->Branch("fTreeVariableDcaV0Daughters",&fTreeVariableDcaV0Daughters,"fTreeVariableDcaV0Daughters/F"); | |
bcb6ffdb | 315 | /* 3*/ fTree->Branch("fTreeVariableDcaPosToPrimVertex",&fTreeVariableDcaPosToPrimVertex,"fTreeVariableDcaPosToPrimVertex/F"); |
316 | /* 4*/ fTree->Branch("fTreeVariableDcaNegToPrimVertex",&fTreeVariableDcaNegToPrimVertex,"fTreeVariableDcaNegToPrimVertex/F"); | |
317 | /* 5*/ fTree->Branch("fTreeVariableV0Radius",&fTreeVariableV0Radius,"fTreeVariableV0Radius/F"); | |
318 | /* 6*/ fTree->Branch("fTreeVariablePt",&fTreeVariablePt,"fTreeVariablePt/F"); | |
319 | /* 7*/ fTree->Branch("fTreeVariableRapK0Short",&fTreeVariableRapK0Short,"fTreeVariableRapK0Short/F"); | |
320 | /* 8*/ fTree->Branch("fTreeVariableRapLambda",&fTreeVariableRapLambda,"fTreeVariableRapLambda/F"); | |
321 | /* 9*/ fTree->Branch("fTreeVariableInvMassK0s",&fTreeVariableInvMassK0s,"fTreeVariableInvMassK0s/F"); | |
322 | /*10*/ fTree->Branch("fTreeVariableInvMassLambda",&fTreeVariableInvMassLambda,"fTreeVariableInvMassLambda/F"); | |
323 | /*11*/ fTree->Branch("fTreeVariableInvMassAntiLambda",&fTreeVariableInvMassAntiLambda,"fTreeVariableInvMassAntiLambda/F"); | |
324 | /*12*/ fTree->Branch("fTreeVariableV0CosineOfPointingAngle",&fTreeVariableV0CosineOfPointingAngle,"fTreeVariableV0CosineOfPointingAngle/F"); | |
325 | /*13*/ fTree->Branch("fTreeVariableAlphaV0",&fTreeVariableAlphaV0,"fTreeVariableAlphaV0/F"); | |
326 | /*14*/ fTree->Branch("fTreeVariablePtArmV0",&fTreeVariablePtArmV0,"fTreeVariablePtArmV0/F"); | |
327 | /*15*/ fTree->Branch("fTreeVariableLeastNbrCrossedRows",&fTreeVariableLeastNbrCrossedRows,"fTreeVariableLeastNbrCrossedRows/I"); | |
328 | /*16*/ fTree->Branch("fTreeVariableLeastRatioCrossedRowsOverFindable",&fTreeVariableLeastRatioCrossedRowsOverFindable,"fTreeVariableLeastRatioCrossedRowsOverFindable/F"); | |
329 | //-----------MULTIPLICITY-INFO-------------------- | |
330 | /*17*/ fTree->Branch("fTreeVariableMultiplicity",&fTreeVariableMultiplicity,"fTreeVariableMultiplicity/I"); | |
331 | //------------------------------------------------ | |
332 | /*18*/ fTree->Branch("fTreeVariableDistOverTotMom",&fTreeVariableDistOverTotMom,"fTreeVariableDistOverTotMom/F"); | |
333 | /*19*/ fTree->Branch("fTreeVariableNSigmasPosProton",&fTreeVariableNSigmasPosProton,"fTreeVariableNSigmasPosProton/F"); | |
334 | /*20*/ fTree->Branch("fTreeVariableNSigmasPosPion",&fTreeVariableNSigmasPosPion,"fTreeVariableNSigmasPosPion/F"); | |
335 | /*21*/ fTree->Branch("fTreeVariableNSigmasNegProton",&fTreeVariableNSigmasNegProton,"fTreeVariableNSigmasNegProton/F"); | |
336 | /*22*/ fTree->Branch("fTreeVariableNSigmasNegPion",&fTreeVariableNSigmasNegPion,"fTreeVariableNSigmasNegPion/F"); | |
337 | /*23*/ fTree->Branch("fTreeVariableNegEta",&fTreeVariableNegEta,"fTreeVariableNegEta/F"); | |
338 | /*24*/ fTree->Branch("fTreeVariablePosEta",&fTreeVariablePosEta,"fTreeVariablePosEta/F"); | |
0eebce93 | 339 | /*25*/ fTree->Branch("fTreeVariableRunNumber",&fTreeVariableRunNumber,"fTreeVariableRunNumber/I"); |
340 | /*26*/ fTree->Branch("fTreeVariableEventNumber",&fTreeVariableEventNumber,"fTreeVariableEventNumber/l"); | |
57d075b9 | 341 | //-----------FOR CTAU DEBUGGING: Full Phase Space + Decay Position Info |
653265df | 342 | fTree->Branch("fTreeVariablePVx",&fTreeVariablePVx,"fTreeVariablePVx/F"); |
343 | fTree->Branch("fTreeVariablePVy",&fTreeVariablePVy,"fTreeVariablePVy/F"); | |
344 | fTree->Branch("fTreeVariablePVz",&fTreeVariablePVz,"fTreeVariablePVz/F"); | |
345 | ||
57d075b9 | 346 | fTree->Branch("fTreeVariableV0x",&fTreeVariableV0x,"fTreeVariableV0x/F"); |
347 | fTree->Branch("fTreeVariableV0y",&fTreeVariableV0y,"fTreeVariableV0y/F"); | |
348 | fTree->Branch("fTreeVariableV0z",&fTreeVariableV0z,"fTreeVariableV0z/F"); | |
349 | ||
350 | fTree->Branch("fTreeVariableV0Px",&fTreeVariableV0Px,"fTreeVariableV0Px/F"); | |
351 | fTree->Branch("fTreeVariableV0Py",&fTreeVariableV0Py,"fTreeVariableV0Py/F"); | |
352 | fTree->Branch("fTreeVariableV0Pz",&fTreeVariableV0Pz,"fTreeVariableV0Pz/F"); | |
bcb6ffdb | 353 | //------------------------------------------------ |
354 | // Particle Identification Setup | |
355 | //------------------------------------------------ | |
356 | ||
357 | AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager(); | |
358 | AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler()); | |
359 | fPIDResponse = inputHandler->GetPIDResponse(); | |
360 | ||
76029adc | 361 | // Multiplicity |
362 | ||
363 | if(! fESDtrackCuts ){ | |
364 | fESDtrackCuts = new AliESDtrackCuts(); | |
365 | } | |
366 | ||
bcb6ffdb | 367 | |
368 | //------------------------------------------------ | |
369 | // V0 Multiplicity Histograms | |
370 | //------------------------------------------------ | |
371 | ||
eff0b6fc | 372 | // Create histograms |
373 | //Create File-resident Tree, please. | |
374 | OpenFile(1); | |
375 | ||
376 | fListHistV0 = new TList(); | |
377 | fListHistV0->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner | |
378 | ||
bcb6ffdb | 379 | if(! fHistV0MultiplicityBeforeTrigSel) { |
380 | fHistV0MultiplicityBeforeTrigSel = new TH1F("fHistV0MultiplicityBeforeTrigSel", | |
381 | "V0s per event (before Trig. Sel.);Nbr of V0s/Evt;Events", | |
382 | 25, 0, 25); | |
383 | fListHistV0->Add(fHistV0MultiplicityBeforeTrigSel); | |
384 | } | |
385 | ||
386 | if(! fHistV0MultiplicityForTrigEvt) { | |
387 | fHistV0MultiplicityForTrigEvt = new TH1F("fHistV0MultiplicityForTrigEvt", | |
388 | "V0s per event (for triggered evt);Nbr of V0s/Evt;Events", | |
389 | 25, 0, 25); | |
390 | fListHistV0->Add(fHistV0MultiplicityForTrigEvt); | |
391 | } | |
392 | ||
393 | if(! fHistV0MultiplicityForSelEvt) { | |
394 | fHistV0MultiplicityForSelEvt = new TH1F("fHistV0MultiplicityForSelEvt", | |
395 | "V0s per event;Nbr of V0s/Evt;Events", | |
396 | 25, 0, 25); | |
397 | fListHistV0->Add(fHistV0MultiplicityForSelEvt); | |
398 | } | |
399 | ||
400 | if(! fHistV0MultiplicityForSelEvtNoTPCOnly) { | |
401 | fHistV0MultiplicityForSelEvtNoTPCOnly = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnly", | |
402 | "V0s per event;Nbr of V0s/Evt;Events", | |
403 | 25, 0, 25); | |
404 | fListHistV0->Add(fHistV0MultiplicityForSelEvtNoTPCOnly); | |
405 | } | |
406 | ||
407 | if(! fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup) { | |
408 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup", | |
409 | "V0s per event;Nbr of V0s/Evt;Events", | |
410 | 25, 0, 25); | |
411 | fListHistV0->Add(fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup); | |
412 | } | |
413 | ||
414 | //------------------------------------------------ | |
415 | // Track Multiplicity Histograms | |
416 | //------------------------------------------------ | |
417 | ||
418 | if(! fHistMultiplicityBeforeTrigSel) { | |
419 | fHistMultiplicityBeforeTrigSel = new TH1F("fHistMultiplicityBeforeTrigSel", | |
420 | "Tracks per event;Nbr of Tracks;Events", | |
421 | 200, 0, 200); | |
422 | fListHistV0->Add(fHistMultiplicityBeforeTrigSel); | |
423 | } | |
424 | if(! fHistMultiplicityForTrigEvt) { | |
425 | fHistMultiplicityForTrigEvt = new TH1F("fHistMultiplicityForTrigEvt", | |
426 | "Tracks per event;Nbr of Tracks;Events", | |
427 | 200, 0, 200); | |
428 | fListHistV0->Add(fHistMultiplicityForTrigEvt); | |
429 | } | |
430 | if(! fHistMultiplicity) { | |
431 | fHistMultiplicity = new TH1F("fHistMultiplicity", | |
432 | "Tracks per event;Nbr of Tracks;Events", | |
433 | 200, 0, 200); | |
434 | fListHistV0->Add(fHistMultiplicity); | |
435 | } | |
436 | if(! fHistMultiplicityNoTPCOnly) { | |
437 | fHistMultiplicityNoTPCOnly = new TH1F("fHistMultiplicityNoTPCOnly", | |
438 | "Tracks per event;Nbr of Tracks;Events", | |
439 | 200, 0, 200); | |
440 | fListHistV0->Add(fHistMultiplicityNoTPCOnly); | |
441 | } | |
442 | if(! fHistMultiplicityNoTPCOnlyNoPileup) { | |
443 | fHistMultiplicityNoTPCOnlyNoPileup = new TH1F("fHistMultiplicityNoTPCOnlyNoPileup", | |
444 | "Tracks per event;Nbr of Tracks;Events", | |
445 | 200, 0, 200); | |
446 | fListHistV0->Add(fHistMultiplicityNoTPCOnlyNoPileup); | |
447 | } | |
448 | ||
1d94e33b | 449 | |
450 | ||
451 | //Raw Data for Vertex Z position estimator change | |
452 | //TH2F *f2dHistMultiplicityVsVertexZBeforeTrigSel; //! multiplicity distribution | |
453 | //TH2F *f2dHistMultiplicityVsVertexZForTrigEvt; //! multiplicity distribution | |
454 | //TH2F *f2dHistMultiplicityVsVertexZ; //! multiplicity distribution | |
455 | //TH2F *f2dHistMultiplicityVsVertexZNoTPCOnly; //! multiplicity distribution | |
456 | //TH2F *f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup; //! multiplicity distribution | |
457 | ||
458 | if(! f2dHistMultiplicityVsVertexZBeforeTrigSel) { | |
459 | f2dHistMultiplicityVsVertexZBeforeTrigSel = new TH2F("f2dHistMultiplicityVsVertexZBeforeTrigSel", | |
460 | "Tracks per event", 200, 0, 200,400, -20, 20); | |
461 | fListHistV0->Add(f2dHistMultiplicityVsVertexZBeforeTrigSel); | |
462 | } | |
463 | if(! f2dHistMultiplicityVsVertexZForTrigEvt) { | |
464 | f2dHistMultiplicityVsVertexZForTrigEvt = new TH2F("f2dHistMultiplicityVsVertexZForTrigEvt", | |
465 | "Tracks per event", 200, 0, 200, 400, -20, 20); | |
466 | fListHistV0->Add(f2dHistMultiplicityVsVertexZForTrigEvt); | |
467 | } | |
468 | if(! f2dHistMultiplicityVsVertexZ) { | |
469 | f2dHistMultiplicityVsVertexZ = new TH2F("f2dHistMultiplicityVsVertexZ", | |
470 | "Tracks per event", 200, 0, 200, 400, -20, 20); | |
471 | fListHistV0->Add(f2dHistMultiplicityVsVertexZ); | |
472 | } | |
473 | if(! f2dHistMultiplicityVsVertexZNoTPCOnly) { | |
474 | f2dHistMultiplicityVsVertexZNoTPCOnly = new TH2F("f2dHistMultiplicityVsVertexZNoTPCOnly", | |
475 | "Tracks per event", 200, 0, 200, 400, -20, 20); | |
476 | fListHistV0->Add(f2dHistMultiplicityVsVertexZNoTPCOnly); | |
477 | } | |
478 | if(! f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup) { | |
479 | f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup = new TH2F("f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup", | |
480 | "Tracks per event", 200, 0, 200, 400, -20, 20); | |
481 | fListHistV0->Add(f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup); | |
482 | } | |
483 | ||
484 | //----------------------------------------------------- | |
485 | ||
bcb6ffdb | 486 | if(! fHistPVx) { |
487 | fHistPVx = new TH1F("fHistPVx", | |
488 | "PV x position;Nbr of Evts;x", | |
489 | 2000, -0.5, 0.5); | |
490 | fListHistV0->Add(fHistPVx); | |
491 | } | |
492 | if(! fHistPVy) { | |
493 | fHistPVy = new TH1F("fHistPVy", | |
494 | "PV y position;Nbr of Evts;y", | |
495 | 2000, -0.5, 0.5); | |
496 | fListHistV0->Add(fHistPVy); | |
497 | } | |
498 | if(! fHistPVz) { | |
499 | fHistPVz = new TH1F("fHistPVz", | |
500 | "PV z position;Nbr of Evts;z", | |
501 | 400, -20, 20); | |
502 | fListHistV0->Add(fHistPVz); | |
503 | } | |
504 | if(! fHistPVxAnalysis) { | |
505 | fHistPVxAnalysis = new TH1F("fHistPVxAnalysis", | |
506 | "PV x position;Nbr of Evts;x", | |
507 | 2000, -0.5, 0.5); | |
508 | fListHistV0->Add(fHistPVxAnalysis); | |
509 | } | |
510 | if(! fHistPVyAnalysis) { | |
511 | fHistPVyAnalysis = new TH1F("fHistPVyAnalysis", | |
512 | "PV y position;Nbr of Evts;y", | |
513 | 2000, -0.5, 0.5); | |
514 | fListHistV0->Add(fHistPVyAnalysis); | |
515 | } | |
516 | if(! fHistPVzAnalysis) { | |
517 | fHistPVzAnalysis = new TH1F("fHistPVzAnalysis", | |
518 | "PV z position;Nbr of Evts;z", | |
519 | 400, -20, 20); | |
520 | fListHistV0->Add(fHistPVzAnalysis); | |
521 | } | |
4f8ed367 | 522 | if(! fHistSwappedV0Counter) { |
523 | fHistSwappedV0Counter = new TH1F("fHistSwappedV0Counter", | |
524 | "Swap or not histo;Swapped (1) or not (0); count", | |
525 | 2, 0, 2); | |
526 | fListHistV0->Add(fHistSwappedV0Counter); | |
527 | } | |
bcb6ffdb | 528 | //Regular output: Histograms |
529 | PostData(1, fListHistV0); | |
530 | //TTree Object: Saved to base directory. Should cache to disk while saving. | |
531 | //(Important to avoid excessive memory usage, particularly when merging) | |
532 | PostData(2, fTree); | |
533 | ||
534 | }// end UserCreateOutputObjects | |
535 | ||
536 | ||
537 | //________________________________________________________________________ | |
538 | void AliAnalysisTaskExtractV0::UserExec(Option_t *) | |
539 | { | |
540 | // Main loop | |
541 | // Called for each event | |
4f8ed367 | 542 | //gObjectTable->Print(); |
bcb6ffdb | 543 | AliESDEvent *lESDevent = 0x0; |
0eebce93 | 544 | |
bcb6ffdb | 545 | //AliAODEvent *lAODevent = 0x0; |
546 | Int_t nV0s = -1; | |
547 | ||
548 | Double_t lTrkgPrimaryVtxPos[3] = {-100.0, -100.0, -100.0}; | |
549 | Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0}; | |
550 | Double_t lMagneticField = -10.; | |
551 | ||
552 | // Connect to the InputEvent | |
553 | // After these lines, we should have an ESD/AOD event + the number of cascades in it. | |
554 | ||
555 | // Appropriate for ESD analysis! | |
556 | ||
557 | lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() ); | |
558 | if (!lESDevent) { | |
559 | AliWarning("ERROR: lESDevent not available \n"); | |
560 | return; | |
561 | } | |
0eebce93 | 562 | fTreeVariableRunNumber = lESDevent->GetRunNumber(); |
563 | fTreeVariableEventNumber = | |
564 | ( ( ((ULong64_t)lESDevent->GetPeriodNumber() ) << 36 ) | | |
565 | ( ((ULong64_t)lESDevent->GetOrbitNumber () ) << 12 ) | | |
566 | ((ULong64_t)lESDevent->GetBunchCrossNumber() ) ); | |
bcb6ffdb | 567 | |
568 | //REVISED multiplicity estimator after 'multiplicity day' (2011) | |
4f8ed367 | 569 | Int_t lMultiplicity = -100; |
570 | ||
76029adc | 571 | if(fkIsNuclear == kFALSE) lMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,0.5); |
548bd092 | 572 | |
573 | //---> If this is a nuclear collision, then go nuclear on "multiplicity" variable... | |
574 | //---> Warning: Experimental | |
575 | if(fkIsNuclear == kTRUE){ | |
576 | AliCentrality* centrality; | |
577 | centrality = lESDevent->GetCentrality(); | |
e039e6b3 | 578 | lMultiplicity = ( ( Int_t ) ( centrality->GetCentralityPercentile( fCentralityEstimator.Data() ) ) ); |
548bd092 | 579 | if (centrality->GetQuality()>1) { |
580 | PostData(1, fListHistV0); | |
581 | PostData(2, fTree); | |
582 | return; | |
583 | } | |
584 | } | |
4f8ed367 | 585 | |
bcb6ffdb | 586 | //Set variable for filling tree afterwards! |
548bd092 | 587 | //---> pp case......: GetReferenceMultiplicity |
588 | //---> Pb-Pb case...: Centrality by V0M | |
589 | fTreeVariableMultiplicity = lMultiplicity; | |
548bd092 | 590 | fHistMultiplicityBeforeTrigSel->Fill ( lMultiplicity ); |
4f8ed367 | 591 | fHistV0MultiplicityBeforeTrigSel->Fill ( lESDevent->GetNumberOfV0s() ); |
592 | ||
bcb6ffdb | 593 | //------------------------------------------------ |
594 | // Physics Selection | |
595 | //------------------------------------------------ | |
596 | ||
597 | // new method | |
598 | UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected(); | |
599 | Bool_t isSelected = 0; | |
600 | isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB; | |
548bd092 | 601 | |
048f4f8f | 602 | //pA triggering: CINT7 |
603 | if( fkSwitchINT7 ) isSelected = (maskIsSelected & AliVEvent::kINT7) == AliVEvent::kINT7; | |
604 | ||
548bd092 | 605 | //Standard Min-Bias Selection |
bcb6ffdb | 606 | if ( ! isSelected ) { |
607 | PostData(1, fListHistV0); | |
608 | PostData(2, fTree); | |
609 | return; | |
610 | } | |
611 | ||
612 | //------------------------------------------------ | |
613 | // After Trigger Selection | |
614 | //------------------------------------------------ | |
615 | ||
616 | nV0s = lESDevent->GetNumberOfV0s(); | |
617 | ||
618 | fHistV0MultiplicityForTrigEvt ->Fill( nV0s ); | |
548bd092 | 619 | fHistMultiplicityForTrigEvt ->Fill( lMultiplicity ); |
bcb6ffdb | 620 | |
621 | //------------------------------------------------ | |
622 | // Getting: Primary Vertex + MagField Info | |
623 | //------------------------------------------------ | |
624 | ||
625 | const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks(); | |
626 | // get the vtx stored in ESD found with tracks | |
627 | lPrimaryTrackingESDVtx->GetXYZ( lTrkgPrimaryVtxPos ); | |
628 | ||
629 | const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex(); | |
630 | // get the best primary vertex available for the event | |
631 | // As done in AliCascadeVertexer, we keep the one which is the best one available. | |
632 | // between : Tracking vertex > SPD vertex > TPC vertex > default SPD vertex | |
633 | // This one will be used for next calculations (DCA essentially) | |
634 | lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos ); | |
635 | ||
636 | Double_t tPrimaryVtxPosition[3]; | |
637 | const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex(); | |
638 | tPrimaryVtxPosition[0] = primaryVtx->GetX(); | |
639 | tPrimaryVtxPosition[1] = primaryVtx->GetY(); | |
640 | tPrimaryVtxPosition[2] = primaryVtx->GetZ(); | |
641 | fHistPVx->Fill( tPrimaryVtxPosition[0] ); | |
642 | fHistPVy->Fill( tPrimaryVtxPosition[1] ); | |
643 | fHistPVz->Fill( tPrimaryVtxPosition[2] ); | |
644 | ||
1d94e33b | 645 | f2dHistMultiplicityVsVertexZForTrigEvt->Fill( lMultiplicity, tPrimaryVtxPosition[2] ); |
646 | ||
bcb6ffdb | 647 | //------------------------------------------------ |
648 | // Primary Vertex Z position: SKIP | |
649 | //------------------------------------------------ | |
650 | ||
651 | if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0 ) { | |
652 | AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !"); | |
653 | PostData(1, fListHistV0); | |
654 | PostData(2, fTree); | |
655 | return; | |
656 | } | |
657 | ||
1d94e33b | 658 | f2dHistMultiplicityVsVertexZ->Fill( lMultiplicity, tPrimaryVtxPosition[2] ); |
659 | ||
bcb6ffdb | 660 | lMagneticField = lESDevent->GetMagneticField( ); |
661 | fHistV0MultiplicityForSelEvt ->Fill( nV0s ); | |
548bd092 | 662 | fHistMultiplicity->Fill(lMultiplicity); |
bcb6ffdb | 663 | |
664 | //------------------------------------------------ | |
665 | // Only look at events with well-established PV | |
666 | //------------------------------------------------ | |
667 | ||
668 | const AliESDVertex *lPrimaryTrackingESDVtxCheck = lESDevent->GetPrimaryVertexTracks(); | |
669 | const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD(); | |
670 | if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtxCheck->GetStatus() ){ | |
671 | AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !"); | |
672 | PostData(1, fListHistV0); | |
673 | PostData(2, fTree); | |
674 | return; | |
675 | } | |
676 | ||
1d94e33b | 677 | |
678 | f2dHistMultiplicityVsVertexZNoTPCOnly->Fill( lMultiplicity, tPrimaryVtxPosition[2] ); | |
bcb6ffdb | 679 | fHistV0MultiplicityForSelEvtNoTPCOnly ->Fill( nV0s ); |
548bd092 | 680 | fHistMultiplicityNoTPCOnly->Fill(lMultiplicity); |
bcb6ffdb | 681 | |
682 | //------------------------------------------------ | |
683 | // Pileup Rejection | |
684 | //------------------------------------------------ | |
685 | ||
686 | // FIXME : quality selection regarding pile-up rejection | |
4f8ed367 | 687 | 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 | 688 | PostData(1, fListHistV0); |
689 | PostData(2, fTree); | |
690 | return; | |
691 | } | |
1d94e33b | 692 | |
693 | f2dHistMultiplicityVsVertexZNoTPCOnlyNoPileup->Fill( lMultiplicity, tPrimaryVtxPosition[2] ); | |
bcb6ffdb | 694 | fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup ->Fill( nV0s ); |
548bd092 | 695 | fHistMultiplicityNoTPCOnlyNoPileup->Fill(lMultiplicity); |
bcb6ffdb | 696 | |
697 | //------------------------------------------------ | |
698 | // MAIN LAMBDA LOOP STARTS HERE | |
699 | //------------------------------------------------ | |
700 | ||
701 | if( ! (lESDevent->GetPrimaryVertex()->IsFromVertexerZ() ) ){ | |
702 | fHistPVxAnalysis->Fill( tPrimaryVtxPosition[0] ); | |
703 | fHistPVyAnalysis->Fill( tPrimaryVtxPosition[1] ); | |
704 | fHistPVzAnalysis->Fill( tPrimaryVtxPosition[2] ); | |
705 | } | |
706 | ||
653265df | 707 | fTreeVariablePVx = tPrimaryVtxPosition[0]; |
708 | fTreeVariablePVy = tPrimaryVtxPosition[1]; | |
709 | fTreeVariablePVz = tPrimaryVtxPosition[2]; | |
710 | ||
bcb6ffdb | 711 | //Variable definition |
712 | Int_t lOnFlyStatus = 0;// nv0sOn = 0, nv0sOff = 0; | |
713 | Double_t lChi2V0 = 0; | |
714 | Double_t lDcaV0Daughters = 0, lDcaV0ToPrimVertex = 0; | |
715 | Double_t lDcaPosToPrimVertex = 0, lDcaNegToPrimVertex = 0; | |
716 | Double_t lV0CosineOfPointingAngle = 0; | |
717 | Double_t lV0Radius = 0, lPt = 0; | |
718 | Double_t lRapK0Short = 0, lRapLambda = 0; | |
719 | Double_t lInvMassK0s = 0, lInvMassLambda = 0, lInvMassAntiLambda = 0; | |
720 | Double_t lAlphaV0 = 0, lPtArmV0 = 0; | |
721 | ||
722 | Double_t fMinV0Pt = 0; | |
723 | Double_t fMaxV0Pt = 100; | |
724 | ||
725 | Int_t nv0s = 0; | |
726 | nv0s = lESDevent->GetNumberOfV0s(); | |
727 | ||
4f8ed367 | 728 | //for (Int_t iV0 = 0; iV0 < nv0s; iV0++) |
729 | for (Int_t iV0 = 0; iV0 < nv0s; iV0++) //extra-crazy test | |
bcb6ffdb | 730 | {// This is the begining of the V0 loop |
731 | AliESDv0 *v0 = ((AliESDEvent*)lESDevent)->GetV0(iV0); | |
732 | if (!v0) continue; | |
4f8ed367 | 733 | |
734 | //---> Fix On-the-Fly candidates, count how many swapped | |
735 | if( v0->GetParamN()->Charge() > 0 && v0->GetParamP()->Charge() < 0 ){ | |
736 | fHistSwappedV0Counter -> Fill( 1 ); | |
737 | }else{ | |
738 | fHistSwappedV0Counter -> Fill( 0 ); | |
739 | } | |
740 | if ( fkUseOnTheFly ) CheckChargeV0(v0); | |
741 | ||
bcb6ffdb | 742 | Double_t tDecayVertexV0[3]; v0->GetXYZ(tDecayVertexV0[0],tDecayVertexV0[1],tDecayVertexV0[2]); |
57d075b9 | 743 | |
bcb6ffdb | 744 | Double_t tV0mom[3]; |
745 | v0->GetPxPyPz( tV0mom[0],tV0mom[1],tV0mom[2] ); | |
746 | Double_t lV0TotalMomentum = TMath::Sqrt( | |
747 | tV0mom[0]*tV0mom[0]+tV0mom[1]*tV0mom[1]+tV0mom[2]*tV0mom[2] ); | |
748 | ||
749 | lV0Radius = TMath::Sqrt(tDecayVertexV0[0]*tDecayVertexV0[0]+tDecayVertexV0[1]*tDecayVertexV0[1]); | |
57d075b9 | 750 | |
751 | //Set Variables for later filling | |
752 | fTreeVariableV0x = tDecayVertexV0[0]; | |
753 | fTreeVariableV0y = tDecayVertexV0[1]; | |
754 | fTreeVariableV0z = tDecayVertexV0[2]; | |
755 | ||
756 | //Set Variables for later filling | |
757 | fTreeVariableV0Px = tV0mom[0]; | |
758 | fTreeVariableV0Py = tV0mom[1]; | |
759 | fTreeVariableV0Pz = tV0mom[2]; | |
760 | ||
bcb6ffdb | 761 | lPt = v0->Pt(); |
762 | lRapK0Short = v0->RapK0Short(); | |
763 | lRapLambda = v0->RapLambda(); | |
764 | if ((lPt<fMinV0Pt)||(fMaxV0Pt<lPt)) continue; | |
765 | ||
766 | UInt_t lKeyPos = (UInt_t)TMath::Abs(v0->GetPindex()); | |
767 | UInt_t lKeyNeg = (UInt_t)TMath::Abs(v0->GetNindex()); | |
768 | ||
769 | Double_t lMomPos[3]; v0->GetPPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]); | |
770 | Double_t lMomNeg[3]; v0->GetNPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]); | |
771 | ||
772 | AliESDtrack *pTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyPos); | |
773 | AliESDtrack *nTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyNeg); | |
774 | if (!pTrack || !nTrack) { | |
775 | Printf("ERROR: Could not retreive one of the daughter track"); | |
776 | continue; | |
777 | } | |
778 | ||
779 | //Daughter Eta for Eta selection, afterwards | |
780 | fTreeVariableNegEta = nTrack->Eta(); | |
781 | fTreeVariablePosEta = pTrack->Eta(); | |
782 | ||
783 | // Filter like-sign V0 (next: add counter and distribution) | |
784 | if ( pTrack->GetSign() == nTrack->GetSign()){ | |
785 | continue; | |
786 | } | |
787 | ||
788 | //________________________________________________________________________ | |
789 | // Track quality cuts | |
790 | Float_t lPosTrackCrossedRows = pTrack->GetTPCClusterInfo(2,1); | |
791 | Float_t lNegTrackCrossedRows = nTrack->GetTPCClusterInfo(2,1); | |
4f8ed367 | 792 | fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows; |
bcb6ffdb | 793 | if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows ) |
4f8ed367 | 794 | fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows; |
bcb6ffdb | 795 | |
796 | // TPC refit condition (done during reconstruction for Offline but not for On-the-fly) | |
797 | if( !(pTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
798 | if( !(nTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue; | |
799 | ||
85b81f83 | 800 | if ( ( ( ( pTrack->GetTPCClusterInfo(2,1) ) < 70 ) || ( ( nTrack->GetTPCClusterInfo(2,1) ) < 70 ) )&&(fkTakeAllTracks==kFALSE) ) continue; |
bcb6ffdb | 801 | |
802 | //GetKinkIndex condition | |
803 | if( pTrack->GetKinkIndex(0)>0 || nTrack->GetKinkIndex(0)>0 ) continue; | |
804 | ||
805 | //Findable clusters > 0 condition | |
806 | if( pTrack->GetTPCNclsF()<=0 || nTrack->GetTPCNclsF()<=0 ) continue; | |
807 | ||
808 | //Compute ratio Crossed Rows / Findable clusters | |
809 | //Note: above test avoids division by zero! | |
810 | Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF())); | |
811 | Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF())); | |
812 | ||
813 | fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable; | |
814 | if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable ) | |
815 | fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable; | |
816 | ||
817 | //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here | |
85b81f83 | 818 | if ( (fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8)&&(fkTakeAllTracks==kFALSE) ) continue; |
bcb6ffdb | 819 | |
820 | //End track Quality Cuts | |
821 | //________________________________________________________________________ | |
822 | ||
823 | lDcaPosToPrimVertex = TMath::Abs(pTrack->GetD(tPrimaryVtxPosition[0], | |
824 | tPrimaryVtxPosition[1], | |
825 | lMagneticField) ); | |
826 | ||
827 | lDcaNegToPrimVertex = TMath::Abs(nTrack->GetD(tPrimaryVtxPosition[0], | |
828 | tPrimaryVtxPosition[1], | |
829 | lMagneticField) ); | |
830 | ||
831 | lOnFlyStatus = v0->GetOnFlyStatus(); | |
832 | lChi2V0 = v0->GetChi2V0(); | |
833 | lDcaV0Daughters = v0->GetDcaV0Daughters(); | |
834 | lDcaV0ToPrimVertex = v0->GetD(tPrimaryVtxPosition[0],tPrimaryVtxPosition[1],tPrimaryVtxPosition[2]); | |
835 | lV0CosineOfPointingAngle = v0->GetV0CosineOfPointingAngle(tPrimaryVtxPosition[0],tPrimaryVtxPosition[1],tPrimaryVtxPosition[2]); | |
836 | fTreeVariableV0CosineOfPointingAngle=lV0CosineOfPointingAngle; | |
837 | ||
838 | // Getting invariant mass infos directly from ESD | |
839 | v0->ChangeMassHypothesis(310); | |
840 | lInvMassK0s = v0->GetEffMass(); | |
841 | v0->ChangeMassHypothesis(3122); | |
842 | lInvMassLambda = v0->GetEffMass(); | |
843 | v0->ChangeMassHypothesis(-3122); | |
844 | lInvMassAntiLambda = v0->GetEffMass(); | |
845 | lAlphaV0 = v0->AlphaV0(); | |
846 | lPtArmV0 = v0->PtArmV0(); | |
847 | ||
848 | fTreeVariablePt = v0->Pt(); | |
849 | fTreeVariableChi2V0 = lChi2V0; | |
850 | fTreeVariableDcaV0ToPrimVertex = lDcaV0ToPrimVertex; | |
851 | fTreeVariableDcaV0Daughters = lDcaV0Daughters; | |
852 | fTreeVariableV0CosineOfPointingAngle = lV0CosineOfPointingAngle; | |
853 | fTreeVariableV0Radius = lV0Radius; | |
854 | fTreeVariableDcaPosToPrimVertex = lDcaPosToPrimVertex; | |
855 | fTreeVariableDcaNegToPrimVertex = lDcaNegToPrimVertex; | |
856 | fTreeVariableInvMassK0s = lInvMassK0s; | |
857 | fTreeVariableInvMassLambda = lInvMassLambda; | |
858 | fTreeVariableInvMassAntiLambda = lInvMassAntiLambda; | |
859 | fTreeVariableRapK0Short = lRapK0Short; | |
860 | fTreeVariableRapLambda = lRapLambda; | |
861 | fTreeVariableAlphaV0 = lAlphaV0; | |
862 | fTreeVariablePtArmV0 = lPtArmV0; | |
863 | ||
864 | //Official means of acquiring N-sigmas | |
865 | fTreeVariableNSigmasPosProton = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kProton ); | |
866 | fTreeVariableNSigmasPosPion = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kPion ); | |
867 | fTreeVariableNSigmasNegProton = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kProton ); | |
868 | fTreeVariableNSigmasNegPion = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kPion ); | |
869 | ||
870 | //This requires an Invariant Mass Hypothesis afterwards | |
871 | fTreeVariableDistOverTotMom = TMath::Sqrt( | |
872 | TMath::Power( tDecayVertexV0[0] - lBestPrimaryVtxPos[0] , 2) + | |
873 | TMath::Power( tDecayVertexV0[1] - lBestPrimaryVtxPos[1] , 2) + | |
874 | TMath::Power( tDecayVertexV0[2] - lBestPrimaryVtxPos[2] , 2) | |
875 | ); | |
876 | fTreeVariableDistOverTotMom /= (lV0TotalMomentum+1e-10); //avoid division by zero, to be sure | |
877 | ||
878 | //------------------------------------------------ | |
879 | // Fill Tree! | |
880 | //------------------------------------------------ | |
881 | ||
882 | // The conditionals are meant to decrease excessive | |
883 | // memory usage! | |
884 | ||
885 | //First Selection: Reject OnFly | |
4f8ed367 | 886 | if( (lOnFlyStatus == 0 && fkUseOnTheFly == kFALSE) || (lOnFlyStatus != 0 && fkUseOnTheFly == kTRUE ) ){ |
bcb6ffdb | 887 | //Second Selection: rough 20-sigma band, parametric. |
888 | //K0Short: Enough to parametrize peak broadening with linear function. | |
889 | Double_t lUpperLimitK0Short = (5.63707e-01) + (1.14979e-02)*fTreeVariablePt; | |
890 | Double_t lLowerLimitK0Short = (4.30006e-01) - (1.10029e-02)*fTreeVariablePt; | |
891 | //Lambda: Linear (for higher pt) plus exponential (for low-pt broadening) | |
892 | //[0]+[1]*x+[2]*TMath::Exp(-[3]*x) | |
893 | Double_t lUpperLimitLambda = (1.13688e+00) + (5.27838e-03)*fTreeVariablePt + (8.42220e-02)*TMath::Exp(-(3.80595e+00)*fTreeVariablePt); | |
894 | Double_t lLowerLimitLambda = (1.09501e+00) - (5.23272e-03)*fTreeVariablePt - (7.52690e-02)*TMath::Exp(-(3.46339e+00)*fTreeVariablePt); | |
895 | //Do Selection | |
896 | if( (fTreeVariableInvMassLambda < lUpperLimitLambda && fTreeVariableInvMassLambda > lLowerLimitLambda ) || | |
897 | (fTreeVariableInvMassAntiLambda < lUpperLimitLambda && fTreeVariableInvMassAntiLambda > lLowerLimitLambda ) || | |
898 | (fTreeVariableInvMassK0s < lUpperLimitK0Short && fTreeVariableInvMassK0s > lLowerLimitK0Short ) ){ | |
4f8ed367 | 899 | //Pre-selection in case this is AA... |
900 | if( fkIsNuclear == kFALSE ) fTree->Fill(); | |
901 | if( fkIsNuclear == kTRUE){ | |
902 | //If this is a nuclear collision___________________ | |
903 | // ... pre-filter with TPC, daughter eta selection | |
904 | if( (fTreeVariableInvMassLambda < lUpperLimitLambda && fTreeVariableInvMassLambda > lLowerLimitLambda | |
905 | && TMath::Abs(fTreeVariableNSigmasPosProton) < 6.0 && TMath::Abs(fTreeVariableNSigmasNegPion) < 6.0 ) || | |
906 | (fTreeVariableInvMassAntiLambda < lUpperLimitLambda && fTreeVariableInvMassAntiLambda > lLowerLimitLambda | |
907 | && TMath::Abs(fTreeVariableNSigmasNegProton) < 6.0 && TMath::Abs(fTreeVariableNSigmasPosPion) < 6.0 ) || | |
908 | (fTreeVariableInvMassK0s < lUpperLimitK0Short && fTreeVariableInvMassK0s > lLowerLimitK0Short | |
909 | && TMath::Abs(fTreeVariableNSigmasNegPion) < 6.0 && TMath::Abs(fTreeVariableNSigmasPosPion) < 6.0 ) ){ | |
910 | //insane test | |
911 | if ( TMath::Abs(fTreeVariableNegEta)<0.8 && TMath::Abs(fTreeVariablePosEta)<0.8 ) fTree->Fill(); | |
912 | } | |
913 | }//end nuclear_____________________________________ | |
bcb6ffdb | 914 | } |
915 | } | |
916 | ||
917 | //------------------------------------------------ | |
918 | // Fill tree over. | |
919 | //------------------------------------------------ | |
920 | ||
921 | }// This is the end of the V0 loop | |
922 | ||
923 | // Post output data. | |
924 | PostData(1, fListHistV0); | |
925 | PostData(2, fTree); | |
4f8ed367 | 926 | |
927 | ||
bcb6ffdb | 928 | } |
929 | ||
930 | //________________________________________________________________________ | |
931 | void AliAnalysisTaskExtractV0::Terminate(Option_t *) | |
932 | { | |
933 | // Draw result to the screen | |
934 | // Called once at the end of the query | |
935 | // This will draw the V0 candidate multiplicity, whose | |
936 | // number of entries corresponds to the number of triggered events. | |
937 | TList *cRetrievedList = 0x0; | |
938 | cRetrievedList = (TList*)GetOutputData(1); | |
939 | if(!cRetrievedList){ | |
940 | Printf("ERROR - AliAnalysisTaskExtractV0 : ouput data container list not available\n"); | |
941 | return; | |
942 | } | |
943 | fHistV0MultiplicityForTrigEvt = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistV0MultiplicityForTrigEvt") ); | |
944 | if (!fHistV0MultiplicityForTrigEvt) { | |
945 | Printf("ERROR - AliAnalysisTaskExtractV0 : fHistV0MultiplicityForTrigEvt not available"); | |
946 | return; | |
947 | } | |
948 | TCanvas *canCheck = new TCanvas("AliAnalysisTaskExtractV0","V0 Multiplicity",10,10,510,510); | |
949 | canCheck->cd(1)->SetLogy(); | |
950 | fHistV0MultiplicityForTrigEvt->SetMarkerStyle(22); | |
951 | fHistV0MultiplicityForTrigEvt->DrawCopy("E"); | |
952 | } | |
953 | ||
4f8ed367 | 954 | //________________________________________________________________________ |
955 | void AliAnalysisTaskExtractV0::CheckChargeV0(AliESDv0 *v0) | |
956 | { | |
957 | // This function checks charge of negative and positive daughter tracks. | |
958 | // If incorrectly defined (onfly vertexer), swaps out. | |
959 | if( v0->GetParamN()->Charge() > 0 && v0->GetParamP()->Charge() < 0 ){ | |
960 | //V0 daughter track swapping is required! Note: everything is swapped here... P->N, N->P | |
961 | Long_t lCorrectNidx = v0->GetPindex(); | |
962 | Long_t lCorrectPidx = v0->GetNindex(); | |
963 | Double32_t lCorrectNmom[3]; | |
964 | Double32_t lCorrectPmom[3]; | |
965 | v0->GetPPxPyPz( lCorrectNmom[0], lCorrectNmom[1], lCorrectNmom[2] ); | |
966 | v0->GetNPxPyPz( lCorrectPmom[0], lCorrectPmom[1], lCorrectPmom[2] ); | |
967 | ||
968 | AliExternalTrackParam lCorrectParamN( | |
969 | v0->GetParamP()->GetX() , | |
970 | v0->GetParamP()->GetAlpha() , | |
971 | v0->GetParamP()->GetParameter() , | |
972 | v0->GetParamP()->GetCovariance() | |
973 | ); | |
974 | AliExternalTrackParam lCorrectParamP( | |
975 | v0->GetParamN()->GetX() , | |
976 | v0->GetParamN()->GetAlpha() , | |
977 | v0->GetParamN()->GetParameter() , | |
978 | v0->GetParamN()->GetCovariance() | |
979 | ); | |
980 | lCorrectParamN.SetMostProbablePt( v0->GetParamP()->GetMostProbablePt() ); | |
981 | lCorrectParamP.SetMostProbablePt( v0->GetParamN()->GetMostProbablePt() ); | |
982 | ||
983 | //Get Variables___________________________________________________ | |
984 | Double_t lDcaV0Daughters = v0 -> GetDcaV0Daughters(); | |
985 | Double_t lCosPALocal = v0 -> GetV0CosineOfPointingAngle(); | |
986 | Bool_t lOnFlyStatusLocal = v0 -> GetOnFlyStatus(); | |
987 | ||
988 | //Create Replacement Object_______________________________________ | |
989 | AliESDv0 *v0correct = new AliESDv0(lCorrectParamN,lCorrectNidx,lCorrectParamP,lCorrectPidx); | |
990 | v0correct->SetDcaV0Daughters ( lDcaV0Daughters ); | |
991 | v0correct->SetV0CosineOfPointingAngle ( lCosPALocal ); | |
992 | v0correct->ChangeMassHypothesis ( kK0Short ); | |
993 | v0correct->SetOnFlyStatus ( lOnFlyStatusLocal ); | |
994 | ||
995 | //Reverse Cluster info..._________________________________________ | |
996 | v0correct->SetClusters( v0->GetClusters( 1 ), v0->GetClusters ( 0 ) ); | |
997 | ||
998 | *v0 = *v0correct; | |
999 | //Proper cleanup..._______________________________________________ | |
1000 | v0correct->Delete(); | |
1001 | v0correct = 0x0; | |
1002 | ||
1003 | //Just another cross-check and output_____________________________ | |
1004 | if( v0->GetParamN()->Charge() > 0 && v0->GetParamP()->Charge() < 0 ) { | |
1005 | AliWarning("Found Swapped Charges, tried to correct but something FAILED!"); | |
1006 | }else{ | |
1007 | //AliWarning("Found Swapped Charges and fixed."); | |
1008 | } | |
1009 | //________________________________________________________________ | |
1010 | }else{ | |
1011 | //Don't touch it! --- | |
1012 | //Printf("Ah, nice. Charges are already ordered..."); | |
1013 | } | |
1014 | return; | |
1015 | } |