24 #include "CLHEP/Vector/RotationInterfaces.h"
25 #include "CLHEP/Units/GlobalPhysicalConstants.h"
26 #include "CLHEP/Units/GlobalSystemOfUnits.h"
69 if ( nArgs.find(
"Endcap") != nArgs.end() ) {
75 if ( sArgs.find(
"FlagString") != sArgs.end() ) {
83 if ( sArgs.find(
"Child") != sArgs.end() ) {
89 if ( vArgs.find(
"ChildTranslation") != vArgs.end() ) {
95 if ( sArgs.find(
"ChildRotation") != sArgs.end() ) {
128 CLHEP::HepRotation childRotMatrix = CLHEP::HepRotation();
133 childRotation.
rotation()->GetComponents(x, y, z);
134 CLHEP::HepRep3x3 tr(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
135 childRotMatrix = CLHEP::HepRotation(tr);
136 }
else if (
childName ==
"pixfwdNipple:PixelForwardNippleZPlus") {
138 }
else if (
childName ==
"pixfwdNipple:PixelForwardNippleZMinus") {
142 CLHEP::Hep3Vector childTranslation;
143 if (
childName ==
"pixfwdNipple:PixelForwardNippleZPlus") {
145 }
else if (
childName ==
"pixfwdNipple:PixelForwardNippleZMinus") {
153 CLHEP::HepRotation bladeRotMatrix(CLHEP::Hep3Vector(0.,1.,0.),effBladeAngle);
159 double zShiftMax = effBladeZShift*((nQuarter-1)/2.);
161 for (
int iBlade=0; iBlade <
nBlades; iBlade++) {
170 double phi = (iBlade + 0.5) * deltaPhi - 90.*CLHEP::deg;
171 int iQuarter = iBlade % nQuarter;
172 double zShift = - zShiftMax + iQuarter * effBladeZShift;
176 CLHEP::HepRotation rotMatrix(CLHEP::Hep3Vector(0.,0.,1.), phi);
177 rotMatrix *= bladeRotMatrix;
181 CLHEP::Hep3Vector translation = rotMatrix(childTranslation + CLHEP::Hep3Vector(0.,
ancorRadius, 0.));
182 translation += CLHEP::Hep3Vector(0., 0., zShift +
zPlane);
191 rotMatrix *= childRotMatrix;
193 rotMatrix.yx(), rotMatrix.yy(), rotMatrix.yz(),
194 rotMatrix.zx(), rotMatrix.zy(), rotMatrix.zz() );
199 DDTranslation ddtran(translation.x(), translation.y(), translation.z());
200 cpv.
position(child, mother, copy, ddtran, rotation);
222 CLHEP::Hep3Vector jC;
223 CLHEP::Hep3Vector kB;
224 std::string rotNameNippleToCover;
225 std::string rotNameCoverToNipple;
226 std::string rotNameNippleToBody;
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 =
new double(jkC.mag());
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);
287 rpCN->yx(), rpCN->yy(), rpCN->yz(),
288 rpCN->zx(), rpCN->zy(), rpCN->zz() );
290 DDrot(
DDName(rotNameCoverToNipple,
"pixfwdNipple"), ddrpCN);
291 CLHEP::HepRotation rpNC(axis, -angleCover);
293 rpNC.yx(), rpNC.yy(), rpNC.yz(),
294 rpNC.zx(), rpNC.zy(), rpNC.zz() );
296 DDrot(
DDName(rotNameNippleToCover,
"pixfwdNipple"), ddrpNC);
300 CLHEP::HepRotation rpNB( rpNC * rCB );
302 rpNB.yx(), rpNB.yy(), rpNB.yz(),
303 rpNB.zx(), rpNB.zy(), rpNB.zz() );
305 DDrot(
DDName(rotNameNippleToBody,
"pixfwdNipple"), ddrpNB);
306 double angleBody = vZ.angle(rpNB * vZ);
307 LogDebug(
"PixelGeom") <<
" Angle to body : " << angleBody;
static const double bladeZShift
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
void execute(DDCompactView &cpv)
static double nippleTranslationZ
double deltaPhi(float phi1, float phi2)
static const double ancorRadius
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.
static const double zPlane
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.
std::string int_to_string(const int &in)
Cos< T >::type cos(const T &t)
static double nippleTranslationX
static CLHEP::HepRotation * nippleRotationZPlus
static const double bladeAngle
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
static std::map< std::string, int > copyNumbers
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
static CLHEP::HepRotation * nippleRotationZMinus
static 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