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 🙏

© 2024 – Pkg Stats / Ryan Hefner

rootjs

v1.0.0

Published

Node bindings to the ROOT scientific framework

Downloads

88

Readme

Jenkins: Build Status, Sir!

rootJS

Node.js bindings for ROOT 6

Docs

Check this https://jenkins-rootjs.web.cern.ch/job/RootJS/doxygen/ for the current documentation. Documentation is generated by Jenkins, so this link should always point to a recent version.

Installation

rootJS is in the main npm package repository - all you have to do is have ROOT6 installed, then run npm install rootjs.

Testing

Simply run npm test after installing rootJS in development mode.

We currently use a mocha testsuite but might add something to (unit-)test C++ code directly.

#Dependencies

  • This module only supports Node.js v4.4 or newer
  • You need to have ROOT-6.06.00 or newer installed (root-config needs to be available in your PATH)
  • You need libuv, on Ubuntu you can use sudo apt-get install libuv1-dev to install it

#Usage You can use rootJS in a node shell by using require on the module directory, e.g.:

var root = require('rootjs');

Afterwards you have access to root's functionality through the required root object which copies its structure from ROOT.

> root.gProgName //You can access globals
'node'
> root.Compress("compress this text") //You can call global functions
'compressthistext'
> var browser = new root.TBrowser() //You can create new objects (even GUI elements)
undefined
> browser.SetName("test") //And run its methods
'165781144'
> browser.GetName()
'test'

##Load libraries You can easily load other ROOT libraries whenever needed, just use loadLibrary:

>root.loadlibrary("libMathCore.so") //Loads math core
0
>root.ROOT.Math.Pi()
3.141592653589793 //Verified!

Calling ROOT's gSystem.load("libName.so")to load a library is highly discouraged and may result in unexpected behaviour.

If neccessary a refresh of the exported functions can be done through refreshExports

>root.refreshExports() //Checks for additions to the gClassTable and exposes them
undefined

##Callbacks We support async code execution on every method call, just add a callback:

> root.gSystem.Exec("sleep 1", function() {
	console.log("this is called in the callback")
});
>console.log("Async called");
Async called // The second log is shown first because the other one will be called after "sleep 1"
undefined
> this is called in the callback

This will be usefull when processing huge amounts of data while setting up other parts of the environment.

##Operators C++ operators like "==" are supported, these operators are mapped on objects or in the global root object

> var t1 = new root.TString("test")
undefined
> var t2 = new root.TString("test")
undefined
> t1 == t2
false
> root._equals(t1, t2) // C++ == operator
true

> t1._at(1) //C++ []-operator
'e'

t1._call(2, 2).Data() //C++ ()-operator
'st'

t1._setAdd(" test2") //C++ += operator
undefined
> t1.Data()
'test test2'

//All implemented operators are prefixed with "_"