Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
lar_dl_content::DlVertexingAlgorithm Class Reference

DeepLearningTrackShowerIdAlgorithm class. More...

#include "DlVertexingAlgorithm.h"

Inheritance diagram for lar_dl_content::DlVertexingAlgorithm:
Collaboration diagram for lar_dl_content::DlVertexingAlgorithm:

Classes

class  VertexTuple
 

Public Types

typedef std::map< std::pair< int, int >, std::vector< const pandora::CaloHit * > > PixelToCaloHitsMap
 

Public Member Functions

 DlVertexingAlgorithm ()
 Default constructor.
 
virtual ~DlVertexingAlgorithm ()
 
const std::string & GetType () const
 Get the type.
 
const std::string & GetInstanceName () const
 Get the instance name.
 
const PandoraGetPandora () const
 Get the associated pandora instance.
 

Protected Member Functions

virtual StatusCode Initialize ()
 Perform any operations that must occur after reading settings, but before running the process.
 
virtual StatusCode Reset ()
 Perform any operations when pandora is reset, typically at the end of each event.
 
StatusCode RegisterDetails (const Pandora *const pPandora, const std::string &type, const std::string &instanceName)
 Register i) the pandora instance that will run the process and ii) the process type.
 

Protected Attributes

const Pandoram_pPandora
 The pandora object that will run the process.
 
std::string m_type
 The process type.
 
std::string m_instanceName
 The process instance name.
 

Private Types

typedef std::pair< int, int > Pixel
 
typedef std::vector< PixelPixelVector
 

Private Member Functions

pandora::StatusCode Run ()
 Run the algorithm.
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 Read the algorithm settings.
 
pandora::StatusCode PrepareTrainingSample ()
 
pandora::StatusCode Infer ()
 
pandora::StatusCode MakeNetworkInputFromHits (const pandora::CaloHitList &caloHits, const pandora::HitType view, const float xMin, const float xMax, const float zMin, const float zMax, LArDLHelper::TorchInput &networkInput, PixelVector &pixelVector) const
 
pandora::StatusCode MakeWirePlaneCoordinatesFromCanvas (float **canvas, const int canvasWidth, const int canvasHeight, const int columnOffset, const int rowOffset, const pandora::HitType view, const float xMin, const float xMax, const float zMin, const float zMax, pandora::CartesianPointVector &positionVector) const
 
void GetCanvasParameters (const LArDLHelper::TorchOutput &networkOutput, const PixelVector &pixelVector, int &columnOffset, int &rowOffset, int &width, int &height) const
 Determines the parameters of the canvas for extracting the vertex location. The network predicts the distance that each pixel associated with a hit is located from the vertex, but says nothing about the direction. As a result, the ring describing the potential vertices associated with that hit can extend beyond the original canvas size. This function returns the size of the required canvas and the offset for the bottom left corner.
 
void DrawRing (float **canvas, const int row, const int col, const int inner, const int outer, const float weight) const
 Add a filled ring to the specified canvas. The ring has an inner radius based on the minimum predicted distance to the vertex and an outer radius based on the maximum predicted distance to the vertex. The centre of the ring is the location of the hit used to predict the distance to the vertex. Each pixel to be filled is augmented by the specified weight. In this way, once all hits have been considered, a consensus view emerges of the likely vertex location based on the overlap of various rings centred at different locations.
 
void Update (const int radius, int &col, int &row) const
 Update the coordinates along the loci of a circle. When drawing the ring we need an efficient means to determine the next pixel defining the inner and outer loci of the ring. This update function uses the Bresenham midpoint circle update function to determine this location. The row position is always incremented by 1 pixel, the column position is left unchanged, or decremented by 1 pixel to best follow the arc of the true underlying circle.
 
pandora::StatusCode GetMCToHitsMap (LArMCParticleHelper::MCContributionMap &mcToHitsMap) const
 
pandora::StatusCode CompleteMCHierarchy (const LArMCParticleHelper::MCContributionMap &mcToHitsMap, pandora::MCParticleList &mcHierarchy) const
 
void GetHitRegion (const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax) const
 
