TFile

TFile

new TFile()

Interface to read objects from ROOT files

Description:
  • Use openFile to create instance of the class

Source:

Methods

getFileName()

Returns file name

Source:

(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) 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