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);
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);
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());
189 const float vtxVerticalCoordinate(
m_isDualPhase ? vtxPosition.GetX() : vtxPosition.GetY());
190 const float endVerticalCoordinate(
m_isDualPhase ? endPosition.GetX() : endPosition.GetY());
192 if (!foundVtx || (minVerticalCoordinate >
std::max(maxVerticalCoordinate, vtxVerticalCoordinate)))
195 vtxPosition = minPosition;
196 vtxDirection = minDirection;
199 if (!foundVtx || (maxVerticalCoordinate >
std::max(minVerticalCoordinate, vtxVerticalCoordinate)))
202 vtxPosition = maxPosition;
203 vtxDirection = maxDirection;
206 if (!foundEnd || (minVerticalCoordinate <
std::min(maxVerticalCoordinate, endVerticalCoordinate)))
209 endPosition = minPosition;
210 endDirection = minDirection;
213 if (!foundEnd || (maxVerticalCoordinate <
std::min(minVerticalCoordinate, endVerticalCoordinate)))
216 endPosition = maxPosition;
217 endDirection = maxDirection;
220 catch (StatusCodeException &statusCodeException)
222 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
223 throw statusCodeException;
229 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 int max(int a, int b)
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)