]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSVertexerTracks.h
merging RecPoints and ClustersV2. All ClusterFinders produce AliITSRecPoints objects...
[u/mrichter/AliRoot.git] / ITS / AliITSVertexerTracks.h
1 #ifndef ALIITSVERTEXERTRACKS_H
2 #define ALIITSVERTEXERTRACKS_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 primary vertex determination with ITS tracks
9 //
10 //   Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
11 //           M.Masera,  Torino, massimo.masera@to.infn.it 
12 //-------------------------------------------------------
13
14 /*****************************************************************************
15  *                                                                           *
16  * This class determines the primary vertex position using ITS tracks.       *
17  * This is done in two steps:                                                *
18  * 1) Vertex Finding: a reasonable estimate of the vertex position is        *
19  *    obtained from a mean of "points of closest approach" between all       *
20  *    possible pairs of tracks.                                              *
21  * 2) Vertex Fitting: once tracks are propagated to the position given by    *
22  *    first step, the optimal estimate of the position of vertex is obtained *
23  *    from a weighted average of the track positions. A covariance           *
24  *    matrix and a chi2 for the vertex are given.                            *
25  *                                                                           *
26  *****************************************************************************/
27 #include "AliITSVertexer.h"
28 #include "AliITSSimpleVertex.h"
29
30 #include <TObjArray.h>
31
32 class TTree; 
33 class AliESDVertex; 
34 class AliITSSimpleVertex; 
35 class AliESD;
36 class AliITStrackV2;
37
38 class AliITSVertexerTracks : public AliITSVertexer {
39   
40  public:
41   // default constructor
42   AliITSVertexerTracks(); 
43   // standard constructor     
44   AliITSVertexerTracks(TFile *inFile,TFile *outFile,
45                        Int_t fEv=0,Int_t lEv=0,
46                        Double_t xStart=0.,Double_t yStart=0.);
47   // alternative constructor
48   AliITSVertexerTracks(TString fn,Double_t xStart=0,Double_t yStart=0); 
49   // destructor
50   virtual ~AliITSVertexerTracks();
51   // return vertex from the set of tracks in the tree
52   AliESDVertex* VertexOnTheFly(TTree &trkTree);
53   // computes the vertex for the current event
54   virtual AliESDVertex* FindPrimaryVertexForCurrentEvent(Int_t evnumb);
55   virtual AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb){
56     Warning(" FindVertexForCurrentEvent","Deprecated method use FindPrimaryVertexForCurrentEvent instead");
57     return FindPrimaryVertexForCurrentEvent(evnumb);
58   }
59   // computes the vertex for the current event using the ESD
60   AliESDVertex*         FindPrimaryVertexForCurrentEvent(AliESD *esdEvent);
61   AliESDVertex*         FindVertexForCurrentEvent(AliESD *esdEvent){
62     Warning(" FindVertexForCurrentEvent","Deprecated method use FindPrimaryVertexForCurrentEvent instead");
63     return FindPrimaryVertexForCurrentEvent(esdEvent);
64   }
65   // computes the vertex for each event and stores it on file
66   virtual void  FindVertices();
67   // computes the vertex for each event and stores it in the ESD
68   void FindVerticesESD();
69
70   // computes the vertex for selected tracks 
71   // (TrkPos=vector with track positions in ESD)
72   AliITSSimpleVertex* VertexForSelectedTracks(AliESD *esdEvent,Int_t nofCand, Int_t *trkPos, Int_t opt=1); 
73   // opt=1 (default) finds minimum-distance point among all the selected tracks
74   //       approximated as straight lines 
75   //       and uses errors on track parameters as weights
76   // opt=2 finds minimum-distance point among all the selected tracks
77   //       approximated as straight lines 
78   // opt=3 finds the average point among DCA points of all pairs of tracks
79   //       treated as helices
80   // opt=4 finds the average point among DCA points of all pairs of tracks
81   //       approximated as straight lines 
82   //       and uses errors on track parameters as weights
83   // opt=5 finds the average point among DCA points of all pairs of tracks
84   //       approximated as straight lines 
85
86
87   virtual void  PrintStatus() const;
88   void  SetMinTracks(Int_t n=2) { fMinTracks = n; return; }
89   void  SetSkipTracks(Int_t n,Int_t *skipped); 
90   void  SetVtxStart(Double_t x=0,Double_t y=0) 
91     { fNominalPos[0]=x; fNominalPos[1]=y; return; }
92   void  SetDCAcut(Double_t maxdca)
93     { fDCAcut=maxdca; return;}
94   
95  private:
96     // copy constructor (NO copy allowed: the constructor is protected
97     // to avoid misuse)
98     AliITSVertexerTracks(const AliITSVertexerTracks& vtxr);
99     // assignment operator (NO assignment allowed)
100     AliITSVertexerTracks& operator=(const AliITSVertexerTracks& /* vtxr */);
101   TFile    *fInFile;          // input file (with tracks)
102   TFile    *fOutFile;         // output file for vertices
103   AliITSSimpleVertex  fSimpVert; // vertex after vertex finder
104   Double_t  fNominalPos[2];   // initial knowledge on vertex position
105   Int_t     fMinTracks;       // minimum number of tracks
106   Double_t  fDCAcut;          // maximum DCA between 2 tracks used for vertex
107   Double_t  fMaxChi2PerTrack; // maximum contribition to the chi2 
108   TObjArray fTrkArray;        // array with tracks to be processed
109   Int_t     *fTrksToSkip;     // tracks to be skipped for find and fit 
110   Int_t     fNTrksToSkip;     // number of tracks to be skipped 
111
112   Bool_t   CheckField() const; 
113   void     ComputeMaxChi2PerTrack(Int_t nTracks);
114   Int_t    PrepareTracks(TTree &trkTree);
115   Int_t    PrepareTracks(AliESD* esdEvent,Int_t NofCand, Int_t *TrkPos);
116   Double_t Prepare(AliITStrackV2* itstrack);
117   void     TooFewTracks();
118   void     VertexFinder(Int_t OptUseWeights=0);
119   void     HelixVertexFinder();
120   void     StrLinVertexFinderMinDist(Int_t OptUseWeights=0);
121   static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t m[][3],Double_t *d);
122   static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t *sigmasq,Double_t m[][3],Double_t *d);
123   static Double_t GetStrLinMinDist(Double_t *p0,Double_t *p1,Double_t *x0);
124   static Double_t GetDeterminant3X3(Double_t matr[][3]);
125  
126   void     VertexFitter();
127
128   ClassDef(AliITSVertexerTracks,1) // 3D Vertexing with ITS tracks 
129 };
130
131 #endif
132
133
134