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 std::make_unique<DDRotationMatrix>(rotMatrix.xx(), rotMatrix.xy(), rotMatrix.xz(),
195 rotMatrix.yx(), rotMatrix.yy(), rotMatrix.yz(),
196 rotMatrix.zx(), rotMatrix.zy(), rotMatrix.zz()));
200 DDTranslation ddtran(translation.x(), translation.y(), translation.z());
201 cpv.
position(child, mother, copy, ddtran, rotation);
222 CLHEP::Hep3Vector jC;
223 CLHEP::Hep3Vector kB;
231 rotNameNippleToCover =
"NippleToCoverZPlus";
232 rotNameCoverToNipple =
"CoverToNippleZPlus";
233 rotNameNippleToBody =
"NippleToBodyZPlus";
237 rotNameNippleToCover =
"NippleToCoverZMinus";
238 rotNameCoverToNipple =
"CoverToNippleZMinus";
239 rotNameNippleToBody =
"NippleToBodyZMinus";
249 CLHEP::HepRotation rCB(CLHEP::Hep3Vector(1.*
sin(effBladeAngle), 0., 1.*
cos(effBladeAngle)), deltaPhi);
253 CLHEP::Hep3Vector kC = rCB * (kB + tCB);
257 CLHEP::Hep3Vector jkC = kC - jC;
258 double jkLength = jkC.mag();
259 DDConstant JK(
DDName(
"JK",
"pixfwdNipple"), std::make_unique<double>( jkLength ));
260 LogDebug(
"PixelGeom") <<
"+++++++++++++++ DDPixFwdBlades: " <<
"JK Length " << jkLength * CLHEP::mm;
264 CLHEP::Hep3Vector nippleTranslation((kC+jC)/2. - CLHEP::Hep3Vector(0.,
ancorRadius, 0.));
270 LogDebug(
"PixelGeom") <<
"Child translation : " << nippleTranslation;
274 CLHEP::Hep3Vector vZ(0.,0.,1.);
275 CLHEP::Hep3Vector axis = vZ.cross(jkC);
276 double angleCover = vZ.angle(jkC);
277 LogDebug(
"PixelGeom") <<
" Angle to Cover: " << angleCover;
278 CLHEP::HepRotation* rpCN =
new CLHEP::HepRotation(axis, angleCover);
286 DDrot(
DDName(rotNameCoverToNipple,
"pixfwdNipple"),
287 std::make_unique<DDRotationMatrix>( rpCN->xx(), rpCN->xy(), rpCN->xz(),
288 rpCN->yx(), rpCN->yy(), rpCN->yz(),
289 rpCN->zx(), rpCN->zy(), rpCN->zz()));
290 CLHEP::HepRotation rpNC(axis, -angleCover);
292 DDrot(
DDName(rotNameNippleToCover,
"pixfwdNipple"),
293 std::make_unique<DDRotationMatrix>( rpNC.xx(), rpNC.xy(), rpNC.xz(),
294 rpNC.yx(), rpNC.yy(), rpNC.yz(),
295 rpNC.zx(), rpNC.zy(), rpNC.zz()));
299 CLHEP::HepRotation rpNB( rpNC * rCB );
302 std::make_unique<DDRotationMatrix>( rpNB.xx(), rpNB.xy(), rpNB.xz(),
303 rpNB.yx(), rpNB.yy(), rpNB.yz(),
304 rpNB.zx(), rpNB.zy(), rpNB.zz()));
305 double angleBody = vZ.angle(rpNB * vZ);
306 LogDebug(
"PixelGeom") <<
" Angle to body : " << angleBody;
std::map< std::string, int > copyNumbers
double nippleTranslationZ
Sin< T >::type sin(const T &t)
void computeNippleParameters(double endcap)
DDName is used to identify DDD entities uniquely.
void execute(DDCompactView &cpv) override
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
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 position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
~DDPixFwdBlades() override
double nippleTranslationY
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
std::string childRotationName
const std::string & name() const
Returns the name.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override