LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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...
 
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
 
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.

References _wire_ratio_cut.

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

Member Function Documentation

virtual void cmtool::CMAlgoBase::EventBegin ( const std::vector< cluster::ClusterParamsAlg > &  )
inlinevirtualinherited

Optional function: called at the beginning of 1st iteration. This is called per event.

Reimplemented in cmtool::CPAlgoArray, cmtool::CBAlgoArray, and cmtool::CBAlgoPolyShortestDist.

Definition at line 45 of file CMAlgoBase.h.

Referenced by cmtool::CMergeManager::EventBegin().

45 {}
virtual void cmtool::CMAlgoBase::EventEnd ( )
inlinevirtualinherited

Optional function: called at the end of event ... after the last merging iteration is over.

Reimplemented in cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 50 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::EventEnd(), and cmtool::CMergeManager::EventEnd().

50 {}
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 18 of file CFAlgoZOverlap.cxx.

References cmtool::CMAlgoBase::_verbose, and _wire_ratio_cut.

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  }
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:82
virtual void cmtool::CMAlgoBase::IterationBegin ( const std::vector< cluster::ClusterParamsAlg > &  )
inlinevirtualinherited

Optional function: called at the beggining of each iteration over all pairs of clusters. 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.

Reimplemented in cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 57 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::EventBegin(), cmtool::CMatchManager::IterationBegin(), and cmtool::CMergeManager::IterationBegin().

57 {}
virtual void cmtool::CMAlgoBase::IterationEnd ( )
inlinevirtualinherited

Optional function: called at the end of each iteration over all pairs of clusters.

Reimplemented in cmtool::CPAlgoArray, and cmtool::CBAlgoArray.

Definition at line 62 of file CMAlgoBase.h.

Referenced by cmtool::CMatchManager::IterationEnd(), and cmtool::CMergeManager::IterationEnd().

62 {}
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 102 of file CFAlgoZOverlap.cxx.

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

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 13 of file CFAlgoZOverlap.cxx.

15  {}
void cmtool::CMAlgoBase::SetAnaFile ( TFile *  fout)
inlineinherited

Setter function for an output plot TFile pointer.

Definition at line 72 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_fout.

Referenced by cmtool::CMergeManager::EventBegin().

72 { _fout = fout; }
TFile * _fout
TFile pointer to an output file.
Definition: CMAlgoBase.h:79
virtual void cmtool::CMAlgoBase::SetVerbose ( bool  doit = true)
inlinevirtualinherited

Setter function for verbosity.

Reimplemented in cmtool::CBAlgoArray, and cmtool::CFAlgoTimeOverlap.

Definition at line 75 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_verbose.

Referenced by cmtool::CMatchManager::EventBegin(), and cmtool::CMergeManager::EventBegin().

75 { _verbose = doit; }
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:82

Member Data Documentation

TFile* cmtool::CMAlgoBase::_fout
protectedinherited

TFile pointer to an output file.

Definition at line 79 of file CMAlgoBase.h.

Referenced by cmtool::CMAlgoBase::CMAlgoBase(), and cmtool::CMAlgoBase::SetAnaFile().

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.

Referenced by CFAlgoZOverlap(), and Float().


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