DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
triggeralgs::dbscan Namespace Reference

Classes

struct  Cluster
 
struct  Hit
 
class  HitSet
 
class  IncrementalDBSCAN
 

Enumerations

enum class  Connectedness { kUndefined , kNoise , kCore , kEdge }
 
enum class  Completeness { kIncomplete , kComplete }
 

Functions

int neighbours_sorted (const std::vector< Hit * > &hits, Hit &q, float eps, int minPts)
 
float manhattan_distance (const Hit &p, const Hit &q)
 
template<class T >
sqr (T x)
 
float euclidean_distance (const Hit &p, const Hit &q)
 
float euclidean_distance_sqr (const Hit &p, const Hit &q)
 
bool time_comp_lower (const Hit *hit, const float t)
 

Variables

const int kNoise = -2
 
const int kUndefined = -1
 

Enumeration Type Documentation

◆ Completeness

Enumerator
kIncomplete 
kComplete 

Definition at line 37 of file Hit.hpp.

38{
39 kIncomplete,
41};

◆ Connectedness

Enumerator
kUndefined 
kNoise 
kCore 
kEdge 

Definition at line 20 of file Hit.hpp.

21{
22 // clang-format off
24 kNoise, // Fewer than minPts neighbours, not in a cluster
25 kCore, // minPts neighbours or more
26 kEdge // Fewer than minPts neighbours, part of a cluster
27 // clang-format on
28};
const int kUndefined
Definition Hit.hpp:15
const int kNoise
Definition Hit.hpp:14

Function Documentation

◆ euclidean_distance()

float triggeralgs::dbscan::euclidean_distance ( const Hit & p,
const Hit & q )
inline

Definition at line 106 of file Hit.hpp.

107{
108 return std::sqrt(sqr(p.time - q.time) + sqr(p.chan - q.chan));
109}

◆ euclidean_distance_sqr()

float triggeralgs::dbscan::euclidean_distance_sqr ( const Hit & p,
const Hit & q )
inline

Definition at line 113 of file Hit.hpp.

114{
115 return sqr(p.time - q.time) + sqr(p.chan - q.chan);
116}

◆ manhattan_distance()

float triggeralgs::dbscan::manhattan_distance ( const Hit & p,
const Hit & q )
inline

Definition at line 91 of file Hit.hpp.

92{
93 return fabs((p.time - q.time)) + fabs(p.chan - q.chan);
94}

◆ neighbours_sorted()

int triggeralgs::dbscan::neighbours_sorted ( const std::vector< Hit * > & hits,
Hit & q,
float eps,
int minPts )

Definition at line 12 of file dbscan.cpp.

13{
14 int n = 0;
15 // Loop over the hits starting from the latest hit, since we will
16 // ~always be adding a hit at recent times
17 for (auto hit_it = hits.rbegin(); hit_it != hits.rend(); ++hit_it) {
18 if ((*hit_it)->time > q.time + eps)
19 continue;
20 if ((*hit_it)->time < q.time - eps)
21 break;
22
23 if (q.add_potential_neighbour(*hit_it, eps, minPts))
24 ++n;
25 }
26 return n;
27}
bool add_potential_neighbour(Hit *other, float eps, int minPts)
Definition Hit.cpp:60

◆ sqr()

template<class T >
T triggeralgs::dbscan::sqr ( T x)
inline

Definition at line 99 of file Hit.hpp.

100{
101 return x * x;
102}

◆ time_comp_lower()

bool triggeralgs::dbscan::time_comp_lower ( const Hit * hit,
const float t )
inline

Definition at line 120 of file Hit.hpp.

121{
122 return hit->time < t;
123}

Variable Documentation

◆ kNoise

const int triggeralgs::dbscan::kNoise = -2

Definition at line 14 of file Hit.hpp.

◆ kUndefined

const int triggeralgs::dbscan::kUndefined = -1

Definition at line 15 of file Hit.hpp.