Public Member Functions | Private Attributes | List of all members
cmtool::CFAlgoStartPointMatch Class Reference

#include <CFAlgoStartPointMatch.h>

Inheritance diagram for cmtool::CFAlgoStartPointMatch:
cmtool::CFloatAlgoBase cmtool::CMAlgoBase

Public Member Functions

 CFAlgoStartPointMatch ()
 Default constructor. More...
 
virtual ~CFAlgoStartPointMatch ()
 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...
 
double Area2D (double Ax, double Ay, double Bx, double By, double Cx, double Cy)
 
double Area3D (double Ax, double Ay, double Az, double Bx, double By, double Bz, double Cx, double Cy, double Cz)
 
void UseTime (bool on)
 
void SetMaxArea (double area)
 
- Public Member Functions inherited from cmtool::CFloatAlgoBase
 CFloatAlgoBase ()
 Default constructor. More...
 
virtual ~CFloatAlgoBase ()
 Default destructor. More...
 
- Public Member Functions inherited from cmtool::CMAlgoBase
 CMAlgoBase ()
 Default constructor. More...
 
virtual ~CMAlgoBase ()
 Default destructor. 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...
 

Private Attributes

double _w2cm
 
double _t2cm
 
double _MaxArea
 
bool _time
 

Additional Inherited Members

- 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 CFAlgoStartPointMatch.h.

Constructor & Destructor Documentation

cmtool::CFAlgoStartPointMatch::CFAlgoStartPointMatch ( )

Default constructor.

Definition at line 10 of file CFAlgoStartPointMatch.cxx.

10  : CFloatAlgoBase()
11  //-------------------------------------------------------
12  {
14  _w2cm = geou.WireToCm();
15  _t2cm = geou.TimeToCm();
16  UseTime(true);
17  SetMaxArea(100.);
18 
19  }
Double_t TimeToCm() const
Double_t WireToCm() const
CFloatAlgoBase()
Default constructor.
virtual cmtool::CFAlgoStartPointMatch::~CFAlgoStartPointMatch ( )
inlinevirtual

Default destructor.

Definition at line 33 of file CFAlgoStartPointMatch.h.

33 {};

Member Function Documentation

double cmtool::CFAlgoStartPointMatch::Area2D ( double  Ax,
double  Ay,
double  Bx,
double  By,
double  Cx,
double  Cy 
)

Definition at line 125 of file CFAlgoStartPointMatch.cxx.

125  {
126  //---------------------------------------------------------------------------------------------------
127 
128  double a = (Ax*(By-Cy)+Bx*(Cy-Ay)+Cx*(Ay-By))*0.5;
129 
130  if ( a < 0 ) { a *= -1; }
131 
132  return a;
133 
134  }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
double cmtool::CFAlgoStartPointMatch::Area3D ( double  Ax,
double  Ay,
double  Az,
double  Bx,
double  By,
double  Bz,
double  Cx,
double  Cy,
double  Cz 
)

Definition at line 137 of file CFAlgoStartPointMatch.cxx.

139  {
140  //---------------------------------------------------------------------------------------------------
141 
142  //Create vectors AB and AC
143  Bx = Bx-Ax;
144  By = By-Ay;
145  Bz = Bz-Az;
146  Cx = Cx-Ax;
147  Cy = Cy-Ay;
148  Cz = Cz-Az;
149 
150  return 0.5*sqrt( (By*Cz-Cz*By)*(By*Cz-Cz*By) + (Bz*Cx-Bx*Cz)*(Bz*Cx-Bx*Cz) + (Bx*Cy-By*Cx)*(Bx*Cy-By*Cx) );
151  }
float cmtool::CFAlgoStartPointMatch::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 29 of file CFAlgoStartPointMatch.cxx.

