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