Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
ThreeViewShowerHitsTool.cc
Go to the documentation of this file.
1
10
12
14
15using namespace pandora;
16
17namespace lar_content
18{
19
23
24//------------------------------------------------------------------------------------------------------------------------------------------
25
26void 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
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
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the geometry helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
Header file for the three view shower hits 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 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).
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
Proto hits are temporary constructs to be used during iterative 3D hit procedure.
bool IsPositionSet() const
Whether the proto hit position is set.
const pandora::CaloHit * GetParentCaloHit2D() const
Get the address of the parent 2D calo hit.
float m_zTolerance
The z tolerance to use when looking for associated calo hits between views.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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...
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.
float GetZ() const
Get the cartesian z coordinate.
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
StatusCodeException class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
HitType
Calorimeter hit type enum.
std::vector< const CaloHit * > CaloHitVector
StatusCode
The StatusCode enum.