Reconstruct the vertex and direction of a track-like Pfos.
136 if (pDaughterPfo->GetParentPfoList().size() != 1)
137 throw StatusCodeException(STATUS_CODE_FAILURE);
139 const ParticleFlowObject *
const pParentPfo = *(pDaughterPfo->GetParentPfoList().begin());
141 ClusterList parentList, daughterList;
145 if (parentList.empty() && pParentPfo->GetVertexList().empty())
148 bool foundVtx(
false);
149 float vtxDistance(0.
f);
150 CartesianVector vtxPosition(0.
f, 0.
f, 0.
f);
151 CartesianVector vtxDirection(0.
f, 0.
f, 0.
f);
155 const Cluster *
const pDaughterCluster = *dIter;
157 CartesianVector minPosition(0.
f, 0.
f, 0.
f), maxPosition(0.
f, 0.
f, 0.
f);
158 CartesianVector minDirection(0.
f, 0.
f, 0.
f), maxDirection(0.
f, 0.
f, 0.
f);
159 bool foundDirection(
false);
163 if (pointingClusterMap.end() != cIter)
165 const LArPointingCluster &pointingCluster(cIter->second);
167 minPosition = pointingCluster.GetInnerVertex().GetPosition();
168 maxPosition = pointingCluster.GetOuterVertex().GetPosition();
169 minDirection = pointingCluster.GetInnerVertex().GetDirection();
170 maxDirection = pointingCluster.GetOuterVertex().GetDirection();
171 foundDirection =
true;
178 if ((maxPosition - minPosition).GetMagnitudeSquared() < std::numeric_limits<float>::epsilon())
183 minDirection = (maxPosition - minPosition).GetUnitVector();
184 maxDirection = (minPosition - maxPosition).GetUnitVector();
192 const Cluster *
const pParentCluster = *pIter;
199 const Vertex *
const pVertex = *(pParentPfo->GetVertexList().begin());
200 minDistance =
std::min(minDistance, (pVertex->GetPosition() - minPosition).GetMagnitude());
201 maxDistance =
std::min(maxDistance, (pVertex->GetPosition() - maxPosition).GetMagnitude());
204 if (!foundVtx || (minDistance < vtxDistance))
207 vtxDistance = minDistance;
208 vtxPosition = minPosition;
209 vtxDirection = minDirection;
212 if (!foundVtx || (maxDistance < vtxDistance))
215 vtxDistance = maxDistance;
216 vtxPosition = maxPosition;
217 vtxDirection = maxDirection;
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.
static int max(int a, int b)
static bool IsNeutrino(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
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) ...
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void SetParticleParameters(const pandora::CartesianVector &vtxPosition, const pandora::CartesianVector &vtxDirection, const pandora::ParticleFlowObject *const pPfo) const
Set the vertex and direction of the Pfos.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.