]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/GammaConv/AliV0Reader.cxx
Fix coding convention violations.
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliV0Reader.cxx
CommitLineData
3c538586 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *\r
5 * Version 1.0 *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16////////////////////////////////////////////////\r
17//--------------------------------------------- \r
18// Class used to do analysis on conversion pairs\r
19//---------------------------------------------\r
20////////////////////////////////////////////////\r
21\r
22// --- ROOT system ---\r
23#include <TMath.h>\r
24\r
25//---- ANALYSIS system ----\r
26#include "AliV0Reader.h"\r
27#include "AliAnalysisManager.h"\r
28#include "AliESDInputHandler.h"\r
32a6d407 29#include "AliESDtrack.h"\r
3c538586 30#include "AliMCEvent.h"\r
31#include "AliKFVertex.h"\r
32\r
33#include "AliStack.h"\r
34#include "AliMCEventHandler.h"\r
35\r
36\r
37class iostream;\r
38class AliESDv0;\r
39class TFormula;\r
40\r
41using namespace std;\r
42\r
43ClassImp(AliV0Reader)\r
44\r
45\r
46\r
32a6d407 47AliV0Reader::AliV0Reader() :\r
48TObject(),\r
49 fMCStack(NULL),\r
50 fMCTruth(NULL),\r
51 fChain(NULL),\r
52 fESDHandler(NULL),\r
53 fESDEvent(NULL),\r
54 fHistograms(NULL),\r
55 fCurrentV0IndexNumber(0),\r
56 fCurrentV0(NULL),\r
57 fCurrentNegativeKFParticle(NULL),\r
58 fCurrentPositiveKFParticle(NULL),\r
59 fCurrentMotherKFCandidate(NULL),\r
60 fCurrentNegativeESDTrack(NULL),\r
61 fCurrentPositiveESDTrack(NULL),\r
62 fNegativeTrackLorentzVector(NULL),\r
63 fPositiveTrackLorentzVector(NULL),\r
64 fMotherCandidateLorentzVector(NULL),\r
65 fCurrentXValue(0),\r
66 fCurrentYValue(0),\r
67 fCurrentZValue(0),\r
68 fPositiveTrackPID(0),\r
69 fNegativeTrackPID(0),\r
70 fNegativeMCParticle(NULL),\r
71 fPositiveMCParticle(NULL),\r
72 fMotherMCParticle(NULL),\r
73 fMotherCandidateKFMass(0),\r
74 fMotherCandidateKFWidth(0),\r
75 fUseKFParticle(kTRUE),\r
76 fUseESDTrack(kFALSE),\r
77 fDoMC(kFALSE),\r
78 fMaxR(10000),// 100 meter(outside of ALICE)\r
79 fEtaCut(0.),\r
80 fPtCut(0.),\r
81 fLineCutZRSlope(0.),\r
82 fLineCutZValue(0.),\r
83 fChi2CutConversion(0.),\r
84 fChi2CutMeson(0.),\r
85 fPIDProbabilityCutNegativeParticle(0),\r
86 fPIDProbabilityCutPositiveParticle(0),\r
87 fXVertexCut(0.),\r
88 fYVertexCut(0.),\r
89 fZVertexCut(0.),\r
90 fNSigmaMass(0.),\r
91 fUseImprovedVertex(kFALSE),\r
92 fCurrentEventGoodV0s(),\r
93 fPreviousEventGoodV0s()\r
3c538586 94{\r
32a6d407 95 \r
3c538586 96}\r
97\r
98\r
99AliV0Reader::AliV0Reader(const AliV0Reader & original) :\r
100 TObject(original),\r
101 fMCStack(original.fMCStack),\r
102 fMCTruth(original.fMCTruth),\r
103 fChain(original.fChain),\r
104 fESDHandler(original.fESDHandler),\r
105 fESDEvent(original.fESDEvent),\r
106 fHistograms(original.fHistograms),\r
107 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),\r
108 fCurrentV0(original.fCurrentV0),\r
109 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),\r
110 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),\r
111 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),\r
112 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),\r
113 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),\r
114 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),\r
115 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),\r
116 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),\r
117 fCurrentXValue(original.fCurrentXValue),\r
118 fCurrentYValue(original.fCurrentYValue),\r
119 fCurrentZValue(original.fCurrentZValue),\r
120 fPositiveTrackPID(original.fPositiveTrackPID),\r
121 fNegativeTrackPID(original.fNegativeTrackPID),\r
122 fNegativeMCParticle(original.fNegativeMCParticle),\r
123 fPositiveMCParticle(original.fPositiveMCParticle),\r
124 fMotherMCParticle(original.fMotherMCParticle),\r
125 fMotherCandidateKFMass(original.fMotherCandidateKFMass),\r
126 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),\r
127 fUseKFParticle(kTRUE),\r
128 fUseESDTrack(kFALSE),\r
129 fDoMC(kFALSE),\r
130 fMaxR(original.fMaxR),\r
131 fEtaCut(original.fEtaCut),\r
132 fPtCut(original.fPtCut),\r
32a6d407 133 fLineCutZRSlope(original.fLineCutZRSlope),\r
134 fLineCutZValue(original.fLineCutZValue),\r
3c538586 135 fChi2CutConversion(original.fChi2CutConversion),\r
136 fChi2CutMeson(original.fChi2CutMeson),\r
137 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),\r
138 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),\r
139 fXVertexCut(original.fXVertexCut),\r
140 fYVertexCut(original.fYVertexCut),\r
141 fZVertexCut(original.fZVertexCut),\r
142 fNSigmaMass(original.fNSigmaMass),\r
143 fUseImprovedVertex(original.fUseImprovedVertex),\r
144 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),\r
145 fPreviousEventGoodV0s(original.fPreviousEventGoodV0s)\r
146{\r
32a6d407 147 \r
3c538586 148}\r
149\r
150\r
151AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)\r
152{\r
153 // assignment operator\r
154 return *this;\r
155}\r
156\r
157void AliV0Reader::Initialize(){\r
158 //see header file for documentation\r
32a6d407 159 \r
3c538586 160 // Get the input handler from the manager\r
161 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());\r
162 if(fESDHandler == NULL){\r
163 //print warning here\r
164 }\r
32a6d407 165 \r
3c538586 166 // Get pointer to esd event from input handler\r
167 fESDEvent = fESDHandler->GetEvent();\r
168 if(fESDEvent == NULL){\r
169 //print warning here\r
170 }\r
32a6d407 171 \r
3c538586 172 //Get pointer to MCTruth\r
173 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());\r
174 if(fMCTruth == NULL){\r
175 //print warning here\r
176 }\r
32a6d407 177 \r
3c538586 178 //Get pointer to the mc stack\r
179 fMCStack = fMCTruth->MCEvent()->Stack();\r
180 if(fMCStack == NULL){\r
181 //print warning here\r
182 }\r
32a6d407 183 \r
3c538586 184 AliKFParticle::SetField(fESDEvent->GetMagneticField());\r
32a6d407 185 \r
3c538586 186}\r
187\r
188AliESDv0* AliV0Reader::GetV0(Int_t index){\r
189 //see header file for documentation\r
32a6d407 190 \r
3c538586 191 fCurrentV0 = fESDEvent->GetV0(index);\r
192 UpdateV0Information();\r
193 return fCurrentV0;\r
194}\r
32a6d407 195\r
a19c3402 196Bool_t AliV0Reader::CheckForPrimaryVertex(){\r
197 return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;\r
198}\r
3c538586 199\r
32a6d407 200\r
201\r
3c538586 202Bool_t AliV0Reader::NextV0(){\r
203 //see header file for documentation\r
32a6d407 204 \r
3c538586 205 Bool_t iResult=kFALSE;\r
206 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){\r
207 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);\r
32a6d407 208 \r
3c538586 209 //checks if on the fly mode is set\r
210 if ( !fCurrentV0->GetOnFlyStatus() ){\r
a19c3402 211 if(fHistograms != NULL){\r
32a6d407 212 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());\r
a19c3402 213 }\r
32a6d407 214 fCurrentV0IndexNumber++;\r
3c538586 215 continue;\r
216 }\r
32a6d407 217 \r
218 //checks if we have a prim vertex\r
219 if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) { \r
a19c3402 220 if(fHistograms != NULL){\r
32a6d407 221 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());\r
a19c3402 222 }\r
32a6d407 223 fCurrentV0IndexNumber++;\r
3c538586 224 continue;\r
225 }\r
32a6d407 226 \r
227 //Check the pid probability\r
3c538586 228 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){\r
a19c3402 229 if(fHistograms != NULL){\r
32a6d407 230 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());\r
a19c3402 231 }\r
32a6d407 232 fCurrentV0IndexNumber++;\r
3c538586 233 continue;\r
234 }\r
32a6d407 235 \r
236 \r
3c538586 237 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);\r
32a6d407 238 \r
239 \r
3c538586 240 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point\r
32a6d407 241 if(fHistograms != NULL){\r
242 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());\r
243 }\r
3c538586 244 fCurrentV0IndexNumber++;\r
32a6d407 245 continue;\r
246 } \r
247 \r
248 \r
249 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct\r
a19c3402 250 if(fHistograms != NULL){\r
32a6d407 251 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());\r
a19c3402 252 }\r
32a6d407 253 fCurrentV0IndexNumber++;\r
254 continue;\r
255 } \r
256 \r
257 \r
258 if(UpdateV0Information() == kFALSE){\r
259 fCurrentV0IndexNumber++;\r
3c538586 260 continue;\r
261 }\r
32a6d407 262 \r
3c538586 263 if(fUseKFParticle){\r
264 if(fCurrentMotherKFCandidate->GetNDF()<=0){\r
a19c3402 265 if(fHistograms != NULL){\r
32a6d407 266 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());\r
a19c3402 267 }\r
32a6d407 268 fCurrentV0IndexNumber++;\r
3c538586 269 continue;\r
270 }\r
32a6d407 271 \r
272 \r
3c538586 273 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();\r
274 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){\r
a19c3402 275 if(fHistograms != NULL){\r
32a6d407 276 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());\r
a19c3402 277 }\r
32a6d407 278 fCurrentV0IndexNumber++;\r
279 continue;\r
3c538586 280 }\r
32a6d407 281 \r
282 \r
3c538586 283 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){\r
a19c3402 284 if(fHistograms != NULL){\r
32a6d407 285 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());\r
a19c3402 286 }\r
32a6d407 287 fCurrentV0IndexNumber++;\r
3c538586 288 continue;\r
289 }\r
32a6d407 290 \r
291 \r
3c538586 292 if(fMotherCandidateLorentzVector->Pt()<fPtCut){\r
a19c3402 293 if(fHistograms != NULL){\r
32a6d407 294 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());\r
a19c3402 295 }\r
32a6d407 296 fCurrentV0IndexNumber++;\r
3c538586 297 continue;\r
298 }\r
32a6d407 299 \r
300 \r
3c538586 301 }\r
302 else if(fUseESDTrack){\r
303 //TODO\r
304 }\r
305\r
32a6d407 306 fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);\r
3c538586 307\r
32a6d407 308 iResult=kTRUE;//means we have a v0 who survived all the cuts applied\r
309 \r
3c538586 310 fCurrentV0IndexNumber++;\r
32a6d407 311 \r
3c538586 312 break;\r
313 }\r
314 return iResult; \r
315}\r
316\r
32a6d407 317Bool_t AliV0Reader::UpdateV0Information(){\r
3c538586 318 //see header file for documentation\r
32a6d407 319\r
320 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks \r
321\r
322 Bool_t switchTracks = kFALSE;\r
323 \r
324 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());\r
325 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());\r
326 \r
327 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign\r
328 iResult=kFALSE;\r
329 if(fHistograms != NULL){\r
330 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());\r
331 }\r
332 }\r
333 \r
334 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks\r
335 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());\r
336 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());\r
337 switchTracks = kTRUE;\r
338 }\r
339\r
340 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) || \r
341 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){\r
342 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) || \r
343 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){\r
344 \r
345 iResult=kFALSE;\r
346 if(fHistograms != NULL){\r
347 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());\r
348 }\r
349 }\r
350 \r
351 \r
352 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 || \r
353 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) { \r
354 \r
355 iResult=kFALSE;\r
356 if(fHistograms != NULL){\r
357 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());\r
358 }\r
359 }\r
360\r
361\r
362 \r
3c538586 363 if(fCurrentNegativeKFParticle != NULL){\r
364 delete fCurrentNegativeKFParticle;\r
365 }\r
32a6d407 366 if(switchTracks == kFALSE){\r
367 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);\r
368 }\r
369 else{\r
370 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);\r
371 }\r
372\r
3c538586 373 if(fCurrentPositiveKFParticle != NULL){\r
374 delete fCurrentPositiveKFParticle;\r
375 }\r
32a6d407 376 if(switchTracks == kFALSE){\r
377 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);\r
378 }\r
379 else{\r
380 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);\r
381 }\r
3c538586 382 \r
383 if(fCurrentMotherKFCandidate != NULL){\r
384 delete fCurrentMotherKFCandidate;\r
385 }\r
386 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);\r
387\r
3c538586 388\r
389 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){\r
390 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);\r
391 }\r
32a6d407 392 \r
393 \r
394 \r
395 \r
3c538586 396 if(fUseImprovedVertex == kTRUE){\r
397 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());\r
398 primaryVertexImproved+=*fCurrentMotherKFCandidate;\r
399 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);\r
400 }\r
32a6d407 401 \r
3c538586 402 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);\r
32a6d407 403 \r
404 \r
3c538586 405 if(fNegativeTrackLorentzVector != NULL){\r
406 delete fNegativeTrackLorentzVector;\r
407 }\r
408 if(fUseKFParticle){\r
409 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());\r
410 }\r
411 else if(fUseESDTrack){\r
412 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());\r
413 }\r
32a6d407 414 \r
3c538586 415 if(fPositiveTrackLorentzVector != NULL){\r
416 delete fPositiveTrackLorentzVector;\r
417 }\r
418 if(fUseKFParticle){\r
419 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());\r
420 }\r
421 else if(fUseESDTrack){\r
422 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());\r
423 }\r
32a6d407 424 \r
3c538586 425 if(fMotherCandidateLorentzVector != NULL){\r
426 delete fMotherCandidateLorentzVector;\r
427 }\r
428 if(fUseKFParticle){\r
429 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);\r
430 }\r
431 else if(fUseESDTrack){\r
432 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);\r
433 }\r
32a6d407 434 \r
3c538586 435 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){\r
436 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.); \r
437 }\r
438 \r
32a6d407 439 \r
3c538586 440 if(fDoMC == kTRUE){\r
a19c3402 441 fMotherMCParticle= NULL;\r
3c538586 442 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));\r
443 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));\r
a19c3402 444 if(fPositiveMCParticle->GetMother(0)>-1){\r
445 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));\r
446 }\r
3c538586 447 }\r
32a6d407 448 \r
449 // if(iResult==kTRUE){\r
450 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate); // moved it to NextV0() after all the cuts are applied\r
451 // }\r
452\r
453 return iResult;\r
3c538586 454}\r
455\r
32a6d407 456\r
457\r
3c538586 458Bool_t AliV0Reader::HasSameMCMother(){\r
459 //see header file for documentation\r
32a6d407 460 \r
3c538586 461 Bool_t iResult = kFALSE;\r
462 if(fDoMC == kTRUE){\r
463 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){\r
464 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))\r
a19c3402 465 if(fMotherMCParticle){\r
466 iResult = kTRUE;\r
467 }\r
3c538586 468 }\r
469 }\r
470 return iResult;\r
471}\r
472\r
473Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){\r
474 //see header file for documentation\r
32a6d407 475 \r
3c538586 476 Bool_t iResult=kFALSE;\r
32a6d407 477 \r
3c538586 478 Double_t *posProbArray = new Double_t[10];\r
479 Double_t *negProbArray = new Double_t[10];\r
480 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());\r
481 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());\r
32a6d407 482 \r
3c538586 483 negTrack->GetTPCpid(negProbArray);\r
484 posTrack->GetTPCpid(posProbArray);\r
32a6d407 485 \r
3c538586 486 if(negProbArray!=NULL && posProbArray!=NULL){\r
487 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){\r
488 iResult=kTRUE;\r
489 }\r
490 }\r
491 delete [] posProbArray;\r
492 delete [] negProbArray;\r
493 return iResult;\r
494}\r
495\r
a19c3402 496void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){\r
32a6d407 497 \r
a19c3402 498 Double_t *posProbArray = new Double_t[10];\r
499 Double_t *negProbArray = new Double_t[10];\r
500 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());\r
501 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());\r
32a6d407 502 \r
a19c3402 503 negTrack->GetTPCpid(negProbArray);\r
504 posTrack->GetTPCpid(posProbArray);\r
32a6d407 505 \r
a19c3402 506 if(negProbArray!=NULL && posProbArray!=NULL){\r
507 negPIDProb = negProbArray[GetSpeciesIndex(-1)];\r
508 posPIDProb = posProbArray[GetSpeciesIndex(1)];\r
509 }\r
510 delete [] posProbArray;\r
511 delete [] negProbArray;\r
512}\r
513\r
3c538586 514void AliV0Reader::UpdateEventByEventData(){\r
515 //see header file for documentation\r
32a6d407 516 \r
3c538586 517 if(fCurrentEventGoodV0s.size() >0 ){\r
32a6d407 518 // fPreviousEventGoodV0s.clear();\r
519 // fPreviousEventGoodV0s = fCurrentEventGoodV0s;\r
520 if(fPreviousEventGoodV0s.size()>19){\r
521 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){\r
522 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());\r
523 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));\r
524 }\r
525 }\r
526 else{\r
527 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){\r
528 if(fPreviousEventGoodV0s.size()<20){\r
529 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));\r
530 }\r
531 else{\r
532 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());\r
533 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));\r
534 }\r
535 }\r
536 }\r
3c538586 537 }\r
538 fCurrentEventGoodV0s.clear();\r
32a6d407 539 \r
3c538586 540 fCurrentV0IndexNumber=0;\r
541}\r
542\r
32a6d407 543\r
3c538586 544Double_t AliV0Reader::GetNegativeTrackPhi() const{\r
545 //see header file for documentation\r
32a6d407 546 \r
3c538586 547 Double_t offset=0;\r
548 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){\r
549 offset = -2*TMath::Pi();\r
550 }\r
551 return fNegativeTrackLorentzVector->Phi()+offset;\r
552}\r
553\r
554Double_t AliV0Reader::GetPositiveTrackPhi() const{\r
555 //see header file for documentation\r
32a6d407 556 \r
3c538586 557 Double_t offset=0;\r
558 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){\r
559 offset = -2*TMath::Pi();\r
560 }\r
561 return fPositiveTrackLorentzVector->Phi()+offset;\r
562}\r
563\r
564Double_t AliV0Reader::GetMotherCandidatePhi() const{\r
565 //see header file for documentation\r
32a6d407 566 \r
3c538586 567 Double_t offset=0;\r
568 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){\r
569 offset = -2*TMath::Pi();\r
570 }\r
571 return fMotherCandidateLorentzVector->Phi()+offset;\r
572}\r
573\r
32a6d407 574\r
575Double_t AliV0Reader::GetMotherCandidateRapidity() const{\r
3c538586 576 //see header file for documentation\r
32a6d407 577 \r
578 Double_t rapidity=0;\r
579 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;\r
580 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));\r
581 return rapidity;\r
582 \r
583}\r
584\r
3c538586 585\r
3c538586 586\r
32a6d407 587\r
588\r
589Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){\r
590 //see header file for documentation\r
591 \r
592 Int_t iResult = 10; // Unknown particle\r
593 \r
3c538586 594 if(chargeOfTrack==-1){ //negative track\r
595 switch(abs(fNegativeTrackPID)){\r
596 case 11: //electron\r
597 iResult = 0;\r
598 break;\r
599 case 13: //muon\r
600 iResult = 1;\r
601 break;\r
602 case 211: //pion\r
603 iResult = 2;\r
604 break;\r
605 case 321: //kaon\r
606 iResult = 3;\r
607 break;\r
608 case 2212: //proton\r
609 iResult = 4;\r
610 break;\r
611 case 22: //photon\r
612 iResult = 5;\r
613 break;\r
614 case 111: //pi0\r
615 iResult = 6;\r
616 break;\r
617 case 2112: //neutron\r
618 iResult = 7;\r
619 break;\r
620 case 311: //K0\r
621 iResult = 8;\r
622 break;\r
32a6d407 623 \r
3c538586 624 //Put in here for kSPECIES::kEleCon ????\r
625 }\r
626 }\r
627 else if(chargeOfTrack==1){ //positive track\r
628 switch(abs(fPositiveTrackPID)){\r
629 case 11: //electron\r
630 iResult = 0;\r
631 break;\r
632 case 13: //muon\r
633 iResult = 1;\r
634 break;\r
635 case 211: //pion\r
636 iResult = 2;\r
637 break;\r
638 case 321: //kaon\r
639 iResult = 3;\r
640 break;\r
641 case 2212: //proton\r
642 iResult = 4;\r
643 break;\r
644 case 22: //photon\r
645 iResult = 5;\r
646 break;\r
647 case 111: //pi0\r
648 iResult = 6;\r
649 break;\r
650 case 2112: //neutron\r
651 iResult = 7;\r
652 break;\r
653 case 311: //K0\r
654 iResult = 8;\r
655 break;\r
32a6d407 656 \r
3c538586 657 //Put in here for kSPECIES::kEleCon ????\r
658 }\r
659 }\r
660 else{\r
661 //Wrong parameter.. Print warning\r
662 }\r
663 return iResult;\r
664}\r