StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTpcHit.h
1 
5 /***************************************************************************
6  *
7  * $Id: StTpcHit.h,v 2.34 2018/10/17 20:45:26 fisyak Exp $
8  *
9  * Author: Thomas Ullrich, Jan 1999
10  ***************************************************************************
11  *
12  * Description:
13  *
14  ***************************************************************************
15  *
16  * $Log: StTpcHit.h,v $
17  * Revision 2.34 2018/10/17 20:45:26 fisyak
18  * Restore update for Run XVIII dE/dx calibration removed by Gene on 08/07/2018
19  *
20  * Revision 2.32 2018/08/06 15:54:30 fisyak
21  * Add dX
22  *
23  * Revision 2.30 2016/05/16 02:44:00 perev
24  * Added init of mAdd. (Coverity)
25  *
26  * Revision 2.29 2016/02/25 17:10:20 ullrich
27  * Implemented detector() which is now a pure abstract method in StHit.
28  *
29  * Revision 2.28 2014/01/15 21:00:54 fisyak
30  * Step back with version
31  *
32  * Revision 2.27 2014/01/15 20:59:14 fisyak
33  * Step back with version
34  *
35  * Revision 2.25 2013/12/17 15:01:40 fisyak
36  * Add transient data members for upper and lower pad positons
37  *
38  * Revision 2.23 2013/07/16 14:29:04 fisyak
39  * Restore mass fit tracks
40  *
41  * Revision 2.22 2012/10/23 20:17:16 fisyak
42  * Allow more then 64 pad rows
43  *
44  * Revision 2.21 2011/10/17 00:13:49 fisyak
45  * Add handles for IdTruth info
46  *
47  * Revision 2.20 2011/05/12 22:25:48 fisyak
48  * Restore hit errors as persistent, add sort to TpcHit
49  *
50  * Revision 2.19 2011/03/31 19:25:13 fisyak
51  * Keep ADC value for cluster
52  *
53  * Revision 2.18 2011/01/20 18:25:41 genevb
54  * Place FCF_flags include where it is needed
55  *
56  * Revision 2.17 2010/10/04 19:06:13 fisyak
57  * Add reference to FCF flag definition
58  *
59  * Revision 2.16 2010/08/31 20:01:04 fisyak
60  * Fix no. of padsInHit, accounting afterburner
61  *
62  * Revision 2.15 2010/03/26 13:47:29 fisyak
63  * Add methods to modify hit content
64  *
65  * Revision 2.14 2009/11/23 22:20:51 ullrich
66  * Minor cleanup performed, fixed compiler warnings.
67  *
68  * Revision 2.13 2009/11/23 16:34:07 fisyak
69  * Cleanup, remove dependence on dst tables, clean up software monitors
70  *
71  * Revision 2.12 2007/10/03 21:47:36 ullrich
72  * Added several new member to hold hit length info.
73  *
74  * Revision 2.11 2004/08/06 15:37:09 fisyak
75  * Add clster id
76  *
77  * Revision 2.10 2004/07/15 16:36:25 ullrich
78  * Removed all clone() declerations and definitions. Use StObject::clone() only.
79  *
80  * Revision 2.9 2003/01/08 19:43:11 perev
81  * CleanUp
82  *
83  * Revision 2.8 2002/02/22 22:56:52 jeromel
84  * Doxygen basic documentation in all header files. None of this is required
85  * for QM production.
86  *
87  * Revision 2.7 2001/04/05 04:00:44 ullrich
88  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
89  *
90  * Revision 2.6 2001/03/24 03:34:59 perev
91  * clone() -> clone() const
92  *
93  * Revision 2.5 1999/12/13 20:16:27 ullrich
94  * Changed numbering scheme for hw_position unpack methods (STAR conventions).
95  *
96  * Revision 2.4 1999/12/01 15:56:31 ullrich
97  * Renamed xxxInCluster() methods to xxxInHit()
98  *
99  * Revision 2.3 1999/11/11 10:19:55 ullrich
100  * Inlined sector() and padrow().
101  *
102  * Revision 2.2 1999/11/09 19:35:27 ullrich
103  * Memory now allocated using StMemoryPool via overloaded new/delete
104  *
105  * Revision 2.1 1999/10/28 22:27:10 ullrich
106  * Adapted new StArray version. First version to compile on Linux and Sun.
107  *
108  * Revision 2.0 1999/10/12 18:42:51 ullrich
109  * Completely Revised for New Version
110  *
111  **************************************************************************/
112 #ifndef StTpcHit_hh
113 #define StTpcHit_hh
114 
115 #include "StHit.h"
116 #include "StMemoryPool.hh"
117 #include "TMath.h"
118 
119 class StTpcHit : public StHit {
120 
121  public:
122  StTpcHit() : StHit() {mMinpad = mMaxpad = mMintmbk = mMaxtmbk = 0; mMcl_x = mMcl_t = 0; mAdc =0; mChargeModified = 0; mdX = 0;}
123  StTpcHit(const StThreeVectorF& p,
124  const StThreeVectorF& e,
125  UInt_t hw, float q, UChar_t c = 0,
126  Int_t IdTruth=0, UShort_t quality=0,
127  UShort_t Id =0,
128  Short_t mnpad=0, Short_t mxpad=0, Short_t mntmbk=0,
129  Short_t mxtmbk=0, Float_t cl_x = 0, Float_t cl_t = 0, UShort_t Adc = 0)
130  : StHit(p, e, hw, q, c, IdTruth, quality, Id), mAdc(Adc) {
131  setExtends(cl_x, cl_t, mnpad, mxpad, mntmbk, mxtmbk); mChargeModified = 0; mdX = 0;}
132  ~StTpcHit() {}
133 
134  StDetectorId detector() const;
135 
136  void* operator new(size_t /* sz */,void *p) { return p;}
137  void* operator new(size_t) { return mPool.alloc(); }
138  void operator delete(void* p) { mPool.free(p); }
139 
140  void setChargeModified(Float_t Charge) {mChargeModified = Charge;}
141  void setPadTmbk(Float_t cl_x, Float_t cl_t) { mMcl_x = TMath::Nint(cl_x*64); mMcl_t = TMath::Nint(cl_t*64);}
142  void setExtends(Float_t cl_x, Float_t cl_t, Short_t mnpad, Short_t mxpad, Short_t mntmbk, Short_t mxtmbk);
143  void setAdc(UShort_t Adc = 0) {mAdc = Adc;}
144  void setdX(Float_t dX) {mdX = dX;}
145  UInt_t sector() const {return bits(4, 5);} // bits 4-8 -> 1-24
146  UInt_t padrow() const {return bits(9, 7);} // bits 9-15 -> 1-128
147  UInt_t padsInHit() const {return maxPad() - minPad() + 1;}
148  UInt_t pixelsInHit() const {return bits(22,10);}; // bits 22-31 obsolete (TCL only, FCF put no. of time buckets)
149  UChar_t minPad() const {return TMath::Nint(mMcl_x/64.) - mMinpad;}
150  UChar_t maxPad() const {return TMath::Nint(mMcl_x/64.) + mMaxpad;}
151  Short_t minTmbk() const {return TMath::Nint(mMcl_t/64.) - mMintmbk;}
152  Short_t maxTmbk() const {return TMath::Nint(mMcl_t/64.) + mMaxtmbk;}
153  Int_t volumeID() const {return 100 * sector() + padrow();}
154  Short_t timeBucketsInHit() const {return maxTmbk() - minTmbk() + 1;} // number of time bucket fired in this hit
155  Float_t timeBucket() const {return static_cast<float>(mMcl_t)/64.;}
156  Float_t pad() const {return static_cast<float>(mMcl_x)/64.;}
157  UShort_t adc() const {return mAdc;}
158  Float_t chargeModified() const {return mChargeModified;}
159  Float_t dX() {return mdX;}
160  void Print(Option_t *option="") const;
161  virtual Bool_t IsSortable() const { return kTRUE; }
162  virtual Int_t Compare(const TObject *obj) const {
163  StTpcHit *hit = (StTpcHit *) obj;
164  if (sector() > hit->sector()) return kTRUE;
165  if (padrow() > hit->padrow()) return kTRUE;
166  if (TMath::Abs(position().z()) > TMath::Abs(hit->position().z())) return kTRUE;
167  return kFALSE;
168  }
169  virtual const StThreeVectorF& positionU() const {return *&mPositionU;}
170  virtual const StThreeVectorF& positionL() const {return *&mPositionL;}
171  virtual void setPositionU(const StThreeVectorF& p) {mPositionU = p;}
172  virtual void setPositionL(const StThreeVectorF& p) {mPositionL = p;}
173 
174 protected:
175  static StMemoryPool mPool;
176  UChar_t mMinpad; /* central pad - lowest pad id in this hit*/
177  UChar_t mMaxpad; /* highest pad id in this hit - central pad */
178  UChar_t mMintmbk; /* central timebucket - lowest time bucket in hit*/
179  UChar_t mMaxtmbk; /* highest time bucket in hit - central timebucket */
180  Short_t mMcl_x; /* average pad*64 */
181  Short_t mMcl_t; /* average timebucket*64 */
182  UShort_t mAdc; /* cluster ADC sum */
183  Float_t mChargeModified;
184  StThreeVectorF mPositionU; // upper position = y_local + padlength/2.
185  StThreeVectorF mPositionL; // lower position = y_local - padlength/2.
186  Float_t mdX; // estimated dX from StdEdxY2Maker
187  ClassDef(StTpcHit,10)
188 };
189 ostream& operator<<(ostream& os, StTpcHit const & v);
190 
191 inline StDetectorId StTpcHit::detector() const {return (bits(1,1) ? kiTpcId : kTpcId);}
192 
193 #endif
Definition: StHit.h:125