LArSoft  v10_04_05
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
27 
28 #include "TVector2.h"
29 class TTree;
30 
31 #include <map>
32 #include <vector>
33 
34 namespace cluster {
35  class MergeClusterAlg;
36 }
37 
39 public:
41 
43  TVector2 const& centre,
44  TVector2 const& direction,
45  TVector2& start,
46  TVector2& end) const;
47  double FindClusterOverlap(TVector2 const& direction,
48  TVector2 const& centre,
49  TVector2 const& start1,
50  TVector2 const& end1,
51  TVector2 const& start2,
52  TVector2 const& end2) const;
53  double FindCrossingDistance(TVector2 const& direction1,
54  TVector2 const& centre1,
55  TVector2 const& direction2,
56  TVector2 const& centre2) const;
57  double FindMinSeparation(art::PtrVector<recob::Hit> const& cluster1,
58  art::PtrVector<recob::Hit> const& cluster2) const;
59  double FindProjectedWidth(TVector2 const& centre1,
60  TVector2 const& start1,
61  TVector2 const& end1,
62  TVector2 const& centre2,
63  TVector2 const& start2,
64  TVector2 const& end2) const;
65  double GlobalWire(geo::WireID const& wireID) const;
66  TVector2 HitCoordinates(art::Ptr<recob::Hit> const& hit) const;
67  int MergeClusters(std::vector<art::PtrVector<recob::Hit>> const& planeClusters,
68  std::vector<art::PtrVector<recob::Hit>>& clusters) const;
69  bool PassCuts(double angle,
70  double crossingDistance,
71  double projectedWidth,
72  double separation,
73  double longLength) const;
74 
75 private:
76  // Merging parameters
77  unsigned int
78  fMinMergeClusterSize; // Minimum size of a cluster for it to be considered for merging
79  double fMaxMergeSeparation; // Maximum separation of clusters for merging
80  double
81  fProjWidthThreshold; // Maximum projected width (width of a tube parallel to the line connecting centres of clusters which just encompasses the clusters) for merging
82 
83  // Create geometry and detector property handle
86 
87  std::map<int, int> trueClusterMap;
88 
89  // Tree
90  TTree* fTree;
91  double fAngle;
92  double fEigenvalue;
95  double fLength1;
96  double fLength2;
97  double fSeparation;
100  double fOverlap;
102 };
103 
104 #endif
MergeClusterAlg(fhicl::ParameterSet const &pset)
int MergeClusters(std::vector< art::PtrVector< recob::Hit >> const &planeClusters, std::vector< art::PtrVector< recob::Hit >> &clusters) const
Declaration of signal hit object.
void FindClusterEndPoints(art::PtrVector< recob::Hit > const &cluster, TVector2 const &centre, TVector2 const &direction, TVector2 &start, TVector2 &end) const
art::ServiceHandle< art::TFileService const > tfs
Cluster finding and building.
geo::WireReadoutGeom const * fWireReadoutGeom
double FindClusterOverlap(TVector2 const &direction, TVector2 const &centre, TVector2 const &start1, TVector2 const &end1, TVector2 const &start2, TVector2 const &end2) const
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
Interface for a class providing readout channel mapping to geometry.
std::map< int, int > trueClusterMap
Detector simulation of raw signals on wires.
TVector2 HitCoordinates(art::Ptr< recob::Hit > const &hit) const
double FindMinSeparation(art::PtrVector< recob::Hit > const &cluster1, art::PtrVector< recob::Hit > const &cluster2) const
double FindCrossingDistance(TVector2 const &direction1, TVector2 const &centre1, TVector2 const &direction2, TVector2 const &centre2) const
double GlobalWire(geo::WireID const &wireID) const
bool PassCuts(double angle, double crossingDistance, double projectedWidth, double separation, double longLength) const
double FindProjectedWidth(TVector2 const &centre1, TVector2 const &start1, TVector2 const &end1, TVector2 const &centre2, TVector2 const &start2, TVector2 const &end2) const
unsigned int fMinMergeClusterSize
art framework interface to geometry description