diff --git a/GaudiExamples/src/THist/THistRead.cpp b/GaudiExamples/src/THist/THistRead.cpp index 2e114c51c1831a43fd548c7bfae080cce376f0d2..cd31f3f7225822c6987fb446a1c19188d68a43b6 100644 --- a/GaudiExamples/src/THist/THistRead.cpp +++ b/GaudiExamples/src/THist/THistRead.cpp @@ -35,7 +35,7 @@ StatusCode THistRead::initialize() // stream read1, 1D in "/xxx" StatusCode sc1a = m_ths->regHist( "/read1/xxx/1Dgauss" ); - TH1* h1; + TH1* h1( nullptr ); StatusCode sc1b = m_ths->getHist( "/read1/xxx/1Dgauss", h1 ); if ( sc1a.isFailure() || sc1b.isFailure() || h1 == nullptr ) { error() << "Couldn't read gauss1d" << endmsg; @@ -45,7 +45,7 @@ StatusCode THistRead::initialize() // stream read2, 2D tree in "/" StatusCode sc2a = m_ths->regHist( "/read2/2Dgauss" ); - TH2* h2; + TH2* h2( nullptr ); StatusCode sc2b = m_ths->getHist( "/read2/2Dgauss", h2 ); if ( sc2a.isFailure() || sc2b.isFailure() || h2 == nullptr ) { error() << "Couldn't read 2Dgauss" << endmsg; @@ -55,7 +55,7 @@ StatusCode THistRead::initialize() // 3D tree in "/" StatusCode sc3a = m_ths->regHist( "/read2/3Dgauss" ); - TH3* h3; + TH3* h3( nullptr ); StatusCode sc3b = m_ths->getHist( "/read2/3Dgauss", h3 ); if ( sc3a.isFailure() || sc3b.isFailure() || h3 == nullptr ) { error() << "Couldn't read 3Dgauss" << endmsg; @@ -65,7 +65,7 @@ StatusCode THistRead::initialize() // Profile in "/" StatusCode sc4a = m_ths->regHist( "/read2/profile" ); - TH1* tp; + TH1* tp( nullptr ); StatusCode sc4b = m_ths->getHist( "/read2/profile", tp ); if ( sc4a.isFailure() || sc4b.isFailure() || tp == nullptr ) { error() << "Couldn't read profile" << endmsg; @@ -75,7 +75,7 @@ StatusCode THistRead::initialize() // Tree with branches in "/trees/stuff" StatusCode sc5a = m_ths->regTree( "/read2/trees/stuff/treename" ); - TTree* tr; + TTree* tr( nullptr ); StatusCode sc5b = m_ths->getTree( "/read2/trees/stuff/treename", tr ); if ( sc5a.isFailure() || sc5b.isFailure() || tr == nullptr ) { error() << "Couldn't read tree" << endmsg; diff --git a/GaudiExamples/src/THist/THistWrite.cpp b/GaudiExamples/src/THist/THistWrite.cpp index 52dc95bbf48d9e13cfbabcd777e1d0fa180643c8..4d9df3cf11f2147fd9821ae226ee8e3bf8306e5c 100644 --- a/GaudiExamples/src/THist/THistWrite.cpp +++ b/GaudiExamples/src/THist/THistWrite.cpp @@ -19,7 +19,7 @@ DECLARE_COMPONENT( THistWrite ) //------------------------------------------------------------------------------ -THistWrite::THistWrite( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ), m_ths( 0 ) +THistWrite::THistWrite( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ), m_ths( nullptr ) //------------------------------------------------------------------------------ { } @@ -100,14 +100,14 @@ StatusCode THistWrite::initialize() // Update to stream "upd", dir "/xxx" std::unique_ptr<TH1F> h3s = std::make_unique<TH1F>( "1Dgauss_shared", "1D Gaussian", 100, -50., 50. ); - LockedHandle<TH1> lh1; + LockedHandle<TH1> lh1( nullptr, nullptr ); if ( m_ths->regShared( "/upd/xxx/gauss1d_shared", std::move( h3s ), lh1 ).isFailure() ) { error() << "Couldn't register gauss1d_shared" << endmsg; } // Recreate 2D tree in "/" std::unique_ptr<TH2F> h3sa = std::make_unique<TH2F>( "2Dgauss_shared", "2D Gaussian", 100, -50., 50., 100, -50, 50 ); - LockedHandle<TH2> lh2; + LockedHandle<TH2> lh2( nullptr, nullptr ); if ( m_ths->regShared( "/rec/gauss2d_shared", std::move( h3sa ), lh2 ).isFailure() ) { error() << "Couldn't register gauss2d_shared" << endmsg; } @@ -115,7 +115,7 @@ StatusCode THistWrite::initialize() // 3D tree in "/" std::unique_ptr<TH3F> h4s = std::make_unique<TH3F>( "3Dgauss_shared", "3D Gaussian", 100, -50., 50., 100, -50, 50, 100, -50, 50 ); - LockedHandle<TH3> lh3; + LockedHandle<TH3> lh3( nullptr, nullptr ); if ( m_ths->regShared( "/rec/gauss3d_shared", std::move( h4s ), lh3 ).isFailure() ) { error() << "Couldn't register gauss3d_shared" << endmsg; } @@ -133,7 +133,7 @@ StatusCode THistWrite::execute() double x = sin( double( n ) ) * 52. + 50.; - TH1* h( 0 ); + TH1* h( nullptr ); if ( m_ths->getHist( "TempHist1", h ).isSuccess() ) { h->Fill( x ); } else { @@ -160,7 +160,7 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 1Dgauss" << endmsg; } - TH2* h2( 0 ); + TH2* h2( nullptr ); if ( m_ths->getHist( "/rec/gauss2d", h2 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { h2->Fill( gauss(), gauss(), 1. ); @@ -169,7 +169,7 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 2Dgauss" << endmsg; } - TH3* h3( 0 ); + TH3* h3( nullptr ); if ( m_ths->getHist( "/rec/gauss3d", h3 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { h3->Fill( gauss(), gauss(), gauss(), 1. ); @@ -190,7 +190,7 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve TempHist 6" << endmsg; } - LockedHandle<TH1> lh1; + LockedHandle<TH1> lh1( nullptr, nullptr ); if ( m_ths->getShared( "/upd/xxx/gauss1d_shared", lh1 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { lh1->Fill( gauss(), 1. ); @@ -199,7 +199,7 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 1Dgauss_shared" << endmsg; } - LockedHandle<TH2> lh2; + LockedHandle<TH2> lh2( nullptr, nullptr ); if ( m_ths->getShared( "/rec/gauss2d_shared", lh2 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { lh2->Fill( gauss(), gauss(), 1. ); @@ -208,7 +208,7 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 2Dgauss_shared" << endmsg; } - LockedHandle<TH3> lh3; + LockedHandle<TH3> lh3( nullptr, nullptr ); if ( m_ths->getShared( "/rec/gauss3d_shared", lh3 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { lh3->Fill( gauss(), gauss(), gauss(), 1. ); @@ -217,7 +217,7 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 3Dgauss_shared" << endmsg; } - TTree* tr; + TTree* tr( nullptr ); if ( m_ths->getTree( "/rec/trees/stuff/tree1", tr ).isFailure() ) { error() << "Couldn't retrieve tree tree1" << endmsg; } else {