9 #include "Helpers/XmlHelper.h"
11 #include "Objects/Cluster.h"
30 m_layerFitHalfWindow(20),
31 m_minLayerOccupancy(0.75f),
32 m_maxTrackWidth(0.5f),
33 m_trackResidualQuantile(0.8f),
34 m_minClustersPassingId(2)
46 const TwoDSlidingFitResult twoDSlidingFitResult(pCluster, m_layerFitHalfWindow, slidingFitPitch);
48 if (this->GetMuonTrackWidth(twoDSlidingFitResult) > m_maxTrackWidth)
58 ClusterList clusterList;
61 if (clusterList.empty())
64 unsigned int nClustersPassing(0);
66 for (
const Cluster *
const pCluster : clusterList)
68 if (this->IsMatch(pCluster))
72 if (nClustersPassing < m_minClustersPassingId)
82 FloatVector residuals;
83 const OrderedCaloHitList &orderedCaloHitList(twoDSlidingFitResult.
GetCluster()->GetOrderedCaloHitList());
86 for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(); iter != orderedCaloHitList.end(); ++iter)
88 for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
90 float rL(0.f), rT(0.f);
91 twoDSlidingFitResult.
GetLocalPosition((*hitIter)->GetPositionVector(), rL, rT);
94 LayerFitResultMap::const_iterator fitResultIter = layerFitResultMap.find(
layer);
96 if (layerFitResultMap.end() == fitResultIter)
99 const double fitT(fitResultIter->second.GetFitT());
100 const double gradient(fitResultIter->second.GetGradient());
101 const double residualSquared((fitT - rT) * (fitT - rT) / (1. + gradient * gradient));
102 residuals.push_back(residualSquared);
106 if (residuals.empty())
107 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
109 std::sort(residuals.begin(), residuals.end());
110 const float theQuantile(residuals[m_trackResidualQuantile * residuals.size()]);
112 return std::sqrt(theQuantile);
119 PANDORA_RETURN_RESULT_IF_AND_IF(
120 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"LayerFitHalfWindow", m_layerFitHalfWindow));
122 PANDORA_RETURN_RESULT_IF_AND_IF(
123 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinLayerOccupancy", m_minLayerOccupancy));
125 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxTrackWidth", m_maxTrackWidth));
127 PANDORA_RETURN_RESULT_IF_AND_IF(
128 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrackResidualQuantile", m_trackResidualQuantile));
130 PANDORA_RETURN_RESULT_IF_AND_IF(
131 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinClustersPassingId", m_minClustersPassingId));
133 return STATUS_CODE_SUCCESS;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Header file for the pfo helper class.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
float GetMuonTrackWidth(const TwoDSlidingFitResult &twoDSlidingFitResult) const
Get the muon track width estimator for a provided sliding fit result.
Header file for the lar particle id plugins class.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
Header file for the geometry helper class.
Header file for the cluster helper class.
bool IsMatch(const pandora::Cluster *const pCluster) const
Header file for the lar two dimensional sliding fit result class.
std::map< int, LayerFitResult > LayerFitResultMap
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
static float GetLayerOccupancy(const pandora::Cluster *const pCluster)
Fraction of occupied layers in cluster.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
LArMuonId()
Default constructor.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
TwoDSlidingFitResult class.
int GetLayer(const float rL) const
Get layer number for given sliding linear fit longitudinal coordinate.