]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliVertexerTracks.h
Added test for existence of the vertex (fixes crash)
[u/mrichter/AliRoot.git] / STEER / AliVertexerTracks.h
1 #ifndef ALIVERTEXERTRACKS_H
2 #define ALIVERTEXERTRACKS_H
3 /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6
7 //-------------------------------------------------------
8 // Class for vertex determination with ESD tracks
9 //
10 //   Origin: AliITSVertexerTracks  
11 //           A.Dainese, Padova, andrea.dainese@pd.infn.it
12 //           M.Masera,  Torino, massimo.masera@to.infn.it 
13 //   Moved to STEER and adapted to ESD tracks: 
14 //           F.Prino, Torino, prino@to.infn.it 
15 //-------------------------------------------------------
16
17 /*****************************************************************************
18  *                                                                           *
19  * This class determines the vertex of a set of ESD tracks.                  *
20  * Different algorithms are implemented, see data member fAlgo.              *
21  *                                                                           *
22  *****************************************************************************/
23
24 #include "AliESDVertex.h"
25 #include "AliTracker.h"
26
27 #include <TObjArray.h>
28
29 class TTree; 
30 class AliESD;
31
32 class AliVertexerTracks : public TObject {
33   
34  public:
35   AliVertexerTracks(); 
36   AliVertexerTracks(Double_t xStart, Double_t yStart); 
37   virtual ~AliVertexerTracks();
38
39   AliESDVertex *FindVertex(const AliESD *event);
40
41   // computes the vertex from the set of tracks in the tree
42   AliVertex* VertexForSelectedTracks(TTree *trkTree);
43   AliVertex* VertexForSelectedTracks(TObjArray *trkArray);
44   
45   void  SetMinTracks(Int_t n=2) { fMinTracks = n; return; }
46   void  SetVtxStart(Double_t x=0,Double_t y=0) 
47     { fNominalPos[0]=x; fNominalPos[1]=y; return; }
48   void  SetDCAcut(Double_t maxdca)
49     { fDCAcut=maxdca; return;}
50   void SetFinderAlgorithm(Int_t opt=1) 
51     { fAlgo=opt; return;}
52   
53  protected:
54   Double_t   GetField() const { return AliTracker::GetBz();} 
55
56   Int_t PrepareTracks(TTree &trkTree);
57   void     VertexFinder(Int_t optUseWeights=0);
58   void     HelixVertexFinder();
59   void     StrLinVertexFinderMinDist(Int_t OptUseWeights=0);
60   static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t m[][3],Double_t *d);
61   static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t *sigmasq,Double_t m[][3],Double_t *d);
62   static Double_t GetStrLinMinDist(Double_t *p0,Double_t *p1,Double_t *x0);
63   static Double_t GetDeterminant3X3(Double_t matr[][3]);
64
65   AliESDVertex fVert;         // vertex after vertex finder
66   Double_t  fNominalPos[2];   // initial knowledge on vertex position
67   Int_t     fMinTracks;       // minimum number of tracks
68   TObjArray fTrkArray;        // array with tracks to be processed
69   Double_t  fDCAcut;          // maximum DCA between 2 tracks used for vertex
70   Int_t     fAlgo;            // option for vertex finding algorythm
71   // fAlgo=1 (default) finds minimum-distance point among all selected tracks
72   //         approximated as straight lines 
73   //         and uses errors on track parameters as weights
74   // fAlgo=2 finds minimum-distance point among all the selected tracks
75   //         approximated as straight lines 
76   // fAlgo=3 finds the average point among DCA points of all pairs of tracks
77   //         treated as helices
78   // fAlgo=4 finds the average point among DCA points of all pairs of tracks
79   //         approximated as straight lines 
80   //         and uses errors on track parameters as weights
81   // fAlgo=5 finds the average point among DCA points of all pairs of tracks
82   //         approximated as straight lines 
83
84
85   ClassDef(AliVertexerTracks,2) // 3D Vertexing with ESD tracks 
86 };
87
88 #endif
89
90
91