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