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

InitialRegionFeatureTool to calculate variables related to the initial shower region. More...

#include "ConnectionPathwayFeatureTool.h"

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

Public Types

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

Public Member Functions

 InitialRegionFeatureTool ()
 Default constructor. More...
 
void Run (LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pShowerPfo, const pandora::CartesianVector &nuVertex3D, const ProtoShowerMatch &protoShowerMatch, const pandora::CartesianPointVector &showerStarts3D)
 
void Run (LArMvaHelper::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pShowerPfo, const pandora::CartesianVector &nuVertex3D, const ProtoShowerMatch &protoShowerMatch, const pandora::CartesianPointVector &showerStarts3D)
 
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)
 
void GetViewInitialRegionVariables (const pandora::Algorithm *const pAlgorithm, const pandora::CartesianVector &nuVertex3D, const ProtoShowerMatch &protoShowerMatch, const pandora::HitType hitType, float &initialGapSize, float &largestGapSize) const
 Calculate the initial region variables for the input view. More...
 

Private Attributes

float m_defaultFloat
 Default float value. More...
 
unsigned int m_nHitsToConsider
 The number of hits which defines the initial region. More...
 
float m_maxInitialGapSizeLimit
 maxInitialGapSizeLimit max. limit More...
 
float m_minLargestGapSizeLimit
 minLargestGapSizeLimit max. limit More...
 

Detailed Description

InitialRegionFeatureTool to calculate variables related to the initial shower region.

Definition at line 29 of file ConnectionPathwayFeatureTool.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::InitialRegionFeatureTool::InitialRegionFeatureTool ( )

Default constructor.

Definition at line 25 of file ConnectionPathwayFeatureTool.cc.

References lar_content::LArConnectionPathwayHelper::GetMinMiddleMax(), GetViewInitialRegionVariables(), m_defaultFloat, m_maxInitialGapSizeLimit, m_minLargestGapSizeLimit, and Run().

25  :
26  m_defaultFloat(-10.f),
30 {
31 }
float m_maxInitialGapSizeLimit
maxInitialGapSizeLimit max. limit
TFile f
Definition: plotHisto.C:6
float m_minLargestGapSizeLimit
minLargestGapSizeLimit max. limit
unsigned int m_nHitsToConsider
The number of hits which defines the initial region.

Member Function Documentation

void lar_content::InitialRegionFeatureTool::GetViewInitialRegionVariables ( const pandora::Algorithm *const  pAlgorithm,
const pandora::CartesianVector &  nuVertex3D,
const ProtoShowerMatch protoShowerMatch,
const pandora::HitType  hitType,
float &  initialGapSize,
float &  largestGapSize 
) const
private

Calculate the initial region variables for the input view.

Parameters
pAlgorithmthe algorithm
nuVertex3Dthe 3D neutrino vertex
protoShowerMatchthe ProtoShower match
hitTypethe 2D view
initialGapSizethe output initial gap size
largestGapSizethe output largest gap size

Definition at line 84 of file ConnectionPathwayFeatureTool.cc.

References lar_content::ProtoShower::GetConnectionPathway(), lar_content::ProtoShowerMatch::GetProtoShowerU(), lar_content::ProtoShowerMatch::GetProtoShowerV(), lar_content::ProtoShowerMatch::GetProtoShowerW(), lar_content::ProtoShower::GetSpineHitList(), lar_content::ConnectionPathway::GetStartDirection(), m_defaultFloat, m_nHitsToConsider, and lar_content::LArGeometryHelper::ProjectPosition().

Referenced by InitialRegionFeatureTool().

