]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliCascadeVertexer.cxx
Introduced option for the first and last event to process
[u/mrichter/AliRoot.git] / ITS / AliCascadeVertexer.cxx
index 2eede113605286e7b40267ac7e7185304fbe265c..f0d76679833fe16637f049690411ff5f052b9a61 100644 (file)
@@ -15,7 +15,8 @@
 
 //-------------------------------------------------------------------------
 //               Implementation of the cascade vertexer class
-//
+//          Reads V0s and tracks, writes out cascade vertices
+//                     Fills the ESD with the cascades 
 //    Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr
 //-------------------------------------------------------------------------
 #include <TObjArray.h>
@@ -23,7 +24,6 @@
 
 #include "AliESD.h"
 #include "AliESDv0.h"
-#include "AliESDcascade.h"
 #include "AliCascadeVertex.h"
 #include "AliCascadeVertexer.h"
 #include "AliITStrackV2.h"
@@ -50,10 +50,20 @@ Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESD *event) {
    TObjArray trks(ntr);
    for (i=0; i<ntr; i++) {
        AliESDtrack *esdtr=event->GetTrack(i);
+       UInt_t status=esdtr->GetStatus();
+       UInt_t flags=AliESDtrack::kITSin|AliESDtrack::kTPCin;
+
+       if ((status&AliESDtrack::kITSrefit)==0)
+          if ((status&flags)!=status) continue;
+
        AliITStrackV2 *iotrack=new AliITStrackV2(*esdtr);
-       iotrack->PropagateTo(3.,0.0023,65.19); iotrack->PropagateTo(2.5,0.,0.);
+       iotrack->SetLabel(i);  // now it is the index in array of ESD tracks
+       if ((status&AliESDtrack::kITSrefit)==0)   //correction for the beam pipe
+          if (!iotrack->PropagateTo(3.,0.0023,65.19)) continue; 
+       if (!iotrack->PropagateTo(2.5,0.,0.)) continue;
        trks.AddLast(iotrack);
    }   
+   ntr=trks.GetEntriesFast();
 
    Double_t massLambda=1.11568;
    Int_t ncasc=0;
@@ -68,7 +78,7 @@ Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESD *event) {
         AliITStrackV2 *b=(AliITStrackV2*)trks.UncheckedAt(j);
 
          if (TMath::Abs(b->GetD())<fDBachMin) continue;
-         if (b->Get1Pt()<0.) continue;  // bachelor's charge 
+         if (b->Get1Pt()>0.) continue;  // bachelor's charge 
           
         AliV0vertex v0(*v), *pv0=&v0;
          AliITStrackV2 bt(*b), *pbt=&bt;
@@ -114,7 +124,7 @@ Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESD *event) {
         AliITStrackV2 *b=(AliITStrackV2*)trks.UncheckedAt(j);
 
          if (TMath::Abs(b->GetD())<fDBachMin) continue;
-         if (b->Get1Pt()>0.) continue;  // bachelor's charge 
+         if (b->Get1Pt()<0.) continue;  // bachelor's charge 
           
         AliV0vertex v0(*v), *pv0=&v0;
          AliITStrackV2 bt(*b), *pbt=&bt;
@@ -163,6 +173,9 @@ V0sTracks2CascadeVertices(TTree *vTree,TTree *tTree, TTree *xTree) {
   //--------------------------------------------------------------------
   // This function reconstructs cascade vertices
   //--------------------------------------------------------------------
+  Warning("V0sTracks2CascadeVertices(TTree*,TTree*,TTree*)",
+  "Will be removed soon !  Use V0sTracks2CascadeVertices(AliESD*) instead");
+
    TBranch *branch=vTree->GetBranch("vertices");
    if (!branch) {
       Error("V0sTracks2CascadeVertices","Can't get the V0 branch !");
@@ -204,7 +217,8 @@ V0sTracks2CascadeVertices(TTree *vTree,TTree *tTree, TTree *xTree) {
        branch->SetAddress(&iotrack);
        tTree->GetEvent(i);
 
-       iotrack->PropagateTo(3.,0.0023,65.19); iotrack->PropagateTo(2.5,0.,0.);
+       if (!iotrack->PropagateTo(3.,0.0023,65.19)) continue; 
+       if (!iotrack->PropagateTo(2.5,0.,0.)) continue;
 
        ntrack++; trks.AddLast(iotrack);
        
@@ -240,8 +254,8 @@ V0sTracks2CascadeVertices(TTree *vTree,TTree *tTree, TTree *xTree) {
 
           if (TMath::Abs(bachtrk->GetD())<fDBachMin) continue;        // eliminate to small impact parameters
 
-          if (lV0ver->GetPdgCode()==kLambda0 && bachtrk->Get1Pt()<0.) continue;     // condition on V0 label 
-          if (lV0ver->GetPdgCode()==kLambda0Bar && bachtrk->Get1Pt()>0.) continue;  // + good sign for bachelor
+          if (lV0ver->GetPdgCode()==kLambda0 && bachtrk->Get1Pt()>0.) continue;     // condition on V0 label 
+          if (lV0ver->GetPdgCode()==kLambda0Bar && bachtrk->Get1Pt()<0.) continue;  // + good sign for bachelor
           
          AliV0vertex lV0(*lV0ver), *pV0=&lV0;
           AliITStrackV2 bt(*bachtrk), *pbt=&bt;