LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 
25 namespace recob {
26 
27 
71  class Cluster {
72 
73  public:
74  typedef int ID_t;
75 
76 
77  typedef enum {
82  } ClusterEnds_t;
83 
84  typedef enum {
89  } ChargeMode_t;
90 
91 
93  Cluster();
94 
95  private:
96 
97  unsigned int fNHits;
98 
103  float fEndWires[NEnds];
104 
108 
111  float fEndTicks[NEnds];
112 
116 
121 
130  float fAngles[NEnds];
131 
139 
140 
146 
150 
155 
158 
160  float fWidth;
161 
165  ID_t fID;
166 
167 
169 
171 
172 
173  public:
174 
176  typedef struct {} SentryArgument_t;
177 
179  static constexpr ID_t InvalidID = -1;
180 
182  static const SentryArgument_t Sentry;
183 
184 
222  Cluster(
223  float start_wire,
224  float sigma_start_wire,
225  float start_tick,
226  float sigma_start_tick,
227  float start_charge,
228  float start_angle,
229  float start_opening,
230  float end_wire,
231  float sigma_end_wire,
232  float end_tick,
233  float sigma_end_tick,
234  float end_charge,
235  float end_angle,
236  float end_opening,
237  float integral,
238  float integral_stddev,
239  float summedADC,
240  float summedADC_stddev,
241  unsigned int n_hits,
242  float multiple_hit_density,
243  float width,
244  ID_t ID,
245  geo::View_t view,
246  geo::PlaneID const& plane,
247  SentryArgument_t sentry = Sentry
248  );
249 
250 
252  Cluster(Cluster const&) = default;
253 
255  Cluster(Cluster&& from): Cluster(from) { from.fID = InvalidID; }
256 
258  Cluster& operator= (Cluster const&) = default;
259 
262  {
263  if (&from != this) { operator=(from); from.fID = InvalidID; }
264  return *this;
265  }
266 
268  ~Cluster() = default;
269 
270 
273 
275  unsigned int NHits() const { return fNHits; }
276 
286  float StartWire() const { return fEndWires[clStart]; }
287 
297  float StartTick() const { return fEndTicks[clStart]; }
298 
306  float SigmaStartWire() const { return fSigmaEndWires[clStart]; }
307 
315  float SigmaStartTick() const { return fSigmaEndTicks[clStart]; }
316 
317 
329  float EndWire() const { return fEndWires[clEnd]; }
330 
342  float EndTick() const { return fEndTicks[clEnd]; }
343 
351  float SigmaEndWire() const { return fSigmaEndWires[clEnd]; }
352 
360  float SigmaEndTick() const { return fSigmaEndTicks[clEnd]; }
361 
362 
364 
386  float WireCoord(ClusterEnds_t side) const { return fEndWires[side]; }
387  float WireCoord(unsigned int side) const { return fEndWires[side]; }
389 
391 
413  float TickCoord(ClusterEnds_t side) const { return fEndTicks[side]; }
414  float TickCoord(unsigned int side) const { return fEndTicks[side]; }
416 
417 
419 
427  float SigmaWireCoord(ClusterEnds_t side) const { return fSigmaEndWires[side]; }
428  float SigmaWireCoord(unsigned int side) const { return fSigmaEndWires[side]; }
430 
432 
440  float SigmaTickCoord(ClusterEnds_t side) const { return fSigmaEndTicks[side]; }
441  float SigmaTickCoord(unsigned int side) const { return fSigmaEndTicks[side]; }
443 
444 
454  float StartCharge() const { return fEndCharges[clStart]; }
455 
475  float StartAngle() const { return fAngles[clStart]; }
476 
485  float StartOpeningAngle() const { return fOpeningAngles[clStart]; }
486 
487 
498  float EndCharge() const { return fEndCharges[clEnd]; }
499 
519  float EndAngle() const { return fAngles[clEnd]; }
520 
529  float EndOpeningAngle() const { return fOpeningAngles[clEnd]; }
530 
531 
533 
544  float EdgeCharge(ClusterEnds_t side) const { return fEndCharges[side]; }
545  float EdgeCharge(unsigned int side) const { return fEndCharges[side]; }
547 
549 
569  float Angle(ClusterEnds_t side) const { return fAngles[side]; }
570  float Angle(unsigned int side) const { return fAngles[side]; }
572 
574 
584  float OpeningAngle(ClusterEnds_t side) const
585  { return fOpeningAngles[side]; }
586  float OpeningAngle(unsigned int side) const
587  { return fOpeningAngles[side]; }
589 
590 
600  float Integral() const { return fChargeSum[cmFit]; }
601 
611  float IntegralStdDev() const { return fChargeStdDev[cmFit]; }
612 
622  float IntegralAverage() const { return fChargeAverage[cmFit]; }
623 
624 
634  float SummedADC() const { return fChargeSum[cmADC]; }
635 
645  float SummedADCstdDev() const { return fChargeStdDev[cmADC]; }
646 
656  float SummedADCaverage() const { return fChargeAverage[cmADC]; }
657 
658 
660 
676  float Charge(ChargeMode_t mode) const { return fChargeSum[mode]; }
677  float Charge(unsigned int mode) const { return fChargeSum[mode]; }
679 
681 
691  float ChargeStdDev(ChargeMode_t mode) const
692  { return fChargeStdDev[mode]; }
693  float ChargeStdDev(unsigned int mode) const
694  { return fChargeStdDev[mode]; }
696 
698 
708  float ChargeAverage(ChargeMode_t mode) const
709  { return fChargeAverage[mode]; }
710  float ChargeAverage(unsigned int mode) const
711  { return fChargeAverage[mode]; }
713 
723  float MultipleHitDensity() const { return fMultipleHitDensity; }
724 
725 
727  float Width() const { return fWidth; }
728 
729 
738  ID_t ID() const { return fID; }
739 
741  geo::View_t View() const { return fView; }
742 
744  geo::PlaneID Plane() const { return fPlaneID; }
745 
747 
749  bool hasPlane() const { return fPlaneID.isValid; }
750 
751 
753  bool isValid() const { return ID() != InvalidID; }
754 
755 
756  friend std::ostream& operator << (std::ostream& o, Cluster const& c);
757  friend bool operator < (Cluster const& a, Cluster const& b);
758 
759 
760  }; // class Cluster
761 
762 } // namespace recob
763 
764 
765 #endif //CLUSTER_H
Sums from the fitted hit values.
Definition: Cluster.h:85
float SigmaEndTick() const
Returns the uncertainty on tick coordinate of the end of the cluster.
Definition: Cluster.h:360
float fWidth
A measure of the cluster width, in homogenized units.
Definition: Cluster.h:160
static constexpr ID_t InvalidID
Value for an invalid cluster ID.
Definition: Cluster.h:179
float ChargeStdDev(unsigned int mode) const
Returns the standard deviation of charge of the cluster hits.
Definition: Cluster.h:693
float fMultipleHitDensity
Density of wires in the cluster with more than one hit.
Definition: Cluster.h:157
Just an alias for loops.
Definition: Cluster.h:88
float SummedADCaverage() const
Returns the average signal ADC counts of the cluster hits.
Definition: Cluster.h:656
float IntegralAverage() const
Returns the average charge of the cluster hits.
Definition: Cluster.h:622
float SigmaWireCoord(ClusterEnds_t side) const
Returns the uncertainty on wire coordinate of one of the end sides of the cluster.
Definition: Cluster.h:427
Reconstruction base classes.
float Angle(ClusterEnds_t side) const
Returns the angle at either end of the cluster.
Definition: Cluster.h:569
float fEndTicks[NEnds]
Definition: Cluster.h:111
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:413
float fEndCharges[NEnds]
Definition: Cluster.h:120
float fEndWires[NEnds]
Definition: Cluster.h:103
friend std::ostream & operator<<(std::ostream &o, Cluster const &c)
Definition: Cluster.cxx:173
float WireCoord(unsigned int side) const
Number of hits in the cluster.
Definition: Cluster.h:387
float fSigmaEndTicks[NEnds]
Definition: Cluster.h:115
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:129
float EdgeCharge(ClusterEnds_t side) const
Returns the charge on the first or last wire of the cluster.
Definition: Cluster.h:544
float SigmaTickCoord(ClusterEnds_t side) const
Returns the uncertainty on tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:440
float StartWire() const
Returns the wire coordinate of the start of the cluster.
Definition: Cluster.h:286
float fSigmaEndWires[NEnds]
Definition: Cluster.h:107
End count.
Definition: Cluster.h:80
Set of hits with a 2D structure.
Definition: Cluster.h:71
float EndTick() const
Returns the tick coordinate of the end of the cluster.
Definition: Cluster.h:342
float SigmaWireCoord(unsigned int side) const
Returns the uncertainty on wire coordinate of one of the end sides of the cluster.
Definition: Cluster.h:428
float MultipleHitDensity() const
Density of wires in the cluster with more than one hit.
Definition: Cluster.h:723
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
Definition: Cluster.h:744
geo::PlaneID fPlaneID
Location of the start of the cluster.
Definition: Cluster.h:170
Type of sentry argument.
Definition: Cluster.h:176
bool isValid() const
Returns if the cluster is valid (that is, if its ID is not invalid)
Definition: Cluster.h:753
float StartAngle() const
Returns the starting angle of the cluster.
Definition: Cluster.h:475
Sums directly from ADC counts.
Definition: Cluster.h:86
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:182
~Cluster()=default
Destructor: automatically generated.
float SummedADCstdDev() const
Returns the standard deviation of the signal ADC counts of the cluster hits.
Definition: Cluster.h:645
float fChargeSum[NChargeModes]
Definition: Cluster.h:145
float fChargeAverage[NChargeModes]
Definition: Cluster.h:153
float EndCharge() const
Returns the charge on the last wire of the cluster.
Definition: Cluster.h:498
float SummedADC() const
Returns the total charge of the cluster from signal ADC counts.
Definition: Cluster.h:634
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:691
float StartOpeningAngle() const
Returns the opening angle at the start of the cluster.
Definition: Cluster.h:485
Represents the most likely start of the cluster.
Definition: Cluster.h:78
Cluster(Cluster &&from)
Move constructor: as copy, but source cluster gets an invalid ID.
Definition: Cluster.h:255
float Width() const
A measure of the cluster width, in homogenized units.
Definition: Cluster.h:727
float SigmaEndWire() const
Returns the uncertainty on wire coordinate of the end of the cluster.
Definition: Cluster.h:351
float Charge(unsigned int mode) const
Returns the total charge of the cluster.
Definition: Cluster.h:677
float IntegralStdDev() const
Returns the standard deviation of the charge of the cluster hits.
Definition: Cluster.h:611
float SigmaStartWire() const
Returns the uncertainty on wire coordinate of the start of the cluster.
Definition: Cluster.h:306
float ChargeAverage(unsigned int mode) const
Returns the average charge of the cluster hits.
Definition: Cluster.h:710
float WireCoord(ClusterEnds_t side) const
Returns the wire coordinate of one of the end sides of the cluster.
Definition: Cluster.h:386
float fAngles[NEnds]
Definition: Cluster.h:130
Definition of data types for geometry description.
friend bool operator<(Cluster const &a, Cluster const &b)
Definition: Cluster.cxx:196
float EndOpeningAngle() const
Returns the opening angle at the end of the cluster.
Definition: Cluster.h:529
float ChargeAverage(ChargeMode_t mode) const
Returns the average charge of the cluster hits.
Definition: Cluster.h:708
geo::View_t View() const
Returns the view for this cluster.
Definition: Cluster.h:741
float TickCoord(unsigned int side) const
Returns the tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:414
float StartCharge() const
Returns the charge on the first wire of the cluster.
Definition: Cluster.h:454
ID_t ID() const
Identifier of this cluster.
Definition: Cluster.h:738
unsigned int fNHits
Number of hits in the cluster.
Definition: Cluster.h:97
float EdgeCharge(unsigned int side) const
Returns the charge on the first or last wire of the cluster.
Definition: Cluster.h:545
float fOpeningAngles[NEnds]
Definition: Cluster.h:137
float SigmaStartTick() const
Returns the uncertainty on tick coordinate of the start of the cluster.
Definition: Cluster.h:315
Just an alias for loops.
Definition: Cluster.h:81
bool hasPlane() const
Returns whether geometry plane is valid.
Definition: Cluster.h:749
Cluster()
Default constructor: an empty cluster.
Definition: Cluster.cxx:35
float Charge(ChargeMode_t mode) const
Returns the total charge of the cluster.
Definition: Cluster.h:676
unsigned int NHits() const
Number of hits in the cluster.
Definition: Cluster.h:275
float EndAngle() const
Returns the ending angle of the cluster.
Definition: Cluster.h:519
float OpeningAngle(ClusterEnds_t side) const
Returns the opening angle at either end of the cluster.
Definition: Cluster.h:584
float StartTick() const
Returns the tick coordinate of the start of the cluster.
Definition: Cluster.h:297
float Angle(unsigned int side) const
Returns the angle at either end of the cluster.
Definition: Cluster.h:570
float OpeningAngle(unsigned int side) const
Returns the opening angle at either end of the cluster.
Definition: Cluster.h:586
float fChargeStdDev[NChargeModes]
Definition: Cluster.h:149
geo::View_t fView
View for this cluster.
Definition: Cluster.h:168
float SigmaTickCoord(unsigned int side) const
Returns the uncertainty on tick coordinate of one of the end sides of the cluster.
Definition: Cluster.h:441
int ID_t
Type of cluster ID.
Definition: Cluster.h:74
Represents the end, or the alternative start, of the cluster.
Definition: Cluster.h:79
float Integral() const
Returns the total charge of the cluster from hit shape.
Definition: Cluster.h:600
float EndWire() const
Returns the wire coordinate of the end of the cluster.
Definition: Cluster.h:329