All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MergeClusterAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////
2 // 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
11 ////////////////////////////////////////////////////////////////////
12 
13 #ifndef MergeCluster_h
14 #define MergeCluster_h
15 
16 // Framework includes
17 #include "art/Framework/Services/Registry/ServiceHandle.h"
18 #include "art_root_io/TFileService.h"
19 #include "canvas/Persistency/Common/Ptr.h"
20 #include "canvas/Persistency/Common/PtrVector.h"
21 namespace fhicl { class ParameterSet; }
22 
23 // LArSoft includes
26 namespace geo { struct WireID; }
27 
28 
29 #include "TVector2.h"
30 class TTree;
31 
32 #include <vector>
33 #include <map>
34 
35 namespace cluster {
36  class MergeClusterAlg;
37 }
38 
40 public:
41 
42  MergeClusterAlg(fhicl::ParameterSet const& pset);
43 
44  void FindClusterEndPoints(art::PtrVector<recob::Hit> const& cluster, TVector2 const& centre, TVector2 const& direction, TVector2& start, TVector2& end) const;
45  double FindClusterOverlap(TVector2 const& direction, TVector2 const& centre, TVector2 const& start1, TVector2 const& end1, TVector2 const& start2, TVector2 const& end2) const;
46  double FindCrossingDistance(TVector2 const &direction1, TVector2 const &centre1, TVector2 const&direction2, TVector2 const &centre2) const;
47  double FindMinSeparation(art::PtrVector<recob::Hit> const &cluster1, art::PtrVector<recob::Hit> const &cluster2) const;
48  double FindProjectedWidth(TVector2 const& centre1, TVector2 const& start1, TVector2 const& end1, TVector2 const& centre2, TVector2 const& start2, TVector2 const& end2) const;
49  double GlobalWire(geo::WireID const& wireID) const;
50  TVector2 HitCoordinates(art::Ptr<recob::Hit> const& hit) const;
51  int MergeClusters(std::vector<art::PtrVector<recob::Hit> > const &planeClusters, std::vector<art::PtrVector<recob::Hit> > &clusters) const;
52  void reconfigure(fhicl::ParameterSet const& p);
53  bool PassCuts(double const& angle, double const& crossingDistance, double const& projectedWidth, double const& separation, double const& overlap, double const& longLength) const;
54 
55 private:
56 
57  // Merging parameters
58  unsigned int fMinMergeClusterSize; // Minimum size of a cluster for it to be considered for merging
59  double fMaxMergeSeparation; // Maximum separation of clusters for merging
60  double fProjWidthThreshold; // Maximum projected width (width of a tube parallel to the line connecting centres of clusters which just encompasses the clusters) for merging
61 
62  // Create geometry and detector property handle
63  art::ServiceHandle<geo::Geometry const> fGeom;
64  art::ServiceHandle<art::TFileService const> tfs;
65 
66  std::map<int,int> trueClusterMap;
67 
68  // Tree
69  TTree *fTree;
70  double fAngle;
71  double fEigenvalue;
74  double fLength1;
75  double fLength2;
76  double fSeparation;
79  double fOverlap;
80  bool fTrueMerge;
81 // bool fMerge;
82 
83 };
84 
85 #endif
MergeClusterAlg(fhicl::ParameterSet const &pset)
std::map< int, int > trueClusterMap
process_name cluster
Definition: cheaterreco.fcl:51
art::ServiceHandle< geo::Geometry const > fGeom
Declaration of signal hit object.
pdgs p
Definition: selectors.fcl:22
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
process_name hit
Definition: cheaterreco.fcl:51
void reconfigure(fhicl::ParameterSet const &p)
double FindClusterOverlap(TVector2 const &direction, TVector2 const &centre, TVector2 const &start1, TVector2 const &end1, TVector2 const &start2, TVector2 const &end2) const
int MergeClusters(std::vector< art::PtrVector< recob::Hit > > const &planeClusters, std::vector< art::PtrVector< recob::Hit > > &clusters) const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
bool PassCuts(double const &angle, double const &crossingDistance, double const &projectedWidth, double const &separation, double const &overlap, double const &longLength) const
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
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
finds tracks best matching by angle
double GlobalWire(geo::WireID const &wireID) 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