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

PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy. More...

#include "TrackShowerIdFeatureTool.h"

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

Public Types

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

Public Member Functions

 PfoHierarchyFeatureTool ()
 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

PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy.

Definition at line 130 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::PfoHierarchyFeatureTool::PfoHierarchyFeatureTool ( )

Default constructor.

Definition at line 322 of file TrackShowerIdFeatureTool.cc.

323 {
324 }

Member Function Documentation

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

Definition at line 394 of file TrackShowerIdFeatureTool.cc.

395 {
396  return STATUS_CODE_SUCCESS;
397 }
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::PfoHierarchyFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 328 of file TrackShowerIdFeatureTool.cc.

References lar_content::LArPfoHelper::GetAllDownstreamPfos(), lar_content::LArPfoHelper::GetCaloHits(), and lar_content::TwoDVertexDistanceFeatureTool::Run().

330 {
331  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
332  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
333 
334  CaloHitList parent3DHitList;
335  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, parent3DHitList);
336  const unsigned int nParentHits3D(parent3DHitList.size());
337 
338  PfoList allDaughtersPfoList;
339  LArPfoHelper::GetAllDownstreamPfos(pInputPfo, allDaughtersPfoList);
340  const unsigned int nDaughterPfos(allDaughtersPfoList.empty() ? 0 : allDaughtersPfoList.size() - 1);
341 
342  unsigned int nDaughterHits3DTotal(0);
343 
344  if (nDaughterPfos > 0)
345  {
346  // ATTN This relies on knowing that the first pfo in allDaughtersPfoList is the input pfo
347  allDaughtersPfoList.pop_front();
348 
349  for (const ParticleFlowObject *const pDaughterPfo : allDaughtersPfoList)
350  {
351  CaloHitList daughter3DHitList;
352  LArPfoHelper::GetCaloHits(pDaughterPfo, TPC_3D, daughter3DHitList);
353  nDaughterHits3DTotal += daughter3DHitList.size();
354  }
355  }
356 
357  const LArMvaHelper::MvaFeature nDaughters(static_cast<double>(nDaughterPfos));
358  const LArMvaHelper::MvaFeature nDaughterHits3D(static_cast<double>(nDaughterHits3DTotal));
359  const LArMvaHelper::MvaFeature daughterParentNHitsRatio(
360  (nParentHits3D > 0) ? static_cast<double>(nDaughterHits3DTotal) / static_cast<double>(nParentHits3D) : 0.);
361 
362  featureVector.push_back(nDaughters);
363  featureVector.push_back(nDaughterHits3D);
364  featureVector.push_back(daughterParentNHitsRatio);
365 }
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:74
static void GetAllDownstreamPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively, of all daughters associated with those pfos in an input lis...
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::PfoHierarchyFeatureTool::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: