All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters Class Reference

ConeParameters class. More...

#include <VertexBasedPfoMopUpAlgorithm.h>

Public Member Functions

 ConeParameters (const pandora::Cluster *const pCluster, const pandora::CartesianVector &vertexPosition2D, const float coneAngleCentile, const float maxConeCosHalfAngle)
 Constructor. More...
 
float GetBoundedFraction (const pandora::Cluster *const pDaughterCluster, const float coneLengthMultiplier) const
 Get the fraction of hits in a candidate daughter cluster bounded by the cone. More...
 

Private Member Functions

pandora::CartesianVector GetDirectionEstimate () const
 Get the cone direction estimate, with apex fixed at the 2d vertex position. More...
 
float GetSignedConeLength () const
 Get the cone length (signed, by projections of hits onto initial direction estimate) More...
 
float GetCosHalfAngleEstimate (const float coneAngleCentile) const
 Get the cone cos half angle estimate. More...
 

Private Attributes

const pandora::Cluster * m_pCluster
 The parent cluster. More...
 
pandora::CartesianVector m_apex
 The cone apex. More...
 
pandora::CartesianVector m_direction
 The cone direction. More...
 
float m_coneLength
 The cone length. More...
 
float m_coneCosHalfAngle
 The cone cos half angle. More...
 

Detailed Description

ConeParameters class.

Definition at line 191 of file VertexBasedPfoMopUpAlgorithm.h.

Constructor & Destructor Documentation

lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::ConeParameters ( const pandora::Cluster *const  pCluster,
const pandora::CartesianVector &  vertexPosition2D,
const float  coneAngleCentile,
const float  maxConeCosHalfAngle 
)

Constructor.

Parameters
pClusteraddress of the cluster
vertexPosition2Dthe event 2D vertex position
coneAngleCentilethe cone angle centile
maxConeCosHalfAnglethe maximum value for cosine of cone half angle

Definition at line 389 of file VertexBasedPfoMopUpAlgorithm.cc.

390  :
391  m_pCluster(pCluster),
392  m_apex(vertexPosition2D),
393  m_direction(0.f, 0.f, 0.f),
394  m_coneLength(0.f),
395  m_coneCosHalfAngle(0.f)
396 {
399 
400  // ATTN Compensate for coordinate shift when fitting with vertex constraint (cleaner way to do this?)
401  if (m_coneLength < std::numeric_limits<float>::epsilon())
402  {
403  m_direction = m_direction * -1.f;
404  m_coneLength = std::fabs(m_coneLength);
405  }
406 
407  m_coneCosHalfAngle = std::min(maxCosHalfAngle, this->GetCosHalfAngleEstimate(coneAngleCentile));
408 }
float GetCosHalfAngleEstimate(const float coneAngleCentile) const
Get the cone cos half angle estimate.
float GetSignedConeLength() const
Get the cone length (signed, by projections of hits onto initial direction estimate) ...
pandora::CartesianVector GetDirectionEstimate() const
Get the cone direction estimate, with apex fixed at the 2d vertex position.

Member Function Documentation

float lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::GetBoundedFraction ( const pandora::Cluster *const  pDaughterCluster,
const float  coneLengthMultiplier 
) const

Get the fraction of hits in a candidate daughter cluster bounded by the cone.

Parameters
pDaughterClusterthe address of the daughter cluster
coneLengthMultipliercnsider hits as bound if inside cone with projected distance less than N times cone length
Returns
the bounded fraction

Definition at line 412 of file VertexBasedPfoMopUpAlgorithm.cc.

413 {
414  unsigned int nMatchedHits(0);
415  const OrderedCaloHitList &orderedCaloHitList(pDaughterCluster->GetOrderedCaloHitList());
416 
417  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
418  {
419  for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
420  {
421  const CartesianVector &positionVector((*hIter)->GetPositionVector());
422 
423  if (m_direction.GetCosOpeningAngle(positionVector - m_apex) < m_coneCosHalfAngle)
424  continue;
425 
426  if (m_direction.GetDotProduct(positionVector - m_apex) > coneLengthMultiplier * m_coneLength)
427  continue;
428 
429  ++nMatchedHits;
430  }
431  }
432 
433  if (0 == pDaughterCluster->GetNCaloHits())
434  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
435 
436  return (static_cast<float>(nMatchedHits) / static_cast<float>(pDaughterCluster->GetNCaloHits()));
437 }
float lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::GetCosHalfAngleEstimate ( const float  coneAngleCentile) const
private

