LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ThreeViewShowerHitsTool.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 ThreeViewShowerHitsTool::ThreeViewShowerHitsTool() :
21  m_zTolerance(1.f)
22 {
23 }
24 
25 //------------------------------------------------------------------------------------------------------------------------------------------
26 
27 void ThreeViewShowerHitsTool::GetShowerHit3D(const CaloHitVector &caloHitVector1, const CaloHitVector &caloHitVector2, ProtoHit &protoHit) const
28 {
29  if (caloHitVector1.empty() || caloHitVector2.empty())
30  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
31 
32  const HitType hitType1(caloHitVector1.at(0)->GetHitType());
33  const HitType hitType2(caloHitVector2.at(0)->GetHitType());
34 
35  const CaloHit *const pCaloHit2D(protoHit.GetParentCaloHit2D());
36  const HitType hitType2D(pCaloHit2D->GetHitType());
37  const float position2D(pCaloHit2D->GetPositionVector().GetZ());
38 
39  for (const CaloHit *const pCaloHit1 : caloHitVector1)
40  {
41  const CartesianVector &position1(pCaloHit1->GetPositionVector());
42  const float prediction(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), hitType2D, hitType1, position2D, position1.GetZ()));
43 
44  for (const CaloHit *const pCaloHit2 : caloHitVector2)
45  {
46  const CartesianVector &position2(pCaloHit2->GetPositionVector());
47 
48  if (std::fabs(position2.GetZ() - prediction) > m_zTolerance)
49  continue;
50 
51  ProtoHit thisProtoHit(pCaloHit2D);
52  this->GetBestPosition3D(hitType1, hitType2, position1, position2, thisProtoHit);
53 
54  if (!protoHit.IsPositionSet() || (thisProtoHit.GetChi2() < protoHit.GetChi2()))
55  protoHit = thisProtoHit;
56  }
57  }
58 }
59 
60 //------------------------------------------------------------------------------------------------------------------------------------------
61 
62 StatusCode ThreeViewShowerHitsTool::ReadSettings(const TiXmlHandle xmlHandle)
63 {
64  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ZTolerance", m_zTolerance));
65 
66  return ShowerHitsBaseTool::ReadSettings(xmlHandle);
67 }
68 
69 } // 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.
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
bool IsPositionSet() const
Whether the proto hit position is set.
TFile f
Definition: plotHisto.C:6
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...
HitType
Definition: HitType.h:12
float m_zTolerance
The z tolerance to use when looking for associated calo hits between views.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)