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

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
 

Detailed Description

PfoHierarchyFeatureTool for calculation of features relating to reconstructed particle hierarchy.

Definition at line 122 of file TrackShowerIdFeatureTool.h.

Constructor & Destructor Documentation

lar_content::PfoHierarchyFeatureTool::PfoHierarchyFeatureTool ( )

Default constructor.

Definition at line 246 of file TrackShowerIdFeatureTool.cc.

247 {
248 }

Member Function Documentation

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

Definition at line 293 of file TrackShowerIdFeatureTool.cc.

294 {
295  return STATUS_CODE_SUCCESS;
296 }
void lar_content::PfoHierarchyFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 252 of file TrackShowerIdFeatureTool.cc.

254 {
255  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
256  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
257 
258  CaloHitList parent3DHitList;
259  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, parent3DHitList);
260  const unsigned int nParentHits3D(parent3DHitList.size());
261 
262  PfoList allDaughtersPfoList;
263  LArPfoHelper::GetAllDownstreamPfos(pInputPfo, allDaughtersPfoList);
264  const unsigned int nDaughterPfos(allDaughtersPfoList.empty() ? 0 : allDaughtersPfoList.size() - 1);
265 
266  unsigned int nDaughterHits3DTotal(0);
267 
268  if (nDaughterPfos > 0)
269  {
270  // ATTN This relies on knowing that the first pfo in allDaughtersPfoList is the input pfo
271  allDaughtersPfoList.pop_front();
272 
273  for (const ParticleFlowObject *const pDaughterPfo : allDaughtersPfoList)
274  {
275  CaloHitList daughter3DHitList;
276  LArPfoHelper::GetCaloHits(pDaughterPfo, TPC_3D, daughter3DHitList);
277  nDaughterHits3DTotal += daughter3DHitList.size();
278  }
279  }
280 
281  const LArMvaHelper::MvaFeature nDaughters(static_cast<double>(nDaughterPfos));
282  const LArMvaHelper::MvaFeature nDaughterHits3D(static_cast<double>(nDaughterHits3DTotal));
283  const LArMvaHelper::MvaFeature daughterParentNHitsRatio(
284  (nParentHits3D > 0) ? static_cast<double>(nDaughterHits3DTotal) / static_cast<double>(nParentHits3D) : 0.);
285 
286  featureVector.push_back(nDaughters);
287  featureVector.push_back(nDaughterHits3D);
288  featureVector.push_back(daughterParentNHitsRatio);
289 }
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:57
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.
QTextStream & endl(QTextStream &s)

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