All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClearTransverseTrackHitsTool.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArHitCreation/ClearTransverseTrackHitsTool.cc
3  *
4  * @brief Implementation of the transverse track hit creation tool.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 void ClearTransverseTrackHitsTool::GetTransverseTrackHit3D(const MatchedSlidingFitMap &matchedSlidingFitMap, ProtoHit &protoHit) const
19 {
20  const CaloHit *const pCaloHit2D(protoHit.GetParentCaloHit2D());
21  const HitType hitType(pCaloHit2D->GetHitType());
22  const HitType hitType1((TPC_VIEW_U == hitType) ? TPC_VIEW_V : (TPC_VIEW_V == hitType) ? TPC_VIEW_W : TPC_VIEW_U);
23  const HitType hitType2((TPC_VIEW_U == hitType) ? TPC_VIEW_W : (TPC_VIEW_V == hitType) ? TPC_VIEW_U : TPC_VIEW_V);
24 
25  CartesianPointVector fitPositionList1, fitPositionList2;
26 
27  MatchedSlidingFitMap::const_iterator fIter1 = matchedSlidingFitMap.find(hitType1);
28  if (matchedSlidingFitMap.end() != fIter1)
29  {
30  const TwoDSlidingFitResult &fitResult1 = fIter1->second;
31  CartesianVector position1(0.f, 0.f, 0.f);
32  const StatusCode statusCode(fitResult1.GetExtrapolatedPositionAtX(pCaloHit2D->GetPositionVector().GetX(), position1));
33 
34  if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
35  throw StatusCodeException(statusCode);
36 
37  if (STATUS_CODE_SUCCESS == statusCode)
38  fitPositionList1.push_back(position1);
39  }
40 
41  MatchedSlidingFitMap::const_iterator fIter2 = matchedSlidingFitMap.find(hitType2);
42  if (matchedSlidingFitMap.end() != fIter2)
43  {
44  const TwoDSlidingFitResult &fitResult2 = fIter2->second;
45  CartesianVector position2(0.f, 0.f, 0.f);
46  const StatusCode statusCode(fitResult2.GetExtrapolatedPositionAtX(pCaloHit2D->GetPositionVector().GetX(), position2));
47 
48  if ((STATUS_CODE_SUCCESS != statusCode) && (STATUS_CODE_NOT_FOUND != statusCode))
49  throw StatusCodeException(statusCode);
50 
51  if (STATUS_CODE_SUCCESS == statusCode)
52  fitPositionList2.push_back(position2);
53  }
54 
55  unsigned int nViews(1);
56  if (fitPositionList1.size() > 0)
57  ++nViews;
58  if (fitPositionList2.size() > 0)
59  ++nViews;
60 
61  if (nViews < m_minViews)
62  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
63 
64  this->GetBestPosition3D(hitType1, hitType2, fitPositionList1, fitPositionList2, protoHit);
65 }
66 
67 } // namespace lar_content
Proto hits are temporary constructs to be used during iterative 3D hit procedure. ...
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
pandora::StatusCode GetExtrapolatedPositionAtX(const float x, pandora::CartesianVector &position) const
Get extrapolated position (beyond span) for a given input x coordinate.
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
Definition: reco_sbnd.fcl:182
Header file for the clear transverse track hit creation tool.