LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CFAlgoZOverlap.cxx
Go to the documentation of this file.
2 
3 namespace cmtool {
4 
5  //-------------------------------------------------------
7  //-------------------------------------------------------
8  {
9  _wire_ratio_cut = 0.1; //Preliminary cuts
10  }
11 
12  //-----------------------------
14  //-----------------------------
15  {}
16 
17  //----------------------------------------------------------------------------------------------
19  const std::vector<const cluster::ClusterParamsAlg*>& clusters)
20  //----------------------------------------------------------------------------------------------
21  {
22 
23  // This ensures the algorithm works only if # clusters is > 2 (and not =2)
24  // You may take out this block if you want to allow matching using clusters from only 2 planes.
25  if (clusters.size() == 2) return -1;
26 
27  double wire_distance = 0;
28  double ratio = 1;
29  double max_wire_distance = -1;
30 
31  //Record the start/end points that retunr the maximum wire distance
32  double max_end_w = -1;
33 
34  double start_w = 0;
35  double end_w = 0;
36  _verbose = true;
37 
38  for (auto const& c : clusters) {
39 
40  //...start_point.w in planes 0 and 1 returns a distance in slanted wire space (perp to slanted wires).
41  //Rotate this to properly compare to the other planes
42  if (c->Plane() != 2) {
43  start_w = 0.5 * c->GetParams().start_point.w;
44  end_w = 0.5 * c->GetParams().end_point.w;
45  wire_distance = end_w - start_w;
46  }
47  else {
48  start_w = c->GetParams().start_point.w;
49  end_w = c->GetParams().end_point.w;
50  wire_distance = c->GetParams().end_point.w - c->GetParams().start_point.w;
51  }
52 
53  if (wire_distance < 0) wire_distance *= -1;
54 
55  if (max_wire_distance < wire_distance) {
56  max_wire_distance = wire_distance;
57  //max_plane = c->Plane();
58  //max_start_w = start_w ;
59  max_end_w = end_w;
60  }
61  }
62 
63  //Calculate maximum z range(accounting for the slant in UV). Then compare start points. Similar
64  //in this sense, to time.
65 
66  for (auto const& c : clusters) {
67 
68  if (c->Plane() != 2) {
69  start_w = 0.5 * c->GetParams().start_point.w;
70  end_w = 0.5 * c->GetParams().end_point.w;
71  wire_distance = end_w - start_w;
72  }
73  else {
74  start_w = c->GetParams().start_point.w;
75  end_w = c->GetParams().end_point.w;
76  wire_distance = c->GetParams().end_point.w - c->GetParams().start_point.w;
77  }
78 
79  if (wire_distance < 0) wire_distance *= -1;
80 
81  if (start_w <= max_end_w) // && end_w+25 >=max_start_w )
82  ratio *= wire_distance / max_wire_distance;
83  else
84  ratio *= 0.1;
85 
86  if (_verbose && ratio > _wire_ratio_cut) {
87  std::cout << "\nThe wire distance for cluster in plane " << c->Plane()
88  << " is: " << wire_distance << std::endl;
89  std::cout << "Max wire disatance is: " << max_wire_distance << std::endl;
90  std::cout << "Ratio is: " << ratio << std::endl;
91  std::cout << "Start and end points: " << start_w << ", " << end_w << std::endl;
92  }
93  }
94  if (_verbose && ratio > _wire_ratio_cut)
95  std::cout << " FOOOOUUUUNNNND ONE WOooooooooooooooooooooooooooooooooooooooooooooooooo: "
96  << ratio << std::endl;
97 
98  return (ratio > _wire_ratio_cut ? ratio : -1);
99  }
100 
101  //------------------------------
103  //------------------------------
104  {}
105 
106 }
Class def header for a class CFAlgoZOverlap.
void Reset() override
Function to reset the algorithm instance, called together with manager&#39;s Reset()
CFAlgoZOverlap()
Default constructor.
float Float(util::GeometryUtilities const &, const std::vector< const cluster::ClusterParamsAlg * > &clusters) override
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:82