LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::ThreeDPCAFeatureTool Class Referenceabstract

PCA 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
 

Public Member Functions

 ThreeDPCAFeatureTool ()
 Default constructor. More...
 
void Run (LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
 
virtual void Run (MvaTypes::MvaFeatureVector &featureVector, Ts...args)=0
 Run the algorithm tool. More...
 

Private Member Functions

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

Detailed Description

PCA class for the calculation of PCA-related variables.

Definition at line 205 of file TrackShowerIdFeatureTool.h.

Member Typedef Documentation

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

Definition at line 30 of file LArMvaHelper.h.

Constructor & Destructor Documentation

lar_content::ThreeDPCAFeatureTool::ThreeDPCAFeatureTool ( )

Default constructor.

Definition at line 565 of file TrackShowerIdFeatureTool.cc.

566 {
567 }

Member Function Documentation

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

Definition at line 611 of file TrackShowerIdFeatureTool.cc.

612 {
613  return STATUS_CODE_SUCCESS;
614 }
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
void lar_content::ThreeDPCAFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 571 of file TrackShowerIdFeatureTool.cc.

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

573 {
574  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
575  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
576 
577  LArMvaHelper::MvaFeature pca1, pca2;
578  // Need the 3D cluster and hits to calculate PCA components
579  ClusterList threeDClusterList;
580  LArPfoHelper::GetThreeDClusterList(pInputPfo, threeDClusterList);
581 
582  CaloHitList threeDCaloHitList;
583  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, threeDCaloHitList);
584 
585 
586  if ((!threeDClusterList.empty()) && (!threeDCaloHitList.empty()))
587  {
588  // Run the PCA analysis
589  CartesianVector centroid(0.f, 0.f, 0.f);
590  LArPcaHelper::EigenVectors eigenVecs;
591  LArPcaHelper::EigenValues eigenValues(0.f, 0.f, 0.f);
592  try
593  {
594  LArPcaHelper::RunPca(threeDCaloHitList, centroid, eigenValues, eigenVecs);
595  const float principalEigenvalue(eigenValues.GetX()), secondaryEigenvalue(eigenValues.GetY()), tertiaryEigenvalue(eigenValues.GetZ());
596  if (principalEigenvalue > std::numeric_limits<float>::epsilon())
597  {
598  pca1 = secondaryEigenvalue/principalEigenvalue;
599  pca2 = tertiaryEigenvalue/principalEigenvalue;
600  }
601  }
602  catch (const StatusCodeException &){}
603  }
604 
605  featureVector.push_back(pca1);
606  featureVector.push_back(pca2);
607 }
pandora::CartesianVector EigenValues
Definition: LArPcaHelper.h:21
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:57
TFile f
Definition: plotHisto.C:6
static void GetThreeDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 3D clusters from an input pfo.
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:22
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.

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