ThreeViewShowerHitsTool.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArHitCreation/ThreeViewShowerHitsTool.cc
3  *
4  * @brief Implementation of the three view shower hits tool.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 ThreeViewShowerHitsTool::ThreeViewShowerHitsTool() : m_zTolerance(1.f)
21 {
22 }
23 
24 //------------------------------------------------------------------------------------------------------------------------------------------
25 
26 void ThreeViewShowerHitsTool::GetShowerHit3D(const CaloHitVector &caloHitVector1, const CaloHitVector &caloHitVector2, ProtoHit &protoHit) const
27 {
28  if (caloHitVector1.empty() || caloHitVector2.empty())
29  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
30 
31  const HitType hitType1(caloHitVector1.at(0)->GetHitType());
32  const HitType hitType2(caloHitVector2.at(0)->GetHitType());
33 
34  const CaloHit *const pCaloHit2D(protoHit.GetParentCaloHit2D());
35  const HitType hitType2D(pCaloHit2D->GetHitType());
36  const float position2D(pCaloHit2D->GetPositionVector().GetZ());
37 
38  for (const CaloHit *const pCaloHit1 : caloHitVector1)
39  {
40  const CartesianVector &position1(pCaloHit1->GetPositionVector());
41  const float prediction(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), hitType2D, hitType1, position2D, position1.GetZ()));
42 
43  for (const CaloHit *const pCaloHit2 : caloHitVector2)
44  {
45  const CartesianVector &position2(pCaloHit2->GetPositionVector());
46 
47  if (std::fabs(position2.GetZ() - prediction) > m_zTolerance)
48  continue;
49 
50  ProtoHit thisProtoHit(pCaloHit2D);
51  this->GetBestPosition3D(hitType1, hitType2, position1, position2, thisProtoHit);
52 
53  if (!protoHit.IsPositionSet() || (thisProtoHit.GetChi2() < protoHit.GetChi2()))
54  protoHit = thisProtoHit;
55  }
56  }
57 }
58 
59 //------------------------------------------------------------------------------------------------------------------------------------------
60 
61 StatusCode ThreeViewShowerHitsTool::ReadSettings(const TiXmlHandle xmlHandle)
62 {
63  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ZTolerance", m_zTolerance));
64 
65  return ShowerHitsBaseTool::ReadSettings(xmlHandle);
66 }
67 
68 } // namespace lar_content
Proto hits are temporary constructs to be used during iterative 3D hit procedure. ...
Header file for the three view shower hits tool.
enum cvn::HType HitType
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
bool IsPositionSet() const
Whether the proto hit position is set.
Header file for the geometry helper class.
void GetShowerHit3D(const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHit &protoHit) const
Get the three dimensional position for to a two dimensional calo hit, using the hit and a list of can...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
double GetChi2() const
Get the chi squared value.
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
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...
float m_zTolerance
The z tolerance to use when looking for associated calo hits between views.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)