pandora::StatusCode MakeCandidateVertexList (const pandora::CartesianPointVector &positions)
 Create a vertex list from the candidate vertices.
 
void GetTrueVertexPosition (float &x, float &y, float &z) const
 Retrieve the true neutrino vertex position.
 
void GetTrueVertexPosition (float &x, float &u, float &v, float &w) const
 Retrieve the true neutrino vertex position.
 
const pandora::CartesianVectorGetTrueVertex () const
 Retrieve the true neutrino vertex.
 

Private Attributes

bool m_trainingMode
 Training mode.
 
std::string m_trainingOutputFile
 Output file name for training examples.
 
std::string m_inputVertexListName
 Input vertex list name if 2nd pass.
 
std::string m_outputVertexListName
 Output vertex list name.
 
pandora::StringVector m_caloHitListNames
 Names of input calo hit lists.
 
LArDLHelper::TorchModel m_modelU
 The model for the U view.
 
LArDLHelper::TorchModel m_modelV
 The model for the V view.
 
LArDLHelper::TorchModel m_modelW
 The model for the W view.
 
int m_event
 The current event number.
 
int m_pass
 The pass of the train/infer step.
 
int m_nClasses
 The number of distance classes.
 
int m_height
 The height of the images.
 
int m_width
 The width of the images.
 
float m_driftStep
 The size of a pixel in the drift direction in cm (most relevant in pass 2)
 
bool m_visualise
 Whether or not to visualise the candidate vertices.
 
bool m_writeTree
 Whether or not to write validation details to a ROOT tree.
 
std::string m_rootTreeName
 The ROOT tree name.
 
std::string m_rootFileName
 The ROOT file name.
 
std::mt19937 m_rng
 The random number generator.
 
std::vector< double > m_thresholds
 Distance class thresholds.
 
std::string m_volumeType
 The name of the fiducial volume type for the monitoring output.
 

Detailed Description

DeepLearningTrackShowerIdAlgorithm class.

Definition at line 27 of file DlVertexingAlgorithm.h.

Member Typedef Documentation

◆ Pixel

typedef std::pair<int, int> lar_dl_content::DlVertexingAlgorithm::Pixel
private

Definition at line 58 of file DlVertexingAlgorithm.h.

◆ PixelToCaloHitsMap

typedef std::map<std::pair<int, int>, std::vector<const pandora::CaloHit *> > lar_dl_content::DlVertexingAlgorithm::PixelToCaloHitsMap

Definition at line 30 of file DlVertexingAlgorithm.h.

◆ PixelVector

Definition at line 59 of file DlVertexingAlgorithm.h.

Constructor & Destructor Documentation

◆ DlVertexingAlgorithm()

lar_dl_content::DlVertexingAlgorithm::DlVertexingAlgorithm ( )

Default constructor.

Definition at line 28 of file DlVertexingAlgorithm.cc.

◆ ~DlVertexingAlgorithm()

lar_dl_content::DlVertexingAlgorithm::~DlVertexingAlgorithm ( )
virtual

Definition at line 44 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:

Member Function Documentation

◆ CompleteMCHierarchy()

StatusCode lar_dl_content::DlVertexingAlgorithm::CompleteMCHierarchy ( const LArMCParticleHelper::MCContributionMap mcToHitsMap,
pandora::MCParticleList mcHierarchy 
) const
private

Definition at line 562 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawRing()

void lar_dl_content::DlVertexingAlgorithm::DrawRing ( float **  canvas,
const int  row,
const int  col,
const int  inner,
const int  outer,
const float  weight 
) const
private

Add a filled ring to the specified canvas. The ring has an inner radius based on the minimum predicted distance to the vertex and an outer radius based on the maximum predicted distance to the vertex. The centre of the ring is the location of the hit used to predict the distance to the vertex. Each pixel to be filled is augmented by the specified weight. In this way, once all hits have been considered, a consensus view emerges of the likely vertex location based on the overlap of various rings centred at different locations.

