StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoETofHit.cxx
1 //
2 // StPicoETofHit holds information about eTOF hits
3 //
4 
5 // C++ headers
6 #include <limits>
7 
8 // ROOT headers
9 #include "TMath.h"
10 
11 // PicoDst headers
12 #include "StPicoMessMgr.h"
13 #include "StPicoETofHit.h"
14 
15 ClassImp(StPicoETofHit)
16 
17 //_________________
19  mGeomId( 0 ),
20  mLocalX( std::numeric_limits<short>::min() ),
21  mLocalY( std::numeric_limits<short>::min() ),
22  mClusterSize( 0 ),
23  mLeadingEdgeTime( 0 ),
24  mTimeOverThreshold( 0 ) //,
25  //mGlobalX( 0 ),
26  //mGlobalY( 0 ),
27  //mGlobalZ( 0 )
28 {
29  /* empty */
30 }
31 
32 //_________________
34  mGeomId = hit.mGeomId;
35  mLocalX = hit.mLocalX;
36  mLocalY = hit.mLocalY;
37  mClusterSize = hit.mClusterSize;
38  mLeadingEdgeTime = hit.mLeadingEdgeTime;
39  mTimeOverThreshold = hit.mTimeOverThreshold;
40  //mGlobalX = hit.mGlobalX;
41  //mGlobalY = hit.mGlobalY;
42  //mGlobalZ = hit.mGlobalZ;
43 }
44 
45 //_________________
47  /* empty */
48 }
49 
50 //_________________
51 void StPicoETofHit::Print(const Char_t* option __attribute__((unused)) ) const {
52  LOG_INFO << " sector = " << sector()
53  << " zPlane = " << zPlane()
54  << " counter = " << counter()
55  << " localX = " << localX()
56  << " localY = " << localY()
57  << " clusterSize = " << clusterSize()
58  << " time = " << leadingEdgeTime()
59  << " tot = " << timeOverThreshold()
60  << endm;
61 }
62 
63 
64 //
65 // Setters
66 //
67 
68 //_________________
69 void StPicoETofHit::setGeomId(Int_t geomId) {
70  if( geomId<=0 ) {
71  mGeomId = 0;
72  }
73  else {
74  mGeomId = ( ( geomId > std::numeric_limits<unsigned char>::max() ) ?
75  std::numeric_limits<unsigned char>::max() :
76  (UChar_t) geomId );
77  }
78 }
79 
80 //_________________
81 void StPicoETofHit::setGeomId(Int_t sector, Int_t plane, Int_t counter ) {
82  if( sector<13 || sector>24 || plane<1 || plane>3 || counter<1 || counter>3 ) {
83  mGeomId = 0;
84  }
85  else {
86  mGeomId = (UChar_t)( (sector - 13) * 9 + (plane - 1) * 3 + (counter - 1) + 1 );
87  }
88 }
89 
90 //_________________
91 void StPicoETofHit::setLocalX(Float_t localX) {
92  mLocalX = ( fabs(localX * 800.) > std::numeric_limits<short>::max() ?
93  ( (localX>0) ? std::numeric_limits<short>::max() :
94  std::numeric_limits<short>::min() ):
95  (Short_t)( TMath::Nint( localX * 800. ) ) );
96 }
97 
98 //_________________
99 void StPicoETofHit::setLocalY(Float_t localY) {
100  mLocalY = ( fabs(localY * 800.) > std::numeric_limits<short>::max() ?
101  ( (localY>0) ? std::numeric_limits<short>::max() :
102  std::numeric_limits<short>::min() ):
103  (Short_t)( TMath::Nint( localY * 800. ) ) );
104 }
105 
106 //_________________
107 void StPicoETofHit::setClusterSize(Int_t clusterSize) {
108  if( clusterSize <= 0 ) {
109  mClusterSize = 0;
110  }
111  else {
112  mClusterSize = ( ( clusterSize > std::numeric_limits<unsigned char>::max() ) ?
113  std::numeric_limits<unsigned char>::max() :
114  (UChar_t) clusterSize );
115  }
116 }
117 
118 //_________________
119 void StPicoETofHit::setTime(Float_t time) {
120  Float_t cyclicTime = time;
121  if( cyclicTime < 0. ) {
122  while( cyclicTime < 0. ) {
123  cyclicTime += 51200;
124  }
125  }
126  if( cyclicTime > 51200. ) {
127  while( cyclicTime > 51200. ) {
128  cyclicTime -= 51200.;
129  }
130  }
131 
132  mLeadingEdgeTime = cyclicTime;
133 }
134 
135 //_________________
136 void StPicoETofHit::setTot(Float_t tot) {
138 }
139 
140 //_________________
142  if( tot <= 0 ) {
143  mTimeOverThreshold = 0;
144  }
145  else {
146  mTimeOverThreshold = ( (tot * 250.) > std::numeric_limits<unsigned short>::max() ?
147  std::numeric_limits<unsigned short>::max() :
148  (UShort_t)( TMath::Nint( tot * 250. ) ) );
149  }
150 }
151 
152 /*
153 //_________________
154 void StPicoETofHit::setGlobalX( const Float_t& x ) {
155  mGlobalX = ( fabs(x * 100.) > std::numeric_limits<short>::max() ?
156  ( (x>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
157  (Short_t)( TMath::Nint( x * 100. ) ) );
158 }
159 
160 //_________________
161 void StPicoETofHit::setGlobalY( const Float_t& y ) {
162  mGlobalY = ( fabs(y * 100.) > std::numeric_limits<short>::max() ?
163  ( (y>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
164  (Short_t)( TMath::Nint( y * 100. ) ) );
165 }
166 
167 //_________________
168 void StPicoETofHit::setGlobalZ( const Float_t& z ) {
169  mGlobalZ = ( fabs(z * 100.) > std::numeric_limits<short>::max() ?
170  ( (z>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
171  (Short_t)( TMath::Nint( z * 100. ) ) );
172 }
173 
174 //_________________
175 void StPicoETofHit::setGlobalPos( const Float_t& x, const Float_t& y, const Float_t& z ) {
176  setGlobalX( x );
177  setGlobalY( y );
178  setGlobalZ( z );
179 }
180 */
Float_t localX() const
Return local X coordinate (cm) across strips w.r.t. center of eTOF counter volume.
Definition: StPicoETofHit.h:49
void setClusterSize(Int_t clusterSize)
Set cluster size of eTOF hit.
Int_t zPlane() const
Definition: StPicoETofHit.h:43
Float_t leadingEdgeTime() const
Return leading edge time (ns) of eTOF hit.
Definition: StPicoETofHit.h:57
void setLocalY(Float_t localY)
Set local Y coordinate (cm) along strips w.r.t. center of eTOF counter volume.
virtual ~StPicoETofHit()
Destructor.
virtual void Print(const Char_t *option="") const
Print hit information.
Float_t timeOverThreshold() const
Return time over threshold (ns) of eTOF hit.
Definition: StPicoETofHit.h:59
StPicoETofHit()
Default consturctor.
Int_t clusterSize() const
Return cluster size of eTOF hit (number of &quot;hits&quot; on different strips clustered into one hit) ...
Definition: StPicoETofHit.h:53
Int_t sector() const
Return eTOF sector number (equal to TPC sector numbering)
Definition: StPicoETofHit.h:39
void setTime(Float_t time)
Set leading edge time (ns) of eTOF hit.
void setTot(Float_t tot)
Set time over threshold (ns) of eTOF hit.
void setTimeOverThreshold(Float_t tot)
Set time over threshold (ns) of eTOF hit.
Stores eTOF hit information.
Definition: StPicoETofHit.h:19
Int_t counter() const
Definition: StPicoETofHit.h:47
void setGeomId(Int_t geomId)
Set geometry ID of the hit.
Float_t time() const
Return leading edge time (ns) of eTOF hit.
Definition: StPicoETofHit.h:55
Float_t localY() const
Return local Y coordinate (cm) along strips w.r.t. center of eTOF counter volume. ...
Definition: StPicoETofHit.h:51
void setLocalX(Float_t localX)
Set local X coordinate (cm) across strips w.r.t. center of eTOF counter volume.