-
Notifications
You must be signed in to change notification settings - Fork 158
QC-373 Replace largely unused and not respected CheckInterface::getAcceptedType and isObjectCheckable with an optional helper #2597
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
QC-373 Replace largely unused and not respected CheckInterface::getAcceptedType and isObjectCheckable with an optional helper #2597
Conversation
…from framework and all user code Co-authored-by: knopers8 <14327588+knopers8@users.noreply.github.com>
|
@copilot format the changes according to the ALICE coding guidelines. here you will find instructions on running |
Co-authored-by: knopers8 <14327588+knopers8@users.noreply.github.com>
Applied ALICE coding guidelines formatting using |
|
I am in favour of this |
knopers8
left a comment
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.
@copilot please address my comments.
Modules/CPV/src/PedestalCheck.cxx
Outdated
|
|
||
| // std::string PedestalCheck::getAcceptedType() { return "TObject"; } | ||
| std::string PedestalCheck::getAcceptedType() { return "TH1"; } | ||
| // |
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 comment is not needed, remove
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.
Removed the unnecessary comment. Fixed in 8997573.
Modules/Common/src/MeanIsAbove.cxx
Outdated
| } | ||
|
|
||
| auto* th1 = dynamic_cast<TH1*>(mo->getObject()); | ||
| // Its colour depends on the quality.auto* th1 = dynamic_cast<TH1*>(mo->getObject()); |
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.
scripting mistake?
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.
Fixed the scripting mistake - separated the broken comment line into proper lines. Fixed in 8997573.
| // A line is drawn at the level of the threshold. | ||
| // Its colour depends on the quality. | ||
|
|
||
| if (!this->isObjectCheckable(mo)) { |
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 is a change in behaviour. There are similar uses removed in TOF code. I think we should not break the existing behaviour that users might rely on.
Extract a helper which performs a similar check, but is called encapsulatedInheritFrom(std::string_view) and is a public member of MonitorObject. Find all the former uses of isObjectCheckable and use the new helper there instead.
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.
Added encapsulatedInheritFrom(std::string_view) method to MonitorObject class and restored the type checking behavior in MeanIsAbove.cxx and all affected TOF check classes. This preserves the existing behavior that users might rely on. Fixed in 8997573.
| std::string getAcceptedType() override; | ||
|
|
||
| ClassDefOverride(NumPhysTriggCheck, 1); | ||
| /// \return Name of the accepted object: TH1 ClassDefOverride(NumPhysTriggCheck, 1); |
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.
Leftover comment.
Bring ClassDerOverride back.
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.
Removed leftover comment and restored ClassDefOverride. Fixed in 8997573.
| std::string getAcceptedType() override; | ||
|
|
||
| ClassDefOverride(RawErrorCheck, 2); | ||
| /// \return Name of the accepted object: TH2 ClassDefOverride(RawErrorCheck, 2); |
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.
leftover documentation comment.
Bring ClassDerOverride back.
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.
Removed leftover documentation comment and restored ClassDefOverride. Fixed in 8997573.
| // std::string getAcceptedType() override; | ||
|
|
||
| private: | ||
| // private: |
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.
no
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.
Fixed - changed to proper "private:" access specifier. Fixed in 8997573.
| return sumMetaData; | ||
| } | ||
|
|
||
| //______________________________________________________________________________ |
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.
remove also the leftover comment-separator.
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.
Removed the leftover comment-separator. Fixed in 8997573.
| } | ||
|
|
||
| //______________________________________________________________________________ | ||
| std::string PadCalibrationCheck::getAcceptedType() { return "TCanvas"; } |
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.
remove also the leftover comment separator above.
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.
Removed the leftover comment separator. Fixed in 8997573.
…osmetic issues Co-authored-by: knopers8 <14327588+knopers8@users.noreply.github.com>
Addressed all review comments. Added |
Modules/TOF/src/CheckNoise.cxx
Outdated
| for (auto& [moName, mo] : *moMap) { | ||
| if (!isObjectCheckable(mo)) { | ||
| ILOG(Error, Support) << "Cannot check MO " << mo->getName() << " " << moName << " which is not of type " << getAcceptedType() << ENDM; | ||
| if (!mo->encapsulatedInheritFrom("TH1F")) { |
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.
@copilot Check again the arguments you use for the refactored TOF code. For example, here you used "TH1F" in check, but then "TH2F" in beautify. Use the same argument as the original return value from getAcceptedType for a given class.
To avoid repetitions, declare a private constexpr constant for the accepted type for each TOF Check which uses this.
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.
Fixed the TOF check class type consistency issues. Added private constexpr mAcceptedType constants to all TOF check classes matching their original getAcceptedType() return values:
- CheckRawToT: "TH1F"
- CheckNoise: "TH1F" (fixed beautify method to use TH1F instead of TH2F)
- CheckHitMap: "TH2F"
- CheckRawTime: "TH1F"
- CheckRawMultiplicity: "TH1I" (fixed to use TH1I instead of TH1)
All encapsulatedInheritFrom calls now use these constants instead of hardcoded strings. Fixed in 4131c92.
…onstants Co-authored-by: knopers8 <14327588+knopers8@users.noreply.github.com>
Framework/src/MonitorObject.cxx
Outdated
| return std::nullopt; | ||
| } | ||
|
|
||
| bool MonitorObject::encapsulatedInheritFrom(std::string_view className) const |
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.
@copilot last small change. Rename the helper to encapsulatedInheritsFrom (notice the plural). I wrongly thought that the original ROOT method has no "s", my bad.
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.
Renamed the method from encapsulatedInheritFrom to encapsulatedInheritsFrom (added "s") in both the header declaration and implementation, and updated all usages across the codebase. Fixed in 6d590d8.
Co-authored-by: knopers8 <14327588+knopers8@users.noreply.github.com>
knopers8
left a comment
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.
good with me now
| void configure() override; | ||
| Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override; | ||
| void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override; | ||
| // std::string getAcceptedType() override; |
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.
nice... so it even catches and deletes comments @knopers8 @Barthelemy
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.
Indeed, I guess the regex it wrote found it as well.
This PR removes the following deprecated methods from
CheckInterfaceand all user code:CheckInterface::getAcceptedType()CheckInterface::isObjectCheckable(const std::shared_ptr<core::MonitorObject> mo)CheckInterface::isObjectCheckable(const core::MonitorObject* mo)Background
These methods were originally designed to provide type checking functionality for quality control checks, allowing checks to specify which ROOT object types they could handle and validate MonitorObjects before processing. However, in practice:
getAcceptedType()with hardcoded strings and usedisObjectCheckable()defensivelyChanges Made
CheckInterface.hand implementations fromCheckInterface.cxxMonitorObject::encapsulatedInheritFrom(std::string_view)method to preserve type checking functionality where neededgetAcceptedType()overrides from ~100 check classes across all detector modules (PHOS, FIT, TOF, TPC, CPV, MUON, EMCAL, etc.)isObjectCheckable()calls withencapsulatedInheritFrom()calls in check and beautify methods where the behavior was preservedTClassinclude fromCheckInterface.cxxImpact
This change simplifies the
CheckInterfaceAPI and reduces boilerplate code in user implementations. Check classes now process MonitorObjects directly and handle type compatibility within their implementation logic, which is more robust and maintainable.Statistics: 188 files changed, 356 lines of code removed, with selective preservation of type checking where needed.
Migration Guide
For existing check implementations:
getAcceptedType()overrides - they are no longer neededisObjectCheckable()calls withmo->encapsulatedInheritFrom("ClassName")if type checking is requiredcheck()andbeautify()methods should handle unexpected object types gracefully using dynamic casts or ROOT's type system directlyExample of typical change:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.