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