LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cluster::StandardClusterParamsAlg Class Reference

Algorithm collection class computing cluster parameters. More...

#include "StandardClusterParamsAlg.h"

Inheritance diagram for cluster::StandardClusterParamsAlg:
cluster::ClusterParamsAlgBase

Public Types

using Measure_t = ClusterParamsAlgBase::Measure_t
 

Public Member Functions

 StandardClusterParamsAlg ()
 Constructor. More...
 
virtual ~StandardClusterParamsAlg ()=default
 Destructor. More...
 
void Clear () override
 Restores the class to post-configuration, pre-initialization state. More...
 
void SetHitsFromPointers (util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits) override
 Sets the list of input hits. More...
 
void SetHits (util::GeometryUtilities const &gser, std::vector< recob::Hit > const &hits) override
 Sets the list of input hits. More...
 
void SetVerbose (int level=1) override
 Set the verbosity level. More...
 
size_t NHits () override
 Returns the number of hits in the cluster. More...
 
float MultipleHitDensity () override
 Fraction of wires in the cluster with more than one hit. More...
 
float Width (util::GeometryUtilities const &gser) override
 Computes the width of the cluster. More...
 
size_t NInputHits () const
 Returns the number of input hits. More...
 
Measure_t StartCharge (util::GeometryUtilities const &gser) override
 Computes the charge on the first and last wire of the track. More...
 
Measure_t EndCharge (util::GeometryUtilities const &gser) override
 Computes the charge on the first and last wire of the track. More...
 
Measure_t StartAngle () override
 Computes the angle of the cluster. More...
 
Measure_t EndAngle () override
 Computes the angle of the cluster. More...
 
Measure_t StartOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Measure_t EndOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Cluster charge
Measure_t Integral () override
 Computes the total charge of the cluster from Hit::Integral() More...
 
Measure_t IntegralStdDev () override
 Computes the standard deviation on the charge of the cluster hits. More...
 
Measure_t SummedADC () override
 Computes the total charge of the cluster from Hit::SummedADC() More...
 
Measure_t SummedADCStdDev () override
 Computes the standard deviation on the charge of the cluster hits. More...
 

Static Protected Member Functions

static std::logic_error NotImplemented (std::string function_name)
 

Protected Attributes

ClusterParamsAlg algo
 the actual algorithm class More...
 
int verbose = 0
 verbosity level: 0 is normal, negative is even quieter More...
 

Detailed Description

Algorithm collection class computing cluster parameters.

See also
ClusterParamsAlg

This class wraps ClusterParamsAlg class, designed in the context of shower reconstruction, to expose a standard ClusterParamsBaseAlg interface.

Definition at line 34 of file StandardClusterParamsAlg.h.

Member Typedef Documentation

Constructor & Destructor Documentation

cluster::StandardClusterParamsAlg::StandardClusterParamsAlg ( )

Constructor.

Definition at line 20 of file StandardClusterParamsAlg.cxx.

References SetVerbose().

21 {
22  SetVerbose(0);
23 }
void SetVerbose(int level=1) override
Set the verbosity level.
virtual cluster::StandardClusterParamsAlg::~StandardClusterParamsAlg ( )
virtualdefault

Destructor.

Member Function Documentation

void cluster::StandardClusterParamsAlg::Clear ( )
overridevirtual

Restores the class to post-configuration, pre-initialization state.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 33 of file StandardClusterParamsAlg.cxx.

References algo, and cluster::ClusterParamsAlg::Initialize().

Referenced by SetHitsFromPointers().

34 {
35  algo.Initialize();
36 }
ClusterParamsAlg algo
the actual algorithm class
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::EndAngle ( )
overridevirtual

Computes the angle of the cluster.

Returns
angle of the cluster in the wire x time space, in radians

Uses the coordinates from the hits, weighted by charge (Hit::Integral()) to compute a slope in the homogenized wire x time space. The homogenized space has both wires and ticks converted into a distance (by using detector parameters: wire pitch and drift velocity).

The angle is in the $ [ -\pi, \pi ] $ range, with 0 corresponding to a cluster parallel to the wire plane and $ \pi $ to a cluster orthogonal to the wire plane, going farther from it.

Note
Both the methods return the same value.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 74 of file StandardClusterParamsAlg.cxx.

References StartAngle().

Referenced by SetHits().

75 {
76  return StartAngle(); // Ummm...this doesn't look right. FIXME
77 }
Measure_t StartAngle() override
Computes the angle of the cluster.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::EndCharge ( util::GeometryUtilities const &  gser)
overridevirtual

Computes the charge on the first and last wire of the track.

