9 #include "Helpers/XmlHelper.h" 11 #include "Objects/Cluster.h" 30 m_layerFitHalfWindow(20),
31 m_minLayerOccupancy(0.75
f),
32 m_maxTrackWidth(0.5
f),
33 m_trackResidualQuantile(0.8
f),
34 m_minClustersPassingId(2)
58 ClusterList clusterList;
61 if (clusterList.empty())
64 unsigned int nClustersPassing(0);
66 for (
const Cluster *
const pCluster : clusterList)
82 FloatVector residuals;
83 const OrderedCaloHitList &orderedCaloHitList(twoDSlidingFitResult.
GetCluster()->GetOrderedCaloHitList());
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);
92 const int layer(twoDSlidingFitResult.
GetLayer(rL));
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());
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;
unsigned int m_layerFitHalfWindow
Layer fit half window, used for calculating sliding muon track width.
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 m_trackResidualQuantile
Track residual quantile, used for calculating muon track width.
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.
float m_minLayerOccupancy
Min layer occupancy for for muon identification.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
float m_maxTrackWidth
Max muon track width estimator for muon identification.
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.
unsigned int m_minClustersPassingId
Match pfo if at sufficient clusters in pfo pass the cluster particle id logic.