26 m_spineSlidingFitWindow(20),
27 m_maxXSeparation(5.f),
29 m_maxAngularDeviation(5.f)
38 IntVector usedProtoShowersU, usedProtoShowersV, usedProtoShowersW;
42 for (
unsigned int uIndex = 0; uIndex < protoShowerVectorU.size(); ++uIndex)
46 if (std::find(usedProtoShowersU.begin(), usedProtoShowersU.end(), uIndex) != usedProtoShowersU.end())
49 const ProtoShower &protoShowerU(protoShowerVectorU.at(uIndex));
51 for (
unsigned int vIndex = 0; vIndex < protoShowerVectorV.size(); ++vIndex)
53 if (std::find(usedProtoShowersV.begin(), usedProtoShowersV.end(), vIndex) != usedProtoShowersV.end())
56 const ProtoShower &protoShowerV(protoShowerVectorV.at(vIndex));
58 for (
unsigned int wIndex = 0; wIndex < protoShowerVectorW.size(); ++wIndex)
60 if (std::find(usedProtoShowersW.begin(), usedProtoShowersW.end(), wIndex) != usedProtoShowersW.end())
63 const ProtoShower &protoShowerW(protoShowerVectorW.at(wIndex));
69 usedProtoShowersU.push_back(uIndex);
70 usedProtoShowersV.push_back(vIndex);
71 usedProtoShowersW.push_back(wIndex);
73 protoShowerMatchVector.push_back(
ProtoShowerMatch(protoShowerU, protoShowerV, protoShowerW, consistency));
84 return STATUS_CODE_SUCCESS;
116 const float xSeparationUV(std::fabs(showerStartU.
GetX() - showerStartV.
GetX()));
117 const float xSeparationUW(std::fabs(showerStartU.
GetX() - showerStartW.
GetX()));
118 const float xSeparationVW(std::fabs(showerStartV.
GetX() - showerStartW.
GetX()));
124 CartesianVector projectionU(0.f, 0.f, 0.f), projectionV(0.f, 0.f, 0.f), projectionW(0.f, 0.f, 0.f);
130 const float separationU((projectionU - showerStartU).GetMagnitude());
131 const float separationV((projectionV - showerStartV).GetMagnitude());
132 const float separationW((projectionW - showerStartW).GetMagnitude());
134 const float metric((separationU + separationV + separationW) / 3.f);
153 const bool isDownstream(
159 spinePositionsU.push_back(pCaloHit->GetPositionVector());
162 spinePositionsV.push_back(pCaloHit->GetPositionVector());
165 spinePositionsW.push_back(pCaloHit->GetPositionVector());
188 wireDeviationU = std::min(wireDeviationU,
static_cast<float>(M_PI - wireDeviationU));
191 wireDeviationV = std::min(wireDeviationV,
static_cast<float>(M_PI - wireDeviationV));
194 wireDeviationW = std::min(wireDeviationW,
static_cast<float>(M_PI - wireDeviationW));
196 float radians((2.f * M_PI) / 180.f);
197 bool isIsochronous((wireDeviationU < radians) && (wireDeviationV < radians) && (wireDeviationW < radians));
207 if (directionU.
GetX() * directionV.
GetX() < 0.f)
210 if (directionU.
GetX() * directionW.
GetX() < 0.f)
213 if (directionV.
GetX() * directionW.
GetX() < 0.f)
220 float openingAngleU(directionU.
GetOpeningAngle(projectionU) * 180.f / M_PI);
221 float openingAngleV(directionV.
GetOpeningAngle(projectionV) * 180.f / M_PI);
222 float openingAngleW(directionW.
GetOpeningAngle(projectionW) * 180.f / M_PI);
226 openingAngleU = std::min(openingAngleU, 180.f - openingAngleU);
227 openingAngleV = std::min(openingAngleV, 180.f - openingAngleV);
228 openingAngleW = std::min(openingAngleW, 180.f - openingAngleW);
251 return STATUS_CODE_SUCCESS;
Header file for the connection pathway helper class.
Header file for the geometry helper class.
Header file for the ProtoShower class.
Header file for the lar two dimensional sliding fit result class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
const pandora::CartesianVector & GetStartDirection() const
Get the start direction of the connection pathway.
const pandora::CartesianVector & GetStartPosition() const
Get the start position of the connection pathway.
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).
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
static pandora::CartesianVector MergeTwoDirections(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const pandora::CartesianVector &direction1, const pandora::CartesianVector &direction2)
Merge two views (U,V) to give a third view (Z).
const ShowerCore & GetShowerCore() const
Get the shower core.
const ConnectionPathway & GetConnectionPathway() const
Get the connection pathway.
const pandora::CaloHitList & GetSpineHitList() const
Get the spine hit list.
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.
float m_maxAngularDeviation
The max. opening angle between true and projected 2D initial directions for a match.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float m_maxXSeparation
The max. drift-coordinate separation between matched 2D shower start positions.
float m_maxSeparation
The max. average separation between true and projected 2D shower start positions for a match.
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...
ProtoShowerMatchingTool()
Default constructor.
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.
unsigned int m_spineSlidingFitWindow
The shower spine sliding fit window.
pandora::StatusCode Run(const ProtoShowerVector &protoShowerVectorU, const ProtoShowerVector &protoShowerVectorV, const ProtoShowerVector &protoShowerVectorW, ProtoShowerMatchVector &protoShowerMatchVector)
const pandora::CartesianVector & GetStartPosition() const
Get the start position of the shower core.
TwoDSlidingFitResult class.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
float GetX() const
Get the cartesian x coordinate.
float GetZ() const
Get the cartesian z coordinate.
float GetOpeningAngle(const CartesianVector &rhs) const
Get the opening angle of the cartesian vector with respect to a second cartesian vector.
const Pandora & GetPandora() const
Get the associated pandora instance.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
std::vector< ProtoShower > ProtoShowerVector
Consistency
Consistency enumeration.
std::vector< ProtoShowerMatch > ProtoShowerMatchVector
std::vector< int > IntVector
std::vector< CartesianVector > CartesianPointVector
StatusCode
The StatusCode enum.