14 fDenseStart(false), fDenseEnd(false), fIsEM(false)
16 fHits.reserve(hits.size());
17 for (
size_t h = 0; h < hits.size(); ++h)
fHits.push_back(hits[h]);
24 if (idx <
fHits.size())
35 for (
size_t h = 0; h <
fHits.size(); ++h)
46 if (!
fHits.size())
return 0;
50 for (
size_t h = 1; h <
fHits.size(); ++h)
53 if (d < dmin) { dmin =
d; hout =
fHits[h]; idx = h; }
62 if (!
fHits.size())
return 0;
64 TVector2
mean(0., 0.);
65 for (
size_t h = 0; h <
fHits.size(); ++h)
67 mean +=
fHits[h]->Point2D();
69 mean *= 1.0 /
fHits.size();
73 for (
size_t h = 1; h <
fHits.size(); ++h)
76 if (d > dmax) { dmax =
d; hout =
fHits[h]; idx = h; }
85 TVector2 minimum =
fHits[0]->Point2D();
87 for (
size_t i = 1; i <
size(); ++i)
89 const TVector2 h =
fHits[i]->Point2D();
91 if (h.X() < minimum.X()) minimum.Set(h.X(), h.Y());
92 if (h.Y() < minimum.Y()) minimum.Set(minimum.X(), h.Y());
103 TVector2 maximum =
fHits[0]->Point2D();
105 for (
size_t i = 1; i <
size(); ++i)
107 const TVector2 h =
fHits[i]->Point2D();
109 if (h.X() > maximum.X()) maximum.Set(h.X(), h.Y());
110 if (h.Y() > maximum.Y()) maximum.Set(maximum.X(), h.Y());
120 for (
size_t i = 0; i <
fHits.size(); ++i)
121 if (
fHits[i] == hit)
return true;
131 for (
size_t i = 1; i <
fHits.size(); ++i)
134 if (d2 < min_d2) { min_d2 = d2; }
148 for (
size_t i = 1; i <
fHits.size(); ++i)
151 if (d2 < min_d2) { min_d2 = d2; hIdx = i; }
163 double d2, min_d2 = clu.
dist2(
fHits.front()->Point2D());
164 for (
size_t i = 1; i <
fHits.size(); ++i)
167 if (d2 < min_d2) { min_d2 = d2; }
185 bool touches =
false;
202 for (
size_t i = 0; i < c1.
size(); i++)
204 if (hitsTouching(c1[i], h2))
return true;
212 for (
unsigned int i = 0; i < c1.
size(); i++)
214 if (hitsTouching(c2, c1[i]))
return true;
228 while (i < clusters.size() - 1)
231 while (j < clusters.size())
233 if (hitsTouching(clusters[i], clusters[j]))
235 clusters[i].hits().reserve(clusters[i].
size() + clusters[i].
size());
236 for (
size_t h = 0; h < clusters[j].size(); ++h)
237 clusters[i].
hits().push_back(clusters[j].
hits()[h]);
238 clusters.erase(clusters.begin() + j);
251 std::vector< tss::Cluster2D > result;
252 for (
size_t h = 0; h < inp.size(); ++h)
255 for (
size_t r = 0; r < result.size(); ++r)
256 if (hitsTouching(result[r], inp[h]))
258 result[r].hits().push_back(&(inp[h])); found =
true;
break;
263 result.back().hits().push_back(&(inp[h]));
274 std::vector< tss::Cluster2D > result;
275 for (
size_t h = 0; h < inp.
size(); ++h)
278 for (
size_t r = 0; r < result.size(); ++r)
279 if (hitsTouching(result[r], inp[h]))
281 result[r].hits().push_back(inp.
hits()[h]); found =
true;
break;
286 result.back().hits().push_back(inp.
hits()[h]);
TVector2 const & Point2D(void) const
Trivial, collect hits "touching" each other (next wire or consecutive ticks), plus Cluster2D class to...
double Dist2(const TVector2 &v1, const TVector2 &v2)
unsigned int Wire(void) const
float PeakTime(void) const
std::vector< const tss::Hit2D * > fHits
const Hit2D * outermost(size_t &idx) const
double dist2(const TVector2 &p2d) const
const Hit2D * closest(const TVector2 &p2d, size_t &idx) const
const std::vector< const tss::Hit2D * > & hits(void) const
std::vector< tss::Cluster2D > run(const std::vector< tss::Hit2D > &inp) const
void merge(std::vector< tss::Cluster2D > &clusters) const
const Hit2D * release_at(size_t idx)
Detector simulation of raw signals on wires.
bool hitsTouching(const tss::Hit2D &h1, const tss::Hit2D &h2) const
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
bool release(const tss::Hit2D *hit)
const TVector2 max(void) const
void merge(tss::Cluster2D &clu)
const TVector2 min(void) const
bool has(const tss::Hit2D *hit) const
int StartTick(void) const