]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDVertex.cxx
Updating CMake files
[u/mrichter/AliRoot.git] / STEER / AliESDVertex.cxx
CommitLineData
c5f0f3c1 1/**************************************************************************
0fc5cc25 2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
c5f0f3c1 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
af7ba10c 18// for the Event Data Summary class
19// This class contains the Primary Vertex
20// of the event coming from reconstruction
de04aa35 21// Origin: A.Dainese, andrea.dainese@lnl.infn.it
c5f0f3c1 22//-----------------------------------------------------------------
23
24//---- standard headers ----
8ba665e9 25#include "Riostream.h"
c5f0f3c1 26//---- Root headers --------
504de69b 27#include <TMath.h>
504de69b 28#include <TROOT.h>
c5f0f3c1 29//---- AliRoot headers -----
d681bb2d 30#include "AliESDVertex.h"
504de69b 31
32
d681bb2d 33ClassImp(AliESDVertex)
504de69b 34
c5f0f3c1 35//--------------------------------------------------------------------------
90e48c0c 36AliESDVertex::AliESDVertex() :
8a553be2 37 AliVertex(),
90e48c0c 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),
8a553be2 44 fChi2(0)
90e48c0c 45{
46 //
47 // Default Constructor, set everything to 0
48 //
0fc5cc25 49 SetToZero();
c5f0f3c1 50}
90e48c0c 51
c5f0f3c1 52//--------------------------------------------------------------------------
d681bb2d 53AliESDVertex::AliESDVertex(Double_t positionZ,Double_t sigmaZ,
90e48c0c 54 Int_t nContributors,const Char_t *vtxName) :
8a553be2 55 AliVertex(),
90e48c0c 56 fCovXX(0.005*0.005),
57 fCovXY(0),
58 fCovYY(0.005*0.005),
59 fCovXZ(0),
60 fCovYZ(0),
61 fCovZZ(sigmaZ*sigmaZ),
8a553be2 62 fChi2(0)
90e48c0c 63{
0fc5cc25 64 //
65 // Constructor for vertex Z from pixels
66 //
c5f0f3c1 67
0fc5cc25 68 SetToZero();
c5f0f3c1 69
0fc5cc25 70 fPosition[2] = positionZ;
8a553be2 71 SetName(vtxName);
72 SetNContributors(nContributors);
c5f0f3c1 73
c5f0f3c1 74}
90e48c0c 75
c5f0f3c1 76//-------------------------------------------------------------------------
d681bb2d 77AliESDVertex::AliESDVertex(Double_t position[3],Double_t covmatrix[6],
90e48c0c 78 Double_t chi2,Int_t nContributors,
79 const Char_t *vtxName) :
8a553be2 80 AliVertex(position,0.,nContributors),
90e48c0c 81 fCovXX(covmatrix[0]),
82 fCovXY(covmatrix[1]),
83 fCovYY(covmatrix[2]),
84 fCovXZ(covmatrix[3]),
85 fCovYZ(covmatrix[4]),
86 fCovZZ(covmatrix[5]),
8a553be2 87 fChi2(chi2)
90e48c0c 88{
89 //
90 // Constructor for vertex in 3D from tracks
91 //
0fc5cc25 92
93 SetToZero();
8a553be2 94 SetName(vtxName);
c5f0f3c1 95
cd77595e 96}
c5f0f3c1 97//--------------------------------------------------------------------------
d681bb2d 98AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
90e48c0c 99 const Char_t *vtxName) :
8a553be2 100 AliVertex(position,0.,0),
90e48c0c 101 fCovXX(sigma[0]*sigma[0]),
102 fCovXY(0),
103 fCovYY(sigma[1]*sigma[1]),
104 fCovXZ(0),
105 fCovYZ(0),
106 fCovZZ(sigma[2]*sigma[2]),
8a553be2 107 fChi2(0)
90e48c0c 108{
109 //
110 // Constructor for smearing of true position
111 //
0fc5cc25 112
113 SetToZero();
8a553be2 114 SetName(vtxName);
c5f0f3c1 115
c5f0f3c1 116}
117//--------------------------------------------------------------------------
d681bb2d 118AliESDVertex::AliESDVertex(Double_t position[3],Double_t sigma[3],
90e48c0c 119 Double_t snr[3], const Char_t *vtxName) :
8a553be2 120 AliVertex(position,0.,0),
90e48c0c 121 fCovXX(sigma[0]*sigma[0]),
122 fCovXY(0),
123 fCovYY(sigma[1]*sigma[1]),
124 fCovXZ(0),
125 fCovYZ(0),
126 fCovZZ(sigma[2]*sigma[2]),
8a553be2 127 fChi2(0)
90e48c0c 128{
0fc5cc25 129 //
130 // Constructor for Pb-Pb
131 //
132
133 SetToZero();
8a553be2 134 SetName(vtxName);
0fc5cc25 135
136 fSNR[0] = snr[0];
137 fSNR[1] = snr[1];
138 fSNR[2] = snr[2];
139
0fc5cc25 140}
de04aa35 141//--------------------------------------------------------------------------
142AliESDVertex::AliESDVertex(const AliESDVertex &source):
143 AliVertex(source),
144 fCovXX(source.fCovXX),
145 fCovXY(source.fCovXY),
146 fCovYY(source.fCovYY),
147 fCovXZ(source.fCovXZ),
148 fCovYZ(source.fCovYZ),
149 fCovZZ(source.fCovZZ),
150 fChi2(source.fChi2)
151{
152 //
153 // Copy constructor
154 //
155 for(Int_t i=0;i<3;i++) {
156 fSNR[i] = source.fSNR[i];
de04aa35 157 }
158}
159//--------------------------------------------------------------------------
160AliESDVertex &AliESDVertex::operator=(const AliESDVertex &source){
161 //
162 // assignment operator
163 //
316c6cd9 164 if(&source != this){
165 AliVertex::operator=(source);
166 for(Int_t i=0;i<3;++i)fSNR[i] = source.fSNR[i];
167 fCovXX = source.fCovXX;
168 fCovXY = source.fCovXY;
169 fCovYY = source.fCovYY;
170 fCovXZ = source.fCovXZ;
171 fCovYZ = source.fCovYZ;
172 fCovZZ = source.fCovZZ;
173 fChi2 = source.fChi2;
de04aa35 174 }
175 return *this;
176}
732a24fe 177
178void AliESDVertex::Copy(TObject &obj) const {
179
180 // this overwrites the virtual TOBject::Copy()
181 // to allow run time copying without casting
182 // in AliESDEvent
183
184 if(this==&obj)return;
185 AliESDVertex *robj = dynamic_cast<AliESDVertex*>(&obj);
186 if(!robj)return; // not an AliESDVertex
187 *robj = *this;
188
189}
190
191
0fc5cc25 192//--------------------------------------------------------------------------
d681bb2d 193void AliESDVertex::SetToZero() {
0fc5cc25 194 //
90e48c0c 195 // Set the content of arrays to 0. Used by constructors
0fc5cc25 196 //
197 for(Int_t i=0; i<3; i++){
0fc5cc25 198 fSNR[i] = 0.;
199 }
c5f0f3c1 200}
201//--------------------------------------------------------------------------
d681bb2d 202void AliESDVertex::GetSigmaXYZ(Double_t sigma[3]) const {
de04aa35 203 //
204 // Return errors on vertex position in thrust frame
205 //
c5f0f3c1 206 sigma[0] = TMath::Sqrt(fCovXX);
207 sigma[1] = TMath::Sqrt(fCovYY);
208 sigma[2] = TMath::Sqrt(fCovZZ);
209
210 return;
cd77595e 211}
c5f0f3c1 212//--------------------------------------------------------------------------
d681bb2d 213void AliESDVertex::GetCovMatrix(Double_t covmatrix[6]) const {
de04aa35 214 //
215 // Return covariance matrix of the vertex
216 //
c5f0f3c1 217 covmatrix[0] = fCovXX;
218 covmatrix[1] = fCovXY;
219 covmatrix[2] = fCovYY;
220 covmatrix[3] = fCovXZ;
221 covmatrix[4] = fCovYZ;
222 covmatrix[5] = fCovZZ;
223
224 return;
cd77595e 225}
8a553be2 226
c5f0f3c1 227//--------------------------------------------------------------------------
d681bb2d 228void AliESDVertex::GetSNR(Double_t snr[3]) const {
de04aa35 229 //
230 // Return S/N ratios
231 //
c5f0f3c1 232 for(Int_t i=0;i<3;i++) snr[i] = fSNR[i];
233
234 return;
235}
236//--------------------------------------------------------------------------
5f7789fc 237void AliESDVertex::Print(Option_t* /*option*/) const {
de04aa35 238 //
239 // Print out information on all data members
240 //
5f7789fc 241 printf("ESD vertex position:\n");
c5f0f3c1 242 printf(" x = %f +- %f\n",fPosition[0],TMath::Sqrt(fCovXX));
243 printf(" y = %f +- %f\n",fPosition[1],TMath::Sqrt(fCovYY));
244 printf(" z = %f +- %f\n",fPosition[2],TMath::Sqrt(fCovZZ));
245 printf(" Covariance matrix:\n");
246 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);
247 printf(" S/N = (%f, %f, %f)\n",fSNR[0],fSNR[1],fSNR[2]);
248 printf(" chi2 = %f\n",fChi2);
249 printf(" # tracks (or tracklets) = %d\n",fNContributors);
250
251 return;
252}
253
254
255
6b88f180 256