All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
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 Types inherited from cluster::ClusterParamsAlgBase
using Measure_t = details::Measure_t< float >
 Type used to return values with errors. More...
 

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 SetHits (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
 
Measure_t StartAngle () override
 Computes the angle of the cluster. More...
 
Measure_t EndAngle () override
 
Measure_t StartOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Measure_t EndOpeningAngle () override
 
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...
 
- Public Member Functions inherited from cluster::ClusterParamsAlgBase
virtual ~ClusterParamsAlgBase ()=default
 

Protected Attributes

ClusterParamsAlg algo
 the actual algorithm class More...
 
- Protected Attributes inherited from cluster::ClusterParamsAlgBase
int verbose = 0
 verbosity level: 0 is normal, negative is even quieter More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from cluster::ClusterParamsAlgBase
static std::logic_error NotImplemented (std::string function_name)
 

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

Definition at line 36 of file StandardClusterParamsAlg.h.

Constructor & Destructor Documentation

cluster::StandardClusterParamsAlg::StandardClusterParamsAlg ( )

Constructor.

Definition at line 20 of file StandardClusterParamsAlg.cxx.

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 35 of file StandardClusterParamsAlg.cxx.

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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 78 of file StandardClusterParamsAlg.cxx.

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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 60 of file StandardClusterParamsAlg.cxx.

61 {
62  if (NInputHits() == 0) return {0.F};
63  return {(float)algo.EndCharge(gser)};
64 }
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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 95 of file StandardClusterParamsAlg.cxx.

96 {
97  if (NInputHits() < 3) return {0.F};
98 
100  return {(float)algo.GetParams().closing_angle_charge_wgt};
101 }
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 105 of file StandardClusterParamsAlg.cxx.

106 {
107  if (NInputHits() == 0) return {0.F};
108 
109  algo.GetAverages();
110  return {(float)algo.GetParams().sum_charge};
111 }
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 115 of file StandardClusterParamsAlg.cxx.

116 {
117  if (NInputHits() < 2) return {0.F};
118 
119  algo.GetAverages();
120  return {(float)algo.GetParams().rms_charge};
121 }
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 157 of file StandardClusterParamsAlg.cxx.

158 {
159  if (NInputHits() < 2) return 0.0F;
160 
161  algo.GetAverages();
163  0.;
164 }
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 147 of file StandardClusterParamsAlg.cxx.

148 {
149  if (NInputHits() < 2) return NInputHits();
150 
151  algo.GetAverages();
152  return (size_t)algo.GetParams().N_Hits;
153 }
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 178 of file StandardClusterParamsAlg.cxx.

179 {
180  return algo.GetNHits();
181 }
ClusterParamsAlg algo
the actual algorithm class
void cluster::StandardClusterParamsAlg::SetHits ( 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 42 of file StandardClusterParamsAlg.cxx.

44 {
45  Clear();
46  util::PxHitConverter pxhitconverter{gser};
47  algo.SetHits(pxhitconverter.ToPxHitVector(hits));
48 }
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::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 68 of file StandardClusterParamsAlg.h.

69  {
71  }
virtual void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits)=0
Sets the list of input hits.
void cluster::StandardClusterParamsAlg::SetVerbose ( int  level = 1)
overridevirtual

Set the verbosity level.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 27 of file StandardClusterParamsAlg.cxx.

28 {
30  algo.SetVerbose(level > 0);
31 }
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 68 of file StandardClusterParamsAlg.cxx.

69 {
70  if (NInputHits() < 2) return {0.F};
71 
74 }
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 52 of file StandardClusterParamsAlg.cxx.

53 {
54  if (NInputHits() == 0) return {0.F};
55  return {(float)algo.StartCharge(gser)};
56 }
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 85 of file StandardClusterParamsAlg.cxx.

86 {
87  if (NInputHits() < 3) return {0.F};
88 
90  return {(float)algo.GetParams().opening_angle_charge_wgt};
91 }
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 125 of file StandardClusterParamsAlg.cxx.

126 {
127  if (NInputHits() == 0) return {0.F};
128 
129  // compute all the averages
130  algo.GetAverages();
131  double sumADC = algo.GetParams().sum_ADC;
132  return {(float)sumADC, (float)std::sqrt(sumADC)};
133 }
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 137 of file StandardClusterParamsAlg.cxx.

138 {
139  if (NInputHits() < 2) return {0.F};
140 
141  algo.GetAverages();
142  return {(float)algo.GetParams().rms_ADC};
143 }
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 168 of file StandardClusterParamsAlg.cxx.

169 {
170  if (NInputHits() < 3) return 0.0F;
171 
172  algo.GetProfileInfo(gser);
173  return algo.GetParams().width;
174 }
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

ClusterParamsAlg cluster::StandardClusterParamsAlg::algo
protected

the actual algorithm class

Definition at line 191 of file StandardClusterParamsAlg.h.


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