12 : fDenseStart(false), fDenseEnd(false), fIsEM(false)
14 fHits.reserve(hits.size());
15 for (
size_t h = 0; h < hits.size(); ++h)
16 fHits.push_back(hits[h]);
23 if (idx <
fHits.size()) {
33 for (
size_t h = 0; h <
fHits.size(); ++h)
34 if (
fHits[h] == hit) {
44 if (!
fHits.size())
return 0;
48 for (
size_t h = 1; h <
fHits.size(); ++h) {
63 if (!
fHits.size())
return 0;
65 TVector2
mean(0., 0.);
66 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) {
88 TVector2 minimum =
fHits[0]->Point2D();
90 for (
size_t i = 1; i <
size(); ++i) {
91 const TVector2 h =
fHits[i]->Point2D();
93 if (h.X() < minimum.X()) minimum.Set(h.X(), h.Y());
94 if (h.Y() < minimum.Y()) minimum.Set(minimum.X(), h.Y());
105 TVector2 maximum =
fHits[0]->Point2D();
107 for (
size_t i = 1; i <
size(); ++i) {
108 const TVector2 h =
fHits[i]->Point2D();
110 if (h.X() > maximum.X()) maximum.Set(h.X(), h.Y());
111 if (h.Y() > maximum.Y()) maximum.Set(maximum.X(), h.Y());
121 for (
size_t i = 0; i <
fHits.size(); ++i)
122 if (
fHits[i] == hit)
return true;
131 for (
size_t i = 1; i <
fHits.size(); ++i) {
133 if (d2 < min_d2) { min_d2 = d2; }
147 for (
size_t i = 1; i <
fHits.size(); ++i) {
164 double d2, min_d2 = clu.
dist2(
fHits.front()->Point2D());
165 for (
size_t i = 1; i <
fHits.size(); ++i) {
167 if (d2 < min_d2) { min_d2 = d2; }
184 bool touches =
false;
198 for (
size_t i = 0; i < c1.
size(); i++) {
199 if (hitsTouching(c1[i], h2))
return true;
207 for (
unsigned int i = 0; i < c1.
size(); i++) {
208 if (hitsTouching(c2, c1[i]))
return true;
221 while (i < clusters.size() - 1) {
223 while (j < clusters.size()) {
224 if (hitsTouching(clusters[i], clusters[j])) {
225 clusters[i].hits().reserve(clusters[i].
size() + clusters[i].
size());
226 for (
size_t h = 0; h < clusters[j].size(); ++h)
227 clusters[i].
hits().push_back(clusters[j].
hits()[h]);
228 clusters.erase(clusters.begin() + j);
242 std::vector<tss::Cluster2D> result;
243 for (
size_t h = 0; h < inp.size(); ++h) {
245 for (
size_t r = 0;
r < result.size(); ++
r)
246 if (hitsTouching(result[
r], inp[h])) {
247 result[
r].hits().push_back(&(inp[h]));
253 result.back().hits().push_back(&(inp[h]));
264 std::vector<tss::Cluster2D> result;
265 for (
size_t h = 0; h < inp.
size(); ++h) {
267 for (
size_t r = 0;
r < result.size(); ++
r)
268 if (hitsTouching(result[
r], inp[h])) {
269 result[
r].hits().push_back(inp.
hits()[h]);
275 result.back().hits().push_back(inp.
hits()[h]);
TVector2 const & Point2D() 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() const
const std::vector< const tss::Hit2D * > & hits(void) const
const Hit2D * outermost(size_t &idx) const
double dist2(const TVector2 &p2d) const
const Hit2D * closest(const TVector2 &p2d, size_t &idx) const
std::vector< const tss::Hit2D * > fHits
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