]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDVertex.cxx
Test case for B0 -> mu
[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 //           for the Event Data Summary class
19 //           This class contains the Primary Vertex
20 //           of the event coming from reconstruction
21 // Origin: A.Dainese, Padova, andrea.dainese@pd.infn.it
22 //-----------------------------------------------------------------
23
24 //---- standard headers ----
25 #include "Riostream.h"
26 //---- Root headers --------
27 #include <TMath.h>
28 #include <TROOT.h>
29 //---- AliRoot headers -----
30 #include "AliESDVertex.h"
31
32
33 ClassImp(AliESDVertex)
34
35 //--------------------------------------------------------------------------
36 AliESDVertex::AliESDVertex() :
37   TNamed(),
38   fCovXX(0.005*0.005),
39   fCovXY(0),
40   fCovYY(0.005*0.005),
41   fCovXZ(0),
42   fCovYZ(0),
43   fCovZZ(5.3*5.3),
44   fChi2(0),
45   fNContributors(0)
46 {
47   //
48   // Default Constructor, set everything to 0
49   //
50   SetToZero();
51 }
52
53 //--------------------------------------------------------------------------
54 AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
55                            Int_t nContributors,const Char_t *vtxName) :
56   TNamed(vtxName,""),
57   fCovXX(0.005*0.005),
58   fCovXY(0),
59   fCovYY(0.005*0.005),
60   fCovXZ(0),
61   fCovYZ(0),
62   fCovZZ(sigmaZ*sigmaZ),
63   fChi2(0),
64   fNContributors(nContributors)
65 {
66   //
67   // Constructor for vertex Z from pixels
68   //
69
70   SetToZero();
71
72   fPosition[2]   = positionZ;
73
74 }
75
76 //------------------------------------------------------------------------- 
77 AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
78                            Double_t chi2,Int_t nContributors,
79                            const Char_t *vtxName) :
80   TNamed(vtxName,""),
81   fCovXX(covmatrix[0]),
82   fCovXY(covmatrix[1]),
83   fCovYY(covmatrix[2]),
84   fCovXZ(covmatrix[3]),
85   fCovYZ(covmatrix[4]),
86   fCovZZ(covmatrix[5]),
87   fChi2(chi2),
88   fNContributors(nContributors)
89 {
90   //
91   // Constructor for vertex in 3D from tracks
92   //
93
94   SetToZero();
95   fPosition[0]   = position[0];
96   fPosition[1]   = position[1];
97   fPosition[2]   = position[2];
98
99 }
100 //--------------------------------------------------------------------------
101 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
102                            const Char_t *vtxName) :
103   TNamed(vtxName,""),
104   fCovXX(sigma[0]*sigma[0]),
105   fCovXY(0),
106   fCovYY(sigma[1]*sigma[1]),
107   fCovXZ(0),
108   fCovYZ(0),
109   fCovZZ(sigma[2]*sigma[2]),
110   fChi2(0),
111   fNContributors(0)
112 {
113   //
114   // Constructor for smearing of true position
115   //
116
117   SetToZero();
118   fPosition[0]   = position[0];
119   fPosition[1]   = position[1];
120   fPosition[2]   = position[2];
121
122 }
123 //--------------------------------------------------------------------------
124 AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
125                            Double_t snr[3], const Char_t *vtxName) :
126   TNamed(vtxName,""),
127   fCovXX(sigma[0]*sigma[0]),
128   fCovXY(0),
129   fCovYY(sigma[1]*sigma[1]),
130   fCovXZ(0),
131   fCovYZ(0),
132   fCovZZ(sigma[2]*sigma[2]),
133   fChi2(0),
134   fNContributors(0)
135 {
136   //
137   // Constructor for Pb-Pb
138   //
139
140   SetToZero();
141   fPosition[0]   = position[0];
142   fPosition[1]   = position[1];
143   fPosition[2]   = position[2];
144
145   fSNR[0]        = snr[0];
146   fSNR[1]        = snr[1];
147   fSNR[2]        = snr[2];
148
149 }
150
151 //--------------------------------------------------------------------------
152 void AliESDVertex::SetToZero() {
153   //
154   // Set the content of arrays to 0. Used by constructors
155   //
156   for(Int_t i=0; i<3; i++){
157     fPosition[i] = 0.;
158     fTruePos[i] = 0;
159     fSNR[i] = 0.;
160   }
161 }
162 //--------------------------------------------------------------------------
163 AliESDVertex::~AliESDVertex() {
164 //  
165 // Destructor
166 //
167
168 }
169 //--------------------------------------------------------------------------
170 void AliESDVertex::GetXYZ(Double_t position[3]) const {
171 //
172 // Return position of the vertex in global frame
173 //
174   position[0] = fPosition[0];
175   position[1] = fPosition[1];
176   position[2] = fPosition[2];
177
178   return;
179 }
180 //--------------------------------------------------------------------------
181 void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
182 //
183 // Return errors on vertex position in thrust frame
184 //
185   sigma[0] = TMath::Sqrt(fCovXX);
186   sigma[1] = TMath::Sqrt(fCovYY);
187   sigma[2] = TMath::Sqrt(fCovZZ);
188
189   return;
190 }
191 //--------------------------------------------------------------------------
192 void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
193 //
194 // Return covariance matrix of the vertex
195 //
196   covmatrix[0] = fCovXX;
197   covmatrix[1] = fCovXY;
198   covmatrix[2] = fCovYY;
199   covmatrix[3] = fCovXZ;
200   covmatrix[4] = fCovYZ;
201   covmatrix[5] = fCovZZ;
202
203   return;
204 }
205 //--------------------------------------------------------------------------
206 Double_t AliESDVertex::GetXv() const {
207 //
208 // Return global x
209 //
210   return fPosition[0];
211 }
212 //--------------------------------------------------------------------------
213 Double_t AliESDVertex::GetYv() const {
214 //
215 // Return global y
216 //
217   return fPosition[1];
218 }
219 //--------------------------------------------------------------------------
220 Double_t AliESDVertex::GetZv() const {
221 //
222 // Return global z
223 //
224   return fPosition[2];
225 }
226 //--------------------------------------------------------------------------
227 Double_t AliESDVertex::GetXRes() const {
228 //
229 // Return error on global x
230 //
231   return TMath::Sqrt(fCovXX);
232 }
233 //--------------------------------------------------------------------------
234 Double_t AliESDVertex::GetYRes() const {
235 //
236 // Return error on global y
237 //
238   return TMath::Sqrt(fCovYY);
239 }
240 //--------------------------------------------------------------------------
241 Double_t AliESDVertex::GetZRes() const {
242 //
243 // Return error on global z
244 //
245   return TMath::Sqrt(fCovZZ);
246 }
247 //--------------------------------------------------------------------------
248 void AliESDVertex::GetSNR(Double_t snr[3]) const {
249 //
250 // Return S/N ratios
251 //
252   for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
253
254   return;
255 }
256 //--------------------------------------------------------------------------
257 void AliESDVertex::Print(Option_t* /*option*/) const {
258 //
259 // Print out information on all data members
260 //
261   printf("ESD vertex position:\n");
262   printf("   x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
263   printf("   y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
264   printf("   z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
265   printf(" Covariance matrix:\n");
266   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);
267   printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
268   printf(" chi2 = %f\n",fChi2);
269   printf(" # tracks (or tracklets) = %d\n",fNContributors);
270
271   printf(" True vertex position - for comparison: %12.10f  %12.10f  %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);
272
273   return;
274 }
275
276
277
278