LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CosmicTracker_module.cc File Reference

Go to the source code of this file.

Classes

struct  trkPoint
 
class  trkf::CosmicTracker
 

Namespaces

 trkf
 

Functions

bool AnglesConsistent (const TVector3 &p1, const TVector3 &p2, const TVector3 &a1, const TVector3 &a2, double angcut)
 
bool MatchTrack (const std::vector< trkPoint > &trkpts1, const std::vector< trkPoint > &trkpts2, double angcut)
 
bool SortByWire (art::Ptr< recob::Hit > const &h1, art::Ptr< recob::Hit > const &h2)
 
bool sp_sort_x0 (const trkPoint &tp1, const trkPoint &tp2)
 
bool sp_sort_x1 (const trkPoint &tp1, const trkPoint &tp2)
 
bool sp_sort_y0 (const trkPoint &tp1, const trkPoint &tp2)
 
bool sp_sort_y1 (const trkPoint &tp1, const trkPoint &tp2)
 
bool sp_sort_z0 (const trkPoint &tp1, const trkPoint &tp2)
 
bool sp_sort_z1 (const trkPoint &tp1, const trkPoint &tp2)
 
bool spt_sort_x0 (const recob::SpacePoint h1, const recob::SpacePoint h2)
 
bool spt_sort_x1 (const recob::SpacePoint h1, const recob::SpacePoint h2)
 
bool spt_sort_y0 (const recob::SpacePoint h1, const recob::SpacePoint h2)
 
bool spt_sort_y1 (const recob::SpacePoint h1, const recob::SpacePoint h2)
 
bool spt_sort_z0 (const recob::SpacePoint h1, const recob::SpacePoint h2)
 
bool spt_sort_z1 (const recob::SpacePoint h1, const recob::SpacePoint h2)
 

Function Documentation

bool AnglesConsistent ( const TVector3 &  p1,
const TVector3 &  p2,
const TVector3 &  a1,
const TVector3 &  a2,
double  angcut 
)

Definition at line 61 of file CosmicTracker_module.cc.

Referenced by MatchTrack().

66 {
67  double angle1 = a1.Angle(a2);
68  if (angle1 > TMath::PiOver2()) angle1 = TMath::Pi() - angle1;
69  double angle2 = a1.Angle(p1 - p2);
70  if (angle2 > TMath::PiOver2()) angle2 = TMath::Pi() - angle2;
71  if (angle1 < angcut && angle2 < angcut)
72  return true;
73  else
74  return false;
75 }
#define a2
#define a1
bool MatchTrack ( const std::vector< trkPoint > &  trkpts1,
const std::vector< trkPoint > &  trkpts2,
double  angcut 
)

Definition at line 78 of file CosmicTracker_module.cc.

References AnglesConsistent(), trkPoint::dir, and trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

81 {
82  bool match = false;
83  if (!trkpts1.size()) return match;
84  if (!trkpts2.size()) return match;
85  if ((trkpts1[0].hit)->WireID().Cryostat == (trkpts2[0].hit)->WireID().Cryostat &&
86  (trkpts1[0].hit)->WireID().TPC == (trkpts2[0].hit)->WireID().TPC)
87  return match;
88  // art::ServiceHandle<geo::Geometry const> geom;
89  // const geo::TPCGeo &thetpc1 = geom->TPC((trkpts1[0].hit)->WireID().TPC, (trkpts1[0].hit)->WireID().Cryostat);
90  // const geo::TPCGeo &thetpc2 = geom->TPC((trkpts2[0].hit)->WireID().TPC, (trkpts2[0].hit)->WireID().Cryostat);
91 
92  //std::cout<<trkpts1[0].pos.Y()<<" "<<trkpts1.back().pos.Y()<<" "<<trkpts1[0].pos.Z()<<" "<<trkpts1.back().pos.Z()<<std::endl;
93  //std::cout<<trkpts2[0].pos.Y()<<" "<<trkpts2.back().pos.Y()<<" "<<trkpts2[0].pos.Z()<<" "<<trkpts2.back().pos.Z()<<std::endl;
94 
95  // if (thetpc1.InFiducialY(trkpts1[0].pos.Y(),5)&&
96  // thetpc1.InFiducialY(trkpts1.back().pos.Y(),5)&&
97  // thetpc1.InFiducialZ(trkpts1[0].pos.Z(),5)&&
98  // thetpc1.InFiducialZ(trkpts1.back().pos.Z(),5)) return match;
99  // //std::cout<<"pass 1"<<std::endl;
100  // if (thetpc2.InFiducialY(trkpts2[0].pos.Y(),5)&&
101  // thetpc2.InFiducialY(trkpts2.back().pos.Y(),5)&&
102  // thetpc2.InFiducialZ(trkpts2[0].pos.Z(),5)&&
103  // thetpc2.InFiducialZ(trkpts2.back().pos.Z(),5)) return match;
104  // //std::cout<<"pass 2"<<std::endl;
105 
106  if (AnglesConsistent(trkpts1[0].pos, trkpts2[0].pos, trkpts1[0].dir, trkpts2[0].dir, angcut))
107  match = true;
108  if (AnglesConsistent(
109  trkpts1.back().pos, trkpts2[0].pos, trkpts1.back().dir, trkpts2[0].dir, angcut))
110  match = true;
111  if (AnglesConsistent(
112  trkpts1[0].pos, trkpts2.back().pos, trkpts1[0].dir, trkpts2.back().dir, angcut))
113  match = true;
114  if (AnglesConsistent(
115  trkpts1.back().pos, trkpts2.back().pos, trkpts1.back().dir, trkpts2.back().dir, angcut))
116  match = true;
117 
118  return match;
119 }
bool AnglesConsistent(const TVector3 &p1, const TVector3 &p2, const TVector3 &a1, const TVector3 &a2, double angcut)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Detector simulation of raw signals on wires.
TDirectory * dir
Definition: macro.C:5
bool SortByWire ( art::Ptr< recob::Hit > const &  h1,
art::Ptr< recob::Hit > const &  h2 
)

