New DRC sensitive detector using RegEx #367
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BEGINRELEASENOTES
Geant4RegexSensitivesConstruction
to avoid large memory consumption.ENDRELEASENOTES
This is a draft PR for the update on the DRC sensitive detector using the new
Geant4RegexSensitivesConstruction
introduced in DD4hep recently. By using this, we can avoid large memory consumption caused by the creation of SD objects for every fiber.Note that this is not free, the cost of memory consumption is transferred to the overhead time for matching regex pattern. By trying appropriate pattern, we can suppress the overhead time caused by the
Geant4RegexSensitivesConstruction
down to a few minutes scale. However, this can easily explode up to an hour with complex patterns (so one needs to pay attention). The example steering file can be found in theDRCfastSDsteer.py
.Aside from the introduction of
Geant4RegexSensitivesConstruction
, the default behavior of SD is now modified to skip optical photon propagation for scintillation channels. For scintillation channels, we switched to the defaultGeant4Calorimeter::Hit
(with Birks constant) and retrieve energy deposits from it. For Cherenkov channels, we check whether the optical photon has consecutive total internal reflection. If it has, then we count the photon and kill it to save CPU time. With these, the CPU consumption is now suppressed down to a few seconds per event.The tricky part is retrieving
cellID
. Since each individual fiber is not a unique SD anymore,cellID
now must be retrieved using the segmentation based on the volumeID of the mother tower. To do this, I assigned volumeID for each tower at the detector construction step, then navigateG4VTouchable
object during the SD process. For this I strictly assumed world->detector->tower hierarchy (i.e. the tower volume should be depth 2), and this should be discussed with the capillary tube DRC colleagues.There are still several outstanding action items (e.g., to validate
cellID
encoding, update CI), but I took liberty to push PR already to discuss whether people agree with this approach (conceptually).@lopezzot @swkim95 @s6anloes