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