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 fCurrentEventGoodV0s(),
104 fPreviousEventGoodV0s()
106 fTPCpid = new AliTPCpidESD;
110 AliV0Reader::AliV0Reader(const AliV0Reader & original) :
112 fMCStack(original.fMCStack),
113 fMCTruth(original.fMCTruth),
114 fMCEvent(original.fMCEvent), // for CF
115 fChain(original.fChain),
116 fESDHandler(original.fESDHandler),
117 fESDEvent(original.fESDEvent),
118 fCFManager(original.fCFManager),
119 fTPCpid(original.fTPCpid),
120 fHistograms(original.fHistograms),
121 fCurrentV0IndexNumber(original.fCurrentV0IndexNumber),
122 fCurrentV0(original.fCurrentV0),
123 fCurrentNegativeKFParticle(original.fCurrentNegativeKFParticle),
124 fCurrentPositiveKFParticle(original.fCurrentPositiveKFParticle),
125 fCurrentMotherKFCandidate(original.fCurrentMotherKFCandidate),
126 fCurrentNegativeESDTrack(original.fCurrentNegativeESDTrack),
127 fCurrentPositiveESDTrack(original.fCurrentPositiveESDTrack),
128 fNegativeTrackLorentzVector(original.fNegativeTrackLorentzVector),
129 fPositiveTrackLorentzVector(original.fPositiveTrackLorentzVector),
130 fMotherCandidateLorentzVector(original.fMotherCandidateLorentzVector),
131 fCurrentXValue(original.fCurrentXValue),
132 fCurrentYValue(original.fCurrentYValue),
133 fCurrentZValue(original.fCurrentZValue),
134 fPositiveTrackPID(original.fPositiveTrackPID),
135 fNegativeTrackPID(original.fNegativeTrackPID),
136 fNegativeMCParticle(original.fNegativeMCParticle),
137 fPositiveMCParticle(original.fPositiveMCParticle),
138 fMotherMCParticle(original.fMotherMCParticle),
139 fMotherCandidateKFMass(original.fMotherCandidateKFMass),
140 fMotherCandidateKFWidth(original.fMotherCandidateKFWidth),
141 fUseKFParticle(kTRUE),
142 fUseESDTrack(kFALSE),
144 fMaxR(original.fMaxR),
145 fEtaCut(original.fEtaCut),
146 fPtCut(original.fPtCut),
147 fMaxZ(original.fMaxZ),
148 fLineCutZRSlope(original.fLineCutZRSlope),
149 fLineCutZValue(original.fLineCutZValue),
150 fChi2CutConversion(original.fChi2CutConversion),
151 fChi2CutMeson(original.fChi2CutMeson),
152 fPIDProbabilityCutNegativeParticle(original.fPIDProbabilityCutNegativeParticle),
153 fPIDProbabilityCutPositiveParticle(original.fPIDProbabilityCutPositiveParticle),
154 fDodEdxSigmaCut(original.fDodEdxSigmaCut),
155 fPIDnSigmaAboveElectronLine(original.fPIDnSigmaAboveElectronLine),
156 fPIDnSigmaBelowElectronLine(original.fPIDnSigmaBelowElectronLine),
157 fPIDnSigmaAbovePionLine(original.fPIDnSigmaAbovePionLine),
158 fPIDMinPnSigmaAbovePionLine(original.fPIDMinPnSigmaAbovePionLine),
159 fXVertexCut(original.fXVertexCut),
160 fYVertexCut(original.fYVertexCut),
161 fZVertexCut(original.fZVertexCut),
162 fNSigmaMass(original.fNSigmaMass),
163 fUseImprovedVertex(original.fUseImprovedVertex),
164 fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
165 fDoCF(original.fDoCF),
166 fCurrentEventGoodV0s(original.fCurrentEventGoodV0s),
167 fPreviousEventGoodV0s(original.fPreviousEventGoodV0s)
173 AliV0Reader & AliV0Reader::operator = (const AliV0Reader & /*source*/)
175 // assignment operator
178 AliV0Reader::~AliV0Reader()
185 void AliV0Reader::Initialize(){
186 //see header file for documentation
188 // Get the input handler from the manager
189 fESDHandler = (AliESDInputHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
190 if(fESDHandler == NULL){
194 // Get pointer to esd event from input handler
195 fESDEvent = fESDHandler->GetEvent();
196 if(fESDEvent == NULL){
200 //Get pointer to MCTruth
201 fMCTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
202 if(fMCTruth == NULL){
206 //Get pointer to the mc stack
207 fMCStack = fMCTruth->MCEvent()->Stack();
208 if(fMCStack == NULL){
214 //Get pointer to the mc event
216 fMCEvent = fMCTruth->MCEvent();
217 if(fMCEvent == NULL){
223 AliKFParticle::SetField(fESDEvent->GetMagneticField());
227 AliESDv0* AliV0Reader::GetV0(Int_t index){
228 //see header file for documentation
229 fCurrentV0 = fESDEvent->GetV0(index);
230 UpdateV0Information();
234 Bool_t AliV0Reader::CheckForPrimaryVertex(){
235 return fESDEvent->GetPrimaryVertex()->GetNContributors()>0;
240 Bool_t AliV0Reader::NextV0(){
241 //see header file for documentation
243 Bool_t iResult=kFALSE;
244 while(fCurrentV0IndexNumber<fESDEvent->GetNumberOfV0s()){
245 fCurrentV0 = fESDEvent->GetV0(fCurrentV0IndexNumber);
247 // moved it up here so that the correction framework can access pt and eta information
248 if(UpdateV0Information() == kFALSE){
249 fCurrentV0IndexNumber++;
253 Double_t containerInput[3];
255 containerInput[0] = GetMotherCandidatePt();
256 containerInput[1] = GetMotherCandidateEta();
257 containerInput[2] = GetMotherCandidateMass();
260 //checks if on the fly mode is set
261 if ( !fCurrentV0->GetOnFlyStatus() ){
262 if(fHistograms != NULL){
263 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
265 fCurrentV0IndexNumber++;
269 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
272 //checks if we have a prim vertex
273 if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
274 if(fHistograms != NULL){
275 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
277 fCurrentV0IndexNumber++;
281 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
284 //Check the pid probability
285 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
286 if(fHistograms != NULL){
287 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
289 fCurrentV0IndexNumber++;
293 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
297 if(fUseOwnXYZCalculation == kFALSE){
298 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
304 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
305 fCurrentXValue = convpos[0];
306 fCurrentYValue = convpos[1];
307 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
310 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
311 if(fHistograms != NULL){
312 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
314 fCurrentV0IndexNumber++;
318 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
322 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct
323 if(fHistograms != NULL){
324 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
326 fCurrentV0IndexNumber++;
330 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
333 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
334 if(fHistograms != NULL){
335 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
337 fCurrentV0IndexNumber++;
341 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
344 /* Moved further up so corr framework can work
345 if(UpdateV0Information() == kFALSE){
346 fCurrentV0IndexNumber++;
353 if(fCurrentMotherKFCandidate->GetNDF()<=0){
354 if(fHistograms != NULL){
355 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
357 fCurrentV0IndexNumber++;
361 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
364 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
365 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
366 if(fHistograms != NULL){
367 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
369 fCurrentV0IndexNumber++;
373 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
376 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){
377 if(fHistograms != NULL){
378 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
380 fCurrentV0IndexNumber++;
384 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
387 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
388 if(fHistograms != NULL){
389 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
391 fCurrentV0IndexNumber++;
395 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
399 else if(fUseESDTrack){
403 if(fHistograms != NULL){
404 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
407 fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
409 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
411 fCurrentV0IndexNumber++;
418 Bool_t AliV0Reader::UpdateV0Information(){
419 //see header file for documentation
421 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
423 Bool_t switchTracks = kFALSE;
425 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
426 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
428 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
430 if(fHistograms != NULL){
431 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
435 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
436 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
437 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
438 switchTracks = kTRUE;
441 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
442 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
443 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
444 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
447 if(fHistograms != NULL){
448 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
452 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
453 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
456 if(fHistograms != NULL){
457 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
461 if(fDodEdxSigmaCut == kTRUE){
463 if( fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
464 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
465 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
466 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
468 if(fHistograms != NULL){
469 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
472 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
473 if(fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
474 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
475 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
477 if(fHistograms != NULL){
478 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
483 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
484 if(fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
485 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
486 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
488 if(fHistograms != NULL){
489 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
498 if(fCurrentNegativeKFParticle != NULL){
499 delete fCurrentNegativeKFParticle;
501 if(switchTracks == kFALSE){
502 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
505 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
508 if(fCurrentPositiveKFParticle != NULL){
509 delete fCurrentPositiveKFParticle;
511 if(switchTracks == kFALSE){
512 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
515 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
518 if(fCurrentMotherKFCandidate != NULL){
519 delete fCurrentMotherKFCandidate;
521 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
524 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
525 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
528 if(fUseImprovedVertex == kTRUE){
529 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
530 primaryVertexImproved+=*fCurrentMotherKFCandidate;
531 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
534 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
537 if(fNegativeTrackLorentzVector != NULL){
538 delete fNegativeTrackLorentzVector;
541 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
543 else if(fUseESDTrack){
544 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
547 if(fPositiveTrackLorentzVector != NULL){
548 delete fPositiveTrackLorentzVector;
551 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
553 else if(fUseESDTrack){
554 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
557 if(fMotherCandidateLorentzVector != NULL){
558 delete fMotherCandidateLorentzVector;
561 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
563 else if(fUseESDTrack){
564 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
567 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
568 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
573 fMotherMCParticle= NULL;
574 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
575 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
576 if(fPositiveMCParticle->GetMother(0)>-1){
577 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
581 // if(iResult==kTRUE){
582 // fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate); // moved it to NextV0() after all the cuts are applied
587 Double_t containerInput[3];
589 containerInput[0] = GetMotherCandidatePt();
590 containerInput[1] = GetMotherCandidateEta();
591 containerInput[2] = GetMotherCandidateMass();
593 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
594 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
595 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
602 Bool_t AliV0Reader::HasSameMCMother(){
603 //see header file for documentation
605 Bool_t iResult = kFALSE;
607 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
608 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
609 if(fMotherMCParticle){
615 if(fUseOwnXYZCalculation == kFALSE){
616 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
622 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
623 fCurrentXValue = convpos[0];
624 fCurrentYValue = convpos[1];
625 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
631 Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
632 //see header file for documentation
634 Bool_t iResult=kFALSE;
636 Double_t *posProbArray = new Double_t[10];
637 Double_t *negProbArray = new Double_t[10];
638 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
639 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
641 negTrack->GetTPCpid(negProbArray);
642 posTrack->GetTPCpid(posProbArray);
644 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
645 if(negProbArray && posProbArray){
646 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
650 delete [] posProbArray;
651 delete [] negProbArray;
655 void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
656 // see header file for documentation
658 Double_t *posProbArray = new Double_t[10];
659 Double_t *negProbArray = new Double_t[10];
660 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
661 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
663 negTrack->GetTPCpid(negProbArray);
664 posTrack->GetTPCpid(posProbArray);
666 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
667 if(negProbArray && posProbArray){
668 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
669 posPIDProb = posProbArray[GetSpeciesIndex(1)];
671 delete [] posProbArray;
672 delete [] negProbArray;
675 void AliV0Reader::UpdateEventByEventData(){
676 //see header file for documentation
678 if(fCurrentEventGoodV0s.size() >0 ){
679 // fPreviousEventGoodV0s.clear();
680 // fPreviousEventGoodV0s = fCurrentEventGoodV0s;
681 if(fPreviousEventGoodV0s.size()>19){
682 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){
683 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());
684 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
688 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){
689 if(fPreviousEventGoodV0s.size()<20){
690 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
693 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());
694 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
699 fCurrentEventGoodV0s.clear();
701 fCurrentV0IndexNumber=0;
705 Double_t AliV0Reader::GetNegativeTrackPhi() const{
706 //see header file for documentation
709 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
710 offset = -2*TMath::Pi();
712 return fNegativeTrackLorentzVector->Phi()+offset;
715 Double_t AliV0Reader::GetPositiveTrackPhi() const{
716 //see header file for documentation
719 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
720 offset = -2*TMath::Pi();
722 return fPositiveTrackLorentzVector->Phi()+offset;
725 Double_t AliV0Reader::GetMotherCandidatePhi() const{
726 //see header file for documentation
729 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
730 offset = -2*TMath::Pi();
732 return fMotherCandidateLorentzVector->Phi()+offset;
736 Double_t AliV0Reader::GetMotherCandidateRapidity() const{
737 //see header file for documentation
740 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
741 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
750 Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
751 //see header file for documentation
753 Int_t iResult = 10; // Unknown particle
755 if(chargeOfTrack==-1){ //negative track
756 switch(abs(fNegativeTrackPID)){
785 //Put in here for kSPECIES::kEleCon ????
788 else if(chargeOfTrack==1){ //positive track
789 switch(abs(fPositiveTrackPID)){
818 //Put in here for kSPECIES::kEleCon ????
822 //Wrong parameter.. Print warning
827 Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
828 // see header file for documentation
830 Double_t pi = 3.14159265358979323846;
833 track->GetHelixParameters(helix,b);
835 Double_t xpos = helix[5];
836 Double_t ypos = helix[0];
837 Double_t radius = TMath::Abs(1./helix[4]);
838 Double_t phi = helix[2];
845 Double_t xpoint = radius * TMath::Cos(phi);
846 Double_t ypoint = radius * TMath::Sin(phi);
857 center[0] = xpos + xpoint;
858 center[1] = ypos + ypoint;
863 Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
864 //see header file for documentation
866 Double_t helixcenterpos[2];
867 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
869 Double_t helixcenterneg[2];
870 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
872 Double_t poshelix[6];
873 ptrack->GetHelixParameters(poshelix,b);
874 Double_t posradius = TMath::Abs(1./poshelix[4]);
876 Double_t neghelix[6];
877 ntrack->GetHelixParameters(neghelix,b);
878 Double_t negradius = TMath::Abs(1./neghelix[4]);
880 Double_t xpos = helixcenterpos[0];
881 Double_t ypos = helixcenterpos[1];
882 Double_t xneg = helixcenterneg[0];
883 Double_t yneg = helixcenterneg[1];
885 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
886 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
893 Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
894 //see header file for documentation
896 Double_t helixpos[6];
897 ptrack->GetHelixParameters(helixpos,b);
899 Double_t helixneg[6];
900 ntrack->GetHelixParameters(helixneg,b);
902 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
903 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
905 Double_t pi = 3.14159265358979323846;
908 GetConvPosXY(ptrack,ntrack,b,convpos);
910 Double_t convposx = convpos[0];
911 Double_t convposy = convpos[1];
913 Double_t helixcenterpos[2];
914 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
916 Double_t helixcenterneg[2];
917 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
919 Double_t xpos = helixcenterpos[0];
920 Double_t ypos = helixcenterpos[1];
921 Double_t xneg = helixcenterneg[0];
922 Double_t yneg = helixcenterneg[1];
924 Double_t deltaXPos = convposx - xpos;
925 Double_t deltaYPos = convposy - ypos;
927 Double_t deltaXNeg = convposx - xneg;
928 Double_t deltaYNeg = convposy - yneg;
930 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
931 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
933 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
934 TMath::Cos(alphaNeg);
935 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
936 TMath::Sin(alphaNeg);
938 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
939 TMath::Cos(alphaPos);
940 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
941 TMath::Sin(alphaPos);
943 Double_t x0neg = helixneg[5];
944 Double_t y0neg = helixneg[0];
946 Double_t x0pos = helixpos[5];
947 Double_t y0pos = helixpos[0];
949 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
950 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
952 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
953 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
955 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
958 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
961 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
962 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
964 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
965 Double_t deltaUPos = postrackradius*deltabetaPos;
967 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
968 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
971 (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);