LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
cluster::LazyClusterParamsAlg Class Reference

Algorithm class inheriting cluster parameters. More...

#include "LazyClusterParamsAlg.h"

Inheritance diagram for cluster::LazyClusterParamsAlg:
cluster::ClusterParamsAlgBase

Public Types

using Measure_t = ClusterParamsAlgBase::Measure_t
 

Public Member Functions

 LazyClusterParamsAlg (cluster_params const &new_params)
 Constructor: references to the parameters (no copy is performed!) More...
 
virtual ~LazyClusterParamsAlg ()=default
 Destructor. More...
 
virtual void Clear () override
 Restores the class to post-configuration, pre-initialization state; dummy. More...
 
virtual void SetHits (std::vector< recob::Hit const * > const &hits) override
 Sets the list of input hits. 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...
 
cluster_params const & GetParams () const
 Returns the original precomputed parameters. More...
 
virtual void SetHits (std::vector< recob::Hit > const &hits)
 Sets the list of input hits. More...
 
virtual void SetVerbose (int level=1)
 Set the verbosity level. 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

cluster_params const & params
 the parameters, already computed More...
 
int verbose = 0
 verbosity level: 0 is normal, negative is even quieter More...
 

Detailed Description

Algorithm class inheriting cluster parameters.

See also
ClusterParamsAlg

This class wraps ClusterParamsAlg class, designed in the context of shower reconstruction, to expose a standard ClusterParamsBaseAlg interface. All the information is supposed to have been computed already.

In addition to the standard interface, GetParams() is also available.

Definition at line 35 of file LazyClusterParamsAlg.h.

Member Typedef Documentation

Constructor & Destructor Documentation

cluster::LazyClusterParamsAlg::LazyClusterParamsAlg ( cluster_params const &  new_params)
inline

Constructor: references to the parameters (no copy is performed!)

Definition at line 40 of file LazyClusterParamsAlg.h.

References ~LazyClusterParamsAlg().

40  :
41  params(new_params) {}
cluster_params const & params
the parameters, already computed
virtual cluster::LazyClusterParamsAlg::~LazyClusterParamsAlg ( )
virtualdefault

Destructor.

Referenced by LazyClusterParamsAlg().

Member Function Documentation

virtual void cluster::LazyClusterParamsAlg::Clear ( )
inlineoverridevirtual

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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 48 of file LazyClusterParamsAlg.h.

48 {}
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 49 of file LazyClusterParamsAlg.cxx.

References StartAngle().

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

50 {
51  return StartAngle();
52 } // LazyClusterParamsAlg::EndAngle()
virtual Measure_t StartAngle() override
Computes the angle of the cluster.
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 33 of file LazyClusterParamsAlg.cxx.

References cluster::cluster_params::end_charge, and params.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

34 {
35  return { (float) params.end_charge };
36 } // LazyClusterParamsAlg::EndCharge()
cluster_params const & params
the parameters, already computed
double end_charge
Charge at the (other) end of the cluster.
Definition: ClusterParams.h:46
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 65 of file LazyClusterParamsAlg.cxx.

References cluster::cluster_params::closing_angle_charge_wgt, and params.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

66 {
67  return { (float) params.closing_angle_charge_wgt };
68 } // LazyClusterParamsAlg::EndOpeningAngle()
double closing_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:44
cluster_params const & params
the parameters, already computed
cluster_params const& cluster::LazyClusterParamsAlg::GetParams ( ) const
inline

Returns the original precomputed parameters.

Definition at line 178 of file LazyClusterParamsAlg.h.

References params.

178 { return params; }
cluster_params const & params
the parameters, already computed
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 73 of file LazyClusterParamsAlg.cxx.

References params, and cluster::cluster_params::sum_charge.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

74 {
75  return { (float) params.sum_charge };
76 } // LazyClusterParamsAlg::Integral()
cluster_params const & params
the parameters, already computed
double sum_charge
Sum charge of hits in ADC.
Definition: ClusterParams.h:27
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 81 of file LazyClusterParamsAlg.cxx.

References params, and cluster::cluster_params::rms_charge.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

82 {
83  return { (float) params.rms_charge };
84 } // LazyClusterParamsAlg::IntegralStdDev()
double rms_charge
RMS (standard deviation of sample) of charge of hits in ADC.
Definition: ClusterParams.h:29
cluster_params const & params
the parameters, already computed
float cluster::LazyClusterParamsAlg::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 111 of file LazyClusterParamsAlg.cxx.

References cluster::cluster_params::multi_hit_wires, cluster::cluster_params::N_Wires, and params.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

111  {
113 } // LazyClusterParamsAlg::MultipleHitDensity()
cluster_params const & params
the parameters, already computed
size_t cluster::LazyClusterParamsAlg::NHits ( )
overridevirtual

Returns the number of hits in the cluster.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 105 of file LazyClusterParamsAlg.cxx.

References cluster::cluster_params::N_Hits, and params.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

