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
Added "/dd4hep::cm" to the CSCGeometryParsFromDD Class #32526
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-32526/20477
|
A new Pull Request was created by @slomeo (Sergio Lo Meo) for master. It involves the following packages: Geometry/CSCGeometryBuilder @civanch, @Dr15Jones, @makortel, @cvuosalo, @ianna, @mdhildreth, @cmsbuild can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
@@ -200,6 +214,8 @@ bool CSCGeometryParsFromDD::build(const DDCompactView* cview, | |||
LogTrace(myName) << myName << ": fill fpar..."; | |||
LogTrace(myName) << myName << ": dpars are... " << dpar[4] / cm << ", " << dpar[8] / cm << ", " << dpar[3] / cm | |||
<< ", " << dpar[0] / cm; | |||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(7) dpar[4]: " << dpar[4] / cm << " dpar[8]: " << dpar[8] / cm | |||
<< " dpar[3]: " << dpar[3] / cm << " dpar[0]: " << dpar[0] / cm; | |||
|
|||
fpar.emplace_back((dpar[4] / cm)); |
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.
Please delete line 24:
#include "CLHEP/Units/GlobalSystemOfUnits.h"
(We are trying to remove this file from all of Geometry code.)
Then these lines need to be changed like:
fpar.emplace_back(convertMmToCm(dpar[4]));
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 : done
@@ -426,24 +452,31 @@ bool CSCGeometryParsFromDD::build(const cms::DDCompactView* cview, | |||
} | |||
|
|||
auto wirespacing = fv.get<double>("WireSpacing"); | |||
wg.wireSpacing = static_cast<double>(wirespacing); | |||
wg.wireSpacing = static_cast<double>(wirespacing / dd4hep::cm); |
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 suggest simplifying the treatment of wireSpacing
. Convert it to mm at the start.
wg.wireSpacing = fv.get<double>("WireSpacing") / dd4hep::mm;
In the debug output, give "mm" as its units. And then in line 479, there is no conversion because it is already in mm.
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 : wg.wireSpacing is read, by DD4HEP, in "cm" (see PR description within the DD4HEP part) so in line 479 it is neessary to put / dd4hep::mm.
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.
This code goes through three steps with wire spacing:
auto wirespacing = fv.get<double>("WireSpacing"); // Get wire spacing in DD4hep units
wg.wireSpacing = static_cast<double>(wirespacing / dd4hep::cm); // Convert wire spacing to cm
uparvals.emplace_back(wg.wireSpacing / dd4hep::mm); // Store wire spacing in mm
I don't see any reason for the intermediate conversion to cm. Why is that needed? Don't convert it to cm. It could be converted to mm in the first step in line 456, and that would be the only conversion:
wg.wireSpacing = fv.get<double>("WireSpacing") / dd4hep::mm;
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 : before adding "/ dd4hep::cm" in the line "wg.wireSpacing = static_cast(wirespacing / dd4hep::cm);" I have checked the printouts written inside the myLog.lo file and I saw that for the DD4HEP part wirespacing was written in "cm" not in "mm" (i.e without "/dd4hep::cm"). All parameters inside the DD4HEP part are in "cm". So I added "/dd4hep::cm" in order to put the units in the code for a future fix. I noted that adding "/dd4hep::cm" in all the parameters that are already "cm" does not change the value. The only part of the DD4HEP code written in "mm" was "uparvals.emplace_back((wg.wireSpacing) * 10.0);" in line 446. This is why I wrote /dd4hep::cm and /dd4hep::mm in the code.
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.
Yes, the code here is designed in an inconsistent way. alignmentPinToFirstWire
, narrowWidthOfWirePlane
, and others are stored in cm. However, wireSpacing
is stored in mm. I am suggesting to make a change so wireSpacing
is changed to mm at the first step, which will require changing the debug print-out statements so they say that wireSpacing
is in mm.
The reason we are changing the DD4hep units is to reduce the number of multiplications. Since wireSpacing
is stored in mm, it never needs to be in cm, so let's eliminate the step that converts wireSpacing
to cm.
|
||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(8) gtran[0]: " << gtran[0] / dd4hep::cm << " gtran[1]: " << gtran[1] / dd4hep::cm | ||
<< " gtran[2]: " << gtran[2] / dd4hep::cm; |
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 noticed lines 557-562 contain a useless loop. Those lines can be changed to:
if (wg.numberOfGroups == 0) {
LogTrace(myName) << myName << " wg.numberOfGroups == 0 ";
}
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 : done
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-980269/11776/summary.html Comparison SummarySummary:
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-32526/20497
|
Pull request #32526 was updated. @civanch, @Dr15Jones, @makortel, @cvuosalo, @ianna, @mdhildreth, @cmsbuild can you please check and sign again. |
please test |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-32526/20572
|
Pull request #32526 was updated. @civanch, @Dr15Jones, @makortel, @cvuosalo, @ianna, @mdhildreth, @cmsbuild can you please check and sign again. |
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-980269/11865/summary.html Comparison Summary@slava77 comparisons for the following workflows were not done due to missing matrix map:
Summary:
|
@slomeo Sorry, I left out a step:
The values in these lines should be identical between old DD and DD4hep. |
@cvuosalo : I already have the Geometry/CSCGeometry directory in my IB. I have compiled and I followed your instructions (i.e scram b -j8 USER_CXXFLAGS="-DEDM_ML_DEBUG). The results are in /afs/cern.ch/user/s/slomeo/public/forCarl |
@slomeo Yes, I checked the results in the |
I have confirmed that the latest version of this PR is correct and that the current master has a bug that is fixed by this PR. For the record, here are the instructions and results.
Repeat these steps for this PR. Note that enabling DEBUG messages in the dump-CSC-geometry scripts isn't needed since this PR has already done that. With this PR, the key line of debug output matches between old DD and DD4hep: |
+1 In the comparison test results for the DD4hep workflows, I see some improved results (histograms filled in that were empty in the reference) and also irrelevant statistical fluctuations. I think the comparison results show that this PR fixed a small bug and thus the results changed in a positive way. |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @silviodonato, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2) |
@cvuosalo thank you very much! |
@slomeo Could you please update the validation section of the PR description with the output of the final version of the validation test? You changed the PR after you wrote the PR description. Also, correct the name of the validation script (it's not |
+1 |
PR description:
Added "/ ddhep::cm" to the DD4hep part of the CScGeometryParsFromDD Class in order to simplify a possible future unit transition
PR validation:
validation by "cmsRun Geometry/CSCGeometryBuilder/test/python/dumpCSCGeometryDDD_cfg.py" and "cmsRun Geometry/CSCGeometryBuilder/test/python/dumpCSCGeometryDD4hep_cfg.py". Save the output of each dump script and look at these values:
wireSpacing = 0.25, y1 = -79.9354, narrow_width = 20.13, wide_width = 48.71, length = 150.5, wireAngle = 0.506145, theWireOffset = -69.9131
They have to be the same for DDD and DD4hep.
validation by "cmsRun Geometry/CSCGeometryBuilder/test/python/validateCSCGeometryDD4Hep_cfg.py" and "cmsRun Geometry/RPCGeometryBuilder/test/python/validateDTGeometryDDD_cfg.py"
See attached picture (only one histo for DD4hep)
//DDD
(0) CSCGeometryParsFromDD - DDD
(1) detId: 604017672 jendcap: 1 jstation: 1 jring: 1 jchamber: 1 jlayer: 0
(7) dpar[4]: 15.065 cm dpar[8]: 30.45 cm dpar[3]: 7.35 cm dpar[0]: 81 cm
(8) gtran[0]: 181.5 cm gtran[1]: -3.15941e-13 cm gtran[2]: 616.95 cm
//DD4Hep
(0) CSCGeometryParsFromDD - DD4HEP
(1) detId: 604017672 jendcap: 1 jstation: 1 jring: 1 jchamber: 1 jlayer: 0
(7) dpar[0]: 15.065 cm dpar[1]: 30.45 cm dpar[2]: 7.35 cm dpar[3]: 81 cm
(8) gtran[0]: 181.5 cm gtran[1]: -4.46384e-14 cm gtran[2]: 616.95 cm
25202.1_TTbar_13+TTbar_13+DIGIUP15APVSimu_PU25+RECOUP15_PU25+HARVESTUP15_PU25 Step0-PASSED Step1-PASSED Step2-PASSED Step3-PASSED - time date Thu Dec 17 17:44:41 2020-date Thu Dec 17 17:22:02 2020; exit: 0 0 0 0 1 1 1 1 tests passed, 0 0 0 0 failed
if this PR is a backport please specify the original PR and why you need to backport that PR:
nothing special