LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
StandardClusterParamsAlg.cxx
Go to the documentation of this file.
1 
10 // C/C++ standard library
11 
12 // LArSoft libraries
14 #include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h" // util::DegreesToRadians()
16 
17 //==============================================================================
18 //=== cluster::StandardClusterParamsAlg
19 
21 {
22  SetVerbose(0);
23 }
24 
25 //------------------------------------------------------------------------------
27 {
29  algo.SetVerbose(level > 0);
30 }
31 
32 //------------------------------------------------------------------------------
34 {
35  algo.Initialize();
36 }
37 
38 //------------------------------------------------------------------------------
40  util::GeometryUtilities const& gser,
41  std::vector<recob::Hit const*> const& hits)
42 {
43  Clear();
44  util::PxHitConverter pxhitconverter{gser};
45  algo.SetHits(pxhitconverter.ToPxHitVector(hits));
46 }
47 
48 //------------------------------------------------------------------------------
50  util::GeometryUtilities const& gser)
51 {
52  if (NInputHits() == 0) return {0.F};
53  return {(float)algo.StartCharge(gser)};
54 }
55 
56 //------------------------------------------------------------------------------
58  util::GeometryUtilities const& gser)
59 {
60  if (NInputHits() == 0) return {0.F};
61  return {(float)algo.EndCharge(gser)};
62 }
63 
64 //------------------------------------------------------------------------------
66 {
67  if (NInputHits() < 2) return {0.F};
68 
71 }
72 
73 //------------------------------------------------------------------------------
75 {
76  return StartAngle(); // Ummm...this doesn't look right. FIXME
77 }
78 
79 //------------------------------------------------------------------------------
81 {
82  if (NInputHits() < 3) return {0.F};
83 
85  return {(float)algo.GetParams().opening_angle_charge_wgt};
86 }
87 
88 //------------------------------------------------------------------------------
90 {
91  if (NInputHits() < 3) return {0.F};
92 
94  return {(float)algo.GetParams().closing_angle_charge_wgt};
95 }
96 
97 //------------------------------------------------------------------------------
99 {
100  if (NInputHits() == 0) return {0.F};
101 
102  algo.GetAverages();
103  return {(float)algo.GetParams().sum_charge};
104 }
105 
106 //------------------------------------------------------------------------------
108 {
109  if (NInputHits() < 2) return {0.F};
110 
111  algo.GetAverages();
112  return {(float)algo.GetParams().rms_charge};
113 }
114 
115 //------------------------------------------------------------------------------
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 }
125 
126 //------------------------------------------------------------------------------
128 {
129  if (NInputHits() < 2) return {0.F};
130 
131  algo.GetAverages();
132  return {(float)algo.GetParams().rms_ADC};
133 }
134 
135 //------------------------------------------------------------------------------
137 {
138  if (NInputHits() < 2) return NInputHits();
139 
140  algo.GetAverages();
141  return (size_t)algo.GetParams().N_Hits;
142 }
143 
144 //------------------------------------------------------------------------------
146 {
147  if (NInputHits() < 2) return 0.0F;
148 
149  algo.GetAverages();
151  0.;
152 }
153 
154 //------------------------------------------------------------------------------
156 {
157  if (NInputHits() < 3) return 0.0F;
158 
159  algo.GetProfileInfo(gser);
160  return algo.GetParams().width;
161 }
162 
163 //------------------------------------------------------------------------------
165 {
166  return algo.GetNHits();
167 }
double rms_ADC
RMS (standard deviation of sample) of ADC counts of hits in ADC.
Definition: ClusterParams.h:31
void GetRoughAxis(bool override=false)
double closing_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:43
Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
virtual void SetVerbose(int level=1)
Set the verbosity level.
double rms_charge
RMS (standard deviation of sample) of charge of hits in ADC.
Definition: ClusterParams.h:28
void GetProfileInfo(util::GeometryUtilities const &gser, bool override=false)
void SetVerbose(int level=1) override
Set the verbosity level.
Measure_t StartAngle() override
Computes the angle of the cluster.
Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
const cluster_params & GetParams() const
Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster hits.
double sum_charge
Sum charge of hits in ADC.
Definition: ClusterParams.h:26
void hits()
Definition: readHits.C:15
void SetHitsFromPointers(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits) override
Sets the list of input hits.
constexpr T DegreesToRadians(T angle)
Converts the argument angle from degrees into radians.
float Width(util::GeometryUtilities const &gser) override
Computes the width of the cluster.
ClusterParamsAlg algo
the actual algorithm class
Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
Measure_t EndCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.
Measure_t EndAngle() override
Computes the angle of the cluster.
double EndCharge(util::GeometryUtilities const &gser, float length=1., unsigned int nbins=10)
Returns the expected charge at the end of the cluster.
void GetAverages(bool override=false)
void RefineDirection(bool override=false)
float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
double sum_ADC
Sum charge of ADC counts of hits, in ADC.
Definition: ClusterParams.h:29
int SetHits(const std::vector< util::PxHit > &)
Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
double opening_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:41
size_t NHits() override
Returns the number of hits in the cluster.
Measure_t EndOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
void Clear() override
Restores the class to post-configuration, pre-initialization state.
size_t NInputHits() const
Returns the number of input hits.
Interface to class computing cluster parameters.
Collection of Physical constants used in LArSoft.
double cluster_angle_2d
Linear best fit to high-charge hits in the cluster.
Definition: ClusterParams.h:38
void SetVerbose(bool yes=true)
Measure_t StartCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.
double StartCharge(util::GeometryUtilities const &gser, float length=1., unsigned int nbins=10)
Returns the expected charge at the beginning of the cluster.