QwAnalysis
QwHit.h
Go to the documentation of this file.
1 /**
2  * \file QwHit.h
3  * \brief Draft skeleton for the decoding-to-QTR interface class.
4  *
5  * \author P. M. King
6  * \date 2008feb13
7  */
8 
9 #ifndef QWHIT_H
10 #define QWHIT_H
11 
12 // System headers
13 #include <iostream>
14 
15 // Qweak headers
16 #include "QwTypes.h"
17 #include "QwObjectCounter.h"
18 #include "VQwTrackingElement.h"
19 
20 // Forward declarations
21 class QwDetectorInfo;
22 
23 /**
24  * \class QwHit
25  * \ingroup QwTracking
26  *
27  * \brief Hit structure uniquely defining each hit
28  *
29  * This would either be used to generate the list of "Hit" elements
30  * used by QTR, or QTR (and this class) would be modified to use this
31  * as the base class instead of the "Hit" class (which is in tree.h).
32  *
33  * The decoding routines would create a vector of these objects which
34  * would contain all hits from all subsystems in each CODA event.
35  *
36  * Subsystem classes (derived from the VQwSubsystem class) would need
37  * to have routines to process the raw TDC data into this form.
38  *
39  * A rough example which ought to work for Region 2 exists as the
40  * QwDriftChamber class (although the decoding uses a previous algorithm
41  * and is in the process of being rewritten to support this form).
42  */
43 class QwHit : public VQwTrackingElement, public QwObjectCounter<QwHit> {
44 
45  public:
46 
47  //! \name Constructors
48  // (documented in QwHit.cc)
49  // @{
50  QwHit();
51  QwHit(const QwHit& that);
52  QwHit(const QwHit* that);
53  QwHit(Int_t bank_index, Int_t slot_num, Int_t chan, Int_t hitcount,
54  EQwRegionID region, EQwDetectorPackage package, Int_t octant,
55  Int_t plane, EQwDirectionID direction, Int_t wire, UInt_t rawdata = 0);
56  // @}
57 
58  //! \brief Destructor
59  virtual ~QwHit();
60 
61  private:
62  //! \brief Initialize the hit
63  void Initialize();
64 
65  public:
66  //! \brief Assignment operator
67  QwHit& operator= (const QwHit& hit);
68  //! \brief Ordering operator
69  Bool_t operator< (const QwHit& hit);
70  //! \brief Output stream operator
71  friend std::ostream& operator<< (std::ostream& stream, const QwHit& hit);
72 
73  //! \brief Print debugging information
74  void Print(const Option_t* options = 0) const;
75 
76  //! \name Getter functions
77  // @{
78  const Int_t& GetSubbankID() const { return fCrate; };
79  const Int_t& GetModule() const { return fModule; };
80  const Int_t& GetChannel() const { return fChannel; };
81  const Int_t& GetHitNumber() const { return fHitNumber; };
82  const Int_t& GetHitNumberR() const { return fHitNumber_R; };
83 
84  const Bool_t& AmbiguousElement() const { return fAmbiguousElement; };
85  const Bool_t& LRAmbiguity() const { return fLRAmbiguity; };
86 
87  const UInt_t& GetRawTime() const { return fRawTime; };
88  const UInt_t& GetRawRefTime() const { return fRawRefTime; };
89  const Double_t& GetTime() const { return fTime; };
90  const Double_t& GetTimeNs() const { return fTimeNs; };
91  const Double_t& GetTimeRes() const { return fTimeRes; };
92  const Double_t& GetDriftDistance() const { return fDistance; };
93  const Double_t& GetDriftPosition() const { return fDriftPosition; };
94  const Double_t& GetWirePosition() const { return fWirePosition; };
95 
96  const Double_t& GetTreeLinePosition() const { return fTreeLinePosition; };
97  const Double_t& GetTreeLineResidual() const { return fTreeLineResidual; };
98  const Double_t& GetPartialTrackPosition() const { return fPartialTrackPosition; };
99  const Double_t& GetPartialTrackResidual() const { return fPartialTrackResidual; };
100 
101  const Bool_t& IsUsed() const { return fIsUsed; };
102 
103  const QwDetectorID GetDetectorID() const; // QwHit.cc
104  const QwElectronicsID GetElectronicsID() const; // QwHit.cc
105  // @}
106 
107 
108  //! \name Setter functions
109  // @{
110  void SetSubbankID(const Int_t bank_index) { fCrate = bank_index; };
111  void SetModule(const Int_t slot_num) { fModule = slot_num; };
112  void SetChannel(const Int_t chan) { fChannel = chan; };
113  void SetHitNumber(const Int_t hitcount) { fHitNumber = hitcount; };
114  void SetHitNumberR(const Int_t hitcountr) { fHitNumber_R = hitcountr; };
115 
116  void SetAmbiguousElement(const Bool_t amelement) { fAmbiguousElement = amelement; };
117  void SetLRAmbiguity(const Bool_t amlr) { fLRAmbiguity = amlr; };
118 
119  void SetAmbiguityID(const Bool_t amelement, const Bool_t amlr); // QwHit.cc
120 
121  void SetRawTime(const UInt_t rawtime) { fRawTime = rawtime; };
122  void SetRawRefTime(const UInt_t rawreftime) { fRawRefTime = rawreftime; };
123  void SetTimens(const Double_t timens) { fTimeNs = timens; };
124  void SetTime(const Double_t time) { fTime = time; };
125  void SetTimeRes(const Double_t timeres) { fTimeRes = timeres; };
126  void SetDriftDistance(const Double_t distance) { fDistance = distance; };
127  void SetDriftPosition(const Double_t position) { fDriftPosition = position; };
128  void SetWirePosition(const Double_t position) { fWirePosition = position; };
129 
130  void SetTreeLinePosition(const Double_t position) { fTreeLinePosition = position; };
131  void SetPartialTrackPosition(const Double_t position) { fPartialTrackPosition = position; };
132  void SetTreeLineResidual(const Double_t residual) { fTreeLineResidual = residual; };
133  void SetPartialTrackResidual(const Double_t residual) { fPartialTrackResidual = residual; };
134 
135  void SetSpatialResolution(const Double_t sresolution) { fSpatialResolution = sresolution; };
136  void SetTrackResolution(const Double_t tresolution) { fTrackResolution = tresolution; };
137 
138  void SetUsed(const Bool_t isused = true) { fIsUsed = isused; };
139  // @}
140 
141  Bool_t IsFirstDetectorHit() { return (fHitNumber == 0); };
142 
143  void SubtractTimeAuOffset(Double_t time_au_offset) { fTime -= time_au_offset; };
144  void SubtractTimeNsOffset(Double_t time_ns_offset) { fTimeNs -= time_ns_offset; };
145 
146  void ApplyTimeCalibration(Double_t f1tdc_resolution_ns) {
147  fTimeRes = f1tdc_resolution_ns;
149  };
150 
151  // three functions and their comments can be found in QwHit.cc,
152  Bool_t PlaneMatches(EQwRegionID region, EQwDetectorPackage package, Int_t plane);
153  Bool_t DirMatches(EQwRegionID region, EQwDetectorPackage package, EQwDirectionID dir);
154  Bool_t WireMatches(EQwRegionID region, EQwDetectorPackage package, Int_t plane, Int_t wire);
155 
158  };
161  };
162 
163  public:
164 
165  // Identification information for readout channels
166  Int_t fCrate; ///< ROC number
167  Int_t fModule; ///< F1TDC slot number, or module index
168  Int_t fChannel; ///< Channel number
169  Int_t fHitNumber; ///< Index for multiple hits in a single channel on the left
170  Int_t fHitNumber_R; ///< Index for multiple hits in a single channel on the right
171 
172  Bool_t fAmbiguousElement; ///< TRUE if this hit could come from two different elements
173  /// (used by Region 3 tracking only)
174  Bool_t fLRAmbiguity; ///< TRUE if the other element is 8 wires "right";
175  /// FALSE if the other element is 8 wires "left" (used by Region 3 tracking only)
176 
177 
178  // Data specific to the hit
179  UInt_t fRawTime; ///< Time as reported by TDC; it is a raw data word, and is UNSUBTRACTED
180  UInt_t fRawRefTime; ///< Time as reported by TDC as a reference time
181  Double_t fTimeNs; ///< Reference Corrected and TimeCalibration time (unit ns)
182  Double_t fTime; ///< Start corrected time, may also be further modified
183  Double_t fTimeRes; ///< Resolution of time (if appropriate)
184  Double_t fDistance; ///< Perpendicular distance from the wire to the track,
185  /// as reconstructed from the drift time
186  Double_t fDriftPosition; ///< Position of the decoded hit in the drift cell
187  Double_t fWirePosition; ///< Longitudinal position of the hit (this is mainly
188  /// used in region 3 where the z coordinate is taken
189  /// in the wire plane instead of perpendicular to it)
190 
191  Double_t fTreeLinePosition; ///< Position of the fitted treeline through the drift cell
192  Double_t fTreeLineResidual; ///< Treeline residual of this hit (difference between
193  /// the drift distance and the distance to the fitted track)
194 
195  Double_t fPartialTrackPosition; ///< Position of the fitted treeline through the drift cell
196  Double_t fPartialTrackResidual; ///< Partial track residual of this hit (difference between
197  /// the drift distance and the distance to the fitted track)
198 
199  Double_t fSpatialResolution; ///< Spatial resolution
200  Double_t fTrackResolution; ///< Track resolution
201 
202  Bool_t fIsUsed; //! ///< Is this hit used in a tree line?
203 
204 
205  ClassDef(QwHit,1);
206 
207 }; // class QwHit
208 
209 #endif // QWHIT_H
void Initialize()
Initialize the hit.
Definition: QwHit.cc:112
const QwDetectorID GetDetectorID() const
Definition: QwHit.cc:321
void CalculateTreeLineResidual()
Definition: QwHit.h:156
void SetSubbankID(const Int_t bank_index)
Definition: QwHit.h:110
void SetLRAmbiguity(const Bool_t amlr)
Definition: QwHit.h:117
friend std::ostream & operator<<(std::ostream &stream, const QwHit &hit)
Output stream operator.
Definition: QwHit.cc:276
void SubtractTimeAuOffset(Double_t time_au_offset)
Definition: QwHit.h:143
void SetSpatialResolution(const Double_t sresolution)
Definition: QwHit.h:135
const Bool_t & IsUsed() const
Definition: QwHit.h:101
void SetHitNumber(const Int_t hitcount)
Definition: QwHit.h:113
void SetChannel(const Int_t chan)
Definition: QwHit.h:112
Double_t fDistance
Definition: QwHit.h:184
Bool_t DirMatches(EQwRegionID region, EQwDetectorPackage package, EQwDirectionID dir)
Definition: QwHit.cc:348
Int_t fChannel
Channel number.
Definition: QwHit.h:168
const Int_t & GetHitNumberR() const
Definition: QwHit.h:82
const Double_t & GetTimeRes() const
Definition: QwHit.h:91
const UInt_t & GetRawRefTime() const
Definition: QwHit.h:88
UInt_t fRawRefTime
Time as reported by TDC as a reference time.
Definition: QwHit.h:180
Double_t fSpatialResolution
Spatial resolution.
Definition: QwHit.h:199
void SetTrackResolution(const Double_t tresolution)
Definition: QwHit.h:136
const Double_t & GetTimeNs() const
Definition: QwHit.h:90
void SetTreeLinePosition(const Double_t position)
Definition: QwHit.h:130
const UInt_t & GetRawTime() const
Definition: QwHit.h:87
Double_t fTimeRes
Resolution of time (if appropriate)
Definition: QwHit.h:183
void SetHitNumberR(const Int_t hitcountr)
Definition: QwHit.h:114
void SetPartialTrackPosition(const Double_t position)
Definition: QwHit.h:131
void SetUsed(const Bool_t isused=true)
Definition: QwHit.h:138
Bool_t fLRAmbiguity
Definition: QwHit.h:174
EQwDetectorPackage
Definition: QwTypes.h:70
Double_t fTrackResolution
Track resolution.
Definition: QwHit.h:200
Double_t fTreeLinePosition
Position of the fitted treeline through the drift cell.
Definition: QwHit.h:191
Memory management structure to count objects.
void SetDriftPosition(const Double_t position)
Definition: QwHit.h:127
const Double_t & GetWirePosition() const
Definition: QwHit.h:94
const Int_t & GetModule() const
Definition: QwHit.h:79
Double_t fDriftPosition
Position of the decoded hit in the drift cell.
Definition: QwHit.h:186
Double_t fTimeNs
Reference Corrected and TimeCalibration time (unit ns)
Definition: QwHit.h:181
Double_t fTreeLineResidual
Definition: QwHit.h:192
const Bool_t & LRAmbiguity() const
Definition: QwHit.h:85
QwHit & operator=(const QwHit &hit)
Assignment operator.
Definition: QwHit.cc:153
const Double_t & GetPartialTrackPosition() const
Definition: QwHit.h:98
const Double_t & GetPartialTrackResidual() const
Definition: QwHit.h:99
EQwRegionID
Definition: QwTypes.h:16
Bool_t fIsUsed
Definition: QwHit.h:202
Bool_t operator<(const QwHit &hit)
Ordering operator.
Definition: QwHit.cc:203
const Double_t & GetTreeLineResidual() const
Definition: QwHit.h:97
void SetTime(const Double_t time)
Definition: QwHit.h:124
const Int_t & GetHitNumber() const
Definition: QwHit.h:81
Memory management class to count object instantiations.
const Double_t & GetDriftDistance() const
Definition: QwHit.h:92
void SetPartialTrackResidual(const Double_t residual)
Definition: QwHit.h:133
void CalculatePartialTrackResidual()
Definition: QwHit.h:159
void SetRawTime(const UInt_t rawtime)
Definition: QwHit.h:121
Int_t fModule
F1TDC slot number, or module index.
Definition: QwHit.h:167
void SetModule(const Int_t slot_num)
Definition: QwHit.h:111
void Print(const Option_t *options=0) const
Print debugging information.
Definition: QwHit.cc:314
const Double_t & GetDriftPosition() const
Definition: QwHit.h:93
void SetDriftDistance(const Double_t distance)
Definition: QwHit.h:126
Bool_t WireMatches(EQwRegionID region, EQwDetectorPackage package, Int_t plane, Int_t wire)
Definition: QwHit.cc:357
void SetTimens(const Double_t timens)
Definition: QwHit.h:123
Double_t fTime
Start corrected time, may also be further modified.
Definition: QwHit.h:182
const Double_t & GetTreeLinePosition() const
Definition: QwHit.h:96
const Bool_t & AmbiguousElement() const
Definition: QwHit.h:84
const Int_t & GetSubbankID() const
Definition: QwHit.h:78
void SetAmbiguityID(const Bool_t amelement, const Bool_t amlr)
Definition: QwHit.cc:333
const Int_t & GetChannel() const
Definition: QwHit.h:80
Bool_t fAmbiguousElement
Definition: QwHit.h:172
Definition of virtual base class for all tracking elements.
void SetWirePosition(const Double_t position)
Definition: QwHit.h:128
EQwDirectionID
Definition: QwTypes.h:41
Double_t fPartialTrackResidual
Definition: QwHit.h:196
void SetTimeRes(const Double_t timeres)
Definition: QwHit.h:125
Hit structure uniquely defining each hit.
Definition: QwHit.h:43
Int_t fCrate
ROC number.
Definition: QwHit.h:161
const Double_t & GetTime() const
Definition: QwHit.h:89
Bool_t PlaneMatches(EQwRegionID region, EQwDetectorPackage package, Int_t plane)
Definition: QwHit.cc:341
void SetAmbiguousElement(const Bool_t amelement)
Definition: QwHit.h:116
Int_t fHitNumber
Index for multiple hits in a single channel on the left.
Definition: QwHit.h:169
void ApplyTimeCalibration(Double_t f1tdc_resolution_ns)
Definition: QwHit.h:146
Bool_t IsFirstDetectorHit()
Definition: QwHit.h:141
void SubtractTimeNsOffset(Double_t time_ns_offset)
Definition: QwHit.h:144
ClassDef(QwHit, 1)
///&lt; Is this hit used in a tree line?
void SetRawRefTime(const UInt_t rawreftime)
Definition: QwHit.h:122
Double_t fPartialTrackPosition
Position of the fitted treeline through the drift cell.
Definition: QwHit.h:195
Double_t fWirePosition
Definition: QwHit.h:187
Int_t fHitNumber_R
Index for multiple hits in a single channel on the right.
Definition: QwHit.h:170
void SetTreeLineResidual(const Double_t residual)
Definition: QwHit.h:132
virtual ~QwHit()
Destructor.
Definition: QwHit.cc:106
QwHit()
Definition: QwHit.cc:17
const QwElectronicsID GetElectronicsID() const
Definition: QwHit.cc:327
Virtual base class for all tracking elements.
UInt_t fRawTime
Time as reported by TDC; it is a raw data word, and is UNSUBTRACTED.
Definition: QwHit.h:179