-
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 ECAL Endcap quadrants issue with DD4hep reflected volumes + Also fix ECAL Barrel and CSCs reflected active detectors #32218
Conversation
…reflected active volumes in CSCs and ECAL Barrel. The idea is that the G4 reflected volumes (with names _refl) were not added to the sensitive catalogue, hence the associated reflected G4 logical volumes were not activated as sensitive, hence no SimHits on these active volumes.
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-32218/19964
|
A new Pull Request was created by @ghugo83 for master. It involves the following packages: SimG4Core/Geometry @cmsbuild, @civanch, @mdhildreth can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins.
|
+1 |
Comparison job queued. |
G4LogicalVolumeStore *theStore = G4LogicalVolumeStore::GetInstance(); | ||
for (const auto &lv : *theStore) { | ||
if (lv->GetName().find(reflectedG4LogicalVolumeName) != std::string::npos) { | ||
hasReflectedVolumeInStore = true; |
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.
Shouldn't you add after this line:
break;
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 need to clean style a bit, will slightly improve.
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.
But for now I was focused on finding the issue
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.
break is a good point, I will add it
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 Yep I remember what happened now, actually I wanted to use a std::find, but I did not know what was the type of G4LogicalVolumeStore, so just made the easy loop, to first see whether the fix was working anyway.
Just looked it up, G4LogicalVolumeStore is a std::vector<G4LogicalVolume*>.
I have just used a std::find_if in #32241 , it is equivalent to a loop and break, as of course stops at first occurrence.
@ghugo83 How many logical volumes are contained in the |
The overall complexity is O(number of active non-reflected logical volumes x number of logical volumes). This PR has no effect on the overall complexity of the sensitive catalogue initialization phase, because there is already an existing O(number of active non-reflected logical volumes x number of logical volumes) complexity from a loop just after anyway. It is here: https://github.com/cms-sw/cmssw/blob/master/SimG4Core/SensitiveDetector/src/SensitiveDetector.cc#L49 This PR has same complexity, hence no observable effect on complexity overall. |
The time spent at the creation of the SensitiveCatalogue is overall negligible anyway, it is not a bottleneck AND additionally, it is only called once :) |
Comparison is ready Comparison Summary:
|
Number of logical volumes is ~4000 in Run-2. |
+1 |
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) |
urgent |
+1 |
Did we merge the version without |
This PR fixes the handling of reflected volumes in CMSSW in DD4hep workflows.
The key idea is that the handling of reflected volumes is different in old DD and DD4hep, as there are 2 different files in CMSSW:
In old DD, there is a special treatment for reflected volumes, so that the volumes with _refl are added to the sensitive detector catalogue.
In DD4hep, the G4 reflected volumes were properly created, but their names with _refl were not added to the active detectors catalogue list.
This resulted, further downstream in https://github.com/cms-sw/cmssw/blob/master/SimG4Core/SensitiveDetector/src/SensitiveDetector.cc#L53, to have the reflected volumes not set as active detectors.
This issue did not appear with the TGeo trick, because the reflected volumes with TGeo, did not have the _refl names.
The reflected active volumes being not considered as sensitive detectors by G4, there were obviously no SimHit on them.
The proper list of active volumes is now fixed, and includes the active reflected volumes.
NB: The affected active volumes, which are now present on a DD4hep workflow, and which were NOT considered as active volumes until now, without the TGeo trick, are:
In ECAL Endcap:
reflectedG4LogicalVolumeName = EFRY_refl
-> This solves the ECAL Endcap quadrants issue.
In ECAL Barrel:
reflectedG4LogicalVolumeName = ebalgo:EBRY_01_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_01_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_01_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_02_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_02_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_02_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_03_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_03_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_03_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_07_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_04_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_04_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_04_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_05_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_05_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_05_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_06_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_06_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_06_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_07_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_07_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_08_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_08_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_08_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_09_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_09_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_09_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_10_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_10_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_10_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_11_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_11_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_11_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_12_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_12_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_12_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_13_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_13_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_13_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_14_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_14_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_14_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_15_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_15_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_15_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_16_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_16_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_16_refl
reflectedG4LogicalVolumeName = ebalgo:EBRY_17_refl
reflectedG4LogicalVolumeName = ebalgo:EATJ_17_refl
reflectedG4LogicalVolumeName = ebalgo:EAPD_17_refl
In CSC:
reflectedG4LogicalVolumeName = csc:ME1A_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME11_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME12_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME13_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME21_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME22_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME31_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME32_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME41_ActiveGasVol_refl
reflectedG4LogicalVolumeName = csc:ME42_ActiveGasVol_refl
NB 2: PR quickly done here, might push a few commits to clean it.
@ianna @civanch @bsunanda @cvuosalo