Returns
the charge in ADC counts, with uncertainty

The implementation in ClusterParamsAlg provides an estimation of the charge collected in the first or last 1 cm of the cluster, using a linear fit on the deposited charge to reduce fluctuations.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 57 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::EndCharge(), and NInputHits().

Referenced by SetHits().

59 {
60  if (NInputHits() == 0) return {0.F};
61  return {(float)algo.EndCharge(gser)};
62 }
ClusterParamsAlg algo
the actual algorithm class
double EndCharge(util::GeometryUtilities const &gser, float length=1., unsigned int nbins=10)
Returns the expected charge at the end of the cluster.
size_t NInputHits() const
Returns the number of input hits.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::EndOpeningAngle ( )
overridevirtual

Computes the opening angle at the start or end of the cluster.

Returns
angle at the start of the cluster, in radians

This algorithm returns an opening angle after weighting the hits by their charge (as defined bu Hit::Integral());

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 89 of file StandardClusterParamsAlg.cxx.

References algo, cluster::cluster_params::closing_angle_charge_wgt, cluster::ClusterParamsAlg::GetParams(), NInputHits(), and cluster::ClusterParamsAlg::RefineDirection().

Referenced by SetHits().

90 {
91  if (NInputHits() < 3) return {0.F};
92 
94  return {(float)algo.GetParams().closing_angle_charge_wgt};
95 }
double closing_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:43
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void RefineDirection(bool override=false)
size_t NInputHits() const
Returns the number of input hits.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::Integral ( )
overridevirtual

Computes the total charge of the cluster from Hit::Integral()

Returns
total charge of the cluster, in ADC count units
See also
IntegralStdDev(), SummedADC()

ClusterParamsAlg computes the sum from all hits.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 98 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetAverages(), cluster::ClusterParamsAlg::GetParams(), NInputHits(), and cluster::cluster_params::sum_charge.

Referenced by SetHits().

99 {
100  if (NInputHits() == 0) return {0.F};
101 
102  algo.GetAverages();
103  return {(float)algo.GetParams().sum_charge};
104 }
const cluster_params & GetParams() const
double sum_charge
Sum charge of hits in ADC.
Definition: ClusterParams.h:26
ClusterParamsAlg algo
the actual algorithm class
void GetAverages(bool override=false)
size_t NInputHits() const
Returns the number of input hits.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::IntegralStdDev ( )
overridevirtual

Computes the standard deviation on the charge of the cluster hits.

Returns
the standard deviation of charge of hits, in ADC count units
See also
Integral()

ClusterParamsAlg computes the standard deviation of the sample of charges from all hits. Hit charge is obtained by recob::Hit::Integral().

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 107 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetAverages(), cluster::ClusterParamsAlg::GetParams(), NInputHits(), and cluster::cluster_params::rms_charge.

Referenced by SetHits().

108 {
109  if (NInputHits() < 2) return {0.F};
110 
111  algo.GetAverages();
112  return {(float)algo.GetParams().rms_charge};
113 }
double rms_charge
RMS (standard deviation of sample) of charge of hits in ADC.
Definition: ClusterParams.h:28
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void GetAverages(bool override=false)
size_t NInputHits() const
Returns the number of input hits.
float cluster::StandardClusterParamsAlg::MultipleHitDensity ( )
overridevirtual

Fraction of wires in the cluster with more than one hit.

Returns
fraction of wires with more than one hit, or 0 if no wires

Returns a quantity defined as NMultiHitWires / NWires, where NWires is the number of wires hosting at least one hit of this cluster, and NMultiHitWires is the number of wires which have more than just one hit.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 145 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetAverages(), cluster::ClusterParamsAlg::GetParams(), cluster::cluster_params::multi_hit_wires, cluster::cluster_params::N_Wires, and NInputHits().

Referenced by SetHits().

146 {
147  if (NInputHits() < 2) return 0.0F;
148 
149  algo.GetAverages();
151  0.;
152 }
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void GetAverages(bool override=false)
size_t NInputHits() const
Returns the number of input hits.
size_t cluster::StandardClusterParamsAlg::NHits ( )
overridevirtual

Returns the number of hits in the cluster.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 136 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetAverages(), cluster::ClusterParamsAlg::GetParams(), cluster::cluster_params::N_Hits, and NInputHits().

Referenced by SetHits().

137 {
138  if (NInputHits() < 2) return NInputHits();
139 
140  algo.GetAverages();
141  return (size_t)algo.GetParams().N_Hits;
142 }
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void GetAverages(bool override=false)
size_t NInputHits() const
Returns the number of input hits.
size_t cluster::StandardClusterParamsAlg::NInputHits ( ) const