31  {
32 
33  // Code-block by Kazu starts
34  // This ensures the algorithm works only if # clusters is > 2 (and not =2)
35  // You may take out this block if you want to allow matching using clusters from only 2 planes.
36  if(clusters.size()==2) return -1;
37  // Code-block by Kazu ends
38 
39  //This algorithm now works for 3 planes: find 3Dstart point from first 2 planes and find
40  //How well that agrees with 3rd plane's start point location.
41 
42  //So first, make sure clusters vector has only 3 elements. If not return -1
43  if ( clusters.size() != 3 )
44  return -1;
45 
46  //Find 3D start point from start point on first 2 planes:
47  //For now convert start point wire in cm back to wire number
48  //Round to integer (sometimes output is double...why???)
49  int startWire1 = int( clusters.at(0)->GetParams().start_point.w / _w2cm );
50  double startTime1 = clusters.at(0)->GetParams().start_point.t;
51  unsigned int Pl1 = clusters.at(0)->GetParams().start_point.plane;
52  int startWire2 = int( clusters.at(1)->GetParams().start_point.w / _w2cm );
53  double startTime2 = clusters.at(1)->GetParams().start_point.t;
54  unsigned int Pl2 = clusters.at(1)->GetParams().start_point.plane;
55  int startWire3 = int( clusters.at(2)->GetParams().start_point.w / _w2cm );
56  double startTime3 = clusters.at(2)->GetParams().start_point.t;
57  unsigned int Pl3 = clusters.at(2)->GetParams().start_point.plane;
58 
59  unsigned int cryo=0;
60  unsigned int tpc =0;
61 
62  //Get Intersections in pairs:
63  //y and z indicate detector coordinate and numbers indicate planes
64  //used to generate that intersection point
65  double yS12, zS12, yS13, zS13, yS23, zS23;
66 
68  geo->IntersectionPoint( startWire1, startWire2,
69  Pl1, Pl2,
70  cryo, tpc,
71  yS12, zS12);
72 
73  geo->IntersectionPoint( startWire1, startWire3,
74  Pl1, Pl3,
75  cryo, tpc,
76  yS13, zS13);
77 
78  geo->IntersectionPoint( startWire2, startWire3,
79  Pl2, Pl3,
80  cryo, tpc,
81  yS23, zS23);
82 
83  if ( _verbose ){
84  std::cout << "Wire Start Numbers: " << std::endl;
85  std::cout << "\t" << startWire1 << std::endl;
86  std::cout << "\t" << startWire2 << std::endl;
87  std::cout << "\t" << startWire3 << std::endl;
88  std::cout << std::endl;
89  }
90 
91  if ( _verbose ){
92  std::cout << "Intersection Pl1-Pl3: ( " << yS13 << ", " << zS13 << " )" << std::endl;
93  std::cout << "Intersection Pl1-Pl2: ( " << yS12 << ", " << zS12 << " )" << std::endl;
94  std::cout << "Intersection Pl2-Pl3: ( " << yS23 << ", " << zS23 << " )" << std::endl;
95  }
96 
97  //Parameter used for evaluation is area of triangle formed by the three intersection points
98  double area = -1;
99  if ( !_time ){
100  area = Area2D( yS12, zS12, yS23, zS23, yS13, zS13 );
101  }
102  if ( _time ){
103  area = Area3D( (yS12+yS13)/2. , (zS12+zS13)/2. , startTime1,
104  (yS13+yS23)/2. , (zS13+zS23)/2. , startTime3,
105  (yS12+yS23)/2. , (zS13+zS23)/2. , startTime2 );
106  }
107 
108  if ( _verbose ) { std::cout << "Area of intersections triangle is: " << area << std::endl; }
109 
110  if ( area > _MaxArea )
111  return -1;
112  else
113  return 1./area;
114 
115  }
double Area2D(double Ax, double Ay, double Bx, double By, double Cx, double Cy)
double Area3D(double Ax, double Ay, double Az, double Bx, double By, double Bz, double Cx, double Cy, double Cz)
bool IntersectionPoint(geo::WireID const &wid1, geo::WireID const &wid2, double &y, double &z) const
Returns the intersection point of two wires.
Namespace collecting geometry-related classes utilities.
bool _verbose
Boolean to choose verbose mode. Turned on if CMergeManager/CMatchManager&#39;s verbosity level is >= kPer...
Definition: CMAlgoBase.h:89
QTextStream & endl(QTextStream &s)
void cmtool::CFAlgoStartPointMatch::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 118 of file CFAlgoStartPointMatch.cxx.

120  {
121 
122  }
void cmtool::CFAlgoStartPointMatch::Reset ( void  )
virtual

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

Reimplemented from cmtool::CMAlgoBase.

Definition at line 22 of file CFAlgoStartPointMatch.cxx.

24  {
25 
26  }
void cmtool::CFAlgoStartPointMatch::SetMaxArea ( double  area)
inline

Definition at line 66 of file CFAlgoStartPointMatch.h.

void cmtool::CFAlgoStartPointMatch::UseTime ( bool  on)
inline

Definition at line 64 of file CFAlgoStartPointMatch.h.

Member Data Documentation

double cmtool::CFAlgoStartPointMatch::_MaxArea
private

Definition at line 93 of file CFAlgoStartPointMatch.h.

double cmtool::CFAlgoStartPointMatch::_t2cm
private

Definition at line 92 of file CFAlgoStartPointMatch.h.

bool cmtool::CFAlgoStartPointMatch::_time
private

Definition at line 94 of file CFAlgoStartPointMatch.h.

double cmtool::CFAlgoStartPointMatch::_w2cm
private

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 92 of file CFAlgoStartPointMatch.h.


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