9 #include "Pandora/AlgorithmHeaders.h"
21 CosmicRayShowerMatchingAlgorithm::CosmicRayShowerMatchingAlgorithm() :
22 m_minCaloHitsPerCluster(10),
24 m_minXOverlapFraction(0.5f),
33 for (
const Cluster *
const pCluster : inputVector)
38 outputVector.push_back(pCluster);
46 float xMin1(0.f), xMax1(0.f), xMin2(0.f), xMax2(0.f);
47 pCluster1->GetClusterSpanX(xMin1, xMax1);
48 pCluster2->GetClusterSpanX(xMin2, xMax2);
50 const float xOverlap(std::min(xMax1, xMax2) - std::max(xMin1, xMin2));
51 const float xSpan(std::max(xMax1, xMax2) - std::min(xMin1, xMin2));
53 if (xSpan < std::numeric_limits<float>::epsilon())
65 const Cluster *
const pCluster1,
const Cluster *
const pCluster2,
const Cluster *
const pCluster3)
const
72 if (hitType1 == hitType2 || hitType2 == hitType3 || hitType3 == hitType1)
73 throw StatusCodeException(STATUS_CODE_FAILURE);
76 float xMin1(0.f), xMin2(0.f), xMin3(0.f), xMax1(0.f), xMax2(0.f), xMax3(0.f);
77 pCluster1->GetClusterSpanX(xMin1, xMax1);
78 pCluster2->GetClusterSpanX(xMin2, xMax2);
79 pCluster3->GetClusterSpanX(xMin3, xMax3);
81 const float xMin(std::max(xMin1, std::max(xMin2, xMin3)));
82 const float xMax(std::min(xMax1, std::min(xMax2, xMax3)));
83 const float xOverlap(xMax - xMin);
85 if (xOverlap < std::numeric_limits<float>::epsilon())
88 float p1(std::numeric_limits<float>::max()), p2(std::numeric_limits<float>::max()), p3(std::numeric_limits<float>::max());
101 const float pseudoChi2(((q1 -
p1) * (q1 -
p1) + (q2 - p2) * (q2 - p2) + (q3 - p3) * (q3 - p3)) / 3.f);
113 ClusterList clusterList;
122 pfoParameters.m_particleId = E_MINUS;
123 pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
124 pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
125 pfoParameters.m_energy = 0.f;
126 pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
127 pfoParameters.m_clusterList = clusterList;
134 PANDORA_RETURN_RESULT_IF_AND_IF(
135 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinCaloHitsPerCluster",
m_minCaloHitsPerCluster));
137 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinXOverlap",
m_minXOverlap));
139 PANDORA_RETURN_RESULT_IF_AND_IF(
140 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinXOverlapFraction",
m_minXOverlapFraction));
142 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PseudoChi2Cut",
m_pseudoChi2Cut));
bool MatchClusters(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2) const
Match a pair of clusters from two views.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
const pandora::Cluster * m_pClusterV
Address of cluster in V view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static pandora::StatusCode GetAverageZ(const pandora::Cluster *const pCluster, const float xmin, const float xmax, float &averageZ)
Get average Z positions of the calo hits in a cluster in range xmin to xmax.
Header file for the cosmic ray shower matching algorithm class.
Header file for the geometry helper class.
bool CheckMatchedClusters3D(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3) const
Check that three clusters have a consistent 3D position.
Header file for the cluster helper class.
const pandora::Cluster * m_pClusterW
Address of cluster in W view.
const pandora::Cluster * m_pClusterU
Address of cluster in U view.
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).
float m_pseudoChi2Cut
The selection cut on the matched chi2.
fhicl::Table< sbnd::crt::CRTDetSimParams > Parameters
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
float m_minXOverlap
requirement on minimum X overlap for associated clusters
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void SelectCleanClusters(const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select a set of clusters judged to be clean.
physics associatedGroupsWithLeft p1
float m_minCaloHitsPerCluster
minimum size of clusters for this algorithm
void SetPfoParameters(const Particle &particle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Calculate Pfo properties from proto particle.
float m_minXOverlapFraction
requirement on minimum X overlap fraction for associated clusters