10 #ifndef SimpleClustering_h 11 #define SimpleClustering_h 18 struct bDistToPointLess;
21 class SimpleClustering;
25 public std::binary_function<const tss::Hit2D*, const tss::Hit2D*, bool>
42 Cluster2D(
void) : fTag(false), fDenseStart(false), fDenseEnd(false), fIsEM(false) { }
45 size_t size(
void)
const {
return fHits.size(); }
47 const Hit2D & operator [] (
size_t index)
const {
return *(fHits[index]); }
49 const std::vector< const tss::Hit2D* > &
hits(
void)
const {
return fHits; }
50 std::vector< const tss::Hit2D* > &
hits(
void) {
return fHits; }
56 if (size() > 1)
return pma::Dist2(fHits.front()->Point2D(), fHits.back()->Point2D());
60 double dist2(
const TVector2 & p2d)
const;
61 double dist2(
const TVector2 & p2d,
size_t & hIdx)
const;
64 const Hit2D* release_at(
size_t idx);
71 if (hit) push_back(hit);
75 for (
const auto h : clu.
hits()) fHits.push_back(h);
81 if (fHits.size())
return fHits.front();
86 if (fHits.size())
return fHits.back();
92 std::sort(fHits.begin() + 1, fHits.end(),
104 bool isEM(
void)
const {
return fIsEM; }
107 const Hit2D* closest(
const TVector2 & p2d,
size_t & idx)
const;
108 const Hit2D* outermost(
size_t & idx)
const;
110 const TVector2
min(
void)
const;
111 const TVector2
max(
void)
const;
115 std::vector< const tss::Hit2D* >
fHits;
117 bool fTag, fDenseStart, fDenseEnd, fIsEM;
125 std::vector< tss::Cluster2D > run(
const std::vector< tss::Hit2D > & inp)
const;
126 std::vector< tss::Cluster2D > run(
const tss::Cluster2D & inp)
const;
134 void merge(std::vector< tss::Cluster2D > & clusters)
const;
bDistToPointLess(const TVector2 &point)
TVector2 const & Point2D(void) const
double Dist2(const TVector2 &v1, const TVector2 &v2)
const tss::Hit2D * start(void) const
void push_back(const tss::Hit2D *hit)
bool isDenseEnd(void) const
std::vector< const tss::Hit2D * > fHits
bool operator()(const tss::Hit2D *h1, const tss::Hit2D *h2)
void tagDenseStart(bool b)
const std::vector< const tss::Hit2D * > & hits(void) const
std::vector< const tss::Hit2D * > & hits(void)
bool isDenseStart(void) const
void take_from(tss::Cluster2D &clu, size_t idx)
const tss::Hit2D * end(void) const
const Hit2D * release_at(size_t idx)
Hit pos in cm and original recob hit ptr.
Detector simulation of raw signals on wires.
bool isTagged(void) const
Implementation of the Projection Matching Algorithm.
void merge(tss::Cluster2D &clu)
double length2(void) const