Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
ShowerHitsBaseTool.cc
Go to the documentation of this file.
1
10
12
15
16using namespace pandora;
17
18namespace lar_content
19{
20
22{
23}
24
25//------------------------------------------------------------------------------------------------------------------------------------------
26
28 const CaloHitVector &inputTwoDHits, ProtoHitVector &protoHitVector)
29{
31 std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
32
33 try
34 {
35 if (!LArPfoHelper::IsShower(pPfo))
36 return;
37
38 CaloHitVector caloHitVectorU, caloHitVectorV, caloHitVectorW;
39 pAlgorithm->FilterCaloHitsByType(inputTwoDHits, TPC_VIEW_U, caloHitVectorU);
40 pAlgorithm->FilterCaloHitsByType(inputTwoDHits, TPC_VIEW_V, caloHitVectorV);
41 pAlgorithm->FilterCaloHitsByType(inputTwoDHits, TPC_VIEW_W, caloHitVectorW);
42
43 this->GetShowerHits3D(caloHitVectorU, caloHitVectorV, caloHitVectorW, protoHitVector);
44 this->GetShowerHits3D(caloHitVectorV, caloHitVectorU, caloHitVectorW, protoHitVector);
45 this->GetShowerHits3D(caloHitVectorW, caloHitVectorU, caloHitVectorV, protoHitVector);
46 }
47 catch (StatusCodeException &)
48 {
49 }
50}
51
52//------------------------------------------------------------------------------------------------------------------------------------------
53
54void ShowerHitsBaseTool::GetShowerHits3D(const CaloHitVector &inputTwoDHits, const CaloHitVector &caloHitVector1,
55 const CaloHitVector &caloHitVector2, ProtoHitVector &protoHitVector) const
56{
57 for (const CaloHit *const pCaloHit2D : inputTwoDHits)
58 {
59 try
60 {
61 CaloHitVector filteredHits1, filteredHits2;
62 this->FilterCaloHits(pCaloHit2D->GetPositionVector().GetX(), m_xTolerance, caloHitVector1, filteredHits1);
63 this->FilterCaloHits(pCaloHit2D->GetPositionVector().GetX(), m_xTolerance, caloHitVector2, filteredHits2);
64
65 ProtoHit protoHit(pCaloHit2D);
66 this->GetShowerHit3D(filteredHits1, filteredHits2, protoHit);
67
68 if (protoHit.IsPositionSet() && (protoHit.GetChi2() < m_chiSquaredCut))
69 protoHitVector.push_back(protoHit);
70 }
71 catch (StatusCodeException &)
72 {
73 }
74 }
75}
76
77//------------------------------------------------------------------------------------------------------------------------------------------
78
79void ShowerHitsBaseTool::FilterCaloHits(const float x, const float xTolerance, const CaloHitVector &inputCaloHitVector, CaloHitVector &outputCaloHitVector) const
80{
81 for (const CaloHit *const pCaloHit : inputCaloHitVector)
82 {
83 const float deltaX(pCaloHit->GetPositionVector().GetX() - x);
84
85 if (std::fabs(deltaX) < xTolerance)
86 outputCaloHitVector.push_back(pCaloHit);
87 }
88}
89
90//------------------------------------------------------------------------------------------------------------------------------------------
91
93{
94 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "XTolerance", m_xTolerance));
95
96 return HitCreationBaseTool::ReadSettings(xmlHandle);
97}
98
99} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the pfo helper class.
Header file for the shower hits base tool.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
Header file for the three dimensional hit creation algorithm class.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
double m_chiSquaredCut
The chi squared cut (accept only values below the cut value)
static bool IsShower(const pandora::ParticleFlowObject *const pPfo)
Return shower flag based on Pfo Particle ID.
virtual void GetShowerHit3D(const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHit &protoHit) const =0
Get the three dimensional position for to a two dimensional calo hit, using the hit and a list of can...
float m_xTolerance
The x tolerance to use when looking for associated calo hits between views.
virtual void GetShowerHits3D(const pandora::CaloHitVector &inputTwoDHits, const pandora::CaloHitVector &caloHitVector1, const pandora::CaloHitVector &caloHitVector2, ProtoHitVector &protoHitVector) const
Create three dimensional hits, using a list of input two dimensional hits and the hits (contained in ...
ShowerHitsBaseTool()
Default constructor.
void FilterCaloHits(const float x, const float xTolerance, const pandora::CaloHitVector &inputCaloHitVector, pandora::CaloHitVector &outputCaloHitVector) const
Filter a list of calo hits to find those within a specified tolerance of a give x position.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
virtual void Run(ThreeDHitCreationAlgorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pPfo, const pandora::CaloHitVector &inputTwoDHits, ProtoHitVector &protoHitVector)
Run the algorithm tool.
Proto hits are temporary constructs to be used during iterative 3D hit procedure.
bool IsPositionSet() const
Whether the proto hit position is set.
ThreeDHitCreationAlgorithm::Algorithm class.
void FilterCaloHitsByType(const pandora::CaloHitVector &inputCaloHitVector, const pandora::HitType hitType, pandora::CaloHitVector &outputCaloHitVector) const
Get the subset of a provided calo hit vector corresponding to a specified hit type.
CaloHit class.
Definition CaloHit.h:26
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
ParticleFlowObject class.
const std::string & GetType() const
Get the type.
Definition Process.h:102
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
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
std::vector< const CaloHit * > CaloHitVector
StatusCode
The StatusCode enum.