LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::ProtoShowerMatchingTool Class Reference

#include "ProtoShowerMatchingTool.h"

Inheritance diagram for lar_content::ProtoShowerMatchingTool:

Public Member Functions

 ProtoShowerMatchingTool ()
 Default constructor. More...
 
pandora::StatusCode Run (const ProtoShowerVector &protoShowerVectorU, const ProtoShowerVector &protoShowerVectorV, const ProtoShowerVector &protoShowerVectorW, ProtoShowerMatchVector &protoShowerMatchVector)
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
bool ArePathwaysConsistent (const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW, Consistency &consistency) const
 Determine whether three 2D connection pathways form a consistent 3D connection pathway. More...
 
bool AreShowerStartsConsistent (const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW) const
 Determine whether three 2D shower start positions correspond to the same 3D shower start position. More...
 
bool AreDirectionsConsistent (const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW) const
 Determine whether three 2D initial spine directions correspond to the same 3D initial spine direction. More...
 
bool AreDirectionsConsistent (const pandora::CartesianVector &nuVertexU, const pandora::CartesianVector &nuVertexV, const pandora::CartesianVector &nuVertexW, const pandora::CartesianVector &directionU, const pandora::CartesianVector &directionV, const pandora::CartesianVector &directionW) const
 Determine whether three 2D initial spine directions correspond to the same 3D initial spine direction. More...
 

Private Attributes

unsigned int m_spineSlidingFitWindow
 The shower spine sliding fit window. More...
 
float m_maxXSeparation
 The max. drift-coordinate separation between matched 2D shower start positions. More...
 
float m_maxSeparation
 The max. average separation between true and projected 2D shower start positions for a match. More...
 
float m_xExtrapolation
 Extrapolation distance in the x-direction. More...
 
float m_maxAngularDeviation
 The max. opening angle between true and projected 2D initial directions for a match. More...
 

Detailed Description

Definition at line 19 of file ProtoShowerMatchingTool.h.

Constructor & Destructor Documentation

lar_content::ProtoShowerMatchingTool::ProtoShowerMatchingTool ( )

Default constructor.

Definition at line 25 of file ProtoShowerMatchingTool.cc.

25  :
28  m_maxSeparation(5.f),
31 {
32 }
float m_maxXSeparation
The max. drift-coordinate separation between matched 2D shower start positions.
TFile f
Definition: plotHisto.C:6
unsigned int m_spineSlidingFitWindow
The shower spine sliding fit window.
float m_maxAngularDeviation
The max. opening angle between true and projected 2D initial directions for a match.
float m_maxSeparation
The max. average separation between true and projected 2D shower start positions for a match...
float m_xExtrapolation
Extrapolation distance in the x-direction.

Member Function Documentation

bool lar_content::ProtoShowerMatchingTool::AreDirectionsConsistent ( const ProtoShower protoShowerU,
const ProtoShower protoShowerV,
const ProtoShower protoShowerW 
) const
private

Determine whether three 2D initial spine directions correspond to the same 3D initial spine direction.

Parameters
protoShowerUthe U view ProtoShower
protoShowerVthe V view ProtoShower
protoShowerWthe W view ProtoShower
Returns
whether three 2D initial spine directions correspond to the same 3D initial spine direction

Definition at line 142 of file ProtoShowerMatchingTool.cc.

References f, lar_content::ProtoShower::GetConnectionPathway(), lar_content::TwoDSlidingFitResult::GetGlobalMaxLayerDirection(), lar_content::TwoDSlidingFitResult::GetGlobalMinLayerDirection(), lar_content::ProtoShower::GetShowerCore(), lar_content::ProtoShower::GetSpineHitList(), lar_content::ConnectionPathway::GetStartDirection(), lar_content::ShowerCore::GetStartPosition(), lar_content::ConnectionPathway::GetStartPosition(), lar_content::LArGeometryHelper::GetWirePitch(), m_maxAngularDeviation, m_spineSlidingFitWindow, m_xExtrapolation, and lar_content::LArGeometryHelper::MergeTwoPositions().

Referenced by ArePathwaysConsistent().

143 {
144  const CartesianVector &directionU1(protoShowerU.GetConnectionPathway().GetStartDirection());
145  const CartesianVector &directionV1(protoShowerV.GetConnectionPathway().GetStartDirection());
146  const CartesianVector &directionW1(protoShowerW.GetConnectionPathway().GetStartDirection());
147 
148  if (this->AreDirectionsConsistent(protoShowerU.GetConnectionPathway().GetStartPosition(), protoShowerV.GetConnectionPathway().GetStartPosition(),
149  protoShowerW.GetConnectionPathway().GetStartPosition(), directionU1, directionV1, directionW1))
150  {
151  return true;
152  }
153  else
154  {
155  const bool isDownstream(
156  protoShowerW.GetShowerCore().GetStartPosition().GetZ() > protoShowerW.GetConnectionPathway().GetStartPosition().GetZ());
157 
158  CartesianPointVector spinePositionsU, spinePositionsV, spinePositionsW;
159 
160  for (const CaloHit *const pCaloHit : protoShowerU.GetSpineHitList())
161  spinePositionsU.push_back(pCaloHit->GetPositionVector());
162 
163  for (const CaloHit *const pCaloHit : protoShowerV.GetSpineHitList())
164  spinePositionsV.push_back(pCaloHit->GetPositionVector());
165 
166  for (const CaloHit *const pCaloHit : protoShowerW.GetSpineHitList())
167  spinePositionsW.push_back(pCaloHit->GetPositionVector());
168 
169  const TwoDSlidingFitResult spineFitU(&spinePositionsU, m_spineSlidingFitWindow, LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_U));
170  const TwoDSlidingFitResult spineFitV(&spinePositionsV, m_spineSlidingFitWindow, LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_V));
171  const TwoDSlidingFitResult spineFitW(&spinePositionsW, m_spineSlidingFitWindow, LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_W));
172 
173  const CartesianVector directionU2(isDownstream ? spineFitU.GetGlobalMinLayerDirection() : spineFitU.GetGlobalMaxLayerDirection() * (-1.f));
174  const CartesianVector directionV2(isDownstream ? spineFitV.GetGlobalMinLayerDirection() : spineFitV.GetGlobalMaxLayerDirection() * (-1.f));
175  const CartesianVector directionW2(isDownstream ? spineFitW.GetGlobalMinLayerDirection() : spineFitW.GetGlobalMaxLayerDirection() * (-1.f));
176 
177  return this->AreDirectionsConsistent(protoShowerU.GetConnectionPathway().GetStartPosition(),
178  protoShowerV.GetConnectionPathway().GetStartPosition(), protoShowerW.GetConnectionPathway().GetStartPosition(), directionU2,
179  directionV2, directionW2);
180  }
181 
182  return false;
183 }
bool AreDirectionsConsistent(const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW) const
Determine whether three 2D initial spine directions correspond to the same 3D initial spine direction...
unsigned int m_spineSlidingFitWindow
The shower spine sliding fit window.
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
bool lar_content::ProtoShowerMatchingTool::AreDirectionsConsistent ( const pandora::CartesianVector &  nuVertexU,
const pandora::CartesianVector &  nuVertexV,
const pandora::CartesianVector &  nuVertexW,
const pandora::CartesianVector &  directionU,
const pandora::CartesianVector &  directionV,
const pandora::CartesianVector &  directionW 
) const
private

Determine whether three 2D initial spine directions correspond to the same 3D initial spine direction.

Parameters
nuVertexUthe U view projection of the neutrino vertex
nuVertexVthe V view projection of the neutrino vertex
nuVertexWthe W view projection of the neutrino vertex
directionUthe U view initial spine direction
directionUthe V view initial spine direction
directionUthe W view initial spine direction
Returns
whether three 2D initial spine directions correspond to the same 3D initial spine direction
bool lar_content::ProtoShowerMatchingTool::ArePathwaysConsistent ( const ProtoShower protoShowerU,
const ProtoShower protoShowerV,
const ProtoShower protoShowerW,
Consistency consistency 
) const
private

Determine whether three 2D connection pathways form a consistent 3D connection pathway.

Parameters
protoShowerUthe U view ProtoShower
protoShowerVthe V view ProtoShower
protoShowerWthe W view ProtoShower
consistencythe basis of the match
Returns
whether three 2D connection pathways form a consistent 3D connection pathway

Definition at line 90 of file ProtoShowerMatchingTool.cc.

References AreDirectionsConsistent(), AreShowerStartsConsistent(), lar_content::DIRECTION, and lar_content::POSITION.

Referenced by Run().

