]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliV0vertexer.cxx
Memory leaks in TOF visualization code
[u/mrichter/AliRoot.git] / STEER / AliV0vertexer.cxx
index 451e5fb3fe565366a9fdf8e724be0ae1a977ea5d..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"
 
 ClassImp(AliV0vertexer)
@@ -37,7 +33,7 @@ Double_t AliV0vertexer::fgChi2max=33.; //max chi2
 Double_t AliV0vertexer::fgDNmin=0.05;  //min imp parameter for the 1st daughter
 Double_t AliV0vertexer::fgDPmin=0.05;  //min imp parameter for the 2nd daughter
 Double_t AliV0vertexer::fgDCAmax=0.5;  //max DCA between the daughter tracks
-Double_t AliV0vertexer::fgCPAmax=0.99; //max cosine of V0's pointing angle
+Double_t AliV0vertexer::fgCPAmin=0.99; //min cosine of V0's pointing angle
 Double_t AliV0vertexer::fgRmin=0.2;    //min radius of the fiducial volume
 Double_t AliV0vertexer::fgRmax=100.;   //max radius of the fiducial volume
 
@@ -45,30 +41,32 @@ 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;
 
    Int_t i;
    for (i=0; i<nentr; i++) {
      AliESDtrack *esdTrack=event->GetTrack(i);
-     UInt_t status=esdTrack->GetStatus();
-     UInt_t flags=AliESDtrack::kITSin|AliESDtrack::kTPCin|
-                  AliESDtrack::kTPCpid|AliESDtrack::kESDpid;
+     ULong_t status=esdTrack->GetStatus();
 
      if ((status&AliESDtrack::kITSrefit)==0)
-        if (flags!=status) continue;
+        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;
 
@@ -85,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;
@@ -115,8 +113,8 @@ 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);
-        if (cpa < fCPAmax) continue;
+        Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
+        if (cpa < fCPAmin) continue;
         vertex.SetDcaV0Daughters(dca);
          vertex.SetV0CosineOfPointingAngle(cpa);
          vertex.ChangeMassHypothesis(kK0Short);