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){
208 //Get pointer to the mc stack
209 fMCStack = fMCTruth->MCEvent()->Stack();
210 if(fMCStack == NULL){
216 //Get pointer to the mc event
218 fMCEvent = fMCTruth->MCEvent();
219 if(fMCEvent == NULL){
225 AliKFParticle::SetField(fESDEvent->GetMagneticField());
229 AliESDv0* AliV0Reader::GetV0(Int_t index){
230 //see header file for documentation
231 fCurrentV0 = fESDEvent->GetV0(index);
232 UpdateV0Information();
236 Bool_t AliV0Reader::CheckForPrimaryVertex(){
237 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();
261 //checks if on the fly mode is set
262 if ( !fCurrentV0->GetOnFlyStatus() ){
263 if(fHistograms != NULL){
264 fHistograms->FillHistogram("ESD_CutGetOnFly_InvMass",GetMotherCandidateMass());
266 fCurrentV0IndexNumber++;
270 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGetOnFly); // for CF
273 //checks if we have a prim vertex
274 if(fESDEvent->GetPrimaryVertex()->GetNContributors()<=0) {
275 if(fHistograms != NULL){
276 fHistograms->FillHistogram("ESD_CutNContributors_InvMass",GetMotherCandidateMass());
278 fCurrentV0IndexNumber++;
282 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNContributors); // for CF
285 //Check the pid probability
286 if(CheckPIDProbability(fPIDProbabilityCutNegativeParticle,fPIDProbabilityCutPositiveParticle)==kFALSE){
287 if(fHistograms != NULL){
288 fHistograms->FillHistogram("ESD_CutPIDProb_InvMass",GetMotherCandidateMass());
290 fCurrentV0IndexNumber++;
294 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCPID); // for CF
297 if(GetXYRadius()>fMaxR){ // cuts on distance from collision point
298 if(fHistograms != NULL){
299 fHistograms->FillHistogram("ESD_CutR_InvMass",GetMotherCandidateMass());
301 fCurrentV0IndexNumber++;
305 fCFManager->GetParticleContainer()->Fill(containerInput,kStepR); // for CF
309 if((TMath::Abs(fCurrentZValue)*fLineCutZRSlope)-fLineCutZValue > GetXYRadius() ){ // cuts out regions where we do not reconstruct
310 if(fHistograms != NULL){
311 fHistograms->FillHistogram("ESD_CutLine_InvMass",GetMotherCandidateMass());
313 fCurrentV0IndexNumber++;
317 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLine); // for CF
320 if(TMath::Abs(fCurrentZValue) > fMaxZ ){ // cuts out regions where we do not reconstruct
321 if(fHistograms != NULL){
322 fHistograms->FillHistogram("ESD_CutZ_InvMass",GetMotherCandidateMass());
324 fCurrentV0IndexNumber++;
328 fCFManager->GetParticleContainer()->Fill(containerInput,kStepZ); // for CF
331 /* Moved further up so corr framework can work
332 if(UpdateV0Information() == kFALSE){
333 fCurrentV0IndexNumber++;
340 if(fCurrentMotherKFCandidate->GetNDF()<=0){
341 if(fHistograms != NULL){
342 fHistograms->FillHistogram("ESD_CutNDF_InvMass",GetMotherCandidateMass());
344 fCurrentV0IndexNumber++;
348 fCFManager->GetParticleContainer()->Fill(containerInput,kStepNDF); // for CF
351 Double_t chi2V0 = fCurrentMotherKFCandidate->GetChi2()/fCurrentMotherKFCandidate->GetNDF();
352 if(chi2V0 > fChi2CutConversion || chi2V0 <=0){
353 if(fHistograms != NULL){
354 fHistograms->FillHistogram("ESD_CutChi2_InvMass",GetMotherCandidateMass());
356 fCurrentV0IndexNumber++;
360 fCFManager->GetParticleContainer()->Fill(containerInput,kStepChi2); // for CF
363 if(TMath::Abs(fMotherCandidateLorentzVector->Eta())> fEtaCut){
364 if(fHistograms != NULL){
365 fHistograms->FillHistogram("ESD_CutEta_InvMass",GetMotherCandidateMass());
367 fCurrentV0IndexNumber++;
371 fCFManager->GetParticleContainer()->Fill(containerInput,kStepEta); // for CF
374 if(fMotherCandidateLorentzVector->Pt()<fPtCut){
375 if(fHistograms != NULL){
376 fHistograms->FillHistogram("ESD_CutPt_InvMass",GetMotherCandidateMass());
378 fCurrentV0IndexNumber++;
382 fCFManager->GetParticleContainer()->Fill(containerInput,kStepPt); // for CF
386 else if(fUseESDTrack){
390 if(fHistograms != NULL){
391 fHistograms->FillHistogram("ESD_GoodV0s_InvMass",GetMotherCandidateMass());
394 fCurrentEventGoodV0s.push_back(*fCurrentMotherKFCandidate);
396 iResult=kTRUE;//means we have a v0 who survived all the cuts applied
398 fCurrentV0IndexNumber++;
405 Bool_t AliV0Reader::UpdateV0Information(){
406 //see header file for documentation
408 Bool_t iResult=kTRUE; // for taking out not refitted, kinks and like sign tracks
410 Bool_t switchTracks = kFALSE;
412 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
413 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
415 if(fCurrentNegativeESDTrack->GetSign() == fCurrentPositiveESDTrack->GetSign()){ // avoid like sign
417 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
418 fHistograms->FillHistogram("ESD_CutLikeSign_InvMass",GetMotherCandidateMass());
422 if(fCurrentPositiveESDTrack->GetSign() == -1 && fCurrentNegativeESDTrack->GetSign() == 1){ // switch wrong signed tracks
423 fCurrentNegativeESDTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
424 fCurrentPositiveESDTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
425 switchTracks = kTRUE;
428 if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ||
429 !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kTPCrefit) ){
430 // if( !(fCurrentNegativeESDTrack->GetStatus() & AliESDtrack::kITSrefit) ||
431 // !(fCurrentPositiveESDTrack->GetStatus() & AliESDtrack::kITSrefit) ){
433 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
434 fHistograms->FillHistogram("ESD_CutRefit_InvMass",GetMotherCandidateMass());
438 if( fCurrentNegativeESDTrack->GetKinkIndex(0) > 0 ||
439 fCurrentPositiveESDTrack->GetKinkIndex(0) > 0) {
442 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
443 fHistograms->FillHistogram("ESD_CutKink_InvMass",GetMotherCandidateMass());
447 if(fDodEdxSigmaCut == kTRUE){
449 if( fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
450 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ||
451 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaBelowElectronLine ||
452 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaAboveElectronLine ){
454 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
455 fHistograms->FillHistogram("ESD_CutdEdxSigmaElectronLine_InvMass",GetMotherCandidateMass());
458 if( fCurrentPositiveESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
459 if(fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
460 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
461 fTPCpid->GetNumberOfSigmas(fCurrentPositiveESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
463 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
464 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
469 if( fCurrentNegativeESDTrack->P()>fPIDMinPnSigmaAbovePionLine){
470 if(fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)>fPIDnSigmaBelowElectronLine &&
471 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kElectron)<fPIDnSigmaAboveElectronLine&&
472 fTPCpid->GetNumberOfSigmas(fCurrentNegativeESDTrack,AliPID::kPion)<fPIDnSigmaAbovePionLine){
474 if(fHistograms != NULL && fUpdateV0AlreadyCalled == kFALSE){
475 fHistograms->FillHistogram("ESD_CutdEdxSigmaPionLine_InvMass",GetMotherCandidateMass());
481 if(fCurrentNegativeKFParticle != NULL){
482 delete fCurrentNegativeKFParticle;
484 if(switchTracks == kFALSE){
485 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fNegativeTrackPID);
488 fCurrentNegativeKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fNegativeTrackPID);
491 if(fCurrentPositiveKFParticle != NULL){
492 delete fCurrentPositiveKFParticle;
494 if(switchTracks == kFALSE){
495 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamP()),fPositiveTrackPID);
498 fCurrentPositiveKFParticle = new AliKFParticle(*(fCurrentV0->GetParamN()),fPositiveTrackPID);
501 if(fCurrentMotherKFCandidate != NULL){
502 delete fCurrentMotherKFCandidate;
504 fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
507 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
508 fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
511 if(fUseImprovedVertex == kTRUE){
512 AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
513 primaryVertexImproved+=*fCurrentMotherKFCandidate;
514 fCurrentMotherKFCandidate->SetProductionVertex(primaryVertexImproved);
517 fCurrentMotherKFCandidate->GetMass(fMotherCandidateKFMass,fMotherCandidateKFWidth);
520 if(fNegativeTrackLorentzVector != NULL){
521 delete fNegativeTrackLorentzVector;
524 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeKFParticle->Px(),fCurrentNegativeKFParticle->Py(),fCurrentNegativeKFParticle->Pz());
526 else if(fUseESDTrack){
527 fNegativeTrackLorentzVector = new TLorentzVector(fCurrentNegativeESDTrack->Px(),fCurrentNegativeESDTrack->Py(),fCurrentNegativeESDTrack->Pz());
530 if(fPositiveTrackLorentzVector != NULL){
531 delete fPositiveTrackLorentzVector;
534 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveKFParticle->Px(),fCurrentPositiveKFParticle->Py(),fCurrentPositiveKFParticle->Pz());
536 else if(fUseESDTrack){
537 fPositiveTrackLorentzVector = new TLorentzVector(fCurrentPositiveESDTrack->Px(),fCurrentPositiveESDTrack->Py(),fCurrentPositiveESDTrack->Pz());
540 if(fMotherCandidateLorentzVector != NULL){
541 delete fMotherCandidateLorentzVector;
544 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
546 else if(fUseESDTrack){
547 fMotherCandidateLorentzVector = new TLorentzVector(*fNegativeTrackLorentzVector + *fPositiveTrackLorentzVector);
550 if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
551 fMotherCandidateLorentzVector->SetXYZM(fMotherCandidateLorentzVector->Px() ,fMotherCandidateLorentzVector->Py(),fMotherCandidateLorentzVector->Pz(),0.);
556 fMotherMCParticle= NULL;
557 fNegativeMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetNindex())->GetLabel()));
558 fPositiveMCParticle = fMCStack->Particle(TMath::Abs(fESDEvent->GetTrack(fCurrentV0->GetPindex())->GetLabel()));
559 if(fPositiveMCParticle->GetMother(0)>-1){
560 fMotherMCParticle = fMCStack->Particle(fPositiveMCParticle->GetMother(0));
566 Double_t containerInput[3];
568 containerInput[0] = GetMotherCandidatePt();
569 containerInput[1] = GetMotherCandidateEta();
570 containerInput[2] = GetMotherCandidateMass();
572 fCFManager->GetParticleContainer()->Fill(containerInput,kStepLikeSign); // for CF
573 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTPCRefit); // for CF
574 fCFManager->GetParticleContainer()->Fill(containerInput,kStepKinks); // for CF
578 if(fUseOwnXYZCalculation == kFALSE){
579 fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
585 GetConvPosXY(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField(),convpos);
586 fCurrentXValue = convpos[0];
587 fCurrentYValue = convpos[1];
588 fCurrentZValue = GetConvPosZ(GetPositiveESDTrack(),GetNegativeESDTrack(),GetMagneticField());
592 fUpdateV0AlreadyCalled = kTRUE;
599 Bool_t AliV0Reader::HasSameMCMother(){
600 //see header file for documentation
602 Bool_t iResult = kFALSE;
604 if(fNegativeMCParticle != NULL && fPositiveMCParticle != NULL){
605 if(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))
606 if(fMotherMCParticle){
614 Bool_t AliV0Reader::CheckPIDProbability(Double_t negProbCut, Double_t posProbCut){
615 //see header file for documentation
617 Bool_t iResult=kFALSE;
619 Double_t *posProbArray = new Double_t[10];
620 Double_t *negProbArray = new Double_t[10];
621 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
622 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
624 negTrack->GetTPCpid(negProbArray);
625 posTrack->GetTPCpid(posProbArray);
627 // if(negProbArray != NULL && posProbArray != NULL){ // this is not allowed anymore for some reason(RC19)
628 if(negProbArray && posProbArray){
629 if(negProbArray[GetSpeciesIndex(-1)]>=negProbCut && posProbArray[GetSpeciesIndex(1)]>=posProbCut){
633 delete [] posProbArray;
634 delete [] negProbArray;
638 void AliV0Reader::GetPIDProbability(Double_t &negPIDProb,Double_t & posPIDProb){
639 // see header file for documentation
641 Double_t *posProbArray = new Double_t[10];
642 Double_t *negProbArray = new Double_t[10];
643 AliESDtrack* negTrack = fESDEvent->GetTrack(fCurrentV0->GetNindex());
644 AliESDtrack* posTrack = fESDEvent->GetTrack(fCurrentV0->GetPindex());
646 negTrack->GetTPCpid(negProbArray);
647 posTrack->GetTPCpid(posProbArray);
649 // if(negProbArray!=NULL && posProbArray!=NULL){ // this is not allowed anymore for some reason(RC19)
650 if(negProbArray && posProbArray){
651 negPIDProb = negProbArray[GetSpeciesIndex(-1)];
652 posPIDProb = posProbArray[GetSpeciesIndex(1)];
654 delete [] posProbArray;
655 delete [] negProbArray;
658 void AliV0Reader::UpdateEventByEventData(){
659 //see header file for documentation
661 if(fCurrentEventGoodV0s.size() >0 ){
662 // fPreviousEventGoodV0s.clear();
663 // fPreviousEventGoodV0s = fCurrentEventGoodV0s;
664 if(fPreviousEventGoodV0s.size()>19){
665 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){
666 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());
667 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
671 for(UInt_t nCurrent=0;nCurrent<fCurrentEventGoodV0s.size();nCurrent++){
672 if(fPreviousEventGoodV0s.size()<20){
673 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
676 fPreviousEventGoodV0s.erase(fPreviousEventGoodV0s.begin());
677 fPreviousEventGoodV0s.push_back(fCurrentEventGoodV0s.at(nCurrent));
682 fCurrentEventGoodV0s.clear();
684 fCurrentV0IndexNumber=0;
688 Double_t AliV0Reader::GetNegativeTrackPhi() const{
689 //see header file for documentation
692 if(fNegativeTrackLorentzVector->Phi()> TMath::Pi()){
693 offset = -2*TMath::Pi();
695 return fNegativeTrackLorentzVector->Phi()+offset;
698 Double_t AliV0Reader::GetPositiveTrackPhi() const{
699 //see header file for documentation
702 if(fPositiveTrackLorentzVector->Phi()> TMath::Pi()){
703 offset = -2*TMath::Pi();
705 return fPositiveTrackLorentzVector->Phi()+offset;
708 Double_t AliV0Reader::GetMotherCandidatePhi() const{
709 //see header file for documentation
712 if(fMotherCandidateLorentzVector->Phi()> TMath::Pi()){
713 offset = -2*TMath::Pi();
715 return fMotherCandidateLorentzVector->Phi()+offset;
719 Double_t AliV0Reader::GetMotherCandidateRapidity() const{
720 //see header file for documentation
723 if(fMotherCandidateLorentzVector->Energy() - fMotherCandidateLorentzVector->Pz() == 0 || fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz() == 0) rapidity=0;
724 else rapidity = 0.5*(TMath::Log((fMotherCandidateLorentzVector->Energy() + fMotherCandidateLorentzVector->Pz()) / (fMotherCandidateLorentzVector->Energy()-fMotherCandidateLorentzVector->Pz())));
733 Int_t AliV0Reader::GetSpeciesIndex(Int_t chargeOfTrack){
734 //see header file for documentation
736 Int_t iResult = 10; // Unknown particle
738 if(chargeOfTrack==-1){ //negative track
739 switch(abs(fNegativeTrackPID)){
768 //Put in here for kSPECIES::kEleCon ????
771 else if(chargeOfTrack==1){ //positive track
772 switch(abs(fPositiveTrackPID)){
801 //Put in here for kSPECIES::kEleCon ????
805 //Wrong parameter.. Print warning
810 Bool_t AliV0Reader::GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]){
811 // see header file for documentation
813 Double_t pi = 3.14159265358979323846;
816 track->GetHelixParameters(helix,b);
818 Double_t xpos = helix[5];
819 Double_t ypos = helix[0];
820 Double_t radius = TMath::Abs(1./helix[4]);
821 Double_t phi = helix[2];
828 Double_t xpoint = radius * TMath::Cos(phi);
829 Double_t ypoint = radius * TMath::Sin(phi);
840 center[0] = xpos + xpoint;
841 center[1] = ypos + ypoint;
846 Bool_t AliV0Reader::GetConvPosXY(AliESDtrack* ptrack, AliESDtrack* ntrack, Double_t b, Double_t convpos[2]){
847 //see header file for documentation
849 Double_t helixcenterpos[2];
850 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
852 Double_t helixcenterneg[2];
853 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
855 Double_t poshelix[6];
856 ptrack->GetHelixParameters(poshelix,b);
857 Double_t posradius = TMath::Abs(1./poshelix[4]);
859 Double_t neghelix[6];
860 ntrack->GetHelixParameters(neghelix,b);
861 Double_t negradius = TMath::Abs(1./neghelix[4]);
863 Double_t xpos = helixcenterpos[0];
864 Double_t ypos = helixcenterpos[1];
865 Double_t xneg = helixcenterneg[0];
866 Double_t yneg = helixcenterneg[1];
868 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
869 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
876 Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b){
877 //see header file for documentation
879 Double_t helixpos[6];
880 ptrack->GetHelixParameters(helixpos,b);
882 Double_t helixneg[6];
883 ntrack->GetHelixParameters(helixneg,b);
885 Double_t negtrackradius = TMath::Abs(1./helixneg[4]);
886 Double_t postrackradius = TMath::Abs(1./helixpos[4]);
888 Double_t pi = 3.14159265358979323846;
891 GetConvPosXY(ptrack,ntrack,b,convpos);
893 Double_t convposx = convpos[0];
894 Double_t convposy = convpos[1];
896 Double_t helixcenterpos[2];
897 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
899 Double_t helixcenterneg[2];
900 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
902 Double_t xpos = helixcenterpos[0];
903 Double_t ypos = helixcenterpos[1];
904 Double_t xneg = helixcenterneg[0];
905 Double_t yneg = helixcenterneg[1];
907 Double_t deltaXPos = convposx - xpos;
908 Double_t deltaYPos = convposy - ypos;
910 Double_t deltaXNeg = convposx - xneg;
911 Double_t deltaYNeg = convposy - yneg;
913 Double_t alphaPos = pi + TMath::ATan2(-deltaYPos,-deltaXPos);
914 Double_t alphaNeg = pi + TMath::ATan2(-deltaYNeg,-deltaXNeg);
916 Double_t vertexXNeg = xneg + TMath::Abs(negtrackradius)*
917 TMath::Cos(alphaNeg);
918 Double_t vertexYNeg = yneg + TMath::Abs(negtrackradius)*
919 TMath::Sin(alphaNeg);
921 Double_t vertexXPos = xpos + TMath::Abs(postrackradius)*
922 TMath::Cos(alphaPos);
923 Double_t vertexYPos = ypos + TMath::Abs(postrackradius)*
924 TMath::Sin(alphaPos);
926 Double_t x0neg = helixneg[5];
927 Double_t y0neg = helixneg[0];
929 Double_t x0pos = helixpos[5];
930 Double_t y0pos = helixpos[0];
932 Double_t dNeg = TMath::Sqrt((vertexXNeg - x0neg)*(vertexXNeg - x0neg)
933 +(vertexYNeg - y0neg)*(vertexYNeg - y0neg));
935 Double_t dPos = TMath::Sqrt((vertexXPos - x0pos)*(vertexXPos - x0pos)
936 +(vertexYPos - y0pos)*(vertexYPos - y0pos));
938 Double_t rNeg = TMath::Sqrt(negtrackradius*negtrackradius -
941 Double_t rPos = TMath::Sqrt(postrackradius*postrackradius -
944 Double_t deltabetaNeg = 2*(pi + TMath::ATan2(-dNeg/2.,-rNeg));
945 Double_t deltabetaPos = 2*(pi + TMath::ATan2(-dPos/2.,-rPos));
947 Double_t deltaUNeg = negtrackradius*deltabetaNeg;
948 Double_t deltaUPos = postrackradius*deltabetaPos;
950 Double_t zphaseNeg = ntrack->GetZ() + deltaUNeg * ntrack->GetTgl();
951 Double_t zphasePos = ptrack->GetZ() + deltaUPos * ptrack->GetTgl();
954 (zphasePos*negtrackradius+zphaseNeg*postrackradius)/(negtrackradius+postrackradius);