-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Use of edm::RandomNumberGenerator in HGCDigiProducer #22712
Comments
A new Issue was created by @makortel Matti Kortelainen. @davidlange6, @Dr15Jones, @smuzaffar, @fabiocos can you please review it and eventually sign/assign? Thanks. cms-bot commands are listed here |
There are actually two separate questions.
|
@wddgit I spotted the same pattern in many other classes within the MixingModule plugins, e.g. cmssw/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc Lines 166 to 178 in 285a1d8
cmssw/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc Lines 631 to 643 in 285a1d8
cmssw/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc Lines 88 to 100 in 285a1d8
cmssw/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc Lines 246 to 258 in 285a1d8
cmssw/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc Lines 303 to 315 in 285a1d8
cmssw/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc Lines 290 to 302 in 285a1d8
cmssw/Validation/EcalDigis/src/EcalMixingModuleValidation.cc Lines 811 to 823 in 285a1d8
so maybe the pattern in HGCDigiProducer is just copy-paste from elsewhere? Then there is cmssw/Mixing/Base/src/PileUp.cc Lines 343 to 349 in 285a1d8
which caches the random engine to a member variable. All these were added in commit 6696e5d of #2392. If we now think the pattern could be improved, maybe we should just do it everywhere? @Dr15Jones, could you remind me if an instance of a stream module is always run in the same stream (i.e. is the pattern of |
An instance of a stream module is always run in the same stream. |
Looks like I created this pattern back in 2014. I did not remember After staring at CastorDigiProducer more, I cannot understand or remember Removing the vector in all these cases would be a good thing. It is confusing There is the separate issue of whether we should cache or not. |
Also note EcalMixingModuleValidation is a one type module. For that |
I found the reason it was coded that way. Back in 2014 the |
@wddgit Thanks for reminding of the history. Should we then migrate everything else than |
That sounds like the best course to me. I see that Dan Riley did that for the PileUp class back in 2015. I don't feel strongly about this though. If you or Chris advocate removing the caching entirely I would be happy with that also. It might be worth testing that we do not slow it down significantly if we remove the caching. Matti, were you going to make this change? @Dr15Jones If you want me to do it, let me know and what its priority is compared to what I am currently working on. |
@wddgit I talked briefly with @Dr15Jones and we felt as well to keep the caching (without strong feelings). I can take care of it at some point in the near future. |
The cleanup is in #22874. |
HGCDigiProducer
(which is/can be a member variable ofMixingModule
, which itself is astream::EDProducer
) has a local "stream cache" forCLHEP::HepRandomEngine
s.cmssw/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc
Lines 47 to 50 in 301a35e
cmssw/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc
Lines 69 to 81 in 301a35e
A private e-mail thread with @Dr15Jones and @wddgit concludes that this construct should be safe, even if it is a bit weird.
The only benefit of this construct we could think of is being able to obtain the
CLHEP::HepRandomEngine
on O(1) time instead of O(log n) time.I nevertheless decided to create an issue on this to understand why the cache is needed, and if we are happy with it or not.
The text was updated successfully, but these errors were encountered: