Code Monkey home page Code Monkey logo

g4snitch-viz's Introduction

Using plain ROOT commands

# setup ROOT environment
. [path-to-root]/bin/thisroot.sh
# alternatively, on lxplus or where cvmfs is available, source cvmfs-root-init.env
. cvmfs-root-init.env

# build dictionaries
make dataformats

# get testing data in ROOT format
make get-data-root
# get testing data in JSON format
make get-data-json
# cleanup all downloaded data
make clean-data

# start root
root.exe
  # load the library and dictionary
  gSystem->Load("libRootG4Snitch.so")
  # open data file
  TFile::Open("Mix50-5-20GeV.root")
  # print selected entries from the tree / particle vector
  T->Scan("m_pdg:m_p_beg.fT:m_x_beg.fT:m_x_end.fT:m_parent:n_daughters():m_daughters_begin:m_daughters_end:m_g4_id:m_g4_level:m_was_tracked:m_p_beg.fT - m_mass")

Using loader.C script and second level dumper.C

# Init env / build dictionaries / get data as above

root.exe loader.C
  # loader.C loads the data-format & dictionary library, loads the file, then loads dumper.C
  # one can now call functions from dumper.C:
  dump_primaries()

--> this is the output + json file:
Loaded event 0, size of particle vector=20531, number of primaries=42
Created JSON object, length=46756
Written JSON to 'primaries.json'

  # or, for full dump into 'all-particles.json' (or specify json file name)
  dump_all()

loader.C can take a ROOT file name as argument ... but it needs to be quoted to escape the parenthesis and the file-name string quotation marks like this:

root.exe loader.C'("Mix50-5-20GeV.root")'

Alternatiely, wrap the thing into a here-style script:

root.exe <<FNORD
.x loader.C("SingleProton-200GeV.root")
dump_all("SingleProton-200GeV.json")
.q
FNORD

g4snitch-viz's People

Contributors

osschar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.