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