Returns the number of input hits.

Definition at line 164 of file StandardClusterParamsAlg.cxx.

References algo, and cluster::ClusterParamsAlg::GetNHits().

Referenced by EndCharge(), EndOpeningAngle(), Integral(), IntegralStdDev(), MultipleHitDensity(), NHits(), SetHits(), StartAngle(), StartCharge(), StartOpeningAngle(), SummedADC(), SummedADCStdDev(), and Width().

165 {
166  return algo.GetNHits();
167 }
ClusterParamsAlg algo
the actual algorithm class
static std::logic_error cluster::ClusterParamsAlgBase::NotImplemented ( std::string  function_name)
inlinestaticprotectedinherited

Definition at line 242 of file ClusterParamsAlgBase.h.

243  {
244  return std::logic_error(function_name + "() not implemented.");
245  }
void cluster::StandardClusterParamsAlg::SetHits ( util::GeometryUtilities const &  gser,
std::vector< recob::Hit > const &  hits 
)
inlineoverridevirtual

Sets the list of input hits.

Parameters
hitslist of hits (hits will not be modified)
Exceptions
undefinedin case of error, this method can throw (anything)
See also
ClusterParamsAlgBase::SetHits(std::vector<recob::Hit> const&)

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 67 of file StandardClusterParamsAlg.h.

References EndAngle(), EndCharge(), EndOpeningAngle(), Integral(), IntegralStdDev(), MultipleHitDensity(), NHits(), NInputHits(), cluster::ClusterParamsAlgBase::SetHits(), SetVerbose(), StartAngle(), StartCharge(), StartOpeningAngle(), SummedADC(), SummedADCStdDev(), and Width().

68  {
70  }
virtual void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit > const &hits)
Sets the list of input hits.
void cluster::StandardClusterParamsAlg::SetHitsFromPointers ( util::GeometryUtilities const &  gser,
std::vector< recob::Hit const * > const &  hits 
)
overridevirtual

Sets the list of input hits.

Parameters
hitslist of hits
Exceptions
undefinedin case of error, this method can throw (anything)

Hits are translated into our own internal format. The original hits are not used afterward, and their distruction will not affect this object. This method calls Clear() at the beginning (although the protocol does not requires it).

Implements cluster::ClusterParamsAlgBase.

Definition at line 39 of file StandardClusterParamsAlg.cxx.

References algo, Clear(), and cluster::ClusterParamsAlg::SetHits().

42 {
43  Clear();
44  util::PxHitConverter pxhitconverter{gser};
45  algo.SetHits(pxhitconverter.ToPxHitVector(hits));
46 }
ClusterParamsAlg algo
the actual algorithm class
int SetHits(const std::vector< util::PxHit > &)
void Clear() override
Restores the class to post-configuration, pre-initialization state.
void cluster::StandardClusterParamsAlg::SetVerbose ( int  level = 1)
overridevirtual

Set the verbosity level.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 26 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::SetVerbose(), and cluster::ClusterParamsAlgBase::SetVerbose().

Referenced by SetHits(), and StandardClusterParamsAlg().

27 {
29  algo.SetVerbose(level > 0);
30 }
virtual void SetVerbose(int level=1)
Set the verbosity level.
ClusterParamsAlg algo
the actual algorithm class
void SetVerbose(bool yes=true)
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::StartAngle ( )
overridevirtual

Computes the angle of the cluster.

Returns
angle of the cluster in the wire x time space, in radians

Uses the coordinates from the hits, weighted by charge (Hit::Integral()) to compute a slope in the homogenized wire x time space. The homogenized space has both wires and ticks converted into a distance (by using detector parameters: wire pitch and drift velocity).

The angle is in the $ [ -\pi, \pi ] $ range, with 0 corresponding to a cluster parallel to the wire plane and $ \pi $ to a cluster orthogonal to the wire plane, going farther from it.

Note
Both the methods return the same value.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 65 of file StandardClusterParamsAlg.cxx.

References algo, cluster::cluster_params::cluster_angle_2d, util::DegreesToRadians(), cluster::ClusterParamsAlg::GetParams(), cluster::ClusterParamsAlg::GetRoughAxis(), and NInputHits().

Referenced by EndAngle(), and SetHits().

66 {
67  if (NInputHits() < 2) return {0.F};
68 
71 }
void GetRoughAxis(bool override=false)
const cluster_params & GetParams() const
constexpr T DegreesToRadians(T angle)
Converts the argument angle from degrees into radians.
ClusterParamsAlg algo
the actual algorithm class
size_t NInputHits() const
Returns the number of input hits.
double cluster_angle_2d
Linear best fit to high-charge hits in the cluster.
Definition: ClusterParams.h:38
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::StartCharge ( util::GeometryUtilities const &  gser)
overridevirtual

