LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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...
 
virtual ~CFAlgoZOverlap ()
 Default destructor. More...
 
virtual float Float (const std::vector< const cluster::ClusterParamsAlg * > &clusters)
 
virtual void Report ()
 
virtual void Reset ()
 Function to reset the algorithm instance, called together with manager's Reset() More...
 
virtual void EventBegin (const std::vector< cluster::ClusterParamsAlg > &clusters)
 
virtual void EventEnd ()
 
virtual void IterationBegin (const std::vector< cluster::ClusterParamsAlg > &clusters)
 
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 9 of file CFAlgoZOverlap.cxx.

References _wire_ratio_cut.

10  //-------------------------------------------------------
11  {
12  _wire_ratio_cut = 0.1 ; //Preliminary cuts
13  }
CFloatAlgoBase()
Default constructor.
virtual cmtool::CFAlgoZOverlap::~CFAlgoZOverlap ( )
inlinevirtual

Default destructor.

Definition at line 33 of file CFAlgoZOverlap.h.

References Float(), Report(), and Reset().

33 {};

Member Function Documentation

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

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

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

Definition at line 45 of file CMAlgoBase.h.

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

46  { if(clusters.size()) return; }
virtual void cmtool::CMAlgoBase::EventEnd ( )
inlinevirtualinherited

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

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

Definition at line 51 of file CMAlgoBase.h.

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

52  {return;}
float cmtool::CFAlgoZOverlap::Float ( const std::vector< const cluster::ClusterParamsAlg * > &  clusters)
virtual

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

Reimplemented from cmtool::CFloatAlgoBase.

Definition at line 23 of file CFAlgoZOverlap.cxx.

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

Referenced by ~CFAlgoZOverlap().

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

Definition at line 59 of file CMAlgoBase.h.

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

60  { if(clusters.size()) return;}
virtual void cmtool::CMAlgoBase::IterationEnd ( )
inlinevirtualinherited

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

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

Definition at line 65 of file CMAlgoBase.h.

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

66  {return; }
void cmtool::CFAlgoZOverlap::Report ( )
virtual

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 117 of file CFAlgoZOverlap.cxx.

Referenced by ~CFAlgoZOverlap().

119  {
120 
121  }
void cmtool::CFAlgoZOverlap::Reset ( )
virtual

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 16 of file CFAlgoZOverlap.cxx.

Referenced by ~CFAlgoZOverlap().

18  {
19 
20  }
void cmtool::CMAlgoBase::SetAnaFile ( TFile *  fout)
inlineinherited

Setter function for an output plot TFile pointer.

Definition at line 77 of file CMAlgoBase.h.

References cmtool::CMAlgoBase::_fout.

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

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

Member Data Documentation

TFile* cmtool::CMAlgoBase::_fout
protectedinherited

TFile pointer to an output file.

Definition at line 85 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 79 of file CFAlgoZOverlap.h.

Referenced by CFAlgoZOverlap(), and Float().


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