LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::ThreeDPCAFeatureTool Class Referenceabstract

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

#include "TrackShowerIdFeatureTool.h"

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

Public Types

typedef std::vector< MvaFeatureTool< Ts... > * > FeatureToolVector
 
typedef std::map< std::string, MvaFeatureTool< Ts... > * > FeatureToolMap
 

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)
 
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...)
 

Private Member Functions

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

Detailed Description

ThreeDPCAFeatureTool class for the calculation of PCA-related variables.

Definition at line 317 of file TrackShowerIdFeatureTool.h.

Member Typedef Documentation

template<typename... Ts>
typedef std::map<std::string, MvaFeatureTool<Ts...> *> lar_content::MvaFeatureTool< Ts >::FeatureToolMap
inherited

Definition at line 37 of file LArMvaHelper.h.

template<typename... Ts>
typedef std::vector<MvaFeatureTool<Ts...> *> lar_content::MvaFeatureTool< Ts >::FeatureToolVector
inherited

Definition at line 36 of file LArMvaHelper.h.

Constructor & Destructor Documentation

lar_content::ThreeDPCAFeatureTool::ThreeDPCAFeatureTool ( )

Default constructor.

Definition at line 984 of file TrackShowerIdFeatureTool.cc.

985 {
986 }

Member Function Documentation

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

Definition at line 1058 of file TrackShowerIdFeatureTool.cc.

1059 {
1060  return STATUS_CODE_SUCCESS;
1061 }
template<typename... Ts>
virtual void lar_content::MvaFeatureTool< Ts >::Run ( MvaTypes::MvaFeatureVector featureVector,
Ts...  args 
)
pure virtualinherited

Run the algorithm tool.

Parameters
featureVectorthe vector of features to append
argsarguments to pass to the tool
template<typename... Ts>
virtual void lar_content::MvaFeatureTool< Ts >::Run ( MvaTypes::MvaFeatureMap featureMap,
pandora::StringVector &  featureOrder,
const std::string &  featureToolName,
Ts...   
)
inlinevirtualinherited

Definition at line 51 of file LArMvaHelper.h.

52  {
53  (void)featureMap;
54  (void)featureOrder;
55  (void)featureToolName;
56  return;
57  };
void lar_content::ThreeDPCAFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 990 of file TrackShowerIdFeatureTool.cc.

References f, lar_content::LArPfoHelper::GetCaloHits(), lar_content::ThreeDOpeningAngleFeatureTool::Run(), and lar_content::LArPcaHelper::RunPca().

992 {
993  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
994  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
995 
996  LArMvaHelper::MvaFeature pca1, pca2;
997 
998  // Need the 3D hits to calculate PCA components
999  CaloHitList threeDCaloHitList;
1000  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, threeDCaloHitList);
1001 
1002  if (!threeDCaloHitList.empty())
1003  {
1004  try
1005  {
1006  CartesianVector centroid(0.f, 0.f, 0.f);
1007  LArPcaHelper::EigenVectors eigenVecs;
1008  LArPcaHelper::EigenValues eigenValues(0.f, 0.f, 0.f);
1009 
1010  LArPcaHelper::RunPca(threeDCaloHitList, centroid, eigenValues, eigenVecs);
1011  const float principalEigenvalue(eigenValues.GetX()), secondaryEigenvalue(eigenValues.GetY()), tertiaryEigenvalue(eigenValues.GetZ());
1012 
1013  if (principalEigenvalue > std::numeric_limits<float>::epsilon())
1014  {
1015  pca1 = secondaryEigenvalue / principalEigenvalue;
1016  pca2 = tertiaryEigenvalue / principalEigenvalue;
1017  }
1018  else
1019  {
1020  // ATTN if n3dHits == 1 then principal, secondary, and tertiary eigenvalues are zero hence default to zero
1021  pca1 = 0.;
1022  pca2 = 0.;
1023  }
1024  }
1025  catch (const StatusCodeException &)
1026  {
1027  }
1028  }
1029 
1030  featureVector.push_back(pca1);
1031  featureVector.push_back(pca2);
1032 }
pandora::CartesianVector EigenValues
Definition: LArPcaHelper.h:24
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:74
TFile f
Definition: plotHisto.C:6
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.
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: