5 #if ROOT_VERSION_CODE < 331013
11 #include "StEventTypes.h"
13 #include "StiDetector.h"
14 #include "StiPlacement.h"
29 memcpy(mBeg,h.mBeg,mEnd-mBeg+1);
35 memcpy(mBeg,h.mBeg,mEnd-mBeg+1);
49 static float rotMx[3][3]={{1,0,0},{0,1,0},{0,0,1}}, s[6];
52 double ca = cos(alpha);
53 double sa = sin(alpha);
54 rotMx[0][0] = ca; rotMx[0][1] = sa;
55 rotMx[1][0] =-sa; rotMx[1][1] = ca;
57 double x = rotMx[0][0]*mx + rotMx[0][1]*my;
58 double y = rotMx[1][0]*mx + rotMx[1][1]*my;
62 memcpy(s,&msxx,
sizeof(s));
69 enum Labels {
x=1, y=2, z=3};
84 memcpy(&msxx,matrix,6*
sizeof(msxx));
92 <<
"L:"<<hit.
x() <<
" "<<hit.y() <<
" "<<hit.z()
93 <<
"G:"<<hit.
x_g()<<
" "<<hit.y_g()<<
" "<<hit.z_g();
98 double StiHit::getValue(
int key)
const
103 case kZ: value = _zg;
break;
104 case kR: value = ::sqrt(_xg*_xg+_yg*_yg);
break;
105 case kPseudoRapidity: value = getPseudoRapidity();
break;
106 case kPhi: value = atan2(_yg,_xg);
break;
107 default: value = -999999.;
break;
113 double StiHit::getPseudoRapidity()
const
115 double r=::sqrt(_xg*_xg+_yg*_yg);
116 double tanTheta = ::tan(::atan2(r,_zg)/2.);
118 return -::log(tanTheta);
125 memset(mBeg,0,mEnd-mBeg+1);
127 static unsigned int myCount=0;
135 float gx,
float gy,
float gz,
138 static int nCall =0; nCall++;
143 mrefangle = placement->getLayerAngle();
144 mposition = placement->getLayerRadius();
145 mx = detector->
_cos*gx + detector->
_sin*gy;
146 my = -detector->
_sin*gx + detector->
_cos*gy;
148 double dd[3]={mx,my,mz};
151 if (!detector->insideL(dd,7,1.2)) {
153 Form(
"**** StiHit.%s outside (%d) by %g (%g) ****"
155 ,StiDetector::mgIndex
156 ,StiDetector::mgValue[0],StiDetector::mgValue[1])
158 assert( detector->insideL(dd,7,1.5));
161 mx = detector->
_cos*gx + detector->
_sin*gy;
162 my = -detector->
_sin*gx + detector->
_cos*gy;
191 float x,
float y,
float z,
192 float sxx,
float sxy,
float sxz,
float syy,
float syz,
float szz)
197 mrefangle = placement->getLayerAngle();
198 mposition = placement->getLayerRadius();
199 _xg = detector->
_cos*x - detector->
_sin*y;
200 _yg = detector->
_sin*x + detector->
_cos*y;
224 assert( fabs(stHit->position().x()-_xg)< 1.e-6
225 && fabs(stHit->position().y()-_yg)< 1.e-6
226 && fabs(stHit->position().z()-_zg)< 1.e-6);
228 if (!detector)
return;
229 double pos = detector->getPlacement()->getNormalRadius();
231 if (fabs(dif)<1.)
return;
234 Form(
"**** StiHit.%s too far: x=%f pos=%g dif=%g ****\n"
235 ,detector->
getName().c_str(),mx,pos,dif)
243 assert(mTimesUsed <=mMaxTimes);
246 void StiHit::subTimesUsed()
249 assert(mTimesUsed>=0);
265 void StiHit::set(
float position,
float angle,
float y,
float z)
267 memset(mBeg,0,mEnd-mBeg+1);
281 memset(mBeg,0,mEnd-mBeg+1);
287 if (mdetector)
return 0;
288 if (mx || my || mz)
return 0;
289 if (mszz<1000)
return 0;
296 #include "StEvent/StHit.h"
298 int StiHit::idTruth()
const
301 if (!stHit)
return 0;
302 return stHit->idTruth();
306 int StiHit::qaTruth()
const
309 if (!stHit)
return 0;
310 return stHit->qaTruth();
StiHit()
Default constructor.
void setError(const StMatrixF &)
void makeDca()
Make fake hit for dca calculation.
double _cos
Convenience storage of cos(refAngle)
void setGlobal(const StiDetector *detector, const StMeasuredPoint *stHit, Float_t x, Float_t y, Float_t z, Float_t energy)
const Float_t & x() const
Return the local x, y, z values.
void rotate(double angle)
~StiHit()
Default destructor.
const StiDetector * detector() const
Float_t x_g() const
Return the global x, y, z values.
Float_t refangle() const
Return the refAngle of the detector plane from which the hit arose.
static float * trasat(const float *a, const float *s, float *r, int m, int n)
Int_t isDca() const
Test for DCA. Fake hit for dca calculation.
Float_t getEloss()
Return the energy deposition associated with this point.
Float_t sxx() const
Return components of the error matrix.
double _sin
Convenience storage of sin(refAngle)
Float_t position() const
Return the position of the detector plane from which the hit arose.
const StMeasuredPoint * stHit() const
const StThreeVectorF globalPosition() const
const string & getName() const
Get the name of the object.