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::PfoHierarchyFeatureTool Class Reference

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

PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy.

Definition at line 130 of file TrackShowerIdFeatureTool.h.

Constructor & Destructor Documentation

lar_content::PfoHierarchyFeatureTool::PfoHierarchyFeatureTool ( )

Default constructor.

Definition at line 317 of file TrackShowerIdFeatureTool.cc.

318 {
319 }

Member Function Documentation

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

Definition at line 389 of file TrackShowerIdFeatureTool.cc.

390 {
391  return STATUS_CODE_SUCCESS;
392 }
void lar_content::PfoHierarchyFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 323 of file TrackShowerIdFeatureTool.cc.

325 {
326  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
327  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
328 
329  CaloHitList parent3DHitList;
330  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, parent3DHitList);
331  const unsigned int nParentHits3D(parent3DHitList.size());
332 
333  PfoList allDaughtersPfoList;
334  LArPfoHelper::GetAllDownstreamPfos(pInputPfo, allDaughtersPfoList);
335  const unsigned int nDaughterPfos(allDaughtersPfoList.empty() ? 0 : allDaughtersPfoList.size() - 1);
336 
337  unsigned int nDaughterHits3DTotal(0);
338 
339  if (nDaughterPfos > 0)
340  {
341  // ATTN This relies on knowing that the first pfo in allDaughtersPfoList is the input pfo
342  allDaughtersPfoList.pop_front();
343 
344  for (const ParticleFlowObject *const pDaughterPfo : allDaughtersPfoList)
345  {
346  CaloHitList daughter3DHitList;
347  LArPfoHelper::GetCaloHits(pDaughterPfo, TPC_3D, daughter3DHitList);
348  nDaughterHits3DTotal += daughter3DHitList.size();
349  }
350  }
351 
352  const LArMvaHelper::MvaFeature nDaughters(static_cast<double>(nDaughterPfos));
353  const LArMvaHelper::MvaFeature nDaughterHits3D(static_cast<double>(nDaughterHits3DTotal));
354  const LArMvaHelper::MvaFeature daughterParentNHitsRatio(
355  (nParentHits3D > 0) ? static_cast<double>(nDaughterHits3DTotal) / static_cast<double>(nParentHits3D) : 0.);
356 
357  featureVector.push_back(nDaughters);
358  featureVector.push_back(nDaughterHits3D);
359  featureVector.push_back(daughterParentNHitsRatio);
360 }
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:71
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.
BEGIN_PROLOG could also be cout
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: