3 #include "StiPlacement.h"
9 StiPlacement::StiPlacement(){
18 setNormalRep(0., 0., 0.);
21 StiPlacement::StiPlacement(
float normRefAngle,
float normRadius,
float normYOffset,
float centralZ)
23 setNormalRep(normRefAngle,normRadius,normYOffset);
25 setLayerRadius(centerRadius);
26 layerAngle = centerRefAngle;
27 mRegion = kMidRapidity;
43 StiPlacement::StiPlacement(
const TGeoMatrix& transMatrix,
const TVector3& localCenter,
const TVector3& normal)
45 double centerXyzLocal[3] = {localCenter.X(), localCenter.Y(), localCenter.Z()};
46 double centerXyzGlobal[3] = {};
48 double normalXyzLocal[3] = {normal.X() + localCenter.X(), normal.Y() + localCenter.Y(), normal.Z() + localCenter.Z()};
49 double normalXyzGlobal[3] = {};
52 transMatrix.LocalToMaster(centerXyzLocal, centerXyzGlobal);
53 transMatrix.LocalToMaster(normalXyzLocal, normalXyzGlobal);
55 TVector3 centralVec(centerXyzGlobal);
56 TVector3 normalVec(normalXyzGlobal);
60 normalVec -= centralVec;
62 if (normalVec.Dot(centralVec) < 0) normalVec *= -1;
64 double deltaPhi = centralVec.DeltaPhi(normalVec);
65 double normalVecMag = fabs(centralVec.Perp() * cos(deltaPhi));
67 setNormalRep(normalVec.Phi(), normalVecMag, centralVec.Perp()*sin(deltaPhi));
68 zCenter = centralVec.Z();
69 setLayerRadius(centerRadius);
70 layerAngle = centerRefAngle;
71 mRegion = kMidRapidity;
76 void StiPlacement::setNormalRep(
float refAngle_,
float radius_,
float yOffset_)
84 while(refAngle_ < -M_PI){ refAngle_ += 2.*M_PI; }
85 while(refAngle_ >= M_PI){ refAngle_ -= 2.*M_PI; }
86 normalRefAngle = refAngle_;
88 normalRadius = radius_;
89 normalYoffset = yOffset_;
92 centerRadius = ::sqrt(normalRadius*normalRadius + normalYoffset*normalYoffset);
93 centerOrientation = atan2(normalYoffset,normalRadius);
94 centerRefAngle = normalRefAngle + centerOrientation;
95 while(centerRefAngle < -M_PI){ centerRefAngle += 2.*M_PI; }
96 while(centerRefAngle >= M_PI){ centerRefAngle -= 2.*M_PI; }
101 void StiPlacement::setLayerAngle(
float layerAng)
103 layerAngle = layerAng;
104 while (layerAngle< -M_PI) {layerAngle+=2*M_PI;}
105 while (layerAngle> M_PI) {layerAngle-=2*M_PI;}
112 os <<
"StiPlacement:" << endl
113 <<
"normalRefAngle: " << p.normalRefAngle <<
" rad, "
114 <<
"normalRadius: " << p.normalRadius <<
" cm, "
115 <<
"normalYoffset: " << p.normalYoffset <<
" cm" << endl
116 <<
"centerRefAngle: " << p.centerRefAngle <<
" rad, "
117 <<
"centerRadius: " << p.centerRadius <<
" cm, "
118 <<
"centerOrientation: " << p.centerOrientation <<
" rad" << endl
119 <<
"zCenter: " << p.zCenter <<
" cm, "
120 <<
"layerRadius: " << p.layerRadius <<
" cm, "
121 <<
"layerAngle: " << p.layerAngle <<
" rad" << endl;
126 void StiPlacement::setLayerRadius(
float radius_)
128 static const double kMinRad=0.1,kMaxRad=200;
129 static const double kLogStep=(log(kMaxRad)-log(kMinRad))/10000;
130 int nStp = int(log(radius_+kMinRad)/kLogStep);
131 layerRadius = exp(nStp*kLogStep)-kMinRad;