The underlying implementation is a variant of the Bresenham midpoint circle algorithm and therefore only computes pixel coordinates for one octant of each circle (one of radius 'inner', one of radius 'outer') and interpolates the fill between points using integer arithmetic, guaranteeing each pixel of the ring is filled once and only once, and then mirrored to the remaining seven octants.

Parameters
networkOutputThe TorchOutput object populated by the network inference step
pixelVectorThe vector of populated pixels
thresholdsThe fractional distance thresholds representing the classes predicted by the network
columnOffsetThe output column offset for the canvas
rowOffsetThe output row offset for the canvas
widthThe output width for the canvas
heightThe output height for the canvas

Definition at line 475 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCanvasParameters()

void lar_dl_content::DlVertexingAlgorithm::GetCanvasParameters ( const LArDLHelper::TorchOutput networkOutput,
const PixelVector pixelVector,
int &  columnOffset,
int &  rowOffset,
int &  width,
int &  height 
) const
private

Determines the parameters of the canvas for extracting the vertex location. The network predicts the distance that each pixel associated with a hit is located from the vertex, but says nothing about the direction. As a result, the ring describing the potential vertices associated with that hit can extend beyond the original canvas size. This function returns the size of the required canvas and the offset for the bottom left corner.

Parameters
networkOutputThe TorchOutput object populated by the network inference step
pixelVectorThe vector of populated pixels
columnOffsetThe output column offset for the canvas
rowOffsetThe output row offset for the canvas
widthThe output width for the canvas
heightThe output height for the canvas

Definition at line 440 of file DlVertexingAlgorithm.cc.

Here is the caller graph for this function:

◆ GetHitRegion()

void lar_dl_content::DlVertexingAlgorithm::GetHitRegion ( const pandora::CaloHitList caloHitList,
float &  xMin,
float &  xMax,
float &  zMin,
float &  zMax 
) const
private

Definition at line 592 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstanceName()

const std::string & pandora::Process::GetInstanceName ( ) const
inlineinherited

Get the instance name.

Returns
The instance name

Definition at line 109 of file Process.h.

◆ GetMCToHitsMap()

StatusCode lar_dl_content::DlVertexingAlgorithm::GetMCToHitsMap ( LArMCParticleHelper::MCContributionMap mcToHitsMap) const
private

Definition at line 545 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPandora()

const Pandora & pandora::Process::GetPandora ( ) const
inlineinherited

Get the associated pandora instance.

Returns
the associated pandora instance

Definition at line 116 of file Process.h.

◆ GetTrueVertex()

const CartesianVector & lar_dl_content::DlVertexingAlgorithm::GetTrueVertex ( ) const
private

Retrieve the true neutrino vertex.

Definition at line 753 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTrueVertexPosition() [1/2]

void lar_dl_content::DlVertexingAlgorithm::GetTrueVertexPosition ( float &  x,
float &  u,
float &  v,
float &  w 
) const
private

Retrieve the true neutrino vertex position.

Definition at line 741 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:

◆ GetTrueVertexPosition() [2/2]

void lar_dl_content::DlVertexingAlgorithm::GetTrueVertexPosition ( float &  x,
float &  y,
float &  z 
) const
private

Retrieve the true neutrino vertex position.

Definition at line 731 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetType()

const std::string & pandora::Process::GetType ( ) const
inlineinherited

Get the type.

Returns
The type

Definition at line 102 of file Process.h.

◆ Infer()

StatusCode lar_dl_content::DlVertexingAlgorithm::Infer ( )
private

Definition at line 171 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

StatusCode pandora::Process::Initialize ( )
inlineprotectedvirtualinherited

Perform any operations that must occur after reading settings, but before running the process.

Reimplemented in lar_content::BdtBeamParticleIdTool, lar_content::BeamParticleIdTool, lar_content::CosmicRayTaggingTool, lar_content::EventReadingAlgorithm, lar_content::EventWritingAlgorithm, lar_content::LArPseudoLayerPlugin, lar_content::LArRotationalTransformationPlugin, EventReadingAlgorithm, and EventWritingAlgorithm.

Definition at line 126 of file Process.h.

Here is the caller graph for this function:

