CBAlgoAngleIncompat.cxx
Go to the documentation of this file.
1 #include "CBAlgoAngleIncompat.h"
2 
3 #include <math.h>
4 
5 namespace cmtool {
6 
7  //-------------------------------------------------------
9  //-------------------------------------------------------
10  {
11  SetAngleCut(30.);
12 
13  SetMinHits(0);
14 
15  SetAllow180Ambig(false);
16 
17  SetUseOpeningAngle(false);
18 
19  SetMinLength(20);
20 
21  SetDebug(false);
22  }
23 
24  //----------------------------------------------------------------
25  bool CBAlgoAngleIncompat::Bool(const ::cluster::ClusterParamsAlg &cluster1,
26  const ::cluster::ClusterParamsAlg &cluster2)
27  //----------------------------------------------------------------
28  {
29  //if either cluster is too small, do not prohibit them
30  if (cluster1.GetNHits() < _minHits || cluster2.GetNHits() < _minHits)
31  return false;
32 
33  //if either cluster is too short, do not prohibit them
34  if (cluster1.GetParams().length < _min_length ||
35  cluster2.GetParams().length < _min_length)
36  return false;
37 
38 
39  double angle1 = cluster1.GetParams().angle_2d;
40  double angle2 = cluster2.GetParams().angle_2d;
41 
42  if(angle1 < -998 || angle2 < -998)
43  return false;
44 
45  bool compatible = false;
46 
47  double my_cut_value = _max_allowed_2D_angle_diff;
48 
49  //if using opening angle, have angle cutoff be the smaller of the two opening angles
51  my_cut_value = std::min(cluster1.GetParams().opening_angle, cluster2.GetParams().opening_angle);
52 
53  //if you don't care if clusters have been reconstructed backwards
55  compatible = ( abs(angle1-angle2) < my_cut_value ||
56  abs(angle1-angle2-180) < my_cut_value ||
57  abs(angle1-angle2+180) < my_cut_value );
58  else
59  compatible = ( abs(angle1-angle2) < my_cut_value );
60 
61 
62  if(_debug){
63  if(!compatible)
64 
65  std::cout<<"CBAlgoAngleIncompat is PROHIBITING clusters with angles "
66  <<angle1<<" and "<<angle2<<std::endl;
67 
68  }
69 
70 
71 
72  return !compatible;
73  }
74 
75 }
T abs(T value)
Class def header for a class CBAlgoAngleIncompat.
CBAlgoAngleIncompat()
Default constructor.
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
QTextStream & endl(QTextStream &s)