Bertrand Bellenot root.cern.ch ROOT I/O in JavaScript Reading ROOT files from any web browser ROOT Users Workshop 2013 11.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

A Toolbox for Blackboard Tim Roberts
Web Visualization Technology Horner APG Ver 1.0.
SOFTWARE PRESENTATION ODMS (OPEN SOURCE DOCUMENT MANAGEMENT SYSTEM)
Software to Manage EEP Vegetation Plot Data A design proposal Michael Lee January 31, 2011.
Do We Really Need Rich-Interface Technologies? Yifan Zhang
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
AJAX & By – Anupama Sharma. Defining Ajax Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
The OWASP Foundation Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
Development of mobile applications using PhoneGap and HTML 5
Web Programming Language Dr. Ken Cosh Week 1 (Introduction)
Ashish jaiman architect evangelist Microsoft
Web Browser: Netscape Navigator and Internet Explorer By Bhupendra Ratha, Lecturer School of Library and Information Science Devi Ahilya University, Indore.
Presented by…. Group 2 1. Programming language 2Introduction.
Reading ROOT files in any browser ROOT I/O IN JAVASCRIPT Bertrand Bellenot CERN, PH-SFT.
IT Website Development Welcome!. Welcome to Unit 7! Optimizing Images and creating photo albums in Dreamweaver There are no textbook readings for.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
Yahoo! User Interface (YUI) Library Natly Mekdara.
INTRODUCTION TO FRONTPAGE. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features Features  Starting Front Page Starting Front Page  Components.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
IE 411/511: Visual Programming for Industrial Applications
JavaScript ROOT Bertrand Bellenot (CERN) Sergey Linev (GSI)
Session 1 SESSION 1 Working with Dreamweaver 8.0.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
Linking electronic documents and standardisation of URL’s What can libraries do to enhance dynamic linking and bring related information within a distance.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Axel Naumann University of Nijmegen / NIKHEF, NL ROOT 2004 Users Workshop The Future of THtml Plans and Status of ROOT’s documentation facility.
Introduction to HTML. What is HTML?  Hyper Text Markup Language  Not a programming language but a markup language  Used for presentation and layout.
Are you getting the benefits from ASP.NET and AJAX? Introduction to the CTC ASP.NET Webforms Generator.
Building Rich Web Applications with Ajax Linda Dailey Paulson IEEE – Computer, October 05 (Vol.38, No.10) Presented by Jingming Zhang.
THttpServer for ROOT Bertrand Bellenot, CERN Sergey Linev, GSI Darmstadt
CHEP 2013, Amsterdam Reading ROOT files in a browser ROOT I/O IN JAVASCRIPT B. Bellenot, CERN, PH-SFT B. Linev, GSI, CS-EE.
H.G.Essel: Go4 - J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel, S.Linev CHEP 2003 GSI Online Offline Object Oriented Go4.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
RIA and Web2.0 Development with no Coding Juan Camilo Ruiz Senior Product Manager Development Tools.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Created by Cheryl M. Hughes The Web Wizard’s Guide to XHTML by Cheryl M. Hughes.
 AJAX – Asynchronous JavaScript and XML  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
ROOT I/O in JavaScript Browsing ROOT Files on the Web For more information see: For any questions please use following address:
Creating Animations, Working with Graphics, and Accessing Data Lesson 9.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
The Online World ONLINE DOCUMENTS. Online documents Online documents (such as text documents, spreadsheets, presentations, graphics and forms) are any.
Java Servlets and Java Server Pages
Overview of Servlets and JSP
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
LCG AA Meeting 31 October 2007 The new dynamically and extensively customizable ROOT browser Bertrand Bellenot.
IE Developer Tools Jonathan Seitel Program Manager.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
Reading ROOT files in (almost) any browser.  Use XMLHttpRequest JavaScript class to perform the HTTP HEAD and GET requests  This class is highly browser.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
Fermilab Scientific Computing Division Fermi National Accelerator Laboratory, Batavia, Illinois, USA. Off-the-Shelf Hardware and Software DAQ Performance.
Go4 v2.2 Status & Overview CHEP 2003
Web Programming Language
JavaScript ROOT
WWW and HTTP King Fahd University of Petroleum & Minerals
Complex Geometry Visualization TOol
Application with Cross-Platform GUI
3D graphics in JavaScript ROOT
PHP / MySQL Introduction
CIS 133 mashup Javascript, jQuery and XML
JavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Bertrand Bellenot root.cern.ch ROOT I/O in JavaScript Reading ROOT files from any web browser ROOT Users Workshop

ROOT Users Workshop March Introduction How to share thousands of histograms on the web, without having to generate picture files (gif, jpg, …)? How to easily share a ROOT file? How to browse & display the content of a ROOT file from any platform (even from a smartphone or tablet)? And obviously, all that without having to install ROOT anywhere?

ROOT Users Workshop March 2013 Requirements The solution should be: Portable: use available web browser Lightweight: no library or application to install Easy to use (user side) Easy to extend and maintain (developer side) Fast, with a small memory footprint 3

ROOT Users Workshop March 2013 Targeted scope Not a replacement of ROOT: No tree analysis No fitting No editing Visualization only: Online monitoring Publication sites (Elsevier is going to use it) … 4

ROOT Users Workshop March 2013 Solution HTML & JavaScript: JSROOTIO.js Copy the ROOT file on any plain web server Data is transferred over the web Visualization happens on the client side 5 User’s selection request Compressed object Client ROOT Files WEB SERVER

ROOT Users Workshop March 2013 ROOT I/O 6

ROOT Users Workshop March 2013 Reminder: the streamer info A TStreamerInfo object describes a persistent version of a class. A ROOT file contains the list of TStreamerInfo objects for all the class versions written to this file. A TStreamerInfo is a list of TStreamerElement objects (one per data member or base class) A TStreamerElement describe a data member or a base class (e.g. type, name) 7

ROOT Users Workshop March 2013 Reading the file When opening the file: Read the list of streamer info Read the list of keys and display them in a list tree When the user select an item in the list tree (and only then) Read the compressed buffer from the file Inflate the buffer Decipher the object from the inflated buffer using its streamer info 8

ROOT Users Workshop March 2013 Reading the file Use the XMLHttpRequest AJAX API to perform the HTTP HEAD and GET requests This API is highly browser dependent: On IE, the binary data is in its responseBody data member (VBScript format), and has to be converted into a JavaScript string On other browsers, the data can be in response, mozResponse, mozResponseArrayBuffer, or responseText... Thanks to Ioannis Charalampidis, who kindly provided a working cross-browser solution 9

ROOT Users Workshop March 2013 Downloading & handling binary data Using HTTP byte range (available in HTTP/1.1) to download only a single compressed object when the user wants to read it Minimizes data transfer and memory usage Compressed (zipped) objects are in binary format JavaScript has very little support for raw binary data Binary data is simply stored in a JavaScript string Accessing a single byte is easy: 10 byte = string.charCodeAt(index);

ROOT Users Workshop March 2013 Reading the keys The keys are not compressed They contain basic information on the object they describe, like its name and its type First step was quite easy, starting from already working code written by Axel Naumann Formatting and displaying the keys is done with a JavaScript tree menu 11

ROOT Users Workshop March 2013 File header and key information Screenshot of the file header and the list of keys contained in hsimple.root The hpx key is open, showing the information describing the TH1F object in the file (displayed for debugging purpose only) 12

ROOT Users Workshop March 2013 Inflating & decoding the streamer info Inflating (unzipping) the buffers required: A JavaScript version of zlib’s inflate function from: /inflate.txt /inflate.txt Implementing the streamer info functionality in JavaScript involved: reverse engineering and parallel debugging of C++ and JavaScript valuable help from Philippe Canal Streamer info can be displayed for educational / informational purposes 13

ROOT Users Workshop March 2013 Streamer info visualisation 14

ROOT Users Workshop March 2013 Reading objects, first version At the beginning, the classes’ streamers were hard-coded. This approach has several issues: Streamers must be updated with every change in the original class Add a new streamer for every new class The library is growing with every new streamer The only (partially) supported classes were TH1, TH2, TGraph, and TProfile 15

ROOT Users Workshop March 2013 Reading objects, actual status One very nice feature of JavaScript is the possibility to dynamically (at runtime) create classes Allowed to implement dynamic streamers (automatically generated from the streamer info) Allows to potentially read any object from a ROOT file, as soon as we can read the streamer info of its class 16

ROOT Users Workshop March 2013 Graphics A JavaScript library (d3.js) is used to display the 1D & 2D histograms and graphs ( and is released under the BSD Licensehttp://d3js.org/ Another library (three.js) is used for 3D graphics (released under the MIT License)three.js 3D graphics uses WebGL technology when available (browser and platform dependent) 17

ROOT Users Workshop March 2013 Displaying objects 18 Traditional visualization of a local ROOT file in the ROOT browser

ROOT Users Workshop March 2013 Displaying objects (cont.) 19 JSROOTIO.js visualization of identical histogram

ROOT Users Workshop March 2013 Displaying objects (cont.) 20 Displaying a TH2, as “BOX” plot (default)

ROOT Users Workshop March 2013 Displaying objects (cont.) 21 Displaying the same TH2, as “LEGO” plot

ROOT Users Workshop March 2013 Displaying objects (cont.) 22 Displaying a simple TH3

ROOT Users Workshop March 2013 Displaying objects (cont.) 23 Displaying the content of a TCanvas

ROOT Users Workshop March 2013 How to use it? Simply copy the ROOT file(s) anywhere on the web Create a simple html page next to the files Only two lines have to be added in the Including css and js directly from the root web site keeps you up to date with the latest version 24 Read a ROOT file in JavaScript (Demonstration)

ROOT Users Workshop March 2013 Simple html Example And a few lines in the. Here is a complete example: 25 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " Read a ROOT file in Javascript (Demonstration)

ROOT Users Workshop March 2013 JavaScript API Offering a very simple API: But could be internally complex: 26 Var f = new JSROOTIO.RootFile(url); var histo = f.ReadHistogram(histo_name); if (typeof(histo) != 'undefined') displayHistogram(histo); clRef = streamerInfo.ReadClass(str, o); histo = eval('new JSROOTIO.' + clRef['name'] + '()'); if (typeof histo != 'undefined' && typeof histo.Streamer == 'function') histo.Streamer(str, o);

ROOT Users Workshop March 2013 Status, availability, coming next Doesn’t work on Android prior to version 4.0 (doesn't allow byte range HTTP requests) The source code is available in svn: Remaining tasks Finalize the automatic streaming Allow to use custom streamers (partially done) Add missing drawing options Add graphical feedback (e.g. tooltips) Add Latex support 27

ROOT Users Workshop March 2013 Conclusion The code is in a very good shape, thanks to early users who gave very valuable feedback Feel free to try and to send feedback & requests 28