KNNClusterAlg.h
Go to the documentation of this file.
1 //
2 // KNNClusterAlg.h
3 //
4 // Created by Eldwan Brianne on 17.04.2019
5 // Based on MarlinReco simple clusetring algo
6 // https://github.com/iLCSoft/MarlinReco/blob/master/Clustering/NNClustering/include/NNClusterProcessor.h
7 //
8 // Modificaiton: Addition of usesTracks, Leo Bellantoni 21 Jun2019
9 // If we have more clustering algorithms someday, this should be derived from
10 // some class with a bunch of virtual methods or some sort of thing like that.
11 
12 
13 #ifndef GAR_RECOALG_KNNClusterAlg_h
14 #define GAR_RECOALG_KNNClusterAlg_h
15 
17 #include "Geometry/GeometryCore.h"
18 
22 
23 #include <list>
24 #include <map>
25 #include <unordered_map>
26 #include <unordered_set>
27 
28 namespace fhicl{
29  class ParameterSet;
30 }
31 
32 namespace gar{
33  namespace rec{
34  namespace alg{
35 
36  typedef std::vector<gar::rec::CaloHit*> CaloHitVec;
37  typedef std::vector<gar::rec::Track*> TrackVec;
38  typedef std::vector<gar::rec::Cluster*> ClusterVec;
39 
40  class KNNClusterAlg {
41  public:
42 
44 
45  virtual ~KNNClusterAlg();
46 
47  void reconfigure(fhicl::ParameterSet const& pset);
48 
49  bool usesTracks() {return false;}
50 
51  void PrepareAlgo(const std::vector< art::Ptr<gar::rec::Track> > &trkVector, const std::vector< art::Ptr<gar::rec::CaloHit> > &hitVector, std::unordered_map< const gar::rec::Track*, art::Ptr<gar::rec::Track> > &trkMaptoArtPtr, std::unordered_map< const gar::rec::CaloHit*, art::Ptr<gar::rec::CaloHit> > &hitMaptoArtPtr);
52 
53  void DoClustering();
54 
55  ClusterVec GetFoundClusters() const { return clusterVector; }
56 
57  private:
58 
59  void ClearLists();
60 
61  gar::geo::GeometryCore const* fGeo; ///< geometry information
62 
64  float m_EnergyCut;
66 
67  CaloHitVec m_CaloHitVec;
68  TrackVec m_TrackVec;
69  ClusterVec clusterVector;
70  };
71 
72  } // namespace alg
73  } // namespace rec
74 } //namespace gar
75 
76 #endif /* GAR_RECOALG_KNNClusterAlg_h */
rec
Definition: tracks.py:88
std::string string
Definition: nybbler.cc:12
std::vector< gar::rec::CaloHit * > CaloHitVec
Definition: KNNClusterAlg.h:36
struct vector vector
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
std::vector< gar::rec::Track * > TrackVec
Definition: KNNClusterAlg.h:37
gar::geo::GeometryCore const * fGeo
geometry information
Definition: KNNClusterAlg.h:61
virtual void reconfigure(fhicl::ParameterSet const &pset)
ClusterVec GetFoundClusters() const
Definition: KNNClusterAlg.h:55
General GArSoft Utilities.
std::vector< gar::rec::Cluster * > ClusterVec
Definition: KNNClusterAlg.h:38