LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 380 of file VertexBasedPfoMopUpAlgorithm.cc.

References GetCosHalfAngleEstimate(), GetDirectionEstimate(), GetSignedConeLength(), m_coneCosHalfAngle, m_coneLength, m_direction, and min.

381  :
382  m_pCluster(pCluster),
383  m_apex(vertexPosition2D),
384  m_direction(0.f, 0.f, 0.f),
385  m_coneLength(0.f),
387 {
390 
391  // ATTN Compensate for coordinate shift when fitting with vertex constraint (cleaner way to do this?)
392  if (m_coneLength < std::numeric_limits<float>::epsilon())
393  {
394  m_direction = m_direction * -1.f;
395  m_coneLength = std::fabs(m_coneLength);
396  }
397 
398  m_coneCosHalfAngle = std::min(maxCosHalfAngle, this->GetCosHalfAngleEstimate(coneAngleCentile));
399 }
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) ...
TFile f
Definition: plotHisto.C:6
pandora::CartesianVector GetDirectionEstimate() const
Get the cone direction estimate, with apex fixed at the 2d vertex position.
Int_t min
Definition: plot.C:26

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 403 of file VertexBasedPfoMopUpAlgorithm.cc.

References m_apex, m_coneCosHalfAngle, m_coneLength, and m_direction.

Referenced by lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation().

404 {
405  unsigned int nMatchedHits(0);
406  const OrderedCaloHitList &orderedCaloHitList(pDaughterCluster->GetOrderedCaloHitList());
407 
408  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
409  {
410  for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
411  {
412  const CartesianVector &positionVector((*hIter)->GetPositionVector());
413 
414  if (m_direction.GetCosOpeningAngle(positionVector - m_apex) < m_coneCosHalfAngle)
415  continue;
416 
417  if (m_direction.GetDotProduct(positionVector - m_apex) > coneLengthMultiplier * m_coneLength)
418  continue;
419 
420  ++nMatchedHits;
421  }
422  }
423 
424  if (0 == pDaughterCluster->GetNCaloHits())
425  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
426 
427  return (static_cast<float>(nMatchedHits) / static_cast<float>(pDaughterCluster->GetNCaloHits()));
428 }
intermediate_table::const_iterator const_iterator
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 476 of file VertexBasedPfoMopUpAlgorithm.cc.

References m_apex, m_direction, and m_pCluster.

Referenced by ConeParameters().

477 {
478  FloatVector halfAngleValues;
479  const OrderedCaloHitList &orderedCaloHitList(m_pCluster->GetOrderedCaloHitList());
480 
481  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
482  {
483  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
484  halfAngleValues.push_back(m_direction.GetOpeningAngle((*hitIter)->GetPositionVector() - m_apex));
485  }
486 
487  std::sort(halfAngleValues.begin(), halfAngleValues.end());
488 
489  if (halfAngleValues.empty())
490  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
491 
492  const unsigned int halfAngleBin(coneAngleCentile * halfAngleValues.size());
493  return std::cos(halfAngleValues.at(halfAngleBin));
494 }
intermediate_table::const_iterator const_iterator
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 432 of file VertexBasedPfoMopUpAlgorithm.cc.

References f, m_apex, and m_pCluster.

Referenced by ConeParameters().

433 {
434  const OrderedCaloHitList &orderedCaloHitList(m_pCluster->GetOrderedCaloHitList());
435  float sumDxDz(0.f), sumDxDx(0.f);
436 
437  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
438  {
439  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
440  {
441  const CartesianVector apexDisplacement((*hitIter)->GetPositionVector() - m_apex);
442  sumDxDz += apexDisplacement.GetX() * apexDisplacement.GetZ();
443  sumDxDx += apexDisplacement.GetX() * apexDisplacement.GetX();
444  }
445  }
446 
447  if (sumDxDx < std::numeric_limits<float>::epsilon())
448  return CartesianVector(0.f, 0.f, 1.f);
449 
450  return CartesianVector(1.f, 0.f, sumDxDz / sumDxDx).GetUnitVector();
451 }
TFile f
Definition: plotHisto.C:6
intermediate_table::const_iterator const_iterator
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 455 of file VertexBasedPfoMopUpAlgorithm.cc.

References f, m_apex, m_direction, and m_pCluster.

Referenced by ConeParameters().

456 {
457  float maxProjectedLength(0.f);
458  const OrderedCaloHitList &orderedCaloHitList(m_pCluster->GetOrderedCaloHitList());
459 
460  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
461  {
462  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
463  {
464  const float projectedLength(m_direction.GetDotProduct((*hitIter)->GetPositionVector() - m_apex));
465 
466  if (std::fabs(projectedLength) > std::fabs(maxProjectedLength))
467  maxProjectedLength = projectedLength;
468  }
469  }
470 
471  return maxProjectedLength;
472 }
TFile f
Definition: plotHisto.C:6
intermediate_table::const_iterator const_iterator

Member Data Documentation

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

The cone cos half angle.

Definition at line 243 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by ConeParameters(), and GetBoundedFraction().

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

The cone length.

Definition at line 242 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by ConeParameters(), and GetBoundedFraction().

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

The cone direction.

Definition at line 241 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by ConeParameters(), GetBoundedFraction(), GetCosHalfAngleEstimate(), and GetSignedConeLength().

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

The parent cluster.

Definition at line 239 of file VertexBasedPfoMopUpAlgorithm.h.

Referenced by GetCosHalfAngleEstimate(), GetDirectionEstimate(), and GetSignedConeLength().


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