LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::RPhiFeatureTool::KernelEstimate Class Reference

Kernel estimate class. More...

Public Types

typedef std::multimap< float, float > ContributionList
 Map from x coord to weight, ATTN avoid map.find, etc. with float key. More...
 

Public Member Functions

 KernelEstimate (const float sigma)
 Constructor. More...
 
float Sample (const float x) const
 Sample the parameterised distribution at a specified x coordinate. More...
 
const ContributionListGetContributionList () const
 Get the contribution list. More...
 
float GetSigma () const
 Get the assigned width. More...
 
void AddContribution (const float x, const float weight)
 Add a contribution to the distribution. More...
 

Private Attributes

ContributionList m_contributionList
 The contribution list. More...
 
const float m_sigma
 The assigned width. More...
 

Detailed Description

Kernel estimate class.

Definition at line 49 of file RPhiFeatureTool.h.

Member Typedef Documentation

Map from x coord to weight, ATTN avoid map.find, etc. with float key.

Definition at line 68 of file RPhiFeatureTool.h.

Constructor & Destructor Documentation

lar_content::RPhiFeatureTool::KernelEstimate::KernelEstimate ( const float  sigma)
inline

Constructor.

Parameters
sigmathe width associated with the kernel estimate

Definition at line 182 of file RPhiFeatureTool.h.

References m_sigma.

182  :
183  m_sigma(sigma)
184 {
185  if (m_sigma < std::numeric_limits<float>::epsilon())
186  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
187 }
const float m_sigma
The assigned width.

Member Function Documentation

void lar_content::RPhiFeatureTool::KernelEstimate::AddContribution ( const float  x,
const float  weight 
)

Add a contribution to the distribution.

Parameters
xthe position
weightthe weight

Definition at line 239 of file RPhiFeatureTool.cc.

Referenced by lar_content::RPhiFeatureTool::FillKernelEstimate().

240 {
241  m_contributionList.insert(ContributionList::value_type(x, weight));
242 }
Float_t x
Definition: compare.C:6
double weight
Definition: plottest35.C:25
ContributionList m_contributionList
The contribution list.
const RPhiFeatureTool::KernelEstimate::ContributionList & lar_content::RPhiFeatureTool::KernelEstimate::GetContributionList ( ) const
inline

Get the contribution list.

Returns
the contribution list

Definition at line 191 of file RPhiFeatureTool.h.

References m_contributionList.

Referenced by lar_content::RPhiFeatureTool::GetFastScore(), lar_content::RPhiFeatureTool::GetFullScore(), and lar_content::RPhiFeatureTool::GetMidwayScore().

192 {
193  return m_contributionList;
194 }
ContributionList m_contributionList
The contribution list.
float lar_content::RPhiFeatureTool::KernelEstimate::GetSigma ( ) const
inline

Get the assigned width.

Returns
the assigned width

Definition at line 198 of file RPhiFeatureTool.h.

References m_sigma.

199 {
200  return m_sigma;
201 }
const float m_sigma
The assigned width.
float lar_content::RPhiFeatureTool::KernelEstimate::Sample ( const float  x) const

Sample the parameterised distribution at a specified x coordinate.

Parameters
xthe position at which to sample
Returns
the sample value

Definition at line 218 of file RPhiFeatureTool.cc.

References f.

Referenced by lar_content::RPhiFeatureTool::GetFullScore(), and lar_content::RPhiFeatureTool::GetMidwayScore().

219 {
220  const ContributionList &contributionList(this->GetContributionList());
221  ContributionList::const_iterator lowerIter(contributionList.lower_bound(x - 3.f * m_sigma));
222  ContributionList::const_iterator upperIter(contributionList.upper_bound(x + 3.f * m_sigma));
223 
224  float sample(0.f);
225  const float gaussConstant(1.f / std::sqrt(2.f * M_PI * m_sigma * m_sigma));
226 
227  for (ContributionList::const_iterator iter = lowerIter; iter != upperIter; ++iter)
228  {
229  const float deltaSigma((x - iter->first) / m_sigma);
230  const float gaussian(gaussConstant * std::exp(-0.5f * deltaSigma * deltaSigma));
231  sample += iter->second * gaussian;
232  }
233 
234  return sample;
235 }
Float_t x
Definition: compare.C:6
const ContributionList & GetContributionList() const
Get the contribution list.
TFile f
Definition: plotHisto.C:6
intermediate_table::const_iterator const_iterator
std::multimap< float, float > ContributionList
Map from x coord to weight, ATTN avoid map.find, etc. with float key.
const float m_sigma
The assigned width.

Member Data Documentation

ContributionList lar_content::RPhiFeatureTool::KernelEstimate::m_contributionList
private

The contribution list.

Definition at line 93 of file RPhiFeatureTool.h.

Referenced by GetContributionList().

const float lar_content::RPhiFeatureTool::KernelEstimate::m_sigma
private

The assigned width.

Definition at line 94 of file RPhiFeatureTool.h.

Referenced by GetSigma(), and KernelEstimate().


The documentation for this class was generated from the following files: