Reconstruct the vertex and direction of a parent cosmic-ray Pfo.
141 ClusterList clusterList;
144 if (clusterList.empty())
148 bool foundVtx(
false);
149 CartesianVector vtxPosition(0.f, 0.f, 0.f);
150 CartesianVector vtxDirection(0.f, 0.f, 0.f);
152 bool foundEnd(
false);
153 CartesianVector endPosition(0.f, 0.f, 0.f);
154 CartesianVector endDirection(0.f, 0.f, 0.f);
156 for (ClusterList::const_iterator cIter1 = clusterList.begin(), cIterEnd1 = clusterList.end(); cIter1 != cIterEnd1; ++cIter1)
158 const Cluster *
const pCluster = *cIter1;
162 CartesianVector minPosition(0.f, 0.f, 0.f), maxPosition(0.f, 0.f, 0.f);
163 CartesianVector minDirection(0.f, 0.f, 0.f), maxDirection(0.f, 0.f, 0.f);
165 LArPointingClusterMap::const_iterator cIter2 = pointingClusterMap.find(pCluster);
167 if (pointingClusterMap.end() != cIter2)
169 const LArPointingCluster &pointingCluster(cIter2->second);
171 minPosition = pointingCluster.GetInnerVertex().GetPosition();
172 maxPosition = pointingCluster.GetOuterVertex().GetPosition();
173 minDirection = pointingCluster.GetInnerVertex().GetDirection();
174 maxDirection = pointingCluster.GetOuterVertex().GetDirection();
179 minDirection = (maxPosition - minPosition).GetUnitVector();
180 maxDirection = (minPosition - maxPosition).GetUnitVector();
183 if ((maxPosition - minPosition).GetMagnitudeSquared() < std::numeric_limits<float>::epsilon())
184 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
187 const float minVerticalCoordinate(
m_isDualPhase ? minPosition.GetX() : minPosition.GetY());
188 const float maxVerticalCoordinate(
m_isDualPhase ? maxPosition.GetX() : maxPosition.GetY());
190 if (!foundVtx || (minVerticalCoordinate > std::max(maxVerticalCoordinate,
m_isDualPhase ? vtxPosition.GetX() : vtxPosition.GetY())))
193 vtxPosition = minPosition;
194 vtxDirection = minDirection;
197 if (!foundVtx || (maxVerticalCoordinate > std::max(minVerticalCoordinate,
m_isDualPhase ? vtxPosition.GetX() : vtxPosition.GetY())))
200 vtxPosition = maxPosition;
201 vtxDirection = maxDirection;
204 if (!foundEnd || (minVerticalCoordinate < std::min(maxVerticalCoordinate,
m_isDualPhase ? endPosition.GetX() : endPosition.GetY())))
207 endPosition = minPosition;
208 endDirection = minDirection;
211 if (!foundEnd || (maxVerticalCoordinate < std::min(minVerticalCoordinate,
m_isDualPhase ? endPosition.GetX() : endPosition.GetY())))
214 endPosition = maxPosition;
215 endDirection = maxDirection;
218 catch (StatusCodeException &statusCodeException)
220 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
221 throw statusCodeException;
227 if (!(foundVtx && foundEnd))
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
void SetParticleParameters(const pandora::CartesianVector &vtxPosition, const pandora::CartesianVector &vtxDirection, const pandora::ParticleFlowObject *const pPfo) const
Set the vertex and direction of the Pfos.
bool m_isDualPhase
type of geometry
static void GetExtremalCoordinates(const pandora::ClusterList &clusterList, pandora::CartesianVector &innerCoordinate, pandora::CartesianVector &outerCoordinate)
Get positions of the two most distant calo hits in a list of cluster (ordered by Z) ...