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 );
virtual const std::string * par() const =0
Retrieve String parameters.
Definition of the MsgStream class used to transmit messages.
IRegistry * registry() const
Get pointer to Registry.
void setDirectory(const std::string &loc)
constexpr static const auto SUCCESS
#define DECLARE_CONVERTER(x)
StatusCode createRep(DataObject *pObj, IOpaqueAddress *&refpAddr) override
Convert the transient object to the requested representation.
StatusCode createDirectory(const std::string &loc)
This class is used for returning status codes from appropriate routines.
Create persistent and transient representations of data store directories.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
StatusCode fillObjRefs(IOpaqueAddress *pAddr, DataObject *refpObj) override
Update the transient object from the other representation.
constexpr static const auto FAILURE
StatusCode updateRep(IOpaqueAddress *pAddr, DataObject *pObject) override
Convert the transient object to the requested representation.
Small class representing an N tuple directory in the transient store.
virtual const id_type & identifier() const =0
Full identifier (or key)
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
StatusCode createAddress(DataObject *pObject, TDirectory *pDir, TObject *pTObject, IOpaqueAddress *&refpAddr)
Create address of the transient object according to the requested representation.
void setDiskDirectory(const std::string &loc)