Public Member Functions | Private Member Functions | List of all members
lar_content::ThreeDPCAFeatureTool Class Reference

ThreeDPCAFeatureTool class for the calculation of PCA-related variables. More...

#include <TrackShowerIdFeatureTool.h>

Inheritance diagram for lar_content::ThreeDPCAFeatureTool:
lar_content::MvaFeatureTool< Ts >

Public Member Functions

 ThreeDPCAFeatureTool ()
 Default constructor. More...
 
void Run (LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
 
- Public Member Functions inherited from lar_content::MvaFeatureTool< Ts >
 MvaFeatureTool ()=default
 Default constructor. More...
 
virtual void Run (MvaTypes::MvaFeatureVector &featureVector, Ts...args)=0
 Run the algorithm tool. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Additional Inherited Members

- Public Types inherited from lar_content::MvaFeatureTool< Ts >
typedef std::vector< MvaFeatureTool< Ts... > * > FeatureToolVector
 

Detailed Description

ThreeDPCAFeatureTool class for the calculation of PCA-related variables.

Definition at line 240 of file TrackShowerIdFeatureTool.h.

Constructor & Destructor Documentation

lar_content::ThreeDPCAFeatureTool::ThreeDPCAFeatureTool ( )

Default constructor.

Definition at line 668 of file TrackShowerIdFeatureTool.cc.

669 {
670 }

Member Function Documentation

StatusCode lar_content::ThreeDPCAFeatureTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 720 of file TrackShowerIdFeatureTool.cc.

721 {
722  return STATUS_CODE_SUCCESS;
723 }
void lar_content::ThreeDPCAFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 674 of file TrackShowerIdFeatureTool.cc.

676 {
677  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
678  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
679 
680  LArMvaHelper::MvaFeature pca1, pca2;
681 
682  // Need the 3D hits to calculate PCA components
683  CaloHitList threeDCaloHitList;
684  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, threeDCaloHitList);
685 
686  if (!threeDCaloHitList.empty())
687  {
688  try
689  {
690  CartesianVector centroid(0.f, 0.f, 0.f);
691  LArPcaHelper::EigenVectors eigenVecs;
692  LArPcaHelper::EigenValues eigenValues(0.f, 0.f, 0.f);
693 
694  LArPcaHelper::RunPca(threeDCaloHitList, centroid, eigenValues, eigenVecs);
695  const float principalEigenvalue(eigenValues.GetX()), secondaryEigenvalue(eigenValues.GetY()), tertiaryEigenvalue(eigenValues.GetZ());
696 
697  if (principalEigenvalue > std::numeric_limits<float>::epsilon())
698  {
699  pca1 = secondaryEigenvalue / principalEigenvalue;
700  pca2 = tertiaryEigenvalue / principalEigenvalue;
701  }
702  else
703  {
704  // ATTN if n3dHits == 1 then principal, secondary, and tertiary eigenvalues are zero hence default to zero
705  pca1 = 0.;
706  pca2 = 0.;
707  }
708  }
709  catch (const StatusCodeException &)
710  {
711  }
712  }
713 
714  featureVector.push_back(pca1);
715  featureVector.push_back(pca2);
716 }
pandora::CartesianVector EigenValues
Definition: LArPcaHelper.h:24
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:57
static void RunPca(const T &t, pandora::CartesianVector &centroid, EigenValues &outputEigenValues, EigenVectors &outputEigenVectors)
Run principal component analysis using input calo hits (TPC_VIEW_U,V,W or TPC_3D; all treated as 3D p...
std::vector< pandora::CartesianVector > EigenVectors
Definition: LArPcaHelper.h:25
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
QTextStream & endl(QTextStream &s)

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