ViewMatchAlg.h
Go to the documentation of this file.
1 ///
2 /// \file ViewMatchAlg.h
3 /// \brief Algorithm to handle 3d matching of prongs from FuzzyKVertex
4 /// \version $Id: ViewMatchAlg.h,v 1.3 2012-11-05 22:36:04 edniner Exp $
5 /// \author eniner@indiana.edu
6 ///
7 #ifndef FUZZ_VIEWMATCHALG_H
8 #define FUZZ_VIEWMATCHALG_H
9 
10 #include "fhiclcpp/types/Atom.h"
11 
13 #include "TVector3.h"
14 
15 namespace rb
16 {
17  class Cluster;
18  class Prong;
19 }
20 
21 namespace fuzz {
23  {
24  template<class T> using Atom = fhicl::Atom<T>;
26  using Name = fhicl::Name;
27 
28  // There are actually no configurable parameters as yet...
29  };
30 
32  {
33  public:
34  explicit ViewMatchAlg(const ViewMatchParams& params);
35  ~ViewMatchAlg();
36 
37  /// \brief Function to load the vector of 2d prongs to be matched
38  /// \param prongs Collection of prongs to match
39  void LoadProngs(std::vector<rb::Prong> prongs);
40 
41  /// \brief Function to perform the view matching
42  void Matching();
43 
44  /// \brief Function to calculate the cumulative energy profile of a test prong
45  /// \param testprong The 3D candidate prong being considered for a match
46  /// \param dir The direction vector for the test prong
47  /// \param start The startpoint of the energy distribution (usually the vertex)
48  /// \param totpecorr The total PECorr for the prong in a given view
49  /// \param v The view, either kX or kY of the prong
50  /// Function returns a sorted list of point pairs distance,pecorr showing the deposition of energy as a function of distance from the vertex
51  std::vector<std::pair<double, double> > CalcEnergyProfile(rb::Prong testprong, TVector3 dir, TVector3 start, double *totpecorr, geo::View_t v);
52 
53  /// \brief Function to combine a 2d prong from each view into a 3d test prong to compute a matching score for
54  /// \param xprong Input prong from the XZ view
55  /// \param yprong Input prong from the YZ view
56  /// \param newdir Pointer to the new 3vector direction of the candidate
57  /// \param vert Pointer to the 3vector vertex of the new prong
58  rb::Prong MakeTestProng(rb::Prong& xprong, rb::Prong& yprong, TVector3* newdir, TVector3* vert);
59 
60  /// \brief Function to perform the Kuiper test to compare the energy profiles of the track in each view
61  /// \param xlist Sorted list of (distance_to_vertex,pecorr) for the track in the xz view
62  /// \param ylist Sorted list of (distance_to_vertex,pecorr) for the track in the yz view
63  /// \param shift Base distance to shift the track in one view to better align the profiles
64  /// \param xpecorr The total pecorr in XZ view for the track
65  /// \param ypecorr The total pecorr in YZ view for the track
66  double KuiperTest(std::vector<std::pair<double,double>> xlist, std::vector<std::pair<double,double>> ylist, double shift, double xpecorr, double ypecorr);
67 
68  public:
69 
70  /// Container for all the candidate XZ prongs
71  std::vector<rb::Prong> fXProngs;
72 
73  /// Container for all the candidate YZ prongs
74  std::vector<rb::Prong> fYProngs;
75 
76  /// Container for all the 3D prongs produced after matching
77  std::vector<rb::Prong> fMatchedProngs;
78 
79  /// Container for all the unmatched 2D prongs left over
80  std::vector<rb::Prong> fUnmatchedProngs;
81 
82 
83  /// store information related to the view matching for a summary ntuple
84  std::vector<int> xzid;
85  std::vector<int> yzid;
86  std::vector<double> ksscore;
87  std::vector<double> ksshift;
88  std::vector<std::vector<double>> xzs;
89  std::vector<std::vector<double>> yzs;
90  std::vector<std::vector<double>> xzpe;
91  std::vector<std::vector<double>> yzpe;
92 
93  };
94 }
95 
96 
97 #endif
98 ////////////////////////////////////////////////////////////////////////
std::vector< rb::Prong > fYProngs
Container for all the candidate YZ prongs.
Definition: ViewMatchAlg.h:74
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< rb::Prong > fMatchedProngs
Container for all the 3D prongs produced after matching.
Definition: ViewMatchAlg.h:77
Fuzzy k-Means prong-finding algorithm.
Perform a "2 point" Hough transform on a collection of hits.
std::vector< std::vector< double > > yzpe
Definition: ViewMatchAlg.h:91
A Cluster with defined start position and direction.
Definition: Prong.h:19
std::vector< double > ksshift
Definition: ViewMatchAlg.h:87
TDirectory * dir
Definition: macro.C:5
std::vector< rb::Prong > fXProngs
Container for all the candidate XZ prongs.
Definition: ViewMatchAlg.h:71
std::vector< int > xzid
store information related to the view matching for a summary ntuple
Definition: ViewMatchAlg.h:84
std::vector< rb::Prong > fUnmatchedProngs
Container for all the unmatched 2D prongs left over.
Definition: ViewMatchAlg.h:80
std::vector< double > ksscore
Definition: ViewMatchAlg.h:86
std::vector< std::vector< double > > xzpe
Definition: ViewMatchAlg.h:90
std::vector< std::vector< double > > yzs
Definition: ViewMatchAlg.h:89
std::vector< std::vector< double > > xzs
Definition: ViewMatchAlg.h:88
std::vector< int > yzid
Definition: ViewMatchAlg.h:85