Added new data member: true vertex position; for comparison
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 21 Feb 2003 15:59:46 +0000 (15:59 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 21 Feb 2003 15:59:46 +0000 (15:59 +0000)
ITS/AliITSVertex.cxx
ITS/AliITSVertex.h

index 07822e1..f61eb0d 100644 (file)
@@ -1,5 +1,5 @@
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
  * Contributors are mentioned in the code where appropriate.              *
@@ -36,53 +36,22 @@ AliITSVertex::AliITSVertex() {
 //
 // Default Constructor, set everything to 0
 //
-    fPosition[0]   = 0;
-    fPosition[1]   = 0;
-    fPosition[2]   = 0;
-    fCovXX         = 0;
-    fCovXY         = 0;
-    fCovYY         = 0;
-    fCovXZ         = 0;
-    fCovYZ         = 0;
-    fCovZZ         = 0;
-
-    fSNR[0]        = 0;
-    fSNR[1]        = 0;
-    fSNR[2]        = 0;
-
-    fPhi           = 0;
-    fChi2          = 0;
-    fNContributors = 0;
-
-    SetDebug();
+  SetToZero();
 }
 //--------------------------------------------------------------------------
 AliITSVertex::AliITSVertex(Double_t positionZ,Double_t sigmaZ,
                           Int_t nContributors,Char_t *vtxName) {
-//
-// Constructor for vertex Z from pixels
-//
-    fPosition[0]   = 0;
-    fPosition[1]   = 0;
-    fPosition[2]   = positionZ;
-    fCovXX         = 0;
-    fCovXY         = 0;
-    fCovYY         = 0;
-    fCovXZ         = 0;
-    fCovYZ         = 0;
-    fCovZZ         = sigmaZ*sigmaZ;
+  //
+  // Constructor for vertex Z from pixels
+  //
 
-    fSNR[0]        = 0;
-    fSNR[1]        = 0;
-    fSNR[2]        = 0;
+  SetToZero();
 
-    fPhi           = 0;
-    fChi2          = 0;
-    fNContributors = nContributors;
+  fPosition[2]   = positionZ;
+  fCovZZ         = sigmaZ*sigmaZ;
+  fNContributors = nContributors;
+  SetName(vtxName);
 
-    SetName(vtxName);
-
-    SetDebug();
 }
 //------------------------------------------------------------------------- 
 AliITSVertex::AliITSVertex(Double_t phi,
@@ -91,6 +60,8 @@ AliITSVertex::AliITSVertex(Double_t phi,
 //
 // Constructor for vertex in 3D from tracks
 //
+
+  SetToZero();
     fPosition[0]   = position[0];
     fPosition[1]   = position[1];
     fPosition[2]   = position[2];
@@ -101,9 +72,6 @@ AliITSVertex::AliITSVertex(Double_t phi,
     fCovYZ         = covmatrix[4];
     fCovZZ         = covmatrix[5];
 
-    fSNR[0]        = 0;
-    fSNR[1]        = 0;
-    fSNR[2]        = 0;
 
     fPhi           = phi;
     fChi2          = chi2;
@@ -111,7 +79,6 @@ AliITSVertex::AliITSVertex(Double_t phi,
 
     SetName(vtxName);
 
-    SetDebug();
 }
 //--------------------------------------------------------------------------
 AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
@@ -119,6 +86,8 @@ AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
 //
 // Constructor for smearing of true position
 //
+
+  SetToZero();
     fPosition[0]   = position[0];
     fPosition[1]   = position[1];
     fPosition[2]   = position[2];
@@ -129,51 +98,64 @@ AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
     fCovYZ         = 0;
     fCovZZ         = sigma[2]*sigma[2];
 
-    fSNR[0]        = 0;
-    fSNR[1]        = 0;
-    fSNR[2]        = 0;
-
-    fPhi           = 0;
-    fChi2          = 0;
-    fNContributors = 0;
 
     SetName(vtxName);
 
-    SetDebug();
 }
 //--------------------------------------------------------------------------
 AliITSVertex::AliITSVertex(Double_t position[3],Double_t sigma[3],
                           Double_t snr[3],Char_t *vtxName) {
-//
-// Constructor for Pb-Pb
-//
-    fPosition[0]   = position[0];
-    fPosition[1]   = position[1];
-    fPosition[2]   = position[2];
-    fCovXX         = sigma[0]*sigma[0];
-    fCovXY         = 0;
-    fCovYY         = sigma[1]*sigma[1];
-    fCovXZ         = 0;
-    fCovYZ         = 0;
-    fCovZZ         = sigma[2]*sigma[2];
+  //
+  // Constructor for Pb-Pb
+  //
+
+  SetToZero();
+  fPosition[0]   = position[0];
+  fPosition[1]   = position[1];
+  fPosition[2]   = position[2];
+  fCovXX         = sigma[0]*sigma[0];
+  fCovXY         = 0;
+  fCovYY         = sigma[1]*sigma[1];
+  fCovXZ         = 0;
+  fCovYZ         = 0;
+  fCovZZ         = sigma[2]*sigma[2];
+
+  fSNR[0]        = snr[0];
+  fSNR[1]        = snr[1];
+  fSNR[2]        = snr[2];
+
+  SetName(vtxName);
 
-    fSNR[0]        = snr[0];
-    fSNR[1]        = snr[1];
-    fSNR[2]        = snr[2];
-
-    fPhi           = 0;
-    fChi2          = 0;
-    fNContributors = 0;
-
-    SetName(vtxName);
-
-    SetDebug();
+}
+//--------------------------------------------------------------------------
+void AliITSVertex::SetToZero() {
+  //
+  // Set some data members to 0. Used by constructors
+  //
+  for(Int_t i=0; i<3; i++){
+    fPosition[i] = 0.;
+    fTruePos[i] = 0;
+    fSNR[i] = 0.;
+  }
+  fCovXX         = 0;
+  fCovXY         = 0;
+  fCovYY         = 0;
+  fCovXZ         = 0;
+  fCovYZ         = 0;
+  fCovZZ         = 0;
+
+  fPhi           = 0;
+  fChi2          = 0;
+  fNContributors = 0;
+
+  SetDebug();
 }
 //--------------------------------------------------------------------------
 AliITSVertex::~AliITSVertex() {
 //  
 // Default Destructor
 //
+
 }
 //--------------------------------------------------------------------------
 void AliITSVertex::GetXYZ(Double_t position[3]) const {
@@ -328,6 +310,8 @@ void AliITSVertex::PrintStatus() const {
   printf(" chi2 = %f\n",fChi2);
   printf(" # tracks (or tracklets) = %d\n",fNContributors);
 
+  printf(" True vertex position - for comparison: %12.10f  %12.10f  %12.10f\n ",fTruePos[0],fTruePos[1],fTruePos[2]);
+
   return;
 }
 
index 1b3c5d6..bfaf6cb 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef ALIITSVERTEX_H
 #define ALIITSVERTEX_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 
@@ -73,9 +73,16 @@ class AliITSVertex : public TNamed {
 
   void     PrintStatus() const;
   void     SetDebug(Int_t dbg = 0) { fDebug = dbg; return; }
+  void SetTruePos(Double_t *tp){for(Int_t i=0;i<3;i++)fTruePos[i]=tp[i];}
+  void GetTruePos(Double_t &x,Double_t &y,Double_t &z) const 
+       {x=fTruePos[0]; y=fTruePos[1]; z=fTruePos[2];}
         
  private:
-    
+
+  void SetToZero();
+
+ protected:
+
   Double_t fPosition[3];  // vertex position
   Double_t fCovXX,fCovXY,fCovYY,fCovXZ,fCovYZ,fCovZZ;  // vertex covariance matrix
   Double_t fSNR[3];  // S/N ratio
@@ -83,8 +90,8 @@ class AliITSVertex : public TNamed {
   Double_t fChi2;  // chi2 of vertex fit
   Int_t    fNContributors;  // # of tracklets/tracks used for the estimate 
   Int_t    fDebug;  //! for debugging
-
-  ClassDef(AliITSVertex,2)  // Class for Primary Vertex
+  Double_t fTruePos[3];   //true vertex position (for comparison purposes)
+  ClassDef(AliITSVertex,3)  // Class for Primary Vertex
     };
 
 #endif