/************************************************************************** * Copyright(c) 2006-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. * **************************************************************************/ //----------------------------------------------------------------- // Implementation of the base Vertex class // This class contains the Secondary Vertex // of a set of tracks // And it is the base class for primary vertices // Origin: F.Prino, Torino, prino@to.infn.it //----------------------------------------------------------------- #include "AliVertex.h" ClassImp(AliVertex) //-------------------------------------------------------------------------- AliVertex::AliVertex() : TNamed(), fSigma(0), fNContributors(0), fNIndices(0) { // // Default Constructor, set everything to 0 // for(Int_t k=0;k<3;k++) fPosition[k] = 0; fIndices = 0; } //-------------------------------------------------------------------------- AliVertex::AliVertex(Double_t position[3],Double_t dispersion, Int_t nContributors): TNamed(), fSigma(dispersion), fNContributors(nContributors), fNIndices(0) { // // Standard Constructor // for(Int_t k=0;k<3;k++) fPosition[k] = position[k]; fIndices = 0; SetName("BaseVertex"); } //-------------------------------------------------------------------------- AliVertex::AliVertex(const AliVertex &source): TNamed(source), fSigma(source.GetDispersion()), fNContributors(source.GetNContributors()), fNIndices(source.GetNIndices()), fIndices(0x0) { // // Copy constructor // for(Int_t i=0;i<3;i++)fPosition[i] = source.fPosition[i]; if(source.fNIndices>0) { fIndices = new UShort_t[fNIndices]; memcpy(fIndices,source.fIndices,fNIndices*sizeof(UShort_t)); } } //-------------------------------------------------------------------------- AliVertex &AliVertex::operator=(const AliVertex &source){ // // assignment operator // if(&source == this) return *this; this->SetName(source.GetName()); this->SetTitle(source.GetTitle()); for(Int_t i=0;i<3;i++)fPosition[i] = source.fPosition[i]; fSigma = source.GetDispersion(); fNContributors = source.GetNContributors(); fNIndices = source.GetNIndices(); fIndices = 0x0; if(source.fNIndices>0) { fIndices = new UShort_t[fNIndices]; memcpy(fIndices,source.fIndices,fNIndices*sizeof(UShort_t)); } return *this; } //-------------------------------------------------------------------------- AliVertex::~AliVertex() { // // Default Destructor // delete [] fIndices; } //-------------------------------------------------------------------------- void AliVertex::GetXYZ(Double_t position[3]) const { // // Return position of the vertex in global frame // position[0] = fPosition[0]; position[1] = fPosition[1]; position[2] = fPosition[2]; return; } //-------------------------------------------------------------------------- void AliVertex::SetIndices(Int_t nindices,UShort_t *indices) { // // Set indices of tracks used for vertex determination // if(fNContributors<1) { printf("fNContributors<1"); return; } fNIndices = nindices; delete [] fIndices; fIndices = new UShort_t[fNIndices]; for(Int_t i=0;i