1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *
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 **************************************************************************/
16 ////////////////////////////////////////////////
17 //---------------------------------------------
18 // Class used to do analysis on conversion pairs
19 //---------------------------------------------
20 ////////////////////////////////////////////////
22 // --- ROOT system ---
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"
34 #include "AliMCEventHandler.h"
35 #include "AliTPCpidESD.h"
47 AliV0Reader::AliV0Reader() :
51 fMCEvent(NULL), // for CF
58 fCurrentV0IndexNumber(0),
60 fCurrentNegativeKFParticle(NULL),
61 fCurrentPositiveKFParticle(NULL),
62 fCurrentMotherKFCandidate(NULL),
63 fCurrentNegativeESDTrack(NULL),
64 fCurrentPositiveESDTrack(NULL),
65 fNegativeTrackLorentzVector(NULL),
66 fPositiveTrackLorentzVector(NULL),
67 fMotherCandidateLorentzVector(NULL),
73 fNegativeMCParticle(NULL),
74 fPositiveMCParticle(NULL),
75 fMotherMCParticle(NULL),
76 fMotherCandidateKFMass(0),
77 fMotherCandidateKFWidth(0),
78 fUseKFParticle(kTRUE),
81 fMaxR(10000),// 100 meter(outside of ALICE)
87 fChi2CutConversion(0.),
89 fPIDProbabilityCutNegativeParticle(0),
90 fPIDProbabilityCutPositiveParticle(0),
91 fDodEdxSigmaCut(kFALSE),
92 fPIDnSigmaAboveElectronLine(100),
93 fPIDnSigmaBelowElectronLine(-100),
94 fPIDnSigmaAbovePionLine(-100),
95 fPIDMinPnSigmaAbovePionLine(100),
100 fUseImprovedVertex(kFALSE),
101 fUseOwnXYZCalculation(kFALSE),
103 fUpdateV0AlreadyCalled(kFALSE),
104 fCurrentEventGoodV0s(),
105 fPreviousEventGoodV0s()
107 fTPCpid = new AliTPCpidESD;
111 AliV0Reader::AliV0Reader(const AliV0Reader & original) :
113 fMCStack(original.fMCStack),
114 fMCTruth(original.fMCTruth),
115 fMCEvent(original.fMCEvent), // for CF
116 fChain(original.fChain),
117 fESDHandler(original.fESDHandler),
118 fESDEvent(original.fESDEvent),
119 fCFManager(original.fCFManager),
120 fTPCpid(original.fTPCpid),
121 fHistograms(original.fHistograms),
122 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
123 fCurrentV0(original.fCurrentV0),
124 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
125 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
126 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
127 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
128 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
129 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
130 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
131 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
132 fCurrentXValue(original.fCurrentXValue),
133 fCurrentYValue(original.fCurrentYValue),
134 fCurrentZValue(original.fCurrentZValue),
135 fPositiveTrackPID(original.fPositiveTrackPID),
136 fNegativeTrackPID(original.fNegativeTrackPID),
137 fNegativeMCParticle(original.fNegativeMCParticle),
138 fPositiveMCParticle(original.fPositiveMCParticle),
139 fMotherMCParticle(original.fMotherMCParticle),
140 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
141 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
142 fUseKFParticle(kTRUE),
143 fUseESDTrack(kFALSE),
145 fMaxR(original.fMaxR),
146 fEtaCut(original.fEtaCut),
147 fPtCut(original.fPtCut),
148 fMaxZ(original.fMaxZ),
149 fLineCutZRSlope(original.fLineCutZRSlope),
150 fLineCutZValue(original.fLineCutZValue),
151 fChi2CutConversion(original.fChi2CutConversion),
152 fChi2CutMeson(original.fChi2CutMeson),
153 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
154 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
155 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
156 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
157 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
158 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
159 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
160 fXVertexCut(original.fXVertexCut),
161 fYVertexCut(original.fYVertexCut),
162 fZVertexCut(original.fZVertexCut),
163 fNSigmaMass(original.fNSigmaMass),
164 fUseImprovedVertex(original.fUseImprovedVertex),
165 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
166 fDoCF(original.fDoCF),
167 fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
168 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
169 fPreviousEventGoodV0s(original.fPreviousEventGoodV0s)
175 AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
177 // assignment operator
180 AliV0Reader::~AliV0Reader()
187 void AliV0Reader::Initialize(){
188 //see header file for documentation
189 fUpdateV0AlreadyCalled = kFALSE;
190 // Get the input handler from the manager
191 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
192 if(fESDHandler == NULL){
196 // Get pointer to esd event from input handler
197 fESDEvent = fESDHandler->GetEvent();
198 if(fESDEvent == NULL){
202 //Get pointer to MCTruth
203 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
204 if(fMCTruth == NULL){
209 //Get pointer to the mc stack
211 fMCStack = fMCTruth->MCEvent()->Stack();
212 if(fMCStack == NULL){
218 //Get pointer to the mc event
220 fMCEvent = fMCTruth->MCEvent();
221 if(fMCEvent == NULL){
227 AliKFParticle::SetField(fESDEvent->GetMagneticField());
231 AliESDv0* AliV0Reader::GetV0(Int_t index){
232 //see header file for documentation
233 fCurrentV0 = fESDEvent->GetV0(index);
234 UpdateV0Information();
238 Bool_t AliV0Reader::CheckForPrimaryVertex(){
239 return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
242 Bool_t AliV0Reader::NextV0(){
243 //see header file for documentation
245 Bool_t iResult=kFALSE;
246 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
247 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
249 // moved it up here so that the correction framework can access pt and eta information
250 if(UpdateV0Information() == kFALSE){
251 fCurrentV0IndexNumber++;
255 Double_t containerInput[3];
257 containerInput[0] = GetMotherCandidatePt();
258 containerInput[1] = GetMotherCandidateEta();
259 containerInput[2] = GetMotherCandidateMass();
263 //checks if on the fly mode is set
264 if ( !fCurrentV0->GetOnFlyStatus() ){
265 if(fHistograms != NULL){
266 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
268 fCurrentV0IndexNumber++;
272 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
275 //checks if we have a prim vertex
276 if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
277 if(fHistograms != NULL){
278 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
280 fCurrentV0IndexNumber++;
284 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
287 //Check the pid probability
288 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
289 if(fHistograms != NULL){
290 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
292 fCurrentV0IndexNumber++;
296 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
299 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
300 if(fHistograms != NULL){
301 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
303 fCurrentV0IndexNumber++;
307 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
311 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct
312 if(fHistograms != NULL){
313 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
315 fCurrentV0IndexNumber++;
319 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
322 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
323 if(fHistograms != NULL){
324 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
326 fCurrentV0IndexNumber++;
330 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
333 /* Moved further up so corr framework can work
334 if(UpdateV0Information() == kFALSE){
335 fCurrentV0IndexNumber++;
342 if(fCurrentMotherKFCandidate->GetNDF()<=0){
343 if(fHistograms != NULL){
344 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
346 fCurrentV0IndexNumber++;
350 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
353 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
354 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
355 if(fHistograms != NULL){
356 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
358 fCurrentV0IndexNumber++;
362 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
365 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){
366 if(fHistograms != NULL){
367 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
369 fCurrentV0IndexNumber++;
373 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
376 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
377 if(fHistograms != NULL){
378 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
380 fCurrentV0IndexNumber++;
384 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
388 else if(fUseESDTrack){
392 if(fHistograms != NULL){
393 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
396 fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
398 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
400 fCurrentV0IndexNumber++;
407 Bool_t AliV0Reader::UpdateV0Information(){
408 //see header file for documentation
410 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
412 Bool_t switchTracks = kFALSE;
414 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
415 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
417 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
419 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
420 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
424 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
425 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
426 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
427 switchTracks = kTRUE;
430 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
431 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
432 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
433 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
435 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
436 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
440 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
441 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
444 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
445 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
449 if(fDodEdxSigmaCut == kTRUE){
451 if( fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
452 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
453 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
454 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
456 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
457 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
460 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
461 if(fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
462 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
463 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
465 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
466 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
471 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
472 if(fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
473 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
474 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
476 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
477 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
483 if(fCurrentNegativeKFParticle != NULL){
484 delete fCurrentNegativeKFParticle;
486 if(switchTracks == kFALSE){
487 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
490 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
493 if(fCurrentPositiveKFParticle != NULL){
494 delete fCurrentPositiveKFParticle;
496 if(switchTracks == kFALSE){
497 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
500 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
503 if(fCurrentMotherKFCandidate != NULL){
504 delete fCurrentMotherKFCandidate;
506 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
509 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
510 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
513 if(fUseImprovedVertex == kTRUE){
514 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
515 primaryVertexImproved+=*fCurrentMotherKFCandidate;
516 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
519 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
522 if(fNegativeTrackLorentzVector != NULL){
523 delete fNegativeTrackLorentzVector;
526 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
528 else if(fUseESDTrack){
529 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
532 if(fPositiveTrackLorentzVector != NULL){
533 delete fPositiveTrackLorentzVector;
536 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
538 else if(fUseESDTrack){
539 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
542 if(fMotherCandidateLorentzVector != NULL){
543 delete fMotherCandidateLorentzVector;
546 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
548 else if(fUseESDTrack){
549 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
552 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
553 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
558 fMotherMCParticle= NULL;
559 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
560 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
561 if(fPositiveMCParticle->GetMother(0)>-1){
562 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
568 Double_t containerInput[3];
570 containerInput[0] = GetMotherCandidatePt();
571 containerInput[1] = GetMotherCandidateEta();
572 containerInput[2] = GetMotherCandidateMass();
574 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
575 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
576 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
580 if(fUseOwnXYZCalculation == kFALSE){
581 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
587 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
588 fCurrentXValue = convpos[0];
589 fCurrentYValue = convpos[1];
590 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
594 fUpdateV0AlreadyCalled = kTRUE;
601 Bool_t AliV0Reader::HasSameMCMother(){
602 //see header file for documentation
604 Bool_t iResult = kFALSE;
606 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
607 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
608 if(fMotherMCParticle){
616 Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
617 //see header file for documentation
619 Bool_t iResult=kFALSE;
621 Double_t *posProbArray = new Double_t[10];
622 Double_t *negProbArray = new Double_t[10];
623 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
624 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
626 negTrack->GetTPCpid(negProbArray);
627 posTrack->GetTPCpid(posProbArray);
629 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
630 if(negProbArray && posProbArray){
631 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
635 delete [] posProbArray;
636 delete [] negProbArray;
640 void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
641 // see header file for documentation
643 Double_t *posProbArray = new Double_t[10];
644 Double_t *negProbArray = new Double_t[10];
645 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
646 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
648 negTrack->GetTPCpid(negProbArray);
649 posTrack->GetTPCpid(posProbArray);
651 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
652 if(negProbArray && posProbArray){
653 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
654 posPIDProb = posProbArray[GetSpeciesIndex(1)];
656 delete [] posProbArray;
657 delete [] negProbArray;
660 void AliV0Reader::UpdateEventByEventData(){
661 //see header file for documentation
663 if(fCurrentEventGoodV0s.size() >0 ){
664 // fPreviousEventGoodV0s.clear();
665 // fPreviousEventGoodV0s = fCurrentEventGoodV0s;
666 if(fPreviousEventGoodV0s.size()>19){
667 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){
668 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());
669 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
673 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){
674 if(fPreviousEventGoodV0s.size()<20){
675 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
678 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());
679 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
684 fCurrentEventGoodV0s.clear();
686 fCurrentV0IndexNumber=0;
690 Double_t AliV0Reader::GetNegativeTrackPhi() const{
691 //see header file for documentation
694 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
695 offset = -2*TMath::Pi();
697 return fNegativeTrackLorentzVector->Phi()+offset;
700 Double_t AliV0Reader::GetPositiveTrackPhi() const{
701 //see header file for documentation
704 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
705 offset = -2*TMath::Pi();
707 return fPositiveTrackLorentzVector->Phi()+offset;
710 Double_t AliV0Reader::GetMotherCandidatePhi() const{
711 //see header file for documentation
714 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
715 offset = -2*TMath::Pi();
717 return fMotherCandidateLorentzVector->Phi()+offset;
721 Double_t AliV0Reader::GetMotherCandidateRapidity() const{
722 //see header file for documentation
725 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
726 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
735 Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
736 //see header file for documentation
738 Int_t iResult = 10; // Unknown particle
740 if(chargeOfTrack==-1){ //negative track
741 switch(abs(fNegativeTrackPID)){
770 //Put in here for kSPECIES::kEleCon ????
773 else if(chargeOfTrack==1){ //positive track
774 switch(abs(fPositiveTrackPID)){
803 //Put in here for kSPECIES::kEleCon ????
807 //Wrong parameter.. Print warning
812 Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
813 // see header file for documentation
815 Double_t pi = 3.14159265358979323846;
818 track->GetHelixParameters(helix,b);
820 Double_t xpos = helix[5];
821 Double_t ypos = helix[0];
822 Double_t radius = TMath::Abs(1./helix[4]);
823 Double_t phi = helix[2];
830 Double_t xpoint = radius * TMath::Cos(phi);
831 Double_t ypoint = radius * TMath::Sin(phi);
842 center[0] = xpos + xpoint;
843 center[1] = ypos + ypoint;
848 Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
849 //see header file for documentation
851 Double_t helixcenterpos[2];
852 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
854 Double_t helixcenterneg[2];
855 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
857 Double_t poshelix[6];
858 ptrack->GetHelixParameters(poshelix,b);
859 Double_t posradius = TMath::Abs(1./poshelix[4]);
861 Double_t neghelix[6];
862 ntrack->GetHelixParameters(neghelix,b);
863 Double_t negradius = TMath::Abs(1./neghelix[4]);
865 Double_t xpos = helixcenterpos[0];
866 Double_t ypos = helixcenterpos[1];
867 Double_t xneg = helixcenterneg[0];
868 Double_t yneg = helixcenterneg[1];
870 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
871 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
878 Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
879 //see header file for documentation
881 Double_t helixpos[6];
882 ptrack->GetHelixParameters(helixpos,b);
884 Double_t helixneg[6];
885 ntrack->GetHelixParameters(helixneg,b);
887 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
888 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
890 Double_t pi = 3.14159265358979323846;
893 GetConvPosXY(ptrack,ntrack,b,convpos);
895 Double_t convposx = convpos[0];
896 Double_t convposy = convpos[1];
898 Double_t helixcenterpos[2];
899 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
901 Double_t helixcenterneg[2];
902 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
904 Double_t xpos = helixcenterpos[0];
905 Double_t ypos = helixcenterpos[1];
906 Double_t xneg = helixcenterneg[0];
907 Double_t yneg = helixcenterneg[1];
909 Double_t deltaXPos = convposx - xpos;
910 Double_t deltaYPos = convposy - ypos;
912 Double_t deltaXNeg = convposx - xneg;
913 Double_t deltaYNeg = convposy - yneg;
915 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
916 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
918 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
919 TMath::Cos(alphaNeg);
920 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
921 TMath::Sin(alphaNeg);
923 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
924 TMath::Cos(alphaPos);
925 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
926 TMath::Sin(alphaPos);
928 Double_t x0neg = helixneg[5];
929 Double_t y0neg = helixneg[0];
931 Double_t x0pos = helixpos[5];
932 Double_t y0pos = helixpos[0];
934 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
935 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
937 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
938 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
940 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
943 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
946 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
947 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
949 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
950 Double_t deltaUPos = postrackradius*deltabetaPos;
952 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
953 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
956 (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);