[Misc] Apply SonarCloud rule cpp:S7172
SonarCloud rule fix
- Rule name: Use has_value() or another member function to clarify that the code tests the presence of a value in the "optional", not the contained "unsigned long" value itself.
- Rule code: cpp:S7172
- Rule link: https://sonarcloud.io/project/issues?open=AZg_4QwUrKnheRHEMnU8&id=cern-cta_CTA