LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Cluster.h
Go to the documentation of this file.
1 
15 #ifndef CLUSTER_H
16 #define CLUSTER_H
17 
18 // C/C++ standard library
19 #include <iosfwd> // std::ostream
20 
21 // LArSoft libraries
22 #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" // geo::PlaneID, geo::View_t
23 
24 namespace recob {
25 
69  class Cluster {
70 
71  public:
72  typedef int ID_t;
73 
74  typedef enum {
79  } ClusterEnds_t;
80 
81  typedef enum {
86  } ChargeMode_t;
87 
89  Cluster();
90 
91  private:
92  unsigned int fNHits;
93 
98  float fEndWires[NEnds];
99 
103 
106  float fEndTicks[NEnds];
107 
111 
116 
125  float fAngles[NEnds];
126 
134 
140 
144 
149 
152 
154  float fWidth;
155 
159  ID_t fID;
160 
162 
164 
165  public:
167  typedef struct {
169 
171  static constexpr ID_t InvalidID = -1;
172 
174  static const SentryArgument_t Sentry;
175 
213  Cluster(float start_wire,
214  float sigma_start_wire,
215  float start_tick,
216  float sigma_start_tick,
217  float start_charge,
218  float start_angle,
219  float start_opening,
220  float end_wire,
221  float sigma_end_wire,
222  float end_tick,
223  float sigma_end_tick,
224  float end_charge,
225  float end_angle,
226  float end_opening,
227  float integral,
228  float integral_stddev,
229  float summedADC,
230  float summedADC_stddev,
231  unsigned int n_hits,
232  float multiple_hit_density,
233  float width,
234  ID_t ID,
235  geo::View_t view,
236  geo::PlaneID const& plane,
237  SentryArgument_t sentry = Sentry);
238 
240  Cluster(Cluster const&) = default;
241 
243  Cluster(Cluster&& from) : Cluster(from) { from.fID = InvalidID; }
244 
246  Cluster& operator=(Cluster const&) = default;
247 
250  {
251  if (&from != this) {
252  operator=(from);
253  from.fID = InvalidID;
254  }
255  return *this;
256  }
257 
259  ~Cluster() = default;
260 
263 
265  unsigned int NHits() const { return fNHits; }
266 
276  float StartWire() const { return fEndWires[clStart]; }
277 
287  float StartTick() const { return fEndTicks[clStart]; }
288 
296  float SigmaStartWire() const { return fSigmaEndWires[clStart]; }
297 
305  float SigmaStartTick() const { return fSigmaEndTicks[clStart]; }
306 
318  float EndWire() const { return fEndWires[clEnd]; }
319 
331  float EndTick() const { return fEndTicks[clEnd]; }
332 
340  float SigmaEndWire() const { return fSigmaEndWires[clEnd]; }
341 
349  float SigmaEndTick() const { return fSigmaEndTicks[clEnd]; }
350 
352 
374  float WireCoord(ClusterEnds_t side) const { return fEndWires[side]; }
375  float WireCoord(unsigned int side) const { return fEndWires[side]; }
377 
379 
401  float TickCoord(ClusterEnds_t side) const { return fEndTicks[side]; }
402  float TickCoord(unsigned int side) const { return fEndTicks[side]; }
404 
406 
414  float SigmaWireCoord(ClusterEnds_t side) const { return fSigmaEndWires[side]; }
415  float SigmaWireCoord(unsigned int side) const { return fSigmaEndWires[side]; }
417 
419 
427  float SigmaTickCoord(ClusterEnds_t side) const { return fSigmaEndTicks[side]; }
428  float SigmaTickCoord(unsigned int side) const { return fSigmaEndTicks[side]; }
430 
440  float StartCharge() const { return fEndCharges[clStart]; }
441 
461  float StartAngle() const { return fAngles[clStart]; }
462 
471  float StartOpeningAngle() const { return fOpeningAngles[clStart]; }
472 
483  float EndCharge() const { return fEndCharges[clEnd]; }
484 
504  float EndAngle() const { return fAngles[clEnd]; }
505 
514  float EndOpeningAngle() const { return fOpeningAngles[clEnd]; }
515 
517 
528  float EdgeCharge(ClusterEnds_t side) const { return fEndCharges[side]; }
529  float EdgeCharge(unsigned int side) const { return fEndCharges[side]; }
531 
533 
553  float Angle(ClusterEnds_t side) const { return fAngles[side]; }
554  float Angle(unsigned int side) const { return fAngles[side]; }
556 
558 
568  float OpeningAngle(ClusterEnds_t side) const { return fOpeningAngles[side]; }
569  float OpeningAngle(unsigned int side) const { return fOpeningAngles[side]; }
571 
581  float Integral() const { return fChargeSum[cmFit]; }
582 
592  float IntegralStdDev() const { return fChargeStdDev[cmFit]; }
593 
603  float IntegralAverage() const { return fChargeAverage[cmFit]; }
604 
614  float SummedADC() const { return fChargeSum[cmADC]; }
615 
625  float SummedADCstdDev() const { return fChargeStdDev[cmADC]; }
626 
636  float SummedADCaverage() const { return fChargeAverage[cmADC]; }
637 
639 
655  float Charge(ChargeMode_t mode) const { return fChargeSum[mode]; }
656  float Charge(unsigned int mode) const { return fChargeSum[mode]; }
658 
660 
670  float ChargeStdDev(ChargeMode_t mode) const { return fChargeStdDev[mode]; }
671  float ChargeStdDev(unsigned int mode) const { return fChargeStdDev[mode]; }
673 
675 
685  float ChargeAverage(ChargeMode_t mode) const { return fChargeAverage[mode]; }
686  float ChargeAverage(unsigned int mode) const { return fChargeAverage[mode]; }
688 
698  float MultipleHitDensity() const { return fMultipleHitDensity; }
699 
701  float Width() const { return fWidth; }
702 
711  ID_t ID() const { return fID; }
712 
714  geo::View_t View() const { return fView; }
715 
717  geo::PlaneID Plane() const { return fPlaneID; }
718 
720 
722  bool hasPlane() const { return fPlaneID.isValid; }
723 
725  bool isValid() const { return ID() != InvalidID; }
726 
727  friend std::ostream& operator<<(std::ostream& o, Cluster const& c);
728  friend bool operator<(Cluster const& a, Cluster const& b);
729 
730  }; // class Cluster
731 
732 } // namespace recob
733 
734 #endif //CLUSTER_H
Sums from the fitted hit values.
Definition: Cluster.h:82
float SigmaEndTick() const
Returns the uncertainty on tick coordinate of the end of the cluster.
Definition: Cluster.h:349
float fWidth
A measure of the cluster width, in homogenized units.
Definition: Cluster.h:154
static constexpr ID_t InvalidID
Value for an invalid cluster ID.
Definition: Cluster.h:171
float ChargeStdDev(unsigned int mode) const
Returns the standard deviation of charge of the cluster hits.
Definition: Cluster.h:671
float fMultipleHitDensity
Density of wires in the cluster with more than one hit.
Definition: Cluster.h:151
Just an alias for loops.
Definition: Cluster.h:85
float SummedADCaverage() const
Returns the average signal ADC counts of the cluster hits.
Definition: Cluster.h:636
float IntegralAverage() const
Returns the average charge of the cluster hits.
Definition: Cluster.h:603
float SigmaWireCoord(ClusterEnds_t side) const
Returns the uncertainty on wire coordinate of one of the end sides of the cluster.
Definition: Cluster.h:414
Reconstruction base classes.
float Angle(ClusterEnds_t side) const
Returns the angle at either end of the cluster.
Definition: Cluster.h:553
float fEndTicks[NEnds]
Definition: Cluster.h:106
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
float TickCoord(ClusterEnds_t side) const
Returns the tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:401
float fEndCharges[NEnds]
Definition: Cluster.h:115
float fEndWires[NEnds]
Definition: Cluster.h:98
friend std::ostream & operator<<(std::ostream &o, Cluster const &c)
Definition: Cluster.cxx:168
float WireCoord(unsigned int side) const
Number of hits in the cluster.
Definition: Cluster.h:375
float fSigmaEndTicks[NEnds]
Definition: Cluster.h:110
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:210
float EdgeCharge(ClusterEnds_t side) const
Returns the charge on the first or last wire of the cluster.
Definition: Cluster.h:528
float SigmaTickCoord(ClusterEnds_t side) const
Returns the uncertainty on tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:427
float StartWire() const
Returns the wire coordinate of the start of the cluster.
Definition: Cluster.h:276
float fSigmaEndWires[NEnds]
Definition: Cluster.h:102
End count.
Definition: Cluster.h:77
Set of hits with a 2D structure.
Definition: Cluster.h:69
float EndTick() const
Returns the tick coordinate of the end of the cluster.
Definition: Cluster.h:331
float SigmaWireCoord(unsigned int side) const
Returns the uncertainty on wire coordinate of one of the end sides of the cluster.
Definition: Cluster.h:415
float MultipleHitDensity() const
Density of wires in the cluster with more than one hit.
Definition: Cluster.h:698
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
Definition: Cluster.h:717
geo::PlaneID fPlaneID
Location of the start of the cluster.
Definition: Cluster.h:163
Type of sentry argument.
Definition: Cluster.h:167
bool isValid() const
Returns if the cluster is valid (that is, if its ID is not invalid)
Definition: Cluster.h:725
float StartAngle() const
Returns the starting angle of the cluster.
Definition: Cluster.h:461
Sums directly from ADC counts.
Definition: Cluster.h:83
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:174
~Cluster()=default
Destructor: automatically generated.
float SummedADCstdDev() const
Returns the standard deviation of the signal ADC counts of the cluster hits.
Definition: Cluster.h:625
float fChargeSum[NChargeModes]
Definition: Cluster.h:139
float fChargeAverage[NChargeModes]
Definition: Cluster.h:147
float EndCharge() const
Returns the charge on the last wire of the cluster.
Definition: Cluster.h:483
float SummedADC() const
Returns the total charge of the cluster from signal ADC counts.
Definition: Cluster.h:614
Cluster & operator=(Cluster const &)=default
Copy assignment: automatically generated.
float ChargeStdDev(ChargeMode_t mode) const
Returns the standard deviation of charge of the cluster hits.
Definition: Cluster.h:670
float StartOpeningAngle() const
Returns the opening angle at the start of the cluster.
Definition: Cluster.h:471
Represents the most likely start of the cluster.
Definition: Cluster.h:75
Cluster(Cluster &&from)
Move constructor: as copy, but source cluster gets an invalid ID.
Definition: Cluster.h:243
float Width() const
A measure of the cluster width, in homogenized units.
Definition: Cluster.h:701
float SigmaEndWire() const
Returns the uncertainty on wire coordinate of the end of the cluster.
Definition: Cluster.h:340
float Charge(unsigned int mode) const
Returns the total charge of the cluster.
Definition: Cluster.h:656
Cluster & operator=(Cluster &&from)
Move assignment: as copy, but source cluster gets an invalid ID.
Definition: Cluster.h:249
float IntegralStdDev() const
Returns the standard deviation of the charge of the cluster hits.
Definition: Cluster.h:592
float SigmaStartWire() const
Returns the uncertainty on wire coordinate of the start of the cluster.
Definition: Cluster.h:296
float ChargeAverage(unsigned int mode) const
Returns the average charge of the cluster hits.
Definition: Cluster.h:686
float WireCoord(ClusterEnds_t side) const
Returns the wire coordinate of one of the end sides of the cluster.
Definition: Cluster.h:374
float fAngles[NEnds]
Definition: Cluster.h:125
Definition of data types for geometry description.
friend bool operator<(Cluster const &a, Cluster const &b)
Definition: Cluster.cxx:188
float EndOpeningAngle() const
Returns the opening angle at the end of the cluster.
Definition: Cluster.h:514
float ChargeAverage(ChargeMode_t mode) const
Returns the average charge of the cluster hits.
Definition: Cluster.h:685
geo::View_t View() const
Returns the view for this cluster.
Definition: Cluster.h:714
float TickCoord(unsigned int side) const
Returns the tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:402
float StartCharge() const
Returns the charge on the first wire of the cluster.
Definition: Cluster.h:440
ID_t ID() const
Identifier of this cluster.
Definition: Cluster.h:711
unsigned int fNHits
Number of hits in the cluster.
Definition: Cluster.h:92
float EdgeCharge(unsigned int side) const
Returns the charge on the first or last wire of the cluster.
Definition: Cluster.h:529
float fOpeningAngles[NEnds]
Definition: Cluster.h:132
float SigmaStartTick() const
Returns the uncertainty on tick coordinate of the start of the cluster.
Definition: Cluster.h:305
Just an alias for loops.
Definition: Cluster.h:78
bool hasPlane() const
Returns whether geometry plane is valid.
Definition: Cluster.h:722
Cluster()
Default constructor: an empty cluster.
Definition: Cluster.cxx:34
float Charge(ChargeMode_t mode) const
Returns the total charge of the cluster.
Definition: Cluster.h:655
unsigned int NHits() const
Number of hits in the cluster.
Definition: Cluster.h:265
float EndAngle() const
Returns the ending angle of the cluster.
Definition: Cluster.h:504
float OpeningAngle(ClusterEnds_t side) const
Returns the opening angle at either end of the cluster.
Definition: Cluster.h:568
float StartTick() const
Returns the tick coordinate of the start of the cluster.
Definition: Cluster.h:287
float Angle(unsigned int side) const
Returns the angle at either end of the cluster.
Definition: Cluster.h:554
float OpeningAngle(unsigned int side) const
Returns the opening angle at either end of the cluster.
Definition: Cluster.h:569
float fChargeStdDev[NChargeModes]
Definition: Cluster.h:143
geo::View_t fView
View for this cluster.
Definition: Cluster.h:161
float SigmaTickCoord(unsigned int side) const
Returns the uncertainty on tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:428
int ID_t
Type of cluster ID.
Definition: Cluster.h:72
Represents the end, or the alternative start, of the cluster.
Definition: Cluster.h:76
float Integral() const
Returns the total charge of the cluster from hit shape.
Definition: Cluster.h:581
float EndWire() const
Returns the wire coordinate of the end of the cluster.
Definition: Cluster.h:318