]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliV0vertexer.cxx
Faster AliDebug. The debug message is evaluated after the check for the debug level...
[u/mrichter/AliRoot.git] / STEER / AliV0vertexer.cxx
index 08aab873db17bc5d818eaf36e8432e83877278e9..06d657a9bf1be9d74ccd5baa6267379d6a702c94 100644 (file)
@@ -19,6 +19,8 @@
 //                      fills the ESD with the V0s       
 //     Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch
 //-------------------------------------------------------------------------
+
+
 #include <TObjArray.h>
 #include <TTree.h>
 
 
 ClassImp(AliV0vertexer)
 
+
+//A set of very loose cuts 
+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::fgRmin=0.2;    //min radius of the fiducial volume
+Double_t AliV0vertexer::fgRmax=100.;   //max radius of the fiducial volume
+
 Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
   //--------------------------------------------------------------------
   //This function reconstructs V0 vertices
   //--------------------------------------------------------------------
+   const AliESDVertex *vtx=event->GetVertex();
+   Double_t xv=vtx->GetXv(), yv=vtx->GetYv(), zv=vtx->GetZv();
 
    Int_t nentr=event->GetNumberOfTracks();
    Double_t b=event->GetMagneticField();
@@ -54,7 +68,7 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
      if ((status&AliESDtrack::kITSrefit)==0)
         if (flags!=status) continue;
 
-     Double_t d=esdTrack->GetD(fX,fY,b);
+     Double_t d=esdTrack->GetD(xv,yv,b);
      if (TMath::Abs(d)<fDPmin) continue;
      if (TMath::Abs(d)>fRmax) continue;
 
@@ -71,8 +85,8 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
          Int_t pidx=pos[k];
         AliESDtrack *ptrk=event->GetTrack(pidx);
 
-         if (TMath::Abs(ntrk->GetD(fX,fY,b))<fDNmin)
-          if (TMath::Abs(ptrk->GetD(fX,fY,b))<fDNmin) continue;
+         if (TMath::Abs(ntrk->GetD(xv,yv,b))<fDNmin)
+          if (TMath::Abs(ptrk->GetD(xv,yv,b))<fDNmin) continue;
 
          Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
          if (dca > fDCAmax) continue;
@@ -99,23 +113,13 @@ Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
          nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
 
          AliESDv0 vertex(nt,nidx,pt,pidx);
-         if (vertex.GetChi2() > fChi2max) continue;
+         if (vertex.GetChi2V0() > fChi2max) continue;
         
-         /*  Think of something better here ! 
-         nt.PropagateToVertex(); if (TMath::Abs(nt.GetZ())<0.04) continue;
-         pt.PropagateToVertex(); if (TMath::Abs(pt.GetZ())<0.04) continue;
-        */
-
-         Double_t x,y,z; vertex.GetXYZ(x,y,z); 
-         Double_t px,py,pz; vertex.GetPxPyPz(px,py,pz);
-         Double_t p2=px*px+py*py+pz*pz;
-         Double_t cost=((x-fX)*px + (y-fY)*py + (z-fZ)*pz)/
-               TMath::Sqrt(p2*((x-fX)*(x-fX) + (y-fY)*(y-fY) + (z-fZ)*(z-fZ)));
-
-        //if (cost < (5*fCPAmax-0.9-TMath::Sqrt(r2)*(fCPAmax-1))/4.1) continue;
-         if (cost < fCPAmax) continue;
-        vertex.SetDcaDaughters(dca);
-         //vertex.ChangeMassHypothesis(); //default is Lambda0 
+        Float_t cpa=vertex.GetV0CosineOfPointingAngle(xv,yv,zv);
+        if (cpa < fCPAmax) continue;
+        vertex.SetDcaV0Daughters(dca);
+         vertex.SetV0CosineOfPointingAngle(cpa);
+         vertex.ChangeMassHypothesis(kK0Short);
 
          event->AddV0(&vertex);