All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CBAlgoStartTrack.cxx
Go to the documentation of this file.
2 
3 namespace cmtool {
4 
5  //-------------------------------------------------------
7  //-------------------------------------------------------
8  {
9 
10  SetMinHits(10);
11  SetMinWidth(1.00000);
12  SetMinOpeningAngle(0.15000);
13  SetMinEP(0.99000);
14  SetDebug(false);
15 
16  }
17 
18  //-----------------------------
20  //-----------------------------
21  {
22 
23  }
24 
25  //------------------------------------------------------------------------------------------
26  //void CBAlgoStartTrack::EventBegin(const std::vector<cluster::ClusterParamsAlg> &clusters)
27  //------------------------------------------------------------------------------------------
28  //{
29  //
30  //}
31 
32  //-------------------------------
33  //void CBAlgoStartTrack::EventEnd()
34  //-------------------------------
35  //{
36  //
37  //}
38 
39  //-----------------------------------------------------------------------------------------------
40  //void CBAlgoStartTrack::IterationBegin(const std::vector<cluster::ClusterParamsAlg> &clusters)
41  //-----------------------------------------------------------------------------------------------
42  //{
43  //
44  //}
45 
46  //------------------------------------
47  //void CBAlgoStartTrack::IterationEnd()
48  //------------------------------------
49  //{
50  //
51  //}
52 
53  //----------------------------------------------------------------
54  bool CBAlgoStartTrack::Bool(const ::cluster::ClusterParamsAlg &cluster1,
55  const ::cluster::ClusterParamsAlg &cluster2)
56  //----------------------------------------------------------------
57  {
58 
59  if(cluster1.GetHitVector().size() < _min_hits ||
60  cluster2.GetHitVector().size() < _min_hits )
61  return false;
62 
63  bool FirstTrackSecondBlob = false;
64  bool SecondTrackFirstBlob = false;
65 
66  if(IsStartTrack(cluster1) && IsOverlappingBlob(cluster2))
67  FirstTrackSecondBlob = true;
68  if(IsStartTrack(cluster2) && IsOverlappingBlob(cluster1))
69  SecondTrackFirstBlob = true;
70 
71  if(_debug){
72  if(FirstTrackSecondBlob){
73  std::cout<<"*********************************************"<<std::endl;
74  std::cout<<"First track second blob! First has params:"<<std::endl;
75  std::cout<<"Angle 2D = "<<cluster1.GetParams().angle_2d<<std::endl;
76  std::cout<<"Opening Angle = "<<cluster1.GetParams().opening_angle<<std::endl;
77  std::cout<<"Sum charge = "<<cluster1.GetParams().sum_charge<<std::endl;
78  std::cout<<"Length = "<<cluster1.GetParams().length<<std::endl;
79  std::cout<<"Width = "<<cluster1.GetParams().width<<std::endl;
80  std::cout<<"N_Hits = "<<cluster1.GetHitVector().size()<<std::endl;
81  std::cout<<"eigenvalue_principal = "<<cluster1.GetParams().eigenvalue_principal<<std::endl;
82  std::cout<<"Second has params:"<<std::endl;
83  std::cout<<"Angle 2D = "<<cluster2.GetParams().angle_2d<<std::endl;
84  std::cout<<"Opening Angle = "<<cluster2.GetParams().opening_angle<<std::endl;
85  std::cout<<"Sum charge = "<<cluster2.GetParams().sum_charge<<std::endl;
86  std::cout<<"Length = "<<cluster2.GetParams().length<<std::endl;
87  std::cout<<"Width = "<<cluster2.GetParams().width<<std::endl;
88  std::cout<<"N_Hits = "<<cluster2.GetHitVector().size()<<std::endl;
89  std::cout<<"eigenvalue_principal = "<<cluster2.GetParams().eigenvalue_principal<<std::endl;
90 
91  }
92 
93 
94  }
95 
96  //if cluster1 looks like a track and cluster2 looks like a blob
97  if (FirstTrackSecondBlob)
98  {
99  std::pair<float,float> trackEndPoint =
100  std::pair<float,float>( cluster1.GetParams().end_point.w, cluster1.GetParams().end_point.t );
101 
102  //if the tracklike cluster's endpoint is inside polygon of blob
103  if(cluster2.GetParams().PolyObject.PointInside(trackEndPoint))
104  return true;
105  else
106  return false;
107  }
108 
109  //if cluster2 looks like a track and cluster1 looks like a blob
110  else if (SecondTrackFirstBlob)
111  {
112  std::pair<float,float> trackEndPoint =
113  std::pair<float,float>( cluster2.GetParams().end_point.w, cluster2.GetParams().end_point.t );
114 
115  //if the tracklike cluster's endpoint is inside polygon of blob
116  if(cluster1.GetParams().PolyObject.PointInside(trackEndPoint))
117  return true;
118  else
119  return false;
120  }
121 
122  else
123  return false;
124 
125  //the reason for not just using (one track one blob) and
126  //polyoverlap for this is that
127  //this was merging BNB events where the track is clearly in a different
128  //direction than the blob
129 
130  //this will fail when the tracklike cluster is reconstructed backwards
131  //(looks like it's a track going into a blob, rather than exiting)
132 
133 
134  }
135 
136  //------------------------------
138  //------------------------------
139  {
140 
141  }
142 
143 
144  bool CBAlgoStartTrack::IsStartTrack(const ::cluster::ClusterParamsAlg &cluster)
145  {
146  if(cluster.GetParams().eigenvalue_principal > _min_EP)
147  return true;
148  else
149  return false;
150 
151  }
152 
153  bool CBAlgoStartTrack::IsOverlappingBlob(const ::cluster::ClusterParamsAlg &cluster)
154  {
155  if(cluster.GetParams().width > _min_width &&
156  cluster.GetParams().opening_angle > _min_opening_angle &&
157  cluster.GetParams().eigenvalue_principal < _min_EP)
158  return true;
159  else
160  return false;
161  }
162 }
void SetMinWidth(double value)
process_name cluster
Definition: cheaterreco.fcl:51
virtual bool Bool(const ::cluster::ClusterParamsAlg &cluster1, const ::cluster::ClusterParamsAlg &cluster2)
void SetMinOpeningAngle(double value)
void SetMinEP(double value)
void SetMinHits(size_t value)
bool IsStartTrack(const ::cluster::ClusterParamsAlg &cluster)
This merge algo is looking for short tracks from the start of a shower that are overlapping a blob th...
CBAlgoStartTrack()
Default constructor.
virtual void Reset()
Function to reset the algorithm instance ... maybe implemented via child class.
BEGIN_PROLOG could also be cout
bool IsOverlappingBlob(const ::cluster::ClusterParamsAlg &cluster)