All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DlHitTrackShowerIdAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoradlcontent/LArTrackShowerId/DlHitTrackShowerIdAlgorithm.h
3  *
4  * @brief Header file for the deep learning track shower id algorithm.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_DL_HIT_TRACK_SHOWER_ID_ALGORITHM_H
9 #define LAR_DL_HIT_TRACK_SHOWER_ID_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
15 namespace lar_dl_content
16 {
17 
18 /**
19  * @brief DlHitTrackShowerIdAlgorithm class
20  */
21 class DlHitTrackShowerIdAlgorithm : public pandora::Algorithm
22 {
23 public:
24  /**
25  * @brief Default constructor
26  */
28 
30 
31 private:
32  typedef std::map<const pandora::CaloHit *, std::tuple<int, int, int, int>> CaloHitToPixelMap;
33  typedef std::map<int, int> PixelToTileMap;
34 
35  pandora::StatusCode Run();
36 
37  /**
38  * @brief Produce files that act as inputs to network training
39  */
40  pandora::StatusCode Train();
41 
42  /**
43  * @brief Run network inference
44  */
45  pandora::StatusCode Infer();
46  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
47 
48  /**
49  * @brief Identify the XZ range containing the hits for an event
50  *
51  * @param caloHitList The list of CaloHits for which the range is to be found
52  * @param xMin The output minimum x-coordinate
53  * @param xMax The output maximum x-coordinate
54  * @param zMin The output minimum z-coordinate
55  * @param zMax The output maximum z-coordinate
56  */
57  void GetHitRegion(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax);
58 
59  /**
60  * @brief Populate a map between pixels and tiles
61  *
62  * @param caloHitList The list of CaloHits for which the map is to be populated
63  * @param xMin The minimum x-coordinate
64  * @param zMin The minimum z-coordinate
65  * @param nTilesX The number of tiles in the x direction
66  * @param sparseMap The output map between pixels and tiles
67  */
68  void GetSparseTileMap(const pandora::CaloHitList &caloHitList, const float xMin, const float zMin, const int nTilesX, PixelToTileMap &sparseMap);
69 
70  pandora::StringVector m_caloHitListNames; ///< Name of input calo hit list
71  std::string m_modelFileNameU; ///< Model file name for U view
72  std::string m_modelFileNameV; ///< Model file name for V view
73  std::string m_modelFileNameW; ///< Model file name for W view
74  LArDLHelper::TorchModel m_modelU; ///< Model for the U view
75  LArDLHelper::TorchModel m_modelV; ///< Model for the V view
76  LArDLHelper::TorchModel m_modelW; ///< Model for the W view
77  int m_imageHeight; ///< Height of images in pixels
78  int m_imageWidth; ///< Width of images in pixels
79  float m_tileSize; ///< Size of tile in cm
80  bool m_visualize; ///< Whether to visualize the track shower ID scores
81  bool m_useTrainingMode; ///< Training mode
82  std::string m_trainingOutputFile; ///< Output file name for training examples
83 };
84 
85 } // namespace lar_dl_content
86 
87 #endif // LAR_DL_HIT_TRACK_SHOWER_ID_ALGORITHM_H
LArDLHelper::TorchModel m_modelW
Model for the W view.
bool m_visualize
Whether to visualize the track shower ID scores.
LArDLHelper::TorchModel m_modelU
Model for the U view.
torch::jit::script::Module TorchModel
Definition: LArDLHelper.h:25
std::string m_modelFileNameW
Model file name for W view.
std::string m_modelFileNameU
Model file name for U view.
pandora::StringVector m_caloHitListNames
Name of input calo hit list.
pandora::StatusCode Infer()
Run network inference.
std::string m_trainingOutputFile
Output file name for training examples.
Header file for the lar deep learning helper helper class.
LArDLHelper::TorchModel m_modelV
Model for the V view.
void GetHitRegion(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax, float &zMin, float &zMax)
Identify the XZ range containing the hits for an event.
std::string m_modelFileNameV
Model file name for V view.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode Train()
Produce files that act as inputs to network training.
void GetSparseTileMap(const pandora::CaloHitList &caloHitList, const float xMin, const float zMin, const int nTilesX, PixelToTileMap &sparseMap)
Populate a map between pixels and tiles.
std::map< const pandora::CaloHit *, std::tuple< int, int, int, int > > CaloHitToPixelMap