LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
DeepLearningTrackShowerIdAlgorithm class. More...
#include "DlVertexingAlgorithm.h"
Classes | |
class | VertexTuple |
Public Types | |
typedef std::map< std::pair< int, int >, std::vector< const pandora::CaloHit * > > | PixelToCaloHitsMap |
Public Member Functions | |
DlVertexingAlgorithm () | |
Default constructor. More... | |
virtual | ~DlVertexingAlgorithm () |
Private Types | |
typedef std::pair< int, int > | Pixel |
typedef std::vector< Pixel > | PixelVector |
Private Member Functions | |
pandora::StatusCode | Run () |
pandora::StatusCode | ReadSettings (const pandora::TiXmlHandle xmlHandle) |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | GetTrueVertexPosition (float &x, float &y, float &z) const |
Retrieve the true neutrino vertex position. More... | |
void | GetTrueVertexPosition (float &x, float &u, float &v, float &w) const |
Retrieve the true neutrino vertex position. More... | |
const pandora::CartesianVector & | GetTrueVertex () const |
Retrieve the true neutrino vertex. More... | |
Private Attributes | |
bool | m_trainingMode |
Training mode. More... | |
std::string | m_trainingOutputFile |
Output file name for training examples. More... | |
std::string | m_inputVertexListName |
Input vertex list name if 2nd pass. More... | |
std::string | m_outputVertexListName |
Output vertex list name. More... | |
pandora::StringVector | m_caloHitListNames |
Names of input calo hit lists. More... | |
LArDLHelper::TorchModel | m_modelU |
The model for the U view. More... | |
LArDLHelper::TorchModel | m_modelV |
The model for the V view. More... | |
LArDLHelper::TorchModel | m_modelW |
The model for the W view. More... | |
int | m_event |
The current event number. More... | |
int | m_pass |
The pass of the train/infer step. More... | |
int | m_nClasses |
The number of distance classes. More... | |
int | m_height |
The height of the images. More... | |
int | m_width |
The width of the images. More... | |
float | m_driftStep |
The size of a pixel in the drift direction in cm (most relevant in pass 2) More... | |
bool | m_visualise |
Whether or not to visualise the candidate vertices. More... | |
bool | m_writeTree |
Whether or not to write validation details to a ROOT tree. More... | |
std::string | m_rootTreeName |
The ROOT tree name. More... | |
std::string | m_rootFileName |
The ROOT file name. More... | |
std::mt19937 | m_rng |
The random number generator. More... | |
std::vector< double > | m_thresholds |
Distance class thresholds. More... | |
std::string | m_volumeType |
The name of the fiducial volume type for the monitoring output. More... | |
DeepLearningTrackShowerIdAlgorithm class.
Definition at line 27 of file DlVertexingAlgorithm.h.
|
private |
Definition at line 58 of file DlVertexingAlgorithm.h.
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.
|
private |
Definition at line 59 of file DlVertexingAlgorithm.h.
lar_dl_content::DlVertexingAlgorithm::DlVertexingAlgorithm | ( | ) |
Default constructor.
Definition at line 28 of file DlVertexingAlgorithm.cc.
References m_driftStep, m_event, m_height, m_nClasses, m_pass, m_rng, m_trainingOutputFile, m_visualise, m_volumeType, m_width, and m_writeTree.
|
virtual |
Definition at line 44 of file DlVertexingAlgorithm.cc.
References e, m_rootFileName, m_rootTreeName, and m_writeTree.
|
private |
Definition at line 562 of file DlVertexingAlgorithm.cc.
Referenced by PrepareTrainingSample().
|
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.
networkOutput | The TorchOutput object populated by the network inference step |
pixelVector | The vector of populated pixels |
thresholds | The fractional distance thresholds representing the classes predicted by the network |
columnOffset | The output column offset for the canvas |
rowOffset | The output row offset for the canvas |
width | The output width for the canvas |
height | The output height for the canvas |
Definition at line 475 of file DlVertexingAlgorithm.cc.
References c1, c2, Update(), and weight.
Referenced by Infer().
|
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.
networkOutput | The TorchOutput object populated by the network inference step |
pixelVector | The vector of populated pixels |
columnOffset | The output column offset for the canvas |
rowOffset | The output row offset for the canvas |
width | The output width for the canvas |
height | The output height for the canvas |
Definition at line 440 of file DlVertexingAlgorithm.cc.
References col, m_height, m_thresholds, and m_width.
Referenced by Infer().
|
private |
Definition at line 592 of file DlVertexingAlgorithm.cc.
References util::begin(), m_caloHitListNames, m_driftStep, m_height, m_inputVertexListName, m_pass, m_width, x, and z.
Referenced by Infer(), and PrepareTrainingSample().
|
private |
Definition at line 545 of file DlVertexingAlgorithm.cc.
References lar_content::LArMCParticleHelper::PrimaryParameters::m_maxPhotonPropagation.
Referenced by PrepareTrainingSample().
|
private |
Retrieve the true neutrino vertex.
Definition at line 753 of file DlVertexingAlgorithm.cc.
References m_event, m_pass, m_rootTreeName, m_volumeType, and m_writeTree.
Referenced by GetTrueVertexPosition().
|
private |
Retrieve the true neutrino vertex position.
Definition at line 731 of file DlVertexingAlgorithm.cc.
References GetTrueVertex().
Referenced by Infer().
|
private |
Retrieve the true neutrino vertex position.
Definition at line 741 of file DlVertexingAlgorithm.cc.
References GetTrueVertex().
|
private |
Definition at line 171 of file DlVertexingAlgorithm.cc.
References col, DrawRing(), e, f, lar_dl_content::LArDLHelper::Forward(), GetCanvasParameters(), GetHitRegion(), GetTrueVertexPosition(), m_caloHitListNames, m_event, m_height, m_modelU, m_modelV, m_modelW, m_nClasses, m_pass, m_thresholds, m_visualise, m_width, MakeCandidateVertexList(), MakeNetworkInputFromHits(), MakeWirePlaneCoordinatesFromCanvas(), w, and x.
Referenced by Run().
|
private |
Create a vertex list from the candidate vertices.
candidates | The candidate positions with which to create the list. |
Definition at line 707 of file DlVertexingAlgorithm.cc.
References m_outputVertexListName.
Referenced by Infer().
|
private |
Definition at line 356 of file DlVertexingAlgorithm.cc.
References util::begin(), col, lar_dl_content::LArDLHelper::InitialiseInput(), m_driftStep, m_height, m_pass, m_width, value, x, and z.
Referenced by Infer().
|
private |
Definition at line 407 of file DlVertexingAlgorithm.cc.
References util::begin(), col, f, m_driftStep, m_height, m_width, pt, x, and z.
Referenced by Infer().
|
private |
Definition at line 71 of file DlVertexingAlgorithm.cc.
References CompleteMCHierarchy(), f, GetHitRegion(), GetMCToHitsMap(), m_caloHitListNames, m_pass, m_trainingOutputFile, x, and z.
Referenced by Run().
|
private |
Definition at line 842 of file DlVertexingAlgorithm.cc.
References f, lar_dl_content::LArDLHelper::LoadModel(), m_caloHitListNames, m_driftStep, m_height, m_inputVertexListName, m_modelU, m_modelV, m_modelW, m_nClasses, m_outputVertexListName, m_pass, m_rootFileName, m_rootTreeName, m_thresholds, m_trainingMode, m_trainingOutputFile, m_visualise, m_volumeType, m_width, m_writeTree, and lar_dl_content::DlVertexingAlgorithm::VertexTuple::VertexTuple().
|
private |
Definition at line 61 of file DlVertexingAlgorithm.cc.
References Infer(), m_trainingMode, and PrepareTrainingSample().
|
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.
radius2 | The squared radius of the circle under consideration |
col | The input/output column position to (potentially) update |
row | The input/output row position to update |
Definition at line 527 of file DlVertexingAlgorithm.cc.
References col.
Referenced by DrawRing().
|
private |
Names of input calo hit lists.
Definition at line 223 of file DlVertexingAlgorithm.h.
Referenced by GetHitRegion(), Infer(), PrepareTrainingSample(), and ReadSettings().
|
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.
Referenced by DlVertexingAlgorithm(), GetHitRegion(), MakeNetworkInputFromHits(), MakeWirePlaneCoordinatesFromCanvas(), and ReadSettings().
|
private |
The current event number.
Definition at line 227 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), GetTrueVertex(), and Infer().
|
private |
The height of the images.
Definition at line 230 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), GetCanvasParameters(), GetHitRegion(), Infer(), MakeNetworkInputFromHits(), MakeWirePlaneCoordinatesFromCanvas(), and ReadSettings().
|
private |
Input vertex list name if 2nd pass.
Definition at line 221 of file DlVertexingAlgorithm.h.
Referenced by GetHitRegion(), and ReadSettings().
|
private |
The model for the U view.
Definition at line 224 of file DlVertexingAlgorithm.h.
Referenced by Infer(), and ReadSettings().
|
private |
The model for the V view.
Definition at line 225 of file DlVertexingAlgorithm.h.
Referenced by Infer(), and ReadSettings().
|
private |
The model for the W view.
Definition at line 226 of file DlVertexingAlgorithm.h.
Referenced by Infer(), and ReadSettings().
|
private |
The number of distance classes.
Definition at line 229 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), Infer(), and ReadSettings().
|
private |
Output vertex list name.
Definition at line 222 of file DlVertexingAlgorithm.h.
Referenced by MakeCandidateVertexList(), and ReadSettings().
|
private |
The pass of the train/infer step.
Definition at line 228 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), GetHitRegion(), GetTrueVertex(), Infer(), MakeNetworkInputFromHits(), PrepareTrainingSample(), and ReadSettings().
|
private |
The random number generator.
Definition at line 237 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm().
|
private |
The ROOT file name.
Definition at line 236 of file DlVertexingAlgorithm.h.
Referenced by ReadSettings(), and ~DlVertexingAlgorithm().
|
private |
The ROOT tree name.
Definition at line 235 of file DlVertexingAlgorithm.h.
Referenced by GetTrueVertex(), ReadSettings(), and ~DlVertexingAlgorithm().
|
private |
Distance class thresholds.
Definition at line 238 of file DlVertexingAlgorithm.h.
Referenced by GetCanvasParameters(), Infer(), and ReadSettings().
|
private |
Training mode.
Definition at line 219 of file DlVertexingAlgorithm.h.
Referenced by ReadSettings(), and Run().
|
private |
Output file name for training examples.
Definition at line 220 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), PrepareTrainingSample(), and ReadSettings().
|
private |
Whether or not to visualise the candidate vertices.
Definition at line 233 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), Infer(), and ReadSettings().
|
private |
The name of the fiducial volume type for the monitoring output.
Definition at line 239 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), GetTrueVertex(), and ReadSettings().
|
private |
The width of the images.
Definition at line 231 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), GetCanvasParameters(), GetHitRegion(), Infer(), MakeNetworkInputFromHits(), MakeWirePlaneCoordinatesFromCanvas(), and ReadSettings().
|
private |
Whether or not to write validation details to a ROOT tree.
Definition at line 234 of file DlVertexingAlgorithm.h.
Referenced by DlVertexingAlgorithm(), GetTrueVertex(), ReadSettings(), and ~DlVertexingAlgorithm().