LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MergeClusterAlg.h
Go to the documentation of this file.
1 // Merge Cluster algorithm
3 //
4 // Runs on the output of previous clustering algorithms to merge
5 // clusters together which lie on a straight line and are within
6 // some separation threshold.
7 // Runs recursively over all clusters, including new ones formed
8 // in the algorithm.
9 //
10 // M Wallbank (m.wallbank@sheffield.ac.uk), July 2015
12 
13 #ifndef MergeCluster_h
14 #define MergeCluster_h
15 
16 // Framework includes
18 #include "art_root_io/TFileService.h"
21 #include "fhiclcpp/fwd.h"
22 
23 // LArSoft includes
26 namespace geo {
27  struct WireID;
28 }
29 
30 #include "TVector2.h"
31 class TTree;
32 
33 #include <map>
34 #include <vector>
35 
36 namespace cluster {
37  class MergeClusterAlg;
38 }
39 
41 public:
43 
44  void FindClusterEndPoints(art::PtrVector<recob::Hit> const& cluster,
45  TVector2 const& centre,
46  TVector2 const& direction,
47  TVector2& start,
48  TVector2& end) const;
49  double FindClusterOverlap(TVector2 const& direction,
50  TVector2 const& centre,
51  TVector2 const& start1,
52  TVector2 const& end1,
53  TVector2 const& start2,
54  TVector2 const& end2) const;
55  double FindCrossingDistance(TVector2 const& direction1,
56  TVector2 const& centre1,
57  TVector2 const& direction2,
58  TVector2 const& centre2) const;
59  double FindMinSeparation(art::PtrVector<recob::Hit> const& cluster1,
60  art::PtrVector<recob::Hit> const& cluster2) const;
61  double FindProjectedWidth(TVector2 const& centre1,
62  TVector2 const& start1,
63  TVector2 const& end1,
64  TVector2 const& centre2,
65  TVector2 const& start2,
66  TVector2 const& end2) const;
67  double GlobalWire(geo::WireID const& wireID) const;
68  TVector2 HitCoordinates(art::Ptr<recob::Hit> const& hit) const;
69  int MergeClusters(std::vector<art::PtrVector<recob::Hit>> const& planeClusters,
70  std::vector<art::PtrVector<recob::Hit>>& clusters) const;
71  void reconfigure(fhicl::ParameterSet const& p);
72  bool PassCuts(double angle,
73  double crossingDistance,
74  double projectedWidth,
75  double separation,
76  double longLength) const;
77 
78 private:
79  // Merging parameters
80  unsigned int
81  fMinMergeClusterSize; // Minimum size of a cluster for it to be considered for merging
82  double fMaxMergeSeparation; // Maximum separation of clusters for merging
83  double
84  fProjWidthThreshold; // Maximum projected width (width of a tube parallel to the line connecting centres of clusters which just encompasses the clusters) for merging
85 
86  // Create geometry and detector property handle
89 
90  std::map<int, int> trueClusterMap;
91 
92  // Tree
93  TTree* fTree;
94  double fAngle;
95  double fEigenvalue;
98  double fLength1;
99  double fLength2;
100  double fSeparation;
103  double fOverlap;
105  // bool fMerge;
106 };
107 
108 #endif
art::ServiceHandle< geo::Geometry const > fGeom
Declaration of signal hit object.
art::ServiceHandle< art::TFileService const > tfs
Cluster finding and building.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::map< int, int > trueClusterMap
Detector simulation of raw signals on wires.
unsigned int fMinMergeClusterSize
Namespace collecting geometry-related classes utilities.
art framework interface to geometry description