From bdd011d65271b14395653edc6269445dcaf273ee Mon Sep 17 00:00:00 2001 From: morsch Date: Mon, 20 Oct 2008 16:20:39 +0000 Subject: [PATCH] New base class AliVVertex. (A. Dainese) --- STEER/AliAODVertex.cxx | 16 +++++++-------- STEER/AliAODVertex.h | 10 ++++++++-- STEER/AliESDVertex.cxx | 4 +--- STEER/AliESDVertex.h | 5 ++++- STEER/AliVVertex.cxx | 35 ++++++++++++++++++++++++++++++++ STEER/AliVVertex.h | 43 ++++++++++++++++++++++++++++++++++++++++ STEER/AliVertex.cxx | 19 +++++++++++++----- STEER/AliVertex.h | 15 +++++++++++--- STEER/STEERBaseLinkDef.h | 1 + STEER/libSTEERBase.pkg | 1 + 10 files changed, 127 insertions(+), 22 deletions(-) create mode 100644 STEER/AliVVertex.cxx create mode 100644 STEER/AliVVertex.h diff --git a/STEER/AliAODVertex.cxx b/STEER/AliAODVertex.cxx index 44030031538..6f8b5251b3c 100644 --- a/STEER/AliAODVertex.cxx +++ b/STEER/AliAODVertex.cxx @@ -20,17 +20,17 @@ // Base class for Analysis Object Data // Generic version // Author: Markus Oldenburg, CERN +// Inheritance from AliVVertex: A. Dainese //------------------------------------------------------------------------- #include "AliAODVertex.h" - #include "AliAODTrack.h" ClassImp(AliAODVertex) //______________________________________________________________________________ AliAODVertex::AliAODVertex() : - TObject(), + AliVVertex(), fChi2perNDF(-999.), fID(-1), fType(kUndef), @@ -50,7 +50,7 @@ AliAODVertex::AliAODVertex(const Double_t position[3], TObject *parent, Short_t id, Char_t vtype) : - TObject(), + AliVVertex(), fChi2perNDF(chi2perNDF), fID(id), fType(vtype), @@ -72,7 +72,7 @@ AliAODVertex::AliAODVertex(const Float_t position[3], Short_t id, Char_t vtype) : - TObject(), + AliVVertex(), fChi2perNDF(chi2perNDF), fID(id), fType(vtype), @@ -90,7 +90,7 @@ AliAODVertex::AliAODVertex(const Float_t position[3], AliAODVertex::AliAODVertex(const Double_t position[3], Double_t chi2perNDF, Char_t vtype) : - TObject(), + AliVVertex(), fChi2perNDF(chi2perNDF), fID(-1), fType(vtype), @@ -107,7 +107,7 @@ AliAODVertex::AliAODVertex(const Double_t position[3], AliAODVertex::AliAODVertex(const Float_t position[3], Double_t chi2perNDF, Char_t vtype) : - TObject(), + AliVVertex(), fChi2perNDF(chi2perNDF), fID(-1), fType(vtype), @@ -130,7 +130,7 @@ AliAODVertex::~AliAODVertex() //______________________________________________________________________________ AliAODVertex::AliAODVertex(const AliAODVertex& vtx) : - TObject(vtx), + AliVVertex(vtx), fChi2perNDF(vtx.fChi2perNDF), fID(vtx.fID), fType(vtx.fType), @@ -153,7 +153,7 @@ AliAODVertex& AliAODVertex::operator=(const AliAODVertex& vtx) if (this != &vtx) { // name and type - TObject::operator=(vtx); + AliVVertex::operator=(vtx); //momentum for (int i = 0; i < 3; i++) diff --git a/STEER/AliAODVertex.h b/STEER/AliAODVertex.h index e53cc9fb338..7f33564d568 100644 --- a/STEER/AliAODVertex.h +++ b/STEER/AliAODVertex.h @@ -8,15 +8,17 @@ //------------------------------------------------------------------------- // AOD vertex base class // Author: Markus Oldenburg, CERN +// Inheritance from AliVVertex: A. Dainese //------------------------------------------------------------------------- #include #include #include +#include "AliVVertex.h" #include "AliAODRedCov.h" -class AliAODVertex : public TObject { +class AliAODVertex : public AliVVertex { public : @@ -60,6 +62,8 @@ class AliAODVertex : public TObject { Double_t GetX() const { return fPosition[0]; } Double_t GetY() const { return fPosition[1]; } Double_t GetZ() const { return fPosition[2]; } + void GetXYZ(Double_t position[3]) const + {position[0]=fPosition[0]; position[1]=fPosition[1]; position[2]=fPosition[2];} template void GetPosition(T *pos) const {pos[0]=fPosition[0]; pos[1]=fPosition[1]; pos[2]=fPosition[2];} @@ -71,6 +75,8 @@ class AliAODVertex : public TObject { if(!fCovMatrix) return kFALSE; fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;} + void GetCovarianceMatrix(Double_t covmatrix[6]) const + {GetCovMatrix(covmatrix);} void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;} template void GetSigmaXYZ(T *sigma) const; @@ -125,7 +131,7 @@ class AliAODVertex : public TObject { TRef fParent; // reference to the parent particle TRefArray fDaughters; // references to the daughter particles - ClassDef(AliAODVertex,3); + ClassDef(AliAODVertex,4); }; #endif diff --git a/STEER/AliESDVertex.cxx b/STEER/AliESDVertex.cxx index bc65501a516..121369ece80 100644 --- a/STEER/AliESDVertex.cxx +++ b/STEER/AliESDVertex.cxx @@ -174,7 +174,7 @@ AliESDVertex &AliESDVertex::operator=(const AliESDVertex &source){ } return *this; } - +//-------------------------------------------------------------------------- void AliESDVertex::Copy(TObject &obj) const { // this overwrites the virtual TOBject::Copy() @@ -187,8 +187,6 @@ void AliESDVertex::Copy(TObject &obj) const { *robj = *this; } - - //-------------------------------------------------------------------------- void AliESDVertex::SetToZero() { // diff --git a/STEER/AliESDVertex.h b/STEER/AliESDVertex.h index f29b8fc41bd..973d843fd3b 100644 --- a/STEER/AliESDVertex.h +++ b/STEER/AliESDVertex.h @@ -50,9 +50,10 @@ class AliESDVertex : public AliVertex { virtual ~AliESDVertex() {} - void GetSigmaXYZ(Double_t sigma[3]) const; void GetCovMatrix(Double_t covmatrix[6]) const; + void GetCovarianceMatrix(Double_t covmatrix[6]) const + {GetCovMatrix(covmatrix);} void GetSNR(Double_t snr[3]) const; Double_t GetXRes() const {return TMath::Sqrt(fCovXX);} @@ -65,6 +66,8 @@ class AliESDVertex : public AliVertex { Double_t GetChi2() const { return fChi2; } Double_t GetChi2toNDF() const { return fChi2/(2.*(Double_t)fNContributors-3.); } + Double_t GetChi2perNDF() const { return GetChi2toNDF();} + Int_t GetNDF() const {return (2*fNContributors-3);} void Print(Option_t* option = "") const; void PrintStatus() const {Print();} diff --git a/STEER/AliVVertex.cxx b/STEER/AliVVertex.cxx new file mode 100644 index 00000000000..9e1547f8a2f --- /dev/null +++ b/STEER/AliVVertex.cxx @@ -0,0 +1,35 @@ +/************************************************************************** + * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +//------------------------------------------------------------------------- +// base class for ESD and AOD vertices +// Author: A. Dainese +//------------------------------------------------------------------------- + +#include "AliVVertex.h" + +ClassImp(AliVVertex) + +AliVVertex::AliVVertex(const AliVVertex& vVert) : + TNamed(vVert) { } // Copy constructor + +AliVVertex& AliVVertex::operator=(const AliVVertex& vVert) +{ if (this!=&vVert) { + TNamed::operator=(vVert); + } + + return *this; +} diff --git a/STEER/AliVVertex.h b/STEER/AliVVertex.h new file mode 100644 index 00000000000..e2b83bf4e61 --- /dev/null +++ b/STEER/AliVVertex.h @@ -0,0 +1,43 @@ +#ifndef AliVVertex_H +#define AliVVertex_H +/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------------------------- +// base class for ESD and AOD vertices +// Author: A. Dainese +//------------------------------------------------------------------------- + +#include + +class AliVVertex: public TNamed { + +public: + AliVVertex() { } + virtual ~AliVVertex() { } + AliVVertex(const AliVVertex& vVert); + AliVVertex& operator=(const AliVVertex& vVert); + + // vertex properties + virtual void GetXYZ(Double_t position[3]) const = 0; + virtual Double_t GetX() const = 0; + virtual Double_t GetY() const = 0; + virtual Double_t GetZ() const = 0; + virtual void GetCovarianceMatrix(Double_t covmatrix[6]) const = 0; + + + virtual Double_t GetChi2perNDF() const = 0; + virtual Double_t GetChi2() const = 0; + virtual Int_t GetNDF() const = 0; + + virtual Int_t GetNContributors() const = 0; + virtual void PrintIndices() const = 0; + virtual void Print(Option_t* option = "") const = 0; + + virtual void Clear(Option_t* option) {TNamed::Clear(option);} + + + ClassDef(AliVVertex,0) // base class for vertices +}; + +#endif diff --git a/STEER/AliVertex.cxx b/STEER/AliVertex.cxx index 06fb8915fe0..d20e18c7f0f 100644 --- a/STEER/AliVertex.cxx +++ b/STEER/AliVertex.cxx @@ -28,7 +28,7 @@ ClassImp(AliVertex) //-------------------------------------------------------------------------- AliVertex::AliVertex() : - TNamed(), + AliVVertex(), fSigma(0), fNContributors(0), fNIndices(0), @@ -43,7 +43,7 @@ AliVertex::AliVertex() : //-------------------------------------------------------------------------- AliVertex::AliVertex(Double_t position[3],Double_t dispersion, Int_t nContributors): - TNamed(), + AliVVertex(), fSigma(dispersion), fNContributors(nContributors), fNIndices(0), @@ -60,7 +60,7 @@ AliVertex::AliVertex(Double_t position[3],Double_t dispersion, //-------------------------------------------------------------------------- AliVertex::AliVertex(const AliVertex &source): - TNamed(source), + AliVVertex(source), fSigma(source.GetDispersion()), fNContributors(source.GetNContributors()), fNIndices(source.GetNIndices()), @@ -82,7 +82,7 @@ AliVertex &AliVertex::operator=(const AliVertex &source){ // assignment operator // if(&source != this){ - TNamed::operator=(source); + AliVVertex::operator=(source); for(Int_t i=0;i<3;i++)fPosition[i] = source.fPosition[i]; fSigma = source.GetDispersion(); fNContributors = source.GetNContributors(); @@ -112,7 +112,7 @@ void AliVertex::Clear(Option_t* option) // Delete allocated memory delete [] fIndices; fIndices = 0; - TNamed::Clear(option); + AliVVertex::Clear(option); } //-------------------------------------------------------------------------- @@ -127,6 +127,15 @@ void AliVertex::GetXYZ(Double_t position[3]) const { return; } //-------------------------------------------------------------------------- +void AliVertex::GetCovarianceMatrix(Double_t covmatrix[6]) const { +// +// Fake method (is implmented in AliESDVertex) +// + for(Int_t i=0;i<6;i++) covmatrix[i] = -999.; + + return; +} +//-------------------------------------------------------------------------- void AliVertex::SetIndices(Int_t nindices,UShort_t *indices) { // // Set indices of tracks used for vertex determination diff --git a/STEER/AliVertex.h b/STEER/AliVertex.h index f7e5b84d08b..61c02ff6b7a 100644 --- a/STEER/AliVertex.h +++ b/STEER/AliVertex.h @@ -11,9 +11,9 @@ //------------------------------------------------------- -#include +#include "AliVVertex.h" -class AliVertex : public TNamed { +class AliVertex : public AliVVertex { public: @@ -37,6 +37,9 @@ class AliVertex : public TNamed { virtual Double_t GetXv() const { return fPosition[0]; } virtual Double_t GetYv() const { return fPosition[1]; } virtual Double_t GetZv() const { return fPosition[2]; } + virtual Double_t GetX() const { return fPosition[0]; } + virtual Double_t GetY() const { return fPosition[1]; } + virtual Double_t GetZ() const { return fPosition[2]; } virtual Double_t GetDispersion() const { return fSigma; } virtual Int_t GetNContributors() const { return fNContributors; } virtual Int_t GetNIndices() const { return fNIndices; } @@ -52,6 +55,12 @@ class AliVertex : public TNamed { virtual void PrintIndices() const { if(fNIndices>0) for(Int_t i=0;i