Rootana javascript displays: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
We are exploring ways of being able to view rootana histograms and plots on webpages, rather than in custom GUIs.  The current scheme is based on building webpages based on data served up by the ROOT web server : [https://root.cern.ch/doc/master/classTHttpServer.html THttpServer].
We are exploring ways of being able to view rootana histograms and plots on webpages, rather than in custom GUIs.  The current scheme is based on building webpages based on data served up by the ROOT web server : [https://root.cern.ch/doc/master/classTHttpServer.html THttpServer].


pecifically, I am running an online rootana analyzer that is serving up the
The rootana analyzer has a command line option to allow the initialization of a THttpServer. For instance, doing  
histograms using the THttpServer that is now built into ROOT. Specifically, I am
doing something like


/ana.exe -r8088
<pre> /ana.exe -r8088 </pre>


with the programs in rootana/examples; then I proxy this server through APACHE.
with the programs in rootana/examples; this creates an instance of the THttpServer on port 8088.  


The MIDAS instance I am looking at is here
We have a test MIDAS instance available here


http://neut18.triumf.ca/
http://neut18.triumf.ca/
Line 20: Line 18:
http://neut18.triumf.ca/rootana/
http://neut18.triumf.ca/rootana/


You can use this to explore the histograms I created and plot them. Already
Not that we have proxied both the MIDAS server and the THttpServer through APACHE in this case.
that's quite useful. You can see that I have histograms being filled with data
from V792 (charge) and V1720 (waveforms); note that this is just simulated data.


You can see that rootana has put the histograms into a ROOT folder called
You can use the above link to explore the histograms created by the rootana program and plot them. You can see that I have histograms being filled with datafrom V792 (charge) and V1720 (waveforms); note that this is just simulated data.
'Files/output00000387.root'. This is a little hassle, since it means that the
ROOT directory where the histograms sit changes when there is a new run; but I
wrote javascript to automatically handle that.


The webpage I wrote is available here
In addition to providing a way to browse and plot the histograms, the THttpServer also provides direct access to the histogram data in JSON format.  Based on this ability we have made a javascript webpage that requests the histogram data from rootana using the THttpServer and plots them using the dygraph plotting package.  The webpage is available here


http://neut18.triumf.ca/CS/test
http://neut18.triumf.ca/CS/test


The page works by making requests to the THttpServer for the detailed histogram
= Known problems =
data (AJAX requests), for instance, by grabbing the json description of the
histogram here


http://neut18.triumf.ca/rootana/Files/output00000403.root/V792_0_0/root.json
In addition to the general weakness of the html/javascript/css coding, there are
 
and then filling a plot using the data. I used the dygraph plotting package that
Bryerton used for the GRIFFIN display.
 
I basically tried to recreate the histogram plotting functionality that I have
in the rootana display gui. Namely, the ability to choose which channel to look
at, the ability to overlay different plots and the ability to display plots side
by side. As well as the ability to switch between V792 and V1720 histograms.
 
In general I think it works fairly well; I could reasonably easily deploy this
for different experiments and I think it is fairly responsive and intuitive.
 
Please feel free to try out the webpage and see how it works. Webpage should
also work properly as you start and stop runs.
__________________________________________________
 
Remaining problems
 
In addition to the general weakness of my html/javascript/css coding, here's
some specific problems that still remain with this webpage.
some specific problems that still remain with this webpage.


i) The webpage currently only works for looking at the histograms online. You
* The webpage currently only works for looking at the histograms online. You
could run rootana on a file and use this webpage to look at the plots; but I
could run rootana on a file and use this webpage to look at the plots; but I
don't know how to get the webpage to tell rootana to only process one event at a
don't know how to get the webpage to tell rootana to only process one event at a
time, so this isn't so useful. But maybe the idea of using a webpage to look at
time, so this isn't so useful. But maybe the idea of using a webpage to look at
a particular file doesn't make much sense anyway.
a particular file doesn't make much sense anyway.
 
* The webpage doesn't know anything about MIDAS events; all it know about are
ii) The webpage doesn't know anything about MIDAS events; all it know about are
the histograms that it can grab. For instance, this is a problem with the V1720
the histograms that it can grab. For instance, this is a problem with the V1720
histograms. If you overlay the first two histogram you should in principle see
histograms. If you overlay the first two histogram you should in principle see
Line 81: Line 52:
be for the same event. But even that wouldn't always work.
be for the same event. But even that wouldn't always work.


iii) When you pause the webpage, you can't switch between different channels,
* When you pause the webpage, you can't switch between different channels,
display types, etc. That is because the webpage only has the information for the
display types, etc. That is because the webpage only has the information for the
histogram that it is currently plotting; it doesn't have information for any
histogram that it is currently plotting; it doesn't have information for any
Line 89: Line 60:
context, given problem ii).
context, given problem ii).


