]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliVertexerTracks.h
By default all events go into one run-loader's file. Allows to remove the correspondi...
[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 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 tracks.                      *
20  * Different algorithms are implemented, see data member fAlgo.              *
21  *                                                                           *
22  *****************************************************************************/
23
24 #include <TObjArray.h>
25 #include <TMatrixD.h>
26
27 #include "AliESDVertex.h"
28 #include "AliExternalTrackParam.h"
29 #include "AliLog.h"
30
31 class AliVEvent;
32 class AliESDEvent;
33
34 class AliVertexerTracks : public TObject {
35   
36  public:
37   AliVertexerTracks(); 
38   AliVertexerTracks(Double_t fieldkG); 
39   virtual ~AliVertexerTracks();
40
41   AliESDVertex* FindPrimaryVertex(const AliVEvent *vEvent);
42   AliESDVertex* FindPrimaryVertex(TObjArray *trkArrayOrig,UShort_t *idOrig);
43   AliESDVertex* VertexForSelectedTracks(TObjArray *trkArray,UShort_t *id,
44                                         Bool_t optUseFitter=kTRUE,
45                                         Bool_t optPropagate=kTRUE);
46   AliESDVertex* VertexForSelectedESDTracks(TObjArray *trkArray,
47                                         Bool_t optUseFitter=kTRUE,
48                                         Bool_t optPropagate=kTRUE);
49   AliESDVertex* RemoveTracksFromVertex(AliESDVertex *inVtx,
50                                        TObjArray *trkArray,UShort_t *id,
51                                        Float_t *diamondxy); 
52   void  SetITSMode(Double_t dcacut=0.1,
53                    Double_t dcacutIter0=0.1,
54                    Double_t maxd0z0=0.5,
55                    Int_t minCls=5,
56                    Int_t mintrks=1,
57                    Double_t nsigma=3.,
58                    Double_t mindetfitter=100.,
59                    Double_t maxtgl=1000.,
60                    Double_t fidR=3.,
61                    Double_t fidZ=30.,
62                    Int_t finderAlgo=1,
63                    Int_t finderAlgoIter0=4); 
64   void  SetTPCMode(Double_t dcacut=0.1,
65                    Double_t dcacutIter0=1.0,
66                    Double_t maxd0z0=5.0,
67                    Int_t minCls=10,
68                    Int_t mintrks=1,
69                    Double_t nsigma=3.,
70                    Double_t mindetfitter=0.1,
71                    Double_t maxtgl=1.5, 
72                    Double_t fidR=3.,
73                    Double_t fidZ=30.,
74                    Int_t finderAlgo=1,
75                    Int_t finderAlgoIter0=4); 
76   void  SetCuts(Double_t *cuts);
77   void  SetConstraintOff() { fConstraint=kFALSE; return; }
78   void  SetConstraintOn() { fConstraint=kTRUE; return; }
79   void  SetDCAcut(Double_t maxdca) { fDCAcut=maxdca; return; }
80   void  SetDCAcutIter0(Double_t maxdca) { fDCAcutIter0=maxdca; return; }
81   void  SetFinderAlgorithm(Int_t opt=1) { fAlgo=opt; return; }
82   void  SetITSrefitRequired() { fITSrefit=kTRUE; return; }
83   Bool_t GetITSrefitRequired() const { return fITSrefit; }
84   void  SetITSrefitNotRequired() { fITSrefit=kFALSE; return; }
85   void  SetFiducialRZ(Double_t r=3,Double_t z=30) { fFiducialR=r; fFiducialZ=z; return; }
86   void  SetMaxd0z0(Double_t maxd0z0=0.5) { fMaxd0z0=maxd0z0; return; }
87   void  SetMinClusters(Int_t n=5) { fMinClusters=n; return; }
88   Int_t GetMinClusters() const { return fMinClusters; }
89   void  SetMinTracks(Int_t n=1) { fMinTracks=n; return; }
90   void  SetNSigmad0(Double_t n=3) { fNSigma=n; return; }
91   Double_t GetNSigmad0() const { return fNSigma; }
92   void  SetMinDetFitter(Double_t mindet=100.) { fMinDetFitter=mindet; return; }
93   void  SetMaxTgl(Double_t maxtgl=1.) { fMaxTgl=maxtgl; return; }
94   void  SetOnlyFitter() { if(!fConstraint) AliFatal("Set constraint first!"); 
95      fOnlyFitter=kTRUE; return; }
96   void  SetSkipTracks(Int_t n,Int_t *skipped);
97   void  SetVtxStart(Double_t x=0,Double_t y=0,Double_t z=0) 
98     { fNominalPos[0]=x; fNominalPos[1]=y; fNominalPos[2]=z; return; }
99   void  SetVtxStartSigma(Double_t sx=3.,Double_t sy=3.,Double_t sz=15.) 
100     { fNominalCov[0]=sx*sx; fNominalCov[2]=sy*sy; fNominalCov[5]=sz*sz;
101       fNominalCov[1]=0.; fNominalCov[3]=0.; fNominalCov[4]=0.; return; }
102   void  SetVtxStart(AliESDVertex *vtx);
103   static Double_t GetStrLinMinDist(Double_t *p0,Double_t *p1,Double_t *x0);
104   static Double_t GetDeterminant3X3(Double_t matr[][3]);
105   static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t (*m)[3],Double_t *d);
106   static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t *sigmasq,Double_t (*m)[3],Double_t *d);
107   static AliESDVertex TrackletVertexFinder(TClonesArray *lines, Int_t optUseWeights=0);
108   void     SetFieldkG(Double_t field=-999.) { fFieldkG=field; return; }
109   Double_t GetFieldkG() const { 
110     if(fFieldkG<-99.) AliFatal("Field value not set");
111     return fFieldkG; } 
112   void SetNSigmaForUi00(Double_t n=1.5) { fnSigmaForUi00=n; return; }
113   Double_t GetNSigmaForUi00() const { return fnSigmaForUi00; }
114
115  protected:
116   void     HelixVertexFinder();
117   void     OneTrackVertFinder();
118   Int_t    PrepareTracks(TObjArray &trkArrayOrig,UShort_t *idOrig,
119                          Int_t optImpParCut);
120   Bool_t   PropagateTrackTo(AliExternalTrackParam *track,
121                             Double_t xToGo);
122   Bool_t   TrackToPoint(AliExternalTrackParam *t,
123                         TMatrixD &ri,TMatrixD &wWi,
124                         Bool_t uUi3by3=kFALSE) const;     
125   void     VertexFinder(Int_t optUseWeights=0);
126   void     VertexFitter();
127   void     StrLinVertexFinderMinDist(Int_t optUseWeights=0);
128   void     TooFewTracks();
129
130   AliESDVertex fVert;         // vertex after vertex finder
131   AliESDVertex *fCurrentVertex;  // ESD vertex after fitter
132   UShort_t  fMode;            // 0 ITS+TPC; 1 TPC
133   Double_t  fFieldkG;         // z component of field (kGauss) 
134   Double_t  fNominalPos[3];   // initial knowledge on vertex position
135   Double_t  fNominalCov[6];   // initial knowledge on vertex position
136   TObjArray fTrkArraySel;     // array with tracks to be processed
137   UShort_t  *fIdSel;          // IDs of the tracks (AliESDtrack::GetID())
138   Int_t     *fTrksToSkip;     // track IDs to be skipped for find and fit 
139   Int_t     fNTrksToSkip;     // number of tracks to be skipped 
140   Bool_t    fConstraint;      // true when "mean vertex" was set in 
141                               // fNominal ... and must be used in the fit
142   Bool_t    fOnlyFitter;      // primary with one fitter shot only
143                               // (use only with beam constraint)
144   Int_t     fMinTracks;       // minimum number of tracks
145   Int_t     fMinClusters;     // minimum number of ITS or TPC clusters per track
146   Double_t  fDCAcut;          // maximum DCA between 2 tracks used for vertex
147   Double_t  fDCAcutIter0;     // maximum DCA between 2 tracks used for vertex
148   Double_t  fNSigma;          // number of sigmas for d0 cut in PrepareTracks()
149   Double_t  fMaxd0z0;         // value for sqrt(d0d0+z0z0) cut 
150                               // in PrepareTracks(1) if fConstraint=kFALSE
151   Double_t  fMinDetFitter;    // minimum determinant to try to invertex matrix
152   Double_t  fMaxTgl;          // maximum tgl of tracks
153   Bool_t    fITSrefit;        // if kTRUE (default), use only kITSrefit tracks
154                               // if kFALSE, use all tracks (also TPC only)
155   Double_t  fFiducialR;       // radius of fiducial cylinder for tracks 
156   Double_t  fFiducialZ;       // length of fiducial cylinder for tracks
157   Double_t  fnSigmaForUi00;   // n. sigmas from finder in TrackToPoint
158   Int_t     fAlgo;            // option for vertex finding algorythm
159   Int_t     fAlgoIter0;       // this is for iteration 0
160   // fAlgo=1 (default) finds minimum-distance point among all selected tracks
161   //         approximated as straight lines 
162   //         and uses errors on track parameters as weights
163   // fAlgo=2 finds minimum-distance point among all the selected tracks
164   //         approximated as straight lines 
165   // fAlgo=3 finds the average point among DCA points of all pairs of tracks
166   //         treated as helices
167   // fAlgo=4 finds the average point among DCA points of all pairs of tracks
168   //         approximated as straight lines 
169   //         and uses errors on track parameters as weights
170   // fAlgo=5 finds the average point among DCA points of all pairs of tracks
171   //         approximated as straight lines 
172
173
174  private:
175   AliVertexerTracks(const AliVertexerTracks & source);
176   AliVertexerTracks & operator=(const AliVertexerTracks & source);
177
178   ClassDef(AliVertexerTracks,12) // 3D Vertexing with tracks 
179 };
180
181 #endif
182