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 */
7 //-------------------------------------------------------
8 // Class for primary vertex determination with ITS tracks
10 // Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
11 // M.Masera, Torino, massimo.masera@to.infn.it
12 //-------------------------------------------------------
14 /*****************************************************************************
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. *
26 *****************************************************************************/
28 #include "AliKalmanTrack.h"
29 #include "AliITSVertexer.h"
30 #include "AliITSSimpleVertex.h"
32 #include <TObjArray.h>
36 class AliITSSimpleVertex;
40 class AliITSVertexerTracks : public AliITSVertexer {
43 // default constructor
44 AliITSVertexerTracks();
45 // standard constructor
46 AliITSVertexerTracks(TFile *inFile,TFile *outFile,
47 const AliMagF *map,Int_t fEv=0,Int_t lEv=0,
48 Double_t xStart=0.,Double_t yStart=0.);
49 // alternative constructor
50 AliITSVertexerTracks(const AliMagF *map, TString fn,
51 Double_t xStart=0,Double_t yStart=0);
53 virtual ~AliITSVertexerTracks();
54 // return vertex from the set of tracks in the tree
55 AliESDVertex* VertexOnTheFly(TTree &trkTree);
56 // computes the vertex for the current event
57 virtual AliESDVertex* FindPrimaryVertexForCurrentEvent(Int_t evnumb);
58 virtual AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb){
59 Warning(" FindVertexForCurrentEvent","Deprecated method use FindPrimaryVertexForCurrentEvent instead");
60 return FindPrimaryVertexForCurrentEvent(evnumb);
62 // computes the vertex for the current event using the ESD
63 AliESDVertex* FindPrimaryVertexForCurrentEvent(AliESD *esdEvent);
64 AliESDVertex* FindVertexForCurrentEvent(AliESD *esdEvent){
65 Warning(" FindVertexForCurrentEvent","Deprecated method use FindPrimaryVertexForCurrentEvent instead");
66 return FindPrimaryVertexForCurrentEvent(esdEvent);
68 // computes the vertex for each event and stores it on file
69 virtual void FindVertices();
70 // computes the vertex for each event and stores it in the ESD
71 void FindVerticesESD();
73 // computes the vertex for selected tracks
74 // (TrkPos=vector with track positions in ESD)
75 AliITSSimpleVertex* VertexForSelectedTracks(AliESD *esdEvent,Int_t nofCand, Int_t *trkPos, Int_t opt=1);
76 // opt=1 (default) finds minimum-distance point among all the selected tracks
77 // approximated as straight lines
78 // and uses errors on track parameters as weights
79 // opt=2 finds minimum-distance point among all the selected tracks
80 // approximated as straight lines
81 // opt=3 finds the average point among DCA points of all pairs of tracks
83 // opt=4 finds the average point among DCA points of all pairs of tracks
84 // approximated as straight lines
85 // and uses errors on track parameters as weights
86 // opt=5 finds the average point among DCA points of all pairs of tracks
87 // approximated as straight lines
90 virtual void PrintStatus() const;
91 void SetFieldMap(const AliMagF *map)const{AliKalmanTrack::SetFieldMap(map);}
92 void SetMinTracks(Int_t n=2) { fMinTracks = n; return; }
93 void SetSkipTracks(Int_t n,Int_t *skipped);
94 void SetVtxStart(Double_t x=0,Double_t y=0)
95 { fNominalPos[0]=x; fNominalPos[1]=y; return; }
96 void SetDCAcut(Double_t maxdca)
97 { fDCAcut=maxdca; return;}
100 // copy constructor (NO copy allowed: the constructor is protected
102 AliITSVertexerTracks(const AliITSVertexerTracks& vtxr);
103 // assignment operator (NO assignment allowed)
104 AliITSVertexerTracks& operator=(const AliITSVertexerTracks& /* vtxr */);
105 TFile *fInFile; // input file (with tracks)
106 TFile *fOutFile; // output file for vertices
107 AliITSSimpleVertex fSimpVert; // vertex after vertex finder
108 Double_t fNominalPos[2]; // initial knowledge on vertex position
109 Int_t fMinTracks; // minimum number of tracks
110 Double_t fDCAcut; // maximum DCA between 2 tracks used for vertex
111 Double_t fMaxChi2PerTrack; // maximum contribition to the chi2
112 TObjArray fTrkArray; // array with tracks to be processed
113 Int_t *fTrksToSkip; // tracks to be skipped for find and fit
114 Int_t fNTrksToSkip; // number of tracks to be skipped
116 Bool_t CheckField() const;
117 void ComputeMaxChi2PerTrack(Int_t nTracks);
118 Int_t PrepareTracks(TTree &trkTree);
119 Int_t PrepareTracks(AliESD* esdEvent,Int_t NofCand, Int_t *TrkPos);
120 Double_t Prepare(AliITStrackV2* itstrack);
122 void VertexFinder(Int_t OptUseWeights=0);
123 void HelixVertexFinder();
124 void StrLinVertexFinderMinDist(Int_t OptUseWeights=0);
125 static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t m[][3],Double_t *d);
126 static void GetStrLinDerivMatrix(Double_t *p0,Double_t *p1,Double_t *sigmasq,Double_t m[][3],Double_t *d);
127 static Double_t GetStrLinMinDist(Double_t *p0,Double_t *p1,Double_t *x0);
128 static Double_t GetDeterminant3X3(Double_t matr[][3]);
132 ClassDef(AliITSVertexerTracks,1) // 3D Vertexing with ITS tracks