-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix Walloc-size-larger-than warnings in SimG4CMS/Forward/*NumberingScheme #41942
Conversation
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41942/35903
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
…ingScheme and ZDCNumberingScheme
fdecb97
to
3c866ea
Compare
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41942/35904
|
A new Pull Request was created by @iarspider for master. It involves the following packages:
@cmsbuild, @civanch, @mdhildreth can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test for el8_amd64_gcc12 |
please test |
please test for CMSSW_13_2_DBG_X just in case - some code changes are conditionally compiled only in DBG_X |
please test for el8_amd64_gcc12 |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-f710c1/33122/summary.html Comparison SummarySummary:
|
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-f710c1/33124/summary.html Comparison SummarySummary:
|
@iarspider , I fully agree that making temporary C-arrays in these classes is not necessary, in general, this PR is valid. However, these classes are used by sub-detectors, which in normal tests are not involved, so validation of results should be done with enough statistics or in the new code you should have another proof that the result is not changed. In a standard WF you likely will not see anything. A safe approach would be to do exactly the same thing as before but without C-arrays. |
detectorLevel(aStep, level, copyno, name); | ||
//Find number of levels | ||
const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); | ||
int level = (touch) ? ((touch->GetHistoryDepth()) + 1) : 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.
I do not think that touch can be undefined.
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.
The check was there in the original code, I can drop it if you think it's safe.
delete[] copyno; | ||
delete[] name; | ||
LogDebug("BHMSim") << "BHMNumberingScheme number of levels= " << level; | ||
if (level > 3) { |
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.
In previous implementation if(level>3) the fix depth is used not depended on level of 'level'
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.
Not sure what you mean. In previous implementation if level was less than or equal to 3, the arrays filled by ::detectorLevel
were not used - unless the calls in that function had side-effects
for (int ich = 0; ich < level; ich++) | ||
LogDebug("BscSim") << " name = " << name[ich] << " copy = " << copyno[ich]; | ||
|
||
for (int ich = 0; ich < level; ich++) { |
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.
Why we need this loop? LogDebug may be moved inside previous loop after line 31
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.
Will do
<< " section " << section << " zside " << zside << " layer " << layer << " fiber " | ||
<< fiber << " channel " << channel << "packedIndex =" << intindex | ||
<< " detId raw: " << std::hex << index << std::dec; | ||
for (int ich = 0; ich < level; ich++) { |
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 loop is also not needed, LogVerbatim may be moved after the line 45
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.
Will do
@civanch correct me if I'm wrong, but these classes are mostly just packing and unpacking integers. Or the tricky part is to somehow make sure |
@iarspider , any hit should have a correct detector ID, which defined by numbering schema. It is critical in this PR to have exactly the same detID numbers as was before. |
@iarspider , to me not clear why testing of this PR face problems while #41979 is working, let us close this. |
PR description:
Fix warnings reported here: #41795 . The changes are similar to what was done in #41826 .
PR validation:
No special validation