]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/GammaConv/AliV0Reader.cxx
Cleanup
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliV0Reader.cxx
CommitLineData
a0b94e5c 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *
5 * Version 1.0 *
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// Class used to do analysis on conversion pairs
19//---------------------------------------------
20////////////////////////////////////////////////
21
22// --- ROOT system ---
23#include <TMath.h>
24
25//---- ANALYSIS system ----
26#include "AliV0Reader.h"
27#include "AliAnalysisManager.h"
28#include "AliESDInputHandler.h"
67381a40 29#include "AliPID.h"
a0b94e5c 30#include "AliESDtrack.h"
31#include "AliMCEvent.h"
32#include "AliKFVertex.h"
33
34#include "AliStack.h"
35#include "AliMCEventHandler.h"
10d100d4 36#include "AliESDpid.h"
5e55d806 37#include "AliGammaConversionBGHandler.h"
037dc2db 38#include "AliESDtrackCuts.h"
2ea0dd4a 39#include "TRandom3.h"
a0b94e5c 40
41class iostream;
42class AliESDv0;
43class TFormula;
2ea0dd4a 44class TRandom3;
a0b94e5c 45
46using namespace std;
47
48ClassImp(AliV0Reader)
49
50
9c1cb6f7 51AliESDpid* AliV0Reader::fgESDpid = 0x0;
a0b94e5c 52
53AliV0Reader::AliV0Reader() :
54 TObject(),
55 fMCStack(NULL),
48682642 56 // fMCTruth(NULL),
a0b94e5c 57 fMCEvent(NULL), // for CF
58 fChain(NULL),
48682642 59 // fESDHandler(NULL),
a0b94e5c 60 fESDEvent(NULL),
4a6157dc 61 fCFManager(NULL),
9c1cb6f7 62 //fESDpid(NULL),
a0b94e5c 63 fHistograms(NULL),
64 fCurrentV0IndexNumber(0),
65 fCurrentV0(NULL),
66 fCurrentNegativeKFParticle(NULL),
67 fCurrentPositiveKFParticle(NULL),
68 fCurrentMotherKFCandidate(NULL),
69 fCurrentNegativeESDTrack(NULL),
70 fCurrentPositiveESDTrack(NULL),
71 fNegativeTrackLorentzVector(NULL),
72 fPositiveTrackLorentzVector(NULL),
73 fMotherCandidateLorentzVector(NULL),
74 fCurrentXValue(0),
75 fCurrentYValue(0),
76 fCurrentZValue(0),
77 fPositiveTrackPID(0),
78 fNegativeTrackPID(0),
79 fNegativeMCParticle(NULL),
80 fPositiveMCParticle(NULL),
81 fMotherMCParticle(NULL),
82 fMotherCandidateKFMass(0),
83 fMotherCandidateKFWidth(0),
84 fUseKFParticle(kTRUE),
85 fUseESDTrack(kFALSE),
86 fDoMC(kFALSE),
10e3319b 87 fMaxVertexZ(100.),// 100 cm(from the 0)
a0b94e5c 88 fMaxR(10000),// 100 meter(outside of ALICE)
bd6d9fa3 89 fMinR(0),// 100 meter(outside of ALICE)
a0b94e5c 90 fEtaCut(0.),
dc2883e4 91 fRapidityMesonCut(0.),
a0b94e5c 92 fPtCut(0.),
48682642 93 fSinglePtCut(0.),
a0b94e5c 94 fMaxZ(0.),
48682642 95 fMinClsTPC(0.),
bd6d9fa3 96 fMinClsTPCToF(0.),
a0b94e5c 97 fLineCutZRSlope(0.),
98 fLineCutZValue(0.),
99 fChi2CutConversion(0.),
100 fChi2CutMeson(0.),
9c1cb6f7 101 fAlphaCutMeson(1.),
67381a40 102 fAlphaMinCutMeson(0.),
a0b94e5c 103 fPIDProbabilityCutNegativeParticle(0),
104 fPIDProbabilityCutPositiveParticle(0),
9640a3d1 105 fDodEdxSigmaCut(kFALSE),
e0155998 106 fDoTOFsigmaCut(kFALSE), // RRnewTOF
9640a3d1 107 fPIDnSigmaAboveElectronLine(100),
108 fPIDnSigmaBelowElectronLine(-100),
e0155998 109 fTofPIDnSigmaAboveElectronLine(100), // RRnewTOF
110 fTofPIDnSigmaBelowElectronLine(-100), // RRnewTOF
2ea0dd4a 111 fPIDnSigmaAbovePionLine(-100),
112 fPIDnSigmaAbovePionLineHighPt(-100),
9640a3d1 113 fPIDMinPnSigmaAbovePionLine(100),
10e3319b 114 fPIDMaxPnSigmaAbovePionLine(100),
9c1cb6f7 115 fDoKaonRejectionLowP(kFALSE),
116 fDoProtonRejectionLowP(kFALSE),
117 fDoPionRejectionLowP(kFALSE),
118 fPIDnSigmaAtLowPAroundKaonLine(0),
119 fPIDnSigmaAtLowPAroundProtonLine(0),
120 fPIDnSigmaAtLowPAroundPionLine(0),
121 fPIDMinPKaonRejectionLowP(0),
122 fPIDMinPProtonRejectionLowP(0),
123 fPIDMinPPionRejectionLowP(0),
70ef88b5 124 fDoQtGammaSelection(kFALSE),
14d7f2f9 125 fDoHighPtQtGammaSelection(kFALSE), // RRnew
70ef88b5 126 fQtMax(100.),
14d7f2f9 127 fHighPtQtMax(100.), // RRnew
128 fPtBorderForQt(100.), // RRnew
a0b94e5c 129 fXVertexCut(0.),
130 fYVertexCut(0.),
131 fZVertexCut(0.),
132 fNSigmaMass(0.),
133 fUseImprovedVertex(kFALSE),
134 fUseOwnXYZCalculation(kFALSE),
5ce758b0 135 fUseConstructGamma(kFALSE),
1e7846f4 136 fDoCF(kFALSE),
77880bd8 137 fUseOnFlyV0Finder(kTRUE),
cb90a330 138 fUpdateV0AlreadyCalled(kFALSE),
5e55d806 139 fCurrentEventGoodV0s(NULL),
7f3c7cc6 140 fV0Pindex(),
141 fV0Nindex(),
5e55d806 142// fPreviousEventGoodV0s(),
87f6de3e 143 fCalculateBackground(kFALSE),
5e55d806 144 fBGEventHandler(NULL),
037dc2db 145 fBGEventInitialized(kFALSE),
146 fEsdTrackCuts(NULL),
70ef88b5 147 fNumberOfESDTracks(0),
f14266e7 148 fNEventsForBGCalculation(20),
5ce758b0 149 fUseChargedTrackMultiplicityForBG(kTRUE),
64f4118c 150 fNumberOfGoodV0s(0),
40051a3e 151 fIsHeavyIon(0),
2ea0dd4a 152 fUseCorrectedTPCClsInfo(kFALSE),
57278c00 153 fUseMCPSmearing(kTRUE),
2ea0dd4a 154 fPBremSmearing(1.),
155 fPSigSmearing(0.),
156 fPSigSmearingCte(0.),
157 fRandom(0),
158 fBrem(NULL),
159 fDoPhotonAsymmetryCut(0),
160 fMinPPhotonAsymmetryCut(100.),
161 fMinPhotonAsymmetry(0.)
a0b94e5c 162{
9c1cb6f7 163 //fESDpid = new AliESDpid;
a0b94e5c 164}
165
166
167AliV0Reader::AliV0Reader(const AliV0Reader & original) :
168 TObject(original),
169 fMCStack(original.fMCStack),
48682642 170 // fMCTruth(original.fMCTruth),
a0b94e5c 171 fMCEvent(original.fMCEvent), // for CF
172 fChain(original.fChain),
48682642 173 // fESDHandler(original.fESDHandler),
a0b94e5c 174 fESDEvent(original.fESDEvent),
4a6157dc 175 fCFManager(original.fCFManager),
9c1cb6f7 176 // fESDpid(original.fESDpid),
a0b94e5c 177 fHistograms(original.fHistograms),
178 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
179 fCurrentV0(original.fCurrentV0),
180 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
181 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
182 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
183 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
184 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
185 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
186 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
187 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
188 fCurrentXValue(original.fCurrentXValue),
189 fCurrentYValue(original.fCurrentYValue),
190 fCurrentZValue(original.fCurrentZValue),
191 fPositiveTrackPID(original.fPositiveTrackPID),
192 fNegativeTrackPID(original.fNegativeTrackPID),
193 fNegativeMCParticle(original.fNegativeMCParticle),
194 fPositiveMCParticle(original.fPositiveMCParticle),
195 fMotherMCParticle(original.fMotherMCParticle),
196 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
197 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
198 fUseKFParticle(kTRUE),
199 fUseESDTrack(kFALSE),
200 fDoMC(kFALSE),
10e3319b 201 fMaxVertexZ(original.fMaxVertexZ),
a0b94e5c 202 fMaxR(original.fMaxR),
bd6d9fa3 203 fMinR(original.fMinR),
a0b94e5c 204 fEtaCut(original.fEtaCut),
dc2883e4 205 fRapidityMesonCut(original.fRapidityMesonCut),
a0b94e5c 206 fPtCut(original.fPtCut),
48682642 207 fSinglePtCut(original.fSinglePtCut),
a0b94e5c 208 fMaxZ(original.fMaxZ),
48682642 209 fMinClsTPC(original.fMinClsTPC),
bd6d9fa3 210 fMinClsTPCToF(original.fMinClsTPCToF),
a0b94e5c 211 fLineCutZRSlope(original.fLineCutZRSlope),
212 fLineCutZValue(original.fLineCutZValue),
213 fChi2CutConversion(original.fChi2CutConversion),
214 fChi2CutMeson(original.fChi2CutMeson),
9c1cb6f7 215 fAlphaCutMeson(original.fAlphaCutMeson),
67381a40 216 fAlphaMinCutMeson(original.fAlphaMinCutMeson),
a0b94e5c 217 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
218 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
9640a3d1 219 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
e0155998 220 fDoTOFsigmaCut(original.fDoTOFsigmaCut), // RRnewTOF
9640a3d1 221 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
222 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
e0155998 223 fTofPIDnSigmaAboveElectronLine(original.fTofPIDnSigmaAboveElectronLine), // RRnewTOF
224 fTofPIDnSigmaBelowElectronLine(original.fTofPIDnSigmaBelowElectronLine), // RRnewTOF
9640a3d1 225 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
2ea0dd4a 226 fPIDnSigmaAbovePionLineHighPt(original.fPIDnSigmaAbovePionLineHighPt),
9640a3d1 227 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
10e3319b 228 fPIDMaxPnSigmaAbovePionLine(original.fPIDMaxPnSigmaAbovePionLine),
9c1cb6f7 229 fDoKaonRejectionLowP(original.fDoKaonRejectionLowP),
230 fDoProtonRejectionLowP(original.fDoProtonRejectionLowP),
231 fDoPionRejectionLowP(original.fDoPionRejectionLowP),
232 fPIDnSigmaAtLowPAroundKaonLine(original.fPIDnSigmaAtLowPAroundKaonLine),
233 fPIDnSigmaAtLowPAroundProtonLine(original.fPIDnSigmaAtLowPAroundProtonLine),
234 fPIDnSigmaAtLowPAroundPionLine(original.fPIDnSigmaAtLowPAroundPionLine),
235 fPIDMinPKaonRejectionLowP(original.fPIDMinPKaonRejectionLowP),
236 fPIDMinPProtonRejectionLowP(original.fPIDMinPProtonRejectionLowP),
237 fPIDMinPPionRejectionLowP(original.fPIDMinPPionRejectionLowP),
70ef88b5 238 fDoQtGammaSelection(original.fDoQtGammaSelection),
14d7f2f9 239 fDoHighPtQtGammaSelection(original.fDoHighPtQtGammaSelection), // RRnew
70ef88b5 240 fQtMax(original.fQtMax),
14d7f2f9 241 fHighPtQtMax(original.fHighPtQtMax), // RRnew
242 fPtBorderForQt(original.fPtBorderForQt), // RRnew
a0b94e5c 243 fXVertexCut(original.fXVertexCut),
244 fYVertexCut(original.fYVertexCut),
245 fZVertexCut(original.fZVertexCut),
246 fNSigmaMass(original.fNSigmaMass),
247 fUseImprovedVertex(original.fUseImprovedVertex),
248 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
5ce758b0 249 fUseConstructGamma(original.fUseConstructGamma),
1e7846f4 250 fDoCF(original.fDoCF),
77880bd8 251 fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
cb90a330 252 fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
a0b94e5c 253 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
7f3c7cc6 254 fV0Pindex(original.fV0Pindex),
255 fV0Nindex(original.fV0Nindex),
5e55d806 256 // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s),
87f6de3e 257 fCalculateBackground(original.fCalculateBackground),
5e55d806 258 fBGEventHandler(original.fBGEventHandler),
037dc2db 259 fBGEventInitialized(original.fBGEventInitialized),
260 fEsdTrackCuts(original.fEsdTrackCuts),
70ef88b5 261 fNumberOfESDTracks(original.fNumberOfESDTracks),
f14266e7 262 fNEventsForBGCalculation(original.fNEventsForBGCalculation),
5ce758b0 263 fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG),
64f4118c 264 fNumberOfGoodV0s(original.fNumberOfGoodV0s),
40051a3e 265 fIsHeavyIon(original.fIsHeavyIon),
2ea0dd4a 266 fUseCorrectedTPCClsInfo(original.fUseCorrectedTPCClsInfo),
57278c00 267 fUseMCPSmearing(original.fUseMCPSmearing),
2ea0dd4a 268 fPBremSmearing(original.fPBremSmearing),
269 fPSigSmearing(original.fPSigSmearing),
270 fPSigSmearingCte(original.fPSigSmearingCte),
271 fRandom(original.fRandom),
272 fBrem(original.fBrem),
273 fDoPhotonAsymmetryCut(original.fDoPhotonAsymmetryCut),
274 fMinPPhotonAsymmetryCut(original.fMinPPhotonAsymmetryCut),
275 fMinPhotonAsymmetry(original.fMinPhotonAsymmetry)
a0b94e5c 276{
277
278}
279
280
281AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
282{
283 // assignment operator
284 return *this;
285}
9640a3d1 286AliV0Reader::~AliV0Reader()
287{
9c1cb6f7 288 // if(fESDpid){
289 // delete fESDpid;
290 //}
9640a3d1 291}
a0b94e5c 292
48682642 293//____________________________________________________________________________
294void AliV0Reader::SetInputAndMCEvent(AliVEvent* esd, AliMCEvent* mc) {
295 // Connect the data pointers
296
297 SetInputEvent(esd);
298 SetMC(mc);
299
300}
301
302
a0b94e5c 303void AliV0Reader::Initialize(){
304 //see header file for documentation
5e55d806 305
cb90a330 306 fUpdateV0AlreadyCalled = kFALSE;
48682642 307
308 /*
a0b94e5c 309 // Get the input handler from the manager
310 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
311 if(fESDHandler == NULL){
312 //print warning here
313 }
48682642 314
a0b94e5c 315 // Get pointer to esd event from input handler
316 fESDEvent = fESDHandler->GetEvent();
317 if(fESDEvent == NULL){
318 //print warning here
319 }
48682642 320
a0b94e5c 321 //Get pointer to MCTruth
322 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
48682642 323 */
324
325
326
327 // fMCTruth = mcH->MCEvent();
328 // fMC = mcH->MCEvent();
329 // stack = fMC->Stack();
330
331
332 //if(fMCTruth == NULL){
a0b94e5c 333 //print warning here
48682642 334 // fDoMC = kFALSE;
335 //}
336
337 if(fMCEvent == NULL){
338 fDoMC = kFALSE;
a0b94e5c 339 }
48682642 340
a0b94e5c 341 //Get pointer to the mc stack
48682642 342 // if(fMCTruth){
343 if(fMCEvent){
344 fMCStack = fMCEvent->Stack();
61374d97 345 if(fMCStack == NULL){
346 //print warning here
347 }
5e55d806 348 // Better parameters for MonteCarlo from A. Kalweit 2010/01/8
9c1cb6f7 349// fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
350// 1.75295e+01,
351// 3.40030e-09,
352// 1.96178e+00,
353// 3.91720e+00);
5e55d806 354 }
355 else{
356 // Better parameters for data from A. Kalweit 2010/01/8
9c1cb6f7 357 // fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
358// 2.63394e+01,
359// 5.04114e-11,
360// 2.12543e+00,
361// 4.88663e+00);
a0b94e5c 362 }
363
a0b94e5c 364 // for CF
365 //Get pointer to the mc event
b74269dc 366 if(fDoCF && fDoMC){
48682642 367 //fMCEvent = fMCTruth->MCEvent();
1e7846f4 368 if(fMCEvent == NULL){
369 //print warning here
370 fDoCF = kFALSE;
371 }
372 }
a0b94e5c 373
374 AliKFParticle::SetField(fESDEvent->GetMagneticField());
5e55d806 375
376 // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0);
63e16c52 377 if(fCurrentEventGoodV0s == NULL){
378 fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0);
379 }
5e55d806 380
7f3c7cc6 381 fV0Pindex.clear();
382 fV0Nindex.clear();
383
2ea0dd4a 384 if(gRandom != NULL){
385 delete gRandom;
386 gRandom= new TRandom3(0);
387 }
388
389
390 if (fBrem == NULL){
391 fBrem = new TF1("fBrem","pow(-log(x),[0]/log(2.0)-1.0)/TMath::Gamma([0]/log(2.0))",0.00001,0.999999999);
392 // tests done with 1.0e-14
393 fBrem->SetParameter(0,fPBremSmearing);
394 fBrem->SetNpx(100000);
395 }
396
87f6de3e 397 if(fCalculateBackground == kTRUE){
398 if(fBGEventInitialized == kFALSE){
037dc2db 399
87f6de3e 400
10e3319b 401 Double_t *zBinLimitsArray = new Double_t[9];
037dc2db 402 zBinLimitsArray[0] = -50.00;
5ce758b0 403 zBinLimitsArray[1] = -3.375;
404 zBinLimitsArray[2] = -1.605;
405 zBinLimitsArray[3] = -0.225;
406 zBinLimitsArray[4] = 1.065;
407 zBinLimitsArray[5] = 2.445;
408 zBinLimitsArray[6] = 4.245;
037dc2db 409 zBinLimitsArray[7] = 50.00;
10e3319b 410 zBinLimitsArray[8] = 1000.00;
87f6de3e 411
10e3319b 412 Double_t *multiplicityBinLimitsArray= new Double_t[6];
5ce758b0 413 if(fUseChargedTrackMultiplicityForBG == kTRUE){
414 multiplicityBinLimitsArray[0] = 0;
415 multiplicityBinLimitsArray[1] = 8.5;
416 multiplicityBinLimitsArray[2] = 16.5;
417 multiplicityBinLimitsArray[3] = 27.5;
418 multiplicityBinLimitsArray[4] = 41.5;
419 multiplicityBinLimitsArray[5] = 100.;
64f4118c 420 if(fIsHeavyIon){
421 multiplicityBinLimitsArray[0] = 0;
422 multiplicityBinLimitsArray[1] = 200.;
423 multiplicityBinLimitsArray[2] = 500.;
424 multiplicityBinLimitsArray[3] = 1000.;
425 multiplicityBinLimitsArray[4] = 1500.;
426 multiplicityBinLimitsArray[5] = 3000.;
427 }
f14266e7 428 fBGEventHandler = new AliGammaConversionBGHandler(9,6,fNEventsForBGCalculation);
5ce758b0 429 }
430 else{
431 multiplicityBinLimitsArray[0] = 2;
432 multiplicityBinLimitsArray[1] = 3;
433 multiplicityBinLimitsArray[2] = 4;
434 multiplicityBinLimitsArray[3] = 5;
435 multiplicityBinLimitsArray[4] = 9999;
64f4118c 436 if(fIsHeavyIon){
437 multiplicityBinLimitsArray[0] = 2;
438 multiplicityBinLimitsArray[1] = 10;
439 multiplicityBinLimitsArray[2] = 30;
440 multiplicityBinLimitsArray[3] = 50;
441 multiplicityBinLimitsArray[4] = 9999;
442 }
5ce758b0 443
f14266e7 444 fBGEventHandler = new AliGammaConversionBGHandler(9,5,fNEventsForBGCalculation);
5ce758b0 445 }
446
447
87f6de3e 448
037dc2db 449 /*
450 // ---------------------------------
451 Double_t *zBinLimitsArray = new Double_t[1];
452 zBinLimitsArray[0] = 999999.00;
453
454 Double_t *multiplicityBinLimitsArray= new Double_t[1];
455 multiplicityBinLimitsArray[0] = 99999999.00;
456 fBGEventHandler = new AliGammaConversionBGHandler(1,1,10);
457 // ---------------------------------
458 */
87f6de3e 459 fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray);
460 fBGEventInitialized = kTRUE;
461 }
5e55d806 462 }
a0b94e5c 463}
464
465AliESDv0* AliV0Reader::GetV0(Int_t index){
466 //see header file for documentation
467 fCurrentV0 = fESDEvent->GetV0(index);
468 UpdateV0Information();
469 return fCurrentV0;
470}
471
c8206114 472Int_t AliV0Reader::GetNumberOfContributorsVtx(){
f14266e7 473 // returns number of contributors to the vertex
c8206114 474 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
475 return fESDEvent->GetPrimaryVertexTracks()->GetNContributors();
476 }
477
478 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
14d7f2f9 479 // return 0;
480 //-AM test pi0s without SPD only vertex
c8206114 481 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
482 return fESDEvent->GetPrimaryVertexSPD()->GetNContributors();
483
484 }
485 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
486 cout<<"number of contributors from bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
487 return 0;
488 }
489 }
490 return 0;
491}
a0b94e5c 492Bool_t AliV0Reader::CheckForPrimaryVertex(){
037dc2db 493 //see headerfile for documentation
c8206114 494
495 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
496 return 1;
497 }
498
499 if(fESDEvent->GetPrimaryVertexTracks()->GetNContributors()<1) {
500 // SPD vertex
501 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()>0) {
14d7f2f9 502 // return 0;
503 //-AM test pi0s without SPD only vertex
c8206114 504 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
505 return 1;
506
507 }
508 if(fESDEvent->GetPrimaryVertexSPD()->GetNContributors()<1) {
509 // cout<<"bad vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
510 return 0;
511 }
512 }
513 return 0;
514 // return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
a0b94e5c 515}
516
10e3319b 517Bool_t AliV0Reader::CheckForPrimaryVertexZ(){
518 //see headerfile for documentation
519
520 if(TMath::Abs(fESDEvent->GetPrimaryVertex()->GetZ())<GetMaxVertexZ()){
521 return kTRUE;
522 }else{
523 return kFALSE;
524 }
525 return kTRUE;
526}
77880bd8 527
528Bool_t AliV0Reader::CheckV0FinderStatus(Int_t index){
037dc2db 529 // see headerfile for documentation
77880bd8 530 if(fUseOnFlyV0Finder){
77880bd8 531 if(!GetV0(index)->GetOnFlyStatus()){
532 return kFALSE;
533 }
534 }
535 if(!fUseOnFlyV0Finder){
51b95cb0 536 if(GetV0(index)->GetOnFlyStatus()){
77880bd8 537 return kFALSE;
538 }
539 }
77880bd8 540 return kTRUE;
541}
542
543
544
a0b94e5c 545Bool_t AliV0Reader::NextV0(){
546 //see header file for documentation
037dc2db 547
a0b94e5c 548 Bool_t iResult=kFALSE;
549 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
550 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
037dc2db 551
1b832bb9 552 fUpdateV0AlreadyCalled=kFALSE;
553
037dc2db 554 if(fHistograms != NULL){
555 fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass());
556 }
a0b94e5c 557
558 // moved it up here so that the correction framework can access pt and eta information
559 if(UpdateV0Information() == kFALSE){
560 fCurrentV0IndexNumber++;
561 continue;
562 }
cb90a330 563
a0b94e5c 564 Double_t containerInput[3];
1e7846f4 565 if(fDoCF){
566 containerInput[0] = GetMotherCandidatePt();
567 containerInput[1] = GetMotherCandidateEta();
568 containerInput[2] = GetMotherCandidateMass();
569 }
ebcfaa7e 570 /*
571 if(fDoCF){
572 containerInput[0] = GetMotherCandidatePt();
573 containerInput[1] = GetMotherCandidateEta();
574 containerInput[2] = GetMotherCandidateMass();
575
576 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
577 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
578 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
579 }
580 */
581
a0b94e5c 582 //checks if on the fly mode is set
48e7eac2 583 if ( !CheckV0FinderStatus(fCurrentV0IndexNumber) ){
a0b94e5c 584 if(fHistograms != NULL){
585 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
586 }
587 fCurrentV0IndexNumber++;
588 continue;
589 }
1e7846f4 590 if(fDoCF){
591 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
592 }
ebcfaa7e 593
594 if(fHistograms != NULL){
595 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_InvMass",GetMotherCandidateMass());
596 }
48682642 597
598 Double_t armenterosQtAlfa[2];
599 GetArmenterosQtAlfa(GetNegativeKFParticle(),
600 GetPositiveKFParticle(),
601 GetMotherCandidateKFCombination(),
602 armenterosQtAlfa);
603
604 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
605
606
f14266e7 607 if(fCurrentNegativeESDTrack->Charge() == fCurrentPositiveESDTrack->Charge()){ // avoid like sign
ebcfaa7e 608 // iResult=kFALSE;
609 if(fHistograms != NULL ){
610 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
611 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
612 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
613 // fUpdateV0AlreadyCalled = kTRUE;
614 }
615 fCurrentV0IndexNumber++;
616 continue;
617 }
618 if(fDoCF){
619 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
620 }
621
622
623 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
624 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
625 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
626 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
627 // iResult=kFALSE;
628 if(fHistograms != NULL){
629 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
630 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
631 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
632 //fUpdateV0AlreadyCalled = kTRUE;
633 }
634 fCurrentV0IndexNumber++;
635 continue;
636 }
637 if(fDoCF){
638 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
639 }
640
641
642
643 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
644 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
645 //iResult=kFALSE;
646 if(fHistograms != NULL ){
647 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
648 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
649 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
650 //fUpdateV0AlreadyCalled = kTRUE;
651 }
652 fCurrentV0IndexNumber++;
653 continue;
654 }
655
656 if(fDoCF){
657 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
658 }
659
dc2883e4 660 fHistograms->FillHistogram("ESD_AllV0sCurrentFinder_goodtracks_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
cc5a88a2 661
662
663 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
664 if(fHistograms != NULL){
665 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
666 }
667 fCurrentV0IndexNumber++;
668 continue;
669 }
670 if(fDoCF){
671 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
672 }
673 if(GetXYRadius()<fMinR){ // cuts on distance from collision point
674 if(fHistograms != NULL){
675 fHistograms->FillHistogram("ESD_CutMinR_InvMass",GetMotherCandidateMass());
676 }
677 fCurrentV0IndexNumber++;
678 continue;
679 }
680
681
682
683 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct
684 if(fHistograms != NULL){
685 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
686 }
687 fCurrentV0IndexNumber++;
688 continue;
689 }
690 if(fDoCF){
691 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
692 }
693
694 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
695 if(fHistograms != NULL){
696 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
697 }
698 fCurrentV0IndexNumber++;
699 continue;
700 }
701 if(fDoCF){
702 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
703 }
704
705 if(fUseKFParticle){
706 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){
707 if(fHistograms != NULL){
708 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
709 }
710 fCurrentV0IndexNumber++;
711 continue;
712 }
713
714 if(TMath::Abs(fCurrentNegativeKFParticle->GetEta())> fEtaCut){
715 if(fHistograms != NULL){
716 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
717 }
718 fCurrentV0IndexNumber++;
719 continue;
720 }
721
722 if(TMath::Abs(fCurrentPositiveKFParticle->GetEta())> fEtaCut){
723 if(fHistograms != NULL){
724 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
725 }
726 fCurrentV0IndexNumber++;
727 continue;
728 }
729 }
730
dc2883e4 731
ebcfaa7e 732 if(fDodEdxSigmaCut == kTRUE){
9c1cb6f7 733 if( fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
734 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
735 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
736 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
ebcfaa7e 737 //iResult=kFALSE;
738 if(fHistograms != NULL ){
739 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
740 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
741 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
742 //fUpdateV0AlreadyCalled = kTRUE;
743 }
744 fCurrentV0IndexNumber++;
745 continue;
746 }
747 if(fDoCF){
f14266e7 748 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxElectronselection); // for CF
ebcfaa7e 749 }
750
10e3319b 751 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentPositiveESDTrack->P()<fPIDMaxPnSigmaAbovePionLine ){
9c1cb6f7 752 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
753 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
754 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
ebcfaa7e 755 // iResult=kFALSE;
756 if(fHistograms != NULL){
757 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
758 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
759 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
760 //fUpdateV0AlreadyCalled = kTRUE;
761 }
762 fCurrentV0IndexNumber++;
763 continue;
764 }
765 }
766
10e3319b 767 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine && fCurrentNegativeESDTrack->P()<fPIDMaxPnSigmaAbovePionLine){
9c1cb6f7 768 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
769 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
770 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
ebcfaa7e 771 // iResult=kFALSE;
772 if(fHistograms != NULL){
773 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
774 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
775 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
776 //fUpdateV0AlreadyCalled = kTRUE;
777 }
778 fCurrentV0IndexNumber++;
779 continue;
780 }
781 }
2ea0dd4a 782
783 // High Pt
784 if( fCurrentPositiveESDTrack->P()>fPIDMaxPnSigmaAbovePionLine ){
785 if(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
786 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
787 fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
788 // iResult=kFALSE;
789 if(fHistograms != NULL){
790 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
791 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
792 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
793 //fUpdateV0AlreadyCalled = kTRUE;
794 }
795 fCurrentV0IndexNumber++;
796 continue;
797 }
798 }
799
800 if( fCurrentNegativeESDTrack->P()>fPIDMaxPnSigmaAbovePionLine){
801 if(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
802 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
803 fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLineHighPt){
804 // iResult=kFALSE;
805 if(fHistograms != NULL){
806 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
807 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
808 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
809 //fUpdateV0AlreadyCalled = kTRUE;
810 }
811 fCurrentV0IndexNumber++;
812 continue;
813 }
814 }
815
816
ebcfaa7e 817 if(fDoCF){
f14266e7 818 fCFManager->GetParticleContainer()->Fill(containerInput,kStepdEdxPionrejection); // for CF
ebcfaa7e 819 }
820
821 }
10e3319b 822
9c1cb6f7 823 if(fDoKaonRejectionLowP == kTRUE){
824 if( fCurrentNegativeESDTrack->P()<fPIDMinPKaonRejectionLowP ){
825 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
826 if(fHistograms != NULL){
827 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
828 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
829 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
830 //fUpdateV0AlreadyCalled = kTRUE;
831 }
832 fCurrentV0IndexNumber++;
833 continue;
834 }
835 }
836 if( fCurrentPositiveESDTrack->P()<fPIDMinPKaonRejectionLowP ){
837 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kKaon))<fPIDnSigmaAtLowPAroundKaonLine){
838 if(fHistograms != NULL){
839 fHistograms->FillHistogram("ESD_CutKaonRejectionLowP_InvMass",GetMotherCandidateMass());
840 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
841 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
842 //fUpdateV0AlreadyCalled = kTRUE;
843 }
844 fCurrentV0IndexNumber++;
845 continue;
846 }
847 }
848 }
10e3319b 849
9c1cb6f7 850 if(fDoProtonRejectionLowP == kTRUE){
851 if( fCurrentNegativeESDTrack->P()<fPIDMinPProtonRejectionLowP){
852 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
853 if(fHistograms != NULL){
854 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
855 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
856 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
857 //fUpdateV0AlreadyCalled = kTRUE;
858 }
859 fCurrentV0IndexNumber++;
860 continue;
861 }
862 }
863 if( fCurrentPositiveESDTrack->P()<fPIDMinPProtonRejectionLowP ){
864 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kProton))<fPIDnSigmaAtLowPAroundProtonLine){
865 if(fHistograms != NULL){
866 fHistograms->FillHistogram("ESD_CutProtonRejectionLowP_InvMass",GetMotherCandidateMass());
867 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
868 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
869 //fUpdateV0AlreadyCalled = kTRUE;
870 }
871 fCurrentV0IndexNumber++;
872 continue;
873 }
874 }
875
876 }
10e3319b 877
9c1cb6f7 878 if(fDoPionRejectionLowP == kTRUE){
879 if( fCurrentNegativeESDTrack->P()<fPIDMinPPionRejectionLowP ){
880 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
881 if(fHistograms != NULL){
882 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
883 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
884 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
885 //fUpdateV0AlreadyCalled = kTRUE;
886 }
887 fCurrentV0IndexNumber++;
888 continue;
889 }
890 }
891 if( fCurrentPositiveESDTrack->P()<fPIDMinPPionRejectionLowP ){
892 if( TMath::Abs(fgESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion))<fPIDnSigmaAtLowPAroundPionLine){
893 if(fHistograms != NULL){
894 fHistograms->FillHistogram("ESD_CutPionRejectionLowP_InvMass",GetMotherCandidateMass());
895 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
896 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
897 //fUpdateV0AlreadyCalled = kTRUE;
898 }
899 fCurrentV0IndexNumber++;
900 continue;
901 }
902 }
903 }
904
10e3319b 905
e0155998 906 if( fDoTOFsigmaCut == kTRUE ){ // RRnewTOF start /////////////////////////////////////////////////////////////////////////////
907 Bool_t PosTrackNotTOFelec = kFALSE;
908 Bool_t NegTrackNotTOFelec = kFALSE;
e0155998 909 if( fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTOFpid ){
cc5a88a2 910 Double_t t0pos = fgESDpid->GetTOFResponse().GetStartTime(fCurrentPositiveESDTrack->P());
911 Double_t fnSigmaPos = fgESDpid->NumberOfSigmasTOF(fCurrentPositiveESDTrack, AliPID::kElectron, t0pos);
e0155998 912 if( (fnSigmaPos>fTofPIDnSigmaAboveElectronLine) || (fnSigmaPos<fTofPIDnSigmaBelowElectronLine) ) PosTrackNotTOFelec = kTRUE;
913 }
914 if( fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTOFpid ){
cc5a88a2 915 Double_t t0neg = fgESDpid->GetTOFResponse().GetStartTime(fCurrentNegativeESDTrack->P());
916 Double_t fnSigmaNeg = fgESDpid->NumberOfSigmasTOF(fCurrentNegativeESDTrack, AliPID::kElectron, t0neg);
e0155998 917 if( (fnSigmaNeg>fTofPIDnSigmaAboveElectronLine) || (fnSigmaNeg<fTofPIDnSigmaBelowElectronLine) ) NegTrackNotTOFelec = kTRUE;
918 }
919 if( (PosTrackNotTOFelec==kTRUE) || (NegTrackNotTOFelec==kTRUE) ){
920 if(fHistograms != NULL){
921 fHistograms->FillHistogram("ESD_CutTOFsigmaElec_InvMass",GetMotherCandidateMass());
922 }
923 fCurrentV0IndexNumber++;
924 continue;
925 }
926 } /////////////////////////////// RRnewTOF end ///////////////////////////////////////////////////////////////////////////////
927
928
70ef88b5 929 // Gamma selection based on QT from Armenteros
14d7f2f9 930 if(fDoQtGammaSelection == kTRUE){ // RRnew start : apply different qT-cut above/below
931 if(fDoHighPtQtGammaSelection){
932 if(GetMotherCandidatePt() < fPtBorderForQt){
933 if(armenterosQtAlfa[0]>fQtMax){
934 if(fHistograms != NULL){
935 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
936 }
937 fCurrentV0IndexNumber++;
938 continue;
939 }
940 }
941 else{
942 if(armenterosQtAlfa[0]>fHighPtQtMax) {
943 if(fHistograms != NULL){
944 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
945 }
946 fCurrentV0IndexNumber++;
947 continue;
948 }
949 }
950
70ef88b5 951 }
14d7f2f9 952 else{
953 if(armenterosQtAlfa[0]>fQtMax){
954 if(fHistograms != NULL){
955 fHistograms->FillHistogram("ESD_CutQt_InvMass",GetMotherCandidateMass());
956 }
957 fCurrentV0IndexNumber++;
958 continue;
959 }
960 }
961 } // RRnew end
70ef88b5 962
2ea0dd4a 963 if(fDoPhotonAsymmetryCut == kTRUE){
964 if( fNegativeTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
965 Double_t trackNegAsy=0;
966 if (fCurrentMotherKFCandidate->GetP()!=0.){
967 trackNegAsy= fNegativeTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
968 }
969 if( trackNegAsy<fMinPhotonAsymmetry ||trackNegAsy>(1.- fMinPhotonAsymmetry)){
970 if(fHistograms != NULL){
971 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
972 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
973 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
974 //fUpdateV0AlreadyCalled = kTRUE;
975 }
976 fCurrentV0IndexNumber++;
977 continue;
978 }
979 }
980
981 if( fPositiveTrackLorentzVector->P()>fMinPPhotonAsymmetryCut ){
982 Double_t trackPosAsy=0;
983 if (fCurrentMotherKFCandidate->GetP()!=0.){
984 trackPosAsy= fPositiveTrackLorentzVector->P()/fMotherCandidateLorentzVector->P();
985 }
986 if( trackPosAsy<fMinPhotonAsymmetry ||trackPosAsy>(1.- fMinPhotonAsymmetry)){
987 if(fHistograms != NULL){
988 fHistograms->FillHistogram("ESD_CutPhotonAsymmetry_InvMass",GetMotherCandidateMass());
989 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
990 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
991 //fUpdateV0AlreadyCalled = kTRUE;
992 }
993 fCurrentV0IndexNumber++;
994 continue;
995 }
996 }
997 }
a0b94e5c 998 //checks if we have a prim vertex
c8206114 999 //if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
1000 if(GetNumberOfContributorsVtx()<=0) {
a0b94e5c 1001 if(fHistograms != NULL){
1002 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
1003 }
1004 fCurrentV0IndexNumber++;
1005 continue;
1006 }
1e7846f4 1007 if(fDoCF){
1008 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
1009 }
a0b94e5c 1010
1011 //Check the pid probability
1012 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
1013 if(fHistograms != NULL){
1014 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
1015 }
1016 fCurrentV0IndexNumber++;
1017 continue;
1018 }
1e7846f4 1019 if(fDoCF){
1020 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
1021 }
a0b94e5c 1022
a0b94e5c 1023
1024 /* Moved further up so corr framework can work
1025 if(UpdateV0Information() == kFALSE){
1026 fCurrentV0IndexNumber++;
1027 continue;
1028 }
1029 */
48682642 1030 if(fCurrentNegativeESDTrack->GetNcls(1) < fMinClsTPC || fCurrentPositiveESDTrack->GetNcls(1) < fMinClsTPC ){
1031 if(fHistograms != NULL){
1032 fHistograms->FillHistogram("ESD_CutMinNClsTPC_InvMass",GetMotherCandidateMass());
1033 }
1034 fCurrentV0IndexNumber++;
1035 continue;
1036 }
1037 if(fDoCF){
1038 fCFManager->GetParticleContainer()->Fill(containerInput,kStepMinClsTPC); // for CF
1039 }
f14266e7 1040 Double_t negclsToF = 0.;
40051a3e 1041 if (!fUseCorrectedTPCClsInfo ){
1042 if(fCurrentNegativeESDTrack->GetTPCNclsF()!=0 ){
1043 negclsToF = (Double_t)fCurrentNegativeESDTrack->GetNcls(1)/(Double_t)fCurrentNegativeESDTrack->GetTPCNclsF();
1044 }
1045 }else{
1046 negclsToF = fCurrentNegativeESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
bd6d9fa3 1047 }
1048
f14266e7 1049 Double_t posclsToF = 0.;
40051a3e 1050 if (!fUseCorrectedTPCClsInfo ){
1051 if(fCurrentPositiveESDTrack->GetTPCNclsF()!=0 ){
1052 posclsToF = (Double_t)fCurrentPositiveESDTrack->GetNcls(1)/(Double_t)fCurrentPositiveESDTrack->GetTPCNclsF();
1053 }
1054 }else{
1055 posclsToF = fCurrentPositiveESDTrack->GetTPCClusterInfo(2,0,GetFirstTPCRow(GetXYRadius()));
bd6d9fa3 1056 }
1057
f14266e7 1058 if( negclsToF < fMinClsTPCToF || posclsToF < fMinClsTPCToF ){
bd6d9fa3 1059 if(fHistograms != NULL){
1060 fHistograms->FillHistogram("ESD_CutMinNClsTPCToF_InvMass",GetMotherCandidateMass());
1061 }
1062 fCurrentV0IndexNumber++;
1063 continue;
1064 }
1065
1066
9640a3d1 1067
a0b94e5c 1068
1069 if(fUseKFParticle){
48682642 1070
1071
1072 if( fCurrentNegativeKFParticle->GetPt()< fSinglePtCut || fCurrentPositiveKFParticle->GetPt()< fSinglePtCut){
1073 if(fHistograms != NULL){
1074 fHistograms->FillHistogram("ESD_CutSinglePt_InvMass",GetMotherCandidateMass());
1075 }
1076 fCurrentV0IndexNumber++;
1077 continue;
1078 }
1079 if(fDoCF){
1080 fCFManager->GetParticleContainer()->Fill(containerInput,kStepSinglePt); // for CF
1081 }
1082
1083
a0b94e5c 1084 if(fCurrentMotherKFCandidate->GetNDF()<=0){
1085 if(fHistograms != NULL){
1086 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
1087 }
1088 fCurrentV0IndexNumber++;
1089 continue;
1090 }
1e7846f4 1091 if(fDoCF){
1092 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
1093 }
a0b94e5c 1094
1095 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
1096 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
1097 if(fHistograms != NULL){
1098 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
1099 }
1100 fCurrentV0IndexNumber++;
1101 continue;
1102 }
1e7846f4 1103 if(fDoCF){
1104 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
1105 }
a0b94e5c 1106
10e3319b 1107
1e7846f4 1108 if(fDoCF){
1109 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
1110 }
a0b94e5c 1111
1112 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
1113 if(fHistograms != NULL){
1114 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
1115 }
1116 fCurrentV0IndexNumber++;
1117 continue;
1118 }
1e7846f4 1119 if(fDoCF){
1120 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
1121 }
a0b94e5c 1122
1123 }
1124 else if(fUseESDTrack){
1125 //TODO
1126 }
9640a3d1 1127
1128 if(fHistograms != NULL){
1129 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
1130 }
1131
5e55d806 1132 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
1133
2ea0dd4a 1134 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1135 fCurrentMotherKFCandidate->E()=fCurrentMotherKFCandidate->GetP();
1136 }
1137
1138 if(fDoMC&& fUseMCPSmearing>0){
1139 SmearKFParticle(fCurrentMotherKFCandidate);
1140
1141 }
1142
5e55d806 1143 new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate);
7f3c7cc6 1144 fV0Pindex.push_back(fCurrentV0->GetPindex());
1145 fV0Nindex.push_back(fCurrentV0->GetNindex());
5e55d806 1146
a0b94e5c 1147 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
1148
5ce758b0 1149 fNumberOfGoodV0s++;
1150
a0b94e5c 1151 fCurrentV0IndexNumber++;
1152
1153 break;
1154 }
1155 return iResult;
1156}
1157
1158Bool_t AliV0Reader::UpdateV0Information(){
1159 //see header file for documentation
1160
1161 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
1162
1163 Bool_t switchTracks = kFALSE;
1164
1165 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1166 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
ebcfaa7e 1167
1168 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
1169 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1170 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1171 switchTracks = kTRUE;
1172 }
a0b94e5c 1173
a0b94e5c 1174 if(fCurrentNegativeKFParticle != NULL){
1175 delete fCurrentNegativeKFParticle;
1176 }
1177 if(switchTracks == kFALSE){
1178 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
1179 }
1180 else{
1181 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
1182 }
1183
1184 if(fCurrentPositiveKFParticle != NULL){
1185 delete fCurrentPositiveKFParticle;
1186 }
1187 if(switchTracks == kFALSE){
1188 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
1189 }
1190 else{
1191 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
1192 }
1193
1194 if(fCurrentMotherKFCandidate != NULL){
1195 delete fCurrentMotherKFCandidate;
1196 }
5ce758b0 1197
1198 if(fUseConstructGamma==kTRUE){
1199 fCurrentMotherKFCandidate = new AliKFParticle;//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1200 fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1201 }else{
1202 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
1203 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1204 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
1205 }
a0b94e5c 1206 }
a0b94e5c 1207 if(fUseImprovedVertex == kTRUE){
1208 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
1209 primaryVertexImproved+=*fCurrentMotherKFCandidate;
1210 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
1211 }
1212
1213 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
ebcfaa7e 1214
a0b94e5c 1215 if(fNegativeTrackLorentzVector != NULL){
1216 delete fNegativeTrackLorentzVector;
1217 }
1218 if(fUseKFParticle){
1219 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
1220 }
c8164e83 1221 else { //if(fUseESDTrack){
a0b94e5c 1222 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
1223 }
1224
1225 if(fPositiveTrackLorentzVector != NULL){
1226 delete fPositiveTrackLorentzVector;
1227 }
1228 if(fUseKFParticle){
1229 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
1230 }
b460f542 1231 else { // if(fUseESDTrack){ fPositiveTrackLorentzVector must be reinitialized, so assuming use ESD if not kfparticle Svein.
a0b94e5c 1232 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
1233 }
1234
1235 if(fMotherCandidateLorentzVector != NULL){
1236 delete fMotherCandidateLorentzVector;
1237 }
239a56d1 1238
1239 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
a0b94e5c 1240
1241 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
1242 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
1243 }
1244
1245
1246 if(fDoMC == kTRUE){
1247 fMotherMCParticle= NULL;
1248 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
1249 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
1250 if(fPositiveMCParticle->GetMother(0)>-1){
1251 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
1252 }
1253 }
1254
a0b94e5c 1255
1256 // for CF
ebcfaa7e 1257// Double_t containerInput[3];
1258// if(fDoCF){
1259// containerInput[0] = GetMotherCandidatePt();
1260// containerInput[1] = GetMotherCandidateEta();
1261// containerInput[2] = GetMotherCandidateMass();
1e7846f4 1262
ebcfaa7e 1263// fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
1264// fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
1265// fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
1266// }
cb90a330 1267
1268
1269 if(fUseOwnXYZCalculation == kFALSE){
5ce758b0 1270 if(fUseConstructGamma == kFALSE){
1271 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
1272 }else{
1273 fCurrentXValue=GetMotherCandidateKFCombination()->GetX();
1274 fCurrentYValue=GetMotherCandidateKFCombination()->GetY();
1275 fCurrentZValue=GetMotherCandidateKFCombination()->GetZ();
1276 }
cb90a330 1277 }
1278 else{
1279 Double_t convpos[2];
1280 convpos[0]=0;
1281 convpos[1]=0;
9c1cb6f7 1282
cb90a330 1283 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
1284 fCurrentXValue = convpos[0];
1285 fCurrentYValue = convpos[1];
1286 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
1287 }
ebcfaa7e 1288 /*
51372c5d 1289 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
1290 iResult=kFALSE;
ebcfaa7e 1291 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
51372c5d 1292 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
1293 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1294 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1295 fUpdateV0AlreadyCalled = kTRUE;
1296 }
1297 }
1298
51372c5d 1299 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
1300 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
1301 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
1302 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
1303 iResult=kFALSE;
ebcfaa7e 1304 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
51372c5d 1305 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
1306 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1307 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1308 fUpdateV0AlreadyCalled = kTRUE;
1309 }
1310 }
1311
1312 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
1313 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
1314
1315 iResult=kFALSE;
ebcfaa7e 1316 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){
51372c5d 1317 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
1318 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1319 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1320 fUpdateV0AlreadyCalled = kTRUE;
1321 }
1322 }
1323
1324 if(fDodEdxSigmaCut == kTRUE){
cb90a330 1325
51372c5d 1326 if( fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1327 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
1328 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
1329 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
1330 iResult=kFALSE;
ebcfaa7e 1331 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
51372c5d 1332 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
1333 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1334 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1335 fUpdateV0AlreadyCalled = kTRUE;
1336 }
1337 }
1338 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
1339 if(fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1340 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1341 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1342 iResult=kFALSE;
ebcfaa7e 1343 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE){
51372c5d 1344 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1345 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1346 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1347 fUpdateV0AlreadyCalled = kTRUE;
1348 }
1349 }
1350 }
1351
1352 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
1353 if(fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
1354 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
1355 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
1356 iResult=kFALSE;
ebcfaa7e 1357 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE && doFillHistos == kTRUE ){
51372c5d 1358 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1359 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
1360 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
1361 fUpdateV0AlreadyCalled = kTRUE;
1362 }
1363 }
1364 }
1365 }
ebcfaa7e 1366 */
cb90a330 1367 fUpdateV0AlreadyCalled = kTRUE;
1368
a0b94e5c 1369 return iResult;
1370}
1371
1372
1373
1374Bool_t AliV0Reader::HasSameMCMother(){
1375 //see header file for documentation
1376
1377 Bool_t iResult = kFALSE;
1378 if(fDoMC == kTRUE){
1379 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
1380 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
1381 if(fMotherMCParticle){
1382 iResult = kTRUE;
1383 }
1384 }
1385 }
1386 return iResult;
1387}
1388
1389Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
1390 //see header file for documentation
1391
1392 Bool_t iResult=kFALSE;
1393
9c1cb6f7 1394 // Double_t *posProbArray = new Double_t[10];
1395 // Double_t *negProbArray = new Double_t[10];
1396 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1397
1398 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1399 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1400
1401 AliESDtrack* negTrack = GetNegativeESDTrack();
1402 AliESDtrack* posTrack = GetPositiveESDTrack();
1403 //fESDEvent->GetTrack(fCurrentV0->GetNindex());
1404 //fESDEvent->GetTrack(fCurrentV0->GetPindex());
1405 //-AM for switchtracks==true the above is a bug
1406
4a6157dc 1407 if(negProbArray && posProbArray){
239a56d1 1408
1409 negTrack->GetTPCpid(negProbArray);
1410 posTrack->GetTPCpid(posProbArray);
1411
1412 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
a0b94e5c 1413 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
1414 iResult=kTRUE;
1415 }
1416 }
1417 delete [] posProbArray;
1418 delete [] negProbArray;
1419 return iResult;
1420}
1421
1422void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
4a6157dc 1423 // see header file for documentation
1424
9c1cb6f7 1425 //Double_t *posProbArray = new Double_t[10];
1426 // Double_t *negProbArray = new Double_t[10];
1427 //-AM The TPCpid method expects an array of length kSPECIES that is 5 not 10
1428 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1429 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1430
1431// AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1432// AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1433 //-AM for switchtracks the above is a bug
1434 AliESDtrack* negTrack = GetNegativeESDTrack();
1435 AliESDtrack* posTrack = GetPositiveESDTrack();
1436
4a6157dc 1437 if(negProbArray && posProbArray){
239a56d1 1438 negTrack->GetTPCpid(negProbArray);
1439 posTrack->GetTPCpid(posProbArray);
1440
1441 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
a0b94e5c 1442 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
1443 posPIDProb = posProbArray[GetSpeciesIndex(1)];
1444 }
1445 delete [] posProbArray;
1446 delete [] negProbArray;
1447}
239a56d1 1448
9c1cb6f7 1449void AliV0Reader::GetPIDProbabilityMuonPion(Double_t &negPIDProb,Double_t & posPIDProb){
1450 // see header file for documentation
1451
1452
1453 Double_t *posProbArray = new Double_t[AliPID::kSPECIES];
1454 Double_t *negProbArray = new Double_t[AliPID::kSPECIES];
1455
1456 // AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
1457 // AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
1458 //-AM for switchtracks the above is a bug
1459
1460 AliESDtrack* negTrack = GetNegativeESDTrack();
1461 AliESDtrack* posTrack = GetPositiveESDTrack();
1462
9c1cb6f7 1463 if(negProbArray && posProbArray){
239a56d1 1464 negTrack->GetTPCpid(negProbArray);
1465 posTrack->GetTPCpid(posProbArray);
1466
1467 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
1468
9c1cb6f7 1469 negPIDProb = negProbArray[1]+negProbArray[2];
1470 posPIDProb = posProbArray[1]+posProbArray[2];
1471 }
1472 delete [] posProbArray;
1473 delete [] negProbArray;
1474}
a0b94e5c 1475
1476void AliV0Reader::UpdateEventByEventData(){
1477 //see header file for documentation
5e55d806 1478 if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
87f6de3e 1479 if(fCalculateBackground){
5ce758b0 1480 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1481 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1482 //filling z and multiplicity histograms
1483 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1484 fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
1485 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1486 }
1487 else{ // means we use #V0s for multiplicity
1488 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1489 //filling z and multiplicity histograms
1490 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
1491 fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s);
1492 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1493 }
87f6de3e 1494 }
a0b94e5c 1495 }
5e55d806 1496 fCurrentEventGoodV0s->Delete();
a0b94e5c 1497 fCurrentV0IndexNumber=0;
037dc2db 1498 fNumberOfESDTracks=0;
7f3c7cc6 1499
1500 fV0Pindex.clear();
1501 fV0Nindex.clear();
1502
1503
1504
26923b22 1505 // fBGEventHandler->PrintBGArray(); // for debugging
a0b94e5c 1506}
1507
1508
1509Double_t AliV0Reader::GetNegativeTrackPhi() const{
1510 //see header file for documentation
1511
1512 Double_t offset=0;
1513 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
1514 offset = -2*TMath::Pi();
1515 }
1516 return fNegativeTrackLorentzVector->Phi()+offset;
1517}
1518
1519Double_t AliV0Reader::GetPositiveTrackPhi() const{
1520 //see header file for documentation
1521
1522 Double_t offset=0;
1523 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
1524 offset = -2*TMath::Pi();
1525 }
1526 return fPositiveTrackLorentzVector->Phi()+offset;
1527}
1528
1529Double_t AliV0Reader::GetMotherCandidatePhi() const{
1530 //see header file for documentation
1531
1532 Double_t offset=0;
1533 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
1534 offset = -2*TMath::Pi();
1535 }
1536 return fMotherCandidateLorentzVector->Phi()+offset;
1537}
1538
1539
1540Double_t AliV0Reader::GetMotherCandidateRapidity() const{
1541 //see header file for documentation
1542
1543 Double_t rapidity=0;
1544 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
1545 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
1546 return rapidity;
1547
1548}
1549
1550
1551
1552
1553
1554Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
1555 //see header file for documentation
1556
1557 Int_t iResult = 10; // Unknown particle
1558
1559 if(chargeOfTrack==-1){ //negative track
1560 switch(abs(fNegativeTrackPID)){
1561 case 11: //electron
1562 iResult = 0;
1563 break;
1564 case 13: //muon
1565 iResult = 1;
1566 break;
1567 case 211: //pion
1568 iResult = 2;
1569 break;
1570 case 321: //kaon
1571 iResult = 3;
1572 break;
1573 case 2212: //proton
1574 iResult = 4;
1575 break;
1576 case 22: //photon
1577 iResult = 5;
1578 break;
1579 case 111: //pi0
1580 iResult = 6;
1581 break;
1582 case 2112: //neutron
1583 iResult = 7;
1584 break;
1585 case 311: //K0
1586 iResult = 8;
1587 break;
1588
1589 //Put in here for kSPECIES::kEleCon ????
1590 }
1591 }
1592 else if(chargeOfTrack==1){ //positive track
1593 switch(abs(fPositiveTrackPID)){
1594 case 11: //electron
1595 iResult = 0;
1596 break;
1597 case 13: //muon
1598 iResult = 1;
1599 break;
1600 case 211: //pion
1601 iResult = 2;
1602 break;
1603 case 321: //kaon
1604 iResult = 3;
1605 break;
1606 case 2212: //proton
1607 iResult = 4;
1608 break;
1609 case 22: //photon
1610 iResult = 5;
1611 break;
1612 case 111: //pi0
1613 iResult = 6;
1614 break;
1615 case 2112: //neutron
1616 iResult = 7;
1617 break;
1618 case 311: //K0
1619 iResult = 8;
1620 break;
1621
1622 //Put in here for kSPECIES::kEleCon ????
1623 }
1624 }
1625 else{
1626 //Wrong parameter.. Print warning
1627 }
1628 return iResult;
1629}
1630
4a6157dc 1631Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
a0b94e5c 1632 // see header file for documentation
1633
1634 Double_t pi = 3.14159265358979323846;
1635
1636 Double_t helix[6];
1637 track->GetHelixParameters(helix,b);
1638
1639 Double_t xpos = helix[5];
1640 Double_t ypos = helix[0];
1641 Double_t radius = TMath::Abs(1./helix[4]);
1642 Double_t phi = helix[2];
1643
1644 if(phi < 0){
1645 phi = phi + 2*pi;
1646 }
1647
1648 phi -= pi/2.;
1649 Double_t xpoint = radius * TMath::Cos(phi);
1650 Double_t ypoint = radius * TMath::Sin(phi);
1651
6272370b 1652 if(b<0){
1653 if(charge > 0){
1654 xpoint = - xpoint;
1655 ypoint = - ypoint;
1656 }
1657
1658 if(charge < 0){
1659 xpoint = xpoint;
1660 ypoint = ypoint;
1661 }
a0b94e5c 1662 }
6272370b 1663 if(b>0){
1664 if(charge > 0){
1665 xpoint = xpoint;
1666 ypoint = ypoint;
1667 }
a0b94e5c 1668
6272370b 1669 if(charge < 0){
1670 xpoint = - xpoint;
1671 ypoint = - ypoint;
1672 }
a0b94e5c 1673 }
1674 center[0] = xpos + xpoint;
1675 center[1] = ypos + ypoint;
1676
1677 return 1;
1678}
1679
4a6157dc 1680Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
a0b94e5c 1681 //see header file for documentation
1682
1683 Double_t helixcenterpos[2];
1684 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1685
1686 Double_t helixcenterneg[2];
1687 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1688
1689 Double_t poshelix[6];
1690 ptrack->GetHelixParameters(poshelix,b);
1691 Double_t posradius = TMath::Abs(1./poshelix[4]);
1692
1693 Double_t neghelix[6];
1694 ntrack->GetHelixParameters(neghelix,b);
1695 Double_t negradius = TMath::Abs(1./neghelix[4]);
1696
1697 Double_t xpos = helixcenterpos[0];
1698 Double_t ypos = helixcenterpos[1];
1699 Double_t xneg = helixcenterneg[0];
1700 Double_t yneg = helixcenterneg[1];
1701
1702 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
1703 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
1704
1705 return 1;
1706}
1707
1708
1709
4a6157dc 1710Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
a0b94e5c 1711 //see header file for documentation
1712
1713 Double_t helixpos[6];
1714 ptrack->GetHelixParameters(helixpos,b);
1715
1716 Double_t helixneg[6];
1717 ntrack->GetHelixParameters(helixneg,b);
1718
1719 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
1720 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
1721
1722 Double_t pi = 3.14159265358979323846;
1723
1724 Double_t convpos[2];
1725 GetConvPosXY(ptrack,ntrack,b,convpos);
1726
1727 Double_t convposx = convpos[0];
1728 Double_t convposy = convpos[1];
1729
1730 Double_t helixcenterpos[2];
1731 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1732
1733 Double_t helixcenterneg[2];
1734 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1735
1736 Double_t xpos = helixcenterpos[0];
1737 Double_t ypos = helixcenterpos[1];
1738 Double_t xneg = helixcenterneg[0];
1739 Double_t yneg = helixcenterneg[1];
1740
4a6157dc 1741 Double_t deltaXPos = convposx - xpos;
1742 Double_t deltaYPos = convposy - ypos;
a0b94e5c 1743
4a6157dc 1744 Double_t deltaXNeg = convposx - xneg;
1745 Double_t deltaYNeg = convposy - yneg;
a0b94e5c 1746
4a6157dc 1747 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
1748 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
a0b94e5c 1749
4a6157dc 1750 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
1751 TMath::Cos(alphaNeg);
1752 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
1753 TMath::Sin(alphaNeg);
a0b94e5c 1754
4a6157dc 1755 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
1756 TMath::Cos(alphaPos);
1757 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
1758 TMath::Sin(alphaPos);
a0b94e5c 1759
1760 Double_t x0neg = helixneg[5];
1761 Double_t y0neg = helixneg[0];
1762
1763 Double_t x0pos = helixpos[5];
1764 Double_t y0pos = helixpos[0];
1765
4a6157dc 1766 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
1767 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
a0b94e5c 1768
4a6157dc 1769 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
1770 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
a0b94e5c 1771
4a6157dc 1772 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
1773 dNeg*dNeg/4.);
a0b94e5c 1774
4a6157dc 1775 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
1776 dPos*dPos/4.);
a0b94e5c 1777
4a6157dc 1778 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
1779 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
a0b94e5c 1780
4a6157dc 1781 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
1782 Double_t deltaUPos = postrackradius*deltabetaPos;
a0b94e5c 1783
4a6157dc 1784 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
1785 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
a0b94e5c 1786
87f6de3e 1787 Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);
a0b94e5c 1788
1789 return convposz;
1790}
5e55d806 1791
f14266e7 1792AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/) const{
5ce758b0 1793 /*
1794 if(fUseChargedTrackMultiplicityForBG == kTRUE){
1795 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1796 }
1797 else{ // means we use #v0s as multiplicity
1798 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
1799 }
1800 */
1801 return NULL;
037dc2db 1802}
1803
1804Int_t AliV0Reader::CountESDTracks(){
1805 // see header file for documentation
1806 if(fNumberOfESDTracks == 0){ // count the good esd tracks
1807 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
1808 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
1809 if(!curTrack){
1810 continue;
1811 }
1812 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
1813 fNumberOfESDTracks++;
1814 }
1815 }
1816 }
1817
1818 return fNumberOfESDTracks;
1819}
1820
1821Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){
1822 // see headerfile for documentation
1823 Bool_t iResult=kFALSE;
1824 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
1825 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){
1826 iResult=kTRUE;
1827 }
1828 return iResult;
5e55d806 1829}
48682642 1830
10e3319b 1831Bool_t AliV0Reader::CheckIfEtaIsMother(Int_t label){
1832 // see headerfile for documentation
1833 Bool_t iResult=kFALSE;
1834 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
1835 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 221){
1836 iResult=kTRUE;
1837 }
1838 return iResult;
1839}
1840
48682642 1841
f14266e7 1842Bool_t AliV0Reader::GetArmenterosQtAlfa(const AliKFParticle* positiveKFParticle, const AliKFParticle * negativeKFParticle, const AliKFParticle * gammaKFCandidate, Double_t armenterosQtAlfa[2] ){
48682642 1843 //see header file for documentation
1844
1845 TVector3 momentumVectorPositiveKF(positiveKFParticle->GetPx(),positiveKFParticle->GetPy(),positiveKFParticle->GetPz());
1846 TVector3 momentumVectorNegativeKF(negativeKFParticle->GetPx(),negativeKFParticle->GetPy(),negativeKFParticle->GetPz());
1847 TVector3 vecV0(gammaKFCandidate->GetPx(),gammaKFCandidate->GetPy(),gammaKFCandidate->GetPz());
1848
1849 Float_t thetaV0pos=TMath::ACos(( momentumVectorPositiveKF* vecV0)/(momentumVectorPositiveKF.Mag() * vecV0.Mag()));
1850 Float_t thetaV0neg=TMath::ACos(( momentumVectorNegativeKF* vecV0)/(momentumVectorNegativeKF.Mag() * vecV0.Mag()));
1851
1852 Float_t alfa =((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)-(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg))/
1853 ((momentumVectorPositiveKF.Mag())*TMath::Cos(thetaV0pos)+(momentumVectorNegativeKF.Mag())*TMath::Cos(thetaV0neg)) ;
1854
1855
1856 Float_t qt = momentumVectorPositiveKF.Mag()*TMath::Sin(thetaV0pos);
1857
1858 armenterosQtAlfa[0]=qt;
1859 armenterosQtAlfa[1]=alfa;
1860
1861 return 1;
1862
1863}
1864
40051a3e 1865Int_t AliV0Reader::GetFirstTPCRow(Double_t radius){
1866
1867
1868 Int_t firstTPCRow=0;
1869 Double_t radiusI = 84.8;
1870 Double_t radiusO = 134.6;
1871 Double_t radiusOB = 198.;
1872 Double_t rSizeI = 0.75;
1873 Double_t rSizeO = 1.;
1874 Double_t rSizeOB = 1.5;
1875 Int_t nClsI=63;
1876 Int_t nClsIO=127;
1877
1878 if(radius <= radiusI){
1879 return firstTPCRow;
1880 }
1881 if(radius>radiusI && radius<=radiusO){
1882 firstTPCRow = (Int_t)((radius-radiusI)/rSizeI);
1883 }
1884 if(radius>radiusO && radius<=radiusOB){
1885 firstTPCRow = (Int_t)(nClsI+(radius-radiusO)/rSizeO);
1886 }
48682642 1887
40051a3e 1888 if(radius>radiusOB){
1889 firstTPCRow =(Int_t)(nClsIO+(radius-radiusOB)/rSizeOB);
1890 }
1891
1892
1893 return firstTPCRow;
1894}
2ea0dd4a 1895void AliV0Reader::SmearKFParticle(AliKFParticle * kfParticle)
1896{
1897 Double_t facPBrem = 1.;
1898 Double_t facPSig = 0.;
1899
1900 Double_t phi=0.;
1901 Double_t theta=0.;
1902 Double_t P=0.;
1903
1904 P=kfParticle->GetP();
1905 phi=kfParticle->GetPhi();
1906 if( kfParticle->GetP()!=0){
1907 theta=acos( kfParticle->Pz()/ kfParticle->GetP());
1908 }
1909
1910 if( fPSigSmearing != 0. || fPSigSmearingCte!=0. ){
1911 facPSig = TMath::Sqrt(fPSigSmearingCte*fPSigSmearingCte+fPSigSmearing*fPSigSmearing*P*P)*fRandom.Gaus(0.,1.);
1912 }
1913
1914 if( fPBremSmearing != 1.){
1915 if(fBrem!=NULL){
1916 facPBrem = fBrem->GetRandom();
1917 }
1918 }
1919
1920 kfParticle->Px() = facPBrem* (1+facPSig)* P*sin(theta)*cos(phi) ;
1921 kfParticle->Py() = facPBrem* (1+facPSig)* P*sin(theta)*sin(phi) ;
1922 kfParticle->Pz() = facPBrem* (1+facPSig)* P*cos(theta) ;
1923 kfParticle->E() = kfParticle->GetP();
1924}