105  {
106  return (size_t) params.N_Hits;
107 } // LazyClusterParamsAlg::NHits()
cluster_params const & params
the parameters, already computed
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."); }
virtual void cluster::LazyClusterParamsAlg::SetHits ( std::vector< recob::Hit const * > const &  hits)
inlineoverridevirtual

Sets the list of input hits.

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

The parameters have already been computed. This function is dummy.

Implements cluster::ClusterParamsAlgBase.

Definition at line 59 of file LazyClusterParamsAlg.h.

References EndAngle(), EndCharge(), EndOpeningAngle(), Integral(), IntegralStdDev(), MultipleHitDensity(), NHits(), StartAngle(), StartCharge(), StartOpeningAngle(), SummedADC(), SummedADCStdDev(), and Width().

59 {}
virtual void cluster::ClusterParamsAlgBase::SetHits ( std::vector< recob::Hit > const &  hits)
inlinevirtualinherited

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)

The same general directions apply as for SetHits() version with pointers. This version takes a list of recob::Hit, rather than their pointers. It can simplify upstream handling when the original list is not recob::Hit and creation of temporary recob::Hit is needed. In that case, managing to obtain pointers to these temporary objects can be inefficient.

The default implementation provided here is not efficient either, since it just creates an additional vector of recob::Hit pointers and uses it. If an implementation is concerned with efficiency, it can reimplement this to initialize the algorithm in a more direct way.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, and cluster::StandardClusterParamsAlg.

Definition at line 137 of file ClusterParamsAlgBase.h.

138  {
139  std::vector<recob::Hit const*> hitptrs;
140  hitptrs.reserve(hits.size());
141  std::transform(hits.begin(), hits.end(), std::back_inserter(hitptrs),
142  [] (recob::Hit const& hit) { return &hit; });
143  SetHits(hitptrs);
144  }
Detector simulation of raw signals on wires.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
virtual void SetHits(std::vector< recob::Hit const * > const &hits)=0
Sets the list of input hits.
virtual void cluster::ClusterParamsAlgBase::SetVerbose ( int  level = 1)
inlinevirtualinherited

Set the verbosity level.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, and cluster::StandardClusterParamsAlg.

Definition at line 148 of file ClusterParamsAlgBase.h.

Referenced by cluster::StandardClusterParamsAlg::SetVerbose(), and cluster::OverriddenClusterParamsAlg< AlgoBase >::SetVerbose().

148 { verbose = level; }
int verbose
verbosity level: 0 is normal, negative is even quieter
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 41 of file LazyClusterParamsAlg.cxx.

References cluster::cluster_params::cluster_angle_2d, util::DegreesToRadians(), and params.

Referenced by cluster::ClusterMergeHelper::AppendResult(), EndAngle(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

42 {
44 } // LazyClusterParamsAlg::StartAngle()
cluster_params const & params
the parameters, already computed
constexpr T DegreesToRadians(T angle)
Converts the argument angle from degrees into radians.
double cluster_angle_2d
Linear best fit to high-charge hits in the cluster.
Definition: ClusterParams.h:39
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 25 of file LazyClusterParamsAlg.cxx.

References params, and cluster::cluster_params::start_charge.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

26 {
27  return { (float) params.start_charge };
28 } // LazyClusterParamsAlg::StartCharge()
double start_charge
Charge at the start of the cluster.
Definition: ClusterParams.h:45
cluster_params const & params
the parameters, already computed
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 57 of file LazyClusterParamsAlg.cxx.

References cluster::cluster_params::opening_angle_charge_wgt, and params.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

58 {
59  return { (float) params.opening_angle_charge_wgt };
60 } // LazyClusterParamsAlg::StartOpeningAngle()
cluster_params const & params
the parameters, already computed
double opening_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:42
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 89 of file LazyClusterParamsAlg.cxx.

References params, and cluster::cluster_params::sum_ADC.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

90 {
91  const double sumADC = params.sum_ADC;
92  return { (float) sumADC, (float) std::sqrt(sumADC) };
93 } // LazyClusterParamsAlg::SummedADC()
cluster_params const & params
the parameters, already computed
double sum_ADC
Sum charge of ADC counts of hits, in ADC.
Definition: ClusterParams.h:30
cluster::LazyClusterParamsAlg::Measure_t cluster::LazyClusterParamsAlg::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 98 of file LazyClusterParamsAlg.cxx.

References params, and cluster::cluster_params::rms_ADC.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

99 {
100  return { (float) params.rms_ADC };
101 } // LazyClusterParamsAlg::SummedADCStdDev()
double rms_ADC
RMS (standard deviation of sample) of ADC counts of hits in ADC.
Definition: ClusterParams.h:32
cluster_params const & params
the parameters, already computed
float cluster::LazyClusterParamsAlg::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 117 of file LazyClusterParamsAlg.cxx.

References params, and cluster::cluster_params::width.

Referenced by cluster::ClusterMergeHelper::AppendResult(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), and SetHits().

117  {
118  return params.width;
119 } // LazyClusterParamsAlg::Width()
cluster_params const & params
the parameters, already computed

Member Data Documentation

cluster_params const& cluster::LazyClusterParamsAlg::params
protected
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: