LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
VertexTuple.cc
Go to the documentation of this file.
1 
10 
12 
13 using namespace pandora;
14 using namespace lar_content;
15 
16 namespace lar_dl_content
17 {
18 
19 VertexTuple::VertexTuple(const Pandora &pandora, const CartesianVector &vertexU, const CartesianVector &vertexV, const CartesianVector &vertexW) :
20  m_pos{0.f, 0.f, 0.f},
21  m_chi2{0.f}
22 {
23  LArGeometryHelper::MergeThreePositions3D(pandora, TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W, vertexU, vertexV, vertexW, m_pos, m_chi2);
24  if (m_chi2 <= 1.f)
25  {
26  m_components.emplace_back(vertexU);
27  m_components.emplace_back(vertexV);
28  m_components.emplace_back(vertexW);
29  }
30  else
31  {
32  CartesianVector vertexUV(0.f, 0.f, 0.f);
33  float chi2UV{0.f};
34  LArGeometryHelper::MergeTwoPositions3D(pandora, TPC_VIEW_U, TPC_VIEW_V, vertexU, vertexV, vertexUV, chi2UV);
35 
36  CartesianVector vertexUW(0.f, 0.f, 0.f);
37  float chi2UW{0.f};
38  LArGeometryHelper::MergeTwoPositions3D(pandora, TPC_VIEW_U, TPC_VIEW_W, vertexU, vertexW, vertexUW, chi2UW);
39 
40  CartesianVector vertexVW(0.f, 0.f, 0.f);
41  float chi2VW{0.f};
42  LArGeometryHelper::MergeTwoPositions3D(pandora, TPC_VIEW_V, TPC_VIEW_W, vertexV, vertexW, vertexVW, chi2VW);
43 
44  if (chi2UV < m_chi2)
45  {
46  m_pos = vertexUV;
47  m_chi2 = chi2UV;
48  m_components.emplace_back(vertexU);
49  m_components.emplace_back(vertexV);
50  }
51  if (chi2UW < m_chi2)
52  {
53  m_pos = vertexUW;
54  m_chi2 = chi2UW;
55  m_components.clear();
56  m_components.emplace_back(vertexU);
57  m_components.emplace_back(vertexW);
58  }
59  if (chi2VW < m_chi2)
60  {
61  m_pos = vertexVW;
62  m_chi2 = chi2VW;
63  m_components.clear();
64  m_components.emplace_back(vertexV);
65  m_components.emplace_back(vertexW);
66  }
67  }
68 }
69 
70 //-----------------------------------------------------------------------------------------------------------------------------------------
71 
72 VertexTuple::VertexTuple(const Pandora &pandora, const CartesianVector &vertex1, const CartesianVector &vertex2, const HitType view1, const HitType view2) :
73  m_pos{0.f, 0.f, 0.f},
74  m_chi2{0.f}
75 {
76  m_components.emplace_back(vertex1);
77  m_components.emplace_back(vertex2);
78 
79  LArGeometryHelper::MergeTwoPositions3D(pandora, view1, view2, vertex1, vertex2, m_pos, m_chi2);
80 }
81 
82 //-----------------------------------------------------------------------------------------------------------------------------------------
83 
84 const CartesianVector &VertexTuple::GetPosition() const
85 {
86  return m_pos;
87 }
88 
89 //-----------------------------------------------------------------------------------------------------------------------------------------
90 
91 const CartesianPointVector &VertexTuple::GetComponents() const
92 {
93  return m_components;
94 }
95 
96 //-----------------------------------------------------------------------------------------------------------------------------------------
97 
98 float VertexTuple::GetChi2() const
99 {
100  return m_chi2;
101 }
102 
103 //-----------------------------------------------------------------------------------------------------------------------------------------
104 
105 std::string VertexTuple::ToString() const
106 {
107  const float x{m_pos.GetX()}, y{m_pos.GetY()}, z{m_pos.GetZ()};
108  return "3D pos: (" + std::to_string(x) + ", " + std::to_string(y) + ", " + std::to_string(z) + ") X2 = " + std::to_string(m_chi2);
109 }
110 
111 } // namespace lar_dl_content
Float_t x
Definition: compare.C:6
Header file for the vertex tuple object.
const pandora::CartesianPointVector & GetComponents() const
Definition: VertexTuple.cc:91
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
TFile f
Definition: plotHisto.C:6
Header file for the geometry helper class.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
const pandora::CartesianVector & GetPosition() const
Definition: VertexTuple.cc:84
HitType
Definition: HitType.h:12
std::string ToString() const
Definition: VertexTuple.cc:105
VertexTuple(const pandora::Pandora &pandora, const pandora::CartesianVector &vertexU, const pandora::CartesianVector &vertexV, const pandora::CartesianVector &vertexW)