14 #include "TDirectory.h" 22 #include "TProfile2D.h" 26 auto maybe_stol = [](
const std::string&
s ) -> std::optional<int> {
27 auto pos =
s.find_first_of(
"0123456789+-" );
28 if ( pos == std::string::npos )
return std::nullopt;
52 return createAddress( pObject, gDirectory,
nullptr, refpAddress );
54 refpAddress =
nullptr;
63 if ( createDirectory( loc ).isSuccess() ) {
78 findTFile( full, tf ).ignore();
82 TIter nextkey( gDirectory->GetListOfKeys() );
83 while ( TKey* key = (TKey*)nextkey() ) {
85 TObject* obj = key->ReadObj();
89 int idh = maybe_stol( sid ).value_or( 0 );
93 TClass* isa = obj->IsA();
94 if ( isa->InheritsFrom(
"TTree" ) ) {
95 createAddress( full, CLID_ColumnWiseTuple, idh, obj, pA ).ignore();
96 TTree* tree = (TTree*)obj;
100 }
else if ( isa->InheritsFrom(
"TDirectory" ) ) {
101 createAddress( full, CLID_NTupleDirectory, title, obj, pA ).ignore();
102 }
else if ( isa == TProfile::Class() ) {
103 createAddress( full, CLID_ProfileH, idh, obj, pA ).ignore();
105 }
else if ( isa == TProfile2D::Class() ) {
106 createAddress( full, CLID_ProfileH2, idh, obj, pA ).ignore();
108 }
else if ( isa == TH1C::Class() ) {
109 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
111 }
else if ( isa == TH1S::Class() ) {
112 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
114 }
else if ( isa == TH1I::Class() ) {
115 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
117 }
else if ( isa == TH1F::Class() ) {
118 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
120 }
else if ( isa == TH1D::Class() ) {
121 createAddress( full, CLID_H1D, idh, obj, pA ).ignore();
123 }
else if ( isa == TH2C::Class() ) {
124 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
126 }
else if ( isa == TH2S::Class() ) {
127 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
129 }
else if ( isa == TH2I::Class() ) {
130 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
132 }
else if ( isa == TH2F::Class() ) {
133 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
135 }
else if ( isa == TH2D::Class() ) {
136 createAddress( full, CLID_H2D, idh, obj, pA ).ignore();
138 }
else if ( isa == TH3C::Class() ) {
139 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
141 }
else if ( isa == TH3S::Class() ) {
142 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
144 }
else if ( isa == TH3I::Class() ) {
145 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
147 }
else if ( isa == TH3F::Class() ) {
148 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
150 }
else if ( isa == TH3D::Class() ) {
151 createAddress( full, CLID_H3D, idh, obj, pA ).ignore();
154 log <<
MSG::ERROR <<
"Encountered an unknown object with key: " << obj->GetName() <<
" in ROOT file " << fname
159 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)