All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Functions
CosmicTracker_module.cc File Reference
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include "art/Framework/Core/EDProducer.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Handle.h"
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "canvas/Persistency/Common/FindManyP.h"
#include "canvas/Persistency/Common/Ptr.h"
#include "canvas/Persistency/Common/PtrVector.h"
#include "fhiclcpp/ParameterSet.h"
#include "messagefacility/MessageLogger/MessageLogger.h"
#include "larcore/Geometry/Geometry.h"
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
#include "lardata/DetectorInfoServices/DetectorPropertiesService.h"
#include "lardata/Utilities/AssociationUtil.h"
#include "lardataobj/RecoBase/Cluster.h"
#include "lardataobj/RecoBase/Hit.h"
#include "lardataobj/RecoBase/SpacePoint.h"
#include "lardataobj/RecoBase/Track.h"
#include "larreco/RecoAlg/ClusterMatchTQ.h"
#include "larreco/RecoAlg/CosmicTrackerAlg.h"
#include "TMath.h"
#include "TVector3.h"

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 discut, 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 62 of file CosmicTracker_module.cc.

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

Definition at line 80 of file CosmicTracker_module.cc.

84 {
85  bool match = false;
86  if (!trkpts1.size()) return match;
87  if (!trkpts2.size()) return match;
88  if ((trkpts1[0].hit)->WireID().Cryostat == (trkpts2[0].hit)->WireID().Cryostat &&
89  (trkpts1[0].hit)->WireID().TPC == (trkpts2[0].hit)->WireID().TPC)
90  return match;
91  // art::ServiceHandle<geo::Geometry const> geom;
92  // const geo::TPCGeo &thetpc1 = geom->TPC((trkpts1[0].hit)->WireID().TPC, (trkpts1[0].hit)->WireID().Cryostat);
93  // const geo::TPCGeo &thetpc2 = geom->TPC((trkpts2[0].hit)->WireID().TPC, (trkpts2[0].hit)->WireID().Cryostat);
94 
95  //std::cout<<trkpts1[0].pos.Y()<<" "<<trkpts1.back().pos.Y()<<" "<<trkpts1[0].pos.Z()<<" "<<trkpts1.back().pos.Z()<<std::endl;
96  //std::cout<<trkpts2[0].pos.Y()<<" "<<trkpts2.back().pos.Y()<<" "<<trkpts2[0].pos.Z()<<" "<<trkpts2.back().pos.Z()<<std::endl;
97 
98  // if (thetpc1.InFiducialY(trkpts1[0].pos.Y(),5)&&
99  // thetpc1.InFiducialY(trkpts1.back().pos.Y(),5)&&
100  // thetpc1.InFiducialZ(trkpts1[0].pos.Z(),5)&&
101  // thetpc1.InFiducialZ(trkpts1.back().pos.Z(),5)) return match;
102  // //std::cout<<"pass 1"<<std::endl;
103  // if (thetpc2.InFiducialY(trkpts2[0].pos.Y(),5)&&
104  // thetpc2.InFiducialY(trkpts2.back().pos.Y(),5)&&
105  // thetpc2.InFiducialZ(trkpts2[0].pos.Z(),5)&&
106  // thetpc2.InFiducialZ(trkpts2.back().pos.Z(),5)) return match;
107  // //std::cout<<"pass 2"<<std::endl;
108 
109  if (AnglesConsistent(trkpts1[0].pos, trkpts2[0].pos, trkpts1[0].dir, trkpts2[0].dir, angcut))
110  match = true;
111  if (AnglesConsistent(
112  trkpts1.back().pos, trkpts2[0].pos, trkpts1.back().dir, trkpts2[0].dir, angcut))
113  match = true;
114  if (AnglesConsistent(
115  trkpts1[0].pos, trkpts2.back().pos, trkpts1[0].dir, trkpts2.back().dir, angcut))
116  match = true;
117  if (AnglesConsistent(
118  trkpts1.back().pos, trkpts2.back().pos, trkpts1.back().dir, trkpts2.back().dir, angcut))
119  match = true;
120 
121  return match;
122 }
process_name hit
Definition: cheaterreco.fcl:51
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.
tuple dir
Definition: dropbox.py:28
bool SortByWire ( art::Ptr< recob::Hit > const &  h1,
art::Ptr< recob::Hit > const &  h2 
)

Definition at line 125 of file CosmicTracker_module.cc.

126 {
127  return h1->WireID().Wire < h2->WireID().Wire;
128 }
bool sp_sort_x0 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 131 of file CosmicTracker_module.cc.

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

Definition at line 137 of file CosmicTracker_module.cc.

138 {
139  return tp1.pos.X() > tp2.pos.X();
140 }
bool sp_sort_y0 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 143 of file CosmicTracker_module.cc.

144 {
145  return tp1.pos.Y() < tp2.pos.Y();
146 }
bool sp_sort_y1 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 149 of file CosmicTracker_module.cc.

150 {
151  return tp1.pos.Y() > tp2.pos.Y();
152 }
bool sp_sort_z0 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 155 of file CosmicTracker_module.cc.

156 {
157  return tp1.pos.Z() < tp2.pos.Z();
158 }
bool sp_sort_z1 ( const trkPoint tp1,
const trkPoint tp2 
)

Definition at line 161 of file CosmicTracker_module.cc.

162 {
163  return tp1.pos.Z() > tp2.pos.Z();
164 }
bool spt_sort_x0 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 167 of file CosmicTracker_module.cc.

168 {
169  const double* xyz1 = h1.XYZ();
170  const double* xyz2 = h2.XYZ();
171  return xyz1[0] < xyz2[0];
172 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
bool spt_sort_x1 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 175 of file CosmicTracker_module.cc.

176 {
177  const double* xyz1 = h1.XYZ();
178  const double* xyz2 = h2.XYZ();
179  return xyz1[0] > xyz2[0];
180 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
bool spt_sort_y0 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 183 of file CosmicTracker_module.cc.

184 {
185  const double* xyz1 = h1.XYZ();
186  const double* xyz2 = h2.XYZ();
187  return xyz1[1] < xyz2[1];
188 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
bool spt_sort_y1 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 191 of file CosmicTracker_module.cc.

192 {
193  const double* xyz1 = h1.XYZ();
194  const double* xyz2 = h2.XYZ();
195  return xyz1[1] > xyz2[1];
196 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
bool spt_sort_z0 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 199 of file CosmicTracker_module.cc.

200 {
201  const double* xyz1 = h1.XYZ();
202  const double* xyz2 = h2.XYZ();
203  return xyz1[2] < xyz2[2];
204 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:76
bool spt_sort_z1 ( const recob::SpacePoint  h1,
const recob::SpacePoint  h2 
)

Definition at line 207 of file CosmicTracker_module.cc.

208 {
209  const double* xyz1 = h1.XYZ();
210  const double* xyz2 = h2.XYZ();
211  return xyz1[2] > xyz2[2];
212 }
const Double32_t * XYZ() const
Definition: SpacePoint.h:76