Skip to content
Snippets Groups Projects

Revert some interface changes of THistSvc

Merged Martin Errenst requested to merge merrenst/Gaudi:THistSvc-180131 into master
All threads resolved!
5 files
+ 66
32
Compare changes
  • Side-by-side
  • Inline
Files
5
  • 98965b7c
    Fix bug in deReg and add test · 98965b7c
    Martin Errenst authored
    The lambda in deReg( TObject* ) tried to access vhid->at(0) after a
    check for vhid->size() == 0. This resulted in a certain crash.
    
    I've reorganized the function to delete the vector of THistIDs when
    vhid->size() is 1 (not 0).
    There is also a new test case that registers and deregisters a single
    histogram.
@@ -87,6 +87,14 @@ StatusCode THistWrite::initialize()
error() << "Couldn't use TempHist6 afterwards. getName = " << h6->GetName() << endmsg;
}
TH1D* h7 = new TH1D( "TempHist7", "Temporary Tree 7", 100, 0., 100. );
if ( m_ths->regHist( "TempHist7", h7 ).isFailure() ) {
error() << "Couldn't register TempHist6" << endmsg;
}
if ( strcmp( h7->GetName(), "TempHist7" ) ) {
error() << "Couldn't use TempHist7 afterwards. getName = " << h7->GetName() << endmsg;
}
// Profile in "/"
std::unique_ptr<TH1> tp = std::make_unique<TProfile>( "profile", "profile", 100, -50., -50. );
if ( m_ths->regHist( "/rec/prof", std::move( tp ) ).isFailure() ) {
@@ -269,5 +277,13 @@ StatusCode THistWrite::finalize()
{
info() << "Finalizing..." << endmsg;
TH1* h7 = nullptr;
if ( m_ths->getHist( "TempHist7", h7 ).isFailure() ) {
error() << "Couldn't retrieve TempHist7" << endmsg;
}
if ( m_ths->deReg( h7 ).isFailure() ){
error() << "Failed to deregister histogram TempHist7" << endmsg;
}
return StatusCode::SUCCESS;
}
Loading