158 const char *ftitle =
"",
Int_t compress = 1,
177 TFile(
const char *fname,
Option_t *option=
"",
const char *ftitle=
"",
Int_t compress=1);
184 const char* name,
Int_t bufsize);
186 virtual void Delete(
const char *namecycle=
"");
190 virtual void Flush();
235 virtual void MakeProject(
const char *dirname,
const char *classes=
"*",
274 const char *ftitle =
"",
Int_t compress = 1,
277 const char *ftitle =
"",
Int_t compress = 1,
307 UInt_t buffersize = 1000000);
318 #define gFile (TFile::CurrentFile()) 320 #elif defined(__MAKECINT__) 342 fNetOpt(0), fFile(f) { }
345 fNetOpt(no), fFile(0) { }
356 const char *
GetOpt()
const {
return fOpt; }
virtual void Map()
List the contents of a file sequentially.
Long64_t GetRelOffset() const
virtual void DirWriteKeys(TDirectory *)
Bool_t fIsArchive
!True if this is a pure archive file
static ROOT::TRWSpinLock fgRwLock
!Read-write lock to protect global PID list
Bool_t fIsPcmFile
!True if the file is a ROOT pcm file.
Class describing an archive file containing multiple sub-files, like a ZIP or TAR archive...
virtual void DrawMap(const char *keys="*", Option_t *option="")
Draw map of objects in this file.
virtual Int_t Recover()
Attempt to recover file if not correctly closed.
TFileCacheRead * fCacheRead
!Pointer to the read cache (if any)
Char_t fUnits
Number of bytes for file pointers.
virtual Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
void operator=(const TFile &)
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
Long64_t fBEGIN
First used byte in file.
static Bool_t fgReadInfo
if true (default) ReadStreamerInfo is called when opening a file
virtual Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
Long64_t fBytesWrite
Number of bytes written to this file.
EAsyncOpenStatus
Asynchronous open request status.
virtual void FillBuffer(char *&buffer)
Encode file output buffer.
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
virtual Long64_t GetSeekInfo() const
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
Int_t fCompress
Compression level and algorithm.
TArchiveFile * GetArchive() const
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
static void IncrementFileCounter()
virtual void ReadFree()
Read the FREE linked list.
A cache when reading files over the network.
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
static TList * fgAsyncOpenRequests
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
This class represents a WWW compatible URL.
virtual void SetEND(Long64_t last)
virtual TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize)
Creates key for object and converts data to buffer.
Class holding info about the file being opened.
Bool_t TestBit(UInt_t f) const
static UInt_t fgOpenTimeout
Timeout for open operations in ms - 0 corresponds to blocking i/o.
TArrayC * GetClassIndex() const
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
virtual void DirWriteHeader(TDirectory *)
TObjArray * GetListOfProcessIDs() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
static void SetFileReadCalls(Int_t readcalls=0)
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
virtual void SetReadCalls(Int_t readcalls=0)
virtual Long64_t GetBytesWritten() const
Return the total number of bytes written so far to the file.
TFileOpenHandle(TFile *f)
static Bool_t ShrinkCacheFileDir(Long64_t shrinkSize, Long_t cleanupInteval=0)
Try to shrink the cache to the desired size.
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
Long64_t fBytesReadExtra
Number of extra bytes (overhead) read by the readahead buffer.
TList * fInfoCache
!Cached list of the streamer infos in this file
static void SetReadStreamerInfo(Bool_t readinfo=kTRUE)
Specify if the streamerinfos must be read at file opening.
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
TArchiveFile * fArchive
!Archive file from which we read this file
static void SetReadaheadSize(Int_t bufsize=256000)
Long64_t GetArchiveOffset() const
Int_t fNetOpt
Network options.
virtual Bool_t IsArchive() const
void SumBuffer(Int_t bufsize)
Increment statistics for buffer sizes of objects in this file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
static void SetFileBytesWritten(Long64_t bytes=0)
virtual Long64_t GetSeekFree() const
virtual Int_t GetErrno() const
Method returning errno. Is overriden in TRFIOFile.
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
TMap * fCacheReadMap
!Pointer to the read cache (if any)
virtual void ResetErrno() const
Method resetting the errno. Is overridden in TRFIOFile.
#define ClassDef(name, id)
static Bool_t GetReadStreamerInfo()
If the streamerinfos are to be read at file opening.
virtual void SetCompressionLevel(Int_t level=1)
See comments for function SetCompressionSettings.
virtual void MakeProject(const char *dirname, const char *classes="*", Option_t *option="new")
Generate source code necessary to access the objects stored in the file.
virtual void WriteFree()
Write FREE linked list on the file.
The TNamed class is the base class for all named ROOT classes.
TString fRealName
Effective real file name (not original url)
std::mutex fWriteMutex
!Lock for writing baskets / keys into the file.
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=0)
Resolve the file type as a function of the protocol field in 'name'.
static TFile * OpenFromCache(const char *name, Option_t *="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Open a file for reading through the file cache.
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
virtual Int_t GetReadCalls() const
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Book space in a file, create I/O buffers, to fill them, (un)compress them.
A TProcessID identifies a ROOT job in a unique way in time and space.
virtual TString GetNewUrl()
virtual Int_t SysWrite(Int_t fd, const void *buf, Int_t len)
Interface to system write. All arguments like in POSIX write().
virtual void IncrementProcessIDs()
virtual Int_t SysSync(Int_t fd)
Interface to system fsync. All arguments like in POSIX fsync().
Int_t GetRecordHeader(char *buf, Long64_t first, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen)
Read the logical record header starting at a certain postion.
virtual Long64_t DirCreateEntry(TDirectory *)
TFileOpenHandle(const char *n, const char *o, const char *t, Int_t cmp, Int_t no)
virtual Int_t SysClose(Int_t fd)
Interface to system close. All arguments like in POSIX close().
Int_t GetCompressionAlgorithm() const
static UInt_t GetOpenTimeout()
Returns open timeout (in ms).
virtual void ShowStreamerInfo()
Show the StreamerInfo of all classes written to this file.
virtual Int_t SysRead(Int_t fd, void *buf, Int_t len)
Interface to system read. All arguments like in POSIX read().
const char * GetOpt() const
virtual Int_t GetNfree() const
Long64_t fEND
Last used byte in file.
virtual Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Interface to system open. All arguments like in POSIX open().
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
A ROOT file is structured in Directories (like a file system).
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
Write memory objects to this file.
virtual Int_t GetBytesToPrefetch() const
Max number of bytes to prefetch.
virtual void SetOption(Option_t *option=">")
virtual void Delete(const char *namecycle="")
Delete object namecycle.
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
virtual Bool_t MustFlush() const
EAsyncOpenStatus fAsyncOpenStatus
!Status of an asynchronous open request
virtual void MakeFree(Long64_t first, Long64_t last)
Mark unused bytes on the file.
static std::atomic< Long64_t > fgFileCounter
Counter for all opened files.
Manages buffers for branches of a Tree.
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
virtual Int_t DirReadKeys(TDirectory *)
static void CpProgress(Long64_t bytesread, Long64_t size, TStopwatch &watch)
Print file copy progress.
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
The ROOT global object gROOT contains a list of all defined classes.
virtual void Draw(Option_t *option="")
Fill Graphics Structure and Paint.
virtual TList * GetStreamerInfoList()
Read the list of TStreamerInfo objects written to this file.
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
virtual void Init(Bool_t create)
Initialize a TFile object.
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
static TFile *& CurrentFile()
Return the current ROOT file if any.
Option_t * GetOption() const
virtual Long64_t GetBytesRead() const
static Bool_t fgOnlyStaged
Before the file is opened, it is checked, that the file is staged, if not, the open fails...
static Bool_t GetOnlyStaged()
Returns staged only flag.
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
virtual Int_t GetNbytesFree() const
TFile()
File default Constructor.
TList * fFree
Free segments linked list table.
TFile * fFile
Pointer to current file in memory.
virtual Int_t GetNbytesInfo() const
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
Int_t fNbytesFree
Number of bytes for free segments structure.
static Bool_t fgCacheFileForce
Indicates, to force all READ to CACHEREAD.
TFile * fFile
TFile instance of the file being opened.
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
Describe directory structure in memory.
TFileCacheWrite * GetCacheWrite() const
Return a pointer to the current write cache.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
virtual Long64_t GetSize() const
Returns the current file size.
Bool_t fNoAnchorInName
!True if we don't want to force the anchor to be appended to the file name
static Bool_t fgCacheFileDisconnected
Indicates, we trust in the files in the cache dir without stat on the cached file.
TList * fOpenPhases
!Time info about open phases
TString fOption
File options.
The prefetching mechanism uses two classes (TFilePrefetch and TFPBlock) to prefetch in advance a bloc...
Bool_t fMustFlush
!True if the file buffers must be flushed
Float_t GetCompressionFactor()
Return the file compression factor.
Int_t GetCompress() const
virtual Long64_t GetBytesReadExtra() const
Bool_t fIsRootFile
!True is this is a ROOT file, raw file otherwise
const TList * GetStreamerInfoCache()
Returns the cached list of StreamerInfos used in this file.
Mother of all ROOT objects.
Bool_t FlushWriteCache()
Flush the write cache if active.
static Bool_t SetOnlyStaged(Bool_t onlystaged)
Sets only staged flag.
virtual Long64_t GetEND() const
virtual void Paint(Option_t *option="")
Paint all objects in the file.
virtual void SetCompressionSettings(Int_t settings=1)
Used to specify the compression level and algorithm.
static TString fgCacheFileDir
Directory where to locally stage files.
virtual const TUrl * GetEndpointUrl() const
virtual ~TFile()
File destructor.
static TFileOpenHandle * AsyncOpen(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Submit an asynchronous open request.
static Bool_t SetCacheFileDir(const char *cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Int_t MakeProjectParProofInf(const char *packname, const char *proofinfdir)
Create BUILD.sh and SETUP.C under 'proofinf' for PAR package 'pack'.
virtual void Print(Option_t *option="") const
Print all objects in the file.
TList * GetListOfFree() const
virtual UShort_t WriteProcessID(TProcessID *pid)
Check if the ProcessID pidd is already in the file, if not, add it and return the index number in the...
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
virtual Int_t GetNProcessIDs() const
Int_t fNProcessIDs
Number of TProcessID written to this file.
virtual Int_t Sizeof() const
Return the size in bytes of the file header.
static UInt_t SetOpenTimeout(UInt_t timeout)
Sets open timeout time (in ms). Returns previous timeout value.
virtual void SetCompressionAlgorithm(Int_t algorithm=0)
See comments for function SetCompressionSettings.
TFileCacheRead * GetCacheRead(TObject *tree=0) const
Return a pointer to the current read cache.
Int_t fVersion
File format version.
Long64_t fArchiveOffset
!Offset at which file starts in archive
Int_t fCompress
Compression level and algorithm.
Int_t fWritten
Number of objects written so far.
static Int_t fgReadaheadSize
Readahead buffer size.
Long64_t fOffset
!Seek offset cache
virtual void WriteHeader()
Write File Header.
Bool_t fInitDone
!True if the file has been initialized
TFileOpenHandle * fAsyncHandle
!For proper automatic cleanup
EOpenTimeOut
Open timeout constants.
virtual Int_t GetSize() const
static void SetFileBytesRead(Long64_t bytes=0)
virtual void ls(Option_t *option="") const
List file contents.
Long64_t fSeekFree
Location on disk of free segments structure.
static Long64_t GetFileCounter()
virtual void SetCacheWrite(TFileCacheWrite *cache)
Set a pointer to the write cache.
Int_t GetCompressionLevel() const
Long64_t fBytesRead
Number of bytes read from this file.
static const char * GetCacheFileDir()
Get the directory where to locally stage/cache remote files.
virtual TProcessID * ReadProcessID(UShort_t pidf)
The TProcessID with number pidf is read from this file.
A cache when writing files over the network.
Int_t GetCompressionSettings() const
Int_t GetBestBuffer() const
Return the best buffer size of objects on this file.
virtual void Copy(TObject &) const
Copy this to obj.
Int_t MakeProjectParMake(const char *packname, const char *filename)
Create makefile at 'filemake' for PAR package 'pack'.
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
TFileCacheWrite * fCacheWrite
!Pointer to the write cache (if any)
virtual void Close(Option_t *option="")
Close a file.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
const char * Data() const
Array of chars or bytes (8 bits per element).
ECacheAction
TTreeCache flushing semantics.
virtual EAsyncOpenStatus GetAsyncOpenStatus()