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