iv) I haven't implemented any histogram reset functionality yet. I think that in
* I haven't implemented any histogram reset functionality yet. I think that in
principle this THttpServer does support the idea of sending commands back to the
principle this THttpServer does support the idea of sending commands back to the
program, so I think that this is solvable.
program, so I think that this is solvable.


v) Currently I can only plot histograms that are ROOT TH1* format. It should be
* Currently I can only plot histograms that are ROOT TH1* format. It should be
easy to add the ability to handle TGraph. But TH2D (2D histograms) seems more
easy to add the ability to handle TGraph. But TH2D (2D histograms) seems more
tricky. It seems that handling 2D plots is not generally something that these
tricky. It seems that handling 2D plots is not generally something that these
Line 99: Line 70:
supports this; I will look into this more.
supports this; I will look into this more.


vi) The AJAX data transfers are on the main thread; I'll need to fix that to use
* The AJAX data transfers are on the main thread; I'll need to fix that to use
the same asynchronous type transfers that Konstantin was writing for MIDAS.
the same asynchronous type transfers that Konstantin was writing for MIDAS.


vii) There is some problem with the rootana server when I first restart it.
* There is some problem with the rootana server when I first restart it.
Somehow I have to 'initialize' the rootana server by visiting the default ROOT
Somehow I have to 'initialize' the rootana server by visiting the default ROOT
online browser page. If I haven't done that then my AJAX requests don't work.
online browser page. If I haven't done that then my AJAX requests don't work.

Revision as of 13:37, 12 February 2016

Introduction

We are exploring ways of being able to view rootana histograms and plots on webpages, rather than in custom GUIs. The current scheme is based on building webpages based on data served up by the ROOT web server : THttpServer.

The rootana analyzer has a command line option to allow the initialization of a THttpServer. For instance, doing

 /ana.exe -r8088 

with the programs in rootana/examples; this creates an instance of the THttpServer on port 8088.

We have a test MIDAS instance available here

http://neut18.triumf.ca/

The default browser (the one that ROOT provides) for the rootana histograms is available here

http://neut18.triumf.ca/rootana/

Not that we have proxied both the MIDAS server and the THttpServer through APACHE in this case.

You can use the above link to explore the histograms created by the rootana program and plot them. You can see that I have histograms being filled with datafrom V792 (charge) and V1720 (waveforms); note that this is just simulated data.

In addition to providing a way to browse and plot the histograms, the THttpServer also provides direct access to the histogram data in JSON format. Based on this ability we have made a javascript webpage that requests the histogram data from rootana using the THttpServer and plots them using the dygraph plotting package. The webpage is available here

http://neut18.triumf.ca/CS/test

Known problems

In addition to the general weakness of the html/javascript/css coding, there are some specific problems that still remain with this webpage.

  • The webpage currently only works for looking at the histograms online. You

could run rootana on a file and use this webpage to look at the plots; but I don't know how to get the webpage to tell rootana to only process one event at a time, so this isn't so useful. But maybe the idea of using a webpage to look at a particular file doesn't make much sense anyway.

  • The webpage doesn't know anything about MIDAS events; all it know about are

the histograms that it can grab. For instance, this is a problem with the V1720 histograms. If you overlay the first two histogram you should in principle see two peaks that are close together; at least that is what the data looks like in the underlying MIDAS events.

But when viewed with my webpage you often see that the two peaks are far apart. This is because the webpage has grabbed the information for the waveform for one channel, then rootana changed to the next event and then the information for the waveform for the second channel. So you are actually looking at the waveforms for different events, which is confusing.

I can imagine ugly ways of working around this; for instance, I could ensure that the waveform histogram are only filled every second, so that two AJAX would be for the same event. But even that wouldn't always work.

  • When you pause the webpage, you can't switch between different channels,

display types, etc. That is because the webpage only has the information for the histogram that it is currently plotting; it doesn't have information for any other histograms, so can't show them without un-pausing.

In fact, I'm not really sure what the concept of 'pausing' means in this context, given problem ii).

  • I haven't implemented any histogram reset functionality yet. I think that in

principle this THttpServer does support the idea of sending commands back to the program, so I think that this is solvable.

  • Currently I can only plot histograms that are ROOT TH1* format. It should be

easy to add the ability to handle TGraph. But TH2D (2D histograms) seems more tricky. It seems that handling 2D plots is not generally something that these javascript plotting packages worry about. I may have found a package that supports this; I will look into this more.

  • The AJAX data transfers are on the main thread; I'll need to fix that to use

the same asynchronous type transfers that Konstantin was writing for MIDAS.

  • There is some problem with the rootana server when I first restart it.

Somehow I have to 'initialize' the rootana server by visiting the default ROOT online browser page. If I haven't done that then my AJAX requests don't work. This needs debugging

I guess that problems i), ii) and iii) are probably problems that we also had with roody (not sure about i). They may be problems that are inherent to trying to decouple the generation of the histograms from their display.