LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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...
 
virtual void Clear () override
 Restores the class to post-configuration, pre-initialization state. More...
 
virtual void SetHits (std::vector< recob::Hit const * > const &hits) override
 Sets the list of input hits. More...
 
virtual void SetHits (std::vector< recob::Hit > const &hits) override
 Sets the list of input hits. More...
 
virtual void SetVerbose (int level=1) override
 Set the verbosity level. More...
 
virtual size_t NHits () override
 Returns the number of hits in the cluster. More...
 
virtual float MultipleHitDensity () override
 Fraction of wires in the cluster with more than one hit. More...
 
virtual float Width () override
 Computes the width of the cluster. More...
 
size_t NInputHits () const
 Returns the number of input hits. More...
 
virtual Measure_t StartCharge () override
 Computes the charge on the first and last wire of the track. More...
 
virtual Measure_t EndCharge () override
 Computes the charge on the first and last wire of the track. More...
 
virtual Measure_t StartAngle () override
 Computes the angle of the cluster. More...
 
virtual Measure_t EndAngle () override
 Computes the angle of the cluster. More...
 
virtual Measure_t StartOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
virtual Measure_t EndOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Cluster charge
virtual Measure_t Integral () override
 Computes the total charge of the cluster from Hit::Integral() More...
 
virtual Measure_t IntegralStdDev () override
 Computes the standard deviation on the charge of the cluster hits. More...
 
virtual Measure_t SummedADC () override
 Computes the total charge of the cluster from Hit::SummedADC() More...
 
virtual 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 36 of file StandardClusterParamsAlg.h.

Member Typedef Documentation

Constructor & Destructor Documentation

cluster::StandardClusterParamsAlg::StandardClusterParamsAlg ( )

Constructor.

Definition at line 23 of file StandardClusterParamsAlg.cxx.

References SetVerbose().

23  {
24  SetVerbose(0);
25 } // StandardClusterParamsAlg::StandardClusterParamsAlg()
virtual 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 36 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

36  {
37  algo.Initialize();
38 } // StandardClusterParamsAlg::Clear()
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 84 of file StandardClusterParamsAlg.cxx.

References StartAngle().

Referenced by SetHits().

85 {
86  return StartAngle();
87 } // StandardClusterParamsAlg::EndAngle()
virtual Measure_t StartAngle() override
Computes the angle of the cluster.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::EndCharge ( )
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 62 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

63 {
64  if (NInputHits() == 0) return { 0.F };
65  return { (float) algo.EndCharge() };
66 } // StandardClusterParamsAlg::EndCharge()
double EndCharge(float length=1., unsigned int nbins=10)
Returns the expected charge at the end of the cluster.
ClusterParamsAlg algo
the actual algorithm class
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 105 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

106 {
107  if (NInputHits() < 3) return { 0.F };
108 
109  // compute the direction and related quantities
111  // return the relevant information, no uncertainty
112  return { (float) algo.GetParams().closing_angle_charge_wgt };
113 } // StandardClusterParamsAlg::EndOpeningAngle()
double closing_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:44
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 118 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

119 {
120  if (NInputHits() == 0) return { 0.F };
121 
122  // compute all the averages
123  algo.GetAverages();
124  // return the relevant information, no uncertainty
125  return { (float) algo.GetParams().sum_charge };
126 } // StandardClusterParamsAlg::Integral()
const cluster_params & GetParams() const
double sum_charge
Sum charge of hits in ADC.
Definition: ClusterParams.h:27
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 131 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

132 {
133  if (NInputHits() < 2) return { 0.F };
134 
135  // compute all the averages
136  algo.GetAverages();
137  // return the relevant information, no uncertainty
138  return { (float) algo.GetParams().rms_charge };
139 } // StandardClusterParamsAlg::IntegralStdDev()
double rms_charge
RMS (standard deviation of sample) of charge of hits in ADC.
Definition: ClusterParams.h:29
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 181 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().

181  {
182  if (NInputHits() < 2) return 0.0F;
183 
184  // compute all the averages
185  algo.GetAverages();
186  // return the relevant information
187  return algo.GetParams().N_Wires?
189 } // StandardClusterParamsAlg::MultipleHitDensity()
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 170 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

