21 #include "GFRaveVertex.h"
22 #include "GFRaveConverters.h"
23 #include <Exception.h>
32 static int instCount(0);
35 GFRaveVertex::GFRaveVertex() :
42 std::cerr <<
"GFRaveVertex::GFRaveVertex() - Number of objects: " << ++instCount << std::endl;
47 GFRaveVertex::GFRaveVertex(
const TVector3 & pos,
const TMatrixDSym& cov,
48 const std::vector < GFRaveTrackParameters* > & smoothedTracks,
49 double ndf,
double chi2,
int id) :
55 smoothedTracks_(smoothedTracks)
57 if (cov_.GetNrows()!=3 || cov_.GetNcols()!=3) {
58 Exception exc(
"GFRaveVertex ==> Covariance is not 3x3!",__LINE__,__FILE__);
63 std::cerr <<
"GFRaveVertex::GFRaveVertex(...) - Number of objects: " << ++instCount << std::endl;
68 GFRaveVertex::GFRaveVertex(
const GFRaveVertex & vertex) :
76 unsigned int nPar = vertex.smoothedTracks_.size();
77 smoothedTracks_.reserve(nPar);
78 for (
unsigned int i=0; i<nPar; ++i) {
79 smoothedTracks_.push_back(
new GFRaveTrackParameters(*(vertex.smoothedTracks_[i])));
83 std::cerr <<
"GFRaveVertex::GFRaveVertex(GFRaveVertex) - Number of objects: " << ++instCount << std::endl;
88 GFRaveVertex& GFRaveVertex::operator=(GFRaveVertex other) {
94 void GFRaveVertex::swap(GFRaveVertex& other) {
95 std::swap(this->pos_, other.pos_);
96 this->cov_.ResizeTo(other.cov_);
97 std::swap(this->cov_, other.cov_);
98 std::swap(this->ndf_, other.ndf_);
99 std::swap(this->chi2_, other.chi2_);
100 std::swap(this->id_, other.id_);
101 std::swap(this->smoothedTracks_, other.smoothedTracks_);
105 GFRaveVertex::~GFRaveVertex(){
106 unsigned int nPar = smoothedTracks_.size();
107 for (
unsigned int i=0; i<nPar; ++i) {
108 delete smoothedTracks_[i];
112 std::cerr <<
"GFRaveVertex::~GFRaveVertex() - Number of objects: " << --instCount << std::endl;
118 GFRaveVertex::Print(
const Option_t*)
const {
119 std::cout <<
"GFRaveVertex\n";
120 std::cout <<
"Position: "; getPos().Print();
121 std::cout <<
"Covariance: "; getCov().Print();
122 std::cout <<
"Ndf: " << getNdf() <<
", Chi2: " << getChi2() <<
", Id: " << getId() <<
"\n";
123 std::cout <<
"Number of tracks: " << getNTracks() <<
"\n";
124 for (
unsigned int i=0; i<getNTracks(); ++i) {
125 std::cout <<
" track " << i <<
":\n"; getParameters(i)->Print();
Defines for I/O streams used for error and debug printing.