Definition at line 121 of file CosmicTracker_module.cc.

References geo::WireID::Wire, and recob::Hit::WireID().

Referenced by cluster::ClusterMatchTQ::MatchedClusters(), trkf::SpacePts::produce(), and vertex::VertexFinder2D::produce().

122 {
123  return h1->WireID().Wire < h2->WireID().Wire;
124 }
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:563
geo::WireID const & WireID() const
Initial tdc tick for hit.
Definition: Hit.h:280
bool sp_sort_x0 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 126 of file CosmicTracker_module.cc.

References trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

127 {
128  return tp1.pos.X() < tp2.pos.X();
129 }
bool sp_sort_x1 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 131 of file CosmicTracker_module.cc.

References trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

132 {
133  return tp1.pos.X() > tp2.pos.X();
134 }
bool sp_sort_y0 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 136 of file CosmicTracker_module.cc.

References trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

137 {
138  return tp1.pos.Y() < tp2.pos.Y();
139 }
bool sp_sort_y1 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 141 of file CosmicTracker_module.cc.

References trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

142 {
143  return tp1.pos.Y() > tp2.pos.Y();
144 }
bool sp_sort_z0 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 146 of file CosmicTracker_module.cc.

References trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

147 {
148  return tp1.pos.Z() < tp2.pos.Z();
149 }
bool sp_sort_z1 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 151 of file CosmicTracker_module.cc.

References trkPoint::pos.

Referenced by trkf::CosmicTracker::produce().

152 {
153  return tp1.pos.Z() > tp2.pos.Z();
154 }
bool spt_sort_x0 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 156 of file CosmicTracker_module.cc.

References recob::SpacePoint::XYZ().

Referenced by trkf::CosmicTracker::produce().

157 {
158  const double* xyz1 = h1.XYZ();
159  const double* xyz2 = h2.XYZ();
160  return xyz1[0] < xyz2[0];
161 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:78
bool spt_sort_x1 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 163 of file CosmicTracker_module.cc.

References recob::SpacePoint::XYZ().

Referenced by trkf::CosmicTracker::produce().

164 {
165  const double* xyz1 = h1.XYZ();
166  const double* xyz2 = h2.XYZ();
167  return xyz1[0] > xyz2[0];
168 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:78
bool spt_sort_y0 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 170 of file CosmicTracker_module.cc.

References recob::SpacePoint::XYZ().

Referenced by trkf::CosmicTracker::produce().

171 {
172  const double* xyz1 = h1.XYZ();
173  const double* xyz2 = h2.XYZ();
174  return xyz1[1] < xyz2[1];
175 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:78
bool spt_sort_y1 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 177 of file CosmicTracker_module.cc.

References recob::SpacePoint::XYZ().

Referenced by trkf::CosmicTracker::produce().

178 {
179  const double* xyz1 = h1.XYZ();
180  const double* xyz2 = h2.XYZ();
181  return xyz1[1] > xyz2[1];
182 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:78
bool spt_sort_z0 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 184 of file CosmicTracker_module.cc.

References recob::SpacePoint::XYZ().

Referenced by trkf::CosmicTracker::produce().

185 {
186  const double* xyz1 = h1.XYZ();
187  const double* xyz2 = h2.XYZ();
188  return xyz1[2] < xyz2[2];
189 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:78
bool spt_sort_z1 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 191 of file CosmicTracker_module.cc.

References recob::SpacePoint::XYZ().

Referenced by trkf::CosmicTracker::produce().

192 {
193  const double* xyz1 = h1.XYZ();
194  const double* xyz2 = h2.XYZ();
195  return xyz1[2] > xyz2[2];
196 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:78