31 std::auto_ptr<PropertyMgr> pmgr (
new PropertyMgr() );
37 jobSvc->setMyProperties(
"RFileCnv",&*pmgr) );
50 unsigned long* ipar = (
unsigned long*)pAddress->
ipar();
51 char mode[2] = { char(ipar[1]), 0 };
53 std::string fname = pAddress->
par()[0];
54 std::string ooname = pAddress->
par()[1];
56 const std::string* spar = pAddress->
par();
58 std::string oname = spar[1].substr(spar[1].find(
"/",1)+1, spar[1].length());
62 static TROOT
root(
"root",
"ROOT I/O");
65 log <<
MSG::VERBOSE <<
"ROOT already initialized, debug = "
71 if ( mode[0] ==
'O' ) {
73 if (findTFile(ooname,rfile).isFailure()) {
75 log <<
MSG::INFO <<
"opening Root file \"" << fname <<
"\" for reading"
78 rfile = TFile::Open(fname.c_str(),
"READ");
79 if ( rfile != 0 && rfile->IsOpen() ) {
80 regTFile(ooname,rfile).ignore();
82 ipar[0] = (
unsigned long)rfile;
90 log <<
MSG::ERROR <<
"Couldn't open \"" << fname <<
"\" for reading"
96 log <<
MSG::DEBUG <<
"Root file \"" << fname <<
"\" already opened"
102 }
else if ( mode[0] ==
'U' ) {
104 log <<
MSG::INFO <<
"opening Root file \"" << fname <<
"\" for updating"
110 }
else if ( mode[0] ==
'N' ) {
112 log <<
MSG::INFO <<
"opening Root file \"" << fname <<
"\" for writing";
113 if ( !m_compLevel.empty() )
114 { log <<
", CompressionLevel='" << m_compLevel <<
"'"; }
117 rfile = TFile::Open( fname.c_str(),
"RECREATE",
"Gaudi Trees" );
118 if ( ! ( rfile && rfile->IsOpen() ) ) {
119 log <<
MSG::ERROR <<
"Could not open file " << fname <<
" for writing"
123 if ( !m_compLevel.empty() )
126 rfile->SetCompressionSettings(settings.
level());
129 regTFile(ooname,rfile).ignore();
133 ipar[0] = (
unsigned long)rfile;
164 std::string ooname = pAddress->
par()[1];
167 if ( pFile != 0 && pFile->
isOpen() ) {
169 unsigned long* ipar = (
unsigned long*)pAddress->
ipar();
170 if (findTFile(ooname,rfile).isFailure()) {
175 rfile->Write(0,TObject::kOverwrite);
virtual const std::string * par() const =0
Retrieve String parameters.
Definition of the MsgStream class used to transmit messages.
void setOpen(bool flag)
Set "open" flag.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual ~RFileCnv()
Standard destructor.
MSG::Level level()
Retrieve output level.
virtual StatusCode initialize()
Initialize the converter.
Property manager helper class.
IRegistry * registry() const
Get pointer to Registry.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)
Convert the transient object to the requested representation.
NTuple converter class definition.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Main interface for the JobOptions service.
GAUDI_API ISvcLocator * svcLocator()
bool isValid() const
Allow for check if smart pointer is valid.
Property * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
This class is used for returning status codes from appropriate routines.
Create persistent and transient representations of data store directories.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)
Create the transient representation of an object.
Simple class to decode a ROOT compression settings string, of the form '
:' into the integ...
bool isOpen() const
Access "open" flag.
std::string m_compLevel
Compression setting.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode initialize()
Initialise.
#define DECLARE_NAMESPACE_CONVERTER_FACTORY(n, x)
int level() const
Get the level.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
virtual const unsigned long * ipar() const =0
Access to generic link parameters.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Small class representing an N tuple file in the transient store.