2d57349e |
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 | //------------------------------------------------------- |
6d8df534 |
8 | // Class for vertex determination with tracks |
2d57349e |
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 | * * |
6d8df534 |
19 | * This class determines the vertex of a set of tracks. * |
2d57349e |
20 | * Different algorithms are implemented, see data member fAlgo. * |
21 | * * |
22 | *****************************************************************************/ |
23 | |
2d57349e |
24 | #include <TObjArray.h> |
817e1004 |
25 | #include <TMatrixD.h> |
2d57349e |
26 | |
6d8df534 |
27 | #include "AliLog.h" |
f5740e9a |
28 | #include "AliESDVertex.h" |
6d8df534 |
29 | |
817e1004 |
30 | |
f5740e9a |
31 | class AliExternalTrackParam; |
0aa2faf4 |
32 | class AliVEvent; |
3f2db92f |
33 | class AliESDEvent; |
8e104736 |
34 | class AliStrLine; |
2d57349e |
35 | |
36 | class AliVertexerTracks : public TObject { |
37 | |
38 | public: |
3f2db92f |
39 | enum {kTOFBCShift=200, |
40 | kStrLinVertexFinderMinDist1=1, |
41 | kStrLinVertexFinderMinDist0=2, |
42 | kHelixVertexFinder=3, |
43 | kVertexFinder1=4, |
44 | kVertexFinder0=5, |
45 | kMultiVertexer=6}; |
46 | enum {kBitUsed = BIT(16),kBitAccounted = BIT(17)}; |
2d57349e |
47 | AliVertexerTracks(); |
dc3719f3 |
48 | AliVertexerTracks(Double_t fieldkG); |
2d57349e |
49 | virtual ~AliVertexerTracks(); |
50 | |
f5740e9a |
51 | AliESDVertex* FindPrimaryVertex(const AliVEvent *vEvent); |
52 | AliESDVertex* FindPrimaryVertex(const TObjArray *trkArrayOrig,UShort_t *idOrig); |
53 | AliESDVertex* VertexForSelectedTracks(const TObjArray *trkArray,UShort_t *id, |
6d8df534 |
54 | Bool_t optUseFitter=kTRUE, |
97669588 |
55 | Bool_t optPropagate=kTRUE, |
56 | Bool_t optUseDiamondConstraint=kFALSE); |
6d8df534 |
57 | AliESDVertex* VertexForSelectedESDTracks(TObjArray *trkArray, |
58 | Bool_t optUseFitter=kTRUE, |
97669588 |
59 | Bool_t optPropagate=kTRUE, |
60 | Bool_t optUseDiamondConstraint=kFALSE); |
6d8df534 |
61 | AliESDVertex* RemoveTracksFromVertex(AliESDVertex *inVtx, |
f5740e9a |
62 | const TObjArray *trkArray,UShort_t *id, |
63 | const Float_t *diamondxy) const; |
6b908072 |
64 | AliESDVertex* RemoveConstraintFromVertex(AliESDVertex *inVtx, |
65 | Float_t *diamondxyz, |
66 | Float_t *diamondcov) const; |
a00021a7 |
67 | void SetITSMode(Double_t dcacut=0.1, |
68 | Double_t dcacutIter0=0.1, |
69 | Double_t maxd0z0=0.5, |
70 | Int_t minCls=5, |
71 | Int_t mintrks=1, |
72 | Double_t nsigma=3., |
73 | Double_t mindetfitter=100., |
74 | Double_t maxtgl=1000., |
75 | Double_t fidR=3., |
8c75f668 |
76 | Double_t fidZ=30., |
77 | Int_t finderAlgo=1, |
78 | Int_t finderAlgoIter0=4); |
a00021a7 |
79 | void SetTPCMode(Double_t dcacut=0.1, |
80 | Double_t dcacutIter0=1.0, |
81 | Double_t maxd0z0=5.0, |
82 | Int_t minCls=10, |
83 | Int_t mintrks=1, |
84 | Double_t nsigma=3., |
85 | Double_t mindetfitter=0.1, |
86 | Double_t maxtgl=1.5, |
87 | Double_t fidR=3., |
8c75f668 |
88 | Double_t fidZ=30., |
89 | Int_t finderAlgo=1, |
90 | Int_t finderAlgoIter0=4); |
8eaa1a42 |
91 | void SetCuts(Double_t *cuts, int ncuts); |
302c78d4 |
92 | void SetConstraintOff() { fConstraint=kFALSE; SetVtxStart(); SetVtxStartSigma(); return; } |
fee9ef0d |
93 | void SetConstraintOn() { fConstraint=kTRUE; return; } |
fee9ef0d |
94 | void SetDCAcut(Double_t maxdca) { fDCAcut=maxdca; return; } |
f09c879d |
95 | void SetDCAcutIter0(Double_t maxdca) { fDCAcutIter0=maxdca; return; } |
fee9ef0d |
96 | void SetFinderAlgorithm(Int_t opt=1) { fAlgo=opt; return; } |
6d8df534 |
97 | void SetITSrefitRequired() { fITSrefit=kTRUE; return; } |
40cfa14d |
98 | void SetITSpureSA() { fITSpureSA=kTRUE; return; } |
0aa2faf4 |
99 | Bool_t GetITSrefitRequired() const { return fITSrefit; } |
50ff0bcd |
100 | void SetITSrefitNotRequired() { fITSrefit=kFALSE; return; } |
6b29d399 |
101 | void SetFiducialRZ(Double_t r=3,Double_t z=30) { fFiducialR=r; fFiducialZ=z; return; } |
fee9ef0d |
102 | void SetMaxd0z0(Double_t maxd0z0=0.5) { fMaxd0z0=maxd0z0; return; } |
6b29d399 |
103 | void SetMinClusters(Int_t n=5) { fMinClusters=n; return; } |
0aa2faf4 |
104 | Int_t GetMinClusters() const { return fMinClusters; } |
6d8df534 |
105 | void SetMinTracks(Int_t n=1) { fMinTracks=n; return; } |
fee9ef0d |
106 | void SetNSigmad0(Double_t n=3) { fNSigma=n; return; } |
107 | Double_t GetNSigmad0() const { return fNSigma; } |
f09c879d |
108 | void SetMinDetFitter(Double_t mindet=100.) { fMinDetFitter=mindet; return; } |
109 | void SetMaxTgl(Double_t maxtgl=1.) { fMaxTgl=maxtgl; return; } |
fee9ef0d |
110 | void SetOnlyFitter() { if(!fConstraint) AliFatal("Set constraint first!"); |
111 | fOnlyFitter=kTRUE; return; } |
f5740e9a |
112 | void SetSkipTracks(Int_t n,const Int_t *skipped); |
3b768a1d |
113 | void SetVtxStart(Double_t x=0,Double_t y=0,Double_t z=0) |
07680cae |
114 | { fNominalPos[0]=x; fNominalPos[1]=y; fNominalPos[2]=z; return; } |
146c29df |
115 | void SetVtxStartSigma(Double_t sx=3.,Double_t sy=3.,Double_t sz=15.) |
50ff0bcd |
116 | { fNominalCov[0]=sx*sx; fNominalCov[2]=sy*sy; fNominalCov[5]=sz*sz; |
117 | fNominalCov[1]=0.; fNominalCov[3]=0.; fNominalCov[4]=0.; return; } |
118 | void SetVtxStart(AliESDVertex *vtx); |
ce1c94a7 |
119 | void SetSelectOnTOFBunchCrossing(Bool_t select=kFALSE,Bool_t keepAlsoUnflagged=kTRUE) {fSelectOnTOFBunchCrossing=select; fKeepAlsoUnflaggedTOFBunchCrossing=keepAlsoUnflagged; return;} |
3f2db92f |
120 | // |
f5740e9a |
121 | static Double_t GetStrLinMinDist(const Double_t *p0,const Double_t *p1,const Double_t *x0); |
71d84967 |
122 | static Double_t GetDeterminant3X3(Double_t matr[][3]); |
817e1004 |
123 | static void GetStrLinDerivMatrix(const Double_t *p0,const Double_t *p1,Double_t (*m)[3],Double_t *d); |
f5740e9a |
124 | static void GetStrLinDerivMatrix(const Double_t *p0,const Double_t *p1,const Double_t *sigmasq,Double_t (*m)[3],Double_t *d); |
125 | static AliESDVertex TrackletVertexFinder(const TClonesArray *lines, Int_t optUseWeights=0); |
8e104736 |
126 | static AliESDVertex TrackletVertexFinder(AliStrLine **lines, const Int_t knacc, Int_t optUseWeights=0); |
dc3719f3 |
127 | void SetFieldkG(Double_t field=-999.) { fFieldkG=field; return; } |
128 | Double_t GetFieldkG() const { |
129 | if(fFieldkG<-99.) AliFatal("Field value not set"); |
130 | return fFieldkG; } |
3b768a1d |
131 | void SetNSigmaForUi00(Double_t n=1.5) { fnSigmaForUi00=n; return; } |
132 | Double_t GetNSigmaForUi00() const { return fnSigmaForUi00; } |
3f2db92f |
133 | // |
134 | void SetMVTukey2(double t=6) {fMVTukey2 = t;} |
135 | void SetMVSig2Ini(double t=1e3) {fMVSig2Ini = t;} |
136 | void SetMVMaxSigma2(double t=3.) {fMVMaxSigma2 = t;} |
137 | void SetMVMinSig2Red(double t=0.005) {fMVMinSig2Red = t;} |
138 | void SetMVMinDst(double t=10e-4) {fMVMinDst = t;} |
139 | void SetMVScanStep(double t=2.) {fMVScanStep = t;} |
140 | void SetMVFinalWBinary(Bool_t v=kTRUE) {fMVFinalWBinary = v;} |
141 | void SetMVMaxWghNtr(double w=10.) {fMVMaxWghNtr = w;} |
142 | // |
143 | void FindVerticesMV(); |
144 | Bool_t FindNextVertexMV(); |
145 | // |
146 | AliESDVertex* GetCurrentVertex() const {return (AliESDVertex*)fCurrentVertex;} |
147 | TObjArray* GetVerticesArray() const {return (TObjArray*)fMVVertices;} // RS to be removed |
148 | void AnalyzePileUp(AliESDEvent* esdEv); |
149 | void SetBCSpacing(Int_t ns=50) {fBCSpacing = ns;} |
7878b3ae |
150 | |
151 | // Configuration of multi-vertexing vis pre-clusterization of tracks |
152 | void SetUseTrackClusterization(Bool_t opt=kFALSE){fClusterize=opt;} |
153 | void SetDeltaZCutForCluster(Double_t cut){fDeltaZCutForCluster=cut;} |
154 | void SetnSigmaZCutForCluster(Double_t cut){fnSigmaZCutForCluster=cut;} |
155 | |
156 | Bool_t GetUseTrackClusterization() const {return fClusterize;} |
157 | Double_t GetDeltaZCutForCluster() const {return fDeltaZCutForCluster;} |
158 | Double_t GetnSigmaZCutForCluster() const {return fnSigmaZCutForCluster;} |
159 | |
160 | |
3f2db92f |
161 | // |
2d57349e |
162 | protected: |
fee9ef0d |
163 | void HelixVertexFinder(); |
0c69be49 |
164 | void OneTrackVertFinder(); |
f5740e9a |
165 | Int_t PrepareTracks(const TObjArray &trkArrayOrig,const UShort_t *idOrig, |
6d8df534 |
166 | Int_t optImpParCut); |
f09c879d |
167 | Bool_t PropagateTrackTo(AliExternalTrackParam *track, |
168 | Double_t xToGo); |
6d8df534 |
169 | Bool_t TrackToPoint(AliExternalTrackParam *t, |
817e1004 |
170 | TMatrixD &ri,TMatrixD &wWi, |
0bf2e2b4 |
171 | Bool_t uUi3by3=kFALSE) const; |
2d57349e |
172 | void VertexFinder(Int_t optUseWeights=0); |
3f2db92f |
173 | void VertexFitter(Bool_t vfit=kTRUE, Bool_t chiCalc=kTRUE,Int_t useWeights=0); |
fee9ef0d |
174 | void StrLinVertexFinderMinDist(Int_t optUseWeights=0); |
6d8df534 |
175 | void TooFewTracks(); |
eae1677e |
176 | |
7878b3ae |
177 | void FindAllVertices(Int_t nTrksOrig, const TObjArray *trkArrayOrig, Double_t* zTr, Double_t* err2zTr, UShort_t* idOrig); |
178 | |
146c29df |
179 | AliESDVertex fVert; // vertex after vertex finder |
ec1be5d5 |
180 | AliESDVertex *fCurrentVertex; // ESD vertex after fitter |
f09c879d |
181 | UShort_t fMode; // 0 ITS+TPC; 1 TPC |
dc3719f3 |
182 | Double_t fFieldkG; // z component of field (kGauss) |
07680cae |
183 | Double_t fNominalPos[3]; // initial knowledge on vertex position |
50ff0bcd |
184 | Double_t fNominalCov[6]; // initial knowledge on vertex position |
f09c879d |
185 | TObjArray fTrkArraySel; // array with tracks to be processed |
186 | UShort_t *fIdSel; // IDs of the tracks (AliESDtrack::GetID()) |
187 | Int_t *fTrksToSkip; // track IDs to be skipped for find and fit |
188 | Int_t fNTrksToSkip; // number of tracks to be skipped |
fee9ef0d |
189 | Bool_t fConstraint; // true when "mean vertex" was set in |
190 | // fNominal ... and must be used in the fit |
191 | Bool_t fOnlyFitter; // primary with one fitter shot only |
192 | // (use only with beam constraint) |
2d57349e |
193 | Int_t fMinTracks; // minimum number of tracks |
6b29d399 |
194 | Int_t fMinClusters; // minimum number of ITS or TPC clusters per track |
2d57349e |
195 | Double_t fDCAcut; // maximum DCA between 2 tracks used for vertex |
f09c879d |
196 | Double_t fDCAcutIter0; // maximum DCA between 2 tracks used for vertex |
07680cae |
197 | Double_t fNSigma; // number of sigmas for d0 cut in PrepareTracks() |
43c9dae1 |
198 | Double_t fMaxd0z0; // value for sqrt(d0d0+z0z0) cut |
fee9ef0d |
199 | // in PrepareTracks(1) if fConstraint=kFALSE |
f09c879d |
200 | Double_t fMinDetFitter; // minimum determinant to try to invertex matrix |
201 | Double_t fMaxTgl; // maximum tgl of tracks |
50ff0bcd |
202 | Bool_t fITSrefit; // if kTRUE (default), use only kITSrefit tracks |
203 | // if kFALSE, use all tracks (also TPC only) |
40cfa14d |
204 | Bool_t fITSpureSA; // if kFALSE (default) skip ITSpureSA tracks |
205 | // if kTRUE use only those |
6b29d399 |
206 | Double_t fFiducialR; // radius of fiducial cylinder for tracks |
207 | Double_t fFiducialZ; // length of fiducial cylinder for tracks |
3b768a1d |
208 | Double_t fnSigmaForUi00; // n. sigmas from finder in TrackToPoint |
f09c879d |
209 | Int_t fAlgo; // option for vertex finding algorythm |
3f2db92f |
210 | Int_t fAlgoIter0; // this is for iteration 0 |
2d57349e |
211 | // fAlgo=1 (default) finds minimum-distance point among all selected tracks |
212 | // approximated as straight lines |
213 | // and uses errors on track parameters as weights |
214 | // fAlgo=2 finds minimum-distance point among all the selected tracks |
215 | // approximated as straight lines |
216 | // fAlgo=3 finds the average point among DCA points of all pairs of tracks |
217 | // treated as helices |
218 | // fAlgo=4 finds the average point among DCA points of all pairs of tracks |
219 | // approximated as straight lines |
220 | // and uses errors on track parameters as weights |
221 | // fAlgo=5 finds the average point among DCA points of all pairs of tracks |
222 | // approximated as straight lines |
3f2db92f |
223 | // |
ce1c94a7 |
224 | Bool_t fSelectOnTOFBunchCrossing; // tracks from bunch crossing 0 |
225 | Bool_t fKeepAlsoUnflaggedTOFBunchCrossing; // also tracks w/o bunch crossing number (-1) |
3f2db92f |
226 | // parameters for multivertexer |
227 | Double_t fMVWSum; // sum of weights for multivertexer |
228 | Double_t fMVWE2; // sum of weighted chi2's for multivertexer |
229 | Double_t fMVTukey2; // Tukey constant for multivertexer |
230 | Double_t fMVSigma2; // chi2 current scaling param for multivertexer |
231 | Double_t fMVSig2Ini; // initial value for fMVSigma2 |
232 | Double_t fMVMaxSigma2; // max acceptable value for final fMVSigma2 |
233 | Double_t fMVMinSig2Red; // min reduction of fMVSigma2 to exit the loop |
234 | Double_t fMVMinDst; // min distance between vertices at two iterations to exit |
235 | Double_t fMVScanStep; // step of vertices scan |
236 | Double_t fMVMaxWghNtr; // min W-distance*Ncontr_min for close vertices |
237 | Bool_t fMVFinalWBinary; // for the final fit use binary weights |
238 | Int_t fBCSpacing; // BC Spacing in ns (will define the rounding of BCid) |
239 | TObjArray* fMVVertices; // array of found vertices |
7878b3ae |
240 | |
241 | Bool_t fClusterize; // flag to activate track clusterization into vertices before vertex finder |
242 | Double_t fDeltaZCutForCluster; // minimum distance in z between tracks to create new cluster |
243 | Double_t fnSigmaZCutForCluster; // minimum distacnce in number of sigma along z to create new cluster |
3f2db92f |
244 | // |
fe12e09c |
245 | private: |
246 | AliVertexerTracks(const AliVertexerTracks & source); |
247 | AliVertexerTracks & operator=(const AliVertexerTracks & source); |
2d57349e |
248 | |
7878b3ae |
249 | ClassDef(AliVertexerTracks,16) // 3D Vertexing with tracks |
2d57349e |
250 | }; |
251 | |
252 | #endif |
43c9dae1 |
253 | |