]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliV0vertexer.cxx
The track number and track pid associated with the cluster are included
[u/mrichter/AliRoot.git] / STEER / AliV0vertexer.cxx
index 96a63fa745ea561f593c2ef85c01921f91c68209..43e9cc2c202a12aae6ecaaf77b7d220814882bc9 100644 (file)
 //               Implementation of the V0 vertexer class
 //                  reads tracks writes out V0 vertices
 //                      fills the ESD with the V0s       
-//     Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch
+//     Origin: Iouri Belikov, IPHC, Strasbourg, Jouri.Belikov@cern.ch
 //-------------------------------------------------------------------------
 
 
-#include <TObjArray.h>
-#include <TTree.h>
-
 #include "AliESDEvent.h"
 #include "AliESDv0.h"
-#include "AliESDtrack.h"
 #include "AliV0vertexer.h"
-#include "AliESDVertex.h"
 
 ClassImp(AliV0vertexer)
 
@@ -46,16 +41,20 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
   //--------------------------------------------------------------------
   //This function reconstructs V0 vertices
   //--------------------------------------------------------------------
-   const AliESDVertex *vtx=event->GetVertex();
-   Double_t xv=vtx->GetXv(), yv=vtx->GetYv(), zv=vtx->GetZv();
+
+   const AliESDVertex *vtxT3D=event->GetPrimaryVertex();
+
+   Double_t xPrimaryVertex=vtxT3D->GetXv();
+   Double_t yPrimaryVertex=vtxT3D->GetYv();
+   Double_t zPrimaryVertex=vtxT3D->GetZv();
 
    Int_t nentr=event->GetNumberOfTracks();
    Double_t b=event->GetMagneticField();
 
    if (nentr<2) return 0; 
 
-   TArrayI neg(nentr/2);
-   TArrayI pos(nentr/2);
+   TArrayI neg(nentr);
+   TArrayI pos(nentr);
 
    Int_t nneg=0, npos=0, nvtx=0;
 
@@ -67,7 +66,7 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
      if ((status&AliESDtrack::kITSrefit)==0)
         if ((status&AliESDtrack::kTPCrefit)==0) continue;
 
-     Double_t d=esdTrack->GetD(xv,yv,b);
+     Double_t d=esdTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
      if (TMath::Abs(d)<fDPmin) continue;
      if (TMath::Abs(d)>fRmax) continue;
 
@@ -84,8 +83,8 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
          Int_t pidx=pos[k];
         AliESDtrack *ptrk=event->GetTrack(pidx);
 
-         if (TMath::Abs(ntrk->GetD(xv,yv,b))<fDNmin)
-          if (TMath::Abs(ptrk->GetD(xv,yv,b))<fDNmin) continue;
+         if (TMath::Abs(ntrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin)
+          if (TMath::Abs(ptrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin) continue;
 
          Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
          if (dca > fDCAmax) continue;
@@ -114,7 +113,7 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
          AliESDv0 vertex(nt,nidx,pt,pidx);
          if (vertex.GetChi2V0() > fChi2max) continue;
         
-        Float_t cpa=vertex.GetV0CosineOfPointingAngle(xv,yv,zv);
+        Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
         if (cpa < fCPAmin) continue;
         vertex.SetDcaV0Daughters(dca);
          vertex.SetV0CosineOfPointingAngle(cpa);