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 
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 
91 }
92 
93 //------------------------------------------------------------------------------
96 {
97  if (NInputHits() < 3) return {0.F};
98 
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();
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 }
double rms_ADC
RMS (standard deviation of sample) of ADC counts of hits in ADC.
Definition: ClusterParams.h:32
void GetRoughAxis(bool override=false)
double closing_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:44
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:29
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:27
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()
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
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:30
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:42
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.
ClusterParamsAlgBase::Measure_t Measure_t
double cluster_angle_2d
Linear best fit to high-charge hits in the cluster.
Definition: ClusterParams.h:39
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.