Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
MultiValuedLongitudinalTrackHitsTool.cc
Go to the documentation of this file.
1
10
12
14
15using namespace pandora;
16
17namespace lar_content
18{
19
21 const MatchedSlidingFitMap &matchedSlidingFitMap, const CartesianVector &vtx3D, const CartesianVector &end3D, ProtoHit &protoHit) const
22{
23 const CaloHit *const pCaloHit2D(protoHit.GetParentCaloHit2D());
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);
27
28 const CartesianVector vtx2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), vtx3D, hitType));
29 const CartesianVector end2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), end3D, hitType));
30
31 if ((end2D - vtx2D).GetMagnitudeSquared() < std::numeric_limits<float>::epsilon())
32 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
33
34 const float frac((end2D - vtx2D).GetDotProduct(pCaloHit2D->GetPositionVector() - vtx2D) / (end2D - vtx2D).GetMagnitudeSquared());
35 const CartesianVector projection3D(vtx3D + (end3D - vtx3D) * frac);
36
37 CartesianPointVector fitPositionList1, fitPositionList2;
38
39 MatchedSlidingFitMap::const_iterator fIter1 = matchedSlidingFitMap.find(hitType1);
40 if (matchedSlidingFitMap.end() != fIter1)
41 {
42 const TwoDSlidingFitResult &fitResult1 = fIter1->second;
43 const CartesianVector position2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), projection3D, hitType1));
44
45 CartesianVector position1(0.f, 0.f, 0.f);
46 const StatusCode statusCode(fitResult1.GetGlobalFitProjection(position2D, position1));
47
48 if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
49 throw StatusCodeException(statusCode);
50
51 if (STATUS_CODE_SUCCESS == statusCode)
52 fitPositionList1.push_back(position1);
53 }
54
55 MatchedSlidingFitMap::const_iterator fIter2 = matchedSlidingFitMap.find(hitType2);
56 if (matchedSlidingFitMap.end() != fIter2)
57 {
58 const TwoDSlidingFitResult &fitResult2 = fIter2->second;
59 const CartesianVector position2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), projection3D, hitType2));
60
61 CartesianVector position2(0.f, 0.f, 0.f);
62 const StatusCode statusCode(fitResult2.GetGlobalFitProjection(position2D, position2));
63
64 if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
65 throw StatusCodeException(statusCode);
66
67 if (STATUS_CODE_SUCCESS == statusCode)
68 fitPositionList2.push_back(position2);
69 }
70
71 unsigned int nViews(1);
72 if (fitPositionList1.size() > 0)
73 ++nViews;
74 if (fitPositionList2.size() > 0)
75 ++nViews;
76
77 if (nViews < m_minViews)
78 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
79
80 this->GetBestPosition3D(hitType1, hitType2, fitPositionList1, fitPositionList2, protoHit);
81}
82
83} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the geometry helper class.
Header file for the multivalued longitudinal track hit creation tool.
virtual void GetBestPosition3D(const pandora::HitType hitType1, const pandora::HitType hitType2, const pandora::CartesianPointVector &fitPositionList1, const pandora::CartesianPointVector &fitPositionList2, ProtoHit &protoHit) const
Get the three dimensional position using a provided two dimensional calo hit and candidate fit positi...
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
void GetLongitudinalTrackHit3D(const MatchedSlidingFitMap &matchedSlidingFitMap, const pandora::CartesianVector &vtx3D, const pandora::CartesianVector &end3D, ProtoHit &protoHit) const
Get the three dimensional position using a provided two dimensional calo hit and sliding linear fits ...
Proto hits are temporary constructs to be used during iterative 3D hit procedure.
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
unsigned int m_minViews
The minimum number of views required for building hits.
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
pandora::StatusCode GetGlobalFitProjection(const pandora::CartesianVector &inputPosition, pandora::CartesianVector &projectedPosition) const
Get projected position on global fit for a given position vector.
CaloHit class.
Definition CaloHit.h:26
HitType GetHitType() const
Get the calorimeter hit type.
Definition CaloHit.h:441
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
Definition CaloHit.h:350
CartesianVector class.
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
StatusCodeException class.
HitType
Calorimeter hit type enum.
std::vector< CartesianVector > CartesianPointVector
StatusCode
The StatusCode enum.