QwAnalysis
QwPartialTrack.h
Go to the documentation of this file.
1 /*!
2  * \file QwPartialTrack.h
3  * \brief Definition of the partial track class
4  *
5  * \author Wouter Deconinck
6  * \date 2009-12-11
7  */
8 
9 #ifndef QWPARTIALTRACK_H
10 #define QWPARTIALTRACK_H
11 
12 #include <iostream>
13 #include <math.h>
14 
15 // ROOT headers
16 #include "TClonesArray.h"
17 #include "TVector3.h"
18 
19 // Qweak headers
20 #include "VQwTrackingElement.h"
21 #include "QwObjectCounter.h"
22 #include "QwTreeLine.h"
23 #include "QwDetectorInfo.h"
24 #include "QwGeometry.h"
25 
26 // Forward declarations
27 class QwVertex;
28 
29 /**
30  * \class QwPartialTrack
31  * \ingroup QwTracking
32  * \brief Contains the straight part of a track in one region only.
33  *
34  * A QwPartialTrack contains tracking information for one region only.
35  * It is constructed by combining multiple tree lines together, and in turn
36  * used to construct the complete track.
37  */
38 class QwPartialTrack: public VQwTrackingElement, public QwObjectCounter<QwPartialTrack> {
39 
40  private:
41 
42  //! Number of tree lines in this partial track
44  //! List of tree lines in this partial track
45  std::vector<QwTreeLine*> fQwTreeLines;
46 
47  public: // methods
48 
49  /// \brief Default constructor
51  /// \brief Copy constructor by reference
52  QwPartialTrack(const QwPartialTrack& that);
53  /// \brief Copy constructor from pointer
54  QwPartialTrack(const QwPartialTrack* that);
55  /// \brief Constructor with track position and direction
56  QwPartialTrack(const TVector3& position, const TVector3& momentum);
57  /// Destructor
58  virtual ~QwPartialTrack();
59 
60  /// Assignment operator
62 
63  private:
64 
65  /// Initialization
66  void Initialize();
67 
68  public:
69 
70  // Valid and used flags
71  bool IsVoid() const { return fIsVoid; };
72  bool IsValid() const { return ! fIsVoid; };
73  bool IsGood() const { return fIsGood; };
74  bool IsNotValid() const { return ! fIsVoid; };
75  bool IsUsed() const { return fIsUsed; };
76  bool IsNotUsed() const { return ! fIsUsed; };
77 
78  // Housekeeping methods for lists
79  void Clear(Option_t *option = "");
80  void Reset(Option_t *option = "");
81 
82  //! \name Creating, adding, and getting tree lines
83  // @{
84  //! Create a new tree line
86  //! Add an existing tree line as a copy
87  void AddTreeLine(const QwTreeLine* treeline);
88  //! \brief Add a linked list of existing tree lines as a copy
89  void AddTreeLineList(const QwTreeLine* treelinelist);
90  //! \brief Add a standard vector of existing tree lines as a copy
91  void AddTreeLineList(const std::vector<QwTreeLine*> &treelinelist);
92  //! \brief Clear the list of tree lines
93  void ClearTreeLines(Option_t *option = "");
94  //! \brief Reset the list of tree lines
95  void ResetTreeLines(Option_t *option = "");
96  //! \brief Get the number of tree lines
97  Int_t GetNumberOfTreeLines() const { return fNQwTreeLines; };
98  //! \brief Get the list of tree lines
99  const std::vector<QwTreeLine*>& GetListOfTreeLines() const { return fQwTreeLines; };
100  //! \brief Get the specified tree line
101  const QwTreeLine* GetTreeLine(const int tl) const { return fQwTreeLines.at(tl); };
102  //! \brief Print the list of tree lines
103  void PrintTreeLines(Option_t *option = "") const;
104  // @}
105 
106  // Get the weighted chi squared
107  double GetChiWeight () const;
108 
109  void Print(const Option_t* options = 0) const;
110  void PrintValid();
111  friend std::ostream& operator<< (std::ostream& stream, const QwPartialTrack& pt);
112 
113  /// \brief Return the vertex at position z
114  const TVector3 GetPosition(const double z) const;
115  /// \brief Return the direction
116  const TVector3 GetMomentumDirection() const;
117  /// \brief Return the phi angle
118  Double_t GetMomentumDirectionPhi() const {
119  return GetMomentumDirection().Phi();
120  };
121  /// \brief Return the theta angle
122  Double_t GetMomentumDirectionTheta() const {
123  return GetMomentumDirection().Theta();
124  };
125 
126 
127  /// \brief Get the vertex position
128  Double_t GetVertexZ() const {
129  return
130  -(fSlopeX * fOffsetX + fSlopeY * fOffsetY) /
131  (fSlopeX * fSlopeX + fSlopeY * fSlopeY);
132  }
133 
134  /// \brief Smear the position
135  QwPartialTrack& SmearPosition(const double sigma_x, const double sigma_y);
136  /// \brief Smear the theta angle
137  QwPartialTrack& SmearAngleTheta(const double sigma);
138  /// \brief Smear the phi angle
139  QwPartialTrack& SmearAnglePhi(const double sigma);
140 
141  /// \brief Determine vertex in detector
142  const QwVertex* DeterminePositionInDetector(const QwDetectorInfo* geometry);
143  /// \brief Determine vertex in the target
144  const QwVertex* DeterminePositionInTarget (const QwGeometry& geometry);
145  /// \brief Determine intersection with trigger scintillators
147  /// \brief Determine intersection with cerenkov bars
148  const QwVertex* DeterminePositionInCerenkovBars (const QwGeometry& geometry);
149  /// \brief Determine position in first horizontal drift chamber
150  const QwVertex* DeterminePositionInHDC (const QwGeometry& geometry);
151 
152  // Average residuals
153  double GetAverageResidual() const { return fAverageResidual; };
154  void SetAverageResidual(const double residual) { fAverageResidual = residual; }
155  double CalculateAverageResidual();
157 
158  // Only 2 Treelines in Plane 0
159  void SetAlone(const int alone) { fAlone = alone; }
160  //! Only 2 Treelines in Plane 0
161  int GetAlone() const { return fAlone; }
162 
163  //! Rotate coordinates to right octant
164  void RotateCoordinates();
165 
166  //Rotate coordinates to account for any rotator pitch, yaw, or roll
167  void RotateRotator(const QwDetectorInfo* geometry);
168 
169  public: // members
170 
171  Double_t fOffsetX; ///< x coordinate (at MAGNET_CENTER)
172  Double_t fOffsetY; ///< y coordinate (at MAGNET_CENTER)
173  Double_t fSlopeX; ///< x slope
174  Double_t fSlopeY; ///< y slope
175 
176  // Results of the fit to the hits
177  Double_t fChi; ///< combined chi square
178  Double_t fCov[4][4]; ///< covariance matrix
179 
180  // record the slope and offset from each treeline,modified 4/26/11
181  Double_t TResidual[kNumDirections]; // record the residual in u v and x treelines(designed for R2)
182  Double_t fSignedResidual[12]; // record the signed residual in every plane(track point - hit point) (designed for R2)
183 
184  Bool_t fIsUsed; ///< used (part of a track)
185  Bool_t fIsVoid; ///< marked as being void
186  Bool_t fIsGood;
187 
188  Int_t fNumMiss; ///< missing hits
189  Int_t fNumHits; ///< used hits
190 
191  double pR2hit[3]; ///< x-y-z position at R2
192  double uvR2hit[3]; ///< direction at R2
193 
194  double pR3hit[3]; ///< x-y-z position at R3
195  double uvR3hit[3]; ///< direction at R3
196 
197  int fAlone; /// number of Plane 0 Treelines
198 
199 
200  private:
201 
202  double fAverageResidual; ///< average residual over all used treelines
203 
205 
206 }; // class QwPartialTrack
207 
209 
210 #endif // QWPARTIALTRACK_H
void SetAverageResidual()
QwPartialTrack & SmearAngleTheta(const double sigma)
Smear the theta angle.
QwPartialTrack & SmearPosition(const double sigma_x, const double sigma_y)
Smear the position.
QwPartialTrack & SmearAnglePhi(const double sigma)
Smear the phi angle.
Int_t GetNumberOfTreeLines() const
Get the number of tree lines.
const QwVertex * DeterminePositionInHDC(const QwGeometry &geometry)
Determine position in first horizontal drift chamber.
Double_t fOffsetX
x coordinate (at MAGNET_CENTER)
Contains vertex information.
Definition: QwVertex.h:23
QwPartialTrack & operator=(const QwPartialTrack &that)
Assignment operator.
bool IsGood() const
bool IsVoid() const
double GetAverageResidual() const
Double_t fSlopeY
y slope
double fAverageResidual
number of Plane 0 Treelines
int GetAlone() const
Only 2 Treelines in Plane 0.
Double_t GetMomentumDirectionTheta() const
Return the theta angle.
Double_t fChi
combined chi square
friend std::ostream & operator<<(std::ostream &stream, const QwPartialTrack &pt)
Int_t fNQwTreeLines
Number of tree lines in this partial track.
const TVector3 GetPosition(const double z) const
Return the vertex at position z.
QwTreeLine * CreateNewTreeLine()
Create a new tree line.
void AddTreeLine(const QwTreeLine *treeline)
Add an existing tree line as a copy.
Memory management structure to count objects.
double pR2hit[3]
x-y-z position at R2
VQwTrackingElementContainer< QwPartialTrack > QwPartialTrackContainer
void RotateCoordinates()
Rotate coordinates to right octant.
const TVector3 GetMomentumDirection() const
Return the direction.
bool IsNotValid() const
const QwTreeLine * GetTreeLine(const int tl) const
Get the specified tree line.
Memory management class to count object instantiations.
void Reset(Option_t *option="")
const QwVertex * DeterminePositionInTarget(const QwGeometry &geometry)
Determine vertex in the target.
const QwVertex * DeterminePositionInCerenkovBars(const QwGeometry &geometry)
Determine intersection with cerenkov bars.
double CalculateAverageResidual()
void SetAlone(const int alone)
Double_t GetVertexZ() const
Get the vertex position.
bool IsUsed() const
Double_t fCov[4][4]
covariance matrix
double uvR3hit[3]
direction at R3
void SetAverageResidual(const double residual)
Double_t fSlopeX
x slope
Definition of the one-dimensional track stubs.
Bool_t fIsVoid
marked as being void
Double_t TResidual[kNumDirections]
void Clear(Option_t *option="")
One-dimensional (u, v, or x) track stubs and associated hits.
Definition: QwTreeLine.h:51
bool IsNotUsed() const
double uvR2hit[3]
direction at R2
Definition of virtual base class for all tracking elements.
void RotateRotator(const QwDetectorInfo *geometry)
void ResetTreeLines(Option_t *option="")
Reset the list of tree lines.
Collection of QwDetectorInfo pointers that specifies an experimental geometry.
Definition: QwGeometry.h:27
double pR3hit[3]
x-y-z position at R3
const QwVertex * DeterminePositionInDetector(const QwDetectorInfo *geometry)
Determine vertex in detector.
ClassDef(QwPartialTrack, 1)
QwPartialTrack()
Default constructor.
Double_t fOffsetY
y coordinate (at MAGNET_CENTER)
Double_t fSignedResidual[12]
void PrintTreeLines(Option_t *option="") const
Print the list of tree lines.
Double_t GetMomentumDirectionPhi() const
Return the phi angle.
const QwVertex * DeterminePositionInTriggerScintillators(const QwGeometry &geometry)
Determine intersection with trigger scintillators.
void Initialize()
Initialization.
Bool_t fIsUsed
used (part of a track)
double GetChiWeight() const
std::vector< QwTreeLine * > fQwTreeLines
List of tree lines in this partial track.
virtual ~QwPartialTrack()
Destructor.
void AddTreeLineList(const QwTreeLine *treelinelist)
Add a linked list of existing tree lines as a copy.
bool IsValid() const
Int_t fNumMiss
missing hits
Contains the straight part of a track in one region only.
void ClearTreeLines(Option_t *option="")
Clear the list of tree lines.
const std::vector< QwTreeLine * > & GetListOfTreeLines() const
Get the list of tree lines.
Int_t fNumHits
used hits
Virtual base class for all tracking elements.
void Print(const Option_t *options=0) const