StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHit.h
1 
5 /***************************************************************************
6  *
7  * $Id: StHit.h,v 2.30 2016/02/25 17:07:14 ullrich Exp $
8  *
9  * Author: Thomas Ullrich, Jan 1999
10  ***************************************************************************
11  *
12  * Description:
13  *
14  ***************************************************************************
15  *
16  * $Log: StHit.h,v $
17  * Revision 2.30 2016/02/25 17:07:14 ullrich
18  * Removed implentation of detector() making class pure abstract.
19  *
20  * Revision 2.29 2015/10/09 17:46:14 ullrich
21  * Changed type of mIdTruth from ushort to int.
22  *
23  * Revision 2.28 2012/01/24 03:04:22 perev
24  * Cleanup
25  *
26  * Revision 2.27 2011/10/17 00:13:49 fisyak
27  * Add handles for IdTruth info
28  *
29  * Revision 2.26 2011/05/12 22:25:48 fisyak
30  * Restore hit errors as persistent, add sort to TpcHit
31  *
32  * Revision 2.25 2011/01/21 18:30:45 fisyak
33  * fix setFlag with UShort_t
34  *
35  * Revision 2.24 2011/01/21 16:14:40 fisyak
36  * change mFlag type from UChar_t to UShort_t (bug #2058)
37  *
38  * Revision 2.23 2009/11/10 00:40:17 ullrich
39  * Changed print-out format.
40  *
41  * Revision 2.22 2008/04/02 20:43:58 fisyak
42  * Don't store mPositionError in file
43  *
44  * Revision 2.21 2006/01/19 21:50:02 ullrich
45  * Made detector() virtual method.
46  *
47  * Revision 2.20 2005/12/07 19:03:23 perev
48  * mId short ==> int
49  *
50  * Revision 2.19 2005/07/19 21:34:24 perev
51  * quality ==> qaTruth to avoid misleading
52  *
53  * Revision 2.18 2005/07/06 18:57:48 fisyak
54  * Add StHit print out
55  *
56  * Revision 2.17 2005/01/26 23:04:12 perev
57  * const for Sthit* nextHit()
58  *
59  * Revision 2.16 2004/08/19 21:58:53 ullrich
60  * Fixed omitted implementation of nextHit().
61  *
62  * Revision 2.15 2004/08/18 19:00:19 ullrich
63  * Added access function hardwarePosition().
64  *
65  * Revision 2.14 2004/08/06 15:37:09 fisyak
66  * Add clster id
67  *
68  * Revision 2.13 2004/07/30 22:28:31 fisyak
69  * Add transient pointer to next Hit
70  *
71  * Revision 2.12 2004/07/15 16:36:24 ullrich
72  * Removed all clone() declerations and definitions. Use StObject::clone() only.
73  *
74  * Revision 2.11 2004/03/30 15:59:08 calderon
75  * Added method to set mFitFlag (new chain no longer uses tables, so must set
76  * this by hand).
77  *
78  * Revision 2.10 2004/01/13 21:01:32 fisyak
79  * Add Truth and Quality information from simulation
80  *
81  * Revision 2.9 2002/02/22 22:56:48 jeromel
82  * Doxygen basic documentation in all header files. None of this is required
83  * for QM production.
84  *
85  * Revision 2.8 2001/04/25 17:46:56 jeromel
86  * Remove last change. There is another way to fix the problems seen (the right way
87  * actually) which Thomas will take care off.
88  *
89  * Revision 2.7 2001/04/25 15:57:22 jeromel
90  * Fixed cint problem with StContainers.h
91  *
92  * Revision 2.6 2001/04/05 04:00:38 ullrich
93  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
94  *
95  * Revision 2.5 2001/03/24 03:34:50 perev
96  * clone() -> clone() const
97  *
98  * Revision 2.4 2000/07/28 23:29:42 calderon
99  * Added handling of Fit Flag: use this flag to tell if the point
100  * is used in the fit.
101  *
102  * Revision 2.3 2000/06/07 09:43:21 ullrich
103  * Changed return type of flag() to unsigned int
104  *
105  * Revision 2.2 2000/06/01 21:38:56 ullrich
106  * Added member mFlag and access member flag() and setFlag().
107  *
108  * Revision 2.1 1999/10/28 22:25:50 ullrich
109  * Adapted new StArray version. First version to compile on Linux and Sun.
110  *
111  * Revision 2.0 1999/10/12 18:42:21 ullrich
112  * Completely Revised for New Version
113  *
114  **************************************************************************/
115 #ifndef StHit_hh
116 #define StHit_hh
117 
118 #include "StMeasuredPoint.h"
119 #include "StEnumerations.h"
120 #include "StContainers.h"
121 
122 class StTrackNode;
123 class StTrack;
124 
125 class StHit : public StMeasuredPoint {
126 public:
127  StHit();
128  StHit(const StThreeVectorF& position,
129  const StThreeVectorF& errors,
130  unsigned int hardware,
131  float charge,
132  unsigned char trakRefCount = 0,
133  int idTruth=0,
134  unsigned short quality=0,
135  unsigned short id =0);
136  // StHit(const StHit&); use default
137  // StHit& operator=(const StHit&); use default
138  ~StHit();
139 
140  int operator==(const StHit&) const;
141  int operator!=(const StHit&) const;
142 
143  float charge() const;
144  unsigned int trackReferenceCount() const;
145  unsigned int flag() const;
146  StThreeVectorF positionError() const; // overwrite inherited
147  StMatrixF covariantMatrix() const; // overwrite inherited
148  int usedInFit() const;
149  int idTruth() const;
150  int qaTruth() const { return mQuality; }
151  int id() const;
152  const StHit* nextHit() const;
153  unsigned int hardwarePosition() const;
154 
155 
156  void setCharge(float);
157  void setFlag(unsigned short val) { mFlag = val; }
158  void setFitFlag(unsigned char);
159  void setTrackReferenceCount(unsigned char);
160  void setHardwarePosition(unsigned int);
161  void setPositionError(const StThreeVectorF&);
162  void setId(int Id) {mId = Id;}
163  void setIdTruth(int idtru, int qatru=0);
164  void SetNextHit(StHit *next = 0) {mNextHit = next;}
165 
166  virtual StDetectorId detector() const = 0;
167  virtual void Print(Option_t *option="") const;
168 
169 protected:
170  unsigned int bits(unsigned int, unsigned int) const;
171 
172  UInt_t mHardwarePosition;
173  StThreeVectorF mPositionError;
174  Float_t mCharge;
175  Int_t mId;
176  Int_t mIdTruth; // simulation track id
177  UShort_t mQuality; // quality of this information (percentage of charge produced by mIdTruth)
178  UChar_t mFitFlag;
179  UChar_t mTrackRefCount;
180  UShort_t mFlag;
181  StHit* mNextHit;
182  ClassDef(StHit,8)
183 };
184 
185 inline unsigned int StHit::bits(unsigned int bit, unsigned int nbits) const
186 {
187  return (mHardwarePosition>>bit) & ~(~0UL<<nbits);
188 }
189 
190 inline unsigned int StHit::hardwarePosition() const {return mHardwarePosition;}
191 inline int StHit::id() const {return mId;}
192 inline const StHit* StHit::nextHit() const {return mNextHit;}
193 
194 ostream& operator<<(ostream& os, StHit const & v);
195 #endif
Definition: StHit.h:125