Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Cascades / AliAnalysisTaskStrangenessVsMultiplicity.cxx
CommitLineData
af0d4791 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// This task is meant to explore the possibility of using a VZERO amplitude
19// based multiplicity estimator for proton-proton collisions. For this, two
20// main operation methods for this task are foreseen:
21//
22// 1) (under development) it should act as an auxiliary task and provide a
23// calibrated estimator
24//
25// 2) "Debug mode" which will also create a ROOT TTree object with event
26// by event info potentially used for exploration / calibration. This
27// includes the following info:
28//
29// --- All VZERO Amplitudes (saved as Float_t)
30// --- (optional) time for each channel
31// --- (optional) time width for each channel
32// --- GetReferenceMultiplicity Estimator, |eta|<0.5
33// --- GetReferenceMultiplicity Estimator, |eta|<0.8
34// --- (if MC) True Multiplicity, |eta|<0.5
35// --- (if MC) True Multiplicity, 2.8 < eta < 5.8 (VZEROA region)
36// --- (if MC) True Multiplicity, -3.7 < eta <-1.7 (VZEROC region)
37// --- Run Number
38//
39// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40
41class TTree;
42class TParticle;
43class TVector3;
44
45//class AliMCEventHandler;
46//class AliMCEvent;
47//class AliStack;
48
49class AliESDVertex;
50class AliAODVertex;
51class AliESDv0;
52class AliAODv0;
53
54#include <Riostream.h>
55#include "TList.h"
56#include "TH1.h"
57#include "TH2.h"
58#include "TH3.h"
59#include "TFile.h"
60#include "THnSparse.h"
61#include "TVector3.h"
62#include "TCanvas.h"
63#include "TMath.h"
64#include "TLegend.h"
65//#include "AliLog.h"
66
67#include "AliESDEvent.h"
68#include "AliAODEvent.h"
69#include "AliV0vertexer.h"
70#include "AliCascadeVertexer.h"
71#include "AliESDpid.h"
72#include "AliESDtrack.h"
73#include "AliESDtrackCuts.h"
74#include "AliInputEventHandler.h"
75#include "AliAnalysisManager.h"
76#include "AliMCEventHandler.h"
77#include "AliMCEvent.h"
78#include "AliStack.h"
79#include "AliCentrality.h"
b40a01ae 80#include "AliPPVsMultUtils.h"
af0d4791 81
82#include "AliCFContainer.h"
83#include "AliMultiplicity.h"
84#include "AliAODMCParticle.h"
85#include "AliESDcascade.h"
86#include "AliAODcascade.h"
87#include "AliESDUtils.h"
88#include "AliGenEventHeader.h"
89#include "AliAnalysisTaskSE.h"
90#include "AliAnalysisUtils.h"
91#include "AliAnalysisTaskStrangenessVsMultiplicity.h"
92
93using std::cout;
94using std::endl;
95
96ClassImp(AliAnalysisTaskStrangenessVsMultiplicity)
97
98AliAnalysisTaskStrangenessVsMultiplicity::AliAnalysisTaskStrangenessVsMultiplicity()
15863da5 99 : AliAnalysisTaskSE(), fListHist(0), fTreeEvent(0), fTreeV0(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0), fPPVsMultUtils(0), fUtils(0),
af0d4791 100 fkSaveV0Tree ( kFALSE ),
101 fkSaveCascadeTree ( kTRUE ),
102 fkRunVertexers ( kTRUE ),
758b26b0 103 fkSkipEventSelection( kFALSE ),
af0d4791 104 //---> Variables for fTreeEvent
105 fAmplitude_V0A (0),
106 fAmplitude_V0C (0),
107 fAmplitude_V0AEq (0),
108 fAmplitude_V0CEq (0),
109 fCentrality_V0A(0),
110 fCentrality_V0C(0),
111 fCentrality_V0M(0),
112 fCentrality_V0AEq(0),
113 fCentrality_V0CEq(0),
114 fCentrality_V0MEq(0),
b40a01ae 115 fCustomCentrality_V0M(0),
116 fCustomCentrality_V0MEq(0),
af0d4791 117 fRefMultEta5(0),
118 fRefMultEta8(0),
119 fRunNumber(0),
47529a6d 120 fEvSel_HasAtLeastSPDVertex(0),
121 fEvSel_VtxZCut(0),
122 fEvSel_IsNotPileup(0),
15863da5 123 fEvSel_IsNotPileupMV(0),
47529a6d 124 fEvSel_IsNotPileupInMultBins(0),
125 fEvSel_HasVtxContributor(0),
126 fEvSel_nTracklets(0),
127 fEvSel_nSPDClusters(0),
128
161c57ac 129 //---> Variables for fTreeV0
130 fTreeVariableChi2V0(0),
131 fTreeVariableDcaV0Daughters(0),
132 fTreeVariableDcaV0ToPrimVertex(0),
133 fTreeVariableDcaPosToPrimVertex(0),
134 fTreeVariableDcaNegToPrimVertex(0),
135 fTreeVariableV0CosineOfPointingAngle(0),
136 fTreeVariableV0Radius(0),
137 fTreeVariablePt(0),
138 fTreeVariableRapK0Short(0),
139 fTreeVariableRapLambda(0),
140 fTreeVariableInvMassK0s(0),
141 fTreeVariableInvMassLambda(0),
142 fTreeVariableInvMassAntiLambda(0),
143 fTreeVariableAlphaV0(0),
144 fTreeVariablePtArmV0(0),
145 fTreeVariableNegEta(0),
146 fTreeVariablePosEta(0),
147
148 fTreeVariableNSigmasPosProton(0),
149 fTreeVariableNSigmasPosPion(0),
150 fTreeVariableNSigmasNegProton(0),
151 fTreeVariableNSigmasNegPion(0),
152
153 fTreeVariableDistOverTotMom(0),
154 fTreeVariableLeastNbrCrossedRows(0),
155 fTreeVariableLeastRatioCrossedRowsOverFindable(0),
156
157 fTreeVariableCentV0A(0),
158 fTreeVariableCentV0C(0),
159 fTreeVariableCentV0M(0),
160 fTreeVariableCentV0AEq(0),
161 fTreeVariableCentV0CEq(0),
162 fTreeVariableCentV0MEq(0),
163 fTreeVariableAmpV0A(0),
164 fTreeVariableAmpV0C(0),
165 fTreeVariableAmpV0AEq(0),
166 fTreeVariableAmpV0CEq(0),
167 fTreeVariableRefMultEta8(0),
168 fTreeVariableRefMultEta5(0),
169 fTreeVariableRunNumber(0),
af0d4791 170 //---> Variables for fTreeCascade
171 fTreeCascVarCharge(0),
172 fTreeCascVarMassAsXi(0),
173 fTreeCascVarMassAsOmega(0),
174 fTreeCascVarPt(0),
175 fTreeCascVarRapXi(0),
176 fTreeCascVarRapOmega(0),
177 fTreeCascVarNegEta(0),
178 fTreeCascVarPosEta(0),
179 fTreeCascVarBachEta(0),
180 fTreeCascVarDCACascDaughters(0),
181 fTreeCascVarDCABachToPrimVtx(0),
182 fTreeCascVarDCAV0Daughters(0),
183 fTreeCascVarDCAV0ToPrimVtx(0),
184 fTreeCascVarDCAPosToPrimVtx(0),
185 fTreeCascVarDCANegToPrimVtx(0),
186 fTreeCascVarCascCosPointingAngle(0),
187 fTreeCascVarCascRadius(0),
188 fTreeCascVarV0Mass(0),
189 fTreeCascVarV0CosPointingAngle(0),
190 fTreeCascVarV0CosPointingAngleSpecial(0),
191 fTreeCascVarV0Radius(0),
192 fTreeCascVarLeastNbrClusters(0),
193 fTreeCascVarDistOverTotMom(0),
194 fTreeCascVarNegNSigmaPion(0),
195 fTreeCascVarNegNSigmaProton(0),
196 fTreeCascVarPosNSigmaPion(0),
197 fTreeCascVarPosNSigmaProton(0),
198 fTreeCascVarBachNSigmaPion(0),
199 fTreeCascVarBachNSigmaKaon(0),
200 fTreeCascVarCentV0A(0),
201 fTreeCascVarCentV0C(0),
202 fTreeCascVarCentV0M(0),
203 fTreeCascVarCentV0AEq(0),
204 fTreeCascVarCentV0CEq(0),
205 fTreeCascVarCentV0MEq(0),
206 fTreeCascVarAmpV0A(0),
207 fTreeCascVarAmpV0C(0),
208 fTreeCascVarAmpV0AEq(0),
209 fTreeCascVarAmpV0CEq(0),
210 fTreeCascVarRefMultEta8(0),
211 fTreeCascVarRefMultEta5(0),
26d39641 212 fTreeCascVarRunNumber(0),
af0d4791 213 //Histos
214 fHistEventCounter(0)
215//------------------------------------------------
216// Tree Variables
217{
218
219}
220
221AliAnalysisTaskStrangenessVsMultiplicity::AliAnalysisTaskStrangenessVsMultiplicity(const char *name)
15863da5 222 : AliAnalysisTaskSE(name), fListHist(0), fTreeEvent(0), fTreeV0(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0), fPPVsMultUtils(0), fUtils(0),
af0d4791 223 fkSaveV0Tree ( kFALSE ),
224 fkSaveCascadeTree ( kTRUE ),
225 fkRunVertexers ( kTRUE ),
758b26b0 226 fkSkipEventSelection( kFALSE ),
af0d4791 227 //---> Variables for fTreeEvent
228 fAmplitude_V0A (0),
229 fAmplitude_V0C (0),
230 fAmplitude_V0AEq (0),
231 fAmplitude_V0CEq (0),
232 fCentrality_V0A(0),
233 fCentrality_V0C(0),
234 fCentrality_V0M(0),
235 fCentrality_V0AEq(0),
236 fCentrality_V0CEq(0),
b40a01ae 237 fCentrality_V0MEq(0),
238 fCustomCentrality_V0M(0),
239 fCustomCentrality_V0MEq(0),
af0d4791 240 fRefMultEta5(0),
241 fRefMultEta8(0),
242 fRunNumber(0),
47529a6d 243 fEvSel_HasAtLeastSPDVertex(0),
244 fEvSel_VtxZCut(0),
245 fEvSel_IsNotPileup(0),
15863da5 246 fEvSel_IsNotPileupMV(0),
47529a6d 247 fEvSel_IsNotPileupInMultBins(0),
248 fEvSel_HasVtxContributor(0),
249 fEvSel_nTracklets(0),
250 fEvSel_nSPDClusters(0),
251
161c57ac 252 //---> Variables for fTreeV0
253 fTreeVariableChi2V0(0),
254 fTreeVariableDcaV0Daughters(0),
255 fTreeVariableDcaV0ToPrimVertex(0),
256 fTreeVariableDcaPosToPrimVertex(0),
257 fTreeVariableDcaNegToPrimVertex(0),
258 fTreeVariableV0CosineOfPointingAngle(0),
259 fTreeVariableV0Radius(0),
260 fTreeVariablePt(0),
261 fTreeVariableRapK0Short(0),
262 fTreeVariableRapLambda(0),
263 fTreeVariableInvMassK0s(0),
264 fTreeVariableInvMassLambda(0),
265 fTreeVariableInvMassAntiLambda(0),
266 fTreeVariableAlphaV0(0),
267 fTreeVariablePtArmV0(0),
268 fTreeVariableNegEta(0),
269 fTreeVariablePosEta(0),
270
271 fTreeVariableNSigmasPosProton(0),
272 fTreeVariableNSigmasPosPion(0),
273 fTreeVariableNSigmasNegProton(0),
274 fTreeVariableNSigmasNegPion(0),
275
276 fTreeVariableDistOverTotMom(0),
277 fTreeVariableLeastNbrCrossedRows(0),
278 fTreeVariableLeastRatioCrossedRowsOverFindable(0),
279
280 fTreeVariableCentV0A(0),
281 fTreeVariableCentV0C(0),
282 fTreeVariableCentV0M(0),
283 fTreeVariableCentV0AEq(0),
284 fTreeVariableCentV0CEq(0),
285 fTreeVariableCentV0MEq(0),
286 fTreeVariableAmpV0A(0),
287 fTreeVariableAmpV0C(0),
288 fTreeVariableAmpV0AEq(0),
289 fTreeVariableAmpV0CEq(0),
290 fTreeVariableRefMultEta8(0),
291 fTreeVariableRefMultEta5(0),
292 fTreeVariableRunNumber(0),
af0d4791 293 //---> Variables for fTreeCascade
294 fTreeCascVarCharge(0),
295 fTreeCascVarMassAsXi(0),
296 fTreeCascVarMassAsOmega(0),
297 fTreeCascVarPt(0),
298 fTreeCascVarRapXi(0),
299 fTreeCascVarRapOmega(0),
300 fTreeCascVarNegEta(0),
301 fTreeCascVarPosEta(0),
302 fTreeCascVarBachEta(0),
303 fTreeCascVarDCACascDaughters(0),
304 fTreeCascVarDCABachToPrimVtx(0),
305 fTreeCascVarDCAV0Daughters(0),
306 fTreeCascVarDCAV0ToPrimVtx(0),
307 fTreeCascVarDCAPosToPrimVtx(0),
308 fTreeCascVarDCANegToPrimVtx(0),
309 fTreeCascVarCascCosPointingAngle(0),
310 fTreeCascVarCascRadius(0),
311 fTreeCascVarV0Mass(0),
312 fTreeCascVarV0CosPointingAngle(0),
313 fTreeCascVarV0CosPointingAngleSpecial(0),
314 fTreeCascVarV0Radius(0),
315 fTreeCascVarLeastNbrClusters(0),
316 fTreeCascVarDistOverTotMom(0),
317 fTreeCascVarNegNSigmaPion(0),
318 fTreeCascVarNegNSigmaProton(0),
319 fTreeCascVarPosNSigmaPion(0),
320 fTreeCascVarPosNSigmaProton(0),
321 fTreeCascVarBachNSigmaPion(0),
322 fTreeCascVarBachNSigmaKaon(0),
323 fTreeCascVarCentV0A(0),
324 fTreeCascVarCentV0C(0),
325 fTreeCascVarCentV0M(0),
326 fTreeCascVarCentV0AEq(0),
327 fTreeCascVarCentV0CEq(0),
328 fTreeCascVarCentV0MEq(0),
329 fTreeCascVarAmpV0A(0),
330 fTreeCascVarAmpV0C(0),
331 fTreeCascVarAmpV0AEq(0),
332 fTreeCascVarAmpV0CEq(0),
333 fTreeCascVarRefMultEta8(0),
334 fTreeCascVarRefMultEta5(0),
26d39641 335 fTreeCascVarRunNumber(0),
af0d4791 336 //Histos
337 fHistEventCounter(0)
338{
339
340 //Re-vertex: Will only apply for cascade candidates
341
342 fV0VertexerSels[0] = 33. ; // max allowed chi2
343 fV0VertexerSels[1] = 0.02; // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
344 fV0VertexerSels[2] = 0.02; // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
345 fV0VertexerSels[4] = 0.95; // min allowed cosine of V0's pointing angle (LHC09a4 : 0.99)
346 fV0VertexerSels[5] = 1.0 ; // min radius of the fiducial volume (LHC09a4 : 0.2)
347 fV0VertexerSels[6] = 200. ; // max radius of the fiducial volume (LHC09a4 : 100.0)
348
349 fCascadeVertexerSels[0] = 33. ; // max allowed chi2 (same as PDC07)
350 fCascadeVertexerSels[1] = 0.05 ; // min allowed V0 impact parameter (PDC07 : 0.05 / LHC09a4 : 0.025 )
351 fCascadeVertexerSels[2] = 0.010; // "window" around the Lambda mass (PDC07 : 0.008 / LHC09a4 : 0.010 )
352 fCascadeVertexerSels[3] = 0.03 ; // min allowed bachelor's impact parameter (PDC07 : 0.035 / LHC09a4 : 0.025 )
353 fCascadeVertexerSels[4] = 2.0 ; // max allowed DCA between the V0 and the bachelor (PDC07 : 0.1 / LHC09a4 : 0.2 )
354 fCascadeVertexerSels[5] = 0.95 ; // min allowed cosine of the cascade pointing angle (PDC07 : 0.9985 / LHC09a4 : 0.998 )
355 fCascadeVertexerSels[6] = 0.4 ; // min radius of the fiducial volume (PDC07 : 0.9 / LHC09a4 : 0.2 )
356 fCascadeVertexerSels[7] = 100. ; // max radius of the fiducial volume (PDC07 : 100 / LHC09a4 : 100 )
357
358
359 DefineOutput(1, TList::Class()); // Event Counter Histo
360 DefineOutput(2, TTree::Class()); // Event Tree
361 DefineOutput(3, TTree::Class()); // V0 Tree
362 DefineOutput(4, TTree::Class()); // Cascade Tree
363}
364
365
366AliAnalysisTaskStrangenessVsMultiplicity::~AliAnalysisTaskStrangenessVsMultiplicity()
367{
368//------------------------------------------------
369// DESTRUCTOR
370//------------------------------------------------
371
372 if (fListHist){
373 delete fListHist;
374 fListHist = 0x0;
375 }
376 if (fTreeEvent){
377 delete fTreeEvent;
378 fTreeEvent = 0x0;
379 }
380 if (fTreeV0){
381 delete fTreeV0;
382 fTreeV0 = 0x0;
383 }
384 if (fTreeCascade){
385 delete fTreeCascade;
386 fTreeCascade = 0x0;
387 }
b40a01ae 388 if (fPPVsMultUtils){
389 delete fPPVsMultUtils;
390 fPPVsMultUtils = 0x0;
391 }
15863da5 392 if (fUtils){
393 delete fUtils;
394 fUtils = 0x0;
395 }
af0d4791 396}
397
398//________________________________________________________________________
399void AliAnalysisTaskStrangenessVsMultiplicity::UserCreateOutputObjects()
400{
401
402 OpenFile(2);
403 // Called once
404
405//------------------------------------------------
406
407 fTreeEvent = new TTree("fTreeEvent","Event");
408
409//------------------------------------------------
410// fTree Branch definitions - Event by Event info
411//------------------------------------------------
412
413//-----------BASIC-INFO---------------------------
414
415 //--- VZERO Data (Integrated)
416 fTreeEvent->Branch("fAmplitude_V0A",&fAmplitude_V0A,"fAmplitude_V0A/F");
417 fTreeEvent->Branch("fAmplitude_V0C",&fAmplitude_V0C,"fAmplitude_V0C/F");
418 fTreeEvent->Branch("fAmplitude_V0AEq",&fAmplitude_V0AEq,"fAmplitude_V0AEq/F");
419 fTreeEvent->Branch("fAmplitude_V0CEq",&fAmplitude_V0CEq,"fAmplitude_V0CEq/F");
420
421 //Info from AliCentrality (not necessarily 'centrality' per se)
422 fTreeEvent->Branch("fCentrality_V0A",&fCentrality_V0A,"fCentrality_V0A/F");
423 fTreeEvent->Branch("fCentrality_V0C",&fCentrality_V0C,"fCentrality_V0C/F");
34442f2a 424 fTreeEvent->Branch("fCentrality_V0M",&fCentrality_V0M,"fCentrality_V0M/F");
af0d4791 425 fTreeEvent->Branch("fCentrality_V0AEq",&fCentrality_V0AEq,"fCentrality_V0AEq/F");
426 fTreeEvent->Branch("fCentrality_V0CEq",&fCentrality_V0CEq,"fCentrality_V0CEq/F");
34442f2a 427 fTreeEvent->Branch("fCentrality_V0MEq",&fCentrality_V0MEq,"fCentrality_V0MEq/F");
b40a01ae 428 fTreeEvent->Branch("fCustomCentrality_V0M",&fCustomCentrality_V0M,"fCustomCentrality_V0M/F");
429 fTreeEvent->Branch("fCustomCentrality_V0MEq",&fCustomCentrality_V0MEq,"fCustomCentrality_V0MEq/F");
430
af0d4791 431 //Official GetReferenceMultiplicity
432 fTreeEvent->Branch("fRefMultEta5",&fRefMultEta5,"fRefMultEta5/I");
433 fTreeEvent->Branch("fRefMultEta8",&fRefMultEta8,"fRefMultEta8/I");
434
435 //Run Number
436 fTreeEvent->Branch("fRunNumber", &fRunNumber, "fRunNumber/I");
437
47529a6d 438 //Booleans for Event Selection
439 fTreeEvent->Branch("fEvSel_HasAtLeastSPDVertex", &fEvSel_HasAtLeastSPDVertex, "fEvSel_HasAtLeastSPDVertex/O");
440 fTreeEvent->Branch("fEvSel_VtxZCut", &fEvSel_VtxZCut, "fEvSel_VtxZCut/O");
441 fTreeEvent->Branch("fEvSel_IsNotPileup", &fEvSel_IsNotPileup, "fEvSel_IsNotPileup/O");
15863da5 442 fTreeEvent->Branch("fEvSel_IsNotPileupMV", &fEvSel_IsNotPileupMV, "fEvSel_IsNotPileupMV/O");
47529a6d 443 fTreeEvent->Branch("fEvSel_IsNotPileupInMultBins", &fEvSel_IsNotPileupInMultBins, "fEvSel_IsNotPileupInMultBins/O");
444 fTreeEvent->Branch("fEvSel_HasVtxContributor", &fEvSel_HasVtxContributor, "fEvSel_HasVtxContributor/O");
445
446 //Tracklets vs clusters test
447 fTreeEvent->Branch("fEvSel_nTracklets", &fEvSel_nTracklets, "fEvSel_nTracklets/I");
448 fTreeEvent->Branch("fEvSel_nSPDClusters", &fEvSel_nSPDClusters, "fEvSel_nSPDClusters/I");
449
af0d4791 450 //Create Basic V0 Output Tree
451 fTreeV0 = new TTree( "fTreeV0", "V0 Candidates");
452
161c57ac 453//------------------------------------------------
454// fTreeV0 Branch definitions
455//------------------------------------------------
456
457//-----------BASIC-INFO---------------------------
458 fTreeV0->Branch("fTreeVariableChi2V0",&fTreeVariableChi2V0,"fTreeVariableChi2V0/F");
459 fTreeV0->Branch("fTreeVariableDcaV0Daughters",&fTreeVariableDcaV0Daughters,"fTreeVariableDcaV0Daughters/F");
460 fTreeV0->Branch("fTreeVariableDcaV0ToPrimVertex",&fTreeVariableDcaV0ToPrimVertex,"fTreeVariableDcaV0ToPrimVertex/F");
461 fTreeV0->Branch("fTreeVariableDcaPosToPrimVertex",&fTreeVariableDcaPosToPrimVertex,"fTreeVariableDcaPosToPrimVertex/F");
462 fTreeV0->Branch("fTreeVariableDcaNegToPrimVertex",&fTreeVariableDcaNegToPrimVertex,"fTreeVariableDcaNegToPrimVertex/F");
463 fTreeV0->Branch("fTreeVariableV0Radius",&fTreeVariableV0Radius,"fTreeVariableV0Radius/F");
464 fTreeV0->Branch("fTreeVariablePt",&fTreeVariablePt,"fTreeVariablePt/F");
465 fTreeV0->Branch("fTreeVariableRapK0Short",&fTreeVariableRapK0Short,"fTreeVariableRapK0Short/F");
466 fTreeV0->Branch("fTreeVariableRapLambda",&fTreeVariableRapLambda,"fTreeVariableRapLambda/F");
467 fTreeV0->Branch("fTreeVariableInvMassK0s",&fTreeVariableInvMassK0s,"fTreeVariableInvMassK0s/F");
468 fTreeV0->Branch("fTreeVariableInvMassLambda",&fTreeVariableInvMassLambda,"fTreeVariableInvMassLambda/F");
469 fTreeV0->Branch("fTreeVariableInvMassAntiLambda",&fTreeVariableInvMassAntiLambda,"fTreeVariableInvMassAntiLambda/F");
470 fTreeV0->Branch("fTreeVariableV0CosineOfPointingAngle",&fTreeVariableV0CosineOfPointingAngle,"fTreeVariableV0CosineOfPointingAngle/F");
471 fTreeV0->Branch("fTreeVariableAlphaV0",&fTreeVariableAlphaV0,"fTreeVariableAlphaV0/F");
472 fTreeV0->Branch("fTreeVariablePtArmV0",&fTreeVariablePtArmV0,"fTreeVariablePtArmV0/F");
473 fTreeV0->Branch("fTreeVariableLeastNbrCrossedRows",&fTreeVariableLeastNbrCrossedRows,"fTreeVariableLeastNbrCrossedRows/I");
474 fTreeV0->Branch("fTreeVariableLeastRatioCrossedRowsOverFindable",&fTreeVariableLeastRatioCrossedRowsOverFindable,"fTreeVariableLeastRatioCrossedRowsOverFindable/F");
475 fTreeV0->Branch("fTreeVariableDistOverTotMom",&fTreeVariableDistOverTotMom,"fTreeVariableDistOverTotMom/F");
476 fTreeV0->Branch("fTreeVariableNSigmasPosProton",&fTreeVariableNSigmasPosProton,"fTreeVariableNSigmasPosProton/F");
477 fTreeV0->Branch("fTreeVariableNSigmasPosPion",&fTreeVariableNSigmasPosPion,"fTreeVariableNSigmasPosPion/F");
478 fTreeV0->Branch("fTreeVariableNSigmasNegProton",&fTreeVariableNSigmasNegProton,"fTreeVariableNSigmasNegProton/F");
479 fTreeV0->Branch("fTreeVariableNSigmasNegPion",&fTreeVariableNSigmasNegPion,"fTreeVariableNSigmasNegPion/F");
480 fTreeV0->Branch("fTreeVariableNegEta",&fTreeVariableNegEta,"fTreeVariableNegEta/F");
481 fTreeV0->Branch("fTreeVariablePosEta",&fTreeVariablePosEta,"fTreeVariablePosEta/F");
482//-----------MULTIPLICITY-INFO--------------------
483 fTreeV0->Branch("fTreeVariableCentV0A",&fTreeVariableCentV0A,"fTreeVariableCentV0A/F");
484 fTreeV0->Branch("fTreeVariableCentV0C",&fTreeVariableCentV0C,"fTreeVariableCentV0C/F");
485 fTreeV0->Branch("fTreeVariableCentV0M",&fTreeVariableCentV0M,"fTreeVariableCentV0M/F");
486 fTreeV0->Branch("fTreeVariableCentV0AEq",&fTreeVariableCentV0AEq,"fTreeVariableCentV0AEq/F");
487 fTreeV0->Branch("fTreeVariableCentV0CEq",&fTreeVariableCentV0CEq,"fTreeVariableCentV0CEq/F");
488 fTreeV0->Branch("fTreeVariableCentV0MEq",&fTreeVariableCentV0MEq,"fTreeVariableCentV0MEq/F");
489 fTreeV0->Branch("fTreeVariableAmpV0A",&fTreeVariableAmpV0A,"fTreeVariableAmpV0A/F");
490 fTreeV0->Branch("fTreeVariableAmpV0C",&fTreeVariableAmpV0C,"fTreeVariableAmpV0C/F");
491 fTreeV0->Branch("fTreeVariableAmpV0AEq",&fTreeVariableAmpV0AEq,"fTreeVariableAmpV0AEq/F");
492 fTreeV0->Branch("fTreeVariableAmpV0CEq",&fTreeVariableAmpV0CEq,"fTreeVariableAmpV0CEq/F");
493 fTreeV0->Branch("fTreeVariableRefMultEta8",&fTreeVariableRefMultEta8,"fTreeVariableRefMultEta8/I");
494 fTreeV0->Branch("fTreeVariableRefMultEta5",&fTreeVariableRefMultEta5,"fTreeVariableRefMultEta5/I");
495 fTreeV0->Branch("fTreeVariableRunNumber",&fTreeVariableRunNumber,"fTreeVariableRunNumber/I");
496//------------------------------------------------
497
af0d4791 498 //Create Cascade output tree
499 fTreeCascade = new TTree("fTreeCascade","CascadeCandidates");
500
501//------------------------------------------------
502// fTreeCascade Branch definitions - Cascade Tree
503//------------------------------------------------
504
505//-----------BASIC-INFO---------------------------
506 fTreeCascade->Branch("fTreeCascVarCharge",&fTreeCascVarCharge,"fTreeCascVarCharge/I");
507 fTreeCascade->Branch("fTreeCascVarMassAsXi",&fTreeCascVarMassAsXi,"fTreeCascVarMassAsXi/F");
508 fTreeCascade->Branch("fTreeCascVarMassAsOmega",&fTreeCascVarMassAsOmega,"fTreeCascVarMassAsOmega/F");
509 fTreeCascade->Branch("fTreeCascVarPt",&fTreeCascVarPt,"fTreeCascVarPt/F");
510 fTreeCascade->Branch("fTreeCascVarRapXi",&fTreeCascVarRapXi,"fTreeCascVarRapXi/F");
511 fTreeCascade->Branch("fTreeCascVarRapOmega",&fTreeCascVarRapOmega,"fTreeCascVarRapOmega/F");
512 fTreeCascade->Branch("fTreeCascVarNegEta",&fTreeCascVarNegEta,"fTreeCascVarNegEta/F");
513 fTreeCascade->Branch("fTreeCascVarPosEta",&fTreeCascVarPosEta,"fTreeCascVarPosEta/F");
514 fTreeCascade->Branch("fTreeCascVarBachEta",&fTreeCascVarBachEta,"fTreeCascVarBachEta/F");
515//-----------INFO-FOR-CUTS------------------------
516 fTreeCascade->Branch("fTreeCascVarDCACascDaughters",&fTreeCascVarDCACascDaughters,"fTreeCascVarDCACascDaughters/F");
517 fTreeCascade->Branch("fTreeCascVarDCABachToPrimVtx",&fTreeCascVarDCABachToPrimVtx,"fTreeCascVarDCABachToPrimVtx/F");
518 fTreeCascade->Branch("fTreeCascVarDCAV0Daughters",&fTreeCascVarDCAV0Daughters,"fTreeCascVarDCAV0Daughters/F");
519 fTreeCascade->Branch("fTreeCascVarDCAV0ToPrimVtx",&fTreeCascVarDCAV0ToPrimVtx,"fTreeCascVarDCAV0ToPrimVtx/F");
520 fTreeCascade->Branch("fTreeCascVarDCAPosToPrimVtx",&fTreeCascVarDCAPosToPrimVtx,"fTreeCascVarDCAPosToPrimVtx/F");
521 fTreeCascade->Branch("fTreeCascVarDCANegToPrimVtx",&fTreeCascVarDCANegToPrimVtx,"fTreeCascVarDCANegToPrimVtx/F");
522 fTreeCascade->Branch("fTreeCascVarCascCosPointingAngle",&fTreeCascVarCascCosPointingAngle,"fTreeCascVarCascCosPointingAngle/F");
523 fTreeCascade->Branch("fTreeCascVarCascRadius",&fTreeCascVarCascRadius,"fTreeCascVarCascRadius/F");
524 fTreeCascade->Branch("fTreeCascVarV0Mass",&fTreeCascVarV0Mass,"fTreeCascVarV0Mass/F");
525 fTreeCascade->Branch("fTreeCascVarV0CosPointingAngle",&fTreeCascVarV0CosPointingAngle,"fTreeCascVarV0CosPointingAngle/F");
526 fTreeCascade->Branch("fTreeCascVarV0CosPointingAngleSpecial",&fTreeCascVarV0CosPointingAngleSpecial,"fTreeCascVarV0CosPointingAngleSpecial/F");
527 fTreeCascade->Branch("fTreeCascVarV0Radius",&fTreeCascVarV0Radius,"fTreeCascVarV0Radius/F");
528 fTreeCascade->Branch("fTreeCascVarLeastNbrClusters",&fTreeCascVarLeastNbrClusters,"fTreeCascVarLeastNbrClusters/I");
529//-----------MULTIPLICITY-INFO--------------------
530 fTreeCascade->Branch("fTreeCascVarCentV0A",&fTreeCascVarCentV0A,"fTreeCascVarCentV0A/F");
531 fTreeCascade->Branch("fTreeCascVarCentV0C",&fTreeCascVarCentV0C,"fTreeCascVarCentV0C/F");
532 fTreeCascade->Branch("fTreeCascVarCentV0M",&fTreeCascVarCentV0M,"fTreeCascVarCentV0M/F");
533 fTreeCascade->Branch("fTreeCascVarCentV0AEq",&fTreeCascVarCentV0AEq,"fTreeCascVarCentV0AEq/F");
534 fTreeCascade->Branch("fTreeCascVarCentV0CEq",&fTreeCascVarCentV0CEq,"fTreeCascVarCentV0CEq/F");
535 fTreeCascade->Branch("fTreeCascVarCentV0MEq",&fTreeCascVarCentV0MEq,"fTreeCascVarCentV0MEq/F");
536 fTreeCascade->Branch("fTreeCascVarAmpV0A",&fTreeCascVarAmpV0A,"fTreeCascVarAmpV0A/F");
537 fTreeCascade->Branch("fTreeCascVarAmpV0C",&fTreeCascVarAmpV0C,"fTreeCascVarAmpV0C/F");
538 fTreeCascade->Branch("fTreeCascVarAmpV0AEq",&fTreeCascVarAmpV0AEq,"fTreeCascVarAmpV0AEq/F");
539 fTreeCascade->Branch("fTreeCascVarAmpV0CEq",&fTreeCascVarAmpV0CEq,"fTreeCascVarAmpV0CEq/F");
540 fTreeCascade->Branch("fTreeCascVarRefMultEta8",&fTreeCascVarRefMultEta8,"fTreeCascVarRefMultEta8/I");
541 fTreeCascade->Branch("fTreeCascVarRefMultEta5",&fTreeCascVarRefMultEta5,"fTreeCascVarRefMultEta5/I");
26d39641 542 fTreeCascade->Branch("fTreeCascVarRunNumber",&fTreeCascVarRunNumber,"fTreeCascVarRunNumber/I");
af0d4791 543//-----------DECAY-LENGTH-INFO--------------------
544 fTreeCascade->Branch("fTreeCascVarDistOverTotMom",&fTreeCascVarDistOverTotMom,"fTreeCascVarDistOverTotMom/F");
545//------------------------------------------------
546 fTreeCascade->Branch("fTreeCascVarNegNSigmaPion",&fTreeCascVarNegNSigmaPion,"fTreeCascVarNegNSigmaPion/F");
547 fTreeCascade->Branch("fTreeCascVarNegNSigmaProton",&fTreeCascVarNegNSigmaProton,"fTreeCascVarNegNSigmaProton/F");
548 fTreeCascade->Branch("fTreeCascVarPosNSigmaPion",&fTreeCascVarPosNSigmaPion,"fTreeCascVarPosNSigmaPion/F");
549 fTreeCascade->Branch("fTreeCascVarPosNSigmaProton",&fTreeCascVarPosNSigmaProton,"fTreeCascVarPosNSigmaProton/F");
550 fTreeCascade->Branch("fTreeCascVarBachNSigmaPion",&fTreeCascVarBachNSigmaPion,"fTreeCascVarBachNSigmaPion/F");
551 fTreeCascade->Branch("fTreeCascVarBachNSigmaKaon",&fTreeCascVarBachNSigmaKaon,"fTreeCascVarBachNSigmaKaon/F");
552
553//------------------------------------------------
554// Particle Identification Setup
555//------------------------------------------------
556
557 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
558 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
559 fPIDResponse = inputHandler->GetPIDResponse();
560
561 // Multiplicity
562 if(! fESDtrackCuts ){
563 fESDtrackCuts = new AliESDtrackCuts();
564 }
15863da5 565 //Helper
566 if(! fPPVsMultUtils ){
567 fPPVsMultUtils = new AliPPVsMultUtils();
568 }
569 //Analysis Utils
570 if(! fUtils ){
571 fUtils = new AliAnalysisUtils();
572 }
af0d4791 573
574//------------------------------------------------
575// V0 Multiplicity Histograms
576//------------------------------------------------
577
578 // Create histograms
579 OpenFile(1);
580 fListHist = new TList();
581 fListHist->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
582
583 if(! fHistEventCounter ) {
584 //Histogram Output: Event-by-Event
585 fHistEventCounter = new TH1D( "fHistEventCounter", ";Evt. Sel. Step;Count",5,0,5);
586 fHistEventCounter->GetXaxis()->SetBinLabel(1, "Processed");
587 fHistEventCounter->GetXaxis()->SetBinLabel(2, "Phys-Sel");
588 fHistEventCounter->GetXaxis()->SetBinLabel(3, "Has Vtx");
589 fHistEventCounter->GetXaxis()->SetBinLabel(4, "Vtx |z|<10cm");
590 fHistEventCounter->GetXaxis()->SetBinLabel(5, "Isn't Pileup");
591 fListHist->Add(fHistEventCounter);
592 }
593
594 //List of Histograms: Normal
595 PostData(1, fListHist);
596
597 //TTree Object: Saved to base directory. Should cache to disk while saving.
598 //(Important to avoid excessive memory usage, particularly when merging)
599 PostData(2, fTreeEvent);
600 PostData(3, fTreeV0);
601 PostData(4, fTreeCascade);
602
603}// end UserCreateOutputObjects
604
605
606//________________________________________________________________________
607void AliAnalysisTaskStrangenessVsMultiplicity::UserExec(Option_t *)
608{
609 // Main loop
610 // Called for each event
611
612 AliESDEvent *lESDevent = 0x0;
47529a6d 613
614 //Zero all booleans, etc
615 fEvSel_HasAtLeastSPDVertex = kFALSE;
616 fEvSel_VtxZCut = kFALSE;
617 fEvSel_IsNotPileup = kFALSE;
618 fEvSel_IsNotPileupInMultBins = kFALSE;
619 fEvSel_HasVtxContributor = kFALSE;
620
621 fEvSel_nTracklets = -1;
622 fEvSel_nSPDClusters = -1;
af0d4791 623
624 // Connect to the InputEvent
625 // After these lines, we should have an ESD/AOD event + the number of V0s in it.
626
627 // Appropriate for ESD analysis!
628
629 lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
630 if (!lESDevent) {
631 AliWarning("ERROR: lESDevent not available \n");
632 return;
633 }
634
635 //Get VZERO Information for multiplicity later
636 AliVVZERO* esdV0 = lESDevent->GetVZEROData();
637 if (!esdV0) {
638 AliError("AliVVZERO not available");
639 return;
640 }
641
642 fRunNumber = lESDevent->GetRunNumber();
643
644 Double_t lMagneticField = -10;
645 lMagneticField = lESDevent->GetMagneticField( );
646
647//------------------------------------------------
648// Variable Definition
649//------------------------------------------------
650
651//------------------------------------------------
652// Physics Selection
653//------------------------------------------------
654
655 fHistEventCounter->Fill(0.5);
656
657 UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
658 Bool_t isSelected = 0;
659 isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
660
758b26b0 661 //Standard Min-Bias Selection - always do this!
af0d4791 662 if ( ! isSelected ) {
663 PostData(1, fListHist);
664 PostData(2, fTreeEvent);
665 PostData(3, fTreeV0);
666 PostData(4, fTreeCascade);
667 return;
668 }
669
670 fHistEventCounter->Fill(1.5);
671
672 //------------------------------------------------
673 // Primary Vertex Requirements Section:
674 // ---> pp: has vertex, |z|<10cm
675 //------------------------------------------------
676
677 //classical Proton-proton like selection
678 const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex();
679 const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
680 const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
681
682 Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};
683 lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
684
685 //Only accept if Tracking or SPD vertex is fine
758b26b0 686 if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus() && !fkSkipEventSelection ){
af0d4791 687 AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
688 PostData(1, fListHist);
689 PostData(2, fTreeEvent);
690 PostData(3, fTreeV0);
691 PostData(4, fTreeCascade);
692 return;
693 }
694
47529a6d 695 if(! (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtx->GetStatus()) ){
696 //Passed selection!
697 fEvSel_HasAtLeastSPDVertex = kTRUE;
698 }
699
af0d4791 700 //Has SPD or Tracking Vertex
701 fHistEventCounter -> Fill(2.5);
702
703 //Always do Primary Vertex Selection
758b26b0 704 if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0 && !fkSkipEventSelection ) {
af0d4791 705 AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
706 PostData(1, fListHist);
707 PostData(2, fTreeEvent);
708 PostData(3, fTreeV0);
709 PostData(4, fTreeCascade);
710 return;
711 }
712
47529a6d 713 if(TMath::Abs(lBestPrimaryVtxPos[2]) <= 10.0 ){
714 //Passed selection!
715 fEvSel_VtxZCut = kTRUE;
716 }
717
af0d4791 718 //Fill Event selected counter
719 fHistEventCounter -> Fill(3.5);
720
721 //------------------------------------------------
722 // Check if this isn't pileup
723 //------------------------------------------------
724
758b26b0 725 if(lESDevent->IsPileupFromSPDInMultBins() && !fkSkipEventSelection ){
af0d4791 726 // minContributors=3, minZdist=0.8, nSigmaZdist=3., nSigmaDiamXY=2., nSigmaDiamZ=5.
727 //-> see http://alisoft.cern.ch/viewvc/trunk/STEER/AliESDEvent.h?root=AliRoot&r1=41914&r2=42199&pathrev=42199
728 AliWarning("Pb / Event tagged as pile-up by SPD... return !");
729 PostData(1, fListHist);
730 PostData(2, fTreeEvent);
731 PostData(3, fTreeV0);
732 PostData(4, fTreeCascade);
733 return;
734 }
47529a6d 735
736 if( !lESDevent->IsPileupFromSPD() ) fEvSel_IsNotPileup = kTRUE;
737 if( !lESDevent->IsPileupFromSPDInMultBins() ) fEvSel_IsNotPileupInMultBins = kTRUE;
738
15863da5 739 //First implementation of pileup from multi-vertexer (simple use of analysis utils)
740 if ( !fUtils->IsPileUpMV( lESDevent ) ) fEvSel_IsNotPileupMV = kTRUE;
741
af0d4791 742 //Fill Event isn't pileup counter
743 fHistEventCounter -> Fill(4.5);
744
745//------------------------------------------------
746// Multiplicity Information Acquistion
747//------------------------------------------------
748
749 //Standard GetReferenceMultiplicity Estimator (0.5 and 0.8)
750 fRefMultEta5 = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,0.5);
751 fRefMultEta8 = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,0.8);
752
753 // VZERO PART
754 Float_t multV0A = 0; // multiplicity from V0 reco side A
755 Float_t multV0C = 0; // multiplicity from V0 reco side C
756 Float_t multV0AEq = 0; // multiplicity from V0 reco side A
757 Float_t multV0CEq = 0; // multiplicity from V0 reco side C
758 Float_t multV0ACorr = 0; // multiplicity from V0 reco side A
759 Float_t multV0CCorr = 0; // multiplicity from V0 reco side C
760
761 //Non-Equalized Signal: copy of multV0ACorr and multV0CCorr from AliCentralitySelectionTask
762 //Getters for uncorrected multiplicity
763 multV0A=esdV0->GetMTotV0A();
764 multV0C=esdV0->GetMTotV0C();
765
766 //Get Z vertex position of SPD vertex (why not Tracking if available?)
767 Float_t zvtx = lPrimarySPDVtx->GetZ();
768
769 //Acquire Corrected multV0A
770 multV0ACorr = AliESDUtils::GetCorrV0A(multV0A,zvtx);
771 multV0CCorr = AliESDUtils::GetCorrV0C(multV0C,zvtx);
772
773 //Copy to Event Tree for extra information
774 fAmplitude_V0A = multV0ACorr;
775 fAmplitude_V0C = multV0CCorr;
776
758b26b0 777 // Equalized signals // From AliCentralitySelectionTask // Updated
778 for(Int_t iCh = 32; iCh < 64; ++iCh) {
af0d4791 779 Double_t mult = lESDevent->GetVZEROEqMultiplicity(iCh);
780 multV0AEq += mult;
781 }
758b26b0 782 for(Int_t iCh = 0; iCh < 32; ++iCh) {
af0d4791 783 Double_t mult = lESDevent->GetVZEROEqMultiplicity(iCh);
784 multV0CEq += mult;
785 }
786 fAmplitude_V0AEq = multV0AEq;
787 fAmplitude_V0CEq = multV0CEq;
788
789 fCentrality_V0A = -100;
790 fCentrality_V0C = -100;
791 fCentrality_V0M = -100;
792 fCentrality_V0AEq = -100;
793 fCentrality_V0CEq = -100;
794 fCentrality_V0MEq = -100;
795
796 //AliCentrality... Check if working?
797 AliCentrality* centrality;
798 centrality = lESDevent->GetCentrality();
799 if ( !(centrality->GetQuality()>1) ){
800 fCentrality_V0A = centrality->GetCentralityPercentile( "V0A" );
801 fCentrality_V0C = centrality->GetCentralityPercentile( "V0C" );
802 fCentrality_V0M = centrality->GetCentralityPercentile( "V0M" );
803 fCentrality_V0AEq = centrality->GetCentralityPercentile( "V0AEq" );
804 fCentrality_V0CEq = centrality->GetCentralityPercentile( "V0CEq" );
805 fCentrality_V0MEq = centrality->GetCentralityPercentile( "V0MEq" );
806 }
807
b40a01ae 808 //Cross-check/debug
809 fCustomCentrality_V0M = fPPVsMultUtils->GetMultiplicityPercentile(lESDevent,"V0M");
810 fCustomCentrality_V0MEq = fPPVsMultUtils->GetMultiplicityPercentile(lESDevent,"V0MEq");
811
47529a6d 812 //Tracklets vs Clusters Exploratory data
813 fEvSel_nTracklets = lESDevent->GetMultiplicity()->GetNumberOfTracklets();
814 fEvSel_nSPDClusters = lESDevent->GetNumberOfITSClusters(0) + lESDevent->GetNumberOfITSClusters(1);
815
af0d4791 816 //Event-level fill
817 fTreeEvent->Fill() ;
818
758b26b0 819 //STOP HERE if skipping event selections (no point in doing the rest...)
820 if( fkSkipEventSelection ){
821 PostData(1, fListHist);
822 PostData(2, fTreeEvent);
823 PostData(3, fTreeV0);
824 PostData(4, fTreeCascade);
825 return;
826 }
827
af0d4791 828//------------------------------------------------
829
830//------------------------------------------------
161c57ac 831// Fill V0 Tree as needed
832//------------------------------------------------
833
834//Variable definition
835 Int_t lOnFlyStatus = 0;// nv0sOn = 0, nv0sOff = 0;
836 Double_t lChi2V0 = 0;
837 Double_t lDcaV0Daughters = 0, lDcaV0ToPrimVertex = 0;
838 Double_t lDcaPosToPrimVertex = 0, lDcaNegToPrimVertex = 0;
839 Double_t lV0CosineOfPointingAngle = 0;
840 Double_t lV0Radius = 0, lPt = 0;
841 Double_t lRapK0Short = 0, lRapLambda = 0;
842 Double_t lInvMassK0s = 0, lInvMassLambda = 0, lInvMassAntiLambda = 0;
843 Double_t lAlphaV0 = 0, lPtArmV0 = 0;
844
845 Double_t fMinV0Pt = 0;
846 Double_t fMaxV0Pt = 100;
847
848 Int_t nv0s = 0;
849 nv0s = lESDevent->GetNumberOfV0s();
850
851 for (Int_t iV0 = 0; iV0 < nv0s; iV0++) //extra-crazy test
852 {// This is the begining of the V0 loop
853 AliESDv0 *v0 = ((AliESDEvent*)lESDevent)->GetV0(iV0);
854 if (!v0) continue;
855
856 Double_t tDecayVertexV0[3]; v0->GetXYZ(tDecayVertexV0[0],tDecayVertexV0[1],tDecayVertexV0[2]);
857
858 Double_t tV0mom[3];
859 v0->GetPxPyPz( tV0mom[0],tV0mom[1],tV0mom[2] );
860 Double_t lV0TotalMomentum = TMath::Sqrt(
861 tV0mom[0]*tV0mom[0]+tV0mom[1]*tV0mom[1]+tV0mom[2]*tV0mom[2] );
862
863 lV0Radius = TMath::Sqrt(tDecayVertexV0[0]*tDecayVertexV0[0]+tDecayVertexV0[1]*tDecayVertexV0[1]);
864
865 lPt = v0->Pt();
866 lRapK0Short = v0->RapK0Short();
867 lRapLambda = v0->RapLambda();
868 if ((lPt<fMinV0Pt)||(fMaxV0Pt<lPt)) continue;
869
870 UInt_t lKeyPos = (UInt_t)TMath::Abs(v0->GetPindex());
871 UInt_t lKeyNeg = (UInt_t)TMath::Abs(v0->GetNindex());
872
873 Double_t lMomPos[3]; v0->GetPPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]);
874 Double_t lMomNeg[3]; v0->GetNPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
875
876 AliESDtrack *pTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyPos);
877 AliESDtrack *nTrack=((AliESDEvent*)lESDevent)->GetTrack(lKeyNeg);
878 if (!pTrack || !nTrack) {
879 Printf("ERROR: Could not retreive one of the daughter track");
880 continue;
881 }
882
883 //Daughter Eta for Eta selection, afterwards
884 fTreeVariableNegEta = nTrack->Eta();
885 fTreeVariablePosEta = pTrack->Eta();
886
887 // Filter like-sign V0 (next: add counter and distribution)
888 if ( pTrack->GetSign() == nTrack->GetSign()){
889 continue;
890 }
891
892 //________________________________________________________________________
893 // Track quality cuts
894 Float_t lPosTrackCrossedRows = pTrack->GetTPCClusterInfo(2,1);
895 Float_t lNegTrackCrossedRows = nTrack->GetTPCClusterInfo(2,1);
896 fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
897 if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
898 fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
899
900 // TPC refit condition (done during reconstruction for Offline but not for On-the-fly)
901 if( !(pTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue;
902 if( !(nTrack->GetStatus() & AliESDtrack::kTPCrefit)) continue;
903
904
905 if ( ( ( pTrack->GetTPCClusterInfo(2,1) ) < 70 ) || ( ( nTrack->GetTPCClusterInfo(2,1) ) < 70 ) ) continue;
906
907 //GetKinkIndex condition
908 if( pTrack->GetKinkIndex(0)>0 || nTrack->GetKinkIndex(0)>0 ) continue;
909
910 //Findable clusters > 0 condition
911 if( pTrack->GetTPCNclsF()<=0 || nTrack->GetTPCNclsF()<=0 ) continue;
912
913 //Compute ratio Crossed Rows / Findable clusters
914 //Note: above test avoids division by zero!
915 Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
916 Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
917
918 fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
919 if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
920 fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
921
922 //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
923 if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) continue;
924
925 //End track Quality Cuts
926 //________________________________________________________________________
927
928 lDcaPosToPrimVertex = TMath::Abs(pTrack->GetD(lBestPrimaryVtxPos[0],
929 lBestPrimaryVtxPos[1],
930 lMagneticField) );
931
932 lDcaNegToPrimVertex = TMath::Abs(nTrack->GetD(lBestPrimaryVtxPos[0],
933 lBestPrimaryVtxPos[1],
934 lMagneticField) );
935
936 lOnFlyStatus = v0->GetOnFlyStatus();
937 lChi2V0 = v0->GetChi2V0();
938 lDcaV0Daughters = v0->GetDcaV0Daughters();
939 lDcaV0ToPrimVertex = v0->GetD(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lBestPrimaryVtxPos[2]);
940 lV0CosineOfPointingAngle = v0->GetV0CosineOfPointingAngle(lBestPrimaryVtxPos[0],lBestPrimaryVtxPos[1],lBestPrimaryVtxPos[2]);
941 fTreeVariableV0CosineOfPointingAngle=lV0CosineOfPointingAngle;
942
943 // Getting invariant mass infos directly from ESD
944 v0->ChangeMassHypothesis(310);
945 lInvMassK0s = v0->GetEffMass();
946 v0->ChangeMassHypothesis(3122);
947 lInvMassLambda = v0->GetEffMass();
948 v0->ChangeMassHypothesis(-3122);
949 lInvMassAntiLambda = v0->GetEffMass();
950 lAlphaV0 = v0->AlphaV0();
951 lPtArmV0 = v0->PtArmV0();
952
953 fTreeVariablePt = v0->Pt();
954 fTreeVariableChi2V0 = lChi2V0;
955 fTreeVariableDcaV0ToPrimVertex = lDcaV0ToPrimVertex;
956 fTreeVariableDcaV0Daughters = lDcaV0Daughters;
957 fTreeVariableV0CosineOfPointingAngle = lV0CosineOfPointingAngle;
958 fTreeVariableV0Radius = lV0Radius;
959 fTreeVariableDcaPosToPrimVertex = lDcaPosToPrimVertex;
960 fTreeVariableDcaNegToPrimVertex = lDcaNegToPrimVertex;
961 fTreeVariableInvMassK0s = lInvMassK0s;
962 fTreeVariableInvMassLambda = lInvMassLambda;
963 fTreeVariableInvMassAntiLambda = lInvMassAntiLambda;
964 fTreeVariableRapK0Short = lRapK0Short;
965 fTreeVariableRapLambda = lRapLambda;
966 fTreeVariableAlphaV0 = lAlphaV0;
967 fTreeVariablePtArmV0 = lPtArmV0;
968
969 //Official means of acquiring N-sigmas
970 fTreeVariableNSigmasPosProton = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kProton );
971 fTreeVariableNSigmasPosPion = fPIDResponse->NumberOfSigmasTPC( pTrack, AliPID::kPion );
972 fTreeVariableNSigmasNegProton = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kProton );
973 fTreeVariableNSigmasNegPion = fPIDResponse->NumberOfSigmasTPC( nTrack, AliPID::kPion );
974
975//This requires an Invariant Mass Hypothesis afterwards
976 fTreeVariableDistOverTotMom = TMath::Sqrt(
977 TMath::Power( tDecayVertexV0[0] - lBestPrimaryVtxPos[0] , 2) +
978 TMath::Power( tDecayVertexV0[1] - lBestPrimaryVtxPos[1] , 2) +
979 TMath::Power( tDecayVertexV0[2] - lBestPrimaryVtxPos[2] , 2)
980 );
981 fTreeVariableDistOverTotMom /= (lV0TotalMomentum+1e-10); //avoid division by zero, to be sure
982
983 //Copy Multiplicity information
984 fTreeVariableCentV0A = fCentrality_V0A;
985 fTreeVariableCentV0C = fCentrality_V0C;
986 fTreeVariableCentV0M = fCentrality_V0M;
987 fTreeVariableCentV0AEq = fCentrality_V0AEq;
988 fTreeVariableCentV0CEq = fCentrality_V0CEq;
989 fTreeVariableCentV0MEq = fCentrality_V0MEq;
990 fTreeVariableAmpV0A = fAmplitude_V0A;
991 fTreeVariableAmpV0C = fAmplitude_V0C;
992 fTreeVariableAmpV0AEq = fAmplitude_V0AEq;
993 fTreeVariableAmpV0CEq = fAmplitude_V0CEq;
994 fTreeVariableRefMultEta8 = fRefMultEta8;
995 fTreeVariableRefMultEta5 = fRefMultEta5;
996 fTreeVariableRunNumber = fRunNumber;
997
998//------------------------------------------------
999// Fill Tree!
1000//------------------------------------------------
1001
1002 // The conditionals are meant to decrease excessive
1003 // memory usage!
1004
1005 //First Selection: Reject OnFly
1006 if( lOnFlyStatus == 0 ){
1007 //Second Selection: rough 20-sigma band, parametric.
1008 //K0Short: Enough to parametrize peak broadening with linear function.
1009 Double_t lUpperLimitK0Short = (5.63707e-01) + (1.14979e-02)*fTreeVariablePt;
1010 Double_t lLowerLimitK0Short = (4.30006e-01) - (1.10029e-02)*fTreeVariablePt;
1011 //Lambda: Linear (for higher pt) plus exponential (for low-pt broadening)
1012 //[0]+[1]*x+[2]*TMath::Exp(-[3]*x)
1013 Double_t lUpperLimitLambda = (1.13688e+00) + (5.27838e-03)*fTreeVariablePt + (8.42220e-02)*TMath::Exp(-(3.80595e+00)*fTreeVariablePt);
1014 Double_t lLowerLimitLambda = (1.09501e+00) - (5.23272e-03)*fTreeVariablePt - (7.52690e-02)*TMath::Exp(-(3.46339e+00)*fTreeVariablePt);
1015 //Do Selection
1016 if( (fTreeVariableInvMassLambda < lUpperLimitLambda && fTreeVariableInvMassLambda > lLowerLimitLambda ) ||
1017 (fTreeVariableInvMassAntiLambda < lUpperLimitLambda && fTreeVariableInvMassAntiLambda > lLowerLimitLambda ) ||
1018 (fTreeVariableInvMassK0s < lUpperLimitK0Short && fTreeVariableInvMassK0s > lLowerLimitK0Short ) ){
1019 //Pre-selection in case this is AA...
1020 if ( TMath::Abs(fTreeVariableNegEta)<0.8 && TMath::Abs(fTreeVariablePosEta)<0.8 && fkSaveV0Tree ) fTreeV0->Fill();
1021 }
1022 }
1023 }// This is the end of the V0 loop
1024
1025//------------------------------------------------
1026// Fill V0 tree over.
1027//------------------------------------------------
1028
1029
1030
1031//------------------------------------------------
af0d4791 1032// Rerun cascade vertexer!
1033//------------------------------------------------
1034
1035 if( fkRunVertexers ){
1036 lESDevent->ResetCascades();
1037 lESDevent->ResetV0s();
1038
1039 AliV0vertexer lV0vtxer;
1040 AliCascadeVertexer lCascVtxer;
1041
1042 lV0vtxer.SetDefaultCuts(fV0VertexerSels);
1043 lCascVtxer.SetDefaultCuts(fCascadeVertexerSels);
1044
1045 lV0vtxer.Tracks2V0vertices(lESDevent);
1046 lCascVtxer.V0sTracks2CascadeVertices(lESDevent);
1047 }
1048
1049//------------------------------------------------
1050// MAIN CASCADE LOOP STARTS HERE
1051//------------------------------------------------
1052// Code Credit: Antonin Maire (thanks^100)
1053// ---> This is an adaptation
1054
1055 Long_t ncascades = 0;
1056 ncascades = lESDevent->GetNumberOfCascades();
1057
1058 for (Int_t iXi = 0; iXi < ncascades; iXi++){
1059 //------------------------------------------------
1060 // Initializations
1061 //------------------------------------------------
1062 //Double_t lTrkgPrimaryVtxRadius3D = -500.0;
1063 //Double_t lBestPrimaryVtxRadius3D = -500.0;
1064
1065 // - 1st part of initialisation : variables needed to store AliESDCascade data members
1066 Double_t lEffMassXi = 0. ;
1067 //Double_t lChi2Xi = -1. ;
1068 Double_t lDcaXiDaughters = -1. ;
1069 Double_t lXiCosineOfPointingAngle = -1. ;
1070 Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
1071 Double_t lXiRadius = -1000. ;
1072
1073 // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
1074 Int_t lPosTPCClusters = -1; // For ESD only ...//FIXME : wait for availability in AOD
1075 Int_t lNegTPCClusters = -1; // For ESD only ...
1076 Int_t lBachTPCClusters = -1; // For ESD only ...
1077
1078 // - 3rd part of initialisation : about V0 part in cascades
1079 Double_t lInvMassLambdaAsCascDghter = 0.;
1080 //Double_t lV0Chi2Xi = -1. ;
1081 Double_t lDcaV0DaughtersXi = -1.;
1082
1083 Double_t lDcaBachToPrimVertexXi = -1., lDcaV0ToPrimVertexXi = -1.;
1084 Double_t lDcaPosToPrimVertexXi = -1.;
1085 Double_t lDcaNegToPrimVertexXi = -1.;
1086 Double_t lV0CosineOfPointingAngleXi = -1. ;
1087 Double_t lV0CosineOfPointingAngleXiSpecial = -1. ;
1088 Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
1089 Double_t lV0RadiusXi = -1000.0;
1090 Double_t lV0quality = 0.;
1091
1092 // - 4th part of initialisation : Effective masses
1093 Double_t lInvMassXiMinus = 0.;
1094 Double_t lInvMassXiPlus = 0.;
1095 Double_t lInvMassOmegaMinus = 0.;
1096 Double_t lInvMassOmegaPlus = 0.;
1097
1098 // - 6th part of initialisation : extra info for QA
1099 Double_t lXiMomX = 0. , lXiMomY = 0., lXiMomZ = 0.;
1100 Double_t lXiTransvMom = 0. ;
1101 //Double_t lXiTransvMomMC= 0. ;
1102 Double_t lXiTotMom = 0. ;
1103
1104 Double_t lBachMomX = 0., lBachMomY = 0., lBachMomZ = 0.;
1105 //Double_t lBachTransvMom = 0.;
1106 //Double_t lBachTotMom = 0.;
1107
1108 fTreeCascVarNegNSigmaPion = -100;
1109 fTreeCascVarNegNSigmaProton = -100;
1110 fTreeCascVarPosNSigmaPion = -100;
1111 fTreeCascVarPosNSigmaProton = -100;
1112 fTreeCascVarBachNSigmaPion = -100;
1113 fTreeCascVarBachNSigmaKaon = -100;
1114
1115 Short_t lChargeXi = -2;
1116 //Double_t lV0toXiCosineOfPointingAngle = 0. ;
1117
1118 Double_t lRapXi = -20.0, lRapOmega = -20.0; // lEta = -20.0, lTheta = 360., lPhi = 720. ;
1119 //Double_t lAlphaXi = -200., lPtArmXi = -200.0;
1120
1121 // -------------------------------------
1122 // II.ESD - Calculation Part dedicated to Xi vertices (ESD)
1123
1124 AliESDcascade *xi = lESDevent->GetCascade(iXi);
1125 if (!xi) continue;
1126
1127 // - II.Step 2 : Assigning the necessary variables for specific AliESDcascade data members (ESD)
1128 //-------------
1129 lV0quality = 0.;
1130 xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis : cascade = Xi- decay
1131
1132 lEffMassXi = xi->GetEffMassXi();
1133 //lChi2Xi = xi->GetChi2Xi();
1134 lDcaXiDaughters = xi->GetDcaXiDaughters();
1135 lXiCosineOfPointingAngle = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0],
1136 lBestPrimaryVtxPos[1],
1137 lBestPrimaryVtxPos[2] );
1138 // Take care : the best available vertex should be used (like in AliCascadeVertexer)
1139
1140 xi->GetXYZcascade( lPosXi[0], lPosXi[1], lPosXi[2] );
1141 lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
1142
1143 // - II.Step 3 : around the tracks : Bach + V0 (ESD)
1144 // ~ Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1145 //-------------
1146
1147 UInt_t lIdxPosXi = (UInt_t) TMath::Abs( xi->GetPindex() );
1148 UInt_t lIdxNegXi = (UInt_t) TMath::Abs( xi->GetNindex() );
1149 UInt_t lBachIdx = (UInt_t) TMath::Abs( xi->GetBindex() );
1150 // Care track label can be negative in MC production (linked with the track quality)
1151 // However = normally, not the case for track index ...
1152
1153 // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1154 if(lBachIdx == lIdxNegXi) {
1155 AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
1156 }
1157 if(lBachIdx == lIdxPosXi) {
1158 AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
1159 }
1160
1161 AliESDtrack *pTrackXi = lESDevent->GetTrack( lIdxPosXi );
1162 AliESDtrack *nTrackXi = lESDevent->GetTrack( lIdxNegXi );
1163 AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );
1164
1165 if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1166 AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
1167 continue;
1168 }
1169
1170 fTreeCascVarPosEta = pTrackXi->Eta();
1171 fTreeCascVarNegEta = nTrackXi->Eta();
1172 fTreeCascVarBachEta = bachTrackXi->Eta();
1173
1174 Double_t lBMom[3], lNMom[3], lPMom[3];
1175 xi->GetBPxPyPz( lBMom[0], lBMom[1], lBMom[2] );
1176 xi->GetPPxPyPz( lPMom[0], lPMom[1], lPMom[2] );
1177 xi->GetNPxPyPz( lNMom[0], lNMom[1], lNMom[2] );
1178
1179 //fTreeCascVarBachTransMom = TMath::Sqrt( lBMom[0]*lBMom[0] + lBMom[1]*lBMom[1] );
1180 //fTreeCascVarPosTransMom = TMath::Sqrt( lPMom[0]*lPMom[0] + lPMom[1]*lPMom[1] );
1181 //fTreeCascVarNegTransMom = TMath::Sqrt( lNMom[0]*lNMom[0] + lNMom[1]*lNMom[1] );
1182
1183 //------------------------------------------------
1184 // TPC dEdx information
1185 //------------------------------------------------
1186 fTreeCascVarNegNSigmaPion = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kPion );
1187 fTreeCascVarNegNSigmaProton = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kProton );
1188 fTreeCascVarPosNSigmaPion = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kPion );
1189 fTreeCascVarPosNSigmaProton = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kProton );
1190 fTreeCascVarBachNSigmaPion = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kPion );
1191 fTreeCascVarBachNSigmaKaon = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kKaon );
1192
1193 //------------------------------------------------
1194 // TPC Number of clusters info
1195 // --- modified to save the smallest number
1196 // --- of TPC clusters for the 3 tracks
1197 //------------------------------------------------
1198
1199 lPosTPCClusters = pTrackXi->GetTPCNcls();
1200 lNegTPCClusters = nTrackXi->GetTPCNcls();
1201 lBachTPCClusters = bachTrackXi->GetTPCNcls();
1202
1203 // 1 - Poor quality related to TPCrefit
1204 ULong_t pStatus = pTrackXi->GetStatus();
1205 ULong_t nStatus = nTrackXi->GetStatus();
1206 ULong_t bachStatus = bachTrackXi->GetStatus();
1207
1208 //fTreeCascVarkITSRefitBachelor = kTRUE;
1209 //fTreeCascVarkITSRefitNegative = kTRUE;
1210 //fTreeCascVarkITSRefitPositive = kTRUE;
1211
1212 if ((pStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1213 if ((nStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1214 if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }
1215
af0d4791 1216 // 2 - Poor quality related to TPC clusters: lowest cut of 70 clusters
1217 if(lPosTPCClusters < 70) { AliWarning("Pb / V0 Pos. track has less than 70 TPC clusters ... continue!"); continue; }
1218 if(lNegTPCClusters < 70) { AliWarning("Pb / V0 Neg. track has less than 70 TPC clusters ... continue!"); continue; }
1219 if(lBachTPCClusters < 70) { AliWarning("Pb / Bach. track has less than 70 TPC clusters ... continue!"); continue; }
1220 Int_t leastnumberofclusters = 1000;
1221 if( lPosTPCClusters < leastnumberofclusters ) leastnumberofclusters = lPosTPCClusters;
1222 if( lNegTPCClusters < leastnumberofclusters ) leastnumberofclusters = lNegTPCClusters;
1223 if( lBachTPCClusters < leastnumberofclusters ) leastnumberofclusters = lBachTPCClusters;
1224
1225 lInvMassLambdaAsCascDghter = xi->GetEffMass();
1226 // This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
1227 lDcaV0DaughtersXi = xi->GetDcaV0Daughters();
1228 //lV0Chi2Xi = xi->GetChi2V0();
1229
1230 lV0CosineOfPointingAngleXi = xi->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0],
1231 lBestPrimaryVtxPos[1],
1232 lBestPrimaryVtxPos[2] );
1233 //Modification: V0 CosPA wrt to Cascade decay vertex
1234 lV0CosineOfPointingAngleXiSpecial = xi->GetV0CosineOfPointingAngle( lPosXi[0],
1235 lPosXi[1],
1236 lPosXi[2] );
1237
1238 lDcaV0ToPrimVertexXi = xi->GetD( lBestPrimaryVtxPos[0],
1239 lBestPrimaryVtxPos[1],
1240 lBestPrimaryVtxPos[2] );
1241
1242 lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0],
1243 lBestPrimaryVtxPos[1],
1244 lMagneticField ) );
1245 // Note : AliExternalTrackParam::GetD returns an algebraic value ...
1246
1247 xi->GetXYZ( lPosV0Xi[0], lPosV0Xi[1], lPosV0Xi[2] );
1248 lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
1249
1250 lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi ->GetD( lBestPrimaryVtxPos[0],
1251 lBestPrimaryVtxPos[1],
1252 lMagneticField ) );
1253
1254 lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi ->GetD( lBestPrimaryVtxPos[0],
1255 lBestPrimaryVtxPos[1],
1256 lMagneticField ) );
1257
1258 // - II.Step 4 : around effective masses (ESD)
1259 // ~ change mass hypotheses to cover all the possibilities : Xi-/+, Omega -/+
1260
1261 if( bachTrackXi->Charge() < 0 ) {
1262 lV0quality = 0.;
1263 xi->ChangeMassHypothesis(lV0quality , 3312);
1264 // Calculate the effective mass of the Xi- candidate.
1265 // pdg code 3312 = Xi-
1266 lInvMassXiMinus = xi->GetEffMassXi();
1267
1268 lV0quality = 0.;
1269 xi->ChangeMassHypothesis(lV0quality , 3334);
1270 // Calculate the effective mass of the Xi- candidate.
1271 // pdg code 3334 = Omega-
1272 lInvMassOmegaMinus = xi->GetEffMassXi();
1273
1274 lV0quality = 0.;
1275 xi->ChangeMassHypothesis(lV0quality , 3312); // Back to default hyp.
1276 }// end if negative bachelor
1277
1278
1279 if( bachTrackXi->Charge() > 0 ){
1280 lV0quality = 0.;
1281 xi->ChangeMassHypothesis(lV0quality , -3312);
1282 // Calculate the effective mass of the Xi+ candidate.
1283 // pdg code -3312 = Xi+
1284 lInvMassXiPlus = xi->GetEffMassXi();
1285
1286 lV0quality = 0.;
1287 xi->ChangeMassHypothesis(lV0quality , -3334);
1288 // Calculate the effective mass of the Xi+ candidate.
1289 // pdg code -3334 = Omega+
1290 lInvMassOmegaPlus = xi->GetEffMassXi();
1291
1292 lV0quality = 0.;
1293 xi->ChangeMassHypothesis(lV0quality , -3312); // Back to "default" hyp.
1294 }// end if positive bachelor
1295 // - II.Step 6 : extra info for QA (ESD)
1296 // miscellaneous pieces of info that may help regarding data quality assessment.
1297 //-------------
1298
1299 xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
1300 lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
1301 lXiTotMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
1302
1303 xi->GetBPxPyPz( lBachMomX, lBachMomY, lBachMomZ );
1304 //lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
1305 //lBachTotMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
1306
1307 lChargeXi = xi->Charge();
1308
1309 //lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
1310
1311 lRapXi = xi->RapXi();
1312 lRapOmega = xi->RapOmega();
1313 //lEta = xi->Eta();
1314 //lTheta = xi->Theta() *180.0/TMath::Pi();
1315 //lPhi = xi->Phi() *180.0/TMath::Pi();
1316 //lAlphaXi = xi->AlphaXi();
1317 //lPtArmXi = xi->PtArmXi();
1318
1319 //------------------------------------------------
1320 // Set Variables for adding to tree
1321 //------------------------------------------------
1322
1323 fTreeCascVarCharge = lChargeXi;
1324 if(lInvMassXiMinus!=0) fTreeCascVarMassAsXi = lInvMassXiMinus;
1325 if(lInvMassXiPlus!=0) fTreeCascVarMassAsXi = lInvMassXiPlus;
1326 if(lInvMassOmegaMinus!=0) fTreeCascVarMassAsOmega = lInvMassOmegaMinus;
1327 if(lInvMassOmegaPlus!=0) fTreeCascVarMassAsOmega = lInvMassOmegaPlus;
1328 fTreeCascVarPt = lXiTransvMom;
1329 fTreeCascVarRapXi = lRapXi ;
1330 fTreeCascVarRapOmega = lRapOmega ;
1331 fTreeCascVarDCACascDaughters = lDcaXiDaughters;
1332 fTreeCascVarDCABachToPrimVtx = lDcaBachToPrimVertexXi;
1333 fTreeCascVarDCAV0Daughters = lDcaV0DaughtersXi;
1334 fTreeCascVarDCAV0ToPrimVtx = lDcaV0ToPrimVertexXi;
1335 fTreeCascVarDCAPosToPrimVtx = lDcaPosToPrimVertexXi;
1336 fTreeCascVarDCANegToPrimVtx = lDcaNegToPrimVertexXi;
1337 fTreeCascVarCascCosPointingAngle = lXiCosineOfPointingAngle;
1338 fTreeCascVarCascRadius = lXiRadius;
1339 fTreeCascVarV0Mass = lInvMassLambdaAsCascDghter;
1340 fTreeCascVarV0CosPointingAngle = lV0CosineOfPointingAngleXi;
1341 fTreeCascVarV0CosPointingAngleSpecial = lV0CosineOfPointingAngleXiSpecial;
1342 fTreeCascVarV0Radius = lV0RadiusXi;
1343 fTreeCascVarLeastNbrClusters = leastnumberofclusters;
1344
1345 //Copy Multiplicity information
1346 fTreeCascVarCentV0A = fCentrality_V0A;
1347 fTreeCascVarCentV0C = fCentrality_V0C;
1348 fTreeCascVarCentV0M = fCentrality_V0M;
1349 fTreeCascVarCentV0AEq = fCentrality_V0AEq;
1350 fTreeCascVarCentV0CEq = fCentrality_V0CEq;
1351 fTreeCascVarCentV0MEq = fCentrality_V0MEq;
1352 fTreeCascVarAmpV0A = fAmplitude_V0A;
1353 fTreeCascVarAmpV0C = fAmplitude_V0C;
1354 fTreeCascVarAmpV0AEq = fAmplitude_V0AEq;
1355 fTreeCascVarAmpV0CEq = fAmplitude_V0CEq;
1356 fTreeCascVarRefMultEta8 = fRefMultEta8;
1357 fTreeCascVarRefMultEta5 = fRefMultEta5;
26d39641 1358 fTreeCascVarRunNumber = fRunNumber;
af0d4791 1359
1360 fTreeCascVarDistOverTotMom = TMath::Sqrt(
1361 TMath::Power( lPosXi[0] - lBestPrimaryVtxPos[0] , 2) +
1362 TMath::Power( lPosXi[1] - lBestPrimaryVtxPos[1] , 2) +
1363 TMath::Power( lPosXi[2] - lBestPrimaryVtxPos[2] , 2)
1364 );
1365 fTreeCascVarDistOverTotMom /= (lXiTotMom+1e-13);
1366
1367//All vars not specified here: specified elsewhere!
1368
1369//------------------------------------------------
1370// Fill Tree!
1371//------------------------------------------------
1372
1373// The conditional is meant to decrease excessive
1374// memory usage! Be careful when loosening the
1375// cut!
1376
1377 //Xi Mass window: 150MeV wide
1378 //Omega mass window: 150MeV wide
1379
1380 if( fkSaveCascadeTree && ( (fTreeCascVarMassAsXi<1.32+0.075&&fTreeCascVarMassAsXi>1.32-0.075) ||
1381 (fTreeCascVarMassAsOmega<1.68+0.075&&fTreeCascVarMassAsOmega>1.68-0.075) ) ){
1382 fTreeCascade->Fill();
1383 }
1384
1385//------------------------------------------------
1386// Fill tree over.
1387//------------------------------------------------
1388
1389 }// end of the Cascade loop (ESD or AOD)
1390
1391 // Post output data.
1392 PostData(1, fListHist);
1393 PostData(2, fTreeEvent);
1394 PostData(3, fTreeV0);
1395 PostData(4, fTreeCascade);
1396}
1397
1398//________________________________________________________________________
1399void AliAnalysisTaskStrangenessVsMultiplicity::Terminate(Option_t *)
1400{
1401 // Draw result to the screen
1402 // Called once at the end of the query
1403
1404 TList *cRetrievedList = 0x0;
1405 cRetrievedList = (TList*)GetOutputData(1);
1406 if(!cRetrievedList){
1407 Printf("ERROR - AliAnalysisTaskStrangenessVsMultiplicity : ouput data container list not available\n");
1408 return;
1409 }
1410
1411 fHistEventCounter = dynamic_cast<TH1D*> ( cRetrievedList->FindObject("fHistEventCounter") );
1412 if (!fHistEventCounter) {
1413 Printf("ERROR - AliAnalysisTaskStrangenessVsMultiplicity : fHistEventCounter not available");
1414 return;
1415 }
1416
1417 TCanvas *canCheck = new TCanvas("AliAnalysisTaskStrangenessVsMultiplicity","V0 Multiplicity",10,10,510,510);
1418 canCheck->cd(1)->SetLogy();
1419
1420 fHistEventCounter->SetMarkerStyle(22);
1421 fHistEventCounter->DrawCopy("E");
1422}
1423
1424//----------------------------------------------------------------------------
1425
1426Double_t AliAnalysisTaskStrangenessVsMultiplicity::MyRapidity(Double_t rE, Double_t rPz) const
1427{
1428 // Local calculation for rapidity
1429 Double_t ReturnValue = -100;
1430 if( (rE-rPz+1.e-13) != 0 && (rE+rPz) != 0 ){
1431 ReturnValue = 0.5*TMath::Log((rE+rPz)/(rE-rPz+1.e-13));
1432 }
1433 return ReturnValue;
1434}