import { openFile } from "https://root.cern/js/latest/modules/main.mjs"; import { TSelector, treeProcess } from "https://root.cern/js/latest/modules/tree.mjs"; class MySelector extends TSelector { constructor() { super(); this.entry = 0; // add branches this.addBranch('px'); this.addBranch('p'); } Begin() { this.entry = 0; } Process() { if (this.entry < 1) { console.log(this); console.log(this.tgtobj.px, this.tgtobj.p); console.log(typeof(this.tgtobj.px)); } ++this.entry; } Terminate() {} } const file = await openFile('./example.root'); const tree = await file.readObject('tree;1'); treeProcess(tree, new MySelector);