Get the cone cos half angle estimate.

Parameters
coneAngleCentilethe cone angle centile
Returns
the cone cos half angle estimate

Definition at line 485 of file VertexBasedPfoMopUpAlgorithm.cc.

486 {
487  FloatVector halfAngleValues;
488  const OrderedCaloHitList &orderedCaloHitList(m_pCluster->GetOrderedCaloHitList());
489 
490  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
491  {
492  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
493  halfAngleValues.push_back(m_direction.GetOpeningAngle((*hitIter)->GetPositionVector() - m_apex));
494  }
495 
496  std::sort(halfAngleValues.begin(), halfAngleValues.end());
497 
498  if (halfAngleValues.empty())
499  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
500 
501  const unsigned int halfAngleBin(coneAngleCentile * halfAngleValues.size());
502  return std::cos(halfAngleValues.at(halfAngleBin));
503 }
CartesianVector lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::GetDirectionEstimate ( ) const
private

Get the cone direction estimate, with apex fixed at the 2d vertex position.

Returns
the direction estimate

Definition at line 441 of file VertexBasedPfoMopUpAlgorithm.cc.

442 {
443  const OrderedCaloHitList &orderedCaloHitList(m_pCluster->GetOrderedCaloHitList());
444  float sumDxDz(0.f), sumDxDx(0.f);
445 
446  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
447  {
448  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
449  {
450  const CartesianVector apexDisplacement((*hitIter)->GetPositionVector() - m_apex);
451  sumDxDz += apexDisplacement.GetX() * apexDisplacement.GetZ();
452  sumDxDx += apexDisplacement.GetX() * apexDisplacement.GetX();
453  }
454  }
455 
456  if (sumDxDx < std::numeric_limits<float>::epsilon())
457  return CartesianVector(0.f, 0.f, 1.f);
458 
459  return CartesianVector(1.f, 0.f, sumDxDz / sumDxDx).GetUnitVector();
460 }
float lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::GetSignedConeLength ( ) const
private

Get the cone length (signed, by projections of hits onto initial direction estimate)

Returns
rhe cone length

Definition at line 464 of file VertexBasedPfoMopUpAlgorithm.cc.

465 {
466  float maxProjectedLength(0.f);
467  const OrderedCaloHitList &orderedCaloHitList(m_pCluster->GetOrderedCaloHitList());
468 
469  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
470  {
471  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
472  {
473  const float projectedLength(m_direction.GetDotProduct((*hitIter)->GetPositionVector() - m_apex));
474 
475  if (std::fabs(projectedLength) > std::fabs(maxProjectedLength))
476  maxProjectedLength = projectedLength;
477  }
478  }
479 
480  return maxProjectedLength;
481 }

Member Data Documentation

pandora::CartesianVector lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::m_apex
private

The cone apex.

Definition at line 240 of file VertexBasedPfoMopUpAlgorithm.h.

float lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::m_coneCosHalfAngle
private

The cone cos half angle.

Definition at line 243 of file VertexBasedPfoMopUpAlgorithm.h.

float lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::m_coneLength
private

The cone length.

Definition at line 242 of file VertexBasedPfoMopUpAlgorithm.h.

pandora::CartesianVector lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::m_direction
private

The cone direction.

Definition at line 241 of file VertexBasedPfoMopUpAlgorithm.h.

const pandora::Cluster* lar_content::VertexBasedPfoMopUpAlgorithm::ConeParameters::m_pCluster
private

The parent cluster.

Definition at line 239 of file VertexBasedPfoMopUpAlgorithm.h.


The documentation for this class was generated from the following files: