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
Changes from 1 commit
601df7b
0404b51
1348192
59cbf2e
25eb699
8d3ef40
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 |
---|---|---|
|
@@ -36,6 +36,8 @@ CSCGeometryParsFromDD::CSCGeometryParsFromDD() : myName("CSCGeometryParsFromDD") | |
|
||
CSCGeometryParsFromDD::~CSCGeometryParsFromDD() {} | ||
|
||
//ddd | ||
|
||
bool CSCGeometryParsFromDD::build(const DDCompactView* cview, | ||
const MuonGeometryConstants& muonConstants, | ||
RecoIdealGeometry& rig, | ||
|
@@ -65,6 +67,9 @@ bool CSCGeometryParsFromDD::build(const DDCompactView* cview, | |
std::vector<double> gtran(3); | ||
std::vector<double> grmat(9); | ||
std::vector<double> trm(9); | ||
|
||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(0) CSCGeometryParsFromDD - DDD "; | ||
|
||
while (doSubDets) { | ||
spec = fv.specifics(); | ||
spit = spec.begin(); | ||
|
@@ -91,6 +96,10 @@ bool CSCGeometryParsFromDD::build(const DDCompactView* cview, | |
int jchamber = detid.chamber(); | ||
int jlayer = detid.layer(); | ||
|
||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(1) detId: " << id << " jendcap: " << jendcap << " jstation: " << jstation << " jring: " << jring | ||
<< " jchamber: " << jchamber << " jlayer: " << jlayer; | ||
|
||
// Package up the wire group info as it's decoded | ||
CSCWireGroupPackage wg; | ||
uparvals.clear(); | ||
|
@@ -137,16 +146,21 @@ bool CSCGeometryParsFromDD::build(const DDCompactView* cview, | |
} | ||
} else if (it->second.name() == "WireSpacing") { | ||
wg.wireSpacing = it->second.doubles()[0]; | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(2) wireSpacing: " << wg.wireSpacing; | ||
} else if (it->second.name() == "AlignmentPinToFirstWire") { | ||
wg.alignmentPinToFirstWire = it->second.doubles()[0]; | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(3) alignmentPinToFirstWire: " << wg.alignmentPinToFirstWire; | ||
} else if (it->second.name() == "TotNumWireGroups") { | ||
wg.numberOfGroups = int(it->second.doubles()[0]); | ||
} else if (it->second.name() == "LengthOfFirstWire") { | ||
wg.narrowWidthOfWirePlane = it->second.doubles()[0]; | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(4) narrowWidthOfWirePlane: " << wg.narrowWidthOfWirePlane; | ||
} else if (it->second.name() == "LengthOfLastWire") { | ||
wg.wideWidthOfWirePlane = it->second.doubles()[0]; | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(5) wideWidthOfWirePlane: " << wg.wideWidthOfWirePlane; | ||
} else if (it->second.name() == "RadialExtentOfWirePlane") { | ||
wg.lengthOfWirePlane = it->second.doubles()[0]; | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(6) lengthOfWirePlane: " << wg.lengthOfWirePlane; | ||
} | ||
} | ||
} | ||
|
@@ -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)); | ||
fpar.emplace_back((dpar[8] / cm)); | ||
|
@@ -214,6 +230,9 @@ bool CSCGeometryParsFromDD::build(const DDCompactView* cview, | |
|
||
LogTrace(myName) << myName << ": gtran[0]=" << gtran[0] << ", gtran[1]=" << gtran[1] << ", gtran[2]=" << gtran[2]; | ||
|
||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(8) gtran[0]: " << gtran[0] << " gtran[1]: " << gtran[1] << " gtran[2]: " << gtran[2]; | ||
|
||
LogTrace(myName) << myName << ": fill grmat..."; | ||
|
||
fv.rotation().GetComponents(trm.begin(), trm.end()); | ||
|
@@ -369,6 +388,9 @@ bool CSCGeometryParsFromDD::build(const cms::DDCompactView* cview, | |
std::vector<double> gtran(3); | ||
std::vector<double> grmat(9); | ||
std::vector<double> trm(9); | ||
|
||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(0) CSCGeometryParsFromDD - DD4HEP "; | ||
|
||
while (fv.firstChild()) { | ||
MuonGeometryNumbering mbn(muonConstants); | ||
CSCNumberingScheme cscnum(muonConstants); | ||
|
@@ -381,6 +403,10 @@ bool CSCGeometryParsFromDD::build(const cms::DDCompactView* cview, | |
int jchamber = detid.chamber(); | ||
int jlayer = detid.layer(); | ||
|
||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(1) detId: " << id << " jendcap: " << jendcap << " jstation: " << jstation << " jring: " << jring | ||
<< " jchamber: " << jchamber << " jlayer: " << jlayer; | ||
|
||
// Package up the wire group info as it's decoded | ||
CSCWireGroupPackage wg; | ||
uparvals.clear(); | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I suggest simplifying the treatment of
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. This code goes through three steps with wire spacing:
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:
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 : 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the code here is designed in an inconsistent way. |
||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(2) wireSpacing: " << wg.wireSpacing / dd4hep::cm; | ||
|
||
auto alignmentpintofirstwire = fv.get<double>("AlignmentPinToFirstWire"); | ||
wg.alignmentPinToFirstWire = static_cast<double>(alignmentpintofirstwire); | ||
wg.alignmentPinToFirstWire = static_cast<double>(alignmentpintofirstwire / dd4hep::cm); | ||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(3) alignmentPinToFirstWire: " << wg.alignmentPinToFirstWire / dd4hep::cm; | ||
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. I didn't notice this before. 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 added "/dd4hep::cm" in order to put the units in the code for a future fix even if alignmentPinToFirstWire is already in cm. Adding "/dd4hep::cm" do not change anything if the value of the parameter is already in "cm" |
||
|
||
auto totnumwiregroups = fv.get<double>("TotNumWireGroups"); | ||
wg.numberOfGroups = static_cast<int>(totnumwiregroups); | ||
|
||
auto lengthoffirstwire = fv.get<double>("LengthOfFirstWire"); | ||
wg.narrowWidthOfWirePlane = static_cast<double>(lengthoffirstwire); | ||
wg.narrowWidthOfWirePlane = static_cast<double>(lengthoffirstwire / dd4hep::cm); | ||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(4) narrowWidthOfWirePlane: " << wg.narrowWidthOfWirePlane / dd4hep::cm; | ||
|
||
auto lengthoflastwire = fv.get<double>("LengthOfLastWire"); | ||
wg.wideWidthOfWirePlane = static_cast<double>(lengthoflastwire); | ||
wg.wideWidthOfWirePlane = static_cast<double>(lengthoflastwire / dd4hep::cm); | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(5) wideWidthOfWirePlane: " << wg.wideWidthOfWirePlane / dd4hep::cm; | ||
|
||
auto radialextentofwireplane = fv.get<double>("RadialExtentOfWirePlane"); | ||
wg.lengthOfWirePlane = static_cast<double>(radialextentofwireplane); | ||
wg.lengthOfWirePlane = static_cast<double>(radialextentofwireplane / dd4hep::cm); | ||
edm::LogVerbatim("CSCGeometryParsFromDD") << "(6) lengthOfWirePlane: " << wg.lengthOfWirePlane / dd4hep::cm; | ||
|
||
uparvals.emplace_back((wg.wireSpacing) * 10.0); | ||
uparvals.emplace_back(wg.wireSpacing / dd4hep::mm); | ||
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 have to be very careful here. I don't think any values that go into the 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 deleted "/dd4hep::mm"inside uparvals and I set wireSpacing in mm |
||
uparvals.emplace_back(wg.alignmentPinToFirstWire); | ||
uparvals.emplace_back(wg.numberOfGroups); | ||
uparvals.emplace_back(wg.narrowWidthOfWirePlane); | ||
|
@@ -477,25 +510,36 @@ bool CSCGeometryParsFromDD::build(const cms::DDCompactView* cview, | |
std::transform( | ||
dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); }); | ||
|
||
fpar.emplace_back((dpar[1])); | ||
fpar.emplace_back((dpar[2])); | ||
fpar.emplace_back((dpar[3])); | ||
fpar.emplace_back((dpar[4])); | ||
fpar.emplace_back((dpar[1] / dd4hep::cm)); | ||
fpar.emplace_back((dpar[2] / dd4hep::cm)); | ||
fpar.emplace_back((dpar[3] / dd4hep::cm)); | ||
fpar.emplace_back((dpar[4] / dd4hep::cm)); | ||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(7) - Subtraction - dpar[1] (ddd dpar[4]): " << dpar[1] / dd4hep::cm | ||
<< " (ddd dpar[8]): " << dpar[2] / dd4hep::cm << " dpar[3] (as ddd): " << dpar[3] / dd4hep::cm | ||
<< " dpar[4] (ddd dpar[0]): " << dpar[4] / dd4hep::cm; | ||
} else { | ||
dpar = fv.parameters(); | ||
|
||
std::transform( | ||
dpar.begin(), dpar.end(), dpar.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); }); | ||
|
||
fpar.emplace_back((dpar[0])); | ||
fpar.emplace_back((dpar[1])); | ||
fpar.emplace_back((dpar[2])); | ||
fpar.emplace_back((dpar[3])); | ||
fpar.emplace_back((dpar[0] / dd4hep::cm)); | ||
fpar.emplace_back((dpar[1] / dd4hep::cm)); | ||
fpar.emplace_back((dpar[2] / dd4hep::cm)); | ||
fpar.emplace_back((dpar[3] / dd4hep::cm)); | ||
edm::LogVerbatim("CSCGeometryParsFromDD") | ||
<< "(7)Bis - Else - dpar[0]: " << dpar[0] / dd4hep::cm << " dpar[1]: " << dpar[1] / dd4hep::cm | ||
<< " dpar[2]: " << dpar[2] / dd4hep::cm << " dpar[3]: " << dpar[3] / dd4hep::cm; | ||
} | ||
|
||
gtran[0] = static_cast<float>(fv.translation().X()); | ||
gtran[1] = static_cast<float>(fv.translation().Y()); | ||
gtran[2] = static_cast<float>(fv.translation().Z()); | ||
gtran[0] = static_cast<float>(fv.translation().X() / dd4hep::cm); | ||
gtran[1] = static_cast<float>(fv.translation().Y() / dd4hep::cm); | ||
gtran[2] = static_cast<float>(fv.translation().Z() / dd4hep::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 commentThe 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:
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 : done |
||
|
||
std::transform( | ||
gtran.begin(), gtran.end(), gtran.begin(), [](double i) -> double { return cms_rounding::roundIfNear0(i); }); | ||
|
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:
(We are trying to remove this file from all of Geometry code.)
Then these lines need to be changed like:
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