All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
cmtool::CFAlgoZOverlap Class Reference

#include <CFAlgoZOverlap.h>

Inheritance diagram for cmtool::CFAlgoZOverlap:
cmtool::CFloatAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CFAlgoZOverlap ()
 Default constructor. More...
 
float Float (util::GeometryUtilities const &, const std::vector< const cluster::ClusterParamsAlg * > &clusters) override
 
void Report () override
 
void Reset () override
 Function to reset the algorithm instance, called together with manager's Reset() More...
 
- Public Member Functions inherited from cmtool::CMAlgoBase
 CMAlgoBase ()
 
virtual ~CMAlgoBase ()=default
 
virtual void EventBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void EventEnd ()
 
virtual void IterationBegin (const std::vector< cluster::ClusterParamsAlg > &)
 
virtual void IterationEnd ()
 
void SetAnaFile (TFile *fout)
 Setter function for an output plot TFile pointer. More...
 
virtual void SetVerbose (bool doit=true)
 Setter function for verbosity. More...
 

Protected Attributes

float _wire_ratio_cut
 
- Protected Attributes inherited from cmtool::CMAlgoBase
TFile * _fout
 TFile pointer to an output file. More...
 
bool _verbose
 Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager's verbosity level is >= kPerMerging. More...
 

Detailed Description

User implementation for CFloatAlgoBase class doxygen documentation!

Definition at line 25 of file CFAlgoZOverlap.h.

Constructor & Destructor Documentation

cmtool::CFAlgoZOverlap::CFAlgoZOverlap ( )

Default constructor.

Definition at line 6 of file CFAlgoZOverlap.cxx.

8  {
9  _wire_ratio_cut = 0.1; //Preliminary cuts
10  }

Member Function Documentation

float cmtool::CFAlgoZOverlap::Float ( util::GeometryUtilities const &  ,
const std::vector< const cluster::ClusterParamsAlg * > &  clusters 
)
overridevirtual

Core function: given a set of CPANs, return a float which indicates the compatibility the cluster combination.

Reimplemented from cmtool::CFloatAlgoBase.

Definition at line 20 of file CFAlgoZOverlap.cxx.

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  }
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is &gt;= kPer...
Definition: CMAlgoBase.h:102
BEGIN_PROLOG could also be cout
void cmtool::CFAlgoZOverlap::Report ( )
overridevirtual

Optional function: called after each iterative approach if a manager class is run with verbosity level <= kPerIteration. Maybe useful for debugging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 105 of file CFAlgoZOverlap.cxx.

107  {}
void cmtool::CFAlgoZOverlap::Reset ( )
overridevirtual

Function to reset the algorithm instance, called together with manager's Reset()

Reimplemented from cmtool::CMAlgoBase.

Definition at line 14 of file CFAlgoZOverlap.cxx.

16  {}

Member Data Documentation

float cmtool::CFAlgoZOverlap::_wire_ratio_cut
protected

Optional function: called at the beginning of 1st iteration. This is called per event. Optional function: called at the end of event ... after the last merging iteration is over. Optional function: called at the beggining of each iterative loop. This provides all clusters' information in case the algorithm need them. Note this is called per iteration which may be more than once per event. Optional function: called at the end of each iterative loop.

Definition at line 76 of file CFAlgoZOverlap.h.


The documentation for this class was generated from the following files: