Changes to acquire V0M, V0A, SPD, TRK and ZNA centrality data simultaneously for...
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / Cascades / AliAnalysisTaskExtractPerformanceCascade.cxx
CommitLineData
76029adc 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17//
18// Modified version of AliAnalysisTaskCheckCascade.cxx.
19// This is a 'hybrid' output version, in that it uses a classic TTree
20// ROOT object to store the candidates, plus a couple of histograms filled on
21// a per-event basis for storing variables too numerous to put in a tree.
22//
23// --- Adapted to look for lambdas as well, using code from
24// AliAnalysisTaskCheckPerformanceStrange.cxx
25//
26// --- Algorithm Description
27// 1. Loop over primaries in stack to acquire generated charged Xi
9a8f3aee 28// 2. Loop over stack to find Cascades, fill TH3Fs "PrimRawPt"s for Efficiency
76029adc 29// 3. Perform Physics Selection
30// 4. Perform Primary Vertex |z|<10cm selection
31// 5. Perform Primary Vertex NoTPCOnly vertexing selection (>0 contrib.)
32// 6. Perform Pileup Rejection
33// 7. Analysis Loops:
34// 7a. Fill TH3Fs "PrimAnalysisPt" for control purposes only
76029adc 35//
36// Please Report Any Bugs!
37//
38// --- David Dobrigkeit Chinellato
39// (david.chinellato@gmail.com)
40//
41// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42
43class TTree;
44class TParticle;
45class TVector3;
46
47//class AliMCEventHandler;
48//class AliMCEvent;
49//class AliStack;
50
51class AliESDVertex;
52class AliAODVertex;
53class AliESDv0;
54class AliAODv0;
55
56#include <Riostream.h>
57#include "TList.h"
58#include "TH1.h"
59#include "TH2.h"
60#include "TH3.h"
61#include "TFile.h"
62#include "THnSparse.h"
63#include "TVector3.h"
64#include "TCanvas.h"
65#include "TMath.h"
66#include "TLegend.h"
67#include "AliLog.h"
68
69#include "AliESDEvent.h"
70#include "AliAODEvent.h"
71#include "AliV0vertexer.h"
72#include "AliCascadeVertexer.h"
73#include "AliESDpid.h"
74#include "AliESDtrack.h"
75#include "AliESDtrackCuts.h"
76#include "AliInputEventHandler.h"
77#include "AliAnalysisManager.h"
78#include "AliMCEventHandler.h"
79#include "AliMCEvent.h"
80#include "AliStack.h"
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
90#include "AliAnalysisTaskExtractPerformanceCascade.h"
91
92using std::cout;
93using std::endl;
94
95ClassImp(AliAnalysisTaskExtractPerformanceCascade)
96
97AliAnalysisTaskExtractPerformanceCascade::AliAnalysisTaskExtractPerformanceCascade()
98 : AliAnalysisTaskSE(), fListHist(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0),
99 fkIsNuclear ( kFALSE ),
2213f6fc 100 fkSwitchINT7 ( kFALSE ),
da3539d8 101 fpArapidityShift ( 0.465 ),
102 fCentralityEstimator("V0M"),
2213f6fc 103//------------------------------------------------
104// Tree Variables
105//------------------------------------------------
106
107 fTreeCascVarCharge(0),
108 fTreeCascVarMassAsXi(0),
109 fTreeCascVarMassAsOmega(0),
110 fTreeCascVarPt(0),
111 fTreeCascVarPtMC(0),
112 fTreeCascVarRapMC(0),
113 fTreeCascVarRapXi(0),
114 fTreeCascVarRapOmega(0),
115 fTreeCascVarNegEta(0),
116 fTreeCascVarPosEta(0),
117 fTreeCascVarBachEta(0),
118 fTreeCascVarDCACascDaughters(0),
119 fTreeCascVarDCABachToPrimVtx(0),
120 fTreeCascVarDCAV0Daughters(0),
121 fTreeCascVarDCAV0ToPrimVtx(0),
122 fTreeCascVarDCAPosToPrimVtx(0),
123 fTreeCascVarDCANegToPrimVtx(0),
124 fTreeCascVarCascCosPointingAngle(0),
125 fTreeCascVarCascRadius(0),
126 fTreeCascVarV0Mass(0),
127 fTreeCascVarV0CosPointingAngle(0),
128 fTreeCascVarV0Radius(0),
129 fTreeCascVarLeastNbrClusters(0),
130 fTreeCascVarMultiplicity(0),
131 fTreeCascVarDistOverTotMom(0),
132 fTreeCascVarPID(0),
133 fTreeCascVarPIDBachelor(0),
134 fTreeCascVarPIDNegative(0),
135 fTreeCascVarPIDPositive(0),
136 fTreeCascVarPosTransMom(0),
137 fTreeCascVarNegTransMom(0),
138 fTreeCascVarPosTransMomMC(0),
139 fTreeCascVarNegTransMomMC(0),
140 fTreeCascVarNegNSigmaPion(0),
141 fTreeCascVarNegNSigmaProton(0),
142 fTreeCascVarPosNSigmaPion(0),
143 fTreeCascVarPosNSigmaProton(0),
144 fTreeCascVarBachNSigmaPion(0),
145 fTreeCascVarBachNSigmaKaon(0),
76029adc 146
147//------------------------------------------------
148// HISTOGRAMS
149// --- Filled on an Event-by-event basis
150//------------------------------------------------
151 fHistV0MultiplicityBeforeTrigSel(0),
152 fHistV0MultiplicityForTrigEvt(0),
153 fHistV0MultiplicityForSelEvt(0),
154 fHistV0MultiplicityForSelEvtNoTPCOnly(0),
155 fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0),
156 fHistMultiplicityBeforeTrigSel(0),
157 fHistMultiplicityForTrigEvt(0),
158 fHistMultiplicity(0),
159 fHistMultiplicityNoTPCOnly(0),
160 fHistMultiplicityNoTPCOnlyNoPileup(0),
161
162//------------------------------------------------
163// PARTICLE HISTOGRAMS
164// --- Filled on a Particle-by-Particle basis
165//------------------------------------------------
166 f3dHistGenPtVsYVsMultXiMinus(0),
167 f3dHistGenPtVsYVsMultXiPlus(0),
168 f3dHistGenPtVsYVsMultOmegaMinus(0),
169 f3dHistGenPtVsYVsMultOmegaPlus(0),
170 f3dHistGenSelectedPtVsYVsMultXiMinus(0),
171 f3dHistGenSelectedPtVsYVsMultXiPlus(0),
172 f3dHistGenSelectedPtVsYVsMultOmegaMinus(0),
173 f3dHistGenSelectedPtVsYVsMultOmegaPlus(0),
da3539d8 174 f3dHistGenPtVsYCMSVsMultXiMinus(0),
175 f3dHistGenPtVsYCMSVsMultXiPlus(0),
176 f3dHistGenPtVsYCMSVsMultOmegaMinus(0),
177 f3dHistGenPtVsYCMSVsMultOmegaPlus(0),
178 f3dHistGenSelectedPtVsYCMSVsMultXiMinus(0),
179 f3dHistGenSelectedPtVsYCMSVsMultXiPlus(0),
180 f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus(0),
181 f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus(0),
76029adc 182 fHistPVx(0),
183 fHistPVy(0),
184 fHistPVz(0),
185 fHistPVxAnalysis(0),
186 fHistPVyAnalysis(0),
187 fHistPVzAnalysis(0)
188{
189 // Dummy Constructor
190}
191
192AliAnalysisTaskExtractPerformanceCascade::AliAnalysisTaskExtractPerformanceCascade(const char *name)
193 : AliAnalysisTaskSE(name), fListHist(0), fTreeCascade(0), fPIDResponse(0), fESDtrackCuts(0),
194 fkIsNuclear ( kFALSE ),
2213f6fc 195 fkSwitchINT7 ( kFALSE ),
da3539d8 196 fpArapidityShift ( 0.465 ),
197 fCentralityEstimator("V0M"),
76029adc 198//------------------------------------------------
2213f6fc 199// Tree Variables
200//------------------------------------------------
201
202 fTreeCascVarCharge(0),
203 fTreeCascVarMassAsXi(0),
204 fTreeCascVarMassAsOmega(0),
205 fTreeCascVarPt(0),
206 fTreeCascVarPtMC(0),
207 fTreeCascVarRapMC(0),
208 fTreeCascVarRapXi(0),
209 fTreeCascVarRapOmega(0),
210 fTreeCascVarNegEta(0),
211 fTreeCascVarPosEta(0),
212 fTreeCascVarBachEta(0),
213 fTreeCascVarDCACascDaughters(0),
214 fTreeCascVarDCABachToPrimVtx(0),
215 fTreeCascVarDCAV0Daughters(0),
216 fTreeCascVarDCAV0ToPrimVtx(0),
217 fTreeCascVarDCAPosToPrimVtx(0),
218 fTreeCascVarDCANegToPrimVtx(0),
219 fTreeCascVarCascCosPointingAngle(0),
220 fTreeCascVarCascRadius(0),
221 fTreeCascVarV0Mass(0),
222 fTreeCascVarV0CosPointingAngle(0),
223 fTreeCascVarV0Radius(0),
224 fTreeCascVarLeastNbrClusters(0),
225 fTreeCascVarMultiplicity(0),
226 fTreeCascVarDistOverTotMom(0),
227 fTreeCascVarPID(0),
228 fTreeCascVarPIDBachelor(0),
229 fTreeCascVarPIDNegative(0),
230 fTreeCascVarPIDPositive(0),
231 fTreeCascVarPosTransMom(0),
232 fTreeCascVarNegTransMom(0),
233 fTreeCascVarPosTransMomMC(0),
234 fTreeCascVarNegTransMomMC(0),
235 fTreeCascVarNegNSigmaPion(0),
236 fTreeCascVarNegNSigmaProton(0),
237 fTreeCascVarPosNSigmaPion(0),
238 fTreeCascVarPosNSigmaProton(0),
239 fTreeCascVarBachNSigmaPion(0),
240 fTreeCascVarBachNSigmaKaon(0),
241
242//------------------------------------------------
76029adc 243// HISTOGRAMS
244// --- Filled on an Event-by-event basis
245//------------------------------------------------
246 fHistV0MultiplicityBeforeTrigSel(0),
247 fHistV0MultiplicityForTrigEvt(0),
248 fHistV0MultiplicityForSelEvt(0),
249 fHistV0MultiplicityForSelEvtNoTPCOnly(0),
250 fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup(0),
251 fHistMultiplicityBeforeTrigSel(0),
252 fHistMultiplicityForTrigEvt(0),
253 fHistMultiplicity(0),
254 fHistMultiplicityNoTPCOnly(0),
255 fHistMultiplicityNoTPCOnlyNoPileup(0),
256
257
258//------------------------------------------------
259// PARTICLE HISTOGRAMS
260// --- Filled on a Particle-by-Particle basis
261//------------------------------------------------
262 f3dHistGenPtVsYVsMultXiMinus(0),
263 f3dHistGenPtVsYVsMultXiPlus(0),
264 f3dHistGenPtVsYVsMultOmegaMinus(0),
265 f3dHistGenPtVsYVsMultOmegaPlus(0),
266 f3dHistGenSelectedPtVsYVsMultXiMinus(0),
267 f3dHistGenSelectedPtVsYVsMultXiPlus(0),
268 f3dHistGenSelectedPtVsYVsMultOmegaMinus(0),
269 f3dHistGenSelectedPtVsYVsMultOmegaPlus(0),
da3539d8 270 f3dHistGenPtVsYCMSVsMultXiMinus(0),
271 f3dHistGenPtVsYCMSVsMultXiPlus(0),
272 f3dHistGenPtVsYCMSVsMultOmegaMinus(0),
273 f3dHistGenPtVsYCMSVsMultOmegaPlus(0),
274 f3dHistGenSelectedPtVsYCMSVsMultXiMinus(0),
275 f3dHistGenSelectedPtVsYCMSVsMultXiPlus(0),
276 f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus(0),
277 f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus(0),
76029adc 278 fHistPVx(0),
279 fHistPVy(0),
280 fHistPVz(0),
281 fHistPVxAnalysis(0),
282 fHistPVyAnalysis(0),
283 fHistPVzAnalysis(0)
284{
285 // Constructor
d8841e95 286
287 //Set Variables for re-running the cascade vertexers (as done for MS paper)
288
289 // New Loose : 1st step for the 7 TeV pp analysis
290
291 fV0Sels[0] = 33. ; // max allowed chi2
292 fV0Sels[1] = 0.02; // min allowed impact parameter for the 1st daughter (LHC09a4 : 0.05)
293 fV0Sels[2] = 0.02; // min allowed impact parameter for the 2nd daughter (LHC09a4 : 0.05)
294 fV0Sels[3] = 2.0 ; // max allowed DCA between the daughter tracks (LHC09a4 : 0.5)
295 fV0Sels[4] = 0.95; // min allowed cosine of V0's pointing angle (LHC09a4 : 0.99)
296 fV0Sels[5] = 1.0 ; // min radius of the fiducial volume (LHC09a4 : 0.2)
297 fV0Sels[6] = 100. ; // max radius of the fiducial volume (LHC09a4 : 100.0)
298
299 fCascSels[0] = 33. ; // max allowed chi2 (same as PDC07)
300 fCascSels[1] = 0.05 ; // min allowed V0 impact parameter (PDC07 : 0.05 / LHC09a4 : 0.025 )
301 fCascSels[2] = 0.010; // "window" around the Lambda mass (PDC07 : 0.008 / LHC09a4 : 0.010 )
302 fCascSels[3] = 0.03 ; // min allowed bachelor's impact parameter (PDC07 : 0.035 / LHC09a4 : 0.025 )
303 fCascSels[4] = 2.0 ; // max allowed DCA between the V0 and the bachelor (PDC07 : 0.1 / LHC09a4 : 0.2 )
304 fCascSels[5] = 0.95 ; // min allowed cosine of the cascade pointing angle (PDC07 : 0.9985 / LHC09a4 : 0.998 )
305 fCascSels[6] = 0.4 ; // min radius of the fiducial volume (PDC07 : 0.9 / LHC09a4 : 0.2 )
306 fCascSels[7] = 100. ; // max radius of the fiducial volume (PDC07 : 100 / LHC09a4 : 100 )
307
76029adc 308 // Output slot #0 writes into a TList container (Cascade)
309 DefineOutput(1, TList::Class());
310 DefineOutput(2, TTree::Class());
311}
312
313
314AliAnalysisTaskExtractPerformanceCascade::~AliAnalysisTaskExtractPerformanceCascade()
315{
316//------------------------------------------------
317// DESTRUCTOR
318//------------------------------------------------
319
320 if (fListHist){
321 delete fListHist;
322 fListHist = 0x0;
323 }
324 if (fTreeCascade){
325 delete fTreeCascade;
326 fTreeCascade = 0x0;
327 }
328 //cleanup esd track cuts object too...
329 if (fESDtrackCuts){
330 delete fESDtrackCuts;
331 fESDtrackCuts = 0x0;
332 }
333
334}
335
336//________________________________________________________________________
337void AliAnalysisTaskExtractPerformanceCascade::UserCreateOutputObjects()
338{
339 OpenFile(2);
340 // Called once
341
342//------------------------------------------------
343
344 fTreeCascade = new TTree("fTreeCascade","CascadeCandidates");
345
346//------------------------------------------------
347// fTreeCascade Branch definitions - Cascade Tree
348//------------------------------------------------
349
350//------------------------------------------------
351// fTreeCascade Branch definitions
352//------------------------------------------------
353
354//-----------BASIC-INFO---------------------------
355/* 1*/ fTreeCascade->Branch("fTreeCascVarCharge",&fTreeCascVarCharge,"fTreeCascVarCharge/I");
356/* 2*/ fTreeCascade->Branch("fTreeCascVarMassAsXi",&fTreeCascVarMassAsXi,"fTreeCascVarMassAsXi/F");
357/* 3*/ fTreeCascade->Branch("fTreeCascVarMassAsOmega",&fTreeCascVarMassAsOmega,"fTreeCascVarMassAsOmega/F");
358/* 4*/ fTreeCascade->Branch("fTreeCascVarPt",&fTreeCascVarPt,"fTreeCascVarPt/F");
359/* 5*/ fTreeCascade->Branch("fTreeCascVarPtMC",&fTreeCascVarPtMC,"fTreeCascVarPtMC/F");
360/* 6*/ fTreeCascade->Branch("fTreeCascVarRapXi",&fTreeCascVarRapXi,"fTreeCascVarRapXi/F");
361/* 7*/ fTreeCascade->Branch("fTreeCascVarRapMC",&fTreeCascVarRapMC,"fTreeCascVarRapMC/F");
362/* 8*/ fTreeCascade->Branch("fTreeCascVarRapOmega",&fTreeCascVarRapOmega,"fTreeCascVarRapOmega/F");
363/* 9*/ fTreeCascade->Branch("fTreeCascVarNegEta",&fTreeCascVarNegEta,"fTreeCascVarNegEta/F");
364/*10*/ fTreeCascade->Branch("fTreeCascVarPosEta",&fTreeCascVarPosEta,"fTreeCascVarPosEta/F");
365/*11*/ fTreeCascade->Branch("fTreeCascVarBachEta",&fTreeCascVarBachEta,"fTreeCascVarBachEta/F");
366//-----------INFO-FOR-CUTS------------------------
367/*12*/ fTreeCascade->Branch("fTreeCascVarDCACascDaughters",&fTreeCascVarDCACascDaughters,"fTreeCascVarDCACascDaughters/F");
368/*13*/ fTreeCascade->Branch("fTreeCascVarDCABachToPrimVtx",&fTreeCascVarDCABachToPrimVtx,"fTreeCascVarDCABachToPrimVtx/F");
369/*14*/ fTreeCascade->Branch("fTreeCascVarDCAV0Daughters",&fTreeCascVarDCAV0Daughters,"fTreeCascVarDCAV0Daughters/F");
370/*15*/ fTreeCascade->Branch("fTreeCascVarDCAV0ToPrimVtx",&fTreeCascVarDCAV0ToPrimVtx,"fTreeCascVarDCAV0ToPrimVtx/F");
371/*16*/ fTreeCascade->Branch("fTreeCascVarDCAPosToPrimVtx",&fTreeCascVarDCAPosToPrimVtx,"fTreeCascVarDCAPosToPrimVtx/F");
372/*17*/ fTreeCascade->Branch("fTreeCascVarDCANegToPrimVtx",&fTreeCascVarDCANegToPrimVtx,"fTreeCascVarDCANegToPrimVtx/F");
373/*18*/ fTreeCascade->Branch("fTreeCascVarCascCosPointingAngle",&fTreeCascVarCascCosPointingAngle,"fTreeCascVarCascCosPointingAngle/F");
374/*19*/ fTreeCascade->Branch("fTreeCascVarCascRadius",&fTreeCascVarCascRadius,"fTreeCascVarCascRadius/F");
375/*20*/ fTreeCascade->Branch("fTreeCascVarV0Mass",&fTreeCascVarV0Mass,"fTreeCascVarV0Mass/F");
376/*21*/ fTreeCascade->Branch("fTreeCascVarV0CosPointingAngle",&fTreeCascVarV0CosPointingAngle,"fTreeCascVarV0CosPointingAngle/F");
377/*22*/ fTreeCascade->Branch("fTreeCascVarV0Radius",&fTreeCascVarV0Radius,"fTreeCascVarV0Radius/F");
378/*23*/ fTreeCascade->Branch("fTreeCascVarLeastNbrClusters",&fTreeCascVarLeastNbrClusters,"fTreeCascVarLeastNbrClusters/I");
379//-----------MULTIPLICITY-INFO--------------------
380/*24*/ fTreeCascade->Branch("fTreeCascVarMultiplicity",&fTreeCascVarMultiplicity,"fTreeCascVarMultiplicity/I");
381//-----------DECAY-LENGTH-INFO--------------------
382/*25*/ fTreeCascade->Branch("fTreeCascVarDistOverTotMom",&fTreeCascVarDistOverTotMom,"fTreeCascVarDistOverTotMom/F");
383//-----------MC-PID-------------------------------
384/*26*/ fTreeCascade->Branch("fTreeCascVarPID",&fTreeCascVarPID,"fTreeCascVarPID/I");
385/*27*/ fTreeCascade->Branch("fTreeCascVarPIDBachelor",&fTreeCascVarPIDBachelor,"fTreeCascVarPIDBachelor/I");
386/*28*/ fTreeCascade->Branch("fTreeCascVarPIDNegative",&fTreeCascVarPIDNegative,"fTreeCascVarPIDNegative/I");
387/*29*/ fTreeCascade->Branch("fTreeCascVarPIDPositive",&fTreeCascVarPIDPositive,"fTreeCascVarPIDPositive/I");
388/*30*/ fTreeCascade->Branch("fTreeCascVarPosTransMom",&fTreeCascVarPosTransMom,"fTreeCascVarPosTransMom/F");
389/*31*/ fTreeCascade->Branch("fTreeCascVarNegTransMom",&fTreeCascVarNegTransMom,"fTreeCascVarNegTransMom/F");
390/*32*/ fTreeCascade->Branch("fTreeCascVarPosTransMomMC",&fTreeCascVarPosTransMomMC,"fTreeCascVarPosTransMomMC/F");
391/*33*/ fTreeCascade->Branch("fTreeCascVarNegTransMomMC",&fTreeCascVarNegTransMomMC,"fTreeCascVarNegTransMomMC/F");
392//------------------------------------------------
393/*34*/ fTreeCascade->Branch("fTreeCascVarNegNSigmaPion",&fTreeCascVarNegNSigmaPion,"fTreeCascVarNegNSigmaPion/F");
394/*35*/ fTreeCascade->Branch("fTreeCascVarNegNSigmaProton",&fTreeCascVarNegNSigmaProton,"fTreeCascVarNegNSigmaProton/F");
395/*36*/ fTreeCascade->Branch("fTreeCascVarPosNSigmaPion",&fTreeCascVarPosNSigmaPion,"fTreeCascVarPosNSigmaPion/F");
396/*37*/ fTreeCascade->Branch("fTreeCascVarPosNSigmaProton",&fTreeCascVarPosNSigmaProton,"fTreeCascVarPosNSigmaProton/F");
397/*38*/ fTreeCascade->Branch("fTreeCascVarBachNSigmaPion",&fTreeCascVarBachNSigmaPion,"fTreeCascVarBachNSigmaPion/F");
398/*39*/ fTreeCascade->Branch("fTreeCascVarBachNSigmaKaon",&fTreeCascVarBachNSigmaKaon,"fTreeCascVarBachNSigmaKaon/F");
399
400//------------------------------------------------
401// Particle Identification Setup
402//------------------------------------------------
403
404 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
405 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
406 fPIDResponse = inputHandler->GetPIDResponse();
407
408// Multiplicity
409
410 if(! fESDtrackCuts ){
411 fESDtrackCuts = new AliESDtrackCuts();
412 }
413
414//------------------------------------------------
415// V0 Multiplicity Histograms
416//------------------------------------------------
417
418 // Create histograms
419 OpenFile(1);
420 fListHist = new TList();
421 fListHist->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner
422
423
424 if(! fHistV0MultiplicityBeforeTrigSel) {
425 fHistV0MultiplicityBeforeTrigSel = new TH1F("fHistV0MultiplicityBeforeTrigSel",
426 "V0s per event (before Trig. Sel.);Nbr of V0s/Evt;Events",
427 25, 0, 25);
428 fListHist->Add(fHistV0MultiplicityBeforeTrigSel);
429 }
430
431 if(! fHistV0MultiplicityForTrigEvt) {
432 fHistV0MultiplicityForTrigEvt = new TH1F("fHistV0MultiplicityForTrigEvt",
433 "V0s per event (for triggered evt);Nbr of V0s/Evt;Events",
434 25, 0, 25);
435 fListHist->Add(fHistV0MultiplicityForTrigEvt);
436 }
437
438 if(! fHistV0MultiplicityForSelEvt) {
439 fHistV0MultiplicityForSelEvt = new TH1F("fHistV0MultiplicityForSelEvt",
440 "V0s per event;Nbr of V0s/Evt;Events",
441 25, 0, 25);
442 fListHist->Add(fHistV0MultiplicityForSelEvt);
443 }
444
445 if(! fHistV0MultiplicityForSelEvtNoTPCOnly) {
446 fHistV0MultiplicityForSelEvtNoTPCOnly = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnly",
447 "V0s per event;Nbr of V0s/Evt;Events",
448 25, 0, 25);
449 fListHist->Add(fHistV0MultiplicityForSelEvtNoTPCOnly);
450 }
451 if(! fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup) {
452 fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup = new TH1F("fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup",
453 "V0s per event;Nbr of V0s/Evt;Events",
454 25, 0, 25);
455 fListHist->Add(fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup);
456 }
457
458//------------------------------------------------
459// Track Multiplicity Histograms
460//------------------------------------------------
461
462 if(! fHistMultiplicityBeforeTrigSel) {
463 fHistMultiplicityBeforeTrigSel = new TH1F("fHistMultiplicityBeforeTrigSel",
464 "Tracks per event;Nbr of Tracks;Events",
465 200, 0, 200);
466 fListHist->Add(fHistMultiplicityBeforeTrigSel);
467 }
468 if(! fHistMultiplicityForTrigEvt) {
469 fHistMultiplicityForTrigEvt = new TH1F("fHistMultiplicityForTrigEvt",
470 "Tracks per event;Nbr of Tracks;Events",
471 200, 0, 200);
472 fListHist->Add(fHistMultiplicityForTrigEvt);
473 }
474 if(! fHistMultiplicity) {
475 fHistMultiplicity = new TH1F("fHistMultiplicity",
476 "Tracks per event;Nbr of Tracks;Events",
477 200, 0, 200);
478 fListHist->Add(fHistMultiplicity);
479 }
480 if(! fHistMultiplicityNoTPCOnly) {
481 fHistMultiplicityNoTPCOnly = new TH1F("fHistMultiplicityNoTPCOnly",
482 "Tracks per event;Nbr of Tracks;Events",
483 200, 0, 200);
484 fListHist->Add(fHistMultiplicityNoTPCOnly);
485 }
486 if(! fHistMultiplicityNoTPCOnlyNoPileup) {
487 fHistMultiplicityNoTPCOnlyNoPileup = new TH1F("fHistMultiplicityNoTPCOnlyNoPileup",
488 "Tracks per event;Nbr of Tracks;Events",
489 200, 0, 200);
490 fListHist->Add(fHistMultiplicityNoTPCOnlyNoPileup);
491 }
492
493//------------------------------------------------
494// Generated Particle Histograms
495//------------------------------------------------
496
497 Int_t lCustomNBins = 200;
498 Double_t lCustomPtUpperLimit = 20;
499 Int_t lCustomNBinsMultiplicity = 100;
500
501//----------------------------------
502// Raw Generated (Pre-physics-selection)
503//----------------------------------
504
505//--------------------------------------------------------------------------------------
506//--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, all generated
507
508 if(! f3dHistGenPtVsYVsMultXiMinus) {
509 f3dHistGenPtVsYVsMultXiMinus = new TH3F( "f3dHistGenPtVsYVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
510 fListHist->Add(f3dHistGenPtVsYVsMultXiMinus);
511 }
512 if(! f3dHistGenPtVsYVsMultXiPlus) {
513 f3dHistGenPtVsYVsMultXiPlus = new TH3F( "f3dHistGenPtVsYVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
514 fListHist->Add(f3dHistGenPtVsYVsMultXiPlus);
515 }
516//--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
517
518 if(! f3dHistGenPtVsYVsMultOmegaMinus) {
519 f3dHistGenPtVsYVsMultOmegaMinus = new TH3F( "f3dHistGenPtVsYVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
520 fListHist->Add(f3dHistGenPtVsYVsMultOmegaMinus);
521 }
522 if(! f3dHistGenPtVsYVsMultOmegaPlus) {
523 f3dHistGenPtVsYVsMultOmegaPlus = new TH3F( "f3dHistGenPtVsYVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
524 fListHist->Add(f3dHistGenPtVsYVsMultOmegaPlus);
525 }
526
da3539d8 527//All generated cascades, YCMS
528
529 if(! f3dHistGenPtVsYCMSVsMultXiMinus) {
530 f3dHistGenPtVsYCMSVsMultXiMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
531 fListHist->Add(f3dHistGenPtVsYCMSVsMultXiMinus);
532 }
533 if(! f3dHistGenPtVsYCMSVsMultXiPlus) {
534 f3dHistGenPtVsYCMSVsMultXiPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
535 fListHist->Add(f3dHistGenPtVsYCMSVsMultXiPlus);
536 }
537//--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
538
539 if(! f3dHistGenPtVsYCMSVsMultOmegaMinus) {
540 f3dHistGenPtVsYCMSVsMultOmegaMinus = new TH3F( "f3dHistGenPtVsYCMSVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
541 fListHist->Add(f3dHistGenPtVsYCMSVsMultOmegaMinus);
542 }
543 if(! f3dHistGenPtVsYCMSVsMultOmegaPlus) {
544 f3dHistGenPtVsYCMSVsMultOmegaPlus = new TH3F( "f3dHistGenPtVsYCMSVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
545 fListHist->Add(f3dHistGenPtVsYCMSVsMultOmegaPlus);
546 }
547
548
76029adc 549//--------------------------------------------------------------------------------------
550//--- 3D Histo (Pt, Y, Multiplicity) for generated XiMinus/Plus, at selected analysis evts
551
552 if(! f3dHistGenSelectedPtVsYVsMultXiMinus) {
553 f3dHistGenSelectedPtVsYVsMultXiMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
554 fListHist->Add(f3dHistGenSelectedPtVsYVsMultXiMinus);
555 }
556 if(! f3dHistGenSelectedPtVsYVsMultXiPlus) {
557 f3dHistGenSelectedPtVsYVsMultXiPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
558 fListHist->Add(f3dHistGenSelectedPtVsYVsMultXiPlus);
559 }
560//--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
561
562 if(! f3dHistGenSelectedPtVsYVsMultOmegaMinus) {
563 f3dHistGenSelectedPtVsYVsMultOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
564 fListHist->Add(f3dHistGenSelectedPtVsYVsMultOmegaMinus);
565 }
566 if(! f3dHistGenSelectedPtVsYVsMultOmegaPlus) {
567 f3dHistGenSelectedPtVsYVsMultOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
568 fListHist->Add(f3dHistGenSelectedPtVsYVsMultOmegaPlus);
569 }
570
da3539d8 571//ANALYSIS level Cascades, YCMS
572
573
574 if(! f3dHistGenSelectedPtVsYCMSVsMultXiMinus) {
575 f3dHistGenSelectedPtVsYCMSVsMultXiMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultXiMinus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
576 fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultXiMinus);
577 }
578 if(! f3dHistGenSelectedPtVsYCMSVsMultXiPlus) {
579 f3dHistGenSelectedPtVsYCMSVsMultXiPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultXiPlus", "Pt_{#Xi} Vs Y_{#Xi} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Xi} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
580 fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultXiPlus);
581 }
582//--- 3D Histo (Pt, Y, Multiplicity) for generated OmegaMinus/Plus
583
584 if(! f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus) {
585 f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
586 fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus);
587 }
588 if(! f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus) {
589 f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus = new TH3F( "f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus", "Pt_{#Omega} Vs Y_{#Omega} Vs Multiplicity; Pt_{cascade} (GeV/c); Y_{#Omega} ; Mult", lCustomNBins, 0., lCustomPtUpperLimit, 48, -1.2,1.2,lCustomNBinsMultiplicity,0,lCustomNBinsMultiplicity);
590 fListHist->Add(f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus);
591 }
592
76029adc 593//----------------------------------
594// Primary Vertex Position Histos
595//----------------------------------
596
597 if(! fHistPVx) {
598 fHistPVx = new TH1F("fHistPVx",
599 "PV x position;Nbr of Evts;x",
600 2000, -0.5, 0.5);
601 fListHist->Add(fHistPVx);
602 }
603 if(! fHistPVy) {
604 fHistPVy = new TH1F("fHistPVy",
605 "PV y position;Nbr of Evts;y",
606 2000, -0.5, 0.5);
607 fListHist->Add(fHistPVy);
608 }
609 if(! fHistPVz) {
610 fHistPVz = new TH1F("fHistPVz",
611 "PV z position;Nbr of Evts;z",
612 400, -20, 20);
613 fListHist->Add(fHistPVz);
614 }
615
616 if(! fHistPVxAnalysis) {
617 fHistPVxAnalysis = new TH1F("fHistPVxAnalysis",
618 "PV x position;Nbr of Evts;x",
619 2000, -0.5, 0.5);
620 fListHist->Add(fHistPVxAnalysis);
621 }
622 if(! fHistPVyAnalysis) {
623 fHistPVyAnalysis = new TH1F("fHistPVyAnalysis",
624 "PV y position;Nbr of Evts;y",
625 2000, -0.5, 0.5);
626 fListHist->Add(fHistPVyAnalysis);
627 }
628 if(! fHistPVzAnalysis) {
629 fHistPVzAnalysis = new TH1F("fHistPVzAnalysis",
630 "PV z position;Nbr of Evts;z",
631 400, -20, 20);
632 fListHist->Add(fHistPVzAnalysis);
633 }
634
635 //List of Histograms: Normal
636 PostData(1, fListHist);
637
638 //TTree Object: Saved to base directory. Should cache to disk while saving.
639 //(Important to avoid excessive memory usage, particularly when merging)
640 PostData(2, fTreeCascade);
641
642}// end UserCreateOutputObjects
643
644
645//________________________________________________________________________
646void AliAnalysisTaskExtractPerformanceCascade::UserExec(Option_t *)
647{
648 // Main loop
649 // Called for each event
650
651 AliESDEvent *lESDevent = 0x0;
652 AliMCEvent *lMCevent = 0x0;
653 AliStack *lMCstack = 0x0;
654
655 Int_t lNumberOfV0s = -1;
656 Double_t lTrkgPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};
657 Double_t lBestPrimaryVtxPos[3] = {-100.0, -100.0, -100.0};
658 Double_t lMagneticField = -10.;
659
660 // Connect to the InputEvent
661 // After these lines, we should have an ESD/AOD event + the number of V0s in it.
662
663 // Appropriate for ESD analysis!
664
665 lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() );
666 if (!lESDevent) {
667 AliWarning("ERROR: lESDevent not available \n");
668 return;
669 }
670
671/* --- Acquisition of exact event ID
672 fTreeVariableRunNumber = lESDevent->GetRunNumber();
673 fTreeVariableEventNumber =
674 ( ( ((ULong64_t)lESDevent->GetPeriodNumber() ) << 36 ) |
675 ( ((ULong64_t)lESDevent->GetOrbitNumber () ) << 12 ) |
676 ((ULong64_t)lESDevent->GetBunchCrossNumber() ) );
677*/
678 lMCevent = MCEvent();
679 if (!lMCevent) {
680 Printf("ERROR: Could not retrieve MC event \n");
681 cout << "Name of the file with pb :" << fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
682 return;
683 }
684
685 lMCstack = lMCevent->Stack();
686 if (!lMCstack) {
687 Printf("ERROR: Could not retrieve MC stack \n");
688 cout << "Name of the file with pb :" << fInputHandler->GetTree()->GetCurrentFile()->GetName() << endl;
689 return;
690 }
691 TArrayF mcPrimaryVtx;
692 AliGenEventHeader* mcHeader=lMCevent->GenEventHeader();
693 if(!mcHeader) return;
694 mcHeader->PrimaryVertex(mcPrimaryVtx);
695
696//------------------------------------------------
697// Multiplicity Information Acquistion
698//------------------------------------------------
699
700 //REVISED multiplicity estimator after 'multiplicity day' (2011)
701 Int_t lMultiplicity = -100;
702
703 //testing purposes
704 if(fkIsNuclear == kFALSE) lMultiplicity = fESDtrackCuts->GetReferenceMultiplicity(lESDevent, AliESDtrackCuts::kTrackletsITSTPC,0.5);
705
706 //---> If this is a nuclear collision, then go nuclear on "multiplicity" variable...
707 //---> Warning: Experimental
708 if(fkIsNuclear == kTRUE){
709 AliCentrality* centrality;
710 centrality = lESDevent->GetCentrality();
da3539d8 711 lMultiplicity = ( ( Int_t ) ( centrality->GetCentralityPercentile( fCentralityEstimator.Data() ) ) );
76029adc 712 if (centrality->GetQuality()>1) {
713 PostData(1, fListHist);
714 PostData(2, fTreeCascade);
715 return;
716 }
717 }
718
719 //Set variable for filling tree afterwards!
720 //---> pp case......: GetReferenceMultiplicity
721 //---> Pb-Pb case...: Centrality by V0M
722
723 fTreeCascVarMultiplicity = lMultiplicity;
724
725 fHistV0MultiplicityBeforeTrigSel->Fill ( lESDevent->GetNumberOfV0s() );
726 fHistMultiplicityBeforeTrigSel->Fill ( lMultiplicity );
727
728//------------------------------------------------
729// MC Information Acquistion
730//------------------------------------------------
731
732 Int_t iNumberOfPrimaries = -1;
733 iNumberOfPrimaries = lMCstack->GetNprimary();
734 if(iNumberOfPrimaries < 1) return;
735
736//------------------------------------------------
737// Variable Definition
738//------------------------------------------------
739
740 Int_t lNbMCPrimary = 0;
741
76029adc 742 Double_t lPtCurrentPart = 0;
743
744 //Int_t lComeFromSigma = 0;
745
746 // current mc particle 's mother
747 //Int_t iCurrentMother = 0;
748 lNbMCPrimary = lMCstack->GetNprimary();
749
750//------------------------------------------------
751// Pre-Physics Selection
752//------------------------------------------------
753
754//----- Loop on primary Xi, Omega --------------------------------------------------------------
755 for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++)
756 {// This is the begining of the loop on primaries
757
758 TParticle* lCurrentParticlePrimary = 0x0;
759 lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack );
760 if(!lCurrentParticlePrimary){
761 Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
762 continue;
763 }
764 if ( TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3312 || TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3334 ) {
765 Double_t lRapXiMCPrimary = -100;
766 if( (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) != 0 ) {
767 if ( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) !=0 ){
768 lRapXiMCPrimary = 0.5*TMath::Log( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) );
769 }
770 }
771
772 //=================================================================================
773 // Xi Histograms
774 if( lCurrentParticlePrimary->GetPdgCode() == 3312 ){
775 lPtCurrentPart = lCurrentParticlePrimary->Pt();
776 f3dHistGenPtVsYVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 777 f3dHistGenPtVsYCMSVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 778 }
779 if( lCurrentParticlePrimary->GetPdgCode() == -3312 ){
780 lPtCurrentPart = lCurrentParticlePrimary->Pt();
781 f3dHistGenPtVsYVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 782 f3dHistGenPtVsYCMSVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 783 }
784 // Omega Histograms
785 if( lCurrentParticlePrimary->GetPdgCode() == 3334 ){
786 lPtCurrentPart = lCurrentParticlePrimary->Pt();
787 f3dHistGenPtVsYVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 788 f3dHistGenPtVsYCMSVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 789 }
790 if( lCurrentParticlePrimary->GetPdgCode() == -3334 ){
791 lPtCurrentPart = lCurrentParticlePrimary->Pt();
792 f3dHistGenPtVsYVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 793 f3dHistGenPtVsYCMSVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 794 }
795 }
796 }
797//----- End Loop on primary Xi, Omega ----------------------------------------------------------
798
799// ---> Set Variables to Zero again
800// ---> Variable Definition
801
76029adc 802 lPtCurrentPart = 0;
803
804//------------------------------------------------
805// Physics Selection
806//------------------------------------------------
807
808 UInt_t maskIsSelected = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
809 Bool_t isSelected = 0;
810 isSelected = (maskIsSelected & AliVEvent::kMB) == AliVEvent::kMB;
811
2213f6fc 812 //pA triggering: CINT7
813 if( fkSwitchINT7 ) isSelected = (maskIsSelected & AliVEvent::kINT7) == AliVEvent::kINT7;
814
76029adc 815 //Standard Min-Bias Selection
816 if ( ! isSelected ) {
817 PostData(1, fListHist);
818 PostData(2, fTreeCascade);
819 return;
820 }
821
822//------------------------------------------------
d8841e95 823// Rerun cascade vertexer!
824//------------------------------------------------
2213f6fc 825/*
d8841e95 826 lESDevent->ResetCascades();
827 lESDevent->ResetV0s();
828
829 AliV0vertexer lV0vtxer;
830 AliCascadeVertexer lCascVtxer;
831
832 lV0vtxer.SetDefaultCuts(fV0Sels);
833 lCascVtxer.SetDefaultCuts(fCascSels);
834
835 lV0vtxer.Tracks2V0vertices(lESDevent);
836 lCascVtxer.V0sTracks2CascadeVertices(lESDevent);
2213f6fc 837*/
d8841e95 838//------------------------------------------------
76029adc 839// After Trigger Selection
840//------------------------------------------------
841
842 lNumberOfV0s = lESDevent->GetNumberOfV0s();
843
844 //Set variable for filling tree afterwards!
845 fHistV0MultiplicityForTrigEvt->Fill(lNumberOfV0s);
846 fHistMultiplicityForTrigEvt->Fill ( lMultiplicity );
847
848//------------------------------------------------
849// Getting: Primary Vertex + MagField Info
850//------------------------------------------------
851
852 const AliESDVertex *lPrimaryTrackingESDVtx = lESDevent->GetPrimaryVertexTracks();
853 // get the vtx stored in ESD found with tracks
854 lPrimaryTrackingESDVtx->GetXYZ( lTrkgPrimaryVtxPos );
855
856 const AliESDVertex *lPrimaryBestESDVtx = lESDevent->GetPrimaryVertex();
857 // get the best primary vertex available for the event
858 // As done in AliCascadeVertexer, we keep the one which is the best one available.
859 // between : Tracking vertex > SPD vertex > TPC vertex > default SPD vertex
860 // This one will be used for next calculations (DCA essentially)
861 lPrimaryBestESDVtx->GetXYZ( lBestPrimaryVtxPos );
862
863 Double_t lPrimaryVtxPosition[3];
864 const AliVVertex *primaryVtx = lESDevent->GetPrimaryVertex();
865 lPrimaryVtxPosition[0] = primaryVtx->GetX();
866 lPrimaryVtxPosition[1] = primaryVtx->GetY();
867 lPrimaryVtxPosition[2] = primaryVtx->GetZ();
868 fHistPVx->Fill( lPrimaryVtxPosition[0] );
869 fHistPVy->Fill( lPrimaryVtxPosition[1] );
870 fHistPVz->Fill( lPrimaryVtxPosition[2] );
871
872//------------------------------------------------
873// Primary Vertex Z position: SKIP
874//------------------------------------------------
875
876 if(TMath::Abs(lBestPrimaryVtxPos[2]) > 10.0 ) {
877 AliWarning("Pb / | Z position of Best Prim Vtx | > 10.0 cm ... return !");
878 PostData(1, fListHist);
879 PostData(2, fTreeCascade);
880 return;
881 }
882
883 lMagneticField = lESDevent->GetMagneticField( );
884 fHistV0MultiplicityForSelEvt ->Fill( lNumberOfV0s );
885 fHistMultiplicity->Fill(lMultiplicity);
886
887//------------------------------------------------
888// SKIP: Events with well-established PVtx
889//------------------------------------------------
890
891 const AliESDVertex *lPrimaryTrackingESDVtxCheck = lESDevent->GetPrimaryVertexTracks();
892 const AliESDVertex *lPrimarySPDVtx = lESDevent->GetPrimaryVertexSPD();
893 if (!lPrimarySPDVtx->GetStatus() && !lPrimaryTrackingESDVtxCheck->GetStatus() ){
894 AliWarning("Pb / No SPD prim. vertex nor prim. Tracking vertex ... return !");
895 PostData(1, fListHist);
896 PostData(2, fTreeCascade);
897 return;
898 }
899 fHistV0MultiplicityForSelEvtNoTPCOnly ->Fill( lNumberOfV0s );
900 fHistMultiplicityNoTPCOnly->Fill(lMultiplicity);
901
902//------------------------------------------------
903// Pileup Rejection Studies
904//------------------------------------------------
905
906 // FIXME : quality selection regarding pile-up rejection
907 if(lESDevent->IsPileupFromSPD() && !fkIsNuclear ){// minContributors=3, minZdist=0.8, nSigmaZdist=3., nSigmaDiamXY=2., nSigmaDiamZ=5. -> see http://alisoft.cern.ch/viewvc/trunk/STEER/AliESDEvent.h?root=AliRoot&r1=41914&r2=42199&pathrev=42199
908 AliWarning("Pb / This is tagged as Pileup from SPD... return !");
909 PostData(1, fListHist);
910 PostData(2, fTreeCascade);
911 return;
912 }
913 fHistV0MultiplicityForSelEvtNoTPCOnlyNoPileup ->Fill( lNumberOfV0s );
914 fHistMultiplicityNoTPCOnlyNoPileup->Fill(lMultiplicity);
915
916 //Do control histograms without the IsFromVertexerZ events, but consider them in analysis...
917 if( ! (lESDevent->GetPrimaryVertex()->IsFromVertexerZ() ) ){
918 fHistPVxAnalysis->Fill( lPrimaryVtxPosition[0] );
919 fHistPVyAnalysis->Fill( lPrimaryVtxPosition[1] );
920 fHistPVzAnalysis->Fill( lPrimaryVtxPosition[2] );
921 }
922
923//------------------------------------------------
924// stack loop starts here
925//------------------------------------------------
926
927//----- Loop on primary Xi, Omega --------------------------------------------------------------
928 for (Int_t iCurrentLabelStack = 0; iCurrentLabelStack < lNbMCPrimary; iCurrentLabelStack++)
929 {// This is the begining of the loop on primaries
930
931 TParticle* lCurrentParticlePrimary = 0x0;
932 lCurrentParticlePrimary = lMCstack->Particle( iCurrentLabelStack );
933 if(!lCurrentParticlePrimary){
934 Printf("Cascade loop %d - MC TParticle pointer to current stack particle = 0x0 ! Skip ...\n", iCurrentLabelStack );
935 continue;
936 }
937 if ( TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3312 || TMath::Abs(lCurrentParticlePrimary->GetPdgCode()) == 3334 ) {
938 Double_t lRapXiMCPrimary = -100;
939 if( (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) != 0 ) {
940 if ( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) !=0 ){
941 lRapXiMCPrimary = 0.5*TMath::Log( (lCurrentParticlePrimary->Energy() + lCurrentParticlePrimary->Pz()) / (lCurrentParticlePrimary->Energy() - lCurrentParticlePrimary->Pz() +1.e-13) );
942 }
943 }
944
945 //=================================================================================
946 // Xi Histograms
947 if( lCurrentParticlePrimary->GetPdgCode() == 3312 ){
948 lPtCurrentPart = lCurrentParticlePrimary->Pt();
949 f3dHistGenSelectedPtVsYVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 950 f3dHistGenSelectedPtVsYCMSVsMultXiMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 951 }
952 if( lCurrentParticlePrimary->GetPdgCode() == -3312 ){
953 lPtCurrentPart = lCurrentParticlePrimary->Pt();
954 f3dHistGenSelectedPtVsYVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 955 f3dHistGenSelectedPtVsYCMSVsMultXiPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 956 }
957 // Omega Histograms
958 if( lCurrentParticlePrimary->GetPdgCode() == 3334 ){
959 lPtCurrentPart = lCurrentParticlePrimary->Pt();
960 f3dHistGenSelectedPtVsYVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 961 f3dHistGenSelectedPtVsYCMSVsMultOmegaMinus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 962 }
963 if( lCurrentParticlePrimary->GetPdgCode() == -3334 ){
964 lPtCurrentPart = lCurrentParticlePrimary->Pt();
965 f3dHistGenSelectedPtVsYVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary, lMultiplicity);
da3539d8 966 f3dHistGenSelectedPtVsYCMSVsMultOmegaPlus->Fill(lPtCurrentPart, lRapXiMCPrimary+fpArapidityShift, lMultiplicity);
76029adc 967 }
968 }
969 }
970//----- End Loop on primary Xi, Omega ----------------------------------------------------------
971
972//------------------------------------------------
973// MAIN CASCADE LOOP STARTS HERE
974//------------------------------------------------
975// Code Credit: Antonin Maire (thanks^100)
976// ---> This is an adaptation
977
978 Long_t ncascades = 0;
979 ncascades = lESDevent->GetNumberOfCascades();
980
981
982 for (Int_t iXi = 0; iXi < ncascades; iXi++){
983 //------------------------------------------------
984 // Initializations
985 //------------------------------------------------
986 //Double_t lTrkgPrimaryVtxRadius3D = -500.0;
987 //Double_t lBestPrimaryVtxRadius3D = -500.0;
988
989 // - 1st part of initialisation : variables needed to store AliESDCascade data members
990 Double_t lEffMassXi = 0. ;
991 //Double_t lChi2Xi = -1. ;
992 Double_t lDcaXiDaughters = -1. ;
993 Double_t lXiCosineOfPointingAngle = -1. ;
994 Double_t lPosXi[3] = { -1000.0, -1000.0, -1000.0 };
995 Double_t lXiRadius = -1000. ;
996
997 // - 2nd part of initialisation : Nbr of clusters within TPC for the 3 daughter cascade tracks
998 Int_t lPosTPCClusters = -1; // For ESD only ...//FIXME : wait for availability in AOD
999 Int_t lNegTPCClusters = -1; // For ESD only ...
1000 Int_t lBachTPCClusters = -1; // For ESD only ...
1001
1002 // - 3rd part of initialisation : about V0 part in cascades
1003 Double_t lInvMassLambdaAsCascDghter = 0.;
1004 //Double_t lV0Chi2Xi = -1. ;
1005 Double_t lDcaV0DaughtersXi = -1.;
1006
1007 Double_t lDcaBachToPrimVertexXi = -1., lDcaV0ToPrimVertexXi = -1.;
1008 Double_t lDcaPosToPrimVertexXi = -1.;
1009 Double_t lDcaNegToPrimVertexXi = -1.;
1010 Double_t lV0CosineOfPointingAngleXi = -1. ;
1011 Double_t lPosV0Xi[3] = { -1000. , -1000., -1000. }; // Position of VO coming from cascade
1012 Double_t lV0RadiusXi = -1000.0;
1013 Double_t lV0quality = 0.;
1014
1015 // - 4th part of initialisation : Effective masses
1016 Double_t lInvMassXiMinus = 0.;
1017 Double_t lInvMassXiPlus = 0.;
1018 Double_t lInvMassOmegaMinus = 0.;
1019 Double_t lInvMassOmegaPlus = 0.;
1020
1021 // - 6th part of initialisation : extra info for QA
1022 Double_t lXiMomX = 0. , lXiMomY = 0., lXiMomZ = 0.;
1023 Double_t lXiTransvMom = 0. ;
1024 Double_t lXiTransvMomMC= 0. ;
1025 Double_t lXiTotMom = 0. ;
1026
1027 Double_t lBachMomX = 0., lBachMomY = 0., lBachMomZ = 0.;
1028 //Double_t lBachTransvMom = 0.;
1029 //Double_t lBachTotMom = 0.;
1030
1031 fTreeCascVarNegNSigmaPion = -100;
1032 fTreeCascVarNegNSigmaProton = -100;
1033 fTreeCascVarPosNSigmaPion = -100;
1034 fTreeCascVarPosNSigmaProton = -100;
1035 fTreeCascVarBachNSigmaPion = -100;
1036 fTreeCascVarBachNSigmaKaon = -100;
1037
1038 Short_t lChargeXi = -2;
1039 //Double_t lV0toXiCosineOfPointingAngle = 0. ;
1040
1041 Double_t lRapXi = -20.0, lRapOmega = -20.0, lRapMC = -20.0; // lEta = -20.0, lTheta = 360., lPhi = 720. ;
1042 //Double_t lAlphaXi = -200., lPtArmXi = -200.0;
1043
1044 // -------------------------------------
1045 // II.ESD - Calculation Part dedicated to Xi vertices (ESD)
1046
1047 AliESDcascade *xi = lESDevent->GetCascade(iXi);
1048 if (!xi) continue;
1049
1050
1051 // - II.Step 1 : around primary vertex
1052 //-------------
1053 //lTrkgPrimaryVtxRadius3D = TMath::Sqrt( lTrkgPrimaryVtxPos[0] * lTrkgPrimaryVtxPos[0] +
1054 // lTrkgPrimaryVtxPos[1] * lTrkgPrimaryVtxPos[1] +
1055 // lTrkgPrimaryVtxPos[2] * lTrkgPrimaryVtxPos[2] );
1056
1057 //lBestPrimaryVtxRadius3D = TMath::Sqrt( lBestPrimaryVtxPos[0] * lBestPrimaryVtxPos[0] +
1058 // lBestPrimaryVtxPos[1] * lBestPrimaryVtxPos[1] +
1059 // lBestPrimaryVtxPos[2] * lBestPrimaryVtxPos[2] );
1060
1061 // - II.Step 2 : Assigning the necessary variables for specific AliESDcascade data members (ESD)
1062 //-------------
1063 lV0quality = 0.;
1064 xi->ChangeMassHypothesis(lV0quality , 3312); // default working hypothesis : cascade = Xi- decay
1065
1066 lEffMassXi = xi->GetEffMassXi();
1067 //lChi2Xi = xi->GetChi2Xi();
1068 lDcaXiDaughters = xi->GetDcaXiDaughters();
1069 lXiCosineOfPointingAngle = xi->GetCascadeCosineOfPointingAngle( lBestPrimaryVtxPos[0],
1070 lBestPrimaryVtxPos[1],
1071 lBestPrimaryVtxPos[2] );
1072 // Take care : the best available vertex should be used (like in AliCascadeVertexer)
1073
1074 xi->GetXYZcascade( lPosXi[0], lPosXi[1], lPosXi[2] );
1075 lXiRadius = TMath::Sqrt( lPosXi[0]*lPosXi[0] + lPosXi[1]*lPosXi[1] );
1076
1077 // - II.Step 3 : around the tracks : Bach + V0 (ESD)
1078 // ~ Necessary variables for ESDcascade data members coming from the ESDv0 part (inheritance)
1079 //-------------
1080
1081 UInt_t lIdxPosXi = (UInt_t) TMath::Abs( xi->GetPindex() );
1082 UInt_t lIdxNegXi = (UInt_t) TMath::Abs( xi->GetNindex() );
1083 UInt_t lBachIdx = (UInt_t) TMath::Abs( xi->GetBindex() );
1084 // Care track label can be negative in MC production (linked with the track quality)
1085 // However = normally, not the case for track index ...
1086
1087 // FIXME : rejection of a double use of a daughter track (nothing but just a crosscheck of what is done in the cascade vertexer)
1088 if(lBachIdx == lIdxNegXi) {
1089 AliWarning("Pb / Idx(Bach. track) = Idx(Neg. track) ... continue!"); continue;
1090 }
1091 if(lBachIdx == lIdxPosXi) {
1092 AliWarning("Pb / Idx(Bach. track) = Idx(Pos. track) ... continue!"); continue;
1093 }
1094
1095 AliESDtrack *pTrackXi = lESDevent->GetTrack( lIdxPosXi );
1096 AliESDtrack *nTrackXi = lESDevent->GetTrack( lIdxNegXi );
1097 AliESDtrack *bachTrackXi = lESDevent->GetTrack( lBachIdx );
1098
1099 if (!pTrackXi || !nTrackXi || !bachTrackXi ) {
1100 AliWarning("ERROR: Could not retrieve one of the 3 ESD daughter tracks of the cascade ...");
1101 continue;
1102 }
1103
1104 fTreeCascVarPosEta = pTrackXi->Eta();
1105 fTreeCascVarNegEta = nTrackXi->Eta();
1106 fTreeCascVarBachEta = bachTrackXi->Eta();
1107
1108 //------------------------------------------------
1109 // TPC dEdx information
1110 //------------------------------------------------
1111 fTreeCascVarNegNSigmaPion = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kPion );
1112 fTreeCascVarNegNSigmaProton = fPIDResponse->NumberOfSigmasTPC( nTrackXi, AliPID::kProton );
1113 fTreeCascVarPosNSigmaPion = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kPion );
1114 fTreeCascVarPosNSigmaProton = fPIDResponse->NumberOfSigmasTPC( pTrackXi, AliPID::kProton );
1115 fTreeCascVarBachNSigmaPion = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kPion );
1116 fTreeCascVarBachNSigmaKaon = fPIDResponse->NumberOfSigmasTPC( bachTrackXi, AliPID::kKaon );
1117
1118 //------------------------------------------------
1119 // TPC Number of clusters info
1120 // --- modified to save the smallest number
1121 // --- of TPC clusters for the 3 tracks
1122 //------------------------------------------------
1123
1124 lPosTPCClusters = pTrackXi->GetTPCNcls();
1125 lNegTPCClusters = nTrackXi->GetTPCNcls();
1126 lBachTPCClusters = bachTrackXi->GetTPCNcls();
1127
1128 // 1 - Poor quality related to TPCrefit
1129 ULong_t pStatus = pTrackXi->GetStatus();
1130 ULong_t nStatus = nTrackXi->GetStatus();
1131 ULong_t bachStatus = bachTrackXi->GetStatus();
1132 if ((pStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Pos. track has no TPCrefit ... continue!"); continue; }
1133 if ((nStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / V0 Neg. track has no TPCrefit ... continue!"); continue; }
1134 if ((bachStatus&AliESDtrack::kTPCrefit) == 0) { AliWarning("Pb / Bach. track has no TPCrefit ... continue!"); continue; }
1135 // 2 - Poor quality related to TPC clusters: lowest cut of 70 clusters
1136 if(lPosTPCClusters < 70) { AliWarning("Pb / V0 Pos. track has less than 70 TPC clusters ... continue!"); continue; }
1137 if(lNegTPCClusters < 70) { AliWarning("Pb / V0 Neg. track has less than 70 TPC clusters ... continue!"); continue; }
1138 if(lBachTPCClusters < 70) { AliWarning("Pb / Bach. track has less than 70 TPC clusters ... continue!"); continue; }
1139 Int_t leastnumberofclusters = 1000;
1140 if( lPosTPCClusters < leastnumberofclusters ) leastnumberofclusters = lPosTPCClusters;
1141 if( lNegTPCClusters < leastnumberofclusters ) leastnumberofclusters = lNegTPCClusters;
1142 if( lBachTPCClusters < leastnumberofclusters ) leastnumberofclusters = lBachTPCClusters;
1143
1144 lInvMassLambdaAsCascDghter = xi->GetEffMass();
1145 // This value shouldn't change, whatever the working hyp. is : Xi-, Xi+, Omega-, Omega+
1146 lDcaV0DaughtersXi = xi->GetDcaV0Daughters();
1147 //lV0Chi2Xi = xi->GetChi2V0();
1148
1149 lV0CosineOfPointingAngleXi = xi->GetV0CosineOfPointingAngle( lBestPrimaryVtxPos[0],
1150 lBestPrimaryVtxPos[1],
1151 lBestPrimaryVtxPos[2] );
1152
1153 lDcaV0ToPrimVertexXi = xi->GetD( lBestPrimaryVtxPos[0],
1154 lBestPrimaryVtxPos[1],
1155 lBestPrimaryVtxPos[2] );
1156
1157 lDcaBachToPrimVertexXi = TMath::Abs( bachTrackXi->GetD( lBestPrimaryVtxPos[0],
1158 lBestPrimaryVtxPos[1],
1159 lMagneticField ) );
1160 // Note : AliExternalTrackParam::GetD returns an algebraic value ...
1161
1162 xi->GetXYZ( lPosV0Xi[0], lPosV0Xi[1], lPosV0Xi[2] );
1163 lV0RadiusXi = TMath::Sqrt( lPosV0Xi[0]*lPosV0Xi[0] + lPosV0Xi[1]*lPosV0Xi[1] );
1164
1165 lDcaPosToPrimVertexXi = TMath::Abs( pTrackXi ->GetD( lBestPrimaryVtxPos[0],
1166 lBestPrimaryVtxPos[1],
1167 lMagneticField ) );
1168
1169 lDcaNegToPrimVertexXi = TMath::Abs( nTrackXi ->GetD( lBestPrimaryVtxPos[0],
1170 lBestPrimaryVtxPos[1],
1171 lMagneticField ) );
1172
1173 // - II.Step 4 : around effective masses (ESD)
1174 // ~ change mass hypotheses to cover all the possibilities : Xi-/+, Omega -/+
1175
1176 if( bachTrackXi->Charge() < 0 ) {
1177 lV0quality = 0.;
1178 xi->ChangeMassHypothesis(lV0quality , 3312);
1179 // Calculate the effective mass of the Xi- candidate.
1180 // pdg code 3312 = Xi-
1181 lInvMassXiMinus = xi->GetEffMassXi();
1182
1183 lV0quality = 0.;
1184 xi->ChangeMassHypothesis(lV0quality , 3334);
1185 // Calculate the effective mass of the Xi- candidate.
1186 // pdg code 3334 = Omega-
1187 lInvMassOmegaMinus = xi->GetEffMassXi();
1188
1189 lV0quality = 0.;
1190 xi->ChangeMassHypothesis(lV0quality , 3312); // Back to default hyp.
1191 }// end if negative bachelor
1192
1193
1194 if( bachTrackXi->Charge() > 0 ){
1195 lV0quality = 0.;
1196 xi->ChangeMassHypothesis(lV0quality , -3312);
1197 // Calculate the effective mass of the Xi+ candidate.
1198 // pdg code -3312 = Xi+
1199 lInvMassXiPlus = xi->GetEffMassXi();
1200
1201 lV0quality = 0.;
1202 xi->ChangeMassHypothesis(lV0quality , -3334);
1203 // Calculate the effective mass of the Xi+ candidate.
1204 // pdg code -3334 = Omega+
1205 lInvMassOmegaPlus = xi->GetEffMassXi();
1206
1207 lV0quality = 0.;
1208 xi->ChangeMassHypothesis(lV0quality , -3312); // Back to "default" hyp.
1209 }// end if positive bachelor
1210 // - II.Step 6 : extra info for QA (ESD)
1211 // miscellaneous pieces of info that may help regarding data quality assessment.
1212 //-------------
1213
1214 xi->GetPxPyPz( lXiMomX, lXiMomY, lXiMomZ );
1215 lXiTransvMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY );
1216 lXiTotMom = TMath::Sqrt( lXiMomX*lXiMomX + lXiMomY*lXiMomY + lXiMomZ*lXiMomZ );
1217
1218 xi->GetBPxPyPz( lBachMomX, lBachMomY, lBachMomZ );
1219 //lBachTransvMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY );
1220 //lBachTotMom = TMath::Sqrt( lBachMomX*lBachMomX + lBachMomY*lBachMomY + lBachMomZ*lBachMomZ );
1221
1222 lChargeXi = xi->Charge();
1223
1224 //lV0toXiCosineOfPointingAngle = xi->GetV0CosineOfPointingAngle( lPosXi[0], lPosXi[1], lPosXi[2] );
1225
1226 lRapXi = xi->RapXi();
1227 lRapOmega = xi->RapOmega();
1228 //lEta = xi->Eta();
1229 //lTheta = xi->Theta() *180.0/TMath::Pi();
1230 //lPhi = xi->Phi() *180.0/TMath::Pi();
1231 //lAlphaXi = xi->AlphaXi();
1232 //lPtArmXi = xi->PtArmXi();
1233
1234//------------------------------------------------
1235// Associate Cascade Candidates to Monte Carlo!
1236//------------------------------------------------
1237
1238//Warning: Not using Continues... Need to fill tree later!
1239
1240 Int_t lPDGCodeCascade = 0;
1241
1242 Int_t lPID_BachMother = 0;
1243 Int_t lPID_NegMother = 0;
1244 Int_t lPID_PosMother = 0;
1245
1246
1247 fTreeCascVarPIDPositive = 0;
1248 fTreeCascVarPIDNegative = 0;
1249 fTreeCascVarPIDBachelor = 0;
1250
1251
1252 if(fDebug > 5)
1253 cout << "MC EventNumber : " << lMCevent->Header()->GetEvent()
1254 << " / MC event Number in Run : " << lMCevent->Header()->GetEventNrInRun() << endl;
1255
1256 // - Step 4.1 : level of the V0 daughters
1257
1258//----------------------------------------
1259// Regular MC ASSOCIATION STARTS HERE
1260//----------------------------------------
1261
1262 Int_t lblPosV0Dghter = (Int_t) TMath::Abs( pTrackXi->GetLabel() );
1263 // Abs value = needed ! question of quality track association ...
1264 Int_t lblNegV0Dghter = (Int_t) TMath::Abs( nTrackXi->GetLabel() );
1265 Int_t lblBach = (Int_t) TMath::Abs( bachTrackXi->GetLabel() );
1266
1267 TParticle* mcPosV0Dghter = lMCstack->Particle( lblPosV0Dghter );
1268 TParticle* mcNegV0Dghter = lMCstack->Particle( lblNegV0Dghter );
1269 TParticle* mcBach = lMCstack->Particle( lblBach );
1270
1271 fTreeCascVarPosTransMomMC = mcPosV0Dghter->Pt();
1272 fTreeCascVarNegTransMomMC = mcNegV0Dghter->Pt();
1273
1274 fTreeCascVarPIDPositive = mcPosV0Dghter -> GetPdgCode();
1275 fTreeCascVarPIDNegative = mcNegV0Dghter -> GetPdgCode();
1276 fTreeCascVarPIDBachelor = mcBach->GetPdgCode();
1277
1278 // - Step 4.2 : level of the Xi daughters
1279
1280 Int_t lblMotherPosV0Dghter = mcPosV0Dghter->GetFirstMother() ;
1281 Int_t lblMotherNegV0Dghter = mcNegV0Dghter->GetFirstMother();
1282
1283 //Rather uncivilized: Open brackets for each 'continue'
1284 if(! (lblMotherPosV0Dghter != lblMotherNegV0Dghter) ) { // same mother
1285 if(! (lblMotherPosV0Dghter < 0) ) { // mother != primary (!= -1)
1286 if(! (lblMotherNegV0Dghter < 0) ) {
1287
1288 // mothers = Lambda candidate ... a priori
1289
1290 TParticle* mcMotherPosV0Dghter = lMCstack->Particle( lblMotherPosV0Dghter );
1291 TParticle* mcMotherNegV0Dghter = lMCstack->Particle( lblMotherNegV0Dghter );
1292
1293 // - Step 4.3 : level of Xi candidate
1294
1295 Int_t lblGdMotherPosV0Dghter = mcMotherPosV0Dghter->GetFirstMother() ;
1296 Int_t lblGdMotherNegV0Dghter = mcMotherNegV0Dghter->GetFirstMother() ;
1297
1298 if(! (lblGdMotherPosV0Dghter != lblGdMotherNegV0Dghter) ) {
1299 if(! (lblGdMotherPosV0Dghter < 0) ) { // primary lambda ...
1300 if(! (lblGdMotherNegV0Dghter < 0) ) { // primary lambda ...
1301
1302 // Gd mothers = Xi candidate ... a priori
1303
1304 TParticle* mcGdMotherPosV0Dghter = lMCstack->Particle( lblGdMotherPosV0Dghter );
1305 TParticle* mcGdMotherNegV0Dghter = lMCstack->Particle( lblGdMotherNegV0Dghter );
1306
1307 Int_t lblMotherBach = (Int_t) TMath::Abs( mcBach->GetFirstMother() );
1308
1309 // if( lblMotherBach != lblGdMotherPosV0Dghter ) continue; //same mother for bach and V0 daughters
1310 if(!(lblMotherBach != lblGdMotherPosV0Dghter)) { //same mother for bach and V0 daughters
1311
1312 TParticle* mcMotherBach = lMCstack->Particle( lblMotherBach );
1313
1314 lPID_BachMother = mcMotherBach->GetPdgCode();
1315 lPID_NegMother = mcGdMotherPosV0Dghter->GetPdgCode();
1316 lPID_PosMother = mcGdMotherNegV0Dghter->GetPdgCode();
1317
1318 if(lPID_BachMother==lPID_NegMother && lPID_BachMother==lPID_PosMother){
1319 lPDGCodeCascade = lPID_BachMother;
1320 lXiTransvMomMC = mcMotherBach->Pt();
1321 if ( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) !=0 ){
1322 lRapMC = 0.5*TMath::Log( (mcMotherBach->Energy() + mcMotherBach->Pz()) / (mcMotherBach->Energy() - mcMotherBach->Pz() +1.e-13) );
1323 }
1324 }
1325
1326 }}}}}}} //Ends all conditionals above...
1327
1328 //----------------------------------------
1329 // Regular MC ASSOCIATION ENDS HERE
1330 //----------------------------------------
1331
1332 //------------------------------------------------
1333 // Set Variables for adding to tree
1334 //------------------------------------------------
1335
1336/* 1*/ fTreeCascVarCharge = lChargeXi;
1337/* 2*/ if(lInvMassXiMinus!=0) fTreeCascVarMassAsXi = lInvMassXiMinus;
1338/* 2*/ if(lInvMassXiPlus!=0) fTreeCascVarMassAsXi = lInvMassXiPlus;
1339/* 3*/ if(lInvMassOmegaMinus!=0) fTreeCascVarMassAsOmega = lInvMassOmegaMinus;
1340/* 3*/ if(lInvMassOmegaPlus!=0) fTreeCascVarMassAsOmega = lInvMassOmegaPlus;
1341/* 4*/ fTreeCascVarPt = lXiTransvMom;
1342/* 4*/ fTreeCascVarPtMC = lXiTransvMomMC;
1343/* 5*/ fTreeCascVarRapXi = lRapXi ;
1344/* 5*/ fTreeCascVarRapMC = lRapMC ;
1345/* 6*/ fTreeCascVarRapOmega = lRapOmega ;
1346/* 7*/ fTreeCascVarDCACascDaughters = lDcaXiDaughters;
1347/* 8*/ fTreeCascVarDCABachToPrimVtx = lDcaBachToPrimVertexXi;
1348/* 9*/ fTreeCascVarDCAV0Daughters = lDcaV0DaughtersXi;
1349/*10*/ fTreeCascVarDCAV0ToPrimVtx = lDcaV0ToPrimVertexXi;
1350/*11*/ fTreeCascVarDCAPosToPrimVtx = lDcaPosToPrimVertexXi;
1351/*12*/ fTreeCascVarDCANegToPrimVtx = lDcaNegToPrimVertexXi;
1352/*13*/ fTreeCascVarCascCosPointingAngle = lXiCosineOfPointingAngle;
1353/*14*/ fTreeCascVarCascRadius = lXiRadius;
1354/*15*/ fTreeCascVarV0Mass = lInvMassLambdaAsCascDghter;
1355/*16*/ fTreeCascVarV0CosPointingAngle = lV0CosineOfPointingAngleXi;
1356/*17*/ fTreeCascVarV0Radius = lV0RadiusXi;
1357/*20*/ fTreeCascVarLeastNbrClusters = leastnumberofclusters;
1358/*21*/ fTreeCascVarMultiplicity = lMultiplicity; //multiplicity, whatever that may be
1359
1360/*23*/ fTreeCascVarDistOverTotMom = TMath::Sqrt(
1361 TMath::Power( lPosXi[0] - lBestPrimaryVtxPos[0] , 2) +
1362 TMath::Power( lPosXi[1] - lBestPrimaryVtxPos[1] , 2) +
1363 TMath::Power( lPosXi[2] - lBestPrimaryVtxPos[2] , 2)
1364 );
1365/*23*/ fTreeCascVarDistOverTotMom /= (lXiTotMom+1e-13);
1366/*24*/ //Not specified here, it has been set already (TRunNumber)
1367/*25*/ fTreeCascVarPID = lPDGCodeCascade;
1368
1369//------------------------------------------------
1370// Fill Tree!
1371//------------------------------------------------
1372
1373// The conditional is meant to decrease excessive
1374// memory usage! Be careful when loosening the
1375// cut!
1376
1377 //Xi Mass window: 150MeV wide
1378 //Omega mass window: 150MeV wide
1379
1380 if( (fTreeCascVarMassAsXi<1.32+0.075&&fTreeCascVarMassAsXi>1.32-0.075) ||
1381 (fTreeCascVarMassAsOmega<1.68+0.075&&fTreeCascVarMassAsOmega>1.68-0.075) ){
1382 fTreeCascade->Fill();
1383 }
1384
1385//------------------------------------------------
1386// Fill tree over.
1387//------------------------------------------------
1388
1389 }// end of the Cascade loop (ESD or AOD)
1390
1391 // Post output data.
1392 PostData(1, fListHist);
1393 PostData(2, fTreeCascade);
1394}
1395
1396//________________________________________________________________________
1397void AliAnalysisTaskExtractPerformanceCascade::Terminate(Option_t *)
1398{
1399 // Draw result to the screen
1400 // Called once at the end of the query
1401
1402 TList *cRetrievedList = 0x0;
1403 cRetrievedList = (TList*)GetOutputData(1);
1404 if(!cRetrievedList){
1405 Printf("ERROR - AliAnalysisTaskExtractCascade : ouput data container list not available\n");
1406 return;
1407 }
1408
1409 fHistV0MultiplicityForTrigEvt = dynamic_cast<TH1F*> ( cRetrievedList->FindObject("fHistV0MultiplicityForTrigEvt") );
1410 if (!fHistV0MultiplicityForTrigEvt) {
1411 Printf("ERROR - AliAnalysisTaskExtractCascade : fHistV0MultiplicityForTrigEvt not available");
1412 return;
1413 }
1414
1415 TCanvas *canCheck = new TCanvas("AliAnalysisTaskExtractCascade","V0 Multiplicity",10,10,510,510);
1416 canCheck->cd(1)->SetLogy();
1417
1418 fHistV0MultiplicityForTrigEvt->SetMarkerStyle(22);
1419 fHistV0MultiplicityForTrigEvt->DrawCopy("E");
1420}
1421
1422//----------------------------------------------------------------------------
1423
1424Double_t AliAnalysisTaskExtractPerformanceCascade::MyRapidity(Double_t rE, Double_t rPz) const
1425{
1426 // Local calculation for rapidity
1427 Double_t ReturnValue = -100;
1428 if( (rE-rPz+1.e-13) != 0 && (rE+rPz) != 0 ){
1429 ReturnValue = 0.5*TMath::Log((rE+rPz)/(rE-rPz+1.e-13));
1430 }
1431 return ReturnValue;
1432}