86 {
87  const ProtoShower &protoShower(hitType == TPC_VIEW_U
88  ? protoShowerMatch.GetProtoShowerU()
89  : (hitType == TPC_VIEW_V ? protoShowerMatch.GetProtoShowerV() : protoShowerMatch.GetProtoShowerW()));
90  const CartesianVector nuVertex2D(LArGeometryHelper::ProjectPosition(pAlgorithm->GetPandora(), nuVertex3D, hitType));
91  const CartesianVector &startDirection(protoShower.GetConnectionPathway().GetStartDirection());
92 
93  // Initial gap size
94  CaloHitVector spineHitVector(protoShower.GetSpineHitList().begin(), protoShower.GetSpineHitList().end());
95 
96  std::sort(spineHitVector.begin(), spineHitVector.end(), LArConnectionPathwayHelper::SortByDistanceToPoint(nuVertex2D));
97  initialGapSize = (nuVertex2D - spineHitVector.front()->GetPositionVector()).GetMagnitude();
98 
99  // Largest Gap Size
100  largestGapSize = m_defaultFloat;
101 
102  std::vector<float> longitudinalProjections;
103 
104  for (const CaloHit *const pCaloHit : protoShower.GetSpineHitList())
105  longitudinalProjections.push_back(startDirection.GetDotProduct(pCaloHit->GetPositionVector() - nuVertex2D));
106 
107  std::sort(longitudinalProjections.begin(), longitudinalProjections.end());
108 
109  const unsigned int nIterations(std::min(longitudinalProjections.size(), static_cast<long unsigned int>(m_nHitsToConsider)) - 1);
110 
111  for (unsigned int i = 0; i < nIterations; ++i)
112  largestGapSize = std::max(std::fabs(longitudinalProjections[i] - longitudinalProjections[i + 1]), largestGapSize);
113 }
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
unsigned int m_nHitsToConsider
The number of hits which defines the initial region.
StatusCode lar_content::InitialRegionFeatureTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 117 of file ConnectionPathwayFeatureTool.cc.

References m_defaultFloat, m_maxInitialGapSizeLimit, m_minLargestGapSizeLimit, and m_nHitsToConsider.

118 {
119  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "nHitsToConsider", m_nHitsToConsider));
120 
121  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "DefaultFloat", m_defaultFloat));
122 
123  PANDORA_RETURN_RESULT_IF_AND_IF(
124  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxInitialGapSizeLimit", m_maxInitialGapSizeLimit));
125 
126  PANDORA_RETURN_RESULT_IF_AND_IF(
127  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinLargestGapSizeLimit", m_minLargestGapSizeLimit));
128 
129  return STATUS_CODE_SUCCESS;
130 }
float m_maxInitialGapSizeLimit
maxInitialGapSizeLimit max. limit
float m_minLargestGapSizeLimit
minLargestGapSizeLimit max. limit
unsigned int m_nHitsToConsider
The number of hits which defines the initial region.
void lar_content::InitialRegionFeatureTool::Run ( LArMvaHelper::MvaFeatureVector featureVector,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pShowerPfo,
const pandora::CartesianVector &  nuVertex3D,
const ProtoShowerMatch protoShowerMatch,
const pandora::CartesianPointVector &  showerStarts3D 
)
void lar_content::InitialRegionFeatureTool::Run ( LArMvaHelper::MvaFeatureMap featureMap,
pandora::StringVector &  featureOrder,
const std::string &  featureToolName,
const pandora::Algorithm *const  pAlgorithm,
const pandora::ParticleFlowObject *const  pShowerPfo,
const pandora::CartesianVector &  nuVertex3D,
const ProtoShowerMatch protoShowerMatch,
const pandora::CartesianPointVector &  showerStarts3D 
)
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  };

Member Data Documentation

float lar_content::InitialRegionFeatureTool::m_defaultFloat
private

Default float value.

Definition at line 61 of file ConnectionPathwayFeatureTool.h.

Referenced by GetViewInitialRegionVariables(), InitialRegionFeatureTool(), and ReadSettings().

float lar_content::InitialRegionFeatureTool::m_maxInitialGapSizeLimit
private

maxInitialGapSizeLimit max. limit

Definition at line 63 of file ConnectionPathwayFeatureTool.h.

Referenced by InitialRegionFeatureTool(), and ReadSettings().

float lar_content::InitialRegionFeatureTool::m_minLargestGapSizeLimit
private

minLargestGapSizeLimit max. limit

Definition at line 64 of file ConnectionPathwayFeatureTool.h.

Referenced by InitialRegionFeatureTool(), and ReadSettings().

unsigned int lar_content::InitialRegionFeatureTool::m_nHitsToConsider
private

The number of hits which defines the initial region.

Definition at line 62 of file ConnectionPathwayFeatureTool.h.

Referenced by GetViewInitialRegionVariables(), and ReadSettings().


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