Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
DlVertexingAlgorithm.h
Go to the documentation of this file.
1
8#ifndef LAR_DL_VERTEXING_ALGORITHM_H
9#define LAR_DL_VERTEXING_ALGORITHM_H 1
10
11#include "Pandora/Algorithm.h"
13
15
17
18#include <random>
19
20using namespace lar_content;
21
22namespace lar_dl_content
23{
28{
29public:
30 typedef std::map<std::pair<int, int>, std::vector<const pandora::CaloHit *>> PixelToCaloHitsMap;
31
36
37 virtual ~DlVertexingAlgorithm();
38
39private:
41 {
42 public:
44 const pandora::CartesianVector &vertexW);
45
47 const pandora::HitType view1, const pandora::HitType view2);
48
50 float GetChi2() const;
51 std::string ToString() const;
52
53 private:
55 float m_chi2;
56 };
57
58 typedef std::pair<int, int> Pixel; // A Pixel is a row, column pair
59 typedef std::vector<Pixel> PixelVector;
60
65
66 /*
67 * @brief Create input for the network from a calo hit list
68 *
69 * @param caloHits The CaloHitList from which the input should be made
70 * @param view The wire plane view
71 * @param xMin The minimum x coordinate for the hits
72 * @param xMax The maximum x coordinate for the hits
73 * @param zMin The minimum x coordinate for the hits
74 * @param zMax The maximum x coordinate for the hits
75 * @param networkInput The TorchInput object to populate
76 * @param pixelVector The output vector of populated pixels
77 *
78 * @return The StatusCode resulting from the function
79 **/
80 pandora::StatusCode MakeNetworkInputFromHits(const pandora::CaloHitList &caloHits, const pandora::HitType view, const float xMin,
81 const float xMax, const float zMin, const float zMax, LArDLHelper::TorchInput &networkInput, PixelVector &pixelVector) const;
82
83 /*
84 * @brief Create a list of wire plane-space coordinates from a canvas
85 *
86 * @param canvas The input canvas
87 * @param canvasWidth The width of the canvas
88 * @param canvasHeight The height of the canvas
89 * @param columnOffset The column offset used when populating the canvas
90 * @param rowOffset The row offset used when populating the canvas
91 * @param xMin The minimum x coordinate for the hits
92 * @param xMax The maximum x coordinate for the hits
93 * @param zMin The minimum x coordinate for the hits
94 * @param zMax The maximum x coordinate for the hits
95 * @param positionVector The output vector of wire plane positions
96 *
97 * @return The StatusCode resulting from the function
98 **/
99 pandora::StatusCode MakeWirePlaneCoordinatesFromCanvas(float **canvas, const int canvasWidth, const int canvasHeight,
100 const int columnOffset, const int rowOffset, const pandora::HitType view, const float xMin, const float xMax, const float zMin,
101 const float zMax, pandora::CartesianPointVector &positionVector) const;
102
116 void GetCanvasParameters(const LArDLHelper::TorchOutput &networkOutput, const PixelVector &pixelVector, int &columnOffset,
117 int &rowOffset, int &width, int &height) const;
118
139 void DrawRing(float **canvas, const int row, const int col, const int inner, const int outer, const float weight) const;
140
152 void Update(const int radius, int &col, int &row) const;
153
154 /*
155 * @brief Retrieve the map from MC to calo hits for reconstructable particles
156 *
157 * @param mcToHitsMap The map to populate
158 *
159 * @return The StatusCode resulting from the function
160 **/
162
163 /*
164 * @brief Construct a list of the MC particles from the MC to calo hits map, completing the interaction hierarchy with the invisible
165 * upstream particles.
166 *
167 * @param mcToHitsMap The map of reconstructible MC particles to calo hits
168 * @param mcHierarchy The output list of MC particles representing the interaction
169 *
170 * @return The StatusCode resulting from the function
171 **/
173
174 /*
175 * @brief Determine the physical bounds associated with a CaloHitList.
176 *
177 * @param caloHitList The CaloHitList for which bounds should be determined
178 * @param xMin The output minimum x value
179 * @param xMax The output maximum x value
180 * @param zMin The output minimum z value
181 * @param zMax The output maximum z value
182 *
183 * @return The StatusCode resulting from the function
184 */
185 void GetHitRegion(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax) const;
186
195
199 void GetTrueVertexPosition(float &x, float &y, float &z) const;
200
204 void GetTrueVertexPosition(float &x, float &u, float &v, float &w) const;
205
210
211#ifdef MONITORING
215 void PopulateRootTree(const std::vector<VertexTuple> &vertexTuples, const pandora::CartesianPointVector &vertexCandidatesU,
216 const pandora::CartesianPointVector &vertexCandidatesV, const pandora::CartesianPointVector &vertexCandidatesW) const;
217#endif
218
228 int m_pass;
235 std::string m_rootTreeName;
236 std::string m_rootFileName;
237 std::mt19937 m_rng;
238 std::vector<double> m_thresholds;
239 std::string m_volumeType;
240};
241
242} // namespace lar_dl_content
243
244#endif // LAR_DL_VERTEXING_ALGORITHM_H
Header file for the algorithm class.
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the lar deep learning helper helper class.
Header file for the lar monte carlo particle helper helper class.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
const pandora::CartesianVector & GetPosition() const
pandora::CartesianVector m_pos
Calculated 3D position.
float m_chi2
Chi squared of calculated position.
DeepLearningTrackShowerIdAlgorithm class.
pandora::StatusCode Run()
Run the algorithm.
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 predicte...
pandora::StatusCode MakeCandidateVertexList(const pandora::CartesianPointVector &positions)
Create a vertex list from the candidate vertices.
const pandora::CartesianVector & GetTrueVertex() const
Retrieve the true neutrino vertex.
LArDLHelper::TorchModel m_modelW
The model for the W view.
bool m_visualise
Whether or not to visualise the candidate vertices.
std::string m_outputVertexListName
Output vertex list name.
std::string m_rootTreeName
The ROOT tree name.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
int m_pass
The pass of the train/infer step.
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
LArDLHelper::TorchModel m_modelV
The model for the V view.
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
int m_nClasses
The number of distance classes.
float m_driftStep
The size of a pixel in the drift direction in cm (most relevant in pass 2)
std::string m_inputVertexListName
Input vertex list name if 2nd pass.
LArDLHelper::TorchModel m_modelU
The model for the U view.
std::string m_trainingOutputFile
Output file name for training examples.
std::map< std::pair< int, int >, std::vector< const pandora::CaloHit * > > PixelToCaloHitsMap
pandora::StatusCode GetMCToHitsMap(LArMCParticleHelper::MCContributionMap &mcToHitsMap) const
bool m_writeTree
Whether or not to write validation details to a ROOT tree.
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 t...
int m_height
The height of the images.
pandora::StringVector m_caloHitListNames
Names of input calo hit lists.
std::string m_volumeType
The name of the fiducial volume type for the monitoring output.
void GetHitRegion(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax) 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 ...
void GetTrueVertexPosition(float &x, float &y, float &z) const
Retrieve the true neutrino vertex position.
std::string m_rootFileName
The ROOT file name.
std::vector< double > m_thresholds
Distance class thresholds.
pandora::StatusCode CompleteMCHierarchy(const LArMCParticleHelper::MCContributionMap &mcToHitsMap, pandora::MCParticleList &mcHierarchy) const
std::mt19937 m_rng
The random number generator.
torch::jit::script::Module TorchModel
Definition LArDLHelper.h:25
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
Definition Algorithm.h:21
CartesianVector class.
Pandora class.
Definition Pandora.h:40
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::vector< std::string > StringVector
std::vector< CartesianVector > CartesianPointVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.