LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ClusterMergeAlg.h
Go to the documentation of this file.
1 // \file ClusterMergeAlg.h
3 //
4 // \brief ClusterMergeAlg header file
5 //
6 // \author david.kaleko@gmail.com, kazuhiro@nevis.columbia.edu
7 //
9 
10 #ifndef CLUSTERMERGEALG_H
11 #define CLUSTERMERGEALG_H
12 
13 // ART includes
14 #include "fhiclcpp/ParameterSet.h"
24 
25 // LArSoft
33 // STL
34 #include <set>
35 #include <vector>
36 #include <sstream>
37 
38 // ROOT
39 #include <TString.h>
40 #include <TTree.h>
41 
42 namespace cluster
43 {
44 
50 
51  unsigned int cluster_index;
54 
55  float start_wire;
56  float start_time;
57  float end_wire;
58  float end_time;
59 
60  double start_wire_err;
61  double start_time_err;
62  double end_wire_err;
63  double end_time_err;
64 
65  float angle;
66 
68  cluster_merge_info(): planeID() {
69 
70  cluster_index = 0xffffffff;
71  view = geo::kUnknown;
72  start_wire = start_time = end_wire = end_time = -1;
73  start_wire_err = start_time_err = end_wire_err =end_time_err = -1;
74 
75  };
76 
78  explicit cluster_merge_info(const recob::Cluster& cl)
79  :cluster_index(cl.ID())
80  ,view(cl.View())
81  ,planeID(cl.Plane())
82  ,start_wire(cl.StartWire())
83  ,start_time(cl.StartTick())
84  ,end_wire(cl.EndWire())
85  ,end_time(cl.EndTick())
86  ,angle(cl.StartAngle())
87  {}
88  };
89 
91 
92  public:
93 
96  //ClusterMergeAlg(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
97 
99  virtual ~ClusterMergeAlg(){};
100 
102  void VerboseMode(bool on) { _verbose = on; }
103 
105  void ReportConfig() const;
106 
108  void SetAngleCut(double angle) { _max_allowed_2D_angle_diff = angle; }
109 
111  void SetSquaredDistanceCut(double d) { _max_2D_dist2 = d; }
112 
114  void AppendClusterInfo(const recob::Cluster &in_cluster,
115  const std::vector<art::Ptr<recob::Hit> > &in_hit_v);
116 
118  void AppendClusterInfo(const art::Ptr<recob::Cluster> in_cluster,
119  const std::vector<art::Ptr<recob::Hit> > &in_hit_v);
120 
122  void ClearEventInfo();
123 
129  void ProcessMergeAlg();
130 
132  const std::vector<std::vector<unsigned int> > GetClusterSets () const {return _cluster_sets_v;};
133 
135  bool CompareClusters(const cluster_merge_info &clus_info_A,
136  const cluster_merge_info &clus_info_B);
137 
143  bool Angle2DCompatibility(const cluster_merge_info &clus_info_A,
144  const cluster_merge_info &clus_info_B) const;
145 
152  bool ShortestDistanceCompatibility(const cluster_merge_info &clus_info_A,
153  const cluster_merge_info &clus_info_B) const;
154 
159  double ShortestDistanceSquared(double point_x, double point_y,
160  double start_x, double start_y,
161  double end_x, double end_y ) const;
162 
167  void PrintClusterVars(cluster_merge_info clus_info) const;
168 
174  int isInClusterSets(unsigned int index) const;
175 
176  protected:
177 
179  void SetWire2Cm(double f) { _wire_2_cm = f; }
180 
182  void SetTime2Cm(double f) { _time_2_cm = f; }
183 
185  void ClearOutputInfo();
186 
188  void ClearInputInfo();
189 
191  void ClearTTreeInfo();
192 
194  void PrepareTTree();
195 
197  void PrepareDetParams();
198 
200  void AppendHitInfo(cluster_merge_info &ci,
201  const std::vector<art::Ptr<recob::Hit> > &in_hit_v);
202 
207  void BuildClusterSets(const cluster_merge_info &clus_info_A,
208  const cluster_merge_info &clus_info_B);
209 
214  void FinalizeClusterSets();
215 
217  int AppendToClusterSets(unsigned int cluster_index, int merged_index=-1);
218 
219  protected:
220 
221  bool _verbose;
223  TTree* _merge_tree;
224 
232  std::vector<int> _cluster_merged_index;
233 
239  std::vector<std::vector<unsigned int> > _cluster_sets_v;
240 
241  std::vector<cluster::cluster_merge_info> _u_clusters;
242  std::vector<cluster::cluster_merge_info> _v_clusters;
243  std::vector<cluster::cluster_merge_info> _w_clusters;
244 
245  double _wire_2_cm;
246  double _time_2_cm;
247  double _max_allowed_2D_angle_diff; //in degrees
248  double _max_2D_dist2; //in cm^2
249  double _min_distance_unit; //in cm^2
250  }; // class ClusterMergeAlg
251 
252 } //namespace cluster
253 #endif
void VerboseMode(bool on)
Method to set verbose mode.
void SetSquaredDistanceCut(double d)
Method to set cut value in cm^2 for distance compatibility test.
geo::PlaneID planeID
plane ID
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Unknown view.
Definition: geo_types.h:83
Declaration of signal hit object.
std::vector< cluster::cluster_merge_info > _v_clusters
Input V-plane clusters&#39; information.
double _time_2_cm
Conversion factor from time to cm scale.
const std::vector< std::vector< unsigned int > > GetClusterSets() const
Method to extract resulting set of cluster IDs for merging computed by ProcessMergeAlg() function...
cluster_merge_info()
Default constructor.
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
double end_wire_err
End point wire error.
cluster_merge_info(const recob::Cluster &cl)
Initialization from a recob::Cluster.
double _wire_2_cm
Conversion factor from wire number to cm scale.
TTree * _merge_tree
Quality Control TTree pointer.
Set of hits with a 2D structure.
Definition: Cluster.h:71
std::vector< int > _cluster_merged_index
Cluster finding and building.
Particle class.
std::vector< cluster::cluster_merge_info > _w_clusters
Input W-plane clusters&#39; information.
float end_time
End point time.
double start_wire_err
Vertex wire error.
bool _verbose
Verbose mode boolean.
TFile f
Definition: plotHisto.C:6
float start_wire
Vertex wire.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void SetTime2Cm(double f)
Method to set a conversion factor from time to cm scale.
virtual ~ClusterMergeAlg()
Default destructor.
void SetAngleCut(double angle)
Method to set cut value in degrees for angle compatibility test.
float start_time
Vertex time.
Float_t d
Definition: plot.C:237
Declaration of cluster object.
float angle
2D starting angle (in radians)
std::vector< std::vector< unsigned int > > _cluster_sets_v
bool _det_params_prepared
Boolean to keep track of detector parameter preparation.
unsigned int cluster_index
Input cluster ID.
std::vector< cluster::cluster_merge_info > _u_clusters
Input U-plane clusters&#39; information.
float end_wire
End point wire.
geo::View_t view
Wire plane ID.
Algorithm for generating space points from hits.
recob::tracking::Plane Plane
Definition: TrackState.h:17
art framework interface to geometry description
double start_time_err
Vertex time error.
double end_time_err
End point time error.
void SetWire2Cm(double f)
Method to set a conversion factor from wire to cm scale.