24 #include <TDirectory.h>
32 #include <TProfile2D.h>
36 auto maybe_stol = [](
const std::string&
s ) -> std::optional<int> {
37 auto pos =
s.find_first_of(
"0123456789+-" );
38 if ( pos == std::string::npos )
return std::nullopt;
62 return createAddress( pObject, gDirectory,
nullptr, refpAddress );
64 refpAddress =
nullptr;
73 if ( createDirectory( loc ).isSuccess() ) {
88 findTFile( full, tf ).ignore();
92 TIter nextkey( gDirectory->GetListOfKeys() );
93 while ( TKey*
key = (TKey*)nextkey() ) {
95 TObject* obj =
key->ReadObj();
99 int idh = maybe_stol( sid ).value_or( 0 );
103 TClass* isa = obj->IsA();
104 if ( isa->InheritsFrom(
"TTree" ) ) {
105 createAddress( full, CLID_ColumnWiseTuple, idh, obj, pA ).ignore();
106 TTree* tree = (TTree*)obj;
110 }
else if ( isa->InheritsFrom(
"TDirectory" ) ) {
111 createAddress( full, CLID_NTupleDirectory, title, obj, pA ).ignore();
112 }
else if ( isa == TProfile::Class() ) {
113 createAddress( full, CLID_ProfileH, idh, obj, pA ).ignore();
115 }
else if ( isa == TProfile2D::Class() ) {
116 createAddress( full, CLID_ProfileH2, idh, obj, pA ).ignore();
118 }
else if ( isa == TH1C::Class() ) {
119 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
121 }
else if ( isa == TH1S::Class() ) {
122 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
124 }
else if ( isa == TH1I::Class() ) {
125 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
127 }
else if ( isa == TH1F::Class() ) {
128 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
130 }
else if ( isa == TH1D::Class() ) {
131 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
133 }
else if ( isa == TH2C::Class() ) {
134 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
136 }
else if ( isa == TH2S::Class() ) {
137 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
139 }
else if ( isa == TH2I::Class() ) {
140 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
142 }
else if ( isa == TH2F::Class() ) {
143 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
145 }
else if ( isa == TH2D::Class() ) {
146 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
148 }
else if ( isa == TH3C::Class() ) {
149 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
151 }
else if ( isa == TH3S::Class() ) {
152 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
154 }
else if ( isa == TH3I::Class() ) {
155 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
157 }
else if ( isa == TH3F::Class() ) {
158 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
160 }
else if ( isa == TH3D::Class() ) {
161 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
164 log <<
MSG::ERROR <<
"Encountered an unknown object with key: " << obj->GetName() <<
" in ROOT file " << fname
169 StatusCode sc = dataManager()->registerAddress( pReg, title, pA );