TFile

TFile

new TFile()

Interface to read objects from ROOT files

Description:
  • Use openFile to create instance of the class

Source:

Methods

(async, private) _open() → {Promise}

Actual file open

Source:
Returns:

when file keys are read

Type
Promise

(async, private) _readFormulas()

read formulas from the file and add them to TF1/TF2 objects

Source:

(private) assignFileContent()

Assign BufferArray with file contentOpen file

Source:

(private) delete()

Fully clenaup TFile data

Source:

(private) extractStreamerInfos()

extract streamer infos from the buffer

Source:

(private) findStreamerInfo(clanme, clversionopt, checksumopt)

Search streamer info

Source:
Parameters:
Name Type Attributes Description
clanme string

class name

clversion number <optional>

class version

checksum number <optional>

streamer info checksum, have to match when specified

(private) getDir()

Get directory with given name and cycle

Description:
  • Function only can be used for already read directories, which are preserved in the memory

Source:

getFileName()

Returns file name

Source:

(private) getKey()

Retrieve a key by its name and cycle in the list of keys

Description:
  • If only_direct not specified, returns Promise while key keys must be read first from the directory

Source:

(private) getSplittedStreamer()

Here we produce list of members, resolving all base classes

Source:

(private) getStreamer()

Returns streamer for the class 'clname',

Description:
  • From the list of streamers or generate it from the streamer infos and add it to the list

Source:

(async, private) readBuffer() → {Promise}

read buffer(s) from the file

Source:
Returns:

with read buffers

Type
Promise

(async) readDirectory(dir_name, cycleopt) → {Promise}

Read the directory content from a root file

Description:
  • If directory was already read - return previously read object Same functionality as TFile#readObject

Source:
Parameters:
Name Type Attributes Description
dir_name string

directory name

cycle number <optional>

directory cycle

Returns:
  • promise with read directory
Type
Promise

(async, private) readKeys()

Read file keys

Source:

(async, private) readObjBuffer()

Read and inflate object buffer described by its key

Source:

(async) readObject(obj_name, cycleopt) → {Promise}

Read any object from a root file

Description:
  • One could specify cycle number in the object name or as separate argument

Source:
Example
import { openFile } from 'https://root.cern/js/latest/modules/io.mjs';
let f = await openFile('https://root.cern/js/files/hsimple.root');
let obj = await f.readObject('hpxpy;1');
console.log(`Read object of type ${obj._typename}`);
Parameters:
Name Type Attributes Description
obj_name string

name of object, may include cycle number like 'hpxpy;1'

cycle number <optional>

cycle number, also can be included in obj_name

Returns:

promise with object read

Type
Promise