Public Member Functions | Private Member Functions | List of all members
lar_content::ThreeDVertexDistanceFeatureTool Class Reference

ThreeDVertexDistanceFeatureTool class for the calculation of 3d distance to neutrino vertex. More...

#include <TrackShowerIdFeatureTool.h>

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

Public Member Functions

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

ThreeDVertexDistanceFeatureTool class for the calculation of 3d distance to neutrino vertex.

Definition at line 177 of file TrackShowerIdFeatureTool.h.

Constructor & Destructor Documentation

lar_content::ThreeDVertexDistanceFeatureTool::ThreeDVertexDistanceFeatureTool ( )

Default constructor.

Definition at line 452 of file TrackShowerIdFeatureTool.cc.

453 {
454 }

Member Function Documentation

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

Definition at line 508 of file TrackShowerIdFeatureTool.cc.

509 {
510  return STATUS_CODE_SUCCESS;
511 }
void lar_content::ThreeDVertexDistanceFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pInputPfo 
)

Definition at line 458 of file TrackShowerIdFeatureTool.cc.

460 {
461  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
462  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
463 
464  LArMvaHelper::MvaFeature vertexDistance;
465 
466  const VertexList *pVertexList(nullptr);
467  (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
468 
469  if (!pVertexList || pVertexList->empty())
470  {
471  featureVector.push_back(vertexDistance);
472  return;
473  }
474 
475  unsigned int nInteractionVertices(0);
476  const Vertex *pInteractionVertex(nullptr);
477 
478  for (const Vertex *pVertex : *pVertexList)
479  {
480  if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
481  {
482  ++nInteractionVertices;
483  pInteractionVertex = pVertex;
484  }
485  }
486 
487  if (pInteractionVertex && (1 == nInteractionVertices))
488  {
489  try
490  {
491  vertexDistance = (pInteractionVertex->GetPosition() - LArPfoHelper::GetVertex(pInputPfo)->GetPosition()).GetMagnitude();
492  }
493  catch (const StatusCodeException &)
494  {
495  CaloHitList threeDCaloHitList;
496  LArPfoHelper::GetCaloHits(pInputPfo, TPC_3D, threeDCaloHitList);
497 
498  if (!threeDCaloHitList.empty())
499  vertexDistance = (pInteractionVertex->GetPosition() - (threeDCaloHitList.front())->GetPositionVector()).GetMagnitude();
500  }
501  }
502 
503  featureVector.push_back(vertexDistance);
504 }
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
MvaTypes::MvaFeature MvaFeature
Definition: LArMvaHelper.h:57
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.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.
std::list< Vertex > VertexList
Definition: DCEL.h:182
QTextStream & endl(QTextStream &s)

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