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