◆ MakeCandidateVertexList()

StatusCode lar_dl_content::DlVertexingAlgorithm::MakeCandidateVertexList ( const pandora::CartesianPointVector positions)
private

Create a vertex list from the candidate vertices.

Parameters
candidatesThe candidate positions with which to create the list.
Returns
The StatusCode resulting from the function

Definition at line 707 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeNetworkInputFromHits()

StatusCode lar_dl_content::DlVertexingAlgorithm::MakeNetworkInputFromHits ( const pandora::CaloHitList caloHits,
const pandora::HitType  view,
const float  xMin,
const float  xMax,
const float  zMin,
const float  zMax,
LArDLHelper::TorchInput networkInput,
PixelVector pixelVector 
) const
private

Definition at line 356 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeWirePlaneCoordinatesFromCanvas()

StatusCode lar_dl_content::DlVertexingAlgorithm::MakeWirePlaneCoordinatesFromCanvas ( float **  canvas,
const int  canvasWidth,
const int  canvasHeight,
const int  columnOffset,
const int  rowOffset,
const pandora::HitType  view,
const float  xMin,
const float  xMax,
const float  zMin,
const float  zMax,
pandora::CartesianPointVector positionVector 
) const
private

Definition at line 407 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareTrainingSample()

StatusCode lar_dl_content::DlVertexingAlgorithm::PrepareTrainingSample ( )
private

Definition at line 71 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadSettings()

StatusCode lar_dl_content::DlVertexingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Read the algorithm settings.

Parameters
xmlHandlethe relevant xml handle

Implements pandora::Process.

Definition at line 842 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:

◆ RegisterDetails()

StatusCode pandora::Process::RegisterDetails ( const Pandora *const  pPandora,
const std::string &  type,
const std::string &  instanceName 
)
inlineprotectedinherited

Register i) the pandora instance that will run the process and ii) the process type.

Parameters
pPandoraaddress of the pandora object that will run the process
typethe process type
instanceNamethe process instance name

Definition at line 146 of file Process.h.

Here is the caller graph for this function:

◆ Reset()

StatusCode pandora::Process::Reset ( )
inlineprotectedvirtualinherited

Perform any operations when pandora is reset, typically at the end of each event.

Reimplemented in lar_content::MasterAlgorithm, lar_content::PostProcessingAlgorithm, and lar_content::PreProcessingAlgorithm.

Definition at line 133 of file Process.h.

Here is the caller graph for this function:

◆ Run()

StatusCode lar_dl_content::DlVertexingAlgorithm::Run ( )
privatevirtual

Run the algorithm.

Implements pandora::Algorithm.

Definition at line 61 of file DlVertexingAlgorithm.cc.

Here is the call graph for this function:

◆ Update()

void lar_dl_content::DlVertexingAlgorithm::Update ( const int  radius,
int &  col,
int &  row 
) const
private

Update the coordinates along the loci of a circle. When drawing the ring we need an efficient means to determine the next pixel defining the inner and outer loci of the ring. This update function uses the Bresenham midpoint circle update function to determine this location. The row position is always incremented by 1 pixel, the column position is left unchanged, or decremented by 1 pixel to best follow the arc of the true underlying circle.

Parameters
radius2The squared radius of the circle under consideration
colThe input/output column position to (potentially) update
rowThe input/output row position to update

Definition at line 527 of file DlVertexingAlgorithm.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ m_caloHitListNames

pandora::StringVector lar_dl_content::DlVertexingAlgorithm::m_caloHitListNames
private

Names of input calo hit lists.

Definition at line 223 of file DlVertexingAlgorithm.h.

◆ m_driftStep

float lar_dl_content::DlVertexingAlgorithm::m_driftStep
private

The size of a pixel in the drift direction in cm (most relevant in pass 2)

Definition at line 232 of file DlVertexingAlgorithm.h.

◆ m_event

int lar_dl_content::DlVertexingAlgorithm::m_event
private

The current event number.

Definition at line 227 of file DlVertexingAlgorithm.h.

◆ m_height

