]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDVertex.cxx
Moving the momentum cut from the TOF PID to the ESD PID (Yu.Belikov)
[u/mrichter/AliRoot.git] / STEER / AliESDVertex.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //-----------------------------------------------------------------
17 //           Implementation of the Primary Vertex class
18 //
19 // Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
20 //-----------------------------------------------------------------
21
22 //---- standard headers ----
23 #include "Riostream.h"
24 //---- Root headers --------
25 #include <TMath.h>
26 #include <TROOT.h>
27 #include <TNamed.h>
28 //---- AliRoot headers -----
29 #include "AliESDVertex.h"
30
31
32 ClassImp(AliESDVertex)
33
34 //--------------------------------------------------------------------------
35 AliESDVertex::AliESDVertex() {
36 //
37 // Default Constructor, set everything to 0
38 //
39   SetToZero();
40 }
41 //--------------------------------------------------------------------------
42 AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
43                            Int_t nContributors,Char_t *vtxName) {
44   //
45   // Constructor for vertex Z from pixels
46   //
47
48   SetToZero();
49
50   fPosition[2]   = positionZ;
51   fCovZZ         = sigmaZ*sigmaZ;
52   fNContributors = nContributors;
53   SetName(vtxName);
54
55 }
56 //------------------------------------------------------------------------- 
57 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
58                            Double_t chi2,Int_t nContributors,Char_t *vtxName) {
59 //
60 // Constructor for vertex in 3D from tracks
61 //
62
63   SetToZero();
64     fPosition[0]   = position[0];
65     fPosition[1]   = position[1];
66     fPosition[2]   = position[2];
67     fCovXX         = covmatrix[0];
68     fCovXY         = covmatrix[1];
69     fCovYY         = covmatrix[2];
70     fCovXZ         = covmatrix[3];
71     fCovYZ         = covmatrix[4];
72     fCovZZ         = covmatrix[5];
73
74
75     fChi2          = chi2;
76     fNContributors = nContributors;
77
78     SetName(vtxName);
79
80 }
81 //--------------------------------------------------------------------------
82 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
83                            Char_t *vtxName) {
84 //
85 // Constructor for smearing of true position
86 //
87
88   SetToZero();
89     fPosition[0]   = position[0];
90     fPosition[1]   = position[1];
91     fPosition[2]   = position[2];
92     fCovXX         = sigma[0]*sigma[0];
93     fCovXY         = 0;
94     fCovYY         = sigma[1]*sigma[1];
95     fCovXZ         = 0;
96     fCovYZ         = 0;
97     fCovZZ         = sigma[2]*sigma[2];
98
99
100     SetName(vtxName);
101
102 }
103 //--------------------------------------------------------------------------
104 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
105                            Double_t snr[3],Char_t *vtxName) {
106   //
107   // Constructor for Pb-Pb
108   //
109
110   SetToZero();
111   fPosition[0]   = position[0];
112   fPosition[1]   = position[1];
113   fPosition[2]   = position[2];
114   fCovXX         = sigma[0]*sigma[0];
115   fCovXY         = 0;
116   fCovYY         = sigma[1]*sigma[1];
117   fCovXZ         = 0;
118   fCovYZ         = 0;
119   fCovZZ         = sigma[2]*sigma[2];
120
121   fSNR[0]        = snr[0];
122   fSNR[1]        = snr[1];
123   fSNR[2]        = snr[2];
124
125   SetName(vtxName);
126
127 }
128 //--------------------------------------------------------------------------
129 void AliESDVertex::SetToZero() {
130   //
131   // Set some data members to 0. Used by constructors
132   //
133   for(Int_t i=0; i<3; i++){
134     fPosition[i] = 0.;
135     fTruePos[i] = 0;
136     fSNR[i] = 0.;
137   }
138   fCovXX         = 0;
139   fCovXY         = 0;
140   fCovYY         = 0;
141   fCovXZ         = 0;
142   fCovYZ         = 0;
143   fCovZZ         = 0;
144
145   fChi2          = 0;
146   fNContributors = 0;
147
148   SetDebug();
149 }
150 //--------------------------------------------------------------------------
151 AliESDVertex::~AliESDVertex() {
152 //  
153 // Default Destructor
154 //
155
156 }
157 //--------------------------------------------------------------------------
158 void AliESDVertex::GetXYZ(Double_t position[3]) const {
159 //
160 // Return position of the vertex in global frame
161 //
162   position[0] = fPosition[0];
163   position[1] = fPosition[1];
164   position[2] = fPosition[2];
165
166   return;
167 }
168 //--------------------------------------------------------------------------
169 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
170 //
171 // Return errors on vertex position in thrust frame
172 //
173   sigma[0] = TMath::Sqrt(fCovXX);
174   sigma[1] = TMath::Sqrt(fCovYY);
175   sigma[2] = TMath::Sqrt(fCovZZ);
176
177   return;
178 }
179 //--------------------------------------------------------------------------
180 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
181 //
182 // Return covariance matrix of the vertex
183 //
184   covmatrix[0] = fCovXX;
185   covmatrix[1] = fCovXY;
186   covmatrix[2] = fCovYY;
187   covmatrix[3] = fCovXZ;
188   covmatrix[4] = fCovYZ;
189   covmatrix[5] = fCovZZ;
190
191   return;
192 }
193 //--------------------------------------------------------------------------
194 Double_t AliESDVertex::GetXv() const {
195 //
196 // Return global x
197 //
198   return fPosition[0];
199 }
200 //--------------------------------------------------------------------------
201 Double_t AliESDVertex::GetYv() const {
202 //
203 // Return global y
204 //
205   return fPosition[1];
206 }
207 //--------------------------------------------------------------------------
208 Double_t AliESDVertex::GetZv() const {
209 //
210 // Return global z
211 //
212   return fPosition[2];
213 }
214 //--------------------------------------------------------------------------
215 Double_t AliESDVertex::GetXRes() const {
216 //
217 // Return error on global x
218 //
219   return TMath::Sqrt(fCovXX);
220 }
221 //--------------------------------------------------------------------------
222 Double_t AliESDVertex::GetYRes() const {
223 //
224 // Return error on global y
225 //
226   return TMath::Sqrt(fCovYY);
227 }
228 //--------------------------------------------------------------------------
229 Double_t AliESDVertex::GetZRes() const {
230 //
231 // Return error on global z
232 //
233   return TMath::Sqrt(fCovZZ);
234 }
235 //--------------------------------------------------------------------------
236 void AliESDVertex::GetSNR(Double_t snr[3]) const {
237 //
238 // Return S/N ratios
239 //
240   for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
241
242   return;
243 }
244 //--------------------------------------------------------------------------
245 void AliESDVertex::PrintStatus() const {
246 //
247 // Print out information on all data members
248 //
249   printf(" Vertex position:\n");
250   printf("   x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
251   printf("   y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
252   printf("   z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
253   printf(" Covariance matrix:\n");
254   printf(" %12.10f  %12.10f  %12.10f\n %12.10f  %12.10f  %12.10f\n %12.10f  %12.10f  %12.10f\n",fCovXX,fCovXY,fCovXZ,fCovXY,fCovYY,fCovYZ,fCovXZ,fCovYZ,fCovZZ);
255   printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
256   printf(" chi2 = %f\n",fChi2);
257   printf(" # tracks (or tracklets) = %d\n",fNContributors);
258
259   printf(" True vertex position - for comparison: %12.10f  %12.10f  %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);
260
261   return;
262 }
263
264
265
266