LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RPhiFeatureTool.h
Go to the documentation of this file.
1 
8 #ifndef LAR_RPHI_FEATURE_TOOL_H
9 #define LAR_RPHI_FEATURE_TOOL_H 1
10 
12 
14 
15 namespace lar_content
16 {
17 
22 {
23 public:
28 
40  void Run(LArMvaHelper::MvaFeatureVector &featureVector, const VertexSelectionBaseAlgorithm *const pAlgorithm,
43  const VertexSelectionBaseAlgorithm::ShowerClusterListMap &, const float beamDeweightingScore, float &bestFastScore);
44 
45 private:
50  {
51  public:
57  KernelEstimate(const float sigma);
58 
66  float Sample(const float x) const;
67 
68  typedef std::multimap<float, float> ContributionList;
69 
75  const ContributionList &GetContributionList() const;
76 
82  float GetSigma() const;
83 
90  void AddContribution(const float x, const float weight);
91 
92  private:
93  ContributionList m_contributionList;
94  const float m_sigma;
95  };
96 
97  //--------------------------------------------------------------------------------------------------------------------------------------
98 
99  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
100 
110  float GetFastScore(const KernelEstimate &kernelEstimateU, const KernelEstimate &kernelEstimateV, const KernelEstimate &kernelEstimateW) const;
111 
121  float GetMidwayScore(const KernelEstimate &kernelEstimateU, const KernelEstimate &kernelEstimateV, const KernelEstimate &kernelEstimateW) const;
122 
132  float GetFullScore(const KernelEstimate &kernelEstimateU, const KernelEstimate &kernelEstimateV, const KernelEstimate &kernelEstimateW) const;
133 
142  void FillKernelEstimate(const pandora::Vertex *const pVertex, const pandora::HitType hitType,
143  VertexSelectionBaseAlgorithm::HitKDTree2D &kdTree, KernelEstimate &kernelEstimate) const;
144 
153  bool AcceptVertexLocation(const pandora::Vertex *const pVertex, const pandora::VertexList &selectedVertexList) const;
154 
163  float atan2Fast(const float y, const float x) const;
164 
167  bool m_fullScore;
168 
170  float m_kappa;
172 
174  unsigned int m_fastHistogramNPhiBins;
177 
179 };
180 
181 //------------------------------------------------------------------------------------------------------------------------------------------
182 
184  m_sigma(sigma)
185 {
186  if (m_sigma < std::numeric_limits<float>::epsilon())
187  throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
188 }
189 
190 //------------------------------------------------------------------------------------------------------------------------------------------
191 
193 {
194  return m_contributionList;
195 }
196 
197 //------------------------------------------------------------------------------------------------------------------------------------------
198 
200 {
201  return m_sigma;
202 }
203 
204 } // namespace lar_content
205 
206 #endif // #ifndef LAR_RPHI_FEATURE_TOOL_H
Float_t x
Definition: compare.C:6
bool m_fastScoreCheck
Whether to use the fast histogram based score to selectively avoid calling full or midway scores...
Header file for the kd tree linker algo template class.
bool AcceptVertexLocation(const pandora::Vertex *const pVertex, const pandora::VertexList &selectedVertexList) const
Whether to accept a candidate vertex, based on its spatial position in relation to other selected can...
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:75
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const VertexSelectionBaseAlgorithm *const pAlgorithm, const pandora::Vertex *const pVertex, const VertexSelectionBaseAlgorithm::SlidingFitDataListMap &, const VertexSelectionBaseAlgorithm::ClusterListMap &, const VertexSelectionBaseAlgorithm::KDTreeMap &kdTreeMap, const VertexSelectionBaseAlgorithm::ShowerClusterListMap &, const float beamDeweightingScore, float &bestFastScore)
Run the tool.
unsigned int m_fastHistogramNPhiBins
Number of bins to use for fast score histograms.
Float_t y
Definition: compare.C:6
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_fastHistogramPhiMin
Min value for fast score histograms.
RPhiFeatureTool class.
float m_kappa
Hit-deweighting offset, of form: weight = 1 / sqrt(distance + kappa), units cm.
float GetSigma() const
Get the assigned width.
bool m_fastScoreOnly
Whether to use the fast histogram based score only.
const ContributionList & GetContributionList() const
Get the contribution list.
float m_minFastScoreFraction
Fast score must be at least this fraction of best fast score to calculate full score.
float atan2Fast(const float y, const float x) const
Fast estimate of std::atan2 function. Rather coarse (max |error| > 0.01) but should suffice for this ...
std::map< pandora::HitType, const ShowerClusterList > ShowerClusterListMap
Map of shower cluster lists for passing to tools.
float GetFastScore(const KernelEstimate &kernelEstimateU, const KernelEstimate &kernelEstimateV, const KernelEstimate &kernelEstimateW) const
Get the score for a trio of kernel estimations, using fast histogram approach.
float Sample(const float x) const
Sample the parameterised distribution at a specified x coordinate.
float m_maxHitVertexDisplacement1D
Max hit-vertex displacement in any one dimension for contribution to kernel estimation.
KernelEstimate(const float sigma)
Constructor.
float GetFullScore(const KernelEstimate &kernelEstimateU, const KernelEstimate &kernelEstimateV, const KernelEstimate &kernelEstimateW) const
Get the score for a trio of kernel estimations, using kernel density estimation and full hit-by-hit s...
float m_fastHistogramPhiMax
Max value for fast score histograms.
bool m_fullScore
Whether to use the full kernel density estimation score, as opposed to the midway score...
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
float m_kernelEstimateSigma
The Gaussian width to use for kernel estimation.
Header file for the vertex selection base algorithm class.
bool m_enableFolding
Whether to enable folding of -pi -> +pi phi distribution into 0 -> +pi region only.
RPhiFeatureTool()
Default constructor.
double weight
Definition: plottest35.C:25
ContributionList m_contributionList
The contribution list.
std::map< pandora::HitType, const SlidingFitDataList > SlidingFitDataListMap
Map of sliding fit data lists for passing to tools.
HitType
Definition: HitType.h:12
float GetMidwayScore(const KernelEstimate &kernelEstimateU, const KernelEstimate &kernelEstimateV, const KernelEstimate &kernelEstimateW) const
Get the score for a trio of kernel estimations, using kernel density estimation but with reduced (bin...
void FillKernelEstimate(const pandora::Vertex *const pVertex, const pandora::HitType hitType, VertexSelectionBaseAlgorithm::HitKDTree2D &kdTree, KernelEstimate &kernelEstimate) const
Use hits in clusters (in the provided kd tree) to fill a provided kernel estimate with hit-vertex rel...
void AddContribution(const float x, const float weight)
Add a contribution to the distribution.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::multimap< float, float > ContributionList
Map from x coord to weight, ATTN avoid map.find, etc. with float key.
std::map< pandora::HitType, const std::reference_wrapper< HitKDTree2D > > KDTreeMap
Map array of hit kd trees for passing to tools.
MvaFeatureTool class template.
Definition: LArMvaHelper.h:33
std::list< Vertex > VertexList
Definition: DCEL.h:169
const float m_sigma
The assigned width.