WindowTrackingAlg.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////
2 /// \file WindowTrackingAlg.h
3 /// \brief Track finder for cosmic rays
4 /// \author brebel@fnal.gov
5 /// \date
6 ///////////////////////////////////////////////////////////////////////
7 #ifndef TRACKFIT_WINDOWTRACKINGALG_H
8 #define TRACKFIT_WINDOWTRACKINGALG_H
9 
10 // C++ includes
11 #include <vector>
12 
13 // ART includes
16 #include "Geometry/Geometry.h"
17 #include "TrackFit/TrackAlg.h"
18 
19 #include "TH1.h"
20 #include "TVector3.h"
21 
22 namespace fhicl { class ParameterSet; }
23 namespace rb {
24  class CellHit;
25  class Track;
26  class Cluster;
27 }
28 
29 namespace trk {
30 
31  /// An algorithm to perform cosmic ray track fitting
32  class WindowTrackingAlg : public TrackAlg{
33  public:
34  explicit WindowTrackingAlg(fhicl::ParameterSet const &pset);
35  virtual ~WindowTrackingAlg();
36 
37  // Take a slice and return a track
38  std::vector<rb::Track> MakeTrack( const rb::Cluster* slice );
39 
40  private:
41 
42  rb::Track Make3DTrack(std::vector<art::Ptr<rb::CellHit> > & allHits,
43  std::vector<art::Ptr<rb::CellHit> > & removedHits,
44  double & chiSqr,
45  bool(*comp)(unsigned short int, unsigned short int));
46 
47  rb::Track FitView(std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
48  bool(*)(unsigned short int, unsigned short int) > & hits,
49  std::map<unsigned short int, std::pair<float, float>,
50  bool(*)(unsigned short int, unsigned short int) > const& planeCoG,
51  std::vector<art::Ptr<rb::CellHit> > & removedHits,
53  double & chiSqr);
54 
55  rb::Track MakeViewTrack(std::vector< art::Ptr<rb::CellHit> > const& trkHits,
56  geo::View_t const& view,
57  double & chiSqr,
58  bool const& dir,
59  std::vector< art::Ptr<rb::CellHit> > & removedHits);
60 
61  void LookForBremsstrahlungHits(rb::Track & track,
62  std::vector<art::Ptr<rb::CellHit> > & removedHits);
63 
64  unsigned int FitWindow(std::vector<art::Ptr<rb::CellHit> > const& prevWindow,
65  std::vector<art::Ptr<rb::CellHit> > & currWindow,
66  std::vector<art::Ptr<rb::CellHit> > & removedHits,
67  std::map<unsigned short int, std::pair<float, float>,
68  bool(*)(unsigned short int, unsigned short int) > const& planeCoG,
69  geo::View_t const& view);
70 
71  rb::Track ShortTrack(std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
72  bool(*)(unsigned short int, unsigned short int) > & xViewHits,
73  std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
74  bool(*)(unsigned short int, unsigned short int) > & yViewHits,
75  std::map<unsigned short int, std::pair<float, float>,
76  bool(*)(unsigned short int, unsigned short int) > const& planeCoG,
77  double & chiSqr);
78 
79  rb::Track ShortViewTrack(std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
80  bool(*)(unsigned short int, unsigned short int) > & viewHits,
81  std::map<unsigned short int, std::pair<float, float>,
82  bool(*)(unsigned short int, unsigned short int) > const& planeCoG,
83  bool const& twoPlanes,
84  int const& firstPlane,
85  int const& secondPlane,
86  geo::View_t const& view);
87  void ShortTrackExtraPlane(std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
88  bool(*)(unsigned short int, unsigned short int) > const& viewHits,
89  std::map<unsigned short int, std::pair<float, float>,
90  bool(*)(unsigned short int, unsigned short int) > const& planeCoG,
91  std::vector<std::pair<geo::View_t, TVector3> > & trajPoints,
92  rb::Track & viewTrack,
93  unsigned short int const& removedPlane);
94  void ShortTrackRemoveExtraPlane(std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
95  bool(*)(unsigned short int, unsigned short int) > & viewHits,
96  std::map<unsigned short int, std::pair<float, float>,
97  bool(*)(unsigned short int, unsigned short int) > & planeCoG,
98  unsigned short int & removedPlane);
99 
100 
101  void SetTrackEndPoints(rb::Track & track);
102  void FindEndPoint(geo::View_t const& view,
103  double * cellCenter,
104  TVector3 const& endPoint,
105  TVector3 const& endDir,
106  bool const& start,
107  rb::Track & track);
108 
109  void CheckTrackDirectionInY(rb::Track & track,
110  TVector3 & start,
111  TVector3 & end);
112 
113  void DetermineInitialDirection(rb::Track & track);
114 
115  bool ValidTrack(std::map<unsigned short int, std::vector<art::Ptr<rb::CellHit> >,
116  bool(*)(unsigned short int, unsigned short int) > const& planeToHit);
117 
118  double fCellHalfDepth; ///< half of cell size in z
119  double fDHitGood; ///< Maximum distance from the line for a
120  ///< hit to be considered part of it
121  unsigned int fWindowSize; ///< Number of planes in the sliding window
122  unsigned int fMinViewPlanes; ///< Minimum number of planes in a view to fit
123  unsigned int fMinHitsTryAgain; ///< Minimum number of hits left to look for another track
124  double fMinHitFraction; ///< Minimum value of hits/plane to look for a track
125  unsigned int fNTrajectory; ///< number of trajectory points to use in determining incoming direction
126  int fMaxPlaneSeparation; ///< Maximum number of planes allowed to separate planes with hits in slice
127  art::ServiceHandle<geo::Geometry> fGeo; ///< handle to the geometry
128 
129  };
130 
131 }
132 
133 #endif // TRACKFIT_WINDOWTRACKINGALG_H
134 ///////////////////////////////////////////////////////////////////////
An algorithm to perform cosmic ray track fitting.
Definition: TrackAlg.h:25
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Definition: event.h:19
A collection of associated CellHits.
Definition: Cluster.h:47
unsigned int fMinHitsTryAgain
Minimum number of hits left to look for another track.
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
Track finder for cosmic rays.
art::ServiceHandle< geo::Geometry > fGeo
handle to the geometry
Track finder for cosmic rays.
void hits()
Definition: readHits.C:15
double fCellHalfDepth
half of cell size in z
unsigned int fMinViewPlanes
Minimum number of planes in a view to fit.
An algorithm to perform cosmic ray track fitting.
Perform a "2 point" Hough transform on a collection of hits.
double fMinHitFraction
Minimum value of hits/plane to look for a track.
TDirectory * dir
Definition: macro.C:5
unsigned int fWindowSize
Number of planes in the sliding window.
unsigned int fNTrajectory
number of trajectory points to use in determining incoming direction
int fMaxPlaneSeparation
Maximum number of planes allowed to separate planes with hits in slice.
Encapsulate the geometry of one entire detector (near, far, ndos)