int lar_dl_content::DlVertexingAlgorithm::m_height
private

The height of the images.

Definition at line 230 of file DlVertexingAlgorithm.h.

◆ m_inputVertexListName

std::string lar_dl_content::DlVertexingAlgorithm::m_inputVertexListName
private

Input vertex list name if 2nd pass.

Definition at line 221 of file DlVertexingAlgorithm.h.

◆ m_instanceName

std::string pandora::Process::m_instanceName
protectedinherited

The process instance name.

Definition at line 89 of file Process.h.

◆ m_modelU

LArDLHelper::TorchModel lar_dl_content::DlVertexingAlgorithm::m_modelU
private

The model for the U view.

Definition at line 224 of file DlVertexingAlgorithm.h.

◆ m_modelV

LArDLHelper::TorchModel lar_dl_content::DlVertexingAlgorithm::m_modelV
private

The model for the V view.

Definition at line 225 of file DlVertexingAlgorithm.h.

◆ m_modelW

LArDLHelper::TorchModel lar_dl_content::DlVertexingAlgorithm::m_modelW
private

The model for the W view.

Definition at line 226 of file DlVertexingAlgorithm.h.

◆ m_nClasses

int lar_dl_content::DlVertexingAlgorithm::m_nClasses
private

The number of distance classes.

Definition at line 229 of file DlVertexingAlgorithm.h.

◆ m_outputVertexListName

std::string lar_dl_content::DlVertexingAlgorithm::m_outputVertexListName
private

Output vertex list name.

Definition at line 222 of file DlVertexingAlgorithm.h.

◆ m_pass

int lar_dl_content::DlVertexingAlgorithm::m_pass
private

The pass of the train/infer step.

Definition at line 228 of file DlVertexingAlgorithm.h.

◆ m_pPandora

const Pandora* pandora::Process::m_pPandora
protectedinherited

The pandora object that will run the process.

Definition at line 87 of file Process.h.

◆ m_rng

std::mt19937 lar_dl_content::DlVertexingAlgorithm::m_rng
private

The random number generator.

Definition at line 237 of file DlVertexingAlgorithm.h.

◆ m_rootFileName

std::string lar_dl_content::DlVertexingAlgorithm::m_rootFileName
private

The ROOT file name.

Definition at line 236 of file DlVertexingAlgorithm.h.

◆ m_rootTreeName

std::string lar_dl_content::DlVertexingAlgorithm::m_rootTreeName
private

The ROOT tree name.

Definition at line 235 of file DlVertexingAlgorithm.h.

◆ m_thresholds

std::vector<double> lar_dl_content::DlVertexingAlgorithm::m_thresholds
private

Distance class thresholds.

Definition at line 238 of file DlVertexingAlgorithm.h.

◆ m_trainingMode

bool lar_dl_content::DlVertexingAlgorithm::m_trainingMode
private

Training mode.

Definition at line 219 of file DlVertexingAlgorithm.h.

◆ m_trainingOutputFile

std::string lar_dl_content::DlVertexingAlgorithm::m_trainingOutputFile
private

Output file name for training examples.

Definition at line 220 of file DlVertexingAlgorithm.h.

◆ m_type

std::string pandora::Process::m_type
protectedinherited

The process type.

Definition at line 88 of file Process.h.

◆ m_visualise

bool lar_dl_content::DlVertexingAlgorithm::m_visualise
private

Whether or not to visualise the candidate vertices.

Definition at line 233 of file DlVertexingAlgorithm.h.

◆ m_volumeType

std::string lar_dl_content::DlVertexingAlgorithm::m_volumeType
private

The name of the fiducial volume type for the monitoring output.

Definition at line 239 of file DlVertexingAlgorithm.h.

◆ m_width

int lar_dl_content::DlVertexingAlgorithm::m_width
private

The width of the images.

Definition at line 231 of file DlVertexingAlgorithm.h.

◆ m_writeTree

bool lar_dl_content::DlVertexingAlgorithm::m_writeTree
private

Whether or not to write validation details to a ROOT tree.

Definition at line 234 of file DlVertexingAlgorithm.h.


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