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