new TFile()
Interface to read objects from ROOT files
Methods
(async, private) _open() → {Promise}
Actual file open
Returns:
when file keys are read
- Type
- Promise
(async, private) _readFormulas()
read formulas from the file and add them to TF1/TF2 objects
(private) assignFileContent()
Assign BufferArray with file contentOpen file
(private) delete()
Fully clenaup TFile data
(private) extractStreamerInfos()
extract streamer infos from the buffer
(private) findStreamerInfo(clanme, clversionopt, checksumopt)
Search streamer info
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
(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
(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
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
(async, private) readObjBuffer()
Read and inflate object buffer described by its key
(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