1 #include "GaudiKernel/IFileMgr.h"
5 #include "TSSLSocket.h"
8 #include "GaudiKernel/MsgStream.h"
9 #include "boost/algorithm/string.hpp"
11 namespace ba = boost::algorithm;
16 const std::string&
c):
17 m_log(msg,
"RootFileHandler"), m_userProxy(p), m_certDir(c)
21 static TROOT
root(
"root",
"ROOT I/O");
31 const std::string& desc,
Io::Fd& fd,
void*& ptr) {
37 << f <<
"," << desc <<
")"
60 std::unique_ptr<TFile> tf;
62 if (ba::starts_with(n,
"https://",ba::is_iequal{}) ||
63 ba::starts_with(n,
"http://",ba::is_iequal{})) {
68 <<
"requested mode is: " << f
73 if (!
m_ssl_setup && ba::starts_with(n,
"https://",ba::is_iequal{}) ) {
77 <<
"Unable to setup TSSLSocket for ROOT TWebFile access over https"
84 tf.reset(
new TWebFile(n.c_str()));
85 }
catch (
const std::exception& Exception) {
87 <<
" file for reading: " << Exception.what() << std::endl
88 <<
" -> file probably corrupt." <<
endmsg;
92 <<
"\": probably corrupt" <<
endmsg;
96 if (tf && tf->IsZombie()) {
98 <<
"\": file does not exist or in not accessible" <<
endmsg;
107 tf.reset( TFile::Open(n.c_str(),opt.c_str()) );
108 }
catch (
const std::exception& Exception) {
110 <<
" file for reading: " << Exception.what() << std::endl
111 <<
" -> file probably corrupt." <<
endmsg;
115 <<
"\": probably corrupt" <<
endmsg;
121 if (!tf || !tf->IsOpen()) {
123 <<
"\" with options \"" << opt <<
"\"" <<
endmsg;
154 TFile* tf =
static_cast<TFile*
>(ptr);
158 }
catch (
const std::exception& Exception) {
160 <<
" file" << Exception.what()
164 m_log <<
MSG::ERROR <<
"Problems closing ROOT file \"" << tf->GetName()
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
MSG::Level level()
Retrieve output level.
Io::open_t openRootFile(const std::string &n, const Io::IoFlags &f, const std::string &desc, Io::Fd &fd, void *&ptr)
Io::close_t closeRootFile(void *ptr)
Io::reopen_t reopenRootFile(void *, const Io::IoFlags &)
virtual int outputLevel() const =0
Retrieve the current output level threshold.
The IMessage is the interface implemented by the message service.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
string opt
print 'Summary: %32s [s] d d steps'%(summary.protocol,summary.type,summary.nevt,len(summary.data),)
void setLevel(int level)
Update outputlevel.
RootFileHandler(IMessageSvc *, const std::string &userProxy, const std::string &certDir)