Skip to content

THistSvc: fix or remove buggy regHist interface

While running cppcheck on the Gaudi code base, cppcheck rightfully complained that:

GaudiSvc/src/THistSvc/THistSvc.cpp:344:32: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
  if ( hist_ptr != nullptr ) { hist_ptr = hist.get(); }
                               ^

That's because the interface is missing an &:

/// Register an existing ROOT histogram TH*X with name and moved unique_ptr
/// @param [in] name      defines the histogram id/name under which it is recorded
/// @param [in] hist      transfers ownership of the histogram to the THistSvc
/// @param [out] hist_ptr for compatibility: return raw pointer to managed object to support common usage in Athena
StatusCode regHist( const std::string& name, std::unique_ptr<TH1> hist, TH1* hist_ptr ) override;

Either we have to fix this interface or remove it entirely (I am checking how widely this is used in ATLAS).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information