23 #include "CLHEP/Vector/RotationInterfaces.h"
24 #include "CLHEP/Units/GlobalPhysicalConstants.h"
25 #include "CLHEP/Units/GlobalSystemOfUnits.h"
41 if ( nArgs.find(
"Endcap") != nArgs.end() ) {
47 if ( sArgs.find(
"FlagString") != sArgs.end() ) {
55 if ( sArgs.find(
"Child") != sArgs.end() ) {
61 if ( vArgs.find(
"ChildTranslation") != vArgs.end() ) {
67 if ( sArgs.find(
"ChildRotation") != sArgs.end() ) {
86 jX = -16.25*CLHEP::mm;
129 CLHEP::HepRotation childRotMatrix = CLHEP::HepRotation();
134 childRotation.
rotation()->GetComponents(x, y, z);
135 CLHEP::HepRep3x3 tr(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
136 childRotMatrix = CLHEP::HepRotation(tr);
137 }
else if (
childName ==
"pixfwdNipple:PixelForwardNippleZPlus") {
139 }
else if (
childName ==
"pixfwdNipple:PixelForwardNippleZMinus") {
143 CLHEP::Hep3Vector childTranslation;
144 if (
childName ==
"pixfwdNipple:PixelForwardNippleZPlus") {
146 }
else if (
childName ==
"pixfwdNipple:PixelForwardNippleZMinus") {
154 CLHEP::HepRotation bladeRotMatrix(CLHEP::Hep3Vector(0.,1.,0.),effBladeAngle);
160 double zShiftMax = effBladeZShift*((nQuarter-1)/2.);
162 for (
int iBlade=0; iBlade <
nBlades; iBlade++) {
171 double phi = (iBlade + 0.5) * deltaPhi - 90.*CLHEP::deg;
172 int iQuarter = iBlade % nQuarter;
173 double zShift = - zShiftMax + iQuarter * effBladeZShift;
177 CLHEP::HepRotation rotMatrix(CLHEP::Hep3Vector(0.,0.,1.), phi);
178 rotMatrix *= bladeRotMatrix;
182 CLHEP::Hep3Vector translation = rotMatrix(childTranslation + CLHEP::Hep3Vector(0.,
ancorRadius, 0.));
183 translation += CLHEP::Hep3Vector(0., 0., zShift +
zPlane);
192 rotMatrix *= childRotMatrix;
194 rotMatrix.yx(), rotMatrix.yy(), rotMatrix.yz(),
195 rotMatrix.zx(), rotMatrix.zy(), rotMatrix.zz() );
200 DDTranslation ddtran(translation.x(), translation.y(), translation.z());
201 cpv.
position(child, mother, copy, ddtran, rotation);
223 CLHEP::Hep3Vector jC;
224 CLHEP::Hep3Vector kB;
232 rotNameNippleToCover =
"NippleToCoverZPlus";
233 rotNameCoverToNipple =
"CoverToNippleZPlus";
234 rotNameNippleToBody =
"NippleToBodyZPlus";
238 rotNameNippleToCover =
"NippleToCoverZMinus";
239 rotNameCoverToNipple =
"CoverToNippleZMinus";
240 rotNameNippleToBody =
"NippleToBodyZMinus";
250 CLHEP::HepRotation rCB(CLHEP::Hep3Vector(1.*
sin(effBladeAngle), 0., 1.*
cos(effBladeAngle)), deltaPhi);
254 CLHEP::Hep3Vector kC = rCB * (kB + tCB);
258 CLHEP::Hep3Vector jkC = kC - jC;
259 double* jkLength =
new double(jkC.mag());
261 LogDebug(
"PixelGeom") <<
"+++++++++++++++ DDPixFwdBlades: " <<
"JK Length " << *jkLength * CLHEP::mm;
265 CLHEP::Hep3Vector nippleTranslation((kC+jC)/2. - CLHEP::Hep3Vector(0.,
ancorRadius, 0.));
271 LogDebug(
"PixelGeom") <<
"Child translation : " << nippleTranslation;
275 CLHEP::Hep3Vector vZ(0.,0.,1.);
276 CLHEP::Hep3Vector axis = vZ.cross(jkC);
277 double angleCover = vZ.angle(jkC);
278 LogDebug(
"PixelGeom") <<
" Angle to Cover: " << angleCover;
279 CLHEP::HepRotation* rpCN =
new CLHEP::HepRotation(axis, angleCover);
288 rpCN->yx(), rpCN->yy(), rpCN->yz(),
289 rpCN->zx(), rpCN->zy(), rpCN->zz() );
291 DDrot(
DDName(rotNameCoverToNipple,
"pixfwdNipple"), ddrpCN);
292 CLHEP::HepRotation rpNC(axis, -angleCover);
294 rpNC.yx(), rpNC.yy(), rpNC.yz(),
295 rpNC.zx(), rpNC.zy(), rpNC.zz() );
297 DDrot(
DDName(rotNameNippleToCover,
"pixfwdNipple"), ddrpNC);
301 CLHEP::HepRotation rpNB( rpNC * rCB );
303 rpNB.yx(), rpNB.yy(), rpNB.yz(),
304 rpNB.zx(), rpNB.zy(), rpNB.zz() );
306 DDrot(
DDName(rotNameNippleToBody,
"pixfwdNipple"), ddrpNB);
307 double angleBody = vZ.angle(rpNB * vZ);
308 LogDebug(
"PixelGeom") <<
" Angle to body : " << angleBody;
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
void execute(DDCompactView &cpv)
std::map< std::string, int > copyNumbers
double nippleTranslationZ
virtual ~DDPixFwdBlades()
Sin< T >::type sin(const T &t)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
void computeNippleParameters(double endcap)
DDName is used to identify DDD entities uniquely.
static std::string & ns()
type of data representation of DDCompactView
std::vector< double > childTranslationVector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Cos< T >::type cos(const T &t)
double nippleTranslationX
CLHEP::HepRotation * nippleRotationZMinus
CLHEP::HepRotation * nippleRotationZPlus
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
double nippleTranslationY
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
std::string childRotationName