Computes the charge on the first and last wire of the track.

Returns
the charge in ADC counts, with uncertainty

The implementation in ClusterParamsAlg provides an estimation of the charge collected in the first or last 1 cm of the cluster, using a linear fit on the deposited charge to reduce fluctuations.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 49 of file StandardClusterParamsAlg.cxx.

References algo, NInputHits(), and cluster::ClusterParamsAlg::StartCharge().

Referenced by SetHits().

51 {
52  if (NInputHits() == 0) return {0.F};
53  return {(float)algo.StartCharge(gser)};
54 }
ClusterParamsAlg algo
the actual algorithm class
size_t NInputHits() const
Returns the number of input hits.
double StartCharge(util::GeometryUtilities const &gser, float length=1., unsigned int nbins=10)
Returns the expected charge at the beginning of the cluster.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::StartOpeningAngle ( )
overridevirtual

Computes the opening angle at the start or end of the cluster.

Returns
angle at the start of the cluster, in radians

This algorithm returns an opening angle after weighting the hits by their charge (as defined bu Hit::Integral());

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 80 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetParams(), NInputHits(), cluster::cluster_params::opening_angle_charge_wgt, and cluster::ClusterParamsAlg::RefineDirection().

Referenced by SetHits().

81 {
82  if (NInputHits() < 3) return {0.F};
83 
85  return {(float)algo.GetParams().opening_angle_charge_wgt};
86 }
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void RefineDirection(bool override=false)
double opening_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:41
size_t NInputHits() const
Returns the number of input hits.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::SummedADC ( )
overridevirtual

Computes the total charge of the cluster from Hit::SummedADC()

Returns
total charge of the cluster, in ADC count units
See also
SummedADCStdDev(), Integral()

ClusterParamsAlg computes the sum from all hits.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 116 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetAverages(), cluster::ClusterParamsAlg::GetParams(), NInputHits(), and cluster::cluster_params::sum_ADC.

Referenced by SetHits().

117 {
118  if (NInputHits() == 0) return {0.F};
119 
120  // compute all the averages
121  algo.GetAverages();
122  double sumADC = algo.GetParams().sum_ADC;
123  return {(float)sumADC, (float)std::sqrt(sumADC)};
124 }
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void GetAverages(bool override=false)
double sum_ADC
Sum charge of ADC counts of hits, in ADC.
Definition: ClusterParams.h:29
size_t NInputHits() const
Returns the number of input hits.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::SummedADCStdDev ( )
overridevirtual

Computes the standard deviation on the charge of the cluster hits.

Returns
the standard deviation of charge of hits, in ADC count units
See also
SummedADC()

ClusterParamsAlg computes the standard deviation of the sample of charges from all hits. Hit charge is obtained by recob::Hit::SummedADC().

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 127 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetAverages(), cluster::ClusterParamsAlg::GetParams(), NInputHits(), and cluster::cluster_params::rms_ADC.

Referenced by SetHits().

128 {
129  if (NInputHits() < 2) return {0.F};
130 
131  algo.GetAverages();
132  return {(float)algo.GetParams().rms_ADC};
133 }
double rms_ADC
RMS (standard deviation of sample) of ADC counts of hits in ADC.
Definition: ClusterParams.h:31
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
void GetAverages(bool override=false)
size_t NInputHits() const
Returns the number of input hits.
float cluster::StandardClusterParamsAlg::Width ( util::GeometryUtilities const &  gser)
overridevirtual

Computes the width of the cluster.

Returns
width of the cluster
Todo:
provide a description of the algorithm by words

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 155 of file StandardClusterParamsAlg.cxx.

References algo, cluster::ClusterParamsAlg::GetParams(), cluster::ClusterParamsAlg::GetProfileInfo(), NInputHits(), and cluster::cluster_params::width.

Referenced by SetHits().

156 {
157  if (NInputHits() < 3) return 0.0F;
158 
159  algo.GetProfileInfo(gser);
160  return algo.GetParams().width;
161 }
void GetProfileInfo(util::GeometryUtilities const &gser, bool override=false)
const cluster_params & GetParams() const
ClusterParamsAlg algo
the actual algorithm class
size_t NInputHits() const
Returns the number of input hits.

Member Data Documentation

int cluster::ClusterParamsAlgBase::verbose = 0
protectedinherited

verbosity level: 0 is normal, negative is even quieter

Definition at line 240 of file ClusterParamsAlgBase.h.


The documentation for this class was generated from the following files: