LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
StandardClusterParamsAlg.cxx
Go to the documentation of this file.
1 
10 // C/C++ standard library
11 #include <vector>
12 
13 // LArSoft libraries
14 #include "larcoreobj/SimpleTypesAndConstants/PhysicalConstants.h" // util::DegreesToRadians()
17 
18 
19 //==============================================================================
20 //=== cluster::StandardClusterParamsAlg
21 //===
22 
24  SetVerbose(0);
25 } // StandardClusterParamsAlg::StandardClusterParamsAlg()
26 
27 
28 //------------------------------------------------------------------------------
31  algo.SetVerbose(level > 0);
32 } // StandardClusterParamsAlg::SetVerbose()
33 
34 
35 //------------------------------------------------------------------------------
37  algo.Initialize();
38 } // StandardClusterParamsAlg::Clear()
39 
40 
41 //------------------------------------------------------------------------------
43  (std::vector<recob::Hit const*> const& hits)
44 {
45  Clear();
46  util::PxHitConverter pxhitconverter;
47  algo.SetHits(pxhitconverter.ToPxHitVector(hits));
48 } // StandardClusterParamsAlg::SetHits()
49 
50 
51 //------------------------------------------------------------------------------
54 {
55  if (NInputHits() == 0) return { 0.F };
56  return { (float) algo.StartCharge() };
57 } // StandardClusterParamsAlg::StartCharge()
58 
59 
60 //------------------------------------------------------------------------------
63 {
64  if (NInputHits() == 0) return { 0.F };
65  return { (float) algo.EndCharge() };
66 } // StandardClusterParamsAlg::EndCharge()
67 
68 
69 //------------------------------------------------------------------------------
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()
80 
81 
82 //------------------------------------------------------------------------------
85 {
86  return StartAngle();
87 } // StandardClusterParamsAlg::EndAngle()
88 
89 
90 //------------------------------------------------------------------------------
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()
101 
102 
103 //------------------------------------------------------------------------------
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()
114 
115 
116 //------------------------------------------------------------------------------
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()
127 
128 
129 //------------------------------------------------------------------------------
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()
140 
141 
142 //------------------------------------------------------------------------------
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()
154 
155 
156 //------------------------------------------------------------------------------
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()
167 
168 
169 //------------------------------------------------------------------------------
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()
178 
179 
180 //------------------------------------------------------------------------------
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()
190 
191 
192 //------------------------------------------------------------------------------
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()
201 
202 
203 //------------------------------------------------------------------------------
205  { return algo.GetNHits(); }
206 
double rms_ADC
RMS (standard deviation of sample) of ADC counts of hits in ADC.
Definition: ClusterParams.h:32
void GetRoughAxis(bool override=false)
void GetProfileInfo(bool override=false)
double closing_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:44
virtual Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
std::vector< util::PxHit > ToPxHitVector(Cont const &hits) const
Returns a vector of util::PxHit out of a vector of hits.
double EndCharge(float length=1., unsigned int nbins=10)
Returns the expected charge at the end of the cluster.
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
double StartCharge(float length=1., unsigned int nbins=10)
Returns the expected charge at the beginning of the cluster.
virtual void SetVerbose(int level=1) override
Set the verbosity level.
virtual Measure_t StartAngle() override
Computes the angle of the cluster.
virtual Measure_t StartCharge() override
Computes the charge on the first and last wire of the track.
virtual Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
const cluster_params & GetParams() const
virtual 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
void hits()
Definition: readHits.C:15
constexpr T DegreesToRadians(T angle)
Converts the argument angle from degrees into radians.
ClusterParamsAlg algo
the actual algorithm class
virtual Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
virtual Measure_t EndCharge() override
Computes the charge on the first and last wire of the track.
virtual Measure_t EndAngle() override
Computes the angle of the cluster.
void GetAverages(bool override=false)
void RefineDirection(bool override=false)
virtual 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 > &)
virtual Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
virtual void SetHits(std::vector< recob::Hit const * > const &hits) override
Sets the list of input hits.
double opening_angle_charge_wgt
Same for charge_wgt.
Definition: ClusterParams.h:42
virtual size_t NHits() override
Returns the number of hits in the cluster.
virtual Measure_t EndOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
virtual void Clear() override
Restores the class to post-configuration, pre-initialization state.
virtual float Width() override
Computes the width of the cluster.
size_t NInputHits() const
Returns the number of input hits.
Interface to class computing cluster parameters.
double cluster_angle_2d
Linear best fit to high-charge hits in the cluster.
Definition: ClusterParams.h:39
void SetVerbose(bool yes=true)