LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
cmtool::CBAlgoStartNearEnd Class Reference

#include "CBAlgoStartNearEnd.h"

Inheritance diagram for cmtool::CBAlgoStartNearEnd:
cmtool::CBoolAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CBAlgoStartNearEnd ()
 Default constructor. More...
 
virtual ~CBAlgoStartNearEnd ()
 Default destructor. More...
 
void SetMaxStartEndSeparation (double d)
 
void SetMaxAngle (double a)
 
void SetMinHits (size_t n)
 
virtual bool Bool (const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
 
virtual void Reset ()
 Function to reset the algorithm instance ... maybe implemented via child class. More...
 
virtual void Report ()
 Function to report what's going on per merging. 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

double _maxopeningangle
 
double _separation
 
size_t _MinHits
 
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

Merge if start point of one is near end point of another and require angle compatibility

Definition at line 26 of file CBAlgoStartNearEnd.h.

Constructor & Destructor Documentation

cmtool::CBAlgoStartNearEnd::CBAlgoStartNearEnd ( )

Default constructor.

Definition at line 9 of file CBAlgoStartNearEnd.cxx.

References SetMaxAngle(), SetMaxStartEndSeparation(), and SetMinHits().

9  : CBoolAlgoBase()
10  //----------------------------------------
11  {
12  SetMaxStartEndSeparation(10); //cm^2
13  SetMinHits(40); //cm^2
14  SetMaxAngle(20*(3.14/180)); //rad: max angle of end-point cluster
15  // Nothing to be done in the base class
16  }
CBoolAlgoBase()
Default constructor.
Definition: CBoolAlgoBase.h:32
void SetMaxStartEndSeparation(double d)
virtual cmtool::CBAlgoStartNearEnd::~CBAlgoStartNearEnd ( )
inlinevirtual

Default destructor.

Definition at line 34 of file CBAlgoStartNearEnd.h.

34 {};

Member Function Documentation

bool cmtool::CBAlgoStartNearEnd::Bool ( const ::cluster::ClusterParamsAlg cluster1,
const ::cluster::ClusterParamsAlg cluster2 
)
virtual

Core function: given the CPAN input, return whether a cluster should be merged or not.

Reimplemented from cmtool::CBoolAlgoBase.

Definition at line 19 of file CBAlgoStartNearEnd.cxx.

References _maxopeningangle, _MinHits, _separation, and cmtool::CMAlgoBase::_verbose.

Referenced by SetMinHits().

22  {
23 
24  double start_w1 = cluster1.GetParams().start_point.w;
25  double start_t1 = cluster1.GetParams().start_point.t;
26  double end_w1 = cluster1.GetParams().end_point.w;
27  double end_t1 = cluster1.GetParams().end_point.t;
28 
29  double start_w2 = cluster2.GetParams().start_point.w;
30  double start_t2 = cluster2.GetParams().start_point.t;
31  double end_w2 = cluster2.GetParams().end_point.w;
32  double end_t2 = cluster2.GetParams().end_point.t;
33 
34  double angle_1 = cluster1.GetParams().opening_angle;
35  double angle_2 = cluster2.GetParams().opening_angle;
36 
37  size_t hits_1 = cluster1.GetHitVector().size();
38  size_t hits_2 = cluster2.GetHitVector().size();
39 
40 
41  if ( (angle_1 < _maxopeningangle) and (hits_1 > _MinHits) and
42  ( ((start_w2-end_w1)*(start_w2-end_w1) +
43  (start_t2-end_t1)*(start_t2-end_t1)) < _separation) ){
44  if (_verbose)
45  std::cout << "Start in End!" << std::endl;
46  return true;
47  }
48 
49  if ( (angle_2 < _maxopeningangle) and (hits_2 > _MinHits) and
50  ( ((start_w1-end_w2)*(start_w1-end_w2) +
51  (start_t1-end_t2)*(start_t1-end_t2)) < _separation) ){
52  if (_verbose)
53  std::cout << "Start in End!" << std::endl;
54  return true;
55  }
56 
57  return false;
58 
59  }
const cluster_params & GetParams() const
double t
Definition: PxUtils.h:11
const std::vector< util::PxHit > & GetHitVector() const
util::PxPoint start_point
start point
Definition: ClusterParams.h:24
double w
Definition: PxUtils.h:10
util::PxPoint end_point
end point
Definition: ClusterParams.h:25
double opening_angle
Width of angular distubtion wrt vertx.
Definition: ClusterParams.h:41
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::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;}
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::CBAlgoStartNearEnd::Report ( )
virtual

Function to report what's going on per merging.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 62 of file CBAlgoStartNearEnd.cxx.

Referenced by Reset().

64  {
65  }
virtual void cmtool::CBAlgoStartNearEnd::Reset ( )
inlinevirtual

Function to reset the algorithm instance ... maybe implemented via child class.

Reimplemented from cmtool::CMAlgoBase.

Definition at line 51 of file CBAlgoStartNearEnd.h.

References Report().

51 {}
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
void cmtool::CBAlgoStartNearEnd::SetMaxAngle ( double  a)
inline

Definition at line 43 of file CBAlgoStartNearEnd.h.

References _maxopeningangle.

Referenced by CBAlgoStartNearEnd().

void cmtool::CBAlgoStartNearEnd::SetMaxStartEndSeparation ( double  d)
inline

Core function: given the ClusterParamsAlg input, return whether a cluster should be merged or not.

Definition at line 41 of file CBAlgoStartNearEnd.h.

References _separation, and d.

Referenced by CBAlgoStartNearEnd().

41 { _separation=d; }
Float_t d
Definition: plot.C:237
void cmtool::CBAlgoStartNearEnd::SetMinHits ( size_t  n)
inline

Definition at line 45 of file CBAlgoStartNearEnd.h.

References _MinHits, Bool(), and n.

Referenced by CBAlgoStartNearEnd().

45 { _MinHits=n; }
Char_t n[5]
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().

double cmtool::CBAlgoStartNearEnd::_maxopeningangle
protected

Definition at line 58 of file CBAlgoStartNearEnd.h.

Referenced by Bool(), and SetMaxAngle().

size_t cmtool::CBAlgoStartNearEnd::_MinHits
protected

Definition at line 60 of file CBAlgoStartNearEnd.h.

Referenced by Bool(), and SetMinHits().

double cmtool::CBAlgoStartNearEnd::_separation
protected

Definition at line 59 of file CBAlgoStartNearEnd.h.

Referenced by Bool(), and SetMaxStartEndSeparation().


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