StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtHit.h
1 /***************************************************************************
2  *
3  * $Id: StFgtHit.h,v 2.5 2016/02/25 17:10:20 ullrich Exp $
4  * Author: S. Gliske, Oct 2011
5  *
6  ***************************************************************************
7  *
8  * Description: data for individual ``hit'' on the FGT, i.e. a 1D cluster.
9  *
10  ***************************************************************************
11  *
12  * $Log: StFgtHit.h,v $
13  * Revision 2.5 2016/02/25 17:10:20 ullrich
14  * Implemented detector() which is now a pure abstract method in StHit.
15  *
16  * Revision 2.4 2013/04/24 17:27:43 ullrich
17  * New methods and members (Akio and Anselm)
18  *
19  * Revision 2.3 2012/11/08 17:58:31 ullrich
20  * major revision, various new methods and member added (Anselm/Akio)
21  *
22  * Revision 2.2 2012/07/21 03:32:34 perev
23  * BugFix define detector()
24  *
25  * Revision 2.1 2012/04/16 20:20:49 ullrich
26  * Initial Revision
27  *
28  *
29  **************************************************************************/
30 
31 #ifndef _ST_FGT_HIT_H_
32 #define _ST_FGT_HIT_H_
33 
34 #include <map>
35 
36 #include "StHit.h"
37 #include "StFgtStrip.h"
38 
39 // Note: not const StFgtStrip, so the clustering can modify the
40 // strips. Clustering algos require these to be ordered by geoId.
41 // Note also, the stripWeightMap_t is only used in memory, and is not
42 // streamed.
43 typedef std::map< StFgtStrip*, float, stripPtrLessThan > stripWeightMap_t;
44 
45 class StFgtHit : public StHit {
46 public:
47  // constructors
48  StFgtHit(int key = -1, int centralStripGeoId = -1, float charge = 0,
49  short disc = -1, short quad = -1, char layer = ' ',
50  float rPos = 0, float rErr = 10000, float phiPos = 0, float phiErr = 10000, float zPos = 0, float zErr = 10000 );
51  // StFgtHit(const StFgtHit&); --> use default
52  // StFgtHit& operator=(const StFgtHit&); --> use default
53 
54  // deconstructor
55  ~StFgtHit();
56 
57  StDetectorId detector() const {return kFgtId;};
58 
59  // accessors/modifiers for the map
60  stripWeightMap_t& getStripWeightMap();
61  const stripWeightMap_t& getStripWeightMap() const;
62 
63  // modifer
64  void setHardwareId( short disc, short quad, char layer );
65 
66  // other accessors
67  int getKey() const;
68  int getDisc() const;
69  int getQuad() const;
70  char getLayer() const;
71  int getCentralStripGeoId() const;
72  float getPositionR() const;
73  float getPositionPhi() const;
74  float getPositionZ() const;
75  float getErrorR() const;
76  float getErrorPhi() const;
77  float getErrorZ() const;
78  // note: no getCharge, as already have charge() defined through parent StHit
79  float getChargeUncert() const;
80  short calcMaxAdc(); //get from stripWeightMap_t
81  short getMaxAdc() const; //get from data member
82  float getLandauNorm() const;
83  float getLandauMpv() const;
84  float getLandauSigma() const;
85  float getLandauChi2() const;
86  int getNstrip() const;
87  int getMaxTimeBin() const;
88  int getSeedType() const;
89  float getEvenOddChargeAsy() const;
90 
91  // modifiers
92  void setCentralStripGeoId( int geoId );
93  void setPositionR( float position );
94  void setPositionPhi( float position );
95  void setPositionZ( float position );
96  void setErrorR( float error );
97  void setErrorPhi( float error );
98  void setErrorZ( float error );
99  void setDisc( short disc );
100  void setQuad( short quad );
101  void setLayer( char layer );
102  void setChargeUncert( float sigma );
103  void setMaxAdc(short v);
104  void setNstrip(int v);
105  void setMaxTimeBin(int v);
106  void setLandau(float norm, float mpv, float sigma, float chi2);
107  void setSeedType(int v);
108  void setEvenOddChargeAsy(float v);
109 
110 protected:
111  void update2error(); // set x,y part of inherited mPositionError
112 
113 
114 protected:
115  // data members
116  Int_t mKey; // unique label
117  Float_t mR, mErrR, mPhi, mErrPhi; // r, phi, z position and error
118  Int_t mCentralStripGeoId; // obvious
119  Float_t mChargeUncert; // uncertanity on the charge
120  Short_t mMaxAdc; // max adc in all strips and timebin
121  Float_t mLandauNorm;
122  Float_t mLandauMpv;
123  Float_t mLandauSigma;
124  Float_t mLandauChi2;
125  Int_t mNstrip; // number of strips in the hit
126  Int_t mMaxTimeBin; // time bin for max adc
127  Int_t mSeedType; // seed type
128  Float_t mEvenOddChargeAsy; // (even-odd)/sum charge for phi layer
129  // for keeping track of which strips constribute to which cluster (not persistant)
130  stripWeightMap_t mStripWeightMap;
131 
132 private:
133  ClassDef(StFgtHit,3);
134 };
135 
136 
137 // inline functions
138 
139 inline short StFgtHit::calcMaxAdc() {
140  mMaxAdc = -1;
141 
142  for(stripWeightMap_t::const_iterator it=mStripWeightMap.begin(); it != mStripWeightMap.end(); it++ ){
143  short adcVal = it->first->getMaxAdc();
144  if( adcVal > mMaxAdc )
145  mMaxAdc = adcVal;
146  };
147 
148  return mMaxAdc;
149 }
150 
151 inline int StFgtHit::getDisc() const {
152  return static_cast< int >(mHardwarePosition/8);
153 };
154 
155 inline int StFgtHit::getQuad() const {
156  return static_cast< int >((mHardwarePosition/2)%4);
157 };
158 
159 inline char StFgtHit::getLayer() const {
160  return (mHardwarePosition % 2) ? 'R' : 'P';
161 };
162 
163 inline int StFgtHit::getKey() const {
164  return mKey;
165 };
166 
167 inline stripWeightMap_t& StFgtHit::getStripWeightMap() {
168  return mStripWeightMap;
169 };
170 
171 inline const stripWeightMap_t& StFgtHit::getStripWeightMap() const {
172  return mStripWeightMap;
173 };
174 
175 inline void StFgtHit::setHardwareId( short disc, short quad, char layer ){
176  mHardwarePosition = disc*8+quad*2+(layer=='R');
177 };
178 
179 inline int StFgtHit::getCentralStripGeoId() const {
180  return mCentralStripGeoId;
181 };
182 
183 inline float StFgtHit::getPositionR() const {
184  return mR;
185 };
186 
187 inline float StFgtHit::getPositionPhi() const {
188  return mPhi;
189 };
190 
191 inline float StFgtHit::getPositionZ() const {
192  return mPosition.z();
193 };
194 
195 inline float StFgtHit::getErrorR() const {
196  return mErrR;
197 };
198 
199 inline float StFgtHit::getErrorPhi() const {
200  return mErrPhi;
201 };
202 
203 inline float StFgtHit::getErrorZ() const {
204  return mPositionError.z();
205 };
206 
207 inline void StFgtHit::setCentralStripGeoId( int geoId ){
208  mCentralStripGeoId = geoId;
209 };
210 
211 inline void StFgtHit::setDisc( short disc ){
212  short quad = getQuad();
213  char layer = getLayer();
214 
215  setHardwareId( disc, quad, layer );
216 };
217 
218 inline void StFgtHit::setQuad( short quad ){
219  short disc = getDisc();
220  char layer = getLayer();
221 
222  setHardwareId( disc, quad, layer );
223 };
224 
225 inline void StFgtHit::setLayer( char layer ){
226  short disc = getDisc();
227  short quad = getQuad();
228 
229  setHardwareId( disc, quad, layer );
230 };
231 
232 inline void StFgtHit::setPositionR( float position ){
233  mR = position;
234  mPosition.setX( mR*cos( mPhi ) );
235  mPosition.setY( mR*sin( mPhi ) );
236 };
237 
238 inline void StFgtHit::setPositionPhi( float position ){
239  mPhi = position;
240  mPosition.setX( mR*cos( mPhi ) );
241  mPosition.setY( mR*sin( mPhi ) );
242 };
243 
244 inline void StFgtHit::setPositionZ( float position ){
245  mPosition.setZ( position );
246 };
247 
248 inline void StFgtHit::setErrorR( float error ){
249  mErrR = error;
250  update2error();
251 };
252 
253 inline void StFgtHit::setErrorPhi( float error ){
254  mErrPhi = error;
255  update2error();
256 };
257 
258 inline void StFgtHit::setErrorZ( float error ){
259  mPositionError.setZ( error );
260 };
261 
262 // charge uncertainty
263 
264 inline float StFgtHit::getChargeUncert() const { return mChargeUncert; };
265 inline void StFgtHit::setChargeUncert( float sigma ){ mChargeUncert = sigma; };
266 inline short StFgtHit::getMaxAdc() const {return mMaxAdc;};
267 inline void StFgtHit::setMaxAdc(short v) {mMaxAdc=v;};
268 inline int StFgtHit::getNstrip() const {return mNstrip;};
269 inline void StFgtHit::setNstrip(int v) {mNstrip=v;};
270 inline int StFgtHit::getMaxTimeBin() const {return mMaxTimeBin;};
271 inline void StFgtHit::setMaxTimeBin(int v) {mMaxTimeBin=v;};
272 inline int StFgtHit::getSeedType() const {return mSeedType;};
273 inline void StFgtHit::setSeedType(int v) {mSeedType=v;};
274 inline float StFgtHit::getEvenOddChargeAsy() const {return mEvenOddChargeAsy;};
275 inline void StFgtHit::setEvenOddChargeAsy(float v) {mEvenOddChargeAsy=v;};
276 inline float StFgtHit::getLandauNorm() const {return mLandauNorm;};
277 inline float StFgtHit::getLandauMpv() const {return mLandauMpv;};
278 inline float StFgtHit::getLandauSigma() const {return mLandauSigma;};
279 inline float StFgtHit::getLandauChi2() const {return mLandauChi2;};
280 inline void StFgtHit::setLandau(float n, float m, float s, float c) {mLandauNorm=n; mLandauMpv=m; mLandauSigma=s; mLandauChi2=c;};
281 #endif
Definition: StHit.h:125