LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Vertex.cxx
Go to the documentation of this file.
1 //
3 // \brief Definition of vertex object for LArSoft
4 //
5 // \author brebel@fnal.gov
6 //
8 
10 
11 #include <iomanip>
12 
13 namespace recob {
14 
15  //----------------------------------------------------------------------
17  {
18  status_ = Invalid;
22  }
23 
24  //----------------------------------------------------------------------
25  Vertex::Vertex(double* xyz, int id) : id_(id)
26  {
27  pos_ = Point_t(xyz[0], xyz[1], xyz[2]);
28  status_ = Valid;
31  }
32 
33  //----------------------------------------------------------------------
34  void Vertex::XYZ(double* xyz) const
35  {
36  xyz[0] = pos_.X();
37  xyz[1] = pos_.Y();
38  xyz[2] = pos_.Z();
39 
40  return;
41  }
42 
43  //----------------------------------------------------------------------
44  // ostream operator.
45  //
46  std::ostream& operator<<(std::ostream& o, const Vertex& a)
47  {
48  o << std::setprecision(5);
49  o << "Vertex ID " << a.id_ << std::setw(5) << " (x,y,z) = (" << a.pos_.X() << ","
50  << a.pos_.Y() << "," << a.pos_.Z() << ")";
51 
52  return o;
53  }
54 
55  //----------------------------------------------------------------------
56  // < operator.
57  //
58  bool operator<(const Vertex& a, const Vertex& b)
59  {
60  double xyza[3] = {0.};
61  double xyzb[3] = {0.};
62  a.XYZ(xyza);
63  b.XYZ(xyzb);
64 
65  return xyza[2] < xyzb[2];
66  }
67 
68 }
void XYZ(double *xyz) const
Legacy method to access vertex position, preserved to avoid breaking code. Please try to use Vertex::...
Definition: Vertex.cxx:34
Reconstruction base classes.
friend std::ostream & operator<<(std::ostream &o, const Vertex &a)
Definition: Vertex.cxx:46
Vertex()
Default constructor, initializes status to Invalid, and data members to default or kBogus values...
Definition: Vertex.cxx:16
constexpr int kBogusI
obviously bogus integer value
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
tracking::Point_t Point_t
Definition: Vertex.h:38
Status status_
Vertex status, as define in Vertex::Status enum.
Definition: Vertex.h:96
int id_
id number for vertex
Definition: Vertex.h:97
int ndof_
Vertex fit degrees of freedom.
Definition: Vertex.h:95
Point_t pos_
Vertex 3D position.
Definition: Vertex.h:92
double chi2_
Vertex fit chi2.
Definition: Vertex.h:94
friend bool operator<(const Vertex &a, const Vertex &b)
Definition: Vertex.cxx:58
constexpr double kBogusD
obviously bogus double value