-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[DD4hep] Minor size correction of 0.1 to 7 degrees in phi for tube shapes that are non-sensitive TIB pillars and ribs #34088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
60c9560
2e36ed0
821e3d4
d2b14d5
a5b80a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,6 +449,11 @@ namespace { | |
| return ns.rotation(ns.prepend(nam)); | ||
| } | ||
|
|
||
| const Rotation3D& myrot(cms::DDNamespace& ns, const string& nam, const Rotation3D& r) { | ||
| ns.addRotation(nam, r); | ||
| return ns.rotation(ns.prepend(nam)); | ||
| } | ||
|
|
||
| Solid mytrap(const std::string& nam, const EcalTrapezoidParameters& t) { | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeom") << nam << " Trap " << convertRadToDeg(t.theta()) << ":" << convertRadToDeg(t.phi()) | ||
|
|
@@ -1169,10 +1174,12 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| const double yy(radius * sin(phi)); | ||
| const double xx(radius * cos(phi)); | ||
| ++ptmCopy; | ||
| xilyLog.placeVolume( | ||
| ilyPTMLog, | ||
| ptmCopy, | ||
| Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyPTMZ[ilyPTM] - ilyLengthHalf))); | ||
| xilyLog.placeVolume(ilyPTMLog, | ||
| ptmCopy, | ||
| Transform3D(myrot(ns, | ||
| std::string(ilyPTMLog.name()) + "_rot" + std::to_string(ptmCopy), | ||
| Rotation3D(RotationZ(phi))), | ||
| Position(xx, yy, ily.vecIlyPTMZ[ilyPTM] - ilyLengthHalf))); | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeomX") | ||
| << ilyPTMLog.name() << ":" << ptmCopy << " positioned in " << xilyLog.name() << " at (" | ||
|
|
@@ -1189,10 +1196,13 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| const double yy(radius * sin(phi)); | ||
| const double xx(radius * cos(phi)); | ||
| ++fanOutCopy; | ||
| xilyLog.placeVolume(ilyFanOutLog, | ||
| fanOutCopy, | ||
| Transform3D(RotationZ(phi) * RotationY(180._deg), | ||
| Position(xx, yy, ily.vecIlyFanOutZ[ilyFO] - ilyLengthHalf))); | ||
| xilyLog.placeVolume( | ||
| ilyFanOutLog, | ||
| fanOutCopy, | ||
| Transform3D(myrot(ns, | ||
| std::string(ilyFanOutLog.name()) + "_rot" + std::to_string(fanOutCopy), | ||
|
||
| RotationZ(phi) * RotationY(180._deg)), | ||
| Position(xx, yy, ily.vecIlyFanOutZ[ilyFO] - ilyLengthHalf))); | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeomX") | ||
| << ilyFanOutLog.name() << ":" << fanOutCopy << " positioned in " << xilyLog.name() << " at (" | ||
|
|
@@ -1207,10 +1217,12 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| const double yy(radius * sin(phi)); | ||
| const double xx(radius * cos(phi)); | ||
| ++femCopy; | ||
| xilyLog.placeVolume( | ||
| ilyFEMLog, | ||
| femCopy, | ||
| Transform3D(RotationZ(phi), Position(xx, yy, ily.vecIlyFEMZ[ilyFEM] - ilyLengthHalf))); | ||
| xilyLog.placeVolume(ilyFEMLog, | ||
| femCopy, | ||
| Transform3D(myrot(ns, | ||
| std::string(ilyFEMLog.name()) + "_rot" + std::to_string(femCopy), | ||
| Rotation3D(RotationZ(phi))), | ||
|
||
| Position(xx, yy, ily.vecIlyFEMZ[ilyFEM] - ilyLengthHalf))); | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeomX") | ||
| << ilyFEMLog.name() << ":" << femCopy << " positioned in " << xilyLog.name() << " at (" | ||
|
|
@@ -1242,8 +1254,11 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| xilyLog.placeVolume( | ||
| ilyPipeLog[type], | ||
| copyNum[type], | ||
| Transform3D(Rotation3D(ROOT::Math::AxisAngle(ROOT::Math::AxisAngle::XYZVector(xx, yy, 0), 90._deg)), | ||
| Position(xx, yy, zz))); | ||
| Transform3D( | ||
| myrot(ns, | ||
| std::string(ilyPipeLog[type].name()) + "_rot" + std::to_string(ly), | ||
|
||
| Rotation3D(ROOT::Math::AxisAngle(ROOT::Math::AxisAngle::XYZVector(xx, yy, 0), 90._deg))), | ||
| Position(xx, yy, zz))); | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeomX") << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in " | ||
| << xilyLog.name() << " at (" << cms::convert2mm(xx) << "," | ||
|
|
@@ -1390,7 +1405,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
|
|
||
| Solid fawSolid = SubtractionSolid(fawSolid1, | ||
| fawCutBox, | ||
| Transform3D(myrot(ns, fawCutName + "R", fawCutForm.getRotation()), | ||
| Transform3D(myrot(ns, fawCutName + "_rot", fawCutForm.getRotation()), | ||
| Position(fawCutForm.getTranslation().x(), | ||
| fawCutForm.getTranslation().y(), | ||
| fawCutForm.getTranslation().z()))); | ||
|
|
@@ -1413,7 +1428,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| ns.assembly(alvWedge.hawRName), | ||
| copyOne, | ||
| Transform3D( | ||
| myrot(ns, alvWedge.hawRName + "R", hawRform.getRotation()), | ||
| myrot(ns, alvWedge.hawRName + "_rot", hawRform.getRotation()), | ||
| Position(hawRform.getTranslation().x(), hawRform.getTranslation().y(), hawRform.getTranslation().z()))); | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeomX") << ns.assembly(alvWedge.hawRName).name() << ":" << copyOne << " positioned in " | ||
|
|
@@ -1426,7 +1441,10 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| ns.assembly(alvWedge.hawRName), | ||
| copyTwo, | ||
| Transform3D( | ||
| Rotation3D(1., 0., 0., 0., 1., 0., 0., 0., -1.) * RotationY(M_PI), // rotate about Y after refl thru Z | ||
| myrot( | ||
| ns, | ||
| alvWedge.hawRName + "R2", | ||
| Rotation3D(1., 0., 0., 0., 1., 0., 0., 0., -1.) * RotationY(M_PI)), // rotate about Y after refl thru Z | ||
| Position(-hawRform.getTranslation().x(), -hawRform.getTranslation().y(), -hawRform.getTranslation().z()))); | ||
| #ifdef EDM_ML_DEBUG | ||
| edm::LogVerbatim("EBGeomX") << ns.assembly(alvWedge.hawRName).name() << ":" << copyTwo << " positioned in " | ||
|
|
@@ -1489,7 +1507,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| ns.assembly(alvWedge.hawRName) | ||
| .placeVolume(gridLog, | ||
| copyOne, | ||
| Transform3D(myrot(ns, grid.name + "R", gridForm.getRotation()), | ||
| Transform3D(myrot(ns, grid.name + "_rot", gridForm.getRotation()), | ||
| Position(gridForm.getTranslation().x(), | ||
| gridForm.getTranslation().y(), | ||
| gridForm.getTranslation().z()))); | ||
|
|
@@ -1559,7 +1577,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext | |
| ); | ||
|
|
||
| const string cryDDName(cry.name + sType); | ||
| Solid crySolid = mytrap(cry.name, trapCry); | ||
| Solid crySolid = mytrap(cryDDName, trapCry); | ||
| Volume cryLog = Volume(cryDDName, crySolid, ns.material(cry.mat)); | ||
|
|
||
| //++++++++++++++++++++++++++++++++++ APD ++++++++++++++++++++++++++++++++++ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| <!-- support ring solids - refer to outer disk comments --> | ||
| <Algorithm name="track:DDCutTubsFromPoints"> | ||
| <rParent name="pixfwdDisks:PixelForwardDiskZminus"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskOuterRing"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskOuterRingZminus"/> | ||
|
||
| <String name="Material" value="pixfwdMaterials:C_C_InnerOuterRing"/> | ||
| <Numeric name="zPos" value="[OuterRingZ]"/> | ||
| <Numeric name="rMin" value="[pixfwdSupportRingParameters:InnerDiskOuterRingRMin]"/> | ||
|
|
@@ -22,7 +22,7 @@ | |
| </Algorithm> | ||
| <Algorithm name="track:DDCutTubsFromPoints"> | ||
| <rParent name="pixfwdDisks:PixelForwardDiskZminus"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskCFOuterRing"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskCFOuterRingZminus"/> | ||
| <String name="Material" value="pixfwdMaterials:FPix_CFSkin_InnerOuterRing"/> | ||
| <Numeric name="zPos" value="[OuterRingZ]"/> | ||
| <Numeric name="rMin" value="[pixfwdSupportRingParameters:InnerDiskOuterRingCFRMin]"/> | ||
|
|
@@ -33,7 +33,7 @@ | |
| </Algorithm> | ||
| <Algorithm name="track:DDCutTubsFromPoints"> | ||
| <rParent name="pixfwdDisks:PixelForwardDiskZminus"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskInnerRing"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskInnerRingZminus"/> | ||
| <String name="Material" value="pixfwdMaterials:C_C_InnerInnerRing"/> | ||
| <Numeric name="zPos" value="[InnerRingZ]"/> | ||
| <Numeric name="rMin" value="[pixfwdSupportRingParameters:InnerDiskInnerRingRMin]"/> | ||
|
|
@@ -44,7 +44,7 @@ | |
| </Algorithm> | ||
| <Algorithm name="track:DDCutTubsFromPoints"> | ||
| <rParent name="pixfwdDisks:PixelForwardDiskZminus"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskCFInnerRing"/> | ||
| <String name="SolidName" value="PixelForwardInnerDiskCFInnerRingZminus"/> | ||
| <String name="Material" value="pixfwdMaterials:FPix_CFSkin_InnerInnerRing"/> | ||
| <Numeric name="zPos" value="[InnerRingZ]"/> | ||
| <Numeric name="rMin" value="[pixfwdSupportRingParameters:InnerDiskInnerRingCFRMin]"/> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -409,6 +409,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, | |
| dy = 0.5 * pitchThick; | ||
| dz = 0.5 * pitchHeight; | ||
| solid = Box(dx, dy, dz); | ||
| name += "Box"; | ||
|
||
| ns.addSolidNS(name, solid); | ||
| edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Box made of " << pitchMat | ||
| << " of dimensions " << dx << ", " << dy << ", " << dz; | ||
|
|
@@ -419,6 +420,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt, | |
| bl2 = 0.5 * pitchHeight - 0.5 * dz * sin(detTilt); | ||
| thet = atan((bl1 - bl2) / (2. * dz)); | ||
| solid = Trap(dz, thet, 0, h1, bl1, bl1, 0, h1, bl2, bl2, 0); | ||
| name += "Trap"; | ||
| ns.addSolidNS(name, solid); | ||
| edm::LogVerbatim("TECGeom") << "Solid:\t" << name << " " << solid.name() << " Trap made of " << pitchMat | ||
| << " of dimensions " << dz << ", " << convertRadToDeg(thet) << ", 0, " << h1 << ", " | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -252,7 +252,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex | |
| double dz = 0.5 * layerL - 2. * fillerDz; | ||
| double _rmi = std::min(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm); | ||
| double _rma = std::max(rin + 0.5 * dd4hep::mm, rout - 0.5 * dd4hep::mm); | ||
| solid = ns.addSolidNS(name, Tube(_rmi, _rma, dz, -0.5 * width, width)); | ||
| solid = ns.addSolidNS(name, Tube(_rmi, _rma, dz, -0.5 * width, 0.5 * width)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cvuosalo - it is strange that this did not come out in validation. Could you, please, share a snapshot of the geometry fragment before and after? Thanks.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I will reproduce the bug and post the before and after. It is a very small difference, so that is maybe why it wasn't detected earlier.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cvuosalo, I suspect, that old variant of the Tube was correct. The signature of the Tube:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can compare old DD with DD4hep for these tubes. Here is old DD: Here is DD4hep WITHOUT the fix: The problem comes from the change in the Tube constructor between old DD and DD4hep. In old DD, the last parameter is and the corresponding line of code is: but with DD4hep the last parameter is so the last the last parameter with DD4hep needs to be It is unfortunate that this bug was not found until now. I think it affects about 20 solids. I would think we would want to fix it now, rather than leaving it for all of Run 3.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cvuosalo , thank you for the explanation but in my view what DD4Hep did is a scandal - they change signature in a place which is very difficult to debug. We may have thousands similar places.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @civanch I did a systematic comparison of all solids between old DD and DD4hep. That's how I discovered the minor discrepancies discussed in this PR. I don't think there are any more. Probably, in most cases for tubes,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cvuosalo - it would be good to see a snapshot before and after the fix. I'd assume there would be an overlap detected with a double delta phi. Also, it is not obvious what DD4hep is doing when constructing the shape. Sometimes the arguments may differ. |
||
| LogDebug("TIBGeom") << solid.name() << " Tubs made of " << ribMat << " from " << -0.5 * convertRadToDeg(width) | ||
| << " to " << 0.5 * convertRadToDeg(width) << " with Rin " << rin + 0.5 * dd4hep::mm << " Rout " | ||
| << rout - 0.5 * dd4hep::mm << " ZHalf " << dz; | ||
|
|
@@ -490,7 +490,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& contex | |
| break; | ||
| } | ||
|
|
||
| solid = ns.addSolidNS(name, Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, 2. * pillarDPhi)); | ||
| solid = ns.addSolidNS(name, Tube(pillarRin, pillarRout, pillarDz, -pillarDPhi, pillarDPhi)); | ||
| Volume Pillar = ns.addVolumeNS(Volume(name, solid, ns.material(pillarMaterial))); | ||
| LogDebug("TIBGeom") << solid.name() << " Tubs made of " << pillarMaterial << " from " << -pillarDPhi << " to " | ||
| << pillarDPhi << " with Rin " << pillarRin << " Rout " << pillarRout << " ZHalf " << pillarDz; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cvuosalo - this is an unnecessary performance bomb. A new object is returned after each +. That means that a new buffer is used each time. You are doing a ton of extra + operations - it is not efficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove these rotation names since they are not strictly necessary.