All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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)
 
void Run (LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName, 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...
 
virtual void Run (MvaTypes::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName, Ts...args)
 

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
 
typedef std::map< std::string,
MvaFeatureTool< Ts...> * > 
FeatureToolMap
 

Detailed Description

ThreeDPCAFeatureTool class for the calculation of PCA-related variables.

Definition at line 317 of file TrackShowerIdFeatureTool.h.

Constructor & Destructor Documentation

lar_content::ThreeDPCAFeatureTool::ThreeDPCAFeatureTool ( )

Default constructor.

Definition at line 975 of file TrackShowerIdFeatureTool.cc.

976 {
977 }

Member Function Documentation

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

Definition at line 1049 of file TrackShowerIdFeatureTool.cc.

1050 {
1051  return STATUS_CODE_SUCCESS;
1052 }
void lar_content::ThreeDPCAFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 981 of file TrackShowerIdFeatureTool.cc.

983 {
984  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
985  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
986 
987  LArMvaHelper::MvaFeature pca1, pca2;
988 
989  // Need the 3D hits to calculate PCA components
990  CaloHitList threeDCaloHitList;
991  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, threeDCaloHitList);
992 
993  if (!threeDCaloHitList.empty())
994  {
995  try
996  {
997  CartesianVector centroid(0.f, 0.f, 0.f);
998  LArPcaHelper::EigenVectors eigenVecs;
999  LArPcaHelper::EigenValues eigenValues(0.f, 0.f, 0.f);
1000 
1001  LArPcaHelper::RunPca(threeDCaloHitList, centroid, eigenValues, eigenVecs);
1002  const float principalEigenvalue(eigenValues.GetX()), secondaryEigenvalue(eigenValues.GetY()), tertiaryEigenvalue(eigenValues.GetZ());
1003 
1004  if (principalEigenvalue > std::numeric_limits<float>::epsilon())
1005  {
1006  pca1 = secondaryEigenvalue / principalEigenvalue;
1007  pca2 = tertiaryEigenvalue / principalEigenvalue;
1008  }
1009  else
1010  {
1011  // ATTN if n3dHits == 1 then principal, secondary, and tertiary eigenvalues are zero hence default to zero
1012  pca1 = 0.;
1013  pca2 = 0.;
1014  }
1015  }
1016  catch (const StatusCodeException &)
1017  {
1018  }
1019  }
1020 
1021  featureVector.push_back(pca1);
1022  featureVector.push_back(pca2);
1023 }
pandora::CartesianVector EigenValues
Definition: LArPcaHelper.h:24
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:71
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.
BEGIN_PROLOG could also be cout
void lar_content::ThreeDPCAFeatureTool::Run ( LArMvaHelper::MvaFeatureMap featureMap,
pandora::StringVector &  featureOrder,
const std::string &  featureToolName,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

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