]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/GammaConv/AliV0Reader.cxx
Bugfix: Cut histograms filled wrongly.
[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"
29#include "AliESDtrack.h"
30#include "AliMCEvent.h"
31#include "AliKFVertex.h"
32
33#include "AliStack.h"
34#include "AliMCEventHandler.h"
10d100d4 35#include "AliESDpid.h"
5e55d806 36#include "AliGammaConversionBGHandler.h"
037dc2db 37#include "AliESDtrackCuts.h"
38
a0b94e5c 39
40class iostream;
41class AliESDv0;
42class TFormula;
43
44using namespace std;
45
46ClassImp(AliV0Reader)
47
48
49
50AliV0Reader::AliV0Reader() :
51 TObject(),
52 fMCStack(NULL),
53 fMCTruth(NULL),
54 fMCEvent(NULL), // for CF
55 fChain(NULL),
56 fESDHandler(NULL),
57 fESDEvent(NULL),
4a6157dc 58 fCFManager(NULL),
10d100d4 59 fESDpid(NULL),
a0b94e5c 60 fHistograms(NULL),
61 fCurrentV0IndexNumber(0),
62 fCurrentV0(NULL),
63 fCurrentNegativeKFParticle(NULL),
64 fCurrentPositiveKFParticle(NULL),
65 fCurrentMotherKFCandidate(NULL),
66 fCurrentNegativeESDTrack(NULL),
67 fCurrentPositiveESDTrack(NULL),
68 fNegativeTrackLorentzVector(NULL),
69 fPositiveTrackLorentzVector(NULL),
70 fMotherCandidateLorentzVector(NULL),
71 fCurrentXValue(0),
72 fCurrentYValue(0),
73 fCurrentZValue(0),
74 fPositiveTrackPID(0),
75 fNegativeTrackPID(0),
76 fNegativeMCParticle(NULL),
77 fPositiveMCParticle(NULL),
78 fMotherMCParticle(NULL),
79 fMotherCandidateKFMass(0),
80 fMotherCandidateKFWidth(0),
81 fUseKFParticle(kTRUE),
82 fUseESDTrack(kFALSE),
83 fDoMC(kFALSE),
84 fMaxR(10000),// 100 meter(outside of ALICE)
85 fEtaCut(0.),
86 fPtCut(0.),
87 fMaxZ(0.),
88 fLineCutZRSlope(0.),
89 fLineCutZValue(0.),
90 fChi2CutConversion(0.),
91 fChi2CutMeson(0.),
92 fPIDProbabilityCutNegativeParticle(0),
93 fPIDProbabilityCutPositiveParticle(0),
9640a3d1 94 fDodEdxSigmaCut(kFALSE),
95 fPIDnSigmaAboveElectronLine(100),
96 fPIDnSigmaBelowElectronLine(-100),
97 fPIDnSigmaAbovePionLine(-100),
98 fPIDMinPnSigmaAbovePionLine(100),
a0b94e5c 99 fXVertexCut(0.),
100 fYVertexCut(0.),
101 fZVertexCut(0.),
102 fNSigmaMass(0.),
103 fUseImprovedVertex(kFALSE),
104 fUseOwnXYZCalculation(kFALSE),
1e7846f4 105 fDoCF(kFALSE),
77880bd8 106 fUseOnFlyV0Finder(kTRUE),
cb90a330 107 fUpdateV0AlreadyCalled(kFALSE),
5e55d806 108 fCurrentEventGoodV0s(NULL),
109// fPreviousEventGoodV0s(),
87f6de3e 110 fCalculateBackground(kFALSE),
5e55d806 111 fBGEventHandler(NULL),
037dc2db 112 fBGEventInitialized(kFALSE),
113 fEsdTrackCuts(NULL),
114 fNumberOfESDTracks(0)
a0b94e5c 115{
10d100d4 116 fESDpid = new AliESDpid;
a0b94e5c 117}
118
119
120AliV0Reader::AliV0Reader(const AliV0Reader & original) :
121 TObject(original),
122 fMCStack(original.fMCStack),
123 fMCTruth(original.fMCTruth),
124 fMCEvent(original.fMCEvent), // for CF
125 fChain(original.fChain),
126 fESDHandler(original.fESDHandler),
127 fESDEvent(original.fESDEvent),
4a6157dc 128 fCFManager(original.fCFManager),
10d100d4 129 fESDpid(original.fESDpid),
a0b94e5c 130 fHistograms(original.fHistograms),
131 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
132 fCurrentV0(original.fCurrentV0),
133 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
134 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
135 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
136 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
137 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
138 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
139 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
140 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
141 fCurrentXValue(original.fCurrentXValue),
142 fCurrentYValue(original.fCurrentYValue),
143 fCurrentZValue(original.fCurrentZValue),
144 fPositiveTrackPID(original.fPositiveTrackPID),
145 fNegativeTrackPID(original.fNegativeTrackPID),
146 fNegativeMCParticle(original.fNegativeMCParticle),
147 fPositiveMCParticle(original.fPositiveMCParticle),
148 fMotherMCParticle(original.fMotherMCParticle),
149 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
150 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
151 fUseKFParticle(kTRUE),
152 fUseESDTrack(kFALSE),
153 fDoMC(kFALSE),
154 fMaxR(original.fMaxR),
155 fEtaCut(original.fEtaCut),
156 fPtCut(original.fPtCut),
157 fMaxZ(original.fMaxZ),
158 fLineCutZRSlope(original.fLineCutZRSlope),
159 fLineCutZValue(original.fLineCutZValue),
160 fChi2CutConversion(original.fChi2CutConversion),
161 fChi2CutMeson(original.fChi2CutMeson),
162 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
163 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
9640a3d1 164 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
165 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
166 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
167 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
168 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
a0b94e5c 169 fXVertexCut(original.fXVertexCut),
170 fYVertexCut(original.fYVertexCut),
171 fZVertexCut(original.fZVertexCut),
172 fNSigmaMass(original.fNSigmaMass),
173 fUseImprovedVertex(original.fUseImprovedVertex),
174 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
1e7846f4 175 fDoCF(original.fDoCF),
77880bd8 176 fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
cb90a330 177 fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
a0b94e5c 178 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
5e55d806 179 // fPreviousEventGoodV0s(original.fPreviousEventGoodV0s),
87f6de3e 180 fCalculateBackground(original.fCalculateBackground),
5e55d806 181 fBGEventHandler(original.fBGEventHandler),
037dc2db 182 fBGEventInitialized(original.fBGEventInitialized),
183 fEsdTrackCuts(original.fEsdTrackCuts),
184 fNumberOfESDTracks(original.fNumberOfESDTracks)
a0b94e5c 185{
186
187}
188
189
190AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
191{
192 // assignment operator
193 return *this;
194}
9640a3d1 195AliV0Reader::~AliV0Reader()
196{
10d100d4 197 if(fESDpid){
198 delete fESDpid;
9640a3d1 199 }
200}
a0b94e5c 201
202void AliV0Reader::Initialize(){
203 //see header file for documentation
5e55d806 204
cb90a330 205 fUpdateV0AlreadyCalled = kFALSE;
a0b94e5c 206 // Get the input handler from the manager
207 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
208 if(fESDHandler == NULL){
209 //print warning here
210 }
211
212 // Get pointer to esd event from input handler
213 fESDEvent = fESDHandler->GetEvent();
214 if(fESDEvent == NULL){
215 //print warning here
216 }
217
218 //Get pointer to MCTruth
219 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
220 if(fMCTruth == NULL){
221 //print warning here
61374d97 222 fDoMC = kFALSE;
a0b94e5c 223 }
224
225 //Get pointer to the mc stack
61374d97 226 if(fMCTruth){
227 fMCStack = fMCTruth->MCEvent()->Stack();
228 if(fMCStack == NULL){
229 //print warning here
230 }
5e55d806 231 // Better parameters for MonteCarlo from A. Kalweit 2010/01/8
10d100d4 232 fESDpid->GetTPCResponse().SetBetheBlochParameters( 2.15898e+00/50.,
5e55d806 233 1.75295e+01,
234 3.40030e-09,
235 1.96178e+00,
236 3.91720e+00);
237 }
238 else{
239 // Better parameters for data from A. Kalweit 2010/01/8
10d100d4 240 fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
5e55d806 241 2.63394e+01,
242 5.04114e-11,
243 2.12543e+00,
244 4.88663e+00);
a0b94e5c 245 }
246
a0b94e5c 247 // for CF
248 //Get pointer to the mc event
b74269dc 249 if(fDoCF && fDoMC){
1e7846f4 250 fMCEvent = fMCTruth->MCEvent();
251 if(fMCEvent == NULL){
252 //print warning here
253 fDoCF = kFALSE;
254 }
255 }
a0b94e5c 256
257 AliKFParticle::SetField(fESDEvent->GetMagneticField());
5e55d806 258
259 // fCurrentEventGoodV0s = new TClonesArray("TClonesArray", 0);
260 fCurrentEventGoodV0s = new TClonesArray("AliKFParticle", 0);
261
87f6de3e 262 if(fCalculateBackground == kTRUE){
263 if(fBGEventInitialized == kFALSE){
037dc2db 264
87f6de3e 265
037dc2db 266 Double_t *zBinLimitsArray = new Double_t[8];
267 zBinLimitsArray[0] = -50.00;
268 zBinLimitsArray[1] = -4.07;
269 zBinLimitsArray[2] = -2.17;
270 zBinLimitsArray[3] = -0.69;
271 zBinLimitsArray[4] = 0.69;
272 zBinLimitsArray[5] = 2.17;
273 zBinLimitsArray[6] = 4.11;
274 zBinLimitsArray[7] = 50.00;
87f6de3e 275
037dc2db 276 Double_t *multiplicityBinLimitsArray= new Double_t[5];
277 multiplicityBinLimitsArray[0] = 0;
278 multiplicityBinLimitsArray[1] = 8.5;
279 multiplicityBinLimitsArray[2] = 16.5;
280 multiplicityBinLimitsArray[3] = 27.5;
281 multiplicityBinLimitsArray[4] = 41.5;
282
87f6de3e 283 fBGEventHandler = new AliGammaConversionBGHandler(8,4,10);
284
037dc2db 285 /*
286 // ---------------------------------
287 Double_t *zBinLimitsArray = new Double_t[1];
288 zBinLimitsArray[0] = 999999.00;
289
290 Double_t *multiplicityBinLimitsArray= new Double_t[1];
291 multiplicityBinLimitsArray[0] = 99999999.00;
292 fBGEventHandler = new AliGammaConversionBGHandler(1,1,10);
293 // ---------------------------------
294 */
87f6de3e 295 fBGEventHandler->Initialize(zBinLimitsArray, multiplicityBinLimitsArray);
296 fBGEventInitialized = kTRUE;
297 }
5e55d806 298 }
a0b94e5c 299}
300
301AliESDv0* AliV0Reader::GetV0(Int_t index){
302 //see header file for documentation
303 fCurrentV0 = fESDEvent->GetV0(index);
304 UpdateV0Information();
305 return fCurrentV0;
306}
307
308Bool_t AliV0Reader::CheckForPrimaryVertex(){
037dc2db 309 //see headerfile for documentation
a0b94e5c 310 return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
311}
312
77880bd8 313
314Bool_t AliV0Reader::CheckV0FinderStatus(Int_t index){
037dc2db 315 // see headerfile for documentation
77880bd8 316 if(fUseOnFlyV0Finder){
77880bd8 317 if(!GetV0(index)->GetOnFlyStatus()){
318 return kFALSE;
319 }
320 }
321 if(!fUseOnFlyV0Finder){
51b95cb0 322 if(GetV0(index)->GetOnFlyStatus()){
77880bd8 323 return kFALSE;
324 }
325 }
77880bd8 326 return kTRUE;
327}
328
329
330
a0b94e5c 331Bool_t AliV0Reader::NextV0(){
332 //see header file for documentation
037dc2db 333
a0b94e5c 334 Bool_t iResult=kFALSE;
335 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
336 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
037dc2db 337
1b832bb9 338 fUpdateV0AlreadyCalled=kFALSE;
339
037dc2db 340 if(fHistograms != NULL){
341 fHistograms->FillHistogram("ESD_AllV0s_InvMass",GetMotherCandidateMass());
342 }
a0b94e5c 343
344 // moved it up here so that the correction framework can access pt and eta information
345 if(UpdateV0Information() == kFALSE){
346 fCurrentV0IndexNumber++;
347 continue;
348 }
cb90a330 349
a0b94e5c 350 Double_t containerInput[3];
1e7846f4 351 if(fDoCF){
352 containerInput[0] = GetMotherCandidatePt();
353 containerInput[1] = GetMotherCandidateEta();
354 containerInput[2] = GetMotherCandidateMass();
355 }
cb90a330 356
357
a0b94e5c 358 //checks if on the fly mode is set
48e7eac2 359 if ( !CheckV0FinderStatus(fCurrentV0IndexNumber) ){
a0b94e5c 360 if(fHistograms != NULL){
361 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
362 }
363 fCurrentV0IndexNumber++;
364 continue;
365 }
1e7846f4 366 if(fDoCF){
367 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
368 }
cb90a330 369
a0b94e5c 370 //checks if we have a prim vertex
371 if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
372 if(fHistograms != NULL){
373 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
374 }
375 fCurrentV0IndexNumber++;
376 continue;
377 }
1e7846f4 378 if(fDoCF){
379 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
380 }
a0b94e5c 381
382 //Check the pid probability
383 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
384 if(fHistograms != NULL){
385 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
386 }
387 fCurrentV0IndexNumber++;
388 continue;
389 }
1e7846f4 390 if(fDoCF){
391 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
392 }
a0b94e5c 393
a0b94e5c 394 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
395 if(fHistograms != NULL){
396 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
397 }
398 fCurrentV0IndexNumber++;
399 continue;
1e7846f4 400 }
401 if(fDoCF){
402 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
403 }
a0b94e5c 404
405
406 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct
407 if(fHistograms != NULL){
408 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
409 }
410 fCurrentV0IndexNumber++;
411 continue;
1e7846f4 412 }
413 if(fDoCF){
414 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
415 }
a0b94e5c 416
417 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
418 if(fHistograms != NULL){
419 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
420 }
421 fCurrentV0IndexNumber++;
422 continue;
1e7846f4 423 }
424 if(fDoCF){
425 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
426 }
a0b94e5c 427
428 /* Moved further up so corr framework can work
429 if(UpdateV0Information() == kFALSE){
430 fCurrentV0IndexNumber++;
431 continue;
432 }
433 */
9640a3d1 434
a0b94e5c 435
436 if(fUseKFParticle){
437 if(fCurrentMotherKFCandidate->GetNDF()<=0){
438 if(fHistograms != NULL){
439 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
440 }
441 fCurrentV0IndexNumber++;
442 continue;
443 }
1e7846f4 444 if(fDoCF){
445 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
446 }
a0b94e5c 447
448 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
449 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
450 if(fHistograms != NULL){
451 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
452 }
453 fCurrentV0IndexNumber++;
454 continue;
455 }
1e7846f4 456 if(fDoCF){
457 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
458 }
a0b94e5c 459
460 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){
461 if(fHistograms != NULL){
462 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
463 }
464 fCurrentV0IndexNumber++;
465 continue;
466 }
1e7846f4 467 if(fDoCF){
468 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
469 }
a0b94e5c 470
471 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
472 if(fHistograms != NULL){
473 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
474 }
475 fCurrentV0IndexNumber++;
476 continue;
477 }
1e7846f4 478 if(fDoCF){
479 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
480 }
a0b94e5c 481
482 }
483 else if(fUseESDTrack){
484 //TODO
485 }
9640a3d1 486
487 if(fHistograms != NULL){
488 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
489 }
490
5e55d806 491 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
492
493 new((*fCurrentEventGoodV0s)[fCurrentEventGoodV0s->GetEntriesFast()]) AliKFParticle(*fCurrentMotherKFCandidate);
494
a0b94e5c 495 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
496
497 fCurrentV0IndexNumber++;
498
499 break;
500 }
501 return iResult;
502}
503
504Bool_t AliV0Reader::UpdateV0Information(){
505 //see header file for documentation
506
507 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
508
509 Bool_t switchTracks = kFALSE;
510
511 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
512 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
513
514 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
515 iResult=kFALSE;
cb90a330 516 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
a0b94e5c 517 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
1b832bb9 518 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
519 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
520 fUpdateV0AlreadyCalled == kTRUE;
a0b94e5c 521 }
522 }
523
524 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
525 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
526 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
527 switchTracks = kTRUE;
528 }
529
530 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
531 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
532 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
533 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
a0b94e5c 534 iResult=kFALSE;
cb90a330 535 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
a0b94e5c 536 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
1b832bb9 537 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
538 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
539 fUpdateV0AlreadyCalled == kTRUE;
a0b94e5c 540 }
541 }
542
543 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
544 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
545
546 iResult=kFALSE;
cb90a330 547 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
a0b94e5c 548 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
1b832bb9 549 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
550 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
551 fUpdateV0AlreadyCalled == kTRUE;
a0b94e5c 552 }
553 }
9640a3d1 554
555 if(fDodEdxSigmaCut == kTRUE){
556
10d100d4 557 if( fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
558 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
559 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
560 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
9640a3d1 561 iResult=kFALSE;
cb90a330 562 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
9640a3d1 563 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
1b832bb9 564 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
565 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
566 fUpdateV0AlreadyCalled == kTRUE;
9640a3d1 567 }
568 }
569 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
10d100d4 570 if(fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
571 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
572 fESDpid->NumberOfSigmasTPC(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
9640a3d1 573 iResult=kFALSE;
cb90a330 574 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
9640a3d1 575 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1b832bb9 576 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
577 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
578 fUpdateV0AlreadyCalled == kTRUE;
9640a3d1 579 }
580 }
581 }
582
583 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
10d100d4 584 if(fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
585 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
586 fESDpid->NumberOfSigmasTPC(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
9640a3d1 587 iResult=kFALSE;
cb90a330 588 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
9640a3d1 589 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
1b832bb9 590 // to avoid filling the other cut histograms. So in this case fUpdateV0AlreadyCalled also serves as a flag for the histogram filling
591 // it will anyway be set to true at the end of the UpdateV0Information function, and there are no return until the end
592 fUpdateV0AlreadyCalled == kTRUE;
9640a3d1 593 }
594 }
595 }
596 }
a0b94e5c 597
598 if(fCurrentNegativeKFParticle != NULL){
599 delete fCurrentNegativeKFParticle;
600 }
601 if(switchTracks == kFALSE){
602 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
603 }
604 else{
605 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
606 }
607
608 if(fCurrentPositiveKFParticle != NULL){
609 delete fCurrentPositiveKFParticle;
610 }
611 if(switchTracks == kFALSE){
612 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
613 }
614 else{
615 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
616 }
617
618 if(fCurrentMotherKFCandidate != NULL){
619 delete fCurrentMotherKFCandidate;
620 }
621 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
622
623
624 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
625 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
626 }
627
628 if(fUseImprovedVertex == kTRUE){
629 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
630 primaryVertexImproved+=*fCurrentMotherKFCandidate;
631 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
632 }
633
634 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
635
636
637 if(fNegativeTrackLorentzVector != NULL){
638 delete fNegativeTrackLorentzVector;
639 }
640 if(fUseKFParticle){
641 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
642 }
643 else if(fUseESDTrack){
644 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
645 }
646
647 if(fPositiveTrackLorentzVector != NULL){
648 delete fPositiveTrackLorentzVector;
649 }
650 if(fUseKFParticle){
651 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
652 }
653 else if(fUseESDTrack){
654 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
655 }
656
657 if(fMotherCandidateLorentzVector != NULL){
658 delete fMotherCandidateLorentzVector;
659 }
660 if(fUseKFParticle){
661 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
662 }
663 else if(fUseESDTrack){
664 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
665 }
666
667 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
668 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
669 }
670
671
672 if(fDoMC == kTRUE){
673 fMotherMCParticle= NULL;
674 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
675 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
676 if(fPositiveMCParticle->GetMother(0)>-1){
677 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
678 }
679 }
680
a0b94e5c 681
682 // for CF
683 Double_t containerInput[3];
1e7846f4 684 if(fDoCF){
685 containerInput[0] = GetMotherCandidatePt();
686 containerInput[1] = GetMotherCandidateEta();
687 containerInput[2] = GetMotherCandidateMass();
688
689 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
690 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
691 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
692 }
cb90a330 693
694
695 if(fUseOwnXYZCalculation == kFALSE){
696 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
697 }
698 else{
699 Double_t convpos[2];
700 convpos[0]=0;
701 convpos[1]=0;
702 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
703 fCurrentXValue = convpos[0];
704 fCurrentYValue = convpos[1];
705 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
706 }
707
708
709 fUpdateV0AlreadyCalled = kTRUE;
710
a0b94e5c 711 return iResult;
712}
713
714
715
716Bool_t AliV0Reader::HasSameMCMother(){
717 //see header file for documentation
718
719 Bool_t iResult = kFALSE;
720 if(fDoMC == kTRUE){
721 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
722 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
723 if(fMotherMCParticle){
724 iResult = kTRUE;
725 }
726 }
727 }
728 return iResult;
729}
730
731Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
732 //see header file for documentation
733
734 Bool_t iResult=kFALSE;
735
736 Double_t *posProbArray = new Double_t[10];
737 Double_t *negProbArray = new Double_t[10];
738 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
739 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
740
741 negTrack->GetTPCpid(negProbArray);
742 posTrack->GetTPCpid(posProbArray);
743
4a6157dc 744 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
745 if(negProbArray && posProbArray){
a0b94e5c 746 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
747 iResult=kTRUE;
748 }
749 }
750 delete [] posProbArray;
751 delete [] negProbArray;
752 return iResult;
753}
754
755void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
4a6157dc 756 // see header file for documentation
757
a0b94e5c 758 Double_t *posProbArray = new Double_t[10];
759 Double_t *negProbArray = new Double_t[10];
760 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
761 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
762
763 negTrack->GetTPCpid(negProbArray);
764 posTrack->GetTPCpid(posProbArray);
765
4a6157dc 766 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
767 if(negProbArray && posProbArray){
a0b94e5c 768 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
769 posPIDProb = posProbArray[GetSpeciesIndex(1)];
770 }
771 delete [] posProbArray;
772 delete [] negProbArray;
773}
774
775void AliV0Reader::UpdateEventByEventData(){
776 //see header file for documentation
5e55d806 777 if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
87f6de3e 778 if(fCalculateBackground){
037dc2db 779 fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
780 //filling z and multiplicity histograms
781 fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
782 fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
783 fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
87f6de3e 784 }
a0b94e5c 785 }
5e55d806 786 fCurrentEventGoodV0s->Delete();
a0b94e5c 787 fCurrentV0IndexNumber=0;
037dc2db 788 fNumberOfESDTracks=0;
26923b22 789 // fBGEventHandler->PrintBGArray(); // for debugging
a0b94e5c 790}
791
792
793Double_t AliV0Reader::GetNegativeTrackPhi() const{
794 //see header file for documentation
795
796 Double_t offset=0;
797 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
798 offset = -2*TMath::Pi();
799 }
800 return fNegativeTrackLorentzVector->Phi()+offset;
801}
802
803Double_t AliV0Reader::GetPositiveTrackPhi() const{
804 //see header file for documentation
805
806 Double_t offset=0;
807 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
808 offset = -2*TMath::Pi();
809 }
810 return fPositiveTrackLorentzVector->Phi()+offset;
811}
812
813Double_t AliV0Reader::GetMotherCandidatePhi() const{
814 //see header file for documentation
815
816 Double_t offset=0;
817 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
818 offset = -2*TMath::Pi();
819 }
820 return fMotherCandidateLorentzVector->Phi()+offset;
821}
822
823
824Double_t AliV0Reader::GetMotherCandidateRapidity() const{
825 //see header file for documentation
826
827 Double_t rapidity=0;
828 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
829 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
830 return rapidity;
831
832}
833
834
835
836
837
838Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
839 //see header file for documentation
840
841 Int_t iResult = 10; // Unknown particle
842
843 if(chargeOfTrack==-1){ //negative track
844 switch(abs(fNegativeTrackPID)){
845 case 11: //electron
846 iResult = 0;
847 break;
848 case 13: //muon
849 iResult = 1;
850 break;
851 case 211: //pion
852 iResult = 2;
853 break;
854 case 321: //kaon
855 iResult = 3;
856 break;
857 case 2212: //proton
858 iResult = 4;
859 break;
860 case 22: //photon
861 iResult = 5;
862 break;
863 case 111: //pi0
864 iResult = 6;
865 break;
866 case 2112: //neutron
867 iResult = 7;
868 break;
869 case 311: //K0
870 iResult = 8;
871 break;
872
873 //Put in here for kSPECIES::kEleCon ????
874 }
875 }
876 else if(chargeOfTrack==1){ //positive track
877 switch(abs(fPositiveTrackPID)){
878 case 11: //electron
879 iResult = 0;
880 break;
881 case 13: //muon
882 iResult = 1;
883 break;
884 case 211: //pion
885 iResult = 2;
886 break;
887 case 321: //kaon
888 iResult = 3;
889 break;
890 case 2212: //proton
891 iResult = 4;
892 break;
893 case 22: //photon
894 iResult = 5;
895 break;
896 case 111: //pi0
897 iResult = 6;
898 break;
899 case 2112: //neutron
900 iResult = 7;
901 break;
902 case 311: //K0
903 iResult = 8;
904 break;
905
906 //Put in here for kSPECIES::kEleCon ????
907 }
908 }
909 else{
910 //Wrong parameter.. Print warning
911 }
912 return iResult;
913}
914
4a6157dc 915Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
a0b94e5c 916 // see header file for documentation
917
918 Double_t pi = 3.14159265358979323846;
919
920 Double_t helix[6];
921 track->GetHelixParameters(helix,b);
922
923 Double_t xpos = helix[5];
924 Double_t ypos = helix[0];
925 Double_t radius = TMath::Abs(1./helix[4]);
926 Double_t phi = helix[2];
927
928 if(phi < 0){
929 phi = phi + 2*pi;
930 }
931
932 phi -= pi/2.;
933 Double_t xpoint = radius * TMath::Cos(phi);
934 Double_t ypoint = radius * TMath::Sin(phi);
935
936 if(charge > 0){
937 xpoint = - xpoint;
938 ypoint = - ypoint;
939 }
940
941 if(charge < 0){
942 xpoint = xpoint;
943 ypoint = ypoint;
944 }
945 center[0] = xpos + xpoint;
946 center[1] = ypos + ypoint;
947
948 return 1;
949}
950
4a6157dc 951Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
a0b94e5c 952 //see header file for documentation
953
954 Double_t helixcenterpos[2];
955 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
956
957 Double_t helixcenterneg[2];
958 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
959
960 Double_t poshelix[6];
961 ptrack->GetHelixParameters(poshelix,b);
962 Double_t posradius = TMath::Abs(1./poshelix[4]);
963
964 Double_t neghelix[6];
965 ntrack->GetHelixParameters(neghelix,b);
966 Double_t negradius = TMath::Abs(1./neghelix[4]);
967
968 Double_t xpos = helixcenterpos[0];
969 Double_t ypos = helixcenterpos[1];
970 Double_t xneg = helixcenterneg[0];
971 Double_t yneg = helixcenterneg[1];
972
973 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
974 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
975
976 return 1;
977}
978
979
980
4a6157dc 981Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
a0b94e5c 982 //see header file for documentation
983
984 Double_t helixpos[6];
985 ptrack->GetHelixParameters(helixpos,b);
986
987 Double_t helixneg[6];
988 ntrack->GetHelixParameters(helixneg,b);
989
990 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
991 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
992
993 Double_t pi = 3.14159265358979323846;
994
995 Double_t convpos[2];
996 GetConvPosXY(ptrack,ntrack,b,convpos);
997
998 Double_t convposx = convpos[0];
999 Double_t convposy = convpos[1];
1000
1001 Double_t helixcenterpos[2];
1002 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
1003
1004 Double_t helixcenterneg[2];
1005 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
1006
1007 Double_t xpos = helixcenterpos[0];
1008 Double_t ypos = helixcenterpos[1];
1009 Double_t xneg = helixcenterneg[0];
1010 Double_t yneg = helixcenterneg[1];
1011
4a6157dc 1012 Double_t deltaXPos = convposx - xpos;
1013 Double_t deltaYPos = convposy - ypos;
a0b94e5c 1014
4a6157dc 1015 Double_t deltaXNeg = convposx - xneg;
1016 Double_t deltaYNeg = convposy - yneg;
a0b94e5c 1017
4a6157dc 1018 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
1019 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
a0b94e5c 1020
4a6157dc 1021 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
1022 TMath::Cos(alphaNeg);
1023 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
1024 TMath::Sin(alphaNeg);
a0b94e5c 1025
4a6157dc 1026 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
1027 TMath::Cos(alphaPos);
1028 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
1029 TMath::Sin(alphaPos);
a0b94e5c 1030
1031 Double_t x0neg = helixneg[5];
1032 Double_t y0neg = helixneg[0];
1033
1034 Double_t x0pos = helixpos[5];
1035 Double_t y0pos = helixpos[0];
1036
4a6157dc 1037 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
1038 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
a0b94e5c 1039
4a6157dc 1040 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
1041 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
a0b94e5c 1042
4a6157dc 1043 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
1044 dNeg*dNeg/4.);
a0b94e5c 1045
4a6157dc 1046 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
1047 dPos*dPos/4.);
a0b94e5c 1048
4a6157dc 1049 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
1050 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
a0b94e5c 1051
4a6157dc 1052 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
1053 Double_t deltaUPos = postrackradius*deltabetaPos;
a0b94e5c 1054
4a6157dc 1055 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
1056 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
a0b94e5c 1057
87f6de3e 1058 Double_t convposz = (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);
a0b94e5c 1059
1060 return convposz;
1061}
5e55d806 1062
1063AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t event){
1064
037dc2db 1065 return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
1066}
1067
1068Int_t AliV0Reader::CountESDTracks(){
1069 // see header file for documentation
1070 if(fNumberOfESDTracks == 0){ // count the good esd tracks
1071 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
1072 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
1073 if(!curTrack){
1074 continue;
1075 }
1076 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
1077 fNumberOfESDTracks++;
1078 }
1079 }
1080 }
1081
1082 return fNumberOfESDTracks;
1083}
1084
1085Bool_t AliV0Reader::CheckIfPi0IsMother(Int_t label){
1086 // see headerfile for documentation
1087 Bool_t iResult=kFALSE;
1088 // cout<<"Checking particle label, particle is: "<<fMCStack->Particle(TMath::Abs(label))->GetName()<<endl;
1089 if(fMCStack->Particle(TMath::Abs(label))->GetPdgCode() == 111){
1090 iResult=kTRUE;
1091 }
1092 return iResult;
5e55d806 1093}