QwAnalysis
QwTrackingTreeCombine.h
Go to the documentation of this file.
1 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
2 
3 #ifndef QWTRACKINGTREECOMBINE_H
4 #define QWTRACKINGTREECOMBINE_H
5 
6 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
7 
8 // Standard C and C++ headers
9 #include <iostream>
10 #include <utility>
11 
12 #include "QwTypes.h"
13 #include "QwDetectorInfo.h"
14 #include "QwGeometry.h"
15 
16 #include "globals.h"
17 #include "matrix.h"
18 
19 #define HASHSIZE 1024 /* power of 2 */
20 #define HASHMASK 1023 /* hashsize-1 */
21 
22 #define MAGNET_CENTER 275.0 //PLACEHOLDER VALUE
23 
24 #ifndef DLAYERS
25 #warning Defining DLAYERS outside of the globals.h header file!
26 #define DLAYERS 10
27 #endif
28 
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
30 
31 /*! \brief QwTrackingTreeCombine combines track segments and performs line fitting
32 
33 QwTrackingTreeCombine performs many of the tasks involved with matching hits to track segments
34 and combining track segments into full tracks with lab coordinates.
35 */
36 
37 // Forward declarations
38 class QwHit;
39 class QwHitContainer;
41 class QwTreeLine;
42 class QwPartialTrack;
43 class QwEvent;
44 
46 
47  public:
48 
50  virtual ~QwTrackingTreeCombine();
51 
52  /// Set the debug level
53  void SetDebugLevel (const int debuglevel) { fDebug = debuglevel; };
54  /// Set the maximum road width
55  void SetMaxRoad (const double maxroad) { fMaxRoad = maxroad; };
56  /// Set the maximum X road width (?)
57  void SetMaxXRoad (const double maxxroad) { fMaxXRoad = maxxroad; };
58 
59  /// Set the geometry
60  void SetGeometry(const QwGeometry& geometry) { fGeometry = geometry; };
61 
62  /// \brief Select the left or right hit assignment for HDC hits
63  int SelectLeftRightHit (double *xresult, double dist_cut,
64  QwHitContainer *hitlist, QwHit **ha, double Dx = 0);
65 
66  /// \brief Select the left or right hit assignment for VDC hits
67  QwHit* SelectLeftRightHit (double track_position, QwHit* hit);
68 
69 
70  void SelectPermutationOfHits (int i, int mul, int l, int *r, QwHit *hx[DLAYERS][MAXHITPERLINE], QwHit **ha);
71  void r2_TreelineFit (
72  double& slope, double& offset, double cov[3], double& chi,
73  QwHit **hits, int n);
74  void r3_TreelineFit (
75  double& slope, double& offset, double cov[3], double& chi,
76  const std::vector<QwHit*> hits, double z1, int wire_offset );
77 
78 
79  int selectx (double *xresult, double dist_cut, QwHit** hitarray, QwHit** ha);
80  int contains (double var, QwHit **arr, int len);
81 
82  bool TlCheckForX (
83  double x1, double x2, double dx1, double dx2, double Dx, double z1, double dz,
84  QwTreeLine *treefill, QwHitContainer *hitlist,
85  int dlayer, int tlayer, int iteration, int stay_tuned, double width);
86 
87  int TlMatchHits (
88  double x1, double x2, double z1, double z2,
89  QwTreeLine *treeline, QwHitContainer *hitlist,
90  int tlayers);
91 
92  bool InAcceptance (EQwDetectorPackage package, EQwRegionID region, double cx, double mx, double cy, double my);
93  void TlTreeLineSort (QwTreeLine *tl, QwHitContainer *hl, EQwDetectorPackage package, EQwRegionID region, EQwDirectionID dir, unsigned long bins, int tlayer, int dlayer, double width);
94 
95  // Combine the tree lines in partial tracks for region 2 and region 3
97  QwTreeLine *wu,
98  QwTreeLine *wv,
99  QwTreeLine *wx,
100  int tlayer,
101  bool drop_worst_hit);
102 
104  QwTreeLine *wu,
105  QwTreeLine *wv,
106  int tlayer);
107 
108  std::vector<QwPartialTrack*> TlTreeCombine (
109  const std::vector<QwTreeLine*>& treelines_x,
110  const std::vector<QwTreeLine*>& treelines_u,
111  const std::vector<QwTreeLine*>& treelines_v,
112  EQwDetectorPackage package,
113  EQwRegionID region,
114  int tlayer,
115  int dlayer);
116 
117  int r2_PartialTrackFit (
118  const int num_hits,
119  QwHit **hits,
120  double *fit,
121  double *cov,
122  double &chi2,
123  double *signedresidual,
124  bool drop_worst_hit);
125 
127  const QwTreeLine* wu,
128  const QwTreeLine* wv);
129 
130  private:
131 
132  int fDebug; ///< Debug level
133 
134  double fMaxRoad;
135  double fMaxXRoad;
136 
138 
139  /// Maximum number of missed planes in region 2
141  /// Maximum number of missed wires in region 3
143 
144  /// Drop the hit with largest residual and attempt partial track fit again in region 2
146 
147 }; // class QwTrackingTreeCombine
148 
149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
150 
151 #endif // QWTRACKINGTREECOMBINE_H
int fMaxMissedWires
Maximum number of missed wires in region 3.
bool TlCheckForX(double x1, double x2, double dx1, double dx2, double Dx, double z1, double dz, QwTreeLine *treefill, QwHitContainer *hitlist, int dlayer, int tlayer, int iteration, int stay_tuned, double width)
int TlMatchHits(double x1, double x2, double z1, double z2, QwTreeLine *treeline, QwHitContainer *hitlist, int tlayers)
void SetMaxRoad(const double maxroad)
Set the maximum road width.
QwPartialTrack * r3_PartialTrackFit(const QwTreeLine *wu, const QwTreeLine *wv)
A container for the pattern databases for each detector region.
void SetMaxXRoad(const double maxxroad)
Set the maximum X road width (?)
#define DLAYERS
Definition: globals.h:5
bool InAcceptance(EQwDetectorPackage package, EQwRegionID region, double cx, double mx, double cy, double my)
void TlTreeLineSort(QwTreeLine *tl, QwHitContainer *hl, EQwDetectorPackage package, EQwRegionID region, EQwDirectionID dir, unsigned long bins, int tlayer, int dlayer, double width)
EQwDetectorPackage
Definition: QwTypes.h:70
int fMaxMissedPlanes
Maximum number of missed planes in region 2.
void SetGeometry(const QwGeometry &geometry)
Set the geometry.
std::vector< QwPartialTrack * > TlTreeCombine(const std::vector< QwTreeLine * > &treelines_x, const std::vector< QwTreeLine * > &treelines_u, const std::vector< QwTreeLine * > &treelines_v, EQwDetectorPackage package, EQwRegionID region, int tlayer, int dlayer)
#define MAXHITPERLINE
Definition: globals.h:12
Contains a tracked event, i.e. all information from hits to tracks.
Definition: QwEvent.h:156
int r2_PartialTrackFit(const int num_hits, QwHit **hits, double *fit, double *cov, double &chi2, double *signedresidual, bool drop_worst_hit)
EQwRegionID
Definition: QwTypes.h:16
bool fDropWorstHit
Drop the hit with largest residual and attempt partial track fit again in region 2.
void SetDebugLevel(const int debuglevel)
Set the debug level.
int SelectLeftRightHit(double *xresult, double dist_cut, QwHitContainer *hitlist, QwHit **ha, double Dx=0)
Select the left or right hit assignment for HDC hits.
One-dimensional (u, v, or x) track stubs and associated hits.
Definition: QwTreeLine.h:51
void r2_TreelineFit(double &slope, double &offset, double cov[3], double &chi, QwHit **hits, int n)
EQwDirectionID
Definition: QwTypes.h:41
Collection of QwDetectorInfo pointers that specifies an experimental geometry.
Definition: QwGeometry.h:27
void SelectPermutationOfHits(int i, int mul, int l, int *r, QwHit *hx[DLAYERS][MAXHITPERLINE], QwHit **ha)
int selectx(double *xresult, double dist_cut, QwHit **hitarray, QwHit **ha)
Combines track segments and performs line fitting.
void r3_TreelineFit(double &slope, double &offset, double cov[3], double &chi, const std::vector< QwHit * > hits, double z1, int wire_offset)
Hit structure uniquely defining each hit.
Definition: QwHit.h:43
int contains(double var, QwHit **arr, int len)
Contains the straight part of a track in one region only.
QwPartialTrack * TcTreeLineCombine(QwTreeLine *wu, QwTreeLine *wv, QwTreeLine *wx, int tlayer, bool drop_worst_hit)
The.