170  {
171  if (NInputHits() < 2) return NInputHits();
172 
173  // compute all the averages
174  algo.GetAverages();
175  // return the relevant information, no uncertainty
176  return (size_t) algo.GetParams().N_Hits;
177 } // StandardClusterParamsAlg::NHits()
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
static std::logic_error cluster::ClusterParamsAlgBase::NotImplemented ( std::string  function_name)
inlinestaticprotectedinherited

Definition at line 243 of file ClusterParamsAlgBase.h.

244  { return std::logic_error(function_name + "() not implemented."); }
void cluster::StandardClusterParamsAlg::SetHits ( 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 43 of file StandardClusterParamsAlg.cxx.

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

Referenced by Clear().

44 {
45  Clear();
46  util::PxHitConverter pxhitconverter;
47  algo.SetHits(pxhitconverter.ToPxHitVector(hits));
48 } // StandardClusterParamsAlg::SetHits()
std::vector< util::PxHit > ToPxHitVector(Cont const &hits) const
Returns a vector of util::PxHit out of a vector of hits.
ClusterParamsAlg algo
the actual algorithm class
int SetHits(const std::vector< util::PxHit > &)
virtual void Clear() override
Restores the class to post-configuration, pre-initialization state.
virtual void cluster::StandardClusterParamsAlg::SetHits ( 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 71 of file StandardClusterParamsAlg.h.

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

virtual void SetHits(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 29 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits(), and StandardClusterParamsAlg().

29  {
31  algo.SetVerbose(level > 0);
32 } // StandardClusterParamsAlg::SetVerbose()
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 71 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().

72 {
73  if (NInputHits() < 2) return { 0.F };
74 
75  // compute the rough direction and related quantities
77  // return the relevant information, no uncertainty
79 } // StandardClusterParamsAlg::StartAngle()
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:39
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::StartCharge ( )
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 53 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

54 {
55  if (NInputHits() == 0) return { 0.F };
56  return { (float) algo.StartCharge() };
57 } // StandardClusterParamsAlg::StartCharge()
double StartCharge(float length=1., unsigned int nbins=10)
Returns the expected charge at the beginning of the cluster.
ClusterParamsAlg algo
the actual algorithm class
size_t NInputHits() const
Returns the number of input hits.
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 92 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

93 {
94  if (NInputHits() < 3) return { 0.F };
95 
96  // compute the direction and related quantities
98  // return the relevant information, no uncertainty
99  return { (float) algo.GetParams().opening_angle_charge_wgt };
100 } // StandardClusterParamsAlg::StartOpeningAngle()
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:42
size_t NInputHits() const
Returns the number of input hits.
cluster::StandardClusterParamsAlg::Measure_t cluster::StandardClusterParamsAlg::SummedADC ( void  )
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 144 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

145 {
146  if (NInputHits() == 0) return { 0.F };
147 
148  // compute all the averages
149  algo.GetAverages();
150  double sumADC = algo.GetParams().sum_ADC;
151  // return the relevant information, no uncertainty
152  return { (float) sumADC, (float) std::sqrt(sumADC) };
153 } // StandardClusterParamsAlg::SummedADC()
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:30
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 158 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

159 {
160  if (NInputHits() < 2) return { 0.F };
161 
162  // compute all the averages
163  algo.GetAverages();
164  // return the relevant information, no uncertainty
165  return { (float) algo.GetParams().rms_ADC };
166 } // StandardClusterParamsAlg::SummedADCStdDev()
double rms_ADC
RMS (standard deviation of sample) of ADC counts of hits in ADC.
Definition: ClusterParams.h:32
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 ( )
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 193 of file StandardClusterParamsAlg.cxx.

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

Referenced by SetHits().

193  {
194  if (NInputHits() < 3) return 0.0F;
195 
196  // compute all the shower profile information
198  // return the relevant information, no uncertainty
199  return algo.GetParams().width;
200 } // StandardClusterParamsAlg::Width()
void GetProfileInfo(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 241 of file ClusterParamsAlgBase.h.


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