npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hep-fcc/root2gltf

v2.0.0

Published

Convert detector geometries from ROOT to the glTF format used by Phoenix

Readme

root2gltf

Node.js Package

Converts particle physics detector geometries from ROOT files to the glTF format used by Phoenix.

It reads a ROOT geometry file, deduplicates redundant mesh and material data, and writes out a single .gltf file ready to load in Phoenix. An optional config file can be used to hide specific parts, group volumes into named views, or control traversal depth.

This project is based on root_cern-To_gltf-Exporter, a browser-based ROOT to glTF converter developed by Sebastien Ponce.

Usage

Install

npm install

Build

npm run build

CLI

node bin/cli.js -i <input.root> [-c <config.json>] [-o <output.gltf>]

| Flag | Description | | --------------------- | ------------------------------------------------------------------------------ | | -i, --input-file | Required path to the input ROOT file | | -c, --config-file | Optional path to a detector config file | | -o, --output-file | Optional path for the output glTF file (which defaults to <input-name>.gltf) |

Example with a config:

node bin/cli.js -i CLD_o4_v05.root -c CLD_o4_v05.config.json -o CLD.gltf

API

You can also call the converter in code. File I/O is your responsibility — pass an already-opened ROOT file and an optional config object:

Example with a config:

import { writeFile } from "node:fs/promises";
import { openFile } from "jsroot";
import root2gltf from "root2gltf";

const input = await openFile("CLD_o4_v05.root");

const gltfContent = await root2gltf({
  input,
  config: {
    childrenToHide: ["BeamPipeShield_assembly_0"],
    depth: 4,
    children: { "Beam Pipe": ["BeBeampipe_assembly_0"] },
  },
});

await writeFile("CLD.gltf", JSON.stringify(gltfContent), "utf8");

Config file

Config file/object is optional. Without it, the converter exports the full geometry at the default traversal depth 2. Use a config when you need to:

  • Hide parts: exclude specific volumes from the output
  • Group volumes: combine multiple volumes into a single named view
  • Increase depth: traverse deeper into the geometry tree for more detail

Here is what the fields do:

| Field | Description | | ---------------- | ------------------------------------------------------------------------------------------------------- | | depth | How many levels deep to traverse the geometry tree. Higher values produce more detail but larger files. | | childrenToHide | List of node names to remove before processing. | | children | Maps a display name to a list of volume names. Each entry becomes a separate scene in the glTF file. |

Ready-to-use configs for several FCC-ee detector concepts are in configs/.

Example: Allegro_o2_v01

{
  "childrenToHide": [],
  "children": {
    "Beam Pipe": [
      "BeBeampipe_assembly_0",
      "BeamPipe_assembly_1",
      "SynchRadMask_assembly_2",
      "BeamPipeShield_assembly_3",
      "BeamPipeShield_noRot_assembly_4"
    ],
    "Screen Solenoid": ["CompSol_assembly_5", "ScreenSol_assembly_6"],
    "LumiCal": [
      "LumiCal_envelope_7",
      "LumiCalInstrumentation_envelope_8",
      "LumiCalCooling_envelope_9",
      "LumiCalBackShield_envelope_10"
    ],
    "Vertex": ["Vertex_11"],
    "STT": ["STT_o1_v01_envelope_12"],
    "Silicon Wrapper": ["SiWrB_envelope_13", "SiWrD_envelope_14"],
    "ECal": ["ECalBarrel_vol_15"],
    "HCal": ["HCalEnvelopeVolume_16"],
    "ECal Endcap": ["ECalEndcaps_turbine_17"],
    "HCal Endcap": ["HCalThreePartsEndcap_volume_18"],
    "Endcap": ["Barrel_assembly_19", "Endcaps_assembly_20"]
  },
  "depth": 3
}

Project structure

root2gltf/
├── bin/
│   └── cli.js                    # CLI entry point (argument parsing)
├── src/
│   ├── index.ts                  # Main conversion logic
│   ├── handleInput.ts            # ROOT tree traversal and filtering helpers
│   ├── deduplicateOutput.ts      # glTF deduplication (materials and meshes)
│   ├── concatenateOutput.ts      # Merges per-scene glTF exports into a single object
│   └── lib/
│       ├── constants.ts          # Build options and geometry settings
│       ├── utils/
│       │   ├── generateConfig.ts # Config generation from ROOT children nodes
│       │   └── nodeWorkarounds.ts# Node.js polyfills and workarounds
│       └── types/                # TypeScript type definitions
└── dist/                         # Compiled JavaScript output (generated by tsc)

Performance improvements

Memory

  • Export one scene at a time so each graph is freed instead of accumulating in memory
  • Keep a reference to the first occurrence of each object instead of JSON-parsing during deduplication
  • Deload Node.js call stack by turning recursive functions into iterative (which uses the heap)