LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ThreeViewShowersAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_THREE_VIEW_SHOWERS_ALGORITHM_H
9 #define LAR_THREE_VIEW_SHOWERS_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
15 
18 
19 namespace lar_content
20 {
21 
22 class ShowerTensorTool;
23 
24 //------------------------------------------------------------------------------------------------------------------------------------------
25 
29 class ThreeViewShowersAlgorithm : public NViewMatchingAlgorithm<ThreeViewMatchingControl<ShowerOverlapResult>>
30 {
31 public:
33 
38 
44  const TwoDSlidingShowerFitResult &GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const;
45 
46  void UpdateForNewCluster(const pandora::Cluster *const pNewCluster);
47  void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster);
48  void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const;
49  void PrepareInputClusters(pandora::ClusterList &preparedClusterList);
50 
51 private:
55  class XSampling
56  {
57  public:
65  XSampling(const TwoDSlidingFitResult &fitResultU, const TwoDSlidingFitResult &fitResultV, const TwoDSlidingFitResult &fitResultW);
66 
75  pandora::StatusCode GetBin(const float x, int &xBin) const;
76 
77  float m_uMinX;
78  float m_uMaxX;
79  float m_vMinX;
80  float m_vMaxX;
81  float m_wMinX;
82  float m_wMaxX;
83  float m_minX;
84  float m_maxX;
86  float m_nPoints;
87  };
88 
89  void TidyUp();
90 
96  void AddToSlidingFitCache(const pandora::Cluster *const pCluster);
97 
103  void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster);
104 
105  void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW);
106 
115  pandora::StatusCode CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV,
116  const pandora::Cluster *const pClusterW, ShowerOverlapResult &overlapResult);
117 
118  typedef std::pair<ShowerPositionMap, ShowerPositionMap> ShowerPositionMapPair;
119 
131  void GetShowerPositionMaps(const TwoDSlidingShowerFitResult &fitResultU, const TwoDSlidingShowerFitResult &fitResultV,
132  const TwoDSlidingShowerFitResult &fitResultW, const XSampling &xSampling, ShowerPositionMapPair &positionMapsU,
133  ShowerPositionMapPair &positionMapsV, ShowerPositionMapPair &positionMapsW) const;
134 
144  void GetBestHitOverlapFraction(const pandora::Cluster *const pCluster, const XSampling &xSampling,
145  const ShowerPositionMapPair &positionMaps, unsigned int &nSampledHits, unsigned int &nMatchedHits) const;
146 
148  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
149 
150  typedef std::vector<ShowerTensorTool *> TensorToolVector;
151  TensorToolVector m_algorithmToolVector;
152  unsigned int m_nMaxTensorToolRepeats;
153 
154  unsigned int m_slidingFitWindow;
156 
158  unsigned int m_minClusterCaloHits;
160 
163  bool m_visualize;
164 };
165 
166 //------------------------------------------------------------------------------------------------------------------------------------------
167 
171 class ShowerTensorTool : public pandora::AlgorithmTool
172 {
173 public:
175  typedef std::vector<TensorType::ElementList::const_iterator> IteratorList;
176 
185  virtual bool Run(ThreeViewShowersAlgorithm *const pAlgorithm, TensorType &overlapTensor) = 0;
186 };
187 
188 } // namespace lar_content
189 
190 #endif // #ifndef LAR_THREE_VIEW_SHOWERS_ALGORITHM_H
Float_t x
Definition: compare.C:6
pandora::StatusCode GetBin(const float x, int &xBin) const
Convert an x position into a sampling bin.
Header file for the lar two dimensional sliding shower fit result class.
NViewMatchingAlgorithm class.
std::vector< ShowerTensorTool * > TensorToolVector
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
XSampling(const TwoDSlidingFitResult &fitResultU, const TwoDSlidingFitResult &fitResultV, const TwoDSlidingFitResult &fitResultW)
Constructor.
NViewMatchingAlgorithm< ThreeViewMatchingControl< ShowerOverlapResult > > BaseAlgorithm
void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster)
Remova an existing sliding fit result, for the specified cluster, from the algorithm cache...
Header file for the n view matching algorithm class.
float m_minX
The min x value of the common x-overlap range.
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
Calculate cluster overlap result and store in container.
std::pair< ShowerPositionMap, ShowerPositionMap > ShowerPositionMapPair
void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
Select a subset of input clusters for processing in this algorithm.
std::vector< TensorType::ElementList::const_iterator > IteratorList
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
The sliding shower fit result map.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
ThreeViewShowersAlgorithm::MatchingType::TensorType TensorType
unsigned int m_minShowerMatchedPoints
The minimum number of matched shower sampling points to allow shower grouping.
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
void ExamineOverlapContainer()
Examine contents of overlap container, collect together best-matching 2D particles and modify cluster...
void PrepareInputClusters(pandora::ClusterList &preparedClusterList)
Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results...
bool m_visualize
Visualize cluster matching procedure.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
Header file for the lar shower overlap result class.
void GetShowerPositionMaps(const TwoDSlidingShowerFitResult &fitResultU, const TwoDSlidingShowerFitResult &fitResultV, const TwoDSlidingShowerFitResult &fitResultW, const XSampling &xSampling, ShowerPositionMapPair &positionMapsU, ShowerPositionMapPair &positionMapsV, ShowerPositionMapPair &positionMapsW) const
Get the shower position maps.
void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters.
void TidyUp()
Tidy member variables in derived class.
void GetBestHitOverlapFraction(const pandora::Cluster *const pCluster, const XSampling &xSampling, const ShowerPositionMapPair &positionMaps, unsigned int &nSampledHits, unsigned int &nMatchedHits) const
Get the best fraction of hits, in the common x-overlap range, contained within the provided pair of s...
float m_nPoints
The number of sampling points to be used.
float m_minShowerMatchedFraction
The minimum shower matched sampling fraction to allow shower grouping.
float m_maxX
The max x value of the common x-overlap range.
Header file for the three view matching control class.
std::unordered_map< const pandora::Cluster *, TwoDSlidingShowerFitResult > TwoDSlidingShowerFitResultMap
const TwoDSlidingShowerFitResult & GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const
Get a sliding shower fit result from the algorithm cache.
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.