LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ThreeDBaseAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_THREE_D_BASE_ALGORITHM_H
9 #define LAR_THREE_D_BASE_ALGORITHM_H 1
10 
11 #include "Api/PandoraContentApi.h"
12 
13 #include "Pandora/Algorithm.h"
14 
16 
17 #include <unordered_map>
18 
19 namespace lar_content
20 {
21 
26 {
27 public:
28  pandora::ClusterList m_clusterListU;
29  pandora::ClusterList m_clusterListV;
30  pandora::ClusterList m_clusterListW;
31 };
32 
33 typedef std::vector<ProtoParticle> ProtoParticleVector;
34 typedef std::unordered_map<const pandora::Cluster*, pandora::ClusterList> ClusterMergeMap;
35 
36 //------------------------------------------------------------------------------------------------------------------------------------------
37 
41 template<typename T>
42 class ThreeDBaseAlgorithm : public pandora::Algorithm
43 {
44 public:
46 
51 
55  virtual ~ThreeDBaseAlgorithm();
56 
64  virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector);
65 
72  virtual void SetPfoParameters(const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const = 0;
73 
81  virtual bool MakeClusterMerges(const ClusterMergeMap &clusterMergeMap);
82 
88  virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster);
89 
95  virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster);
96 
100  virtual void RemoveUnavailableTensorElements();
101 
105  const pandora::ClusterList &GetInputClusterListU() const;
106 
110  const pandora::ClusterList &GetInputClusterListV() const;
111 
115  const pandora::ClusterList &GetInputClusterListW() const;
116 
120  const pandora::ClusterList &GetSelectedClusterListU() const;
121 
125  const pandora::ClusterList &GetSelectedClusterListV() const;
126 
130  const pandora::ClusterList &GetSelectedClusterListW() const;
131 
135  const std::string &GetClusterListNameU() const;
136 
140  const std::string &GetClusterListNameV() const;
141 
145  const std::string &GetClusterListNameW() const;
146 
153  virtual void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const = 0;
154 
155 protected:
156  virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
157 
161  virtual void SelectAllInputClusters();
162 
166  virtual void PreparationStep();
167 
171  virtual void PerformMainLoop();
172 
180  virtual void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW) = 0;
181 
185  virtual void ExamineTensor() = 0;
186 
190  virtual void TidyUp();
191 
192  const pandora::ClusterList *m_pInputClusterListU;
193  const pandora::ClusterList *m_pInputClusterListV;
194  const pandora::ClusterList *m_pInputClusterListW;
195 
196  pandora::ClusterList m_clusterListU;
197  pandora::ClusterList m_clusterListV;
198  pandora::ClusterList m_clusterListW;
199 
200  TensorType m_overlapTensor;
201 
202 private:
203  pandora::StatusCode Run();
204 
208  std::string m_outputPfoListName;
209 };
210 
211 //------------------------------------------------------------------------------------------------------------------------------------------
212 
213 template<typename T>
214 inline const pandora::ClusterList &ThreeDBaseAlgorithm<T>::GetInputClusterListU() const
215 {
216  if (NULL == m_pInputClusterListU)
217  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
218 
219  return (*m_pInputClusterListU);
220 }
221 
222 //------------------------------------------------------------------------------------------------------------------------------------------
223 
224 template<typename T>
225 inline const pandora::ClusterList &ThreeDBaseAlgorithm<T>::GetInputClusterListV() const
226 {
227  if (NULL == m_pInputClusterListV)
228  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
229 
230  return (*m_pInputClusterListV);
231 }
232 
233 //------------------------------------------------------------------------------------------------------------------------------------------
234 
235 template<typename T>
236 inline const pandora::ClusterList &ThreeDBaseAlgorithm<T>::GetInputClusterListW() const
237 {
238  if (NULL == m_pInputClusterListW)
239  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
240 
241  return (*m_pInputClusterListW);
242 }
243 
244 //------------------------------------------------------------------------------------------------------------------------------------------
245 
246 template<typename T>
247 inline const pandora::ClusterList &ThreeDBaseAlgorithm<T>::GetSelectedClusterListU() const
248 {
249  return m_clusterListU;
250 }
251 
252 //------------------------------------------------------------------------------------------------------------------------------------------
253 
254 template<typename T>
255 inline const pandora::ClusterList &ThreeDBaseAlgorithm<T>::GetSelectedClusterListV() const
256 {
257  return m_clusterListV;
258 }
259 
260 //------------------------------------------------------------------------------------------------------------------------------------------
261 
262 template<typename T>
263 inline const pandora::ClusterList &ThreeDBaseAlgorithm<T>::GetSelectedClusterListW() const
264 {
265  return m_clusterListW;
266 }
267 
268 //------------------------------------------------------------------------------------------------------------------------------------------
269 
270 template<typename T>
271 inline const std::string &ThreeDBaseAlgorithm<T>::GetClusterListNameU() const
272 {
273  return m_inputClusterListNameU;
274 }
275 
276 //------------------------------------------------------------------------------------------------------------------------------------------
277 
278 template<typename T>
279 inline const std::string &ThreeDBaseAlgorithm<T>::GetClusterListNameV() const
280 {
281  return m_inputClusterListNameV;
282 }
283 
284 //------------------------------------------------------------------------------------------------------------------------------------------
285 
286 template<typename T>
287 inline const std::string &ThreeDBaseAlgorithm<T>::GetClusterListNameW() const
288 {
289  return m_inputClusterListNameW;
290 }
291 
292 } // namespace lar_content
293 
294 #endif // #ifndef LAR_THREE_D_BASE_ALGORITHM_H
OverlapTensor class.
std::vector< ProtoParticle > ProtoParticleVector
ThreeDBaseAlgorithm class.
const pandora::ClusterList & GetInputClusterListW() const
Get the input w cluster list.
const std::string & GetClusterListNameU() const
Get the name of the u cluster list.
std::string m_inputClusterListNameV
The name of the view V cluster list.
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
Header file for the lar overlap tensor class.
const std::string & GetClusterListNameV() const
Get the name of the v cluster list.
const pandora::ClusterList & GetSelectedClusterListV() const
Get the selected v cluster list.
const pandora::ClusterList * m_pInputClusterListV
Address of the input cluster list V.
const pandora::ClusterList * m_pInputClusterListU
Address of the input cluster list U.
const pandora::ClusterList & GetSelectedClusterListU() const
Get the selected u cluster list.
const pandora::ClusterList * m_pInputClusterListW
Address of the input cluster list W.
const pandora::ClusterList & GetSelectedClusterListW() const
Get the selected w cluster list.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
pandora::ClusterList m_clusterListW
List of 2D W clusters in a 3D proto particle.
const std::string & GetClusterListNameW() const
Get the name of the w cluster list.
const pandora::ClusterList & GetInputClusterListV() const
Get the input v cluster list.
TensorType m_overlapTensor
The overlap tensor.
pandora::ClusterList m_clusterListV
List of 2D V clusters in a 3D proto particle.
const pandora::ClusterList & GetInputClusterListU() const
Get the input u cluster list.
pandora::ClusterList m_clusterListU
List of 2D U clusters in a 3D proto particle.
std::string m_inputClusterListNameW
The name of the view W cluster list.
std::unordered_map< const pandora::Cluster *, pandora::ClusterList > ClusterMergeMap
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
std::string m_inputClusterListNameU
The name of the view U cluster list.
std::string m_outputPfoListName
The output pfo list name.