-
Notifications
You must be signed in to change notification settings - Fork 4.6k
DRAFT: Base classes for refactor of CondTools/Hcal PopConAnalyzers and PopConSourceHandlers #49905
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
base: master
Are you sure you want to change the base?
Conversation
|
cms-bot internal usage |
|
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49905/47643 Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
ec938c2 to
7f6fbd2
Compare
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49905/47662 |
|
Pull request #49905 was updated. |
| @@ -1,38 +1,6 @@ | |||
| #ifndef CastorChannelQualityHandler_h | |||
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 are you removing the header guard?
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 included the #pragma once header guard - is it ill-advised in CMSSW?
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.
Uhm, no idea... Probably you are right, even though I wouldn't (personally) modify it in already existing header files
7f6fbd2 to
520e4fa
Compare
|
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49905/47701
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
|
I have a question: Side note: initially I picked |
520e4fa to
77461bc
Compare
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49905/47702 |
|
Pull request #49905 was updated. |
Having an example to look at is certainly preferable (I bet nobody but you will port the new code without such an example to refere at). On the other hand, Castor is some quite old code, and probably nobody is using and maintaining it, iow it is not even know if it still works as expected. I don't know how many files are affected in cmssw? Is that a migration that you can afford doing yourself (for example, in this very same PR), or there are so many files involved, linked to different systems, that would suggest delegating it to the expert in the different areas? In the second case it would take longer, and a github issue should be opened to track it. |
It involves around 40 PopCon Analyzers, so 120 files. I don't think it makes sense to inlude everything in this PR. Also #49556 would depend on these changes so I wouldn't delay merging this. |
PR description:
Reviewing #49556 I found several problems with proposed CondTools/Hcal/plugins/HcalPulseDelaysPopConAnalyzer.cc and many other (~40) PopConAnalyzers in CondTools/Hcal.
This PR introduced a base class for these PopConAnalyzers and corresponding PopConSourceHandlers that fix the problems. As an example
CastorElectronicsMapPopConAnalyzeris refactored using this base class.Note:
initObjectwas renamed toinitPayloadWith
HCalPulseDelaysas example, the problems are:m_sourceandm_populatorresults in 2 separate instances of these fields (e.g.HcalPulseDelaysPopConAnalyzer::m_sourceandPopConAnalyzer::m_source). Its not a proper use of inheritance and is dangerous and error-prone with any future changes (eg. access tom_sourcefrom the basePopConAnalyzerwill access a different instance of the source).write()is a (potentially unecessary) code duplicationmyDBObjectshould not be defined as a raw pointer. RunningHcalPulseDelaysPopConAnalyzer.analyzemutliple times (i.e. for multiple events) would result with a memory leak. It would be much better to useunique_ptrandstd::movewhen callingsource.initObject()to transfer the ownership. AccordinglyinitObject()should take aunique_ptras the parameter to express taking ownership.Problem 3. is easy to fix by changing
myDbObjectand the parameter ofinitObjecttounique_ptr.Because
m_source,m_populator,writeandendJobare private is tricky to fix point 1. and 2. My idea is to movesource.initObject(myDBObject);to.analyze(...). This would allow not to redefinewrite()and usingsource()getter would allow not to redefinem_source.It needs to be confirmed that this would result in the same logic and behaviour. The difference I see is that it would be then run for every event instead of once, in
endJob(). From what I understandHcalPulseDelaysPopConAnalyzer(and otherPopConAnalyzerswith the same pattern) is not meant to be run for multiple events (as multiple execution ofanaylzewould result in a memory leak), thus this change of behaviour resulting from movinginitObjecttoanalyzeis not a problem. If this is not appropriate, let me know and I'll present an alternative solution.PR validation:
Tested by running
dbwriteCastorElectronicsMap_cfg.pymodified for writing to local sqlite and confirming that it wrote a payload to the db.If this PR is a backport please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:
Before submitting your pull requests, make sure you followed this checklist: