LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ThreeDShowersAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_THREE_D_SHOWERS_ALGORITHM_H
9 #define LAR_THREE_D_SHOWERS_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
15 
17 
18 namespace lar_content
19 {
20 
21 class ShowerTensorTool;
22 
23 //------------------------------------------------------------------------------------------------------------------------------------------
24 
28 class ThreeDShowersAlgorithm : public ThreeDBaseAlgorithm<ShowerOverlapResult>
29 {
30 public:
35 
41  const TwoDSlidingShowerFitResult &GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const;
42 
43  void UpdateForNewCluster(const pandora::Cluster *const pNewCluster);
44  void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster);
45  void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const;
46  void SetPfoParameters(const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const;
47 
48 private:
52  class XSampling
53  {
54  public:
62  XSampling(const TwoDSlidingFitResult &fitResultU, const TwoDSlidingFitResult &fitResultV, const TwoDSlidingFitResult &fitResultW);
63 
72  pandora::StatusCode GetBin(const float x, int &xBin) const;
73 
74  float m_uMinX;
75  float m_uMaxX;
76  float m_vMinX;
77  float m_vMaxX;
78  float m_wMinX;
79  float m_wMaxX;
80  float m_minX;
81  float m_maxX;
83  float m_nPoints;
84  };
85 
86  void PreparationStep();
87 
93  void PreparationStep(pandora::ClusterList &clusterList);
94 
95  void TidyUp();
96 
102  void AddToSlidingFitCache(const pandora::Cluster *const pCluster);
103 
109  void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster);
110 
111  void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW);
112 
121  pandora::StatusCode CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW,
122  ShowerOverlapResult &overlapResult);
123 
124  typedef std::pair<ShowerPositionMap, ShowerPositionMap> ShowerPositionMapPair;
125 
137  void GetShowerPositionMaps(const TwoDSlidingShowerFitResult &fitResultU, const TwoDSlidingShowerFitResult &fitResultV, const TwoDSlidingShowerFitResult &fitResultW,
138  const XSampling &xSampling, ShowerPositionMapPair &positionMapsU, ShowerPositionMapPair &positionMapsV, ShowerPositionMapPair &positionMapsW) const;
139 
149  void GetBestHitOverlapFraction(const pandora::Cluster *const pCluster, const XSampling &xSampling, const ShowerPositionMapPair &positionMaps,
150  unsigned int &nSampledHits, unsigned int &nMatchedHits) const;
151 
152  void ExamineTensor();
153  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
154 
155  typedef std::vector<ShowerTensorTool*> TensorToolVector;
156  TensorToolVector m_algorithmToolVector;
157  unsigned int m_nMaxTensorToolRepeats;
158 
159  unsigned int m_slidingFitWindow;
161 
163  unsigned int m_minClusterCaloHits;
165 
168 };
169 
170 //------------------------------------------------------------------------------------------------------------------------------------------
171 
175 class ShowerTensorTool : public pandora::AlgorithmTool
176 {
177 public:
179  typedef std::vector<TensorType::ElementList::const_iterator> IteratorList;
180 
189  virtual bool Run(ThreeDShowersAlgorithm *const pAlgorithm, TensorType &overlapTensor) = 0;
190 };
191 
192 } // namespace lar_content
193 
194 #endif // #ifndef LAR_THREE_D_SHOWERS_ALGORITHM_H
Float_t x
Definition: compare.C:6
Header file for the lar two dimensional sliding shower fit result class.
ThreeDBaseAlgorithm class.
void PreparationStep()
Perform any preparatory steps required, e.g. caching expensive fit results for clusters.
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
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.
ThreeDShowersAlgorithm::TensorType TensorType
ThreeDShowersAlgorithm class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
const TwoDSlidingShowerFitResult & GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const
Get a sliding shower fit result from the algorithm cache.
std::vector< TensorType::ElementList::const_iterator > IteratorList
Header file for the three dimension algorithm base class.
float m_wMinX
The min x value in the w view.
float m_nPoints
The number of sampling points to be used.
float m_uMaxX
The max x value in the u view.
unsigned int m_minShowerMatchedPoints
The minimum number of matched shower sampling points to allow shower grouping.
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
float m_uMinX
The min x value in the u view.
float m_vMinX
The min x value in the v view.
void SetPfoParameters(const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
Calculate Pfo properties from proto particle.
Header file for the lar shower overlap result class.
float m_maxX
The max x value of the common x-overlap range.
void ExamineTensor()
Examine contents of tensor, collect together best-matching 2D particles and modify clusters as requir...
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
void TidyUp()
Tidy member variables in derived class.
std::pair< ShowerPositionMap, ShowerPositionMap > ShowerPositionMapPair
std::unordered_map< const pandora::Cluster *, TwoDSlidingShowerFitResult > TwoDSlidingShowerFitResultMap
void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster)
Remova an existing sliding fit result, for the specified cluster, from the algorithm cache...
void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
Select a subset of input clusters for processing in this algorithm.
std::vector< ShowerTensorTool * > TensorToolVector
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
The sliding shower fit result map.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
pandora::StatusCode GetBin(const float x, int &xBin) const
Convert an x position into a sampling bin.
void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
Calculate cluster overlap result and store in tensor.
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
float m_wMaxX
The max x value in the w view.
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...
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.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
XSampling(const TwoDSlidingFitResult &fitResultU, const TwoDSlidingFitResult &fitResultV, const TwoDSlidingFitResult &fitResultW)
Constructor.
float m_vMaxX
The max x value in the v view.
float m_minShowerMatchedFraction
The minimum shower matched sampling fraction to allow shower grouping.
float m_minX
The min x value of the common x-overlap range.