All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StandardClusterParamsAlg.cxx
Go to the documentation of this file.
1 /** ****************************************************************************
2  * @file StandardClusterParamsAlg.cxx
3  * @brief Implementation of interface to class computing cluster parameters
4  * @author petrillo@fnal.gov
5  * @date January 22, 2015
6  * @see StandardClusterParamsAlg.h
7  *
8  * ****************************************************************************/
9 
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 //------------------------------------------------------------------------------
26 void
28 {
30  algo.SetVerbose(level > 0);
31 }
32 
33 //------------------------------------------------------------------------------
34 void
36 {
37  algo.Initialize();
38 }
39 
40 //------------------------------------------------------------------------------
41 void
43  std::vector<recob::Hit const*> const& hits)
44 {
45  Clear();
46  util::PxHitConverter pxhitconverter{gser};
47  algo.SetHits(pxhitconverter.ToPxHitVector(hits));
48 }
49 
50 //------------------------------------------------------------------------------
53 {
54  if (NInputHits() == 0) return {0.F};
55  return {(float)algo.StartCharge(gser)};
56 }
57 
58 //------------------------------------------------------------------------------
61 {
62  if (NInputHits() == 0) return {0.F};
63  return {(float)algo.EndCharge(gser)};
64 }
65 
66 //------------------------------------------------------------------------------
69 {
70  if (NInputHits() < 2) return {0.F};
71 
72  algo.GetRoughAxis();
73  return {(float)util::DegreesToRadians(algo.GetParams().cluster_angle_2d)};
74 }
75 
76 //------------------------------------------------------------------------------
79 {
80  return StartAngle(); // Ummm...this doesn't look right. FIXME
81 }
82 
83 //------------------------------------------------------------------------------
86 {
87  if (NInputHits() < 3) return {0.F};
88 
89  algo.RefineDirection();
90  return {(float)algo.GetParams().opening_angle_charge_wgt};
91 }
92 
93 //------------------------------------------------------------------------------
96 {
97  if (NInputHits() < 3) return {0.F};
98 
99  algo.RefineDirection();
100  return {(float)algo.GetParams().closing_angle_charge_wgt};
101 }
102 
103 //------------------------------------------------------------------------------
106 {
107  if (NInputHits() == 0) return {0.F};
108 
109  algo.GetAverages();
110  return {(float)algo.GetParams().sum_charge};
111 }
112 
113 //------------------------------------------------------------------------------
116 {
117  if (NInputHits() < 2) return {0.F};
118 
119  algo.GetAverages();
120  return {(float)algo.GetParams().rms_charge};
121 }
122 
123 //------------------------------------------------------------------------------
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 }
134 
135 //------------------------------------------------------------------------------
138 {
139  if (NInputHits() < 2) return {0.F};
140 
141  algo.GetAverages();
142  return {(float)algo.GetParams().rms_ADC};
143 }
144 
145 //------------------------------------------------------------------------------
146 size_t
148 {
149  if (NInputHits() < 2) return NInputHits();
150 
151  algo.GetAverages();
152  return (size_t)algo.GetParams().N_Hits;
153 }
154 
155 //------------------------------------------------------------------------------
156 float
158 {
159  if (NInputHits() < 2) return 0.0F;
160 
161  algo.GetAverages();
162  return algo.GetParams().N_Wires ? algo.GetParams().multi_hit_wires / algo.GetParams().N_Wires :
163  0.;
164 }
165 
166 //------------------------------------------------------------------------------
167 float
169 {
170  if (NInputHits() < 3) return 0.0F;
171 
172  algo.GetProfileInfo(gser);
173  return algo.GetParams().width;
174 }
175 
176 //------------------------------------------------------------------------------
177 size_t
179 {
180  return algo.GetNHits();
181 }
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.
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.
Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster 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.
Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits) override
Sets the list of input hits.
Measure_t EndCharge(util::GeometryUtilities const &gser) override
float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
size_t NHits() override
Returns the number of hits in 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.
Measure_t StartCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.