9 #include "Pandora/AlgorithmHeaders.h"
20 void ClearLongitudinalTrackHitsTool::GetLongitudinalTrackHit3D(
24 const HitType hitType(pCaloHit2D->GetHitType());
25 const HitType hitType1((TPC_VIEW_U == hitType) ? TPC_VIEW_V : (TPC_VIEW_V == hitType) ? TPC_VIEW_W : TPC_VIEW_U);
26 const HitType hitType2((TPC_VIEW_U == hitType) ? TPC_VIEW_W : (TPC_VIEW_V == hitType) ? TPC_VIEW_U : TPC_VIEW_V);
28 const CartesianVector vtx2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), vtx3D, hitType));
29 const CartesianVector end2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), end3D, hitType));
31 if ((end2D - vtx2D).GetMagnitudeSquared() < std::numeric_limits<float>::epsilon())
32 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
34 const float frac((end2D - vtx2D).GetDotProduct(pCaloHit2D->GetPositionVector() - vtx2D) / (end2D - vtx2D).GetMagnitudeSquared());
35 const CartesianVector projection3D(vtx3D + (end3D - vtx3D) * frac);
37 CartesianPointVector fitPositionList1, fitPositionList2;
39 MatchedSlidingFitMap::const_iterator fIter1 = matchedSlidingFitMap.find(hitType1);
40 if (matchedSlidingFitMap.end() != fIter1)
43 const CartesianVector position2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), projection3D, hitType1));
45 float rL1(0.f), rT1(0.f);
46 CartesianVector position1(0.f, 0.f, 0.f);
50 if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
51 throw StatusCodeException(statusCode);
53 if (STATUS_CODE_SUCCESS == statusCode)
54 fitPositionList1.push_back(position1);
57 MatchedSlidingFitMap::const_iterator fIter2 = matchedSlidingFitMap.find(hitType2);
58 if (matchedSlidingFitMap.end() != fIter2)
61 const CartesianVector position2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), projection3D, hitType2));
63 float rL2(0.f), rT2(0.f);
64 CartesianVector position2(0.f, 0.f, 0.f);
68 if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
69 throw StatusCodeException(statusCode);
71 if (STATUS_CODE_SUCCESS == statusCode)
72 fitPositionList2.push_back(position2);
75 unsigned int nViews(1);
76 if (fitPositionList1.size() > 0)
78 if (fitPositionList2.size() > 0)
81 if (nViews < m_minViews)
82 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
84 this->GetBestPosition3D(hitType1, hitType2, fitPositionList1, fitPositionList2, protoHit);
Proto hits are temporary constructs to be used during iterative 3D hit procedure. ...
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
Header file for the geometry helper class.
const FitSegment & GetFitSegment(const float rL) const
Get fit segment for a given longitudinal coordinate.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
pandora::StatusCode GetTransverseProjection(const float x, const FitSegment &fitSegment, pandora::CartesianVector &position) const
Get projected position for a given input x coordinate and fit segment.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
TwoDSlidingFitResult class.