From 1770f8a9804bbe0dd39e6dc477d40d82fe92ccb9 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 21 Apr 2022 16:38:42 +0200 Subject: [PATCH] Code check --- .../plugins/DDPixFwdBlades.cc | 23 ++++-- .../plugins/DDPixFwdBladesNew.cc | 72 +++++++++++++------ .../plugins/DDPixFwdRotation.cc | 56 +++++++++------ 3 files changed, 101 insertions(+), 50 deletions(-) diff --git a/Geometry/TrackerCommonData/plugins/DDPixFwdBlades.cc b/Geometry/TrackerCommonData/plugins/DDPixFwdBlades.cc index df686f912e867..dd93005afb09a 100644 --- a/Geometry/TrackerCommonData/plugins/DDPixFwdBlades.cc +++ b/Geometry/TrackerCommonData/plugins/DDPixFwdBlades.cc @@ -201,7 +201,14 @@ void DDPixFwdBlades::initialize(const DDNumericArguments& nArgs, copyNumbers.clear(); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades: Initialize with endcap " << endcap << " FlagString " << flagString << " FlagSelector " << flagSelector << " Child " << childName << " ChildTranslation " << childTranslationVector[0] << ":" << childTranslationVector[1] << ":" << childTranslationVector[2] << " ChildRotation " << childRotationName << " NameSpace " << idNameSpace << "\n nBlades " << nBlades << " bladeAngle " << bladeAngle << " zPlane " << zPlane << " bladeZShift " << bladeZShift << " ancorRadius " << ancorRadius << " jX|jY|jZ " << jX << ":" << jY << ":" << jZ << " kX|kY|kZ " << kX << ":" << kY << ":" << kZ; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades: Initialize with endcap " << endcap << " FlagString " << flagString + << " FlagSelector " << flagSelector << " Child " << childName << " ChildTranslation " + << childTranslationVector[0] << ":" << childTranslationVector[1] << ":" + << childTranslationVector[2] << " ChildRotation " << childRotationName << " NameSpace " + << idNameSpace << "\n nBlades " << nBlades << " bladeAngle " << bladeAngle + << " zPlane " << zPlane << " bladeZShift " << bladeZShift << " ancorRadius " + << ancorRadius << " jX|jY|jZ " << jX << ":" << jY << ":" << jZ << " kX|kY|kZ " << kX + << ":" << kY << ":" << kZ; } void DDPixFwdBlades::execute(DDCompactView& cpv) { @@ -307,7 +314,8 @@ void DDPixFwdBlades::execute(DDCompactView& cpv) { DDTranslation ddtran(translation.x(), translation.y(), translation.z()); cpv.position(child, mother, copy, ddtran, rotation); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Position " << child << " copy " << copy << " in " << mother << " with translation " << ddtran << " and rotation " << rotation; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Position " << child << " copy " << copy << " in " << mother + << " with translation " << ddtran << " and rotation " << rotation; } // End of cycle over Phi positions @@ -363,7 +371,7 @@ void DDPixFwdBlades::computeNippleParameters(double endcap) { double jkLength = jkC.mag(); DDConstant JK(DDName("JK", "pixfwdNipple"), make_unique(jkLength)); edm::LogVerbatim("PixelGeom") << "+++++++++++++++ DDPixFwdBlades: " - << "JK Length " << jkLength * CLHEP::mm; + << "JK Length " << jkLength * CLHEP::mm; // Position of the center of a nipple in "cover" blade frame : @@ -394,11 +402,13 @@ void DDPixFwdBlades::computeNippleParameters(double endcap) { make_unique( rpCN->xx(), rpCN->xy(), rpCN->xz(), rpCN->yx(), rpCN->yy(), rpCN->yz(), rpCN->zx(), rpCN->zy(), rpCN->zz())); CLHEP::HepRotation rpNC(axis, -angleCover); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameCoverToNipple, "pixfwdNipple") << " with " << rpCN; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameCoverToNipple, "pixfwdNipple") + << " with " << rpCN; DDrot(DDName(rotNameNippleToCover, "pixfwdNipple"), make_unique( rpNC.xx(), rpNC.xy(), rpNC.xz(), rpNC.yx(), rpNC.yy(), rpNC.yz(), rpNC.zx(), rpNC.zy(), rpNC.zz())); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToCover, "pixfwdNipple") << " with " << rpNC; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToCover, "pixfwdNipple") + << " with " << rpNC; // Rotation from nipple frame to "body" blade frame : @@ -407,7 +417,8 @@ void DDPixFwdBlades::computeNippleParameters(double endcap) { DDrot(DDName(rotNameNippleToBody, "pixfwdNipple"), make_unique( rpNB.xx(), rpNB.xy(), rpNB.xz(), rpNB.yx(), rpNB.yy(), rpNB.yz(), rpNB.zx(), rpNB.zy(), rpNB.zz())); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToBody, "pixfwdNipple") << " with " << rpNB; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToBody, "pixfwdNipple") << " with " + << rpNB; double angleBody = vZ.angle(rpNB * vZ); edm::LogVerbatim("PixelGeom") << " Angle to body : " << angleBody; } diff --git a/Geometry/TrackerCommonData/plugins/DDPixFwdBladesNew.cc b/Geometry/TrackerCommonData/plugins/DDPixFwdBladesNew.cc index a058bd3eed05d..1c74f8fe3e364 100644 --- a/Geometry/TrackerCommonData/plugins/DDPixFwdBladesNew.cc +++ b/Geometry/TrackerCommonData/plugins/DDPixFwdBladesNew.cc @@ -41,7 +41,7 @@ class DDPixFwdBladesNew : public DDAlgorithm { void execute(DDCompactView& cpv) override; private: - double endcap_; // +1 for Z Plus endcap disks, -1 for Z Minus endcap disks + double endcap_; // +1 for Z Plus endcap disks, -1 for Z Minus endcap disks int nBlades_; // Number of blades double bladeAngle_; // Angle of blade rotation around axis perpendicular to beam @@ -59,30 +59,30 @@ class DDPixFwdBladesNew : public DDAlgorithm { double kY_; double kZ_; - std::string flagString_; // String of flags - std::string flagSelector_; // Character that means "yes" in flagString + std::string flagString_; // String of flags + std::string flagSelector_; // Character that means "yes" in flagString - std::string childName_; // Child volume name - int startCopy_; // First copy number + std::string childName_; // Child volume name + int startCopy_; // First copy number std::vector childTranslationVector_; // Child translation with respect to "blade frame" std::string childRotationName_; // Child rotation with respect to "blade frame" - std::string idNameSpace_; //Namespace of this and ALL sub-parts + std::string idNameSpace_; //Namespace of this and ALL sub-parts CLHEP::Hep3Vector getTranslation(); CLHEP::HepRotation getRotation(); }; void DDPixFwdBladesNew::initialize(const DDNumericArguments& nArgs, - const DDVectorArguments& vArgs, - const DDMapArguments&, - const DDStringArguments& sArgs, - const DDStringVectorArguments&) { + const DDVectorArguments& vArgs, + const DDMapArguments&, + const DDStringArguments& sArgs, + const DDStringVectorArguments&) { endcap_ = nArgs["Endcap"]; - nBlades_ = static_cast(nArgs["Blades"]); // Number of blades - bladeAngle_ = nArgs ["BladeAngle"]; // Angle of blade rotation around its axis - bladeZShift_ = nArgs["BladeZShift"]; // Shift in Z between the axes of two adjacent blades + nBlades_ = static_cast(nArgs["Blades"]); // Number of blades + bladeAngle_ = nArgs["BladeAngle"]; // Angle of blade rotation around its axis + bladeZShift_ = nArgs["BladeZShift"]; // Shift in Z between the axes of two adjacent blades ancorRadius_ = nArgs["AncorRadius"]; // Distance from beam line to ancor point defining center of "blade frame" // Coordinates of Nipple ancor points J and K in "blade frame" : nippleType_ = static_cast(nArgs["NippleType"]); @@ -102,7 +102,15 @@ void DDPixFwdBladesNew::initialize(const DDNumericArguments& nArgs, idNameSpace_ = DDCurrentNamespace::ns(); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBladesNew: Initialize with endcap " << endcap_ << " FlagString " << flagString_ << " FlagSelector " << flagSelector_ << " Child " << childName_ << " ChildTranslation " << childTranslationVector_[0] << ":" << childTranslationVector_[1] << ":" << childTranslationVector_[2] << " ChildRotation " << childRotationName_ << " NameSpace " << idNameSpace_ << "\n nBlades " << nBlades_ << " bladeAngle " << bladeAngle_ << " zPlane " << zPlane_ << " bladeZShift " << bladeZShift_ << " ancorRadius " << ancorRadius_ << " NippleType " << nippleType_ << " jX|jY|jZ " << jX_ << ":" << jY_ << ":" << jZ_ << " kX|kY|kZ " << kX_ << ":" << kY_ << ":" << kZ_; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBladesNew: Initialize with endcap " << endcap_ << " FlagString " + << flagString_ << " FlagSelector " << flagSelector_ << " Child " << childName_ + << " ChildTranslation " << childTranslationVector_[0] << ":" + << childTranslationVector_[1] << ":" << childTranslationVector_[2] << " ChildRotation " + << childRotationName_ << " NameSpace " << idNameSpace_ << "\n nBlades " << nBlades_ + << " bladeAngle " << bladeAngle_ << " zPlane " << zPlane_ << " bladeZShift " + << bladeZShift_ << " ancorRadius " << ancorRadius_ << " NippleType " << nippleType_ + << " jX|jY|jZ " << jX_ << ":" << jY_ << ":" << jZ_ << " kX|kY|kZ " << kX_ << ":" << kY_ + << ":" << kZ_; } void DDPixFwdBladesNew::execute(DDCompactView& cpv) { @@ -122,7 +130,8 @@ void DDPixFwdBladesNew::execute(DDCompactView& cpv) { if (nippleType_ == 1) { childRotMatrix = getRotation(); } else if (!childRotationName_.empty()) { - DDRotation childRotation = DDRotation(DDName(DDSplit(childRotationName_).first, DDSplit(childRotationName_).second)); + DDRotation childRotation = + DDRotation(DDName(DDSplit(childRotationName_).first, DDSplit(childRotationName_).second)); // due to conversion to ROOT::Math::Rotation3D -- Michael Case DD3Vector x, y, z; childRotation.rotation().GetComponents(x, y, z); // these are the orthonormal columns. @@ -130,7 +139,10 @@ void DDPixFwdBladesNew::execute(DDCompactView& cpv) { childRotMatrix = CLHEP::HepRotation(tr); } - CLHEP::Hep3Vector childTranslation = (nippleType_ == 1) ? getTranslation() : CLHEP::Hep3Vector(childTranslationVector_[0], childTranslationVector_[1], childTranslationVector_[2]); + CLHEP::Hep3Vector childTranslation = + (nippleType_ == 1) + ? getTranslation() + : CLHEP::Hep3Vector(childTranslationVector_[0], childTranslationVector_[1], childTranslationVector_[2]); // Create a matrix for rotation around blade axis (to "blade frame") : CLHEP::HepRotation bladeRotMatrix(CLHEP::Hep3Vector(0., 1., 0.), effBladeAngle); @@ -170,13 +182,23 @@ void DDPixFwdBladesNew::execute(DDCompactView& cpv) { if (!rotation) { rotMatrix *= childRotMatrix; - rotation = DDrot(DDName(rotstr, idNameSpace_), std::make_unique(rotMatrix.xx(), rotMatrix.xy(), rotMatrix.xz(), rotMatrix.yx(), rotMatrix.yy(), rotMatrix.yz(), rotMatrix.zx(), rotMatrix.zy(), rotMatrix.zz())); + rotation = DDrot(DDName(rotstr, idNameSpace_), + std::make_unique(rotMatrix.xx(), + rotMatrix.xy(), + rotMatrix.xz(), + rotMatrix.yx(), + rotMatrix.yy(), + rotMatrix.yz(), + rotMatrix.zx(), + rotMatrix.zy(), + rotMatrix.zz())); } // position the child : DDTranslation ddtran(translation.x(), translation.y(), translation.z()); cpv.position(child, mother, copy, ddtran, rotation); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Position " << child << " copy " << copy << " in " << mother << " with translation " << ddtran << " and rotation " << rotation; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Position " << child << " copy " << copy << " in " << mother + << " with translation " << ddtran << " and rotation " << rotation; ++copy; } @@ -188,8 +210,10 @@ void DDPixFwdBladesNew::execute(DDCompactView& cpv) { CLHEP::Hep3Vector DDPixFwdBladesNew::getTranslation() { double effBladeAngle = endcap_ * bladeAngle_; - CLHEP::Hep3Vector jC = CLHEP::Hep3Vector(endcap_ * jX_, jY_ + ancorRadius_, jZ_); // Point J in the "cover" blade frame - CLHEP::Hep3Vector kB = CLHEP::Hep3Vector(endcap_ * kX_, kY_ + ancorRadius_, kZ_); // Point K in the "body" blade frame + CLHEP::Hep3Vector jC = + CLHEP::Hep3Vector(endcap_ * jX_, jY_ + ancorRadius_, jZ_); // Point J in the "cover" blade frame + CLHEP::Hep3Vector kB = + CLHEP::Hep3Vector(endcap_ * kX_, kY_ + ancorRadius_, kZ_); // Point K in the "body" blade frame // Z-shift from "cover" to "body" blade frame: CLHEP::Hep3Vector tCB(bladeZShift_ * sin(effBladeAngle), 0., bladeZShift_ * cos(effBladeAngle)); @@ -210,8 +234,10 @@ CLHEP::Hep3Vector DDPixFwdBladesNew::getTranslation() { CLHEP::HepRotation DDPixFwdBladesNew::getRotation() { double effBladeAngle = endcap_ * bladeAngle_; - CLHEP::Hep3Vector jC = CLHEP::Hep3Vector(endcap_ * jX_, jY_ + ancorRadius_, jZ_); // Point J in the "cover" blade frame - CLHEP::Hep3Vector kB = CLHEP::Hep3Vector(endcap_ * kX_, kY_ + ancorRadius_, kZ_); // Point K in the "body" blade frame + CLHEP::Hep3Vector jC = + CLHEP::Hep3Vector(endcap_ * jX_, jY_ + ancorRadius_, jZ_); // Point J in the "cover" blade frame + CLHEP::Hep3Vector kB = + CLHEP::Hep3Vector(endcap_ * kX_, kY_ + ancorRadius_, kZ_); // Point K in the "body" blade frame // Z-shift from "cover" to "body" blade frame: CLHEP::Hep3Vector tCB(bladeZShift_ * sin(effBladeAngle), 0., bladeZShift_ * cos(effBladeAngle)); @@ -224,7 +250,7 @@ CLHEP::HepRotation DDPixFwdBladesNew::getRotation() { CLHEP::Hep3Vector kC = rCB * (kB + tCB); CLHEP::Hep3Vector jkC = kC - jC; edm::LogVerbatim("PixelGeom") << "+++++++++++++++ DDPixFwdBlades: " - << "JK Length " << jkC.mag() * CLHEP::mm; + << "JK Length " << jkC.mag() * CLHEP::mm; // Rotations from nipple frame to "cover" blade frame and back : CLHEP::Hep3Vector vZ(0., 0., 1.); diff --git a/Geometry/TrackerCommonData/plugins/DDPixFwdRotation.cc b/Geometry/TrackerCommonData/plugins/DDPixFwdRotation.cc index 9587e0a55c7af..74798e43b5abc 100644 --- a/Geometry/TrackerCommonData/plugins/DDPixFwdRotation.cc +++ b/Geometry/TrackerCommonData/plugins/DDPixFwdRotation.cc @@ -23,7 +23,6 @@ #include #include - class DDPixFwdRotation : public DDAlgorithm { public: DDPixFwdRotation() {} @@ -38,7 +37,7 @@ class DDPixFwdRotation : public DDAlgorithm { void execute(DDCompactView& cpv) override; private: - double endcap_; // +1 for Z Plus endcap disks, -1 for Z Minus endcap disks + double endcap_; // +1 for Z Plus endcap disks, -1 for Z Minus endcap disks std::string rotNameNippleToCover_; std::string rotNameCoverToNipple_; std::string rotNameNippleToBody_; @@ -54,23 +53,23 @@ class DDPixFwdRotation : public DDAlgorithm { double kX_; double kY_; double kZ_; - std::string rotNS_; //Namespace of the rotation matrix - std::string idNameSpace_; //Namespace of this and ALL sub-parts + std::string rotNS_; //Namespace of the rotation matrix + std::string idNameSpace_; //Namespace of this and ALL sub-parts }; void DDPixFwdRotation::initialize(const DDNumericArguments& nArgs, - const DDVectorArguments& vArgs, - const DDMapArguments&, - const DDStringArguments& sArgs, - const DDStringVectorArguments&) { + const DDVectorArguments& vArgs, + const DDMapArguments&, + const DDStringArguments& sArgs, + const DDStringVectorArguments&) { // -- Input geometry parameters : ----------------------------------------------------- endcap_ = nArgs["Endcap"]; rotNameNippleToCover_ = sArgs["NippleToCover"]; rotNameCoverToNipple_ = sArgs["CoverToNipple"]; rotNameNippleToBody_ = sArgs["NippleToBody"]; - nBlades_ = static_cast(nArgs["Blades"]); // Number of blades - bladeAngle_ = nArgs ["BladeAngle"]; // Angle of blade rotation around its axis - bladeZShift_ = nArgs["BladeZShift"]; // Shift in Z between the axes of two adjacent blades + nBlades_ = static_cast(nArgs["Blades"]); // Number of blades + bladeAngle_ = nArgs["BladeAngle"]; // Angle of blade rotation around its axis + bladeZShift_ = nArgs["BladeZShift"]; // Shift in Z between the axes of two adjacent blades ancorRadius_ = nArgs["AncorRadius"]; // Distance from beam line to ancor point defining center of "blade frame" // Coordinates of Nipple ancor points J and K in "blade frame" : jX_ = nArgs["JX"]; @@ -83,7 +82,11 @@ void DDPixFwdRotation::initialize(const DDNumericArguments& nArgs, rotNS_ = sArgs["RotationNS"]; idNameSpace_ = DDCurrentNamespace::ns(); - edm::LogVerbatim("PixelGeom") << "DDPixFwdRotation: Initialize with endcap " << endcap_ << " NameSpace " << idNameSpace_ << ":" << rotNS_ << "\n nBlades " << nBlades_ << " bladeAngle " << bladeAngle_ << " bladeZShift " << bladeZShift_ << " ancorRadius " << ancorRadius_ << " jX|jY|jZ " << jX_ << ":" << jY_ << ":" << jZ_ << " kX|kY|kZ " << kX_ << ":" << kY_ << ":" << kZ_; + edm::LogVerbatim("PixelGeom") << "DDPixFwdRotation: Initialize with endcap " << endcap_ << " NameSpace " + << idNameSpace_ << ":" << rotNS_ << "\n nBlades " << nBlades_ << " bladeAngle " + << bladeAngle_ << " bladeZShift " << bladeZShift_ << " ancorRadius " << ancorRadius_ + << " jX|jY|jZ " << jX_ << ":" << jY_ << ":" << jZ_ << " kX|kY|kZ " << kX_ << ":" << kY_ + << ":" << kZ_; } void DDPixFwdRotation::execute(DDCompactView&) { @@ -91,9 +94,10 @@ void DDPixFwdRotation::execute(DDCompactView&) { double effBladeAngle = endcap_ * bladeAngle_; - CLHEP::Hep3Vector jC = CLHEP::Hep3Vector(jX_ * endcap_, jY_ + ancorRadius_, jZ_);; // Point J in the "cover" blade frame - CLHEP::Hep3Vector kB = CLHEP::Hep3Vector(kX_ * endcap_, kY_ + ancorRadius_, kZ_);; // PoinladeZShiftladeZShiftladeZShiftt K in the "body" blade frame - + CLHEP::Hep3Vector jC = CLHEP::Hep3Vector(jX_ * endcap_, jY_ + ancorRadius_, jZ_); + ; // Point J in the "cover" blade frame + CLHEP::Hep3Vector kB = CLHEP::Hep3Vector(kX_ * endcap_, kY_ + ancorRadius_, kZ_); + ; // PoinladeZShiftladeZShiftladeZShiftt K in the "body" blade frame // Z-shift from "cover" to "body" blade frame: @@ -128,18 +132,28 @@ void DDPixFwdRotation::execute(DDCompactView&) { edm::LogVerbatim("PixelGeom") << " Angle to Cover: " << angleCover; CLHEP::HepRotation* rpCN = new CLHEP::HepRotation(axis, angleCover); - DDrot(DDName(rotNameCoverToNipple_, rotNS_), std::make_unique(rpCN->xx(), rpCN->xy(), rpCN->xz(), rpCN->yx(), rpCN->yy(), rpCN->yz(), rpCN->zx(), rpCN->zy(), rpCN->zz())); + DDrot( + DDName(rotNameCoverToNipple_, rotNS_), + std::make_unique( + rpCN->xx(), rpCN->xy(), rpCN->xz(), rpCN->yx(), rpCN->yy(), rpCN->yz(), rpCN->zx(), rpCN->zy(), rpCN->zz())); CLHEP::HepRotation rpNC(axis, -angleCover); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameCoverToNipple_, rotNS_) << " with " << rpCN; + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameCoverToNipple_, rotNS_) << " with " + << rpCN; - DDrot(DDName(rotNameNippleToCover_, rotNS_), std::make_unique(rpNC.xx(), rpNC.xy(), rpNC.xz(), rpNC.yx(), rpNC.yy(), rpNC.yz(), rpNC.zx(), rpNC.zy(), rpNC.zz())); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToCover_, rotNS_) << " with " << rpNC; + DDrot(DDName(rotNameNippleToCover_, rotNS_), + std::make_unique( + rpNC.xx(), rpNC.xy(), rpNC.xz(), rpNC.yx(), rpNC.yy(), rpNC.yz(), rpNC.zx(), rpNC.zy(), rpNC.zz())); + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToCover_, rotNS_) << " with " + << rpNC; // Rotation from nipple frame to "body" blade frame : CLHEP::HepRotation rpNB(rpNC * rCB); - DDrot(DDName(rotNameNippleToBody_, rotNS_), std::make_unique(rpNB.xx(), rpNB.xy(), rpNB.xz(), rpNB.yx(), rpNB.yy(), rpNB.yz(), rpNB.zx(), rpNB.zy(), rpNB.zz())); - edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToBody_, rotNS_) << " with " << rpNB; + DDrot(DDName(rotNameNippleToBody_, rotNS_), + std::make_unique( + rpNB.xx(), rpNB.xy(), rpNB.xz(), rpNB.yx(), rpNB.yy(), rpNB.yz(), rpNB.zx(), rpNB.zy(), rpNB.zz())); + edm::LogVerbatim("PixelGeom") << "DDPixFwdBlades::Defines " << DDName(rotNameNippleToBody_, rotNS_) << " with " + << rpNB; edm::LogVerbatim("PixelGeom") << " Angle to body : " << vZ.angle(rpNB * vZ); }