25 inline T
sqr(T v) {
return v*v; }
38 , fSigmaEndWires{ 0., 0. }
40 , fSigmaEndTicks{ 0., 0. }
41 , fEndCharges{ 0., 0. }
43 , fOpeningAngles{ 0., 0. }
44 , fChargeSum{ 0., 0. }
45 , fChargeStdDev{ 0., 0. }
46 , fChargeAverage{ 0., 0. }
47 , fMultipleHitDensity(0.)
58 float sigma_start_wire,
60 float sigma_start_tick,
72 float integral_stddev,
74 float summedADC_stddev,
76 float multiple_hit_density,
84 , fEndWires{ start_wire, end_wire }
85 , fSigmaEndWires{ sigma_start_wire, sigma_end_wire }
86 , fEndTicks{ start_tick, end_tick }
87 , fSigmaEndTicks{ sigma_start_tick, sigma_end_tick }
88 , fEndCharges{ start_charge, end_charge }
89 , fAngles{ start_angle, end_angle }
90 , fOpeningAngles{ start_opening, end_opening }
91 , fChargeSum{ integral, summedADC }
92 , fChargeStdDev{ integral_stddev, summedADC_stddev }
94 , fMultipleHitDensity(multiple_hit_density)
101 for (
unsigned int mode = cmFirstMode;
mode < NChargeModes; ++
mode)
102 fChargeAverage[
mode] = (fNHits > 0)? fChargeSum[
mode] / fNHits: 0.;
119 if (other.View() !=
View())
return {};
121 if (other.hasPlane() &&
hasPlane() && (other.Plane() !=
Plane()))
return {};
123 const unsigned int n_hits =
NHits() + other.NHits();
124 double charge_stddev[2];
129 const double other_variance
130 =
sqr(other.ChargeStdDev(
mode)) * (other.NHits()-1.) / other.NHits();
135 +
NHits() * this_variance
136 + other.NHits() * other_variance
139 charge_stddev[
mode] = std::sqrt(e2);
143 std::min(
StartWire(), other.StartWire()),
144 std::min(
StartTick(), other.StartTick()),
148 std::max(
EndWire(), other.EndWire()),
149 std::max(
EndTick(), other.EndTick()),
154 charge_stddev[
cmFit],
156 charge_stddev[
cmADC],
174 o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
175 o <<
"Cluster ID " << std::setw(5) <<
std::right << c.
ID()
202 if (a.
ID() != b. ID())
203 return a.
ID() < b.
ID();
Sums from the fitted hit values.
static constexpr ID_t InvalidID
Value for an invalid cluster ID.
bool operator<(Cluster const &a, Cluster const &b)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
float StartWire() const
Returns the wire coordinate of the start of the cluster.
CryostatID_t Cryostat
Index of cryostat.
Set of hits with a 2D structure.
float EndTick() const
Returns the tick coordinate of the end of the cluster.
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
Sums directly from ADC counts.
static const SentryArgument_t Sentry
An instance of the sentry object.
float SummedADC() const
Returns the total charge of the cluster from signal ADC counts.
float ChargeStdDev(ChargeMode_t mode) const
Returns the standard deviation of charge of the cluster hits.
float Width() const
A measure of the cluster width, in homogenized units.
PlaneID_t Plane
Index of the plane within its TPC.
Declaration of cluster object.
float ChargeAverage(ChargeMode_t mode) const
Returns the average charge of the cluster hits.
geo::View_t View() const
Returns the view for this cluster.
QuadExpr operator+(double v, const QuadExpr &e)
ID_t ID() const
Identifier of this cluster.
bool hasPlane() const
Returns whether geometry plane is valid.
Cluster()
Default constructor: an empty cluster.
unsigned int NHits() const
Number of hits in the cluster.
TPCID_t TPC
Index of the TPC within its cryostat.
float StartTick() const
Returns the tick coordinate of the start of the cluster.
int ID_t
Type of cluster ID.
std::ostream & operator<<(std::ostream &o, Cluster const &c)
float Integral() const
Returns the total charge of the cluster from hit shape.
float EndWire() const
Returns the wire coordinate of the end of the cluster.