92 {
93  if (this->AreShowerStartsConsistent(protoShowerU, protoShowerV, protoShowerW))
94  {
95  consistency = Consistency::POSITION;
96  }
97  else if (this->AreDirectionsConsistent(protoShowerU, protoShowerV, protoShowerW))
98  {
99  consistency = Consistency::DIRECTION;
100  }
101  else
102  {
103  return false;
104  }
105 
106  return true;
107 }
bool AreDirectionsConsistent(const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW) const
Determine whether three 2D initial spine directions correspond to the same 3D initial spine direction...
bool AreShowerStartsConsistent(const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW) const
Determine whether three 2D shower start positions correspond to the same 3D shower start position...
bool lar_content::ProtoShowerMatchingTool::AreShowerStartsConsistent ( const ProtoShower protoShowerU,
const ProtoShower protoShowerV,
const ProtoShower protoShowerW 
) const
private

Determine whether three 2D shower start positions correspond to the same 3D shower start position.

Parameters
protoShowerUthe U view ProtoShower
protoShowerVthe V view ProtoShower
protoShowerWthe W view ProtoShower
Returns
whether three 2D shower start positions correspond to the same 3D shower start position

Definition at line 111 of file ProtoShowerMatchingTool.cc.

References f, lar_content::ProtoShower::GetShowerCore(), lar_content::ShowerCore::GetStartPosition(), m_maxSeparation, m_maxXSeparation, and lar_content::LArGeometryHelper::MergeTwoPositions().

Referenced by ArePathwaysConsistent().

112 {
113  const CartesianVector &showerStartU(protoShowerU.GetShowerCore().GetStartPosition());
114  const CartesianVector &showerStartV(protoShowerV.GetShowerCore().GetStartPosition());
115  const CartesianVector &showerStartW(protoShowerW.GetShowerCore().GetStartPosition());
116 
117  const float xSeparationUV(std::fabs(showerStartU.GetX() - showerStartV.GetX()));
118  const float xSeparationUW(std::fabs(showerStartU.GetX() - showerStartW.GetX()));
119  const float xSeparationVW(std::fabs(showerStartV.GetX() - showerStartW.GetX()));
120 
121  if ((xSeparationUV > m_maxXSeparation) || (xSeparationUW > m_maxXSeparation) || (xSeparationVW > m_maxXSeparation))
122  return false;
123 
124  float chi2(0.f);
125  CartesianVector projectionU(0.f, 0.f, 0.f), projectionV(0.f, 0.f, 0.f), projectionW(0.f, 0.f, 0.f);
126 
127  LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, showerStartV, showerStartW, projectionU, chi2);
128  LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_W, TPC_VIEW_U, showerStartW, showerStartU, projectionV, chi2);
129  LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, showerStartU, showerStartV, projectionW, chi2);
130 
131  const float separationU((projectionU - showerStartU).GetMagnitude());
132  const float separationV((projectionV - showerStartV).GetMagnitude());
133  const float separationW((projectionW - showerStartW).GetMagnitude());
134 
135  const float metric((separationU + separationV + separationW) / 3.f);
136 
137  return (metric < m_maxSeparation);
138 }
float m_maxXSeparation
The max. drift-coordinate separation between matched 2D shower start positions.
TFile f
Definition: plotHisto.C:6
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
float m_maxSeparation
The max. average separation between true and projected 2D shower start positions for a match...
StatusCode lar_content::ProtoShowerMatchingTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 258 of file ProtoShowerMatchingTool.cc.

References m_maxAngularDeviation, m_maxSeparation, m_maxXSeparation, m_spineSlidingFitWindow, and m_xExtrapolation.

259 {
260  PANDORA_RETURN_RESULT_IF_AND_IF(
261  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SpineSlidingFitWindow", m_spineSlidingFitWindow));
262 
263  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxXSeparation", m_maxXSeparation));
264 
265  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxSeparation", m_maxSeparation));
266 
267  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "XExtrapolation", m_xExtrapolation));
268 
269  PANDORA_RETURN_RESULT_IF_AND_IF(
270  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxAngularDeviation", m_maxAngularDeviation));
271 
272  return STATUS_CODE_SUCCESS;
273 }
float m_maxXSeparation
The max. drift-coordinate separation between matched 2D shower start positions.
unsigned int m_spineSlidingFitWindow
The shower spine sliding fit window.
float m_maxAngularDeviation
The max. opening angle between true and projected 2D initial directions for a match.
float m_maxSeparation
The max. average separation between true and projected 2D shower start positions for a match...
float m_xExtrapolation
Extrapolation distance in the x-direction.
StatusCode lar_content::ProtoShowerMatchingTool::Run ( const ProtoShowerVector protoShowerVectorU,
const ProtoShowerVector protoShowerVectorV,
const ProtoShowerVector protoShowerVectorW,
ProtoShowerMatchVector protoShowerMatchVector 
)

Definition at line 36 of file ProtoShowerMatchingTool.cc.

References ArePathwaysConsistent(), and lar_content::POSITION.

Referenced by lar_content::ElectronInitialRegionRefinementAlgorithm::RefineShower().

38 {
39  IntVector usedProtoShowersU, usedProtoShowersV, usedProtoShowersW;
40 
41  bool added(false);
42 
43  for (unsigned int uIndex = 0; uIndex < protoShowerVectorU.size(); ++uIndex)
44  {
45  added = false;
46 
47  if (std::find(usedProtoShowersU.begin(), usedProtoShowersU.end(), uIndex) != usedProtoShowersU.end())
48  continue;
49 
50  const ProtoShower &protoShowerU(protoShowerVectorU.at(uIndex));
51 
52  for (unsigned int vIndex = 0; vIndex < protoShowerVectorV.size(); ++vIndex)
53  {
54  if (std::find(usedProtoShowersV.begin(), usedProtoShowersV.end(), vIndex) != usedProtoShowersV.end())
55  continue;
56 
57  const ProtoShower &protoShowerV(protoShowerVectorV.at(vIndex));
58 
59  for (unsigned int wIndex = 0; wIndex < protoShowerVectorW.size(); ++wIndex)
60  {
61  if (std::find(usedProtoShowersW.begin(), usedProtoShowersW.end(), wIndex) != usedProtoShowersW.end())
62  continue;
63 
64  const ProtoShower &protoShowerW(protoShowerVectorW.at(wIndex));
66 
67  if (!this->ArePathwaysConsistent(protoShowerU, protoShowerV, protoShowerW, consistency))
68  continue;
69 
70  usedProtoShowersU.push_back(uIndex);
71  usedProtoShowersV.push_back(vIndex);
72  usedProtoShowersW.push_back(wIndex);
73 
74  protoShowerMatchVector.push_back(ProtoShowerMatch(protoShowerU, protoShowerV, protoShowerW, consistency));
75 
76  added = true;
77  break;
78  }
79 
80  if (added)
81  break;
82  }
83  }
84 
85  return STATUS_CODE_SUCCESS;
86 }
Consistency
Consistency enumeration.
std::vector< int > IntVector
bool ArePathwaysConsistent(const ProtoShower &protoShowerU, const ProtoShower &protoShowerV, const ProtoShower &protoShowerW, Consistency &consistency) const
Determine whether three 2D connection pathways form a consistent 3D connection pathway.

Member Data Documentation

float lar_content::ProtoShowerMatchingTool::m_maxAngularDeviation
private

The max. opening angle between true and projected 2D initial directions for a match.

Definition at line 88 of file ProtoShowerMatchingTool.h.

Referenced by AreDirectionsConsistent(), and ReadSettings().

float lar_content::ProtoShowerMatchingTool::m_maxSeparation
private

The max. average separation between true and projected 2D shower start positions for a match.

Definition at line 86 of file ProtoShowerMatchingTool.h.

Referenced by AreShowerStartsConsistent(), and ReadSettings().

float lar_content::ProtoShowerMatchingTool::m_maxXSeparation
private

The max. drift-coordinate separation between matched 2D shower start positions.

Definition at line 85 of file ProtoShowerMatchingTool.h.

Referenced by AreShowerStartsConsistent(), and ReadSettings().

unsigned int lar_content::ProtoShowerMatchingTool::m_spineSlidingFitWindow
private

The shower spine sliding fit window.

Definition at line 84 of file ProtoShowerMatchingTool.h.

Referenced by AreDirectionsConsistent(), and ReadSettings().

float lar_content::ProtoShowerMatchingTool::m_xExtrapolation
private

Extrapolation distance in the x-direction.

Definition at line 87 of file ProtoShowerMatchingTool.h.

Referenced by AreDirectionsConsistent(), and ReadSettings().


The documentation for this class was generated from the following files: