diff --git a/GaudiExamples/src/THist/THistRead.cpp b/GaudiExamples/src/THist/THistRead.cpp index d8c436d098ff2ee07078dabc259d923b8d84fcdc..cd31f3f7225822c6987fb446a1c19188d68a43b6 100644 --- a/GaudiExamples/src/THist/THistRead.cpp +++ b/GaudiExamples/src/THist/THistRead.cpp @@ -34,45 +34,50 @@ StatusCode THistRead::initialize() } // stream read1, 1D in "/xxx" - StatusCode sc1 = m_ths->regHist( "/read1/xxx/1Dgauss" ); - TH1* h1 = m_ths->getHistTH1( "/read1/xxx/1Dgauss" ); - if ( sc1.isFailure() || h1 == nullptr ) { + StatusCode sc1a = m_ths->regHist( "/read1/xxx/1Dgauss" ); + 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; } else { info() << h1->GetName() << ": " << h1->GetEntries() << endmsg; } // stream read2, 2D tree in "/" - StatusCode sc2 = m_ths->regHist( "/read2/2Dgauss" ); - TH2* h2 = m_ths->getHistTH2( "/read2/2Dgauss" ); - if ( sc2.isFailure() || h2 == nullptr ) { + StatusCode sc2a = m_ths->regHist( "/read2/2Dgauss" ); + TH2* h2( nullptr ); + StatusCode sc2b = m_ths->getHist( "/read2/2Dgauss", h2 ); + if ( sc2a.isFailure() || sc2b.isFailure() || h2 == nullptr ) { error() << "Couldn't read 2Dgauss" << endmsg; } else { info() << h2->GetName() << ": " << h2->GetEntries() << endmsg; } // 3D tree in "/" - StatusCode sc3 = m_ths->regHist( "/read2/3Dgauss" ); - TH3* h3 = m_ths->getHistTH3( "/read2/3Dgauss" ); - if ( sc3.isFailure() || h3 == nullptr ) { + StatusCode sc3a = m_ths->regHist( "/read2/3Dgauss" ); + TH3* h3( nullptr ); + StatusCode sc3b = m_ths->getHist( "/read2/3Dgauss", h3 ); + if ( sc3a.isFailure() || sc3b.isFailure() || h3 == nullptr ) { error() << "Couldn't read 3Dgauss" << endmsg; } else { info() << h3->GetName() << ": " << h3->GetEntries() << endmsg; } // Profile in "/" - StatusCode sc4 = m_ths->regHist( "/read2/profile" ); - TH1* tp = m_ths->getHistTH1( "/read2/profile" ); - if ( sc4.isFailure() || tp == nullptr ) { + StatusCode sc4a = m_ths->regHist( "/read2/profile" ); + TH1* tp( nullptr ); + StatusCode sc4b = m_ths->getHist( "/read2/profile", tp ); + if ( sc4a.isFailure() || sc4b.isFailure() || tp == nullptr ) { error() << "Couldn't read profile" << endmsg; } else { info() << tp->GetName() << ": " << tp->GetEntries() << endmsg; } // Tree with branches in "/trees/stuff" - StatusCode sc5 = m_ths->regTree( "/read2/trees/stuff/treename" ); - TTree* tr = m_ths->getTree( "/read2/trees/stuff/treename" ); - if ( sc5.isFailure() || tr == nullptr ) { + StatusCode sc5a = m_ths->regTree( "/read2/trees/stuff/treename" ); + 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; } else { info() << tr->GetName() << ": " << tr->GetEntries() << endmsg; diff --git a/GaudiExamples/src/THist/THistWrite.cpp b/GaudiExamples/src/THist/THistWrite.cpp index 781477bd27d6ea7913cea6e9cb8b128cf969dee2..d470316915c21f40b54639f396893169100dbd4a 100644 --- a/GaudiExamples/src/THist/THistWrite.cpp +++ b/GaudiExamples/src/THist/THistWrite.cpp @@ -2,6 +2,7 @@ #include "THistWrite.h" #include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/LockedHandle.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/RndmGenerators.h" #include <math.h> @@ -18,7 +19,8 @@ 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 ) //------------------------------------------------------------------------------ { } @@ -69,6 +71,30 @@ StatusCode THistWrite::initialize() error() << "Couldn't register gauss3d" << endmsg; } + TH1F* h5 = new TH1F( "TempHist5", "Temporary Tree 5", 100, 0., 100. ); + if ( m_ths->regHist( "TempHist5", std::unique_ptr<TH1F>( h5 ) ).isFailure() ) { + error() << "Couldn't register TempHist5" << endmsg; + } + if ( strcmp( h5->GetName(), "TempHist5" ) ) { + error() << "Couldn't use TempHist5 afterwards. getName = " << h5->GetName() << endmsg; + } + + TH1D* h6 = new TH1D( "TempHist6", "Temporary Tree 6", 100, 0., 100. ); + if ( m_ths->regHist( "TempHist6", std::unique_ptr<TH1D>( h6 ), h6 ).isFailure() ) { + error() << "Couldn't register TempHist6" << endmsg; + } + if ( strcmp( h6->GetName(), "TempHist6" ) ) { + 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() ) { @@ -81,6 +107,28 @@ StatusCode THistWrite::initialize() error() << "Couldn't register tr" << endmsg; } + // 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( 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( nullptr, nullptr ); + if ( m_ths->regShared( "/rec/gauss2d_shared", std::move( h3sa ), lh2 ).isFailure() ) { + error() << "Couldn't register gauss2d_shared" << endmsg; + } + + // 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( nullptr, nullptr ); + if ( m_ths->regShared( "/rec/gauss3d_shared", std::move( h4s ), lh3 ).isFailure() ) { + error() << "Couldn't register gauss3d_shared" << endmsg; + } + return StatusCode::SUCCESS; } @@ -94,30 +142,26 @@ StatusCode THistWrite::execute() double x = sin( double( n ) ) * 52. + 50.; - TH1* h( 0 ); - h = m_ths->getHistTH1( "TempHist1" ); - if ( h != nullptr ) { + TH1* h( nullptr ); + if ( m_ths->getHist( "TempHist1", h ).isSuccess() ) { h->Fill( x ); } else { error() << "Couldn't retrieve TempHist 1" << endmsg; } - h = m_ths->getHistTH1( "other/TempHist1a" ); - if ( h != nullptr ) { + if ( m_ths->getHist( "other/TempHist1a", h ).isSuccess() ) { h->Fill( x ); } else { error() << "Couldn't retrieve TempHist 1a" << endmsg; } - h = m_ths->getHistTH1( "/new/Tree2" ); - if ( h != nullptr ) { + if ( m_ths->getHist( "/new/Tree2", h ).isSuccess() ) { h->Fill( x ); } else { error() << "Couldn't retrieve Tree2" << endmsg; } - h = m_ths->getHistTH1( "/upd/xxx/gauss1d" ); - if ( h != nullptr ) { + if ( m_ths->getHist( "/upd/xxx/gauss1d", h ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { h->Fill( gauss(), 1. ); } @@ -125,9 +169,8 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 1Dgauss" << endmsg; } - TH2* h2( 0 ); - h2 = m_ths->getHistTH2( "/rec/gauss2d" ); - if ( h2 != nullptr ) { + TH2* h2( nullptr ); + if ( m_ths->getHist( "/rec/gauss2d", h2 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { h2->Fill( gauss(), gauss(), 1. ); } @@ -135,9 +178,8 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 2Dgauss" << endmsg; } - TH3* h3( 0 ); - h3 = m_ths->getHistTH3( "/rec/gauss3d" ); - if ( h3 != nullptr ) { + TH3* h3( nullptr ); + if ( m_ths->getHist( "/rec/gauss3d", h3 ).isSuccess() ) { for ( int i = 0; i < 1000; ++i ) { h3->Fill( gauss(), gauss(), gauss(), 1. ); } @@ -145,9 +187,47 @@ StatusCode THistWrite::execute() error() << "Couldn't retrieve 3Dgauss" << endmsg; } - TTree* tr; - tr = m_ths->getTree( "/rec/trees/stuff/tree1" ); - if ( tr == nullptr ) { + if ( m_ths->getHist( "TempHist5", h ).isSuccess() ) { + h->Fill( x ); + } else { + error() << "Couldn't retrieve TempHist 5" << endmsg; + } + + if ( m_ths->getHist( "TempHist6", h ).isSuccess() ) { + h->Fill( x ); + } else { + error() << "Couldn't retrieve TempHist 6" << endmsg; + } + + 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. ); + } + } else { + error() << "Couldn't retrieve 1Dgauss_shared" << endmsg; + } + + 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. ); + } + } else { + error() << "Couldn't retrieve 2Dgauss_shared" << endmsg; + } + + 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. ); + } + } else { + error() << "Couldn't retrieve 3Dgauss_shared" << endmsg; + } + + TTree* tr( nullptr ); + if ( m_ths->getTree( "/rec/trees/stuff/tree1", tr ).isFailure() ) { error() << "Couldn't retrieve tree tree1" << endmsg; } else { if ( n == 0 ) { @@ -197,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; } diff --git a/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistread.qmt b/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistread.qmt index 1ebd6809a049e593e0159e43c232af1d600acdf8..09b050c5c0f2dcd088ce2366b37413941bcfe681 100644 --- a/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistread.qmt +++ b/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistread.qmt @@ -8,6 +8,9 @@ </set></argument> <argument name="validator"><text> preprocessor = normalizeExamples + \ + RegexpReplacer(when = "^THistSvc", + orig = r"(stream: (read1|read2) name: tuple[0-9].rt size: )([0-9]*)", + repl = r"\1###") + \ RegexpReplacer(when = "^THistSvc", orig = r"(.+M: )([0-9]+)(.*)", repl = r"\1########\3") + \ diff --git a/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistwrite.qmt b/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistwrite.qmt index 9a607cf1971ee14a9d7e3c3a8a232a0144a48187..72d661f6d12e152ce99d37fbb501e7429f5c4c58 100644 --- a/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistwrite.qmt +++ b/GaudiExamples/tests/qmtest/gaudiexamples.qms/thistwrite.qmt @@ -5,6 +5,9 @@ <argument name="reference"><text>refs/THistWrite.ref</text></argument> <argument name="validator"><text> preprocessor = normalizeExamples + \ + RegexpReplacer(when = "^THistSvc", + orig = r"(stream: (rec|upd) name: tuple[0-9].rt size: )([0-9]*)", + repl = r"\1###") + \ RegexpReplacer(when = "^THistSvc", orig = r"(.+M: )([0-9]+)(.*)", repl = r"\1########\3") + \ @@ -14,7 +17,8 @@ preprocessor = normalizeExamples + \ RegexpReplacer(when = "^ - 0x########.*id: ", orig = r"(.+id: )(\/.*\/.*)( t: )([0,1])( s: )([0,1])( M: )([0-9]+)(.*o: 0x######## )(.*)", repl = r"\1\2\3\4\5\6\7########\9\10") + \ - SortGroupOfLines(r"^ -") + SortGroupOfLines(r"^ -") + \ + SortGroupOfLines(r"^THistSvc\s+DEBUG finalize") validateWithReference(preproc = preprocessor) </text></argument> diff --git a/GaudiExamples/tests/qmtest/refs/THistRead.ref b/GaudiExamples/tests/qmtest/refs/THistRead.ref index 6f5e9a81caa1a2c566017f50e1402798cb9027dd..359074fac7eb1f1ad01c4265e1976b49e9b1d84b 100644 --- a/GaudiExamples/tests/qmtest/refs/THistRead.ref +++ b/GaudiExamples/tests/qmtest/refs/THistRead.ref @@ -1,4 +1,4 @@ -JobOptionsSvc INFO # =======> /home/merrenst/git/Gaudi/GaudiExamples/options/THistRead.opts +JobOptionsSvc INFO # =======> /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistRead.opts JobOptionsSvc INFO # (5,1): AuditorSvc.Auditors = ["ChronoAuditor"] JobOptionsSvc INFO # (12,1): ApplicationMgr.TopAlg = ["THistRead"] JobOptionsSvc INFO # (15,1): MessageSvc.OutputLevel = 3 @@ -12,11 +12,11 @@ JobOptionsSvc INFO # (25,1): THistSvc.Input += ["read2 DATAFILE='tuple3.r JobOptionsSvc INFO # (27,1): THistSvc.PrintAll = 1 JobOptionsSvc INFO # (32,1): ApplicationMgr.EvtMax = 20 JobOptionsSvc INFO # (33,1): ApplicationMgr.EvtSel = "NONE" -JobOptionsSvc INFO Job options successfully read in from /home/merrenst/git/Gaudi/GaudiExamples/options/THistRead.opts +JobOptionsSvc INFO Job options successfully read in from /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistRead.opts ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v29r0) - running on hpadpmt on Wed Oct 4 10:00:39 2017 + Welcome to ApplicationMgr (GaudiCoreSvc v30r1) + running on hpadpmt on Thu Feb 1 09:38:17 2018 ====================================================================================================================================[m ApplicationMgr VERBOSE declared service EvtDataSvc/EventDataSvc[m ApplicationMgr VERBOSE declared service DetDataSvc/DetectorDataSvc[m @@ -41,33 +41,33 @@ THistSvc INFO registered file [tuple2.rt]... [ok][m THistSvc INFO registered file [tuple3.rt]... [ok][m THistSvc DEBUG regHist_i obj: 0 id: /read1/xxx/1Dgauss s: 0[m THistSvc DEBUG Read in TH1F "1Dgauss" from file tuple2.rt[m -TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19984 +TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19982 THistSvc DEBUG Registering TH1F title: "1D Gaussian" id: "/read1/xxx/1Dgauss" dir: tuple2.rt:/xxx file: tuple2.rt[m -THistSvc DEBUG regHist_i THistID: id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bf0b60 TH1F[m +THistSvc DEBUG regHist_i THistID: id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x3015360 TH1F[m THistRead INFO 1Dgauss: 20000[m THistSvc DEBUG regHist_i obj: 0 id: /read2/2Dgauss s: 0[m THistSvc DEBUG Read in TH2F "2Dgauss" from file tuple3.rt[m -TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19978 +TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19974 THistSvc DEBUG Registering TH2F title: "2D Gaussian" id: "/read2/2Dgauss" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bfe830 TH2F[m +THistSvc DEBUG regHist_i THistID: id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x30344a0 TH2F[m THistRead INFO 2Dgauss: 20000[m THistSvc DEBUG regHist_i obj: 0 id: /read2/3Dgauss s: 0[m THistSvc DEBUG Read in TH3F "3Dgauss" from file tuple3.rt[m -TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19944 +TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19947 THistSvc DEBUG Registering TH3F title: "3D Gaussian" id: "/read2/3Dgauss" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bfd2f0 TH3F[m +THistSvc DEBUG regHist_i THistID: id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x3032fa0 TH3F[m THistRead INFO 3Dgauss: 20000[m THistSvc DEBUG regHist_i obj: 0 id: /read2/profile s: 0[m THistSvc DEBUG Read in TProfile "profile" from file tuple3.rt[m TH1.Print Name = profile, Entries= 0, Total sum= 0 THistSvc DEBUG Registering TProfile title: "profile" id: "/read2/profile" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x2c17c60 TProfile[m +THistSvc DEBUG regHist_i THistID: id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x304dbc0 TProfile[m THistRead INFO profile: 0[m THistSvc DEBUG regHist_i obj: 0 id: /read2/trees/stuff/treename s: 0[m THistSvc DEBUG Read in TTree "treename" from file tuple3.rt[m ****************************************************************************** *Tree :treename : tree title * -*Entries : 1000 : Total = 14027 bytes File Size = 2338 * +*Entries : 1000 : Total = 14027 bytes File Size = 2335 * * : : Tree compression factor = 6.63 * ****************************************************************************** *Br 0 :branch1 : point1/I * @@ -83,7 +83,7 @@ THistSvc DEBUG Read in TTree "treename" from file tuple3.rt[m *Baskets : 1 : Basket Size= 32000 bytes Compression= 25.49 * *............................................................................* THistSvc DEBUG Registering TTree title: "tree title" id: "/read2/trees/stuff/treename" dir: tuple3.rt:/trees/stuff file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2c43040 TTree[m +THistSvc DEBUG regHist_i THistID: id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x3078740 TTree[m THistRead INFO treename: 1000[m [93;1mEventLoopMgr WARNING Unable to locate service "EventSelector" [m [93;1mEventLoopMgr WARNING No events will be processed from external input.[m @@ -114,50 +114,50 @@ ApplicationMgr INFO Application Manager Stopped successfully[m EventLoopMgr INFO Histograms converted successfully according to request.[m THistSvc DEBUG dumping THistSvc contents m_hlist: size: 5 - - id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bf0b60 TH1F :: [0x2bd17d0] 1 {[0x2bf0b60]} - - id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bfe830 TH2F :: [0x2c30b40] 1 {[0x2bfe830]} - - id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bfd2f0 TH3F :: [0x2bfcc90] 1 {[0x2bfd2f0]} - - id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x2c17c60 TProfile :: [0x2c17c20] 1 {[0x2c17c60]} - - id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2c43040 TTree :: [0x3eb3120] 1 {[0x2c43040]} + - id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x3015360 TH1F :: [0x2fe0260] 1 {[0x3015360]} + - id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x30344a0 TH2F :: [0x2f38120] 1 {[0x30344a0]} + - id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x3032fa0 TH3F :: [0x304d190] 1 {[0x3032fa0]} + - id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x304dbc0 TProfile :: [0x3032920] 1 {[0x304dbc0]} + - id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x3078740 TTree :: [0x23ef7d0] 1 {[0x3078740]} m_uids: 5 - - /read2/trees/stuff/treename [0x3eb3120] - - /read1/xxx/1Dgauss [0x2bd17d0] - - /read2/2Dgauss [0x2c30b40] - - /read2/3Dgauss [0x2bfcc90] - - /read2/profile [0x2c17c20] + - /read2/trees/stuff/treename [0x23ef7d0] + - /read1/xxx/1Dgauss [0x2fe0260] + - /read2/2Dgauss [0x2f38120] + - /read2/3Dgauss [0x304d190] + - /read2/profile [0x3032920] m_ids: 5 - - trees/stuff/treename [0x3eb3120] - - xxx/1Dgauss [0x2bd17d0] - - profile [0x2c17c20] - - 3Dgauss [0x2bfcc90] - - 2Dgauss [0x2c30b40] + - trees/stuff/treename [0x23ef7d0] + - xxx/1Dgauss [0x2fe0260] + - profile [0x3032920] + - 3Dgauss [0x304d190] + - 2Dgauss [0x2f38120] m_tobjs: 5 - - 0x2c43040 -> id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2c43040 TTree - - 0x2bf0b60 -> id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bf0b60 TH1F - - 0x2c17c60 -> id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x2c17c60 TProfile - - 0x2bfe830 -> id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bfe830 TH2F - - 0x2bfd2f0 -> id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x2bfd2f0 TH3F + - 0x3078740 -> id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x3078740 TTree + - 0x3015360 -> id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x3015360 TH1F + - 0x3032fa0 -> id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x3032fa0 TH3F + - 0x304dbc0 -> id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x304dbc0 TProfile + - 0x30344a0 -> id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x30344a0 TH2F [m THistSvc DEBUG THistSvc::finalize[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT [m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple2.rt"[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple3.rt"[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT [m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple2.rt"[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple3.rt"[m THistSvc INFO Listing contents of ROOT files: [m THistSvc INFO ==> File: tuple2.rt stream: read1[m TFile: name=tuple2.rt, title=, option=READ -TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19984 +TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19982 Title = 1D Gaussian NbinsX= 100, xmin= -50, xmax=50 THistSvc INFO ==> File: tuple3.rt stream: read2[m TFile: name=tuple3.rt, title=, option=READ -TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19978 +TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19974 Title = 2D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50 -TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19944 +TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19947 Title = 3D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50, NbinsZ= 100, zmin= -50, zmax=50 TH1.Print Name = profile, Entries= 0, Total sum= 0 @@ -165,7 +165,7 @@ TH1.Print Name = profile, Entries= 0, Total sum= 0 NbinsX= 100, xmin= -50, xmax=-50 ****************************************************************************** *Tree :treename : tree title * -*Entries : 1000 : Total = 14027 bytes File Size = 2338 * +*Entries : 1000 : Total = 14027 bytes File Size = 2335 * * : : Tree compression factor = 6.63 * ****************************************************************************** *Br 0 :branch1 : point1/I * diff --git a/GaudiExamples/tests/qmtest/refs/THistRead.ref.dbg b/GaudiExamples/tests/qmtest/refs/THistRead.ref.dbg index a44624b6c9651bbf17d4e4ea98b28e1bf54d5449..1b4d43ecf1b8322434b162f84b597488632710fa 100644 --- a/GaudiExamples/tests/qmtest/refs/THistRead.ref.dbg +++ b/GaudiExamples/tests/qmtest/refs/THistRead.ref.dbg @@ -1,4 +1,4 @@ -JobOptionsSvc INFO # =======> /home/merrenst/git/Gaudi/GaudiExamples/options/THistRead.opts +JobOptionsSvc INFO # =======> /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistRead.opts JobOptionsSvc INFO # (5,1): AuditorSvc.Auditors = ["ChronoAuditor"] JobOptionsSvc INFO # (12,1): ApplicationMgr.TopAlg = ["THistRead"] JobOptionsSvc INFO # (15,1): MessageSvc.OutputLevel = 3 @@ -12,11 +12,11 @@ JobOptionsSvc INFO # (25,1): THistSvc.Input += ["read2 DATAFILE='tuple3.r JobOptionsSvc INFO # (27,1): THistSvc.PrintAll = 1 JobOptionsSvc INFO # (32,1): ApplicationMgr.EvtMax = 20 JobOptionsSvc INFO # (33,1): ApplicationMgr.EvtSel = "NONE" -JobOptionsSvc INFO Job options successfully read in from /home/merrenst/git/Gaudi/GaudiExamples/options/THistRead.opts +JobOptionsSvc INFO Job options successfully read in from /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistRead.opts ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v29r0) - running on hpadpmt on Wed Oct 4 13:58:51 2017 + Welcome to ApplicationMgr (GaudiCoreSvc v30r1) + running on hpadpmt on Thu Feb 1 09:56:58 2018 ====================================================================================================================================[m ApplicationMgr VERBOSE declareMultiSvcType: declared service EvtDataSvc/EventDataSvc[m ApplicationMgr VERBOSE declareMultiSvcType: declared service DetDataSvc/DetectorDataSvc[m @@ -41,33 +41,33 @@ THistSvc INFO registered file [tuple2.rt]... [ok][m THistSvc INFO registered file [tuple3.rt]... [ok][m THistSvc DEBUG regHist_i obj: 0 id: /read1/xxx/1Dgauss s: 0[m THistSvc DEBUG Read in TH1F "1Dgauss" from file tuple2.rt[m -TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19984 +TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19982 THistSvc DEBUG Registering TH1F title: "1D Gaussian" id: "/read1/xxx/1Dgauss" dir: tuple2.rt:/xxx file: tuple2.rt[m -THistSvc DEBUG regHist_i THistID: id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d1e9e0 TH1F[m +THistSvc DEBUG regHist_i THistID: id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21cf200 TH1F[m THistRead INFO 1Dgauss: 20000[m THistSvc DEBUG regHist_i obj: 0 id: /read2/2Dgauss s: 0[m THistSvc DEBUG Read in TH2F "2Dgauss" from file tuple3.rt[m -TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19978 +TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19974 THistSvc DEBUG Registering TH2F title: "2D Gaussian" id: "/read2/2Dgauss" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d266b0 TH2F[m +THistSvc DEBUG regHist_i THistID: id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21ec5e0 TH2F[m THistRead INFO 2Dgauss: 20000[m THistSvc DEBUG regHist_i obj: 0 id: /read2/3Dgauss s: 0[m THistSvc DEBUG Read in TH3F "3Dgauss" from file tuple3.rt[m -TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19944 +TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19947 THistSvc DEBUG Registering TH3F title: "3D Gaussian" id: "/read2/3Dgauss" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d25170 TH3F[m +THistSvc DEBUG regHist_i THistID: id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21eb0e0 TH3F[m THistRead INFO 3Dgauss: 20000[m THistSvc DEBUG regHist_i obj: 0 id: /read2/profile s: 0[m THistSvc DEBUG Read in TProfile "profile" from file tuple3.rt[m TH1.Print Name = profile, Entries= 0, Total sum= 0 THistSvc DEBUG Registering TProfile title: "profile" id: "/read2/profile" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x1d3e780 TProfile[m +THistSvc DEBUG regHist_i THistID: id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x22059a0 TProfile[m THistRead INFO profile: 0[m THistSvc DEBUG regHist_i obj: 0 id: /read2/trees/stuff/treename s: 0[m THistSvc DEBUG Read in TTree "treename" from file tuple3.rt[m ****************************************************************************** *Tree :treename : tree title * -*Entries : 1000 : Total = 14027 bytes File Size = 2338 * +*Entries : 1000 : Total = 14027 bytes File Size = 2335 * * : : Tree compression factor = 6.63 * ****************************************************************************** *Br 0 :branch1 : point1/I * @@ -83,7 +83,7 @@ THistSvc DEBUG Read in TTree "treename" from file tuple3.rt[m *Baskets : 1 : Basket Size= 32000 bytes Compression= 25.49 * *............................................................................* THistSvc DEBUG Registering TTree title: "tree title" id: "/read2/trees/stuff/treename" dir: tuple3.rt:/trees/stuff file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x1d69b60 TTree[m +THistSvc DEBUG regHist_i THistID: id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2230a00 TTree[m THistRead INFO treename: 1000[m [93;1mEventLoopMgr WARNING Unable to locate service "EventSelector" [m [93;1mEventLoopMgr WARNING No events will be processed from external input.[m @@ -91,120 +91,120 @@ THistRead INFO treename: 1000[m ApplicationMgr INFO Application Manager Initialized successfully[m ApplicationMgr INFO Application Manager Started successfully[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG stream: read1 name: tuple2.rt size: 48491[m -THistSvc DEBUG stream: read2 name: tuple3.rt size: 88966[m +THistSvc DEBUG stream: read1 name: tuple2.rt size: 6063[m +THistSvc DEBUG stream: read2 name: tuple3.rt size: 167837[m ApplicationMgr INFO Application Manager Stopped successfully[m EventLoopMgr INFO Histograms converted successfully according to request.[m THistSvc DEBUG dumping THistSvc contents m_hlist: size: 5 - - id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d1e9e0 TH1F :: [0x1cf48a0] 1 {[0x1d1e9e0]} - - id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d266b0 TH2F :: [0x1d57660] 1 {[0x1d266b0]} - - id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d25170 TH3F :: [0x1d24b10] 1 {[0x1d25170]} - - id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x1d3e780 TProfile :: [0x1d3e740] 1 {[0x1d3e780]} - - id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x1d69b60 TTree :: [0x2fd9c40] 1 {[0x1d69b60]} + - id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21cf200 TH1F :: [0x21996f0] 1 {[0x21cf200]} + - id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21ec5e0 TH2F :: [0x2195ee0] 1 {[0x21ec5e0]} + - id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21eb0e0 TH3F :: [0x21f8d70] 1 {[0x21eb0e0]} + - id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x22059a0 TProfile :: [0x21d50e0] 1 {[0x22059a0]} + - id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2230a00 TTree :: [0x2e30f80] 1 {[0x2230a00]} m_uids: 5 - - /read2/trees/stuff/treename [0x2fd9c40] - - /read1/xxx/1Dgauss [0x1cf48a0] - - /read2/2Dgauss [0x1d57660] - - /read2/3Dgauss [0x1d24b10] - - /read2/profile [0x1d3e740] + - /read2/trees/stuff/treename [0x2e30f80] + - /read1/xxx/1Dgauss [0x21996f0] + - /read2/2Dgauss [0x2195ee0] + - /read2/3Dgauss [0x21f8d70] + - /read2/profile [0x21d50e0] m_ids: 5 - - trees/stuff/treename [0x2fd9c40] - - xxx/1Dgauss [0x1cf48a0] - - profile [0x1d3e740] - - 3Dgauss [0x1d24b10] - - 2Dgauss [0x1d57660] + - trees/stuff/treename [0x2e30f80] + - xxx/1Dgauss [0x21996f0] + - profile [0x21d50e0] + - 3Dgauss [0x21f8d70] + - 2Dgauss [0x2195ee0] m_tobjs: 5 - - 0x1d1e9e0 -> id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d1e9e0 TH1F - - 0x1d266b0 -> id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d266b0 TH2F - - 0x1d69b60 -> id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x1d69b60 TTree - - 0x1d25170 -> id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d25170 TH3F - - 0x1d3e780 -> id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x1d3e780 TProfile + - 0x2230a00 -> id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2230a00 TTree + - 0x21cf200 -> id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21cf200 TH1F + - 0x21eb0e0 -> id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21eb0e0 TH3F + - 0x21ec5e0 -> id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21ec5e0 TH2F + - 0x22059a0 -> id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x22059a0 TProfile [m THistSvc DEBUG THistSvc::finalize[m -THistSvc DEBUG finalize: id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x1d69b60 TTree[m -THistSvc DEBUG finalize: id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d1e9e0 TH1F[m -THistSvc DEBUG finalize: id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d266b0 TH2F[m -THistSvc DEBUG finalize: id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x1d25170 TH3F[m -THistSvc DEBUG finalize: id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x1d3e780 TProfile[m -THistSvc DEBUG updateFiles()[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT [m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple2.rt"[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple3.rt"[m +THistSvc DEBUG finalize: id: /read2/trees/stuff/treename t: 0 s: 0 M: 0 m: 0 o: 0x2230a00 TTree[m +THistSvc DEBUG finalize: id: /read1/xxx/1Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21cf200 TH1F[m +THistSvc DEBUG finalize: id: /read2/2Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21ec5e0 TH2F[m +THistSvc DEBUG finalize: id: /read2/3Dgauss t: 0 s: 0 M: 0 m: 0 o: 0x21eb0e0 TH3F[m +THistSvc DEBUG finalize: id: /read2/profile t: 0 s: 0 M: 0 m: 0 o: 0x22059a0 TProfile[m +THistSvc DEBUG updateFiles()[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT [m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple2.rt"[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple3.rt"[m THistSvc INFO Listing contents of ROOT files: [m THistSvc DEBUG finalizing stream/file read1:tuple2.rt[m THistSvc INFO ==> File: tuple2.rt stream: read1[m TFile: name=tuple2.rt, title=, option=READ -TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19984 +TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19982 Title = 1D Gaussian NbinsX= 100, xmin= -50, xmax=50 THistSvc DEBUG finalizing stream/file read2:tuple3.rt[m THistSvc INFO ==> File: tuple3.rt stream: read2[m TFile: name=tuple3.rt, title=, option=READ -TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19978 +TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19974 Title = 2D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50 -TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19944 +TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19947 Title = 3D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50, NbinsZ= 100, zmin= -50, zmax=50 TH1.Print Name = profile, Entries= 0, Total sum= 0 @@ -212,7 +212,7 @@ TH1.Print Name = profile, Entries= 0, Total sum= 0 NbinsX= 100, xmin= -50, xmax=-50 ****************************************************************************** *Tree :treename : tree title * -*Entries : 1000 : Total = 14027 bytes File Size = 2338 * +*Entries : 1000 : Total = 14027 bytes File Size = 2335 * * : : Tree compression factor = 6.63 * ****************************************************************************** *Br 0 :branch1 : point1/I * diff --git a/GaudiExamples/tests/qmtest/refs/THistWrite.ref b/GaudiExamples/tests/qmtest/refs/THistWrite.ref index f457fe50491824a578a94eb870cbbf2f8891d15c..29e4f1a1b7b3f0c1bf90138a904c04bf47a9def3 100644 --- a/GaudiExamples/tests/qmtest/refs/THistWrite.ref +++ b/GaudiExamples/tests/qmtest/refs/THistWrite.ref @@ -1,4 +1,4 @@ -JobOptionsSvc INFO # =======> /home/merrenst/git/Gaudi/GaudiExamples/options/THistWrite.opts +JobOptionsSvc INFO # =======> /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistWrite.opts JobOptionsSvc INFO # (5,1): AuditorSvc.Auditors = ["ChronoAuditor"] JobOptionsSvc INFO # (12,1): ApplicationMgr.TopAlg = ["THistWrite"] JobOptionsSvc INFO # (15,1): MessageSvc.OutputLevel = 3 @@ -12,11 +12,11 @@ JobOptionsSvc INFO # (26,1): THistSvc.Output += ["rec DATAFILE='tuple3.rt JobOptionsSvc INFO # (28,1): THistSvc.PrintAll = 1 JobOptionsSvc INFO # (33,1): ApplicationMgr.EvtMax = 20 JobOptionsSvc INFO # (34,1): ApplicationMgr.EvtSel = "NONE" -JobOptionsSvc INFO Job options successfully read in from /home/merrenst/git/Gaudi/GaudiExamples/options/THistWrite.opts +JobOptionsSvc INFO Job options successfully read in from /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistWrite.opts ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v29r0) - running on hpadpmt on Wed Oct 4 10:00:38 2017 + Welcome to ApplicationMgr (GaudiCoreSvc v30r1) + running on hpadpmt on Thu Feb 1 09:38:16 2018 ====================================================================================================================================[m ApplicationMgr VERBOSE declared service EvtDataSvc/EventDataSvc[m ApplicationMgr VERBOSE declared service DetDataSvc/DetectorDataSvc[m @@ -38,34 +38,55 @@ THistSvc DEBUG Opening TFile "tuple2.rt" stream: "upd" mode: "A" co THistSvc DEBUG Opening TFile "tuple3.rt" stream: "rec" mode: "R" comp level: 1[m THistSvc INFO registered file [tuple3.rt]... [ok][m THistSvc INFO registered file [tuple2.rt]... [ok][m -THistSvc DEBUG regHist_i obj: 0x21ff690 id: TempHist1 s: 0[m +THistSvc DEBUG regHist_i obj: 0x31cb2c0 id: TempHist1 s: 0[m THistSvc DEBUG Historgram with id "TempHist1" is temporary[m THistSvc DEBUG Registering TH1F title: "Temporary Tree 1" id: "/temp/TempHist1" dir: root:/ file: none[m -THistSvc DEBUG regHist_i THistID: id: /temp/TempHist1 t: 1 s: 0 M: 35564512 m: 0 o: 0x21ff690 TH1F[m -THistSvc DEBUG regHist_i obj: 0x21fff40 id: other/TempHist1a s: 0[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist1 t: 1 s: 0 M: 52216688 m: 0 o: 0x31cb2c0 TH1F[m +THistSvc DEBUG regHist_i obj: 0x31d26f0 id: other/TempHist1a s: 0[m THistSvc DEBUG Historgram with id "other/TempHist1a" is temporary[m THistSvc DEBUG Registering TH1F title: "Temporary Tree 1a" id: "/temp/other/TempHist1a" dir: root:/other file: none[m -THistSvc DEBUG regHist_i THistID: id: /temp/other/TempHist1a t: 1 s: 0 M: 35564512 m: 0 o: 0x21fff40 TH1F[m -THistSvc DEBUG regHist_i obj: 0x22019b0 id: /new/Tree2 s: 0[m +THistSvc DEBUG regHist_i THistID: id: /temp/other/TempHist1a t: 1 s: 0 M: 52216688 m: 0 o: 0x31d26f0 TH1F[m +THistSvc DEBUG regHist_i obj: 0x31d4190 id: /new/Tree2 s: 0[m [93;1mTHistSvc WARNING no stream "new" associated with id: "/new/Tree2"[m THistSvc DEBUG Historgram with id "/new/Tree2" is temporary[m THistSvc DEBUG Registering TH1F title: "Tree 2" id: "/new/Tree2" dir: root:/ file: none[m -THistSvc DEBUG regHist_i THistID: id: /new/Tree2 t: 1 s: 0 M: 35564512 m: 0 o: 0x22019b0 TH1F[m -THistSvc DEBUG regHist_i obj: 0x2201f40 id: /upd/xxx/gauss1d s: 0[m +THistSvc DEBUG regHist_i THistID: id: /new/Tree2 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d4190 TH1F[m +THistSvc DEBUG regHist_i obj: 0x31d4720 id: /upd/xxx/gauss1d s: 0[m THistSvc DEBUG Registering TH1F title: "1D Gaussian" id: "/upd/xxx/gauss1d" dir: tuple2.rt:/xxx file: tuple2.rt[m -THistSvc DEBUG regHist_i THistID: id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2201f40 TH1F[m -THistSvc DEBUG regHist_i obj: 0x2205070 id: /rec/gauss2d s: 0[m +THistSvc DEBUG regHist_i THistID: id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x31d4720 TH1F[m +THistSvc DEBUG regHist_i obj: 0x31d76b0 id: /rec/gauss2d s: 0[m THistSvc DEBUG Registering TH2F title: "2D Gaussian" id: "/rec/gauss2d" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2205070 TH2F[m -THistSvc DEBUG regHist_i obj: 0x2205c40 id: /rec/gauss3d s: 0[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x31d76b0 TH2F[m +THistSvc DEBUG regHist_i obj: 0x31d8210 id: /rec/gauss3d s: 0[m THistSvc DEBUG Registering TH3F title: "3D Gaussian" id: "/rec/gauss3d" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2205c40 TH3F[m -THistSvc DEBUG regHist_i obj: 0x2206740 id: /rec/prof s: 0[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x31d8210 TH3F[m +THistSvc DEBUG regHist_i obj: 0x31d8e20 id: TempHist5 s: 0[m +THistSvc DEBUG Historgram with id "TempHist5" is temporary[m +THistSvc DEBUG Registering TH1F title: "Temporary Tree 5" id: "/temp/TempHist5" dir: root:/ file: none[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist5 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d8e20 TH1F[m +THistSvc DEBUG regHist_i obj: 0x31d9a70 id: TempHist6 s: 0[m +THistSvc DEBUG Historgram with id "TempHist6" is temporary[m +THistSvc DEBUG Registering TH1D title: "Temporary Tree 6" id: "/temp/TempHist6" dir: root:/ file: none[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist6 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d9a70 TH1D[m +THistSvc DEBUG regHist_i obj: 0x1aeb690 id: TempHist7 s: 0[m +THistSvc DEBUG Historgram with id "TempHist7" is temporary[m +THistSvc DEBUG Registering TH1D title: "Temporary Tree 7" id: "/temp/TempHist7" dir: root:/ file: none[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist7 t: 1 s: 0 M: 27169504 m: 0 o: 0x1aeb690 TH1D[m +THistSvc DEBUG regHist_i obj: 0x31da3c0 id: /rec/prof s: 0[m THistSvc DEBUG Registering TProfile title: "profile" id: "/rec/prof" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2206740 TProfile[m -THistSvc DEBUG regHist_i obj: 0x22443d0 id: /rec/trees/stuff/tree1 s: 0[m +THistSvc DEBUG regHist_i THistID: id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x31da3c0 TProfile[m +THistSvc DEBUG regHist_i obj: 0x321a710 id: /rec/trees/stuff/tree1 s: 0[m THistSvc DEBUG Registering TTree title: "tree title" id: "/rec/trees/stuff/tree1" dir: tuple3.rt:/trees/stuff file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x22443d0 TTree[m +THistSvc DEBUG regHist_i THistID: id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x321a710 TTree[m +THistSvc DEBUG regHist_i obj: 0x3289e50 id: /upd/xxx/gauss1d_shared s: 1[m +THistSvc DEBUG Registering shared TH1F title: "1D Gaussian" id: "/upd/xxx/gauss1d_shared" dir: tuple2.rt:/xxx file: tuple2.rt[m +THistSvc DEBUG regHist_i THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG regHist_i obj: 0x328a780 id: /rec/gauss2d_shared s: 1[m +THistSvc DEBUG Registering shared TH2F title: "2D Gaussian" id: "/rec/gauss2d_shared" dir: tuple3.rt:/ file: tuple3.rt[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG regHist_i obj: 0x32950f0 id: /rec/gauss3d_shared s: 1[m +THistSvc DEBUG Registering shared TH3F title: "3D Gaussian" id: "/rec/gauss3d_shared" dir: tuple3.rt:/ file: tuple3.rt[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m [93;1mEventLoopMgr WARNING Unable to locate service "EventSelector" [m [93;1mEventLoopMgr WARNING No events will be processed from external input.[m [93;1mHistogramPersis...WARNING Histograms saving not required.[m @@ -74,82 +95,163 @@ ApplicationMgr INFO Application Manager Started successfully[m RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine[m RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3[m RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine>[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F[m THistSvc DEBUG updateFiles()[m ApplicationMgr INFO Application Manager Stopped successfully[m THistWrite INFO Finalizing...[m +THistSvc DEBUG vhid for /temp/TempHist7 is empty. deleting[m EventLoopMgr INFO Histograms converted successfully according to request.[m THistSvc DEBUG dumping THistSvc contents -m_hlist: size: 8 - - id: /temp/TempHist1 t: 1 s: 0 M: 35564512 m: 0 o: 0x21ff690 TH1F :: [0x21c0b80] 1 {[0x21ff690]} - - id: /temp/other/TempHist1a t: 1 s: 0 M: 35564512 m: 0 o: 0x21fff40 TH1F :: [0x1e38d40] 1 {[0x21fff40]} - - id: /new/Tree2 t: 1 s: 0 M: 35564512 m: 0 o: 0x22019b0 TH1F :: [0x2158490] 1 {[0x22019b0]} - - id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2201f40 TH1F :: [0x2157670] 1 {[0x2201f40]} - - id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2205070 TH2F :: [0x21de400] 1 {[0x2205070]} - - id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2205c40 TH3F :: [0x21e69a0] 1 {[0x2205c40]} - - id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2206740 TProfile :: [0x20e38a0] 1 {[0x2206740]} - - id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x22443d0 TTree :: [0x211ea70] 1 {[0x22443d0]} +m_hlist: size: 13 + - id: /temp/TempHist1 t: 1 s: 0 M: 52216688 m: 0 o: 0x31cb2c0 TH1F :: [0x30fed90] 1 {[0x31cb2c0]} + - id: /temp/other/TempHist1a t: 1 s: 0 M: 52216688 m: 0 o: 0x31d26f0 TH1F :: [0x30763d0] 1 {[0x31d26f0]} + - id: /new/Tree2 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d4190 TH1F :: [0x30072f0] 1 {[0x31d4190]} + - id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x31d4720 TH1F :: [0x31c8d80] 1 {[0x31d4720]} + - id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x31d76b0 TH2F :: [0x30fe2b0] 1 {[0x31d76b0]} + - id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x31d8210 TH3F :: [0x3106740] 1 {[0x31d8210]} + - id: /temp/TempHist5 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d8e20 TH1F :: [0x30901a0] 1 {[0x31d8e20]} + - id: /temp/TempHist6 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d9a70 TH1D :: [0x31cf810] 1 {[0x31d9a70]} + - id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x31da3c0 TProfile :: [0x2fff990] 1 {[0x31da3c0]} + - id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x321a710 TTree :: [0x30c9e60] 1 {[0x321a710]} + - id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F :: [0x305d6e0] 1 {[0x3289e50]} + - id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F :: [0x3283e70] 1 {[0x328a780]} + - id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F :: [0x3108c60] 1 {[0x32950f0]} -m_uids: 8 - - /rec/gauss3d [0x21e69a0] - - /rec/gauss2d [0x21de400] - - /temp/TempHist1 [0x21c0b80] - - /temp/other/TempHist1a [0x1e38d40] - - /rec/trees/stuff/tree1 [0x211ea70] - - /rec/prof [0x20e38a0] - - /new/Tree2 [0x2158490] - - /upd/xxx/gauss1d [0x2157670] +m_uids: 13 + - /rec/gauss2d_shared [0x3283e70] + - /upd/xxx/gauss1d_shared [0x305d6e0] + - /rec/gauss3d_shared [0x3108c60] + - /upd/xxx/gauss1d [0x31c8d80] + - /rec/prof [0x2fff990] + - /temp/TempHist5 [0x30901a0] + - /rec/trees/stuff/tree1 [0x30c9e60] + - /temp/other/TempHist1a [0x30763d0] + - /temp/TempHist1 [0x30fed90] + - /new/Tree2 [0x30072f0] + - /rec/gauss2d [0x30fe2b0] + - /rec/gauss3d [0x3106740] + - /temp/TempHist6 [0x31cf810] -m_ids: 8 - - trees/stuff/tree1 [0x211ea70] - - prof [0x20e38a0] - - gauss3d [0x21e69a0] - - gauss2d [0x21de400] - - xxx/gauss1d [0x2157670] - - TempHist1 [0x21c0b80] - - other/TempHist1a [0x1e38d40] - - Tree2 [0x2158490] +m_ids: 13 + - gauss3d_shared [0x3108c60] + - gauss2d_shared [0x3283e70] + - Tree2 [0x30072f0] + - xxx/gauss1d [0x31c8d80] + - xxx/gauss1d_shared [0x305d6e0] + - TempHist1 [0x30fed90] + - other/TempHist1a [0x30763d0] + - gauss2d [0x30fe2b0] + - gauss3d [0x3106740] + - TempHist5 [0x30901a0] + - TempHist6 [0x31cf810] + - prof [0x2fff990] + - trees/stuff/tree1 [0x30c9e60] -m_tobjs: 8 - - 0x22443d0 -> id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x22443d0 TTree - - 0x2206740 -> id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2206740 TProfile - - 0x2205c40 -> id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2205c40 TH3F - - 0x2205070 -> id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2205070 TH2F - - 0x21ff690 -> id: /temp/TempHist1 t: 1 s: 0 M: 35564512 m: 0 o: 0x21ff690 TH1F - - 0x21fff40 -> id: /temp/other/TempHist1a t: 1 s: 0 M: 35564512 m: 0 o: 0x21fff40 TH1F - - 0x22019b0 -> id: /new/Tree2 t: 1 s: 0 M: 35564512 m: 0 o: 0x22019b0 TH1F - - 0x2201f40 -> id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2201f40 TH1F +m_tobjs: 13 + - 0x32950f0 -> id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x3295550 o: 0x32950f0 TH3F + - 0x3289e50 -> id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x3220300 o: 0x3289e50 TH1F + - 0x31d26f0 -> id: /temp/other/TempHist1a t: 1 s: 0 M: 52216688 m: 0 o: 0x31d26f0 TH1F + - 0x31cb2c0 -> id: /temp/TempHist1 t: 1 s: 0 M: 52216688 m: 0 o: 0x31cb2c0 TH1F + - 0x321a710 -> id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x321a710 TTree + - 0x31d76b0 -> id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x31d76b0 TH2F + - 0x31d9a70 -> id: /temp/TempHist6 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d9a70 TH1D + - 0x31d4190 -> id: /new/Tree2 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d4190 TH1F + - 0x328a780 -> id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x3294ec0 o: 0x328a780 TH2F + - 0x31d4720 -> id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x31d4720 TH1F + - 0x31d8210 -> id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x31d8210 TH3F + - 0x31da3c0 -> id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x31da3c0 TProfile + - 0x31d8e20 -> id: /temp/TempHist5 t: 1 s: 0 M: 52216688 m: 0 o: 0x31d8e20 TH1F [m THistSvc DEBUG THistSvc::finalize[m THistSvc DEBUG updateFiles()[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT [m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple2.rt"[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple3.rt"[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT [m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple2.rt"[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple3.rt"[m THistSvc INFO Listing contents of ROOT files: [m THistSvc INFO ==> File: tuple3.rt stream: rec[m TFile: name=tuple3.rt, title=, option=CREATE -TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19978 +TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19974 Title = 2D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50 -TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19944 +TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19947 Title = 3D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50, NbinsZ= 100, zmin= -50, zmax=50 TH1.Print Name = profile, Entries= 0, Total sum= 0 @@ -157,7 +259,7 @@ TH1.Print Name = profile, Entries= 0, Total sum= 0 NbinsX= 100, xmin= -50, xmax=-50 ****************************************************************************** *Tree :treename : tree title * -*Entries : 1000 : Total = 14051 bytes File Size = 2338 * +*Entries : 1000 : Total = 14051 bytes File Size = 2335 * * : : Tree compression factor = 6.63 * ****************************************************************************** *Br 0 :branch1 : point1/I * @@ -172,9 +274,18 @@ TH1.Print Name = profile, Entries= 0, Total sum= 0 *Entries : 1000 : Total Size= 4565 bytes File Size = 160 * *Baskets : 1 : Basket Size= 32000 bytes Compression= 25.49 * *............................................................................* +TH1.Print Name = 2Dgauss_shared, Entries= 20000, Total sum= 19957 + Title = 2D Gaussian + NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50 +TH1.Print Name = 3Dgauss_shared, Entries= 20000, Total sum= 19949 + Title = 3D Gaussian + NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50, NbinsZ= 100, zmin= -50, zmax=50 THistSvc INFO ==> File: tuple2.rt stream: upd[m TFile: name=tuple2.rt, title=, option=UPDATE -TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19984 +TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19982 + Title = 1D Gaussian + NbinsX= 100, xmin= -50, xmax=50 +TH1.Print Name = 1Dgauss_shared, Entries= 20000, Total sum= 19984 Title = 1D Gaussian NbinsX= 100, xmin= -50, xmax=50 ApplicationMgr INFO Application Manager Finalized successfully[m diff --git a/GaudiExamples/tests/qmtest/refs/THistWrite.ref.dbg b/GaudiExamples/tests/qmtest/refs/THistWrite.ref.dbg index 05360bff4a611752d004c83a3f48f23e11f8cd86..2cad1967620df7bfbc8d1c35b98a4adfa5ba88c0 100644 --- a/GaudiExamples/tests/qmtest/refs/THistWrite.ref.dbg +++ b/GaudiExamples/tests/qmtest/refs/THistWrite.ref.dbg @@ -1,4 +1,4 @@ -JobOptionsSvc INFO # =======> /home/merrenst/git/Gaudi/GaudiExamples/options/THistWrite.opts +JobOptionsSvc INFO # =======> /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistWrite.opts JobOptionsSvc INFO # (5,1): AuditorSvc.Auditors = ["ChronoAuditor"] JobOptionsSvc INFO # (12,1): ApplicationMgr.TopAlg = ["THistWrite"] JobOptionsSvc INFO # (15,1): MessageSvc.OutputLevel = 3 @@ -12,11 +12,11 @@ JobOptionsSvc INFO # (26,1): THistSvc.Output += ["rec DATAFILE='tuple3.rt JobOptionsSvc INFO # (28,1): THistSvc.PrintAll = 1 JobOptionsSvc INFO # (33,1): ApplicationMgr.EvtMax = 20 JobOptionsSvc INFO # (34,1): ApplicationMgr.EvtSel = "NONE" -JobOptionsSvc INFO Job options successfully read in from /home/merrenst/git/Gaudi/GaudiExamples/options/THistWrite.opts +JobOptionsSvc INFO Job options successfully read in from /home/merrenst/athena_thistsvc_migration/Gaudi/GaudiExamples/options/THistWrite.opts ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v29r0) - running on hpadpmt on Wed Oct 4 13:58:48 2017 + Welcome to ApplicationMgr (GaudiCoreSvc v30r1) + running on hpadpmt on Thu Feb 1 09:56:56 2018 ====================================================================================================================================[m ApplicationMgr VERBOSE declareMultiSvcType: declared service EvtDataSvc/EventDataSvc[m ApplicationMgr VERBOSE declareMultiSvcType: declared service DetDataSvc/DetectorDataSvc[m @@ -38,34 +38,55 @@ THistSvc DEBUG Opening TFile "tuple2.rt" stream: "upd" mode: "A" co THistSvc DEBUG Opening TFile "tuple3.rt" stream: "rec" mode: "R" comp level: 1[m THistSvc INFO registered file [tuple3.rt]... [ok][m THistSvc INFO registered file [tuple2.rt]... [ok][m -THistSvc DEBUG regHist_i obj: 0x2a5ba40 id: TempHist1 s: 0[m +THistSvc DEBUG regHist_i obj: 0x2d8bc50 id: TempHist1 s: 0[m THistSvc DEBUG Historgram with id "TempHist1" is temporary[m THistSvc DEBUG Registering TH1F title: "Temporary Tree 1" id: "/temp/TempHist1" dir: root:/ file: none[m -THistSvc DEBUG regHist_i THistID: id: /temp/TempHist1 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5ba40 TH1F[m -THistSvc DEBUG regHist_i obj: 0x2a5c2d0 id: other/TempHist1a s: 0[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist1 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d8bc50 TH1F[m +THistSvc DEBUG regHist_i obj: 0x2d93020 id: other/TempHist1a s: 0[m THistSvc DEBUG Historgram with id "other/TempHist1a" is temporary[m THistSvc DEBUG Registering TH1F title: "Temporary Tree 1a" id: "/temp/other/TempHist1a" dir: root:/other file: none[m -THistSvc DEBUG regHist_i THistID: id: /temp/other/TempHist1a t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5c2d0 TH1F[m -THistSvc DEBUG regHist_i obj: 0x2a5dd40 id: /new/Tree2 s: 0[m +THistSvc DEBUG regHist_i THistID: id: /temp/other/TempHist1a t: 1 s: 0 M: 47762608 m: 0 o: 0x2d93020 TH1F[m +THistSvc DEBUG regHist_i obj: 0x2d947a0 id: /new/Tree2 s: 0[m [93;1mTHistSvc WARNING no stream "new" associated with id: "/new/Tree2"[m THistSvc DEBUG Historgram with id "/new/Tree2" is temporary[m THistSvc DEBUG Registering TH1F title: "Tree 2" id: "/new/Tree2" dir: root:/ file: none[m -THistSvc DEBUG regHist_i THistID: id: /new/Tree2 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5dd40 TH1F[m -THistSvc DEBUG regHist_i obj: 0x2a5e2d0 id: /upd/xxx/gauss1d s: 0[m +THistSvc DEBUG regHist_i THistID: id: /new/Tree2 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d947a0 TH1F[m +THistSvc DEBUG regHist_i obj: 0x2d94f90 id: /upd/xxx/gauss1d s: 0[m THistSvc DEBUG Registering TH1F title: "1D Gaussian" id: "/upd/xxx/gauss1d" dir: tuple2.rt:/xxx file: tuple2.rt[m -THistSvc DEBUG regHist_i THistID: id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2a5e2d0 TH1F[m -THistSvc DEBUG regHist_i obj: 0x2a6dfa0 id: /rec/gauss2d s: 0[m +THistSvc DEBUG regHist_i THistID: id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2d94f90 TH1F[m +THistSvc DEBUG regHist_i obj: 0x2d98380 id: /rec/gauss2d s: 0[m THistSvc DEBUG Registering TH2F title: "2D Gaussian" id: "/rec/gauss2d" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2a6dfa0 TH2F[m -THistSvc DEBUG regHist_i obj: 0x2a61030 id: /rec/gauss3d s: 0[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2d98380 TH2F[m +THistSvc DEBUG regHist_i obj: 0x2d98f80 id: /rec/gauss3d s: 0[m THistSvc DEBUG Registering TH3F title: "3D Gaussian" id: "/rec/gauss3d" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2a61030 TH3F[m -THistSvc DEBUG regHist_i obj: 0x2a61920 id: /rec/prof s: 0[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2d98f80 TH3F[m +THistSvc DEBUG regHist_i obj: 0x2d99ba0 id: TempHist5 s: 0[m +THistSvc DEBUG Historgram with id "TempHist5" is temporary[m +THistSvc DEBUG Registering TH1F title: "Temporary Tree 5" id: "/temp/TempHist5" dir: root:/ file: none[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist5 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d99ba0 TH1F[m +THistSvc DEBUG regHist_i obj: 0x2d9a400 id: TempHist6 s: 0[m +THistSvc DEBUG Historgram with id "TempHist6" is temporary[m +THistSvc DEBUG Registering TH1D title: "Temporary Tree 6" id: "/temp/TempHist6" dir: root:/ file: none[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist6 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d9a400 TH1D[m +THistSvc DEBUG regHist_i obj: 0x203a910 id: TempHist7 s: 0[m +THistSvc DEBUG Historgram with id "TempHist7" is temporary[m +THistSvc DEBUG Registering TH1D title: "Temporary Tree 7" id: "/temp/TempHist7" dir: root:/ file: none[m +THistSvc DEBUG regHist_i THistID: id: /temp/TempHist7 t: 1 s: 0 M: 32781792 m: 0 o: 0x203a910 TH1D[m +THistSvc DEBUG regHist_i obj: 0x2d9b130 id: /rec/prof s: 0[m THistSvc DEBUG Registering TProfile title: "profile" id: "/rec/prof" dir: tuple3.rt:/ file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2a61920 TProfile[m -THistSvc DEBUG regHist_i obj: 0x2aa42b0 id: /rec/trees/stuff/tree1 s: 0[m +THistSvc DEBUG regHist_i THistID: id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2d9b130 TProfile[m +THistSvc DEBUG regHist_i obj: 0x2dd9ff0 id: /rec/trees/stuff/tree1 s: 0[m THistSvc DEBUG Registering TTree title: "tree title" id: "/rec/trees/stuff/tree1" dir: tuple3.rt:/trees/stuff file: tuple3.rt[m -THistSvc DEBUG regHist_i THistID: id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2aa42b0 TTree[m +THistSvc DEBUG regHist_i THistID: id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2dd9ff0 TTree[m +THistSvc DEBUG regHist_i obj: 0x2e49780 id: /upd/xxx/gauss1d_shared s: 1[m +THistSvc DEBUG Registering shared TH1F title: "1D Gaussian" id: "/upd/xxx/gauss1d_shared" dir: tuple2.rt:/xxx file: tuple2.rt[m +THistSvc DEBUG regHist_i THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG regHist_i obj: 0x2e4a0b0 id: /rec/gauss2d_shared s: 1[m +THistSvc DEBUG Registering shared TH2F title: "2D Gaussian" id: "/rec/gauss2d_shared" dir: tuple3.rt:/ file: tuple3.rt[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG regHist_i obj: 0x2e54a20 id: /rec/gauss3d_shared s: 1[m +THistSvc DEBUG Registering shared TH3F title: "3D Gaussian" id: "/rec/gauss3d_shared" dir: tuple3.rt:/ file: tuple3.rt[m +THistSvc DEBUG regHist_i THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m [93;1mEventLoopMgr WARNING Unable to locate service "EventSelector" [m [93;1mEventLoopMgr WARNING No events will be processed from external input.[m [93;1mHistogramPersis...WARNING Histograms saving not required.[m @@ -74,131 +95,217 @@ ApplicationMgr INFO Application Manager Started successfully[m RndmGenSvc.Engine INFO Generator engine type:CLHEP::RanluxEngine[m RndmGenSvc.Engine INFO Current Seed:1234567 Luxury:3[m RndmGenSvc INFO Using Random engine:HepRndm::Engine<CLHEP::RanluxEngine>[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m +THistSvc DEBUG getSharedHist: found THistID: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG getSharedHist: found THistID: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m THistSvc DEBUG updateFiles()[m THistSvc DEBUG stream: rec name: tuple3.rt size: 432[m -THistSvc DEBUG stream: upd name: tuple2.rt size: 44719[m +THistSvc DEBUG stream: upd name: tuple2.rt size: 4732[m ApplicationMgr INFO Application Manager Stopped successfully[m THistWrite INFO Finalizing...[m +THistSvc DEBUG vhid for /temp/TempHist7 is empty. deleting[m EventLoopMgr INFO Histograms converted successfully according to request.[m THistSvc DEBUG dumping THistSvc contents -m_hlist: size: 8 - - id: /temp/TempHist1 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5ba40 TH1F :: [0x29b02c0] 1 {[0x2a5ba40]} - - id: /temp/other/TempHist1a t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5c2d0 TH1F :: [0x20fed80] 1 {[0x2a5c2d0]} - - id: /new/Tree2 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5dd40 TH1F :: [0x2905700] 1 {[0x2a5dd40]} - - id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2a5e2d0 TH1F :: [0x2978180] 1 {[0x2a5e2d0]} - - id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2a6dfa0 TH2F :: [0x29e04a0] 1 {[0x2a6dfa0]} - - id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2a61030 TH3F :: [0x288e690] 1 {[0x2a61030]} - - id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2a61920 TProfile :: [0x2a58250] 1 {[0x2a61920]} - - id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2aa42b0 TTree :: [0x2a69b90] 1 {[0x2aa42b0]} +m_hlist: size: 13 + - id: /temp/TempHist1 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d8bc50 TH1F :: [0x2bea0b0] 1 {[0x2d8bc50]} + - id: /temp/other/TempHist1a t: 1 s: 0 M: 47762608 m: 0 o: 0x2d93020 TH1F :: [0x2bf0b80] 1 {[0x2d93020]} + - id: /new/Tree2 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d947a0 TH1F :: [0x2c54b50] 1 {[0x2d947a0]} + - id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2d94f90 TH1F :: [0x2c11090] 1 {[0x2d94f90]} + - id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2d98380 TH2F :: [0x2ce14a0] 1 {[0x2d98380]} + - id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2d98f80 TH3F :: [0x2ce26c0] 1 {[0x2d98f80]} + - id: /temp/TempHist5 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d99ba0 TH1F :: [0x2cdc790] 1 {[0x2d99ba0]} + - id: /temp/TempHist6 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d9a400 TH1D :: [0x2ce2280] 1 {[0x2d9a400]} + - id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2d9b130 TProfile :: [0x2cea790] 1 {[0x2d9b130]} + - id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2dd9ff0 TTree :: [0x2cdcb70] 1 {[0x2dd9ff0]} + - id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F :: [0x2d9bfa0] 1 {[0x2e49780]} + - id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F :: [0x2d47ed0] 1 {[0x2e4a0b0]} + - id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F :: [0x2c0ac50] 1 {[0x2e54a20]} -m_uids: 8 - - /rec/gauss3d [0x288e690] - - /rec/gauss2d [0x29e04a0] - - /temp/TempHist1 [0x29b02c0] - - /temp/other/TempHist1a [0x20fed80] - - /rec/trees/stuff/tree1 [0x2a69b90] - - /rec/prof [0x2a58250] - - /new/Tree2 [0x2905700] - - /upd/xxx/gauss1d [0x2978180] +m_uids: 13 + - /rec/gauss2d_shared [0x2d47ed0] + - /upd/xxx/gauss1d_shared [0x2d9bfa0] + - /rec/gauss3d_shared [0x2c0ac50] + - /upd/xxx/gauss1d [0x2c11090] + - /rec/prof [0x2cea790] + - /temp/TempHist5 [0x2cdc790] + - /rec/trees/stuff/tree1 [0x2cdcb70] + - /temp/other/TempHist1a [0x2bf0b80] + - /temp/TempHist1 [0x2bea0b0] + - /new/Tree2 [0x2c54b50] + - /rec/gauss2d [0x2ce14a0] + - /rec/gauss3d [0x2ce26c0] + - /temp/TempHist6 [0x2ce2280] -m_ids: 8 - - trees/stuff/tree1 [0x2a69b90] - - prof [0x2a58250] - - gauss3d [0x288e690] - - gauss2d [0x29e04a0] - - xxx/gauss1d [0x2978180] - - TempHist1 [0x29b02c0] - - other/TempHist1a [0x20fed80] - - Tree2 [0x2905700] +m_ids: 13 + - gauss3d_shared [0x2c0ac50] + - gauss2d_shared [0x2d47ed0] + - Tree2 [0x2c54b50] + - xxx/gauss1d [0x2c11090] + - xxx/gauss1d_shared [0x2d9bfa0] + - TempHist1 [0x2bea0b0] + - other/TempHist1a [0x2bf0b80] + - gauss2d [0x2ce14a0] + - gauss3d [0x2ce26c0] + - TempHist5 [0x2cdc790] + - TempHist6 [0x2ce2280] + - prof [0x2cea790] + - trees/stuff/tree1 [0x2cdcb70] -m_tobjs: 8 - - 0x2a6dfa0 -> id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2a6dfa0 TH2F - - 0x2aa42b0 -> id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2aa42b0 TTree - - 0x2a5dd40 -> id: /new/Tree2 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5dd40 TH1F - - 0x2a5c2d0 -> id: /temp/other/TempHist1a t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5c2d0 TH1F - - 0x2a61920 -> id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2a61920 TProfile - - 0x2a61030 -> id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2a61030 TH3F - - 0x2a5ba40 -> id: /temp/TempHist1 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5ba40 TH1F - - 0x2a5e2d0 -> id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2a5e2d0 TH1F +m_tobjs: 13 + - 0x2e4a0b0 -> id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F + - 0x2e49780 -> id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F + - 0x2d94f90 -> id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2d94f90 TH1F + - 0x2d98f80 -> id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2d98f80 TH3F + - 0x2d947a0 -> id: /new/Tree2 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d947a0 TH1F + - 0x2d8bc50 -> id: /temp/TempHist1 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d8bc50 TH1F + - 0x2d9a400 -> id: /temp/TempHist6 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d9a400 TH1D + - 0x2d93020 -> id: /temp/other/TempHist1a t: 1 s: 0 M: 47762608 m: 0 o: 0x2d93020 TH1F + - 0x2d98380 -> id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2d98380 TH2F + - 0x2d9b130 -> id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2d9b130 TProfile + - 0x2d99ba0 -> id: /temp/TempHist5 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d99ba0 TH1F + - 0x2e54a20 -> id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F + - 0x2dd9ff0 -> id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2dd9ff0 TTree [m THistSvc DEBUG THistSvc::finalize[m -THistSvc DEBUG finalize: id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2a61030 TH3F[m -THistSvc DEBUG finalize: id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2a6dfa0 TH2F[m -THistSvc DEBUG finalize: id: /temp/TempHist1 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5ba40 TH1F[m -THistSvc DEBUG finalize: id: /temp/other/TempHist1a t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5c2d0 TH1F[m -THistSvc DEBUG finalize: id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2aa42b0 TTree[m -THistSvc DEBUG finalize: id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2a61920 TProfile[m -THistSvc DEBUG finalize: id: /new/Tree2 t: 1 s: 0 M: 43684000 m: 0 o: 0x2a5dd40 TH1F[m -THistSvc DEBUG finalize: id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2a5e2d0 TH1F[m -THistSvc DEBUG updateFiles()[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT [m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple2.rt"[m -THistSvc DEBUG THistSvc::write()::List of Files connected in ROOT: "tuple3.rt"[m +THistSvc DEBUG finalize: id: /rec/gauss2d_shared t: 0 s: 1 M: 2 m: 0x2e547f0 o: 0x2e4a0b0 TH2F[m +THistSvc DEBUG finalize: id: /upd/xxx/gauss1d_shared t: 0 s: 1 M: 3 m: 0x2df2820 o: 0x2e49780 TH1F[m +THistSvc DEBUG finalize: id: /rec/gauss3d_shared t: 0 s: 1 M: 2 m: 0x2e54e80 o: 0x2e54a20 TH3F[m +THistSvc DEBUG finalize: id: /upd/xxx/gauss1d t: 0 s: 0 M: 3 m: 0 o: 0x2d94f90 TH1F[m +THistSvc DEBUG finalize: id: /rec/prof t: 0 s: 0 M: 2 m: 0 o: 0x2d9b130 TProfile[m +THistSvc DEBUG finalize: id: /temp/TempHist5 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d99ba0 TH1F[m +THistSvc DEBUG finalize: id: /rec/trees/stuff/tree1 t: 0 s: 0 M: 2 m: 0 o: 0x2dd9ff0 TTree[m +THistSvc DEBUG finalize: id: /temp/other/TempHist1a t: 1 s: 0 M: 47762608 m: 0 o: 0x2d93020 TH1F[m +THistSvc DEBUG finalize: id: /temp/TempHist1 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d8bc50 TH1F[m +THistSvc DEBUG finalize: id: /new/Tree2 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d947a0 TH1F[m +THistSvc DEBUG finalize: id: /rec/gauss2d t: 0 s: 0 M: 2 m: 0 o: 0x2d98380 TH2F[m +THistSvc DEBUG finalize: id: /rec/gauss3d t: 0 s: 0 M: 2 m: 0 o: 0x2d98f80 TH3F[m +THistSvc DEBUG finalize: id: /temp/TempHist6 t: 1 s: 0 M: 47762608 m: 0 o: 0x2d9a400 TH1D[m +THistSvc DEBUG updateFiles()[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT [m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple2.rt"[m +THistSvc DEBUG THistSvc::writeObjectsToFile()::List of Files connected in ROOT: "tuple3.rt"[m THistSvc INFO Listing contents of ROOT files: [m THistSvc DEBUG finalizing stream/file rec:tuple3.rt[m THistSvc INFO ==> File: tuple3.rt stream: rec[m TFile: name=tuple3.rt, title=, option=CREATE -TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19978 +TH1.Print Name = 2Dgauss, Entries= 20000, Total sum= 19974 Title = 2D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50 -TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19944 +TH1.Print Name = 3Dgauss, Entries= 20000, Total sum= 19947 Title = 3D Gaussian NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50, NbinsZ= 100, zmin= -50, zmax=50 TH1.Print Name = profile, Entries= 0, Total sum= 0 @@ -206,7 +313,7 @@ TH1.Print Name = profile, Entries= 0, Total sum= 0 NbinsX= 100, xmin= -50, xmax=-50 ****************************************************************************** *Tree :treename : tree title * -*Entries : 1000 : Total = 14051 bytes File Size = 2338 * +*Entries : 1000 : Total = 14051 bytes File Size = 2335 * * : : Tree compression factor = 6.63 * ****************************************************************************** *Br 0 :branch1 : point1/I * @@ -221,10 +328,19 @@ TH1.Print Name = profile, Entries= 0, Total sum= 0 *Entries : 1000 : Total Size= 4565 bytes File Size = 160 * *Baskets : 1 : Basket Size= 32000 bytes Compression= 25.49 * *............................................................................* +TH1.Print Name = 2Dgauss_shared, Entries= 20000, Total sum= 19957 + Title = 2D Gaussian + NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50 +TH1.Print Name = 3Dgauss_shared, Entries= 20000, Total sum= 19949 + Title = 3D Gaussian + NbinsX= 100, xmin= -50, xmax=50, NbinsY= 100, ymin= -50, ymax=50, NbinsZ= 100, zmin= -50, zmax=50 THistSvc DEBUG finalizing stream/file upd:tuple2.rt[m THistSvc INFO ==> File: tuple2.rt stream: upd[m TFile: name=tuple2.rt, title=, option=UPDATE -TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19984 +TH1.Print Name = 1Dgauss, Entries= 20000, Total sum= 19982 + Title = 1D Gaussian + NbinsX= 100, xmin= -50, xmax=50 +TH1.Print Name = 1Dgauss_shared, Entries= 20000, Total sum= 19984 Title = 1D Gaussian NbinsX= 100, xmin= -50, xmax=50 ApplicationMgr INFO Application Manager Finalized successfully[m diff --git a/GaudiKernel/GaudiKernel/ITHistSvc.h b/GaudiKernel/GaudiKernel/ITHistSvc.h index 8684911c32577818581c334dcca5589c4b2a9b56..80e1165fa41fbd352bc88dfd35c7006e6f77ce2e 100644 --- a/GaudiKernel/GaudiKernel/ITHistSvc.h +++ b/GaudiKernel/GaudiKernel/ITHistSvc.h @@ -1,16 +1,16 @@ #ifndef GAUDIKERNEL_ITHISTSVC_H #define GAUDIKERNEL_ITHISTSVC_H +#include <memory> +#include <string> +#include <vector> + #ifndef GAUDIKERNEL_ISERVICE_H #include "GaudiKernel/IService.h" #endif #include "GaudiKernel/LockedHandle.h" -#include <memory> -#include <string> -#include <vector> - class TObject; class TH1; class TH2; @@ -24,29 +24,106 @@ class GAUDI_API ITHistSvc : virtual public IService { public: /// InterfaceID - DeclareInterfaceID( ITHistSvc, 2, 0 ); + DeclareInterfaceID( ITHistSvc, 3, 0 ); + /// @name Functions to manage ROOT histograms of any kind + /// @{ + + /// Register a new ROOT histogram TH*X with a name virtual StatusCode regHist( const std::string& name ) = 0; - virtual StatusCode regHist( const std::string& name, std::unique_ptr<TH1> ) = 0; + /// 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 + virtual StatusCode regHist( const std::string& name, std::unique_ptr<TH1> hist ) = 0; + /// 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 + virtual StatusCode regHist( const std::string& name, std::unique_ptr<TH1> hist, TH1* hist_ptr ) = 0; + /// @deprecated {Just for compatibility purposes. Ownership should be clearly managed.} + /// Register an existing ROOT histogram TH*X with name and pointer + virtual StatusCode regHist( const std::string& name, TH1* ) = 0; + /// Return histogram with given name as TH1*, THistSvcMT still owns object. + virtual StatusCode getHist( const std::string& name, TH1*&, size_t index = 0 ) const = 0; + /// Return histogram with given name as TH2*, THistSvcMT still owns object. + virtual StatusCode getHist( const std::string& name, TH2*&, size_t index = 0 ) const = 0; + /// Return histogram with given name as TH3*, THistSvcMT still owns object. + virtual StatusCode getHist( const std::string& name, TH3*&, size_t index = 0 ) const = 0; + + /// @} + + /// @name Functions to manage TTrees + /// @{ + + /// Register a new TTree with a given name + virtual StatusCode regTree( const std::string& name ) = 0; + /// Register an existing TTree with a given name and moved unique_ptr + virtual StatusCode regTree( const std::string& name, std::unique_ptr<TTree> ) = 0; + /// @deprecated {Just kept for compatibiltiy to current ATLAS code. Pleas use std::unique_ptrs instead!} + /// Register a new TTree with a given name and a raw pointer + virtual StatusCode regTree( const std::string& name, TTree* ) = 0; + /// Return TTree with given name + virtual StatusCode getTree( const std::string& name, TTree*& ) const = 0; - virtual TH1* getHistTH1( const std::string& name, size_t index = 0 ) const = 0; - virtual TH2* getHistTH2( const std::string& name, size_t index = 0 ) const = 0; - virtual TH3* getHistTH3( const std::string& name, size_t index = 0 ) const = 0; + /// @} - virtual LockedHandle<TH1> regSharedHist( const std::string& name, std::unique_ptr<TH1> ) = 0; - virtual LockedHandle<TH2> regSharedHist( const std::string& name, std::unique_ptr<TH2> ) = 0; - virtual LockedHandle<TH3> regSharedHist( const std::string& name, std::unique_ptr<TH3> ) = 0; + /// @name Functions to manage TGraphs + /// @{ - virtual LockedHandle<TH1> getSharedHistTH1( const std::string& name ) const = 0; - virtual LockedHandle<TH2> getSharedHistTH2( const std::string& name ) const = 0; - virtual LockedHandle<TH3> getSharedHistTH3( const std::string& name ) const = 0; + /// Register a new TGraph with a given name + virtual StatusCode regGraph( const std::string& name ) = 0; + /// Register an existing TGraph with a given name and moved unique_ptr + virtual StatusCode regGraph( const std::string& name, std::unique_ptr<TGraph> ) = 0; + /// @deprecated {Just kept for compatibiltiy to current ATLAS code. Pleas use std::unique_ptrs instead!} + /// Register a new TGraph with a given name and a raw pointer + virtual StatusCode regGraph( const std::string& name, TGraph* ) = 0; + /// Return TGraph with given name + virtual StatusCode getGraph( const std::string& name, TGraph*& ) const = 0; + + /// @} + + /// @name Functions managing shared objects + /// @{ + + /// Register shared object of type TH1 and return LockedHandle for that object + virtual StatusCode regShared( const std::string& name, std::unique_ptr<TH1>, LockedHandle<TH1>& ) = 0; + /// Register shared object of type TH2 and return LockedHandle for that object + virtual StatusCode regShared( const std::string& name, std::unique_ptr<TH2>, LockedHandle<TH2>& ) = 0; + /// Register shared object of type TH3 and return LockedHandle for that object + virtual StatusCode regShared( const std::string& name, std::unique_ptr<TH3>, LockedHandle<TH3>& ) = 0; + /// Register shared object of type TGraph and return LockedHandle for that object + virtual StatusCode regShared( const std::string& name, std::unique_ptr<TGraph>, LockedHandle<TGraph>& ) = 0; + /// Retrieve shared object with given name as TH1 through LockedHandle + virtual StatusCode getShared( const std::string& name, LockedHandle<TH1>& ) const = 0; + /// Retrieve shared object with given name as TH2 through LockedHandle + virtual StatusCode getShared( const std::string& name, LockedHandle<TH2>& ) const = 0; + /// Retrieve shared object with given name as TH3 through LockedHandle + virtual StatusCode getShared( const std::string& name, LockedHandle<TH3>& ) const = 0; + /// Retrieve shared object with given name as TGraph through LockedHandle + virtual StatusCode getShared( const std::string& name, LockedHandle<TGraph>& ) const = 0; + + /// @} + + /// @name Functions that work on any TObject in the THistSvcMT + /// @{ + + /// Deregister object with given name and give up ownership (without deletion!) + virtual StatusCode deReg( const std::string& name ) = 0; + /// Deregister obejct identified by TObject* and give up ownership (without deletion!) + virtual StatusCode deReg( TObject* obj ) = 0; - virtual StatusCode regTree( const std::string& name ) = 0; - virtual StatusCode regTree( const std::string& name, std::unique_ptr<TTree> ) = 0; - virtual TTree* getTree( const std::string& name ) const = 0; + /// Merge all clones for object with a given id + virtual StatusCode merge( const std::string& id ) = 0; + /// Merge all clones for given TObject* + virtual StatusCode merge( TObject* ) = 0; - virtual StatusCode deReg( const std::string& name ) = 0; - virtual StatusCode deReg( TObject* obj ) = 0; + /// Check if object with given name is managed by THistSvcMT + virtual bool exists( const std::string& name ) const = 0; + + /// @} + + /// @name Functions returning lists of all histograms, trees and graphs + /// @{ virtual std::vector<std::string> getHists() const = 0; virtual std::vector<std::string> getTrees() const = 0; @@ -54,7 +131,6 @@ public: virtual StatusCode getTHists( TDirectory* td, TList&, bool recurse = false ) const = 0; virtual StatusCode getTHists( const std::string& name, TList&, bool recurse = false ) const = 0; - virtual StatusCode getTHists( TDirectory* td, TList&, bool recurse = false, bool reg = false ) = 0; virtual StatusCode getTHists( const std::string& name, TList&, bool recurse = false, bool reg = false ) = 0; @@ -63,20 +139,10 @@ public: virtual StatusCode getTTrees( TDirectory* td, TList&, bool recurse = false, bool reg = false ) = 0; virtual StatusCode getTTrees( const std::string& name, TList&, bool recurse = false, bool reg = false ) = 0; - virtual StatusCode regGraph( const std::string& name ) = 0; - virtual StatusCode regGraph( const std::string& name, std::unique_ptr<TGraph> ) = 0; - virtual TGraph* getGraph( const std::string& name ) const = 0; - - virtual LockedHandle<TGraph> regSharedGraph( const std::string& name, std::unique_ptr<TGraph> ) = 0; - virtual LockedHandle<TGraph> getSharedGraph( const std::string& name ) const = 0; - - virtual StatusCode merge( const std::string& id ) = 0; - virtual StatusCode merge( TObject* ) = 0; - - virtual bool exists( const std::string& name ) const = 0; + /// @} /// virtual destructor virtual ~ITHistSvc() = default; }; -#endif +#endif // GAUDIKERNEL_ITHISTSVC_H diff --git a/GaudiSvc/src/THistSvc/README.md b/GaudiSvc/src/THistSvc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1141f0271fec04dd12b24dc1ee62f5bcc3083a4d --- /dev/null +++ b/GaudiSvc/src/THistSvc/README.md @@ -0,0 +1,43 @@ +# THistSvc + +The latest changes (2018-03-08) of the THistSvc provide two improvements: + 1. Threadfriendly management of TObjetcs (histograms, graphs, trees) + 1. Better memory management through communicating ownership with `std::unique_ptr`s in the interface + +## Parallel THistSvc +Parallel usage of the THistSvc is possible through either: + 1. Use `regHist()` to register a clone for each involved thread that can be merged in the end. (e.g. during `finalize` of an Algorithm/Service ...) + 1. Use `regSharedHist()` to register a single instance for all threads that is mutexed and accessed through a `LockedHandle<>` + +Both approaches have their use cases, but for moderate histogram usage during a normal job of some kind, sharing a single instance is probably best. + +In future ROOT versions (ROOT 7?) it might be possible to introduce further methods of parallelized histograms. +Histograms with atomic bins looks very promising. + +## About ownership +You should register your TObejects to the THistSvc through moving `std::unique_ptr`s into the `reg*` method. +The THistSvc manages these objects and is also responsible for writing these to ROOT files etc. + +If your usage looked like this before: +```cpp +TH1D* hist = new TH1D(...); +regHist( "name", hist ); +hist->Fill(...); +``` +you should replace it with: +```cpp +std::unique_ptr<TH1D> hist = std::make_unique<TH1D>(...); +TH1D* histptr = hist.get(); +regHist( "name", std::move(hist) ); +histptr->Fill(...); +``` +or even +```cpp +std::unique_ptr<TH1D> hist = std::make_unique<TH1D>(...); +regHist( "name", std::move(hist) ); +TH1D* histptr = getHist( "name" ); +histptr->Fill(...); +``` + +This way it is clear that the THistSvc takes ownership of these objects. +Working on the returned raw pointers is no issue as long as the THistSvc is still present (until `finalize` is called) and as long as the user does not do anything malicious with it (i.e. deleting it). diff --git a/GaudiSvc/src/THistSvc/THistSvc.cpp b/GaudiSvc/src/THistSvc/THistSvc.cpp index 8bccfed8bfb66a9856c6e89b406ced20102bbddc..989d7c6a5050e091415d314c1042c5e0c16aa814 100644 --- a/GaudiSvc/src/THistSvc/THistSvc.cpp +++ b/GaudiSvc/src/THistSvc/THistSvc.cpp @@ -1,11 +1,20 @@ -#ifdef __ICC -// disable icc remark #2259: non-pointer conversion from "X" to "Y" may lose significant bits -// TODO: To be removed, since it comes from ROOT TMathBase.h -#pragma warning( disable : 2259 ) -#endif +// system headers +#include <cstdio> +#include <sstream> +#include <streambuf> -#include "THistSvc.h" +// boost headers +#include "boost/algorithm/string/case_conv.hpp" + +// ROOT headers +#include "TDirectory.h" +#include "TError.h" +#include "TFile.h" +#include "TGraph.h" +#include "TKey.h" +#include "TROOT.h" +// Gaudi headers #include "GaudiKernel/AttribStringParser.h" #include "GaudiKernel/FileIncident.h" #include "GaudiKernel/GaudiException.h" @@ -17,20 +26,8 @@ #include "GaudiKernel/ISvcLocator.h" #include "GaudiKernel/Property.h" -#include "boost/algorithm/string/case_conv.hpp" - -#include "TDirectory.h" -#include "TError.h" -#include "TFile.h" -#include "TGraph.h" -#include "TKey.h" -#include "TROOT.h" - -#include <cstdio> -#include <sstream> -#include <streambuf> - -using namespace std; +// local headers +#include "THistSvc.h" DECLARE_COMPONENT( THistSvc ) @@ -65,8 +62,6 @@ THistSvc::THistSvc( const std::string& name, ISvcLocator* svc ) : base_class( na m_inputfile.declareUpdateHandler( &THistSvc::setupInputFile, this ); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::initialize() { GlobalDirectoryRestore restore( m_svcMut ); @@ -132,7 +127,6 @@ StatusCode THistSvc::initialize() } m_okToConnect = true; - if ( m_delayConnect ) { if ( !m_inputfile.value().empty() ) { setupInputFile( m_inputfile ); @@ -147,7 +141,6 @@ StatusCode THistSvc::initialize() m_alreadyConnectedInFiles.clear(); IIoComponentMgr* iomgr = nullptr; - if ( service( "IoComponentMgr", iomgr, true ).isFailure() ) { error() << "unable to get the IoComponentMgr" << endmsg; st = StatusCode::FAILURE; @@ -184,8 +177,6 @@ StatusCode THistSvc::initialize() return st; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::reinitialize() { GlobalDirectoryRestore restore( m_svcMut ); @@ -193,8 +184,6 @@ StatusCode THistSvc::reinitialize() return StatusCode::SUCCESS; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::finalize() { GlobalDirectoryRestore restore( m_svcMut ); @@ -206,21 +195,20 @@ StatusCode THistSvc::finalize() #ifndef NDEBUG if ( msgLevel( MSG::DEBUG ) ) { - for ( auto& itr : m_uids ) { - + for ( const auto& itr : m_uids ) { THistID& thid = itr.second->at( 0 ); - TObject* to = thid.obj; + TObject* tobj = thid.obj; - string dirname( "none" ); - if ( to && to->IsA()->InheritsFrom( "TTree" ) ) { - TTree* tr = dynamic_cast<TTree*>( to ); - if ( tr->GetDirectory() != 0 ) { - dirname = tr->GetDirectory()->GetPath(); + std::string dirname( "none" ); + if ( tobj && tobj->IsA()->InheritsFrom( "TTree" ) ) { + TTree* tree = dynamic_cast<TTree*>( tobj ); + if ( tree->GetDirectory() != 0 ) { + dirname = tree->GetDirectory()->GetPath(); } - } else if ( to && to->IsA()->InheritsFrom( "TGraph" ) ) { + } else if ( tobj && tobj->IsA()->InheritsFrom( "TGraph" ) ) { if ( !thid.temp ) { dirname = thid.file->GetPath(); - string id2( thid.id ); + std::string id2( thid.id ); id2.erase( 0, id2.find( "/", 1 ) ); id2.erase( id2.rfind( "/" ), id2.length() ); if ( id2.find( "/" ) == 0 ) { @@ -230,16 +218,16 @@ StatusCode THistSvc::finalize() } else { dirname = "/tmp"; } - } else if ( to && to->IsA()->InheritsFrom( "TH1" ) ) { - TH1* th = dynamic_cast<TH1*>( to ); - if ( th == 0 ) { + } else if ( tobj && tobj->IsA()->InheritsFrom( "TH1" ) ) { + TH1* th = dynamic_cast<TH1*>( tobj ); + if ( th == nullptr ) { error() << "Couldn't dcast: " << itr.first << endmsg; } else { if ( th->GetDirectory() != 0 ) { dirname = th->GetDirectory()->GetPath(); } } - } else if ( !to ) { + } else if ( !tobj ) { warning() << itr.first << " has NULL TObject ptr" << endmsg; } debug() << "finalize: " << thid << endmsg; @@ -247,17 +235,16 @@ StatusCode THistSvc::finalize() } #endif - StatusCode sc = write(); - if ( sc.isFailure() ) { + if ( writeObjectsToFile().isFailure() ) { error() << "problems writing histograms" << endmsg; } if ( m_print ) { info() << "Listing contents of ROOT files: " << endmsg; } - vector<TFile*> deleted_files; + std::vector<TFile*> deleted_files; for ( auto& itr : m_files ) { - if ( find( deleted_files.begin(), deleted_files.end(), itr.second.first ) == deleted_files.end() ) { + if ( std::find( deleted_files.begin(), deleted_files.end(), itr.second.first ) == deleted_files.end() ) { deleted_files.push_back( itr.second.first ); #ifndef NDEBUG @@ -280,42 +267,43 @@ StatusCode THistSvc::finalize() itr.second.first->Print( "base" ); } - string tmpfn = itr.second.first->GetName(); + std::string tmpfn = itr.second.first->GetName(); p_fileMgr->close( itr.second.first, name() ); - IIncidentSvc* pi = nullptr; - if ( service( "IncidentSvc", pi ).isFailure() ) { + IIncidentSvc* pIncidentSvc = nullptr; + if ( service( "IncidentSvc", pIncidentSvc ).isFailure() ) { error() << "Unable to get the IncidentSvc" << endmsg; return StatusCode::FAILURE; } if ( itr.second.second == SHARE ) { // Merge File - void* vf = nullptr; - int r = p_fileMgr->open( Io::ROOT, name(), m_sharedFiles[itr.first], Io::WRITE | Io::APPEND, vf, "HIST" ); + void* vfile = nullptr; + int returncode = + p_fileMgr->open( Io::ROOT, name(), m_sharedFiles[itr.first], Io::WRITE | Io::APPEND, vfile, "HIST" ); - if ( r ) { + if ( returncode ) { error() << "unable to open Final Output File: \"" << m_sharedFiles[itr.first] << "\" for merging" << endmsg; return StatusCode::FAILURE; } - TFile* outputfile = (TFile*)vf; - pi->fireIncident( FileIncident( name(), IncidentType::WroteToOutputFile, m_sharedFiles[itr.first] ) ); + TFile* outputfile = (TFile*)vfile; + pIncidentSvc->fireIncident( FileIncident( name(), IncidentType::WroteToOutputFile, m_sharedFiles[itr.first] ) ); if ( msgLevel( MSG::DEBUG ) ) { - debug() << "THistSvc::write()::Merging Rootfile " << endmsg; + debug() << "THistSvc::writeObjectsToFile()::Merging Rootfile " << endmsg; } - vf = nullptr; - r = p_fileMgr->open( Io::ROOT, name(), tmpfn, Io::READ, vf, "HIST" ); + vfile = nullptr; + returncode = p_fileMgr->open( Io::ROOT, name(), tmpfn, Io::READ, vfile, "HIST" ); - if ( r ) { + if ( returncode ) { error() << "unable to open temporary file: \"" << tmpfn << endmsg; return StatusCode::FAILURE; } - TFile* inputfile = (TFile*)vf; + TFile* inputfile = (TFile*)vfile; outputfile->SetCompressionLevel( inputfile->GetCompressionLevel() ); @@ -334,194 +322,415 @@ StatusCode THistSvc::finalize() delete itr.second.first; } + m_files.clear(); m_sharedFiles.clear(); m_fileStreams.clear(); - m_files.clear(); - m_uids.clear(); - m_ids.clear(); - m_hlist.clear(); + m_hlist.clear(); // vhid* is deleted in m_tobjs + m_uids.clear(); // vhid* is deleted in m_tobjs + m_ids.clear(); // vhid* is deleted in m_tobjs + + for ( auto& obj : m_tobjs ) { + // TObject*'s are already dealt with through root file i/o + delete obj.second.first; // delete vhid* + } m_tobjs.clear(); return Service::finalize(); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +//*************************************************************************// -bool THistSvc::browseTDir( TDirectory* dir ) const +StatusCode THistSvc::regHist( const std::string& id ) { - if ( !dir ) { - std::cerr << "TDirectory == 0" << std::endl; - return false; - } + std::unique_ptr<TH1> hist = nullptr; + return regHist_i( std::move( hist ), id, false ); +} - GlobalDirectoryRestore restore( m_svcMut ); +StatusCode THistSvc::regHist( const std::string& id, std::unique_ptr<TH1> hist ) +{ + return regHist_i( std::move( hist ), id, false ); +} - dir->cd(); +StatusCode THistSvc::regHist( const std::string& id, std::unique_ptr<TH1> hist, TH1* hist_ptr ) +{ + // This is only to support a common use case where the histogram is used after its registration + if ( hist_ptr != nullptr ) { + hist_ptr = hist.get(); + } + return regHist_i( std::move( hist ), id, false ); +} - cout << "-> " << dir->GetPath() << " " << dir->GetListOfKeys()->GetSize() << endl; +StatusCode THistSvc::regHist( const std::string& id, TH1* hist_ptr ) +{ + std::unique_ptr<TH1> hist( hist_ptr ); + return regHist_i( std::move( hist ), id, false ); +} - // TIter nextkey(dir->GetListOfKeys()); - TIter nextkey( dir->GetList() ); - while ( TKey* key = (TKey*)nextkey() ) { - TObject* obj = key->ReadObj(); - if ( !obj ) { - cout << key->GetName() << " obj==0" << endl; - continue; - } - // if (obj->IsA()->InheritsFrom("TDirectory")) { - cout << " Key: " << key->GetName() << " " - << " tit: " << obj->GetTitle() << " " - << " (" << key->GetClassName() << ")" << endl; - // } +StatusCode THistSvc::getHist( const std::string& id, TH1*& hist, size_t ind ) const +{ + hist = getHist_i<TH1>( id, ind ); + if ( hist != nullptr ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; } +} - nextkey = dir->GetListOfKeys(); - while ( TKey* key = (TKey*)nextkey() ) { - TObject* obj = key->ReadObj(); - if ( !obj ) { - cout << key->GetName() << " obj==0" << endl; - continue; - } - if ( obj->IsA()->InheritsFrom( "TDirectory" ) ) { - TDirectory* tt = dynamic_cast<TDirectory*>( obj ); - browseTDir( tt ); - } +StatusCode THistSvc::getHist( const std::string& id, TH2*& hist, size_t ind ) const +{ + hist = getHist_i<TH2>( id, ind ); + if ( hist != nullptr ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; } - - return true; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::getTHists( TDirectory* td, TList& tl, bool rcs ) const +StatusCode THistSvc::getHist( const std::string& id, TH3*& hist, size_t ind ) const { - GlobalDirectoryRestore restore( m_svcMut ); - - gErrorIgnoreLevel = kBreak; - - if ( !td->cd() ) { - error() << "getTHists: No such TDirectory \"" << td->GetPath() << "\"" << endmsg; + hist = getHist_i<TH3>( id, ind ); + if ( hist != nullptr ) { + return StatusCode::SUCCESS; + } else { return StatusCode::FAILURE; } +} - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTHists: \"" << td->GetPath() << "\": found " << td->GetListOfKeys()->GetSize() << " keys" << endmsg; - } +StatusCode THistSvc::regTree( const std::string& id ) +{ + std::unique_ptr<TTree> tree = nullptr; + return regHist_i( std::move( tree ), id, false ); +} - TIter nextkey( td->GetListOfKeys() ); - while ( TKey* key = (TKey*)nextkey() ) { - auto& log = debug(); - if ( msgLevel( MSG::DEBUG ) ) log << " key: " << key->GetName(); - TObject* obj = key->ReadObj(); - if ( obj != 0 && obj->IsA()->InheritsFrom( "TDirectory" ) ) { - if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; - } else if ( obj != 0 && obj->IsA()->InheritsFrom( "TH1" ) ) { - if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; - tl.Add( obj ); - } else if ( obj != 0 ) { - if ( msgLevel( MSG::DEBUG ) ) log << " [" << obj->IsA()->GetName() << "]"; +StatusCode THistSvc::regTree( const std::string& id, std::unique_ptr<TTree> tree ) +{ + StatusCode sc = regHist_i( std::move( tree ), id, false ); + TTree* tr = nullptr; + if ( getTree( id, tr ).isSuccess() && sc.isSuccess() ) { + if ( m_autoSave != 0 ) { + tr->SetAutoSave( m_autoSave ); } - if ( msgLevel( MSG::DEBUG ) ) log << endmsg; + tr->SetAutoFlush( m_autoFlush ); } + return sc; +} - // operate recursively - if ( rcs ) { - nextkey = td->GetListOfKeys(); - while ( TKey* key = (TKey*)nextkey() ) { - TObject* obj = key->ReadObj(); - if ( obj && obj->IsA()->InheritsFrom( "TDirectory" ) ) { - TDirectory* tt = dynamic_cast<TDirectory*>( obj ); - getTHists( tt, tl, rcs ); - } +StatusCode THistSvc::regTree( const std::string& id, TTree* tree_ptr ) +{ + std::unique_ptr<TTree> tree( tree_ptr ); + StatusCode sc = regHist_i( std::move( tree ), id, false ); + TTree* tr = nullptr; + if ( getTree( id, tr ).isSuccess() && sc.isSuccess() ) { + if ( m_autoSave != 0 ) { + tr->SetAutoSave( m_autoSave ); } + tr->SetAutoFlush( m_autoFlush ); } + return sc; +} - return StatusCode::SUCCESS; +StatusCode THistSvc::getTree( const std::string& id, TTree*& tree ) const +{ + tree = getHist_i<TTree>( id ); + if ( tree != nullptr ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +StatusCode THistSvc::regGraph( const std::string& id ) +{ + std::unique_ptr<TGraph> graph = std::make_unique<TGraph>(); + return regHist_i( std::move( graph ), id, false ); +} -StatusCode THistSvc::getTHists( const std::string& dir, TList& tl, bool rcs ) const +StatusCode THistSvc::regGraph( const std::string& id, std::unique_ptr<TGraph> graph ) { + if ( strcmp( graph->GetName(), "Graph" ) == 0 ) { + std::string id2( id ); + std::string::size_type i = id2.rfind( "/" ); + if ( i != std::string::npos ) { + id2.erase( 0, i + 1 ); + } - GlobalDirectoryRestore restore( m_svcMut ); + info() << "setting name of TGraph id: \"" << id << "\" to \"" << id2 << "\" since it is unset" << endmsg; + graph->SetName( id2.c_str() ); + } - gErrorIgnoreLevel = kBreak; + return regHist_i( std::move( graph ), id, false ); +} - StatusCode sc; +StatusCode THistSvc::regGraph( const std::string& id, TGraph* graph_ptr ) +{ + std::unique_ptr<TGraph> graph( graph_ptr ); + if ( strcmp( graph->GetName(), "Graph" ) == 0 ) { + std::string id2( id ); + std::string::size_type i = id2.rfind( "/" ); + if ( i != std::string::npos ) { + id2.erase( 0, i + 1 ); + } - std::string stream, rem, r2; - parseString( dir, stream, rem ); + info() << "setting name of TGraph id: \"" << id << "\" to \"" << id2 << "\" since it is unset" << endmsg; + graph->SetName( id2.c_str() ); + } - auto itr = m_files.find( stream ); - if ( itr != m_files.end() ) { - r2 = itr->second.first->GetName(); - r2 += ":/"; - r2 += rem; + return regHist_i( std::move( graph ), id, false ); +} - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTHists: \"" << dir << "\" looks like a stream name." - << " associated TFile: \"" << itr->second.first->GetName() << "\"" << endmsg; - } +StatusCode THistSvc::getGraph( const std::string& id, TGraph*& graph ) const +{ + graph = getHist_i<TGraph>( id ); + if ( graph != nullptr ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } +} - if ( gDirectory->cd( r2.c_str() ) ) { - m_curstream = stream; - sc = getTHists( gDirectory, tl, rcs ); - m_curstream = ""; - return sc; - } else { - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTHists: no such TDirectory \"" << r2 << "\"" << endmsg; - } - } +StatusCode THistSvc::regShared( const std::string& id, std::unique_ptr<TH1> hist, LockedHandle<TH1>& lh ) +{ + lh = regShared_i<TH1>( id, std::move( hist ) ); + if ( lh ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } +} +StatusCode THistSvc::regShared( const std::string& id, std::unique_ptr<TH2> hist, LockedHandle<TH2>& lh ) +{ + lh = regShared_i<TH2>( id, std::move( hist ) ); + if ( lh ) { + return StatusCode::SUCCESS; } else { - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTHists: stream \"" << stream << "\" not found" << endmsg; - } + return StatusCode::FAILURE; } +} - if ( !gDirectory->cd( dir.c_str() ) ) { - error() << "getTHists: No such TDirectory/stream \"" << dir << "\"" << endmsg; - sc = StatusCode::FAILURE; +StatusCode THistSvc::regShared( const std::string& id, std::unique_ptr<TH3> hist, LockedHandle<TH3>& lh ) +{ + lh = regShared_i<TH3>( id, std::move( hist ) ); + if ( lh ) { + return StatusCode::SUCCESS; } else { - sc = getTHists( gDirectory, tl, rcs ); + return StatusCode::FAILURE; } +} - return sc; +StatusCode THistSvc::regShared( const std::string& id, std::unique_ptr<TGraph> graph, LockedHandle<TGraph>& lh ) +{ + lh = regShared_i<TGraph>( id, std::move( graph ) ); + if ( lh ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +StatusCode THistSvc::getShared( const std::string& name, LockedHandle<TH1>& lh ) const +{ + lh = getShared_i<TH1>( name ); + if ( lh ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } +} -StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs ) const +StatusCode THistSvc::getShared( const std::string& name, LockedHandle<TH2>& lh ) const { - GlobalDirectoryRestore restore( m_svcMut ); + lh = getShared_i<TH2>( name ); + if ( lh ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } +} - gErrorIgnoreLevel = kBreak; +StatusCode THistSvc::getShared( const std::string& name, LockedHandle<TH3>& lh ) const +{ + lh = getShared_i<TH3>( name ); + if ( lh ) { + return StatusCode::SUCCESS; + } else { + return StatusCode::FAILURE; + } +} - if ( !td->cd() ) { - error() << "getTTrees: No such TDirectory \"" << td->GetPath() << "\"" << endmsg; +StatusCode THistSvc::getShared( const std::string& name, LockedHandle<TGraph>& lh ) const +{ + lh = getShared_i<TGraph>( name ); + if ( lh ) { + return StatusCode::SUCCESS; + } else { return StatusCode::FAILURE; } +} - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTHists: \"" << td->GetPath() << "\": found " << td->GetListOfKeys()->GetSize() << " keys" << endmsg; +StatusCode THistSvc::deReg( const std::string& id ) +{ + auto itr = m_uids.find( id ); + if ( itr == m_uids.end() ) { + error() << "Problem deregistering id \"" << id << "\": not found in registry" << endmsg; + return StatusCode::FAILURE; } - TIter nextkey( td->GetListOfKeys() ); - while ( TKey* key = (TKey*)nextkey() ) { - auto& log = debug(); + vhid_t* vh = itr->second; + debug() << "will deregister " << vh->size() << " elements of id \"" << id << "\"" << endmsg; + StatusCode sc( StatusCode::SUCCESS ); + while ( vh->size() > 0 ) { + if ( deReg( vh->back().obj ).isFailure() ) { + sc = StatusCode::FAILURE; + error() << "Problems deRegistering " << vh->size() << " element of id \"" << id << "\"" << endmsg; + break; + } + } + + return sc; +} + +StatusCode THistSvc::deReg( TObject* obj ) +{ + objMap_t::iterator obj_itr = m_tobjs.find( obj ); + if ( obj_itr != m_tobjs.end() ) { + vhid_t* vhid = obj_itr->second.first; + THistID hid = obj_itr->second.first->at( obj_itr->second.second ); + + auto uid_itr = m_uids.find( hid.id ); + if ( uid_itr == m_uids.end() ) { + error() << "Problems deregistering TObject \"" << obj->GetName() << "\" with id \"" << hid.id + << "\": not in uidMap" << endmsg; + return StatusCode::FAILURE; + } + + if ( vhid->size() == 1 ) { + // We are the last object, so we have to delete vhid properly + debug() << "vhid for " << hid.id << " is empty. deleting" << endmsg; + + std::string root, rem; + parseString( hid.id, root, rem ); + + auto mitr = m_ids.equal_range( rem ); + auto id_itr = std::find_if( mitr.first, mitr.second, + [&]( idMap_t::const_reference i ) { return i.second->at( 0 ).obj == obj; } ); + if ( id_itr == mitr.second ) { + error() << "Problems deregistering TObject \"" << obj->GetName() << "\" with id \"" << hid.id + << "\": not in idMap" << endmsg; + return StatusCode::FAILURE; + } + + auto hlist_itr = std::find( m_hlist.begin(), m_hlist.end(), vhid ); + if ( hlist_itr == m_hlist.end() ) { + error() << "Problems deregistering TObject \"" << obj->GetName() << "\" with id \"" << hid.id + << "\": not in hlist" << endmsg; + return StatusCode::FAILURE; + } + + m_tobjs.erase( obj_itr ); + vhid->erase( vhid->begin() + obj_itr->second.second ); + + m_uids.erase( uid_itr ); + m_ids.erase( id_itr ); + m_hlist.erase( hlist_itr ); + + delete vhid; + + } else if ( vhid->size() > 1 ) { + m_tobjs.erase( obj_itr ); + vhid->erase( vhid->begin() + obj_itr->second.second ); + + // vector of THistID is still not empty (i.e. other instances with same name registered) + } else { + error() << "Deregistration failed unexpectedly. (bug in THistSvc?)" << endmsg; + } + return StatusCode::SUCCESS; + } else { + error() << "Cannot unregister TObject \"" << obj->GetName() << "\": not known to THistSvc" << endmsg; + return StatusCode::FAILURE; + } +} + +StatusCode THistSvc::merge( const std::string& name ) +{ + uidMap_t::iterator itr = m_uids.find( name ); + if ( itr == m_uids.end() ) { + error() << "merge: id \"" << name << "\" not found" << endmsg; + return StatusCode::FAILURE; + } + + return merge( itr->second ); +} + +StatusCode THistSvc::merge( TObject* obj ) +{ + objMap_t::iterator itr = m_tobjs.find( obj ); + if ( itr != m_tobjs.end() ) { + return merge( itr->second.first ); + } else { + error() << "merge: unknown object " << obj << endmsg; + return StatusCode::FAILURE; + } +} + +bool THistSvc::exists( const std::string& name ) const { return ( getHist_i<TH1>( name, 0, true ) != nullptr ); } + +std::vector<std::string> THistSvc::getHists() const +{ + std::vector<std::string> names; + names.reserve( m_uids.size() ); + transform_if( std::begin( m_uids ), std::end( m_uids ), std::back_inserter( names ), select1st, + []( uidMap_t::const_reference i ) { return i.second->at( 0 ).obj->IsA()->InheritsFrom( "TH1" ); } ); + return names; +} + +std::vector<std::string> THistSvc::getTrees() const +{ + std::vector<std::string> names; + names.reserve( m_uids.size() ); + transform_if( std::begin( m_uids ), std::end( m_uids ), std::back_inserter( names ), select1st, + []( uidMap_t::const_reference i ) { return i.second->at( 0 ).obj->IsA()->InheritsFrom( "TTree" ); } ); + return names; +} + +std::vector<std::string> THistSvc::getGraphs() const +{ + std::vector<std::string> names; + names.reserve( m_uids.size() ); + transform_if( std::begin( m_uids ), std::end( m_uids ), std::back_inserter( names ), select1st, + []( uidMap_t::const_reference i ) { return i.second->at( 0 ).obj->IsA()->InheritsFrom( "TGraph" ); } ); + return names; +} + +StatusCode THistSvc::getTHists( TDirectory* td, TList& tl, bool rcs ) const +{ + GlobalDirectoryRestore restore( m_svcMut ); + + gErrorIgnoreLevel = kBreak; + + if ( !td->cd() ) { + error() << "getTHists: No such TDirectory \"" << td->GetPath() << "\"" << endmsg; + return StatusCode::FAILURE; + } + + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "getTHists: \"" << td->GetPath() << "\": found " << td->GetListOfKeys()->GetSize() << " keys" << endmsg; + } + + TIter nextkey( td->GetListOfKeys() ); + while ( TKey* key = (TKey*)nextkey() ) { + auto& log = debug(); if ( msgLevel( MSG::DEBUG ) ) log << " key: " << key->GetName(); TObject* obj = key->ReadObj(); if ( obj != 0 && obj->IsA()->InheritsFrom( "TDirectory" ) ) { if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; - } else if ( obj != 0 && obj->IsA()->InheritsFrom( "TTree" ) ) { + } else if ( obj != 0 && obj->IsA()->InheritsFrom( "TH1" ) ) { if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; tl.Add( obj ); } else if ( obj != 0 ) { if ( msgLevel( MSG::DEBUG ) ) log << " [" << obj->IsA()->GetName() << "]"; } - log << endmsg; + if ( msgLevel( MSG::DEBUG ) ) log << endmsg; } // operate recursively @@ -531,7 +740,7 @@ StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs ) const TObject* obj = key->ReadObj(); if ( obj && obj->IsA()->InheritsFrom( "TDirectory" ) ) { TDirectory* tt = dynamic_cast<TDirectory*>( obj ); - getTTrees( tt, tl, rcs ); + getTHists( tt, tl, rcs ); } } } @@ -539,10 +748,9 @@ StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs ) const return StatusCode::SUCCESS; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::getTTrees( const std::string& dir, TList& tl, bool rcs ) const +StatusCode THistSvc::getTHists( const std::string& dir, TList& tl, bool rcs ) const { + GlobalDirectoryRestore restore( m_svcMut ); gErrorIgnoreLevel = kBreak; @@ -559,33 +767,37 @@ StatusCode THistSvc::getTTrees( const std::string& dir, TList& tl, bool rcs ) co r2 += rem; if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTTrees: \"" << dir << "\" looks like a stream name." + debug() << "getTHists: \"" << dir << "\" looks like a stream name." << " associated TFile: \"" << itr->second.first->GetName() << "\"" << endmsg; } if ( gDirectory->cd( r2.c_str() ) ) { - return getTTrees( gDirectory, tl, rcs ); - } - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTTrees: no such TDirectory \"" << r2 << "\"" << endmsg; + m_curstream = stream; + sc = getTHists( gDirectory, tl, rcs ); + m_curstream = ""; + return sc; + } else { + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "getTHists: no such TDirectory \"" << r2 << "\"" << endmsg; + } } + } else { if ( msgLevel( MSG::DEBUG ) ) { - debug() << "getTTrees: stream \"" << stream << "\" not found" << endmsg; + debug() << "getTHists: stream \"" << stream << "\" not found" << endmsg; } } if ( !gDirectory->cd( dir.c_str() ) ) { - error() << "getTTrees: No such TDirectory/stream \"" << dir << "\"" << endmsg; + error() << "getTHists: No such TDirectory/stream \"" << dir << "\"" << endmsg; sc = StatusCode::FAILURE; } else { - sc = getTTrees( gDirectory, tl, rcs ); + sc = getTHists( gDirectory, tl, rcs ); } + return sc; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::getTHists( TDirectory* td, TList& tl, bool rcs, bool reg ) { GlobalDirectoryRestore restore( m_svcMut ); @@ -612,10 +824,10 @@ StatusCode THistSvc::getTHists( TDirectory* td, TList& tl, bool rcs, bool reg ) if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; tl.Add( obj ); if ( reg && m_curstream != "" ) { - string dir = td->GetPath(); - string fil = td->GetFile()->GetName(); + std::string dir = td->GetPath(); + std::string fil = td->GetFile()->GetName(); dir.erase( 0, fil.length() + 1 ); - string id = "/" + m_curstream; + std::string id = "/" + m_curstream; if ( dir == "/" ) { id = id + "/" + key->GetName(); } else { @@ -649,8 +861,6 @@ StatusCode THistSvc::getTHists( TDirectory* td, TList& tl, bool rcs, bool reg ) return StatusCode::SUCCESS; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::getTHists( const std::string& dir, TList& tl, bool rcs, bool reg ) { GlobalDirectoryRestore restore( m_svcMut ); @@ -703,7 +913,94 @@ StatusCode THistSvc::getTHists( const std::string& dir, TList& tl, bool rcs, boo return sc; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs ) const +{ + GlobalDirectoryRestore restore( m_svcMut ); + + gErrorIgnoreLevel = kBreak; + + if ( !td->cd() ) { + error() << "getTTrees: No such TDirectory \"" << td->GetPath() << "\"" << endmsg; + return StatusCode::FAILURE; + } + + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "getTHists: \"" << td->GetPath() << "\": found " << td->GetListOfKeys()->GetSize() << " keys" << endmsg; + } + + TIter nextkey( td->GetListOfKeys() ); + while ( TKey* key = (TKey*)nextkey() ) { + auto& log = debug(); + if ( msgLevel( MSG::DEBUG ) ) log << " key: " << key->GetName(); + TObject* obj = key->ReadObj(); + if ( obj != 0 && obj->IsA()->InheritsFrom( "TDirectory" ) ) { + if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; + } else if ( obj != 0 && obj->IsA()->InheritsFrom( "TTree" ) ) { + if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; + tl.Add( obj ); + } else if ( obj != 0 ) { + if ( msgLevel( MSG::DEBUG ) ) log << " [" << obj->IsA()->GetName() << "]"; + } + log << endmsg; + } + + // operate recursively + if ( rcs ) { + nextkey = td->GetListOfKeys(); + while ( TKey* key = (TKey*)nextkey() ) { + TObject* obj = key->ReadObj(); + if ( obj && obj->IsA()->InheritsFrom( "TDirectory" ) ) { + TDirectory* tt = dynamic_cast<TDirectory*>( obj ); + getTTrees( tt, tl, rcs ); + } + } + } + + return StatusCode::SUCCESS; +} + +StatusCode THistSvc::getTTrees( const std::string& dir, TList& tl, bool rcs ) const +{ + GlobalDirectoryRestore restore( m_svcMut ); + + gErrorIgnoreLevel = kBreak; + + StatusCode sc; + + std::string stream, rem, r2; + parseString( dir, stream, rem ); + + auto itr = m_files.find( stream ); + if ( itr != m_files.end() ) { + r2 = itr->second.first->GetName(); + r2 += ":/"; + r2 += rem; + + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "getTTrees: \"" << dir << "\" looks like a stream name." + << " associated TFile: \"" << itr->second.first->GetName() << "\"" << endmsg; + } + + if ( gDirectory->cd( r2.c_str() ) ) { + return getTTrees( gDirectory, tl, rcs ); + } + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "getTTrees: no such TDirectory \"" << r2 << "\"" << endmsg; + } + } else { + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "getTTrees: stream \"" << stream << "\" not found" << endmsg; + } + } + + if ( !gDirectory->cd( dir.c_str() ) ) { + error() << "getTTrees: No such TDirectory/stream \"" << dir << "\"" << endmsg; + sc = StatusCode::FAILURE; + } else { + sc = getTTrees( gDirectory, tl, rcs ); + } + return sc; +} StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs, bool reg ) { @@ -731,10 +1028,10 @@ StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs, bool reg ) if ( msgLevel( MSG::DEBUG ) ) log << " (" << obj->IsA()->GetName() << ")"; tl.Add( obj ); if ( reg && m_curstream != "" ) { - string dir = td->GetPath(); - string fil = td->GetFile()->GetName(); + std::string dir = td->GetPath(); + std::string fil = td->GetFile()->GetName(); dir.erase( 0, fil.length() + 1 ); - string id = "/" + m_curstream; + std::string id = "/" + m_curstream; if ( dir == "/" ) { id = id + "/" + key->GetName(); } else { @@ -768,8 +1065,6 @@ StatusCode THistSvc::getTTrees( TDirectory* td, TList& tl, bool rcs, bool reg ) return StatusCode::SUCCESS; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::getTTrees( const std::string& dir, TList& tl, bool rcs, bool reg ) { GlobalDirectoryRestore restore( m_svcMut ); @@ -813,202 +1108,173 @@ StatusCode THistSvc::getTTrees( const std::string& dir, TList& tl, bool rcs, boo return getTTrees( gDirectory, tl, rcs, reg ); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +//*************************************************************************// -StatusCode THistSvc::deReg( TObject* obj ) +void THistSvc::handle( const Incident& /* inc */ ) { - objMap_t::iterator itr = m_tobjs.find( obj ); - if ( itr != m_tobjs.end() ) { - vhid_t* vhid = itr->second.first; - THistID hid = itr->second.first->at( itr->second.second ); + if ( m_signaledStop ) return; - auto itr2 = m_uids.find( hid.id ); - if ( itr2 == m_uids.end() ) { - error() << "Problems deregistering TObject \"" << obj->GetName() << "\" with id \"" << hid.id - << "\": not in uidMap" << endmsg; - return StatusCode::FAILURE; - } - - m_tobjs.erase( itr ); - vhid->erase( vhid->begin() + itr->second.second ); + if ( m_maxFileSize.value() == -1 ) return; - if ( vhid->size() != 0 ) { - return StatusCode::SUCCESS; - } + // convert to bytes. + Long64_t mfs = (Long64_t)m_maxFileSize.value() * (Long64_t)1048576; + Long64_t mfs_warn = mfs * 95 / 100; - debug() << "vhid for " << hid.id << " is empty. deleting" << endmsg; + updateFiles(); - std::string id, root, rem; - parseString( hid.id, root, rem ); + std::map<std::string, std::pair<TFile*, Mode>>::const_iterator itr; + for ( const auto& f : m_files ) { + TFile* tf = f.second.first; - auto mitr = m_ids.equal_range( rem ); - auto itr3 = std::find_if( mitr.first, mitr.second, - [&]( idMap_t::const_reference i ) { return i.second->at( 0 ).obj == obj; } ); - if ( itr3 == mitr.second ) { - error() << "Problems deregistering TObject \"" << obj->GetName() << "\" with id \"" << hid.id - << "\": not in idMap" << endmsg; - return StatusCode::FAILURE; +#ifndef NDEBUG + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "stream: " << f.first << " name: " << tf->GetName() << " size: " << tf->GetSize() << endmsg; } +#endif - auto itr4 = std::find( m_hlist.begin(), m_hlist.end(), vhid ); - if ( itr4 == m_hlist.end() ) { - error() << "Problems deregistering TObject \"" << obj->GetName() << "\" with id \"" << hid.id - << "\": not in hlist" << endmsg; - return StatusCode::FAILURE; - } + // Signal job to terminate if output file is too large + if ( tf->GetSize() > mfs ) { - m_uids.erase( itr2 ); - m_ids.erase( itr3 ); - m_hlist.erase( itr4 ); + m_signaledStop = true; - delete vhid; + fatal() << "file \"" << tf->GetName() << "\" associated with stream \"" << f.first + << "\" has exceeded the max file size of " << m_maxFileSize.value() << "MB. Terminating Job." << endmsg; - return StatusCode::SUCCESS; - } else { - error() << "Cannot unregister TObject \"" << obj->GetName() << "\": not known to THistSvc" << endmsg; - return StatusCode::FAILURE; + IEventProcessor* evt = nullptr; + if ( service( "ApplicationMgr", evt, true ).isSuccess() ) { + evt->stopRun(); + evt->release(); + } else { + abort(); + } + } else if ( tf->GetSize() > mfs_warn ) { + warning() << "file \"" << tf->GetName() << "\" associated with stream \"" << f.first + << "\" is at 95% of its maximum allowable file size of " << m_maxFileSize.value() << "MB" << endmsg; + } } } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::deReg( const std::string& id ) +/** @brief callback method to reinitialize the internal state of + * the component for I/O purposes (e.g. upon @c fork(2)) + */ +StatusCode THistSvc::io_reinit() { - auto itr = m_uids.find( id ); - if ( itr == m_uids.end() ) { - error() << "Problem deregistering id \"" << id << "\": not found in registry" << endmsg; - return StatusCode::FAILURE; - } - - vhid_t* vh = itr->second; - debug() << "will deregister " << vh->size() << " elements of id \"" << id << "\"" << endmsg; - StatusCode sc( StatusCode::SUCCESS ); - while ( vh->size() > 0 ) { - if ( deReg( vh->back().obj ).isFailure() ) { - sc = StatusCode::FAILURE; - error() << "Problems deRegistering " << vh->size() << " element of id \"" << id << "\"" << endmsg; - break; - } + bool all_good = true; + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "reinitializing I/O..." << endmsg; } - return sc; -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::regHist( const std::string& id ) -{ - std::unique_ptr<TH1> hist = nullptr; - return regHist_i( std::move( hist ), id, false ); -} + // retrieve the I/O component manager... -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// + IIoComponentMgr* iomgr = nullptr; -StatusCode THistSvc::regHist( const std::string& id, std::unique_ptr<TH1> hist ) -{ - return regHist_i( std::move( hist ), id, false ); -} + if ( service( "IoComponentMgr", iomgr, true ).isFailure() ) { + error() << "could not retrieve I/O component manager !" << endmsg; + return StatusCode::FAILURE; + } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// + GlobalDirectoryRestore restore( m_svcMut ); + // to hide the expected errors upon closing the files whose + // file descriptors have been swept under the rug... + gErrorIgnoreLevel = kFatal; -StatusCode THistSvc::regTree( const std::string& id ) -{ - std::unique_ptr<TTree> tree = nullptr; - return regHist_i( std::move( tree ), id, false ); -} + for ( auto& ifile : m_files ) { + TFile* f = ifile.second.first; + std::string fname = f->GetName(); + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "file [" << fname << "] mode: [" << f->GetOption() << "] r:" << f->GetFileBytesRead() + << " w:" << f->GetFileBytesWritten() << " cnt:" << f->GetFileCounter() << endmsg; + } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// + if ( ifile.second.second == READ ) { + if ( msgLevel( MSG::DEBUG ) ) { + debug() << " TFile opened in READ mode: not reassigning names" << endmsg; + } + continue; + } -StatusCode THistSvc::regTree( const std::string& id, std::unique_ptr<TTree> tree ) -{ - StatusCode sc = regHist_i( std::move( tree ), id, false ); - auto tr = getTree( id ); - if ( tr != nullptr && sc.isSuccess() ) { - if ( m_autoSave != 0 ) { - tr->SetAutoSave( m_autoSave ); + if ( !iomgr->io_retrieve( this, fname ).isSuccess() ) { + error() << "could not retrieve new name for [" << fname << "] !!" << endmsg; + all_good = false; + continue; + } else { + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "got a new name [" << fname << "]..." << endmsg; + } } - tr->SetAutoFlush( m_autoFlush ); - } - return sc; -} -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// + void* vf = nullptr; + Option_t* opts = f->GetOption(); + int r = p_fileMgr->open( Io::ROOT, name(), fname, Io::WRITE, vf, "HIST" ); + if ( r != 0 ) { + error() << "unable to open file \"" << fname << "\" for writing" << endmsg; + return StatusCode::FAILURE; + } + TFile* newfile = (TFile*)vf; + newfile->SetOption( opts ); -StatusCode THistSvc::regGraph( const std::string& id ) -{ - std::unique_ptr<TGraph> hist = std::make_unique<TGraph>(); - return regHist_i( std::move( hist ), id, false ); -} + if ( ifile.second.second != THistSvc::READ ) { + copyFileLayout( newfile, f ); + ifile.second.first = newfile; + } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// + // loop over all uids and migrate them to the new file + // XXX FIXME: this double loop sucks... + for ( auto& uid : m_uidsX ) { + THistID& hid = uid.second; + if ( hid.file != f ) continue; + TDirectory* olddir = this->changeDir( hid ); + hid.file = newfile; + // side-effect: create needed directories... + TDirectory* newdir = this->changeDir( hid ); + TClass* cl = hid.obj->IsA(); -StatusCode THistSvc::regGraph( const std::string& id, std::unique_ptr<TGraph> graph ) -{ - if ( strcmp( graph->GetName(), "Graph" ) == 0 ) { - std::string id2( id ); - string::size_type i = id2.rfind( "/" ); - if ( i != string::npos ) { - id2.erase( 0, i + 1 ); + // migrate the objects to the new file. + // thanks to the object model of ROOT, it is super easy. + if ( cl->InheritsFrom( "TTree" ) ) { + dynamic_cast<TTree*>( hid.obj )->SetDirectory( newdir ); + dynamic_cast<TTree*>( hid.obj )->Reset(); + } else if ( cl->InheritsFrom( "TH1" ) ) { + dynamic_cast<TH1*>( hid.obj )->SetDirectory( newdir ); + dynamic_cast<TH1*>( hid.obj )->Reset(); + } else if ( cl->InheritsFrom( "TGraph" ) ) { + olddir->Remove( hid.obj ); + newdir->Append( hid.obj ); + } else { + error() << "id: \"" << hid.id << "\" is not a inheriting from a class " + << "we know how to handle (received [" << cl->GetName() << "], " + << "expected [TTree, TH1 or TGraph]) !" << endmsg << "attaching to current dir [" << newdir->GetPath() + << "] " + << "nonetheless..." << endmsg; + olddir->Remove( hid.obj ); + newdir->Append( hid.obj ); + } } - - info() << "setting name of TGraph id: \"" << id << "\" to \"" << id2 << "\" since it is unset" << endmsg; - graph->SetName( id2.c_str() ); + f->ReOpen( "READ" ); + p_fileMgr->close( f, name() ); + f = newfile; } - return regHist_i( std::move( graph ), id, false ); + return all_good ? StatusCode::SUCCESS : StatusCode::FAILURE; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -TH1* THistSvc::getHistTH1( const std::string& id, size_t ind ) const { return getHist_i<TH1>( id, ind ); } - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -TH2* THistSvc::getHistTH2( const std::string& id, size_t ind ) const { return getHist_i<TH2>( id, ind ); } - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -TH3* THistSvc::getHistTH3( const std::string& id, size_t ind ) const { return getHist_i<TH3>( id, ind ); } - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +//*************************************************************************// -std::vector<std::string> THistSvc::getHists() const +THistSvc::GlobalDirectoryRestore::GlobalDirectoryRestore( THistSvcMutex_t& mut ) : m_lock( mut ) { - std::vector<std::string> names; - names.reserve( m_uids.size() ); - transform_if( std::begin( m_uids ), std::end( m_uids ), std::back_inserter( names ), select1st, - []( uidMap_t::const_reference i ) { return i.second->at( 0 ).obj->IsA()->InheritsFrom( "TH1" ); } ); - return names; + m_gDirectory = gDirectory; + m_gFile = gFile; + m_gErrorIgnoreLevel = gErrorIgnoreLevel; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -TTree* THistSvc::getTree( const std::string& id ) const { return getHist_i<TTree>( id ); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -std::vector<std::string> THistSvc::getTrees() const +THistSvc::GlobalDirectoryRestore::~GlobalDirectoryRestore() { - std::vector<std::string> names; - names.reserve( m_uids.size() ); - transform_if( std::begin( m_uids ), std::end( m_uids ), std::back_inserter( names ), select1st, - []( uidMap_t::const_reference i ) { return i.second->at( 0 ).obj->IsA()->InheritsFrom( "TTree" ); } ); - return names; + gDirectory = m_gDirectory; + gFile = m_gFile; + gErrorIgnoreLevel = m_gErrorIgnoreLevel; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -TGraph* THistSvc::getGraph( const std::string& id ) const { return getHist_i<TGraph>( id ); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -std::vector<std::string> THistSvc::getGraphs() const -{ - std::vector<std::string> names; - names.reserve( m_uids.size() ); - transform_if( std::begin( m_uids ), std::end( m_uids ), std::back_inserter( names ), select1st, - []( uidMap_t::const_reference i ) { return i.second->at( 0 ).obj->IsA()->InheritsFrom( "TGraph" ); } ); - return names; -} -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +//*************************************************************************// template <typename T> T* THistSvc::readHist( const std::string& id ) const @@ -1016,139 +1282,8 @@ T* THistSvc::readHist( const std::string& id ) const return dynamic_cast<T*>( readHist_i<T>( id ) ); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - TTree* THistSvc::readTree( const std::string& id ) const { return dynamic_cast<TTree*>( readHist_i<TTree>( id ) ); } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -bool THistSvc::findStream( const string& id, string& stream, string& rem, TFile*& file ) const -{ - auto pos = id.find( "/" ); - - if ( pos == string::npos ) { - // no "/" in id - stream = "temp"; - rem = id; - } else if ( pos != 0 ) { - // id does not start with "/" - stream = "temp"; - rem = id; - } else { - // id starts with "/" - - auto pos2 = id.find( "/", pos + 1 ); - - if ( pos2 == string::npos ) { - // need at least 2 "/" in format "/STREAM/name" or "/STREAM/dir/name" - error() << "badly formed Hist/Tree id: \"" << id << "\"" << endmsg; - return false; - } - parseString( id, stream, rem ); - } - - if ( stream == "temp" ) { - file = nullptr; - return true; - } - - auto itr = m_files.find( stream ); - file = ( itr != m_files.end() ? itr->second.first : nullptr ); - if ( !file ) { - warning() << "no stream \"" << stream << "\" associated with id: \"" << id << "\"" << endmsg; - } - - return true; -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -void THistSvc::parseString( const string& id, string& root, string& rem ) const -{ - auto pos = id.find( "/" ); - - if ( pos == string::npos ) { - root.clear(); - rem = id; - } else if ( pos == 0 ) { - parseString( id.substr( 1 ), root, rem ); - } else { - root = id.substr( 0, pos ); - rem = id.substr( pos + 1 ); - } -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -void THistSvc::setupCompressionLevel( Gaudi::Details::PropertyBase& - /* cl */ ) -{ - warning() << "\"CompressionLevel\" Property has been deprecated. " - << "Set it via the \"CL=\" parameter in the \"Output\" Property" << endmsg; -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -void THistSvc::setupInputFile( Gaudi::Details::PropertyBase& - /*m_inputfile*/ ) -{ - if ( FSMState() < Gaudi::StateMachine::CONFIGURED || !m_okToConnect ) { - debug() << "Delaying connection of Input Files until Initialize" - << ". now in " << FSMState() << endmsg; - - m_delayConnect = true; - } else { - debug() << "Now connecting of Input Files" << endmsg; - - StatusCode sc = StatusCode::SUCCESS; - - for ( const auto& itr : m_inputfile.value() ) { - if ( m_alreadyConnectedInFiles.end() != m_alreadyConnectedInFiles.find( itr ) ) { - continue; - } - if ( connect( itr ).isFailure() ) { - sc = StatusCode::FAILURE; - } else { - m_alreadyConnectedInFiles.insert( itr ); - } - } - - if ( !sc.isSuccess() ) { - throw GaudiException( "Problem connecting inputfile !!", name(), StatusCode::FAILURE ); - } - } -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -void THistSvc::setupOutputFile( Gaudi::Details::PropertyBase& - /*m_outputfile*/ ) -{ - if ( FSMState() < Gaudi::StateMachine::CONFIGURED || !m_okToConnect ) { - debug() << "Delaying connection of Input Files until Initialize" - << ". now in " << FSMState() << endmsg; - m_delayConnect = true; - } else { - StatusCode sc = StatusCode::SUCCESS; - for ( const auto& itr : m_outputfile.value() ) { - if ( m_alreadyConnectedOutFiles.end() != m_alreadyConnectedOutFiles.find( itr ) ) { - continue; - } - if ( connect( itr ).isFailure() ) { - sc = StatusCode::FAILURE; - } else { - m_alreadyConnectedOutFiles.insert( itr ); - } - } - - if ( !sc.isSuccess() ) { - throw GaudiException( "Problem connecting outputfile !!", name(), StatusCode::FAILURE ); - } - } -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - void THistSvc::updateFiles() { // If TTrees grow beyond TTree::fgMaxTreeSize, a new file is @@ -1227,9 +1362,7 @@ void THistSvc::updateFiles() } } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::write() +StatusCode THistSvc::writeObjectsToFile() { updateFiles(); @@ -1244,30 +1377,28 @@ StatusCode THistSvc::write() } ); if ( msgLevel( MSG::DEBUG ) ) { - debug() << "THistSvc::write()::List of Files connected in ROOT " << endmsg; + debug() << "THistSvc::writeObjectsToFile()::List of Files connected in ROOT " << endmsg; TSeqCollection* filelist = gROOT->GetListOfFiles(); for ( int ii = 0; ii < filelist->GetEntries(); ii++ ) { - debug() << "THistSvc::write()::List of Files connected in ROOT: \"" << filelist->At( ii )->GetName() << "\"" - << endmsg; + debug() << "THistSvc::writeObjectsToFile()::List of Files connected in ROOT: \"" << filelist->At( ii )->GetName() + << "\"" << endmsg; } } return StatusCode::SUCCESS; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::connect( const std::string& ident ) { - auto loc = ident.find( " " ); - string stream = ident.substr( 0, loc ); + auto loc = ident.find( " " ); + std::string stream = ident.substr( 0, loc ); char typ( 0 ); typedef std::pair<std::string, std::string> Prop; std::vector<Prop> props; - string filename, db_typ( "ROOT" ); + std::string filename, db_typ( "ROOT" ); int cl( 1 ); - if ( loc != string::npos ) { + if ( loc != std::string::npos ) { using Parser = Gaudi::Utils::AttribStringParser; for ( auto attrib : Parser( ident.substr( loc + 1 ) ) ) { auto TAG = boost::algorithm::to_upper_copy( attrib.tag ); @@ -1348,7 +1479,7 @@ StatusCode THistSvc::connect( const std::string& ident ) return StatusCode::FAILURE; } else { TFile* f2 = f_info.first; - m_files[stream] = make_pair( f2, newMode ); + m_files[stream] = std::make_pair( f2, newMode ); if ( msgLevel( MSG::DEBUG ) ) debug() << "Connecting stream: \"" << stream << "\" to previously opened TFile: \"" << filename << "\"" << endmsg; @@ -1403,11 +1534,11 @@ StatusCode THistSvc::connect( const std::string& ident ) } else if ( newMode == THistSvc::SHARE ) { // SHARE file type // For SHARE files, all data will be stored in a temp file and will be - // merged into the target file in write() when finalize(), this help to - // solve some confliction. e.g. with storegate - static int ishared = 0; - string realfilename = filename; - filename = "tmp_THistSvc_" + std::to_string( ishared++ ) + ".root"; + // merged into the target file in writeObjectsToFile() when finalize(), + // this help to solve some confliction. e.g. with storegate + static int ishared = 0; + std::string realfilename = filename; + filename = "tmp_THistSvc_" + std::to_string( ishared++ ) + ".root"; if ( msgLevel( MSG::DEBUG ) ) { debug() << "Creating temp file \"" << filename << "\" and realfilename=" << realfilename << endmsg; @@ -1435,8 +1566,8 @@ StatusCode THistSvc::connect( const std::string& ident ) f = (TFile*)vf; } - m_files[stream] = make_pair( f, newMode ); - m_fileStreams.insert( make_pair( filename, stream ) ); + m_files[stream] = std::make_pair( f, newMode ); + m_fileStreams.insert( std::make_pair( filename, stream ) ); if ( msgLevel( MSG::DEBUG ) ) { debug() << "Opening TFile \"" << filename << "\" stream: \"" << stream << "\" mode: \"" << typ << "\"" @@ -1446,13 +1577,11 @@ StatusCode THistSvc::connect( const std::string& ident ) return StatusCode::SUCCESS; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - TDirectory* THistSvc::changeDir( const THistSvc::THistID& hid ) const { - string uid = hid.id; - TFile* file = hid.file; - string stream, fdir, bdir, dir, id; + std::string uid = hid.id; + TFile* file = hid.file; + std::string stream, fdir, bdir, dir, id; if ( file ) { file->cd( "/" ); @@ -1461,9 +1590,9 @@ TDirectory* THistSvc::changeDir( const THistSvc::THistID& hid ) const } fdir = uid; - bdir = dirname( fdir ); + bdir = stripDirectoryName( fdir ); - while ( ( dir = dirname( fdir ) ) != "" ) { + while ( ( dir = stripDirectoryName( fdir ) ) != "" ) { if ( !gDirectory->GetKey( dir.c_str() ) ) { gDirectory->mkdir( dir.c_str() ); } @@ -1473,43 +1602,23 @@ TDirectory* THistSvc::changeDir( const THistSvc::THistID& hid ) const return gDirectory; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -std::string THistSvc::dirname( std::string& dir ) const +std::string THistSvc::stripDirectoryName( std::string& dir ) const { - string::size_type i = dir.find( "/" ); + std::string::size_type i = dir.find( "/" ); - if ( i == string::npos ) return {}; + if ( i == std::string::npos ) return {}; if ( i == 0 ) { dir.erase( 0, 1 ); - return dirname( dir ); + return stripDirectoryName( dir ); } - string root = dir.substr( 0, i ); + std::string root = dir.substr( 0, i ); dir.erase( 0, i ); return root; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -THistSvc::GlobalDirectoryRestore::GlobalDirectoryRestore( THistSvcMutex_t& mut ) : m_lock( mut ) -{ - m_gd = gDirectory; - m_gf = gFile; - m_ge = gErrorIgnoreLevel; -} - -THistSvc::GlobalDirectoryRestore::~GlobalDirectoryRestore() -{ - gDirectory = m_gd; - gFile = m_gf; - gErrorIgnoreLevel = m_ge; -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - void THistSvc::removeDoubleSlash( std::string& id ) const { while ( id.find( "//" ) != std::string::npos ) { @@ -1517,8 +1626,6 @@ void THistSvc::removeDoubleSlash( std::string& id ) const } } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - void THistSvc::MergeRootFile( TDirectory* target, TDirectory* source ) { if ( msgLevel( MSG::DEBUG ) ) { @@ -1533,10 +1640,10 @@ void THistSvc::MergeRootFile( TDirectory* target, TDirectory* source ) // loop over all keys in this directory TList* lkeys = current_sourcedir->GetListOfKeys(); int nkeys = lkeys->GetEntries(); - TKey* key; + TKey* key = nullptr; for ( int jj = 0; jj < nkeys; jj++ ) { - key = (TKey*)lkeys->At( jj ); - string pathnameinsource = current_sourcedir->GetPath() + string( "/" ) + key->GetName(); + key = (TKey*)lkeys->At( jj ); + std::string pathnameinsource = current_sourcedir->GetPath() + std::string( "/" ) + key->GetName(); if ( msgLevel( MSG::DEBUG ) ) { debug() << "Reading Key:" << pathnameinsource << endmsg; } @@ -1567,261 +1674,165 @@ void THistSvc::MergeRootFile( TDirectory* target, TDirectory* source ) debug() << "Dumping TTree " << nentries << " entries" << endmsg; } target->cd(); - mytree->CloneTree(); - - } else { - target->cd(); - obj->Write( key->GetName() ); - } - } - } -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -bool THistSvc::exists( const std::string& name ) const { return ( getHist_i<TH1>( name, 0, true ) != nullptr ); } - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -void THistSvc::handle( const Incident& /* inc */ ) -{ - if ( signaledStop ) return; - - if ( m_maxFileSize.value() == -1 ) return; - - // convert to bytes. - Long64_t mfs = (Long64_t)m_maxFileSize.value() * (Long64_t)1048576; - Long64_t mfs_warn = mfs * 95 / 100; - - updateFiles(); - - map<string, pair<TFile*, Mode>>::const_iterator itr; - for ( const auto& f : m_files ) { - TFile* tf = f.second.first; - -#ifndef NDEBUG - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "stream: " << f.first << " name: " << tf->GetName() << " size: " << tf->GetSize() << endmsg; - } -#endif - - // Signal job to terminate if output file is too large - if ( tf->GetSize() > mfs ) { - - signaledStop = true; - - fatal() << "file \"" << tf->GetName() << "\" associated with stream \"" << f.first - << "\" has exceeded the max file size of " << m_maxFileSize.value() << "MB. Terminating Job." << endmsg; - - IEventProcessor* evt = nullptr; - if ( service( "ApplicationMgr", evt, true ).isSuccess() ) { - evt->stopRun(); - evt->release(); - } else { - abort(); - } - } else if ( tf->GetSize() > mfs_warn ) { - warning() << "file \"" << tf->GetName() << "\" associated with stream \"" << f.first - << "\" is at 95% of its maximum allowable file size of " << m_maxFileSize.value() << "MB" << endmsg; - } - } -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -/** helper function to recursively copy the layout of a TFile into a new TFile - */ -void THistSvc::copyFileLayout( TDirectory* dst, TDirectory* src ) -{ - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "copyFileLayout() to dst path: " << dst->GetPath() << endmsg; - } - - // strip out URLs - TString path( (char*)strstr( dst->GetPath(), ":" ) ); - path.Remove( 0, 2 ); - - src->cd( path ); - TDirectory* cur_src_dir = gDirectory; - - // loop over all keys in this directory - TList* key_list = cur_src_dir->GetListOfKeys(); - int n = key_list->GetEntries(); - for ( int j = 0; j < n; ++j ) { - TKey* k = (TKey*)key_list->At( j ); - const std::string src_pathname = cur_src_dir->GetPath() + std::string( "/" ) + k->GetName(); - TObject* o = src->Get( src_pathname.c_str() ); - - if ( o && o->IsA()->InheritsFrom( "TDirectory" ) ) { - if ( msgLevel( MSG::VERBOSE ) ) { - verbose() << " subdir [" << o->GetName() << "]..." << endmsg; - } - dst->cd(); - TDirectory* dst_dir = dst->mkdir( o->GetName(), o->GetTitle() ); - copyFileLayout( dst_dir, src ); - } - } // loop over keys - return; -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// -/** @brief callback method to reinitialize the internal state of - * the component for I/O purposes (e.g. upon @c fork(2)) - */ -StatusCode THistSvc::io_reinit() -{ - bool all_good = true; - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "reinitializing I/O..." << endmsg; - } - - // retrieve the I/O component manager... - - IIoComponentMgr* iomgr = nullptr; - - if ( service( "IoComponentMgr", iomgr, true ).isFailure() ) { - error() << "could not retrieve I/O component manager !" << endmsg; - return StatusCode::FAILURE; - } - - GlobalDirectoryRestore restore( m_svcMut ); - // to hide the expected errors upon closing the files whose - // file descriptors have been swept under the rug... - gErrorIgnoreLevel = kFatal; - - for ( auto& ifile : m_files ) { - TFile* f = ifile.second.first; - std::string fname = f->GetName(); - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "file [" << fname << "] mode: [" << f->GetOption() << "] r:" << f->GetFileBytesRead() - << " w:" << f->GetFileBytesWritten() << " cnt:" << f->GetFileCounter() << endmsg; - } - - if ( ifile.second.second == READ ) { - if ( msgLevel( MSG::DEBUG ) ) { - debug() << " TFile opened in READ mode: not reassigning names" << endmsg; - } - continue; - } - - if ( !iomgr->io_retrieve( this, fname ).isSuccess() ) { - error() << "could not retrieve new name for [" << fname << "] !!" << endmsg; - all_good = false; - continue; - } else { - if ( msgLevel( MSG::DEBUG ) ) { - debug() << "got a new name [" << fname << "]..." << endmsg; - } - } - - void* vf; - Option_t* opts = f->GetOption(); - int r = p_fileMgr->open( Io::ROOT, name(), fname, Io::WRITE, vf, "HIST" ); - if ( r != 0 ) { - error() << "unable to open file \"" << fname << "\" for writing" << endmsg; - return StatusCode::FAILURE; - } - TFile* newfile = (TFile*)vf; - newfile->SetOption( opts ); - - if ( ifile.second.second != THistSvc::READ ) { - copyFileLayout( newfile, f ); - ifile.second.first = newfile; - } - - // loop over all uids and migrate them to the new file - // XXX FIXME: this double loop sucks... - for ( auto& uid : m_uidsX ) { - THistID& hid = uid.second; - if ( hid.file != f ) continue; - TDirectory* olddir = this->changeDir( hid ); - hid.file = newfile; - // side-effect: create needed directories... - TDirectory* newdir = this->changeDir( hid ); - TClass* cl = hid.obj->IsA(); - - // migrate the objects to the new file. - // thanks to the object model of ROOT, it is super easy. - if ( cl->InheritsFrom( "TTree" ) ) { - dynamic_cast<TTree*>( hid.obj )->SetDirectory( newdir ); - dynamic_cast<TTree*>( hid.obj )->Reset(); - } else if ( cl->InheritsFrom( "TH1" ) ) { - dynamic_cast<TH1*>( hid.obj )->SetDirectory( newdir ); - dynamic_cast<TH1*>( hid.obj )->Reset(); - } else if ( cl->InheritsFrom( "TGraph" ) ) { - olddir->Remove( hid.obj ); - newdir->Append( hid.obj ); + mytree->CloneTree(); + } else { - error() << "id: \"" << hid.id << "\" is not a inheriting from a class " - << "we know how to handle (received [" << cl->GetName() << "], " - << "expected [TTree, TH1 or TGraph]) !" << endmsg << "attaching to current dir [" << newdir->GetPath() - << "] " - << "nonetheless..." << endmsg; - olddir->Remove( hid.obj ); - newdir->Append( hid.obj ); + target->cd(); + obj->Write( key->GetName() ); } } - f->ReOpen( "READ" ); - p_fileMgr->close( f, name() ); - f = newfile; } - - return all_good ? StatusCode::SUCCESS : StatusCode::FAILURE; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::rootOpenAction( const Io::FileAttr* fa, const std::string& caller ) +bool THistSvc::findStream( const std::string& id, std::string& stream, std::string& rem, TFile*& file ) const { - if ( fa->tech() != Io::ROOT ) { - // This should never happen - return StatusCode::SUCCESS; - } + auto pos = id.find( "/" ); - if ( fa->desc() != "HIST" ) { - return StatusCode::SUCCESS; + if ( pos == std::string::npos ) { + // no "/" in id + stream = "temp"; + rem = id; + } else if ( pos != 0 ) { + // id does not start with "/" + stream = "temp"; + rem = id; + } else { + // id starts with "/" + + auto pos2 = id.find( "/", pos + 1 ); + + if ( pos2 == std::string::npos ) { + // need at least 2 "/" in format "/STREAM/name" or "/STREAM/dir/name" + error() << "badly formed Hist/Tree id: \"" << id << "\"" << endmsg; + return false; + } + parseString( id, stream, rem ); } - p_incSvc->fireIncident( FileIncident( caller, "OpenHistFile", fa->name() ) ); + if ( stream == "temp" ) { + file = nullptr; + return true; + } - if ( fa->flags().isRead() ) { - p_incSvc->fireIncident( FileIncident( caller, "BeginHistFile", fa->name() ) ); - } else if ( fa->flags().isWrite() ) { - p_incSvc->fireIncident( FileIncident( caller, IncidentType::BeginOutputFile, fa->name() ) ); - } else { - // for Io::RW - p_incSvc->fireIncident( FileIncident( caller, IncidentType::BeginOutputFile, fa->name() ) ); + auto itr = m_files.find( stream ); + file = ( itr != m_files.end() ? itr->second.first : nullptr ); + if ( !file ) { + warning() << "no stream \"" << stream << "\" associated with id: \"" << id << "\"" << endmsg; } - return StatusCode::SUCCESS; + return true; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -StatusCode THistSvc::rootOpenErrAction( const Io::FileAttr* fa, const std::string& caller ) +void THistSvc::parseString( const std::string& id, std::string& root, std::string& rem ) const { - if ( fa->tech() != Io::ROOT ) { - // This should never happen - return StatusCode::SUCCESS; + auto pos = id.find( "/" ); + + if ( pos == std::string::npos ) { + root.clear(); + rem = id; + } else if ( pos == 0 ) { + parseString( id.substr( 1 ), root, rem ); + } else { + root = id.substr( 0, pos ); + rem = id.substr( pos + 1 ); } +} - if ( fa->desc() != "HIST" ) { - return StatusCode::SUCCESS; +void THistSvc::setupInputFile( Gaudi::Details::PropertyBase& + /*m_inputfile*/ ) +{ + if ( FSMState() < Gaudi::StateMachine::CONFIGURED || !m_okToConnect ) { + debug() << "Delaying connection of Input Files until Initialize" + << ". now in " << FSMState() << endmsg; + + m_delayConnect = true; + } else { + debug() << "Now connecting of Input Files" << endmsg; + + StatusCode sc = StatusCode::SUCCESS; + + for ( const auto& itr : m_inputfile.value() ) { + if ( m_alreadyConnectedInFiles.end() != m_alreadyConnectedInFiles.find( itr ) ) { + continue; + } + if ( connect( itr ).isFailure() ) { + sc = StatusCode::FAILURE; + } else { + m_alreadyConnectedInFiles.insert( itr ); + } + } + + if ( !sc.isSuccess() ) { + throw GaudiException( "Problem connecting inputfile !!", name(), StatusCode::FAILURE ); + } } +} - if ( fa->flags().isRead() ) { - p_incSvc->fireIncident( FileIncident( caller, IncidentType::FailInputFile, fa->name() ) ); - } else if ( fa->flags().isWrite() ) { - p_incSvc->fireIncident( FileIncident( caller, IncidentType::FailOutputFile, fa->name() ) ); +void THistSvc::setupOutputFile( Gaudi::Details::PropertyBase& + /*m_outputfile*/ ) +{ + if ( FSMState() < Gaudi::StateMachine::CONFIGURED || !m_okToConnect ) { + debug() << "Delaying connection of Input Files until Initialize" + << ". now in " << FSMState() << endmsg; + m_delayConnect = true; } else { - // for Io::RW - p_incSvc->fireIncident( FileIncident( caller, "FailRWFile", fa->name() ) ); + StatusCode sc = StatusCode::SUCCESS; + for ( const auto& itr : m_outputfile.value() ) { + if ( m_alreadyConnectedOutFiles.end() != m_alreadyConnectedOutFiles.find( itr ) ) { + continue; + } + if ( connect( itr ).isFailure() ) { + sc = StatusCode::FAILURE; + } else { + m_alreadyConnectedOutFiles.insert( itr ); + } + } + + if ( !sc.isSuccess() ) { + throw GaudiException( "Problem connecting outputfile !!", name(), StatusCode::FAILURE ); + } } +} - return StatusCode::SUCCESS; +void THistSvc::setupCompressionLevel( Gaudi::Details::PropertyBase& + /* cl */ ) +{ + warning() << "\"CompressionLevel\" Property has been deprecated. " + << "Set it via the \"CL=\" parameter in the \"Output\" Property" << endmsg; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// +void THistSvc::copyFileLayout( TDirectory* destination, TDirectory* source ) +{ + if ( msgLevel( MSG::DEBUG ) ) { + debug() << "copyFileLayout() to destination path: " << destination->GetPath() << endmsg; + } + + // strip out URLs + TString path( (char*)strstr( destination->GetPath(), ":" ) ); + path.Remove( 0, 2 ); + + source->cd( path ); + TDirectory* current_source_dir = gDirectory; + + // loop over all keys in this directory + TList* key_list = current_source_dir->GetListOfKeys(); + int n = key_list->GetEntries(); + for ( int j = 0; j < n; ++j ) { + TKey* k = (TKey*)key_list->At( j ); + const std::string source_pathname = current_source_dir->GetPath() + std::string( "/" ) + k->GetName(); + TObject* o = source->Get( source_pathname.c_str() ); + + if ( o && o->IsA()->InheritsFrom( "TDirectory" ) ) { + if ( msgLevel( MSG::VERBOSE ) ) { + verbose() << " subdir [" << o->GetName() << "]..." << endmsg; + } + destination->cd(); + TDirectory* destination_dir = destination->mkdir( o->GetName(), o->GetTitle() ); + copyFileLayout( destination_dir, source ); + } + } // loop over keys + return; +} size_t THistSvc::findHistID( const std::string& id, const THistID*& hid, const size_t& index ) const { @@ -1869,44 +1880,9 @@ size_t THistSvc::findHistID( const std::string& id, const THistID*& hid, const s } } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - -LockedHandle<TH1> THistSvc::regSharedHist( const std::string& id, std::unique_ptr<TH1> hist ) -{ - return regSharedObj_i<TH1>( id, std::move( hist ) ); -} - -LockedHandle<TH2> THistSvc::regSharedHist( const std::string& id, std::unique_ptr<TH2> hist ) -{ - return regSharedObj_i<TH2>( id, std::move( hist ) ); -} - -LockedHandle<TH3> THistSvc::regSharedHist( const std::string& id, std::unique_ptr<TH3> hist ) -{ - return regSharedObj_i<TH3>( id, std::move( hist ) ); -} - -LockedHandle<TGraph> THistSvc::regSharedGraph( const std::string& id, std::unique_ptr<TGraph> hist ) -{ - return regSharedObj_i<TGraph>( id, std::move( hist ) ); -} - -LockedHandle<TH1> THistSvc::getSharedHistTH1( const std::string& name ) const { return getSharedObj_i<TH1>( name ); } - -LockedHandle<TH2> THistSvc::getSharedHistTH2( const std::string& name ) const { return getSharedObj_i<TH2>( name ); } - -LockedHandle<TH3> THistSvc::getSharedHistTH3( const std::string& name ) const { return getSharedObj_i<TH3>( name ); } - -LockedHandle<TGraph> THistSvc::getSharedGraph( const std::string& name ) const -{ - return getSharedObj_i<TGraph>( name ); -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - void THistSvc::dump() const { - ostringstream ost; + std::ostringstream ost; // list< vector<THistID> > ost << "m_hlist: size: " << m_hlist.size() << "\n"; @@ -1923,14 +1899,14 @@ void THistSvc::dump() const ost << "\n" << "m_uids: " << m_uids.size() << "\n"; for ( auto& e : m_uids ) { - ost << " - " << e.first << " [" << e.second << "]" << endl; + ost << " - " << e.first << " [" << e.second << "]" << std::endl; } // multimap id -> vector<THistID>* ost << "\n" << "m_ids: " << m_ids.size() << "\n"; for ( auto& e : m_ids ) { - ost << " - " << e.first << " [" << e.second << "]" << endl; + ost << " - " << e.first << " [" << e.second << "]" << std::endl; } // map TObject* -> THistID* @@ -1939,47 +1915,14 @@ void THistSvc::dump() const for ( auto& e : m_tobjs ) { TObject* o = e.first; THistID& i = e.second.first->at( e.second.second ); - ost << " - " << o << " -> " << i << endl; + ost << " - " << o << " -> " << i << std::endl; } debug() << "dumping THistSvc contents\n" << ost.str() << endmsg; } -void THistSvc::dumpVHID( const vhid_t* vi ) const -{ - debug() << "vHID: " << vi << " [" << vi->size() << "]"; - for ( auto& e : *vi ) { - debug() << " " << &e; - } - debug() << endmsg; -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - StatusCode THistSvc::merge( const THistID& hid ) { return merge( hid.id ); } -StatusCode THistSvc::merge( TObject* obj ) -{ - objMap_t::iterator itr = m_tobjs.find( obj ); - if ( itr != m_tobjs.end() ) { - return merge( itr->second.first ); - } else { - error() << "merge: unknown object " << obj << endmsg; - return StatusCode::FAILURE; - } -} - -StatusCode THistSvc::merge( const std::string& name ) -{ - uidMap_t::iterator itr = m_uids.find( name ); - if ( itr == m_uids.end() ) { - error() << "merge: id \"" << name << "\" not found" << endmsg; - return StatusCode::FAILURE; - } - - return merge( itr->second ); -} - StatusCode THistSvc::merge( vhid_t* vh ) { const std::string& name = vh->at( 0 ).id; @@ -2022,3 +1965,51 @@ StatusCode THistSvc::merge( vhid_t* vh ) } return StatusCode::SUCCESS; } + +StatusCode THistSvc::rootOpenAction( const Io::FileAttr* fa, const std::string& caller ) +{ + if ( fa->tech() != Io::ROOT ) { + // This should never happen + return StatusCode::SUCCESS; + } + + if ( fa->desc() != "HIST" ) { + return StatusCode::SUCCESS; + } + + p_incSvc->fireIncident( FileIncident( caller, "OpenHistFile", fa->name() ) ); + + if ( fa->flags().isRead() ) { + p_incSvc->fireIncident( FileIncident( caller, "BeginHistFile", fa->name() ) ); + } else if ( fa->flags().isWrite() ) { + p_incSvc->fireIncident( FileIncident( caller, IncidentType::BeginOutputFile, fa->name() ) ); + } else { + // for Io::RW + p_incSvc->fireIncident( FileIncident( caller, IncidentType::BeginOutputFile, fa->name() ) ); + } + + return StatusCode::SUCCESS; +} + +StatusCode THistSvc::rootOpenErrAction( const Io::FileAttr* fa, const std::string& caller ) +{ + if ( fa->tech() != Io::ROOT ) { + // This should never happen + return StatusCode::SUCCESS; + } + + if ( fa->desc() != "HIST" ) { + return StatusCode::SUCCESS; + } + + if ( fa->flags().isRead() ) { + p_incSvc->fireIncident( FileIncident( caller, IncidentType::FailInputFile, fa->name() ) ); + } else if ( fa->flags().isWrite() ) { + p_incSvc->fireIncident( FileIncident( caller, IncidentType::FailOutputFile, fa->name() ) ); + } else { + // for Io::RW + p_incSvc->fireIncident( FileIncident( caller, "FailRWFile", fa->name() ) ); + } + + return StatusCode::SUCCESS; +} diff --git a/GaudiSvc/src/THistSvc/THistSvc.h b/GaudiSvc/src/THistSvc/THistSvc.h index 64533cadf3bd3a0c12ad4acc8d61c59a4a69d470..b89b219c1d490863f062c56530d1567652a7f06a 100644 --- a/GaudiSvc/src/THistSvc/THistSvc.h +++ b/GaudiSvc/src/THistSvc/THistSvc.h @@ -1,6 +1,13 @@ #ifndef GAUDISVC_THISTSVC_H #define GAUDISVC_THISTSVC_H +// system includes: +#include <map> +#include <set> +#include <string> +#include <vector> + +// Gaudi includes: #include "GaudiKernel/IFileMgr.h" #include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/IIoComponent.h" @@ -8,6 +15,7 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/Service.h" +//Â ROOT includes: #include "TGraph.h" #include "TH1.h" #include "TH2.h" @@ -16,47 +24,118 @@ #include "TObject.h" #include "TTree.h" -#include <map> -#include <set> -#include <string> -#include <vector> - class IIncidentSvc; + class THistSvc : public extends<Service, ITHistSvc, IIncidentListener, IIoComponent> { public: + THistSvc( const std::string& name, ISvcLocator* svc ); + StatusCode initialize() override; StatusCode reinitialize() override; StatusCode finalize() override; - StatusCode regHist( const std::string& name ) override; - StatusCode regHist( const std::string& name, std::unique_ptr<TH1> ) override; - - TH1* getHistTH1( const std::string& name, size_t ind = 0 ) const override; - TH2* getHistTH2( const std::string& name, size_t ind = 0 ) const override; - TH3* getHistTH3( const std::string& name, size_t ind = 0 ) const override; - - LockedHandle<TH1> regSharedHist( const std::string& name, std::unique_ptr<TH1> ) override; - LockedHandle<TH2> regSharedHist( const std::string& name, std::unique_ptr<TH2> ) override; - LockedHandle<TH3> regSharedHist( const std::string& name, std::unique_ptr<TH3> ) override; - - LockedHandle<TH1> getSharedHistTH1( const std::string& name ) const override; - LockedHandle<TH2> getSharedHistTH2( const std::string& name ) const override; - LockedHandle<TH3> getSharedHistTH3( const std::string& name ) const override; +public: + // Methods from ITHistSvc + /// @name Functions to manage ROOT histograms of any kind + /// @{ + /// Register a new ROOT histogram TH*X with a name + StatusCode regHist( const std::string& name ) override; + /// 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 + StatusCode regHist( const std::string& name, std::unique_ptr<TH1> hist ) override; + /// 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; + /// @deprecated {Just for compatibility purposes. Ownership should be clearly managed.} + /// Register an existing ROOT histogram TH*X with name and pointer + StatusCode regHist( const std::string& name, TH1* ) override; + + /// Return histogram with given name as TH1*, THistSvcMT still owns object. + StatusCode getHist( const std::string& name, TH1*&, size_t index = 0 ) const override; + /// Return histogram with given name as TH2*, THistSvcMT still owns object. + StatusCode getHist( const std::string& name, TH2*&, size_t index = 0 ) const override; + /// Return histogram with given name as TH3*, THistSvcMT still owns object. + StatusCode getHist( const std::string& name, TH3*&, size_t index = 0 ) const override; + + /// @} + + /// @name Functions to manage TTrees + /// @{ + + /// Register a new TTree with a given name StatusCode regTree( const std::string& name ) override; + /// Register an existing TTree with a given name and moved unique_ptr StatusCode regTree( const std::string& name, std::unique_ptr<TTree> ) override; - TTree* getTree( const std::string& name ) const override; + /// @deprecated {Just kept for compatibiltiy to current ATLAS code. Pleas use std::unique_ptrs instead!} + /// Register a new TTree with a given name and a raw pointer + StatusCode regTree( const std::string& name, TTree* ) override; + /// Return TTree with given name + StatusCode getTree( const std::string& name, TTree*& ) const override; + /// @} + + /// @name Functions to manage TGraphs + /// @{ + + /// Register a new TGraph with a given name StatusCode regGraph( const std::string& name ) override; + /// Register an existing TGraph with a given name and moved unique_ptr StatusCode regGraph( const std::string& name, std::unique_ptr<TGraph> ) override; - TGraph* getGraph( const std::string& name ) const override; + /// @deprecated {Just kept for compatibiltiy to current ATLAS code. Pleas use std::unique_ptrs instead!} + /// Register a new TGraph with a given name and a raw pointer + virtual StatusCode regGraph( const std::string& name, TGraph* ) override; + /// Return TGraph with given name + StatusCode getGraph( const std::string& name, TGraph*& ) const override; + + /// @} + + /// @name Functions managing shared objects + /// @{ + + /// Register shared object of type TH1 and return LockedHandle for that object + StatusCode regShared( const std::string& name, std::unique_ptr<TH1>, LockedHandle<TH1>& ) override; + /// Register shared object of type TH2 and return LockedHandle for that object + StatusCode regShared( const std::string& name, std::unique_ptr<TH2>, LockedHandle<TH2>& ) override; + /// Register shared object of type TH3 and return LockedHandle for that object + StatusCode regShared( const std::string& name, std::unique_ptr<TH3>, LockedHandle<TH3>& ) override; + /// Register shared object of type TGraph and return LockedHandle for that object + StatusCode regShared( const std::string& name, std::unique_ptr<TGraph>, LockedHandle<TGraph>& ) override; + /// Retrieve shared object with given name as TH1 through LockedHandle + StatusCode getShared( const std::string& name, LockedHandle<TH1>& ) const override; + /// Retrieve shared object with given name as TH2 through LockedHandle + StatusCode getShared( const std::string& name, LockedHandle<TH2>& ) const override; + /// Retrieve shared object with given name as TH3 through LockedHandle + StatusCode getShared( const std::string& name, LockedHandle<TH3>& ) const override; + /// Retrieve shared object with given name as TGraph through LockedHandle + StatusCode getShared( const std::string& name, LockedHandle<TGraph>& ) const override; + + /// @} + + /// @name Functions that work on any TObject in the THistSvcMT + /// @{ + + /// Deregister object with given name and give up ownership (without deletion!) + StatusCode deReg( const std::string& name ) override; + /// Deregister obejct identified by TObject* and give up ownership (without deletion!) + StatusCode deReg( TObject* obj ) override; - LockedHandle<TGraph> regSharedGraph( const std::string& name, std::unique_ptr<TGraph> ) override; - LockedHandle<TGraph> getSharedGraph( const std::string& name ) const override; + /// Merge all clones for object with a given id + StatusCode merge( const std::string& id ) override; + /// Merge all clones for given TObject* + StatusCode merge( TObject* ) override; - StatusCode deReg( TObject* obj ) override; - StatusCode deReg( const std::string& name ) override; + /// Check if object with given name is managed by THistSvcMT + bool exists( const std::string& name ) const override; + + /// @} + + /// @name Functions returning lists of all histograms, trees and graphs + /// @{ std::vector<std::string> getHists() const override; std::vector<std::string> getTrees() const override; @@ -64,34 +143,32 @@ public: StatusCode getTHists( TDirectory* td, TList&, bool recurse = false ) const override; StatusCode getTHists( const std::string& name, TList&, bool recurse = false ) const override; - StatusCode getTHists( TDirectory* td, TList& tl, bool recurse = false, bool reg = false ) override; StatusCode getTHists( const std::string& name, TList& tl, bool recurse = false, bool reg = false ) override; StatusCode getTTrees( TDirectory* td, TList&, bool recurse = false ) const override; StatusCode getTTrees( const std::string& name, TList&, bool recurse = false ) const override; - StatusCode getTTrees( TDirectory* td, TList& tl, bool recurse = false, bool reg = false ) override; StatusCode getTTrees( const std::string& name, TList& tl, bool recurse = false, bool reg = false ) override; - bool exists( const std::string& name ) const override; - - THistSvc( const std::string& name, ISvcLocator* svc ); + /// @} +public: + // Methods from other interfaces + // From IIncidentListener void handle( const Incident& ) override; // From IIoComponent StatusCode io_reinit() override; - StatusCode merge( const std::string& id ) override; - StatusCode merge( TObject* ) override; - protected: ~THistSvc() override = default; private: typedef std::recursive_mutex THistSvcMutex_t; + typedef std::mutex histMut_t; + /// Helper class that manages ROOts global directory and file class GlobalDirectoryRestore { public: @@ -99,16 +176,16 @@ private: ~GlobalDirectoryRestore(); private: - TDirectory* m_gd; - TFile* m_gf; - int m_ge; + TDirectory* m_gDirectory; + TFile* m_gFile; + int m_gErrorIgnoreLevel; std::lock_guard<THistSvcMutex_t> m_lock; }; + /// Enumerating all possible file access modes enum Mode { READ, WRITE, UPDATE, APPEND, SHARE, INVALID }; - typedef std::mutex histMut_t; - + /// Helper struct that bundles the histogram ID with a mutex, TFile and TObject* struct THistID { std::string id{""}; bool temp{true}; @@ -147,6 +224,55 @@ private: } }; + /// @name Container definitions + /// @{ + + std::vector<std::string> m_Rstream, m_Wstream; + + /// list of already connected files. This is to keep track of files + /// registered by the setupInputFile callback method + std::set<std::string> m_alreadyConnectedInFiles; + + /// list of already connected files. This is to keep track of files + /// registered by the setupOutputFile callback method + std::set<std::string> m_alreadyConnectedOutFiles; + + typedef std::map<std::string, THistID> uidXMap; + typedef std::multimap<std::string, THistID> idXMap; + typedef std::multimap<std::string, std::string> streamMap; + + uidXMap m_uidsX; + idXMap m_idsX; + + // containers for fast lookups + // same uid for all elements in vec + typedef std::vector<THistID> vhid_t; + // all THistIDs + typedef std::list<vhid_t*> hlist_t; + // uid: /stream/name -> vhid + typedef std::unordered_map<std::string, vhid_t*> uidMap_t; + // name -> vhid + typedef std::unordered_multimap<std::string, vhid_t*> idMap_t; + typedef std::unordered_map<TObject*, std::pair<vhid_t*, size_t>> objMap_t; + + hlist_t m_hlist; + uidMap_t m_uids; + idMap_t m_ids; + + // Container holding all TObjects and vhid*s + objMap_t m_tobjs; + + std::map<std::string, std::pair<TFile*, Mode>> m_files; // stream->file + streamMap m_fileStreams; // fileName->streams + + // stream->filename of shared files + std::map<std::string, std::string> m_sharedFiles; + + /// @} + + /// @name Templated helper functions to register and retrieve Histograms and TObjects + /// @{ + template <typename T> StatusCode regHist_i( std::unique_ptr<T> hist, const std::string& name, bool shared ); template <typename T> @@ -157,25 +283,29 @@ private: T* readHist_i( const std::string& name ) const; template <typename T> - LockedHandle<T> regSharedObj_i( const std::string& id, std::unique_ptr<T> hist ); + LockedHandle<T> regShared_i( const std::string& id, std::unique_ptr<T> hist ); template <typename T> - LockedHandle<T> getSharedObj_i( const std::string& name ) const; + LockedHandle<T> getShared_i( const std::string& name ) const; + + /// @} + + /// @name Collection of private helper methods + /// @{ template <typename T> T* readHist( const std::string& name ) const; TTree* readTree( const std::string& name ) const; + /// Handle case where TTree grows beyond TTree::fgMaxTreeSize void updateFiles(); - StatusCode write(); + StatusCode writeObjectsToFile(); StatusCode connect( const std::string& ); TDirectory* changeDir( const THistSvc::THistID& hid ) const; - std::string dirname( std::string& dir ) const; + std::string stripDirectoryName( std::string& dir ) const; void removeDoubleSlash( std::string& ) const; void MergeRootFile( TDirectory*, TDirectory* ); - bool browseTDir( TDirectory* dir ) const; - bool findStream( const std::string& name, std::string& root, std::string& rem, TFile*& file ) const; void parseString( const std::string& id, std::string& root, std::string& rem ) const; @@ -187,84 +317,50 @@ private: void setupCompressionLevel( Gaudi::Details::PropertyBase& cmp ); + /// helper function to recursively copy the layout of a TFile into a new TFile void copyFileLayout( TDirectory*, TDirectory* ); size_t findHistID( const std::string& id, const THistID*& hid, const size_t& index = 0 ) const; void dump() const; - //////// + /// Helper method to merge THistID objects + StatusCode merge( const THistID& ); + /// Helper method to merge vectors of THistID + StatusCode merge( vhid_t* ); + + StatusCode rootOpenAction( FILEMGR_CALLBACK_ARGS ); + StatusCode rootOpenErrAction( FILEMGR_CALLBACK_ARGS ); + + /// @} + + /// @name Gaudi properties + /// @{ Gaudi::Property<int> m_autoSave{this, "AutoSave", 0}; Gaudi::Property<int> m_autoFlush{this, "AutoFlush", 0}; Gaudi::Property<bool> m_print{this, "PrintAll", false}; - Gaudi::Property<int> m_maxFileSize{this, "MaxFileSize", 10240, - "maximum file size in MB. if exceeded, will cause an abort. -1 to never check."}; + Gaudi::Property<int> m_maxFileSize{this, "MaxFileSize", 10240, "maximum file size in MB. if exceeded," + " will cause an abort. -1 to never check."}; Gaudi::Property<int> m_compressionLevel{this, "CompressionLevel", 1}; Gaudi::Property<std::vector<std::string>> m_outputfile{this, "Output", {}}; Gaudi::Property<std::vector<std::string>> m_inputfile{this, "Input", {}}; - std::vector<std::string> m_Rstream, m_Wstream; - - /// list of already connected files. This is to keep track of files - /// registered by the setupInputFile callback method - std::set<std::string> m_alreadyConnectedInFiles; - - /// list of already connected files. This is to keep track of files - /// registered by the setupOutputFile callback method - std::set<std::string> m_alreadyConnectedOutFiles; - - typedef std::map<std::string, THistID> uidXMap; - typedef std::multimap<std::string, THistID> idXMap; - typedef std::multimap<std::string, std::string> streamMap; - - uidXMap m_uidsX; - idXMap m_idsX; - - // containers for fast lookups - // same uid for all elements in vec - typedef std::vector<THistID> vhid_t; - // all THistIDs - typedef std::list<vhid_t*> hlist_t; - // uid: /stream/name -> vhid - typedef std::unordered_map<std::string, vhid_t*> uidMap_t; - // name -> vhid - typedef std::unordered_multimap<std::string, vhid_t*> idMap_t; - typedef std::unordered_map<TObject*, std::pair<vhid_t*, size_t>> objMap_t; - - hlist_t m_hlist; - uidMap_t m_uids; - idMap_t m_ids; - - objMap_t m_tobjs; - - std::map<std::string, std::pair<TFile*, Mode>> m_files; // stream->file - streamMap m_fileStreams; // fileName->streams - - // stream->filename of shared files - std::map<std::string, std::string> m_sharedFiles; - - bool signaledStop = false; - bool m_delayConnect = false, m_okToConnect = false; - - mutable std::string m_curstream; - - mutable THistSvcMutex_t m_svcMut; + /// @} IIncidentSvc* p_incSvc = nullptr; IFileMgr* p_fileMgr = nullptr; - StatusCode rootOpenAction( FILEMGR_CALLBACK_ARGS ); - StatusCode rootOpenErrAction( FILEMGR_CALLBACK_ARGS ); + bool m_signaledStop = false; + bool m_delayConnect = false; + bool m_okToConnect = false; - void dumpVHID( const vhid_t* ) const; + mutable std::string m_curstream; - StatusCode merge( const THistID& ); - StatusCode merge( vhid_t* ); + mutable THistSvcMutex_t m_svcMut; }; -#ifndef GAUDISVC_THISTSVC_ICC +// Include template implementation #include "THistSvc.icc" -#endif -#endif +#endif // GAUDISVC_THISTSVC_H diff --git a/GaudiSvc/src/THistSvc/THistSvc.icc b/GaudiSvc/src/THistSvc/THistSvc.icc index deb1f79b16d6837b51a8ed1632a9aa1e8f9aa665..6c34454bbc45b8fadc0f7bc7efc8ebbb670f0731 100644 --- a/GaudiSvc/src/THistSvc/THistSvc.icc +++ b/GaudiSvc/src/THistSvc/THistSvc.icc @@ -1,17 +1,24 @@ #ifndef GAUDISVC_THISTSVC_ICC #define GAUDISVC_THISTSVC_ICC +#include <map> +#include <string> + +#include "TFile.h" +#include "TObject.h" + #ifndef GAUDIKERNEL_MSGSTREAM_H #include "GaudiKernel/MsgStream.h" #endif #include "GaudiKernel/System.h" -#include <map> -#include <string> - -#include "TFile.h" -#include "TObject.h" +template <typename T> +StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist, const std::string& id, bool shared ) +{ + THistID* hid = nullptr ; + return regHist_i( std::move(hist), id, shared, hid ); +} template <typename T> StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist_unique, const std::string& id, bool shared, THistID*& phid ) @@ -161,15 +168,6 @@ StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist_unique, const std::strin return StatusCode::SUCCESS; } -template <typename T> -StatusCode THistSvc::regHist_i( std::unique_ptr<T> hist, const std::string& id, bool shared ) -{ - THistID* hid; - return regHist_i( std::move(hist), id, shared, hid ); -} - -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - template <typename T> T* THistSvc::getHist_i( const std::string& id, const size_t& ind, bool quiet ) const { @@ -178,7 +176,7 @@ T* THistSvc::getHist_i( const std::string& id, const size_t& ind, bool quiet ) c GlobalDirectoryRestore restore( m_svcMut ); T* hist = nullptr; - const THistID* hid; + const THistID* hid = nullptr; size_t num = findHistID( id, hid, ind ); if ( num == 0 ) { // no matches found @@ -213,8 +211,6 @@ T* THistSvc::getHist_i( const std::string& id, const size_t& ind, bool quiet ) c return hist; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - template <typename T> T* THistSvc::readHist_i( const std::string& id ) const { @@ -224,7 +220,7 @@ T* THistSvc::readHist_i( const std::string& id ) const removeDoubleSlash( idr ); std::string stream, rem, dir, fdir, bdir, fdir2; - TFile* file; + TFile* file = nullptr; if ( !findStream( idr, stream, rem, file ) ) { return nullptr; @@ -238,9 +234,9 @@ T* THistSvc::readHist_i( const std::string& id ) const file->cd( "/" ); fdir = idr; - bdir = dirname( fdir ); + bdir = stripDirectoryName( fdir ); fdir2 = fdir; - while ( ( dir = dirname( fdir ) ) != "" ) { + while ( ( dir = stripDirectoryName( fdir ) ) != "" ) { if ( !gDirectory->GetKey( dir.c_str() ) ) { error() << "Directory \"" << fdir2 << "\" doesnt exist in " << file->GetName() << endmsg; return nullptr; @@ -272,16 +268,14 @@ T* THistSvc::readHist_i( const std::string& id ) const return hist; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - template <typename T> -LockedHandle<T> THistSvc::regSharedObj_i( const std::string& id, std::unique_ptr<T> hist ) +LockedHandle<T> THistSvc::regShared_i( const std::string& id, std::unique_ptr<T> hist ) { LockedHandle<T> lh( nullptr, nullptr ); - const THistID* hid; + const THistID* hid = nullptr; if ( findHistID( id, hid ) == 0 ) { T* phist = hist.get(); - THistID* phid; + THistID* phid = nullptr; if ( regHist_i( std::move(hist), id, true, phid ).isSuccess() ) { lh.set( phist, phid->mutex ); @@ -309,14 +303,12 @@ LockedHandle<T> THistSvc::regSharedObj_i( const std::string& id, std::unique_ptr return lh; } -//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// - template <typename T> -LockedHandle<T> THistSvc::getSharedObj_i( const std::string& name ) const +LockedHandle<T> THistSvc::getShared_i( const std::string& name ) const { GlobalDirectoryRestore restore( m_svcMut ); - const THistID* hid; + const THistID* hid = nullptr; size_t i = findHistID( name, hid ); LockedHandle<T> hist( nullptr, nullptr ); @@ -339,4 +331,4 @@ LockedHandle<T> THistSvc::getSharedObj_i( const std::string& name ) const return hist; } -#endif +#endif // GAUDISVC_THISTSVC_ICC