Message: The osc_A2R kit. Converting AIDA histos 1D, 2D to TH1D, 2D to plot them in a TCanvas. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None The osc_A2R kit. Converting AIDA histos 1D, 2D to TH1D, 2D to plot them in a TCanvas. 

Forum: Analysis
Date: 24 May, 2010
From: Guy Barrand <Guy Barrand>


 This is not a bug / problem report but to notify about the creation and
availability of the "osc_A2R" little kit.

 This little kit permit to read AIDA files (whatever the format !), 
within the root prompt, but by using... AIDA itself !

 In fact it is quite easy to wrap for CINT the AIDA interfaces, and it is long
now that I had the material to open an AIDA::ITree, read an AIDA::ITuple
and "loop on it" within a .C script.

 What was lacking was the fact to read an AIDA::IHistogram1D (or 2D) and
then to convert it to a TH1D (TH2D) so that someone can plot it with a TCanvas
(or do what he "ROOT wants" with it). And osc_A2R permits to do that.

 I have put a first version of this material in the :
kit that you can find under the 16.11 (or 16.11.1) directory of my download
area. Simply unzip and follow the README. (I have put a copy of the README below).

The goal of the kit is to build a "A2R" plugin that is loaded from
the root prompt with :
I have put a build_A2R shell script that works for Mac and Linux.

(No build_A2R.bat for Windows yet. For that I shall need to install CERN-ROOT on some Windows ( :-( ). But in fact what is needed is to "simply" build the A2R.dll, something which should not resist too much to someone fond of the ROOT + Windows combination. (I don't why but I am more "Mac + OSC" :-) )).

 As it manipulates only the AIDA interfaces and the TH1D, TH2D
it should work with good part of ROOT versions and osc_batch (osc_vis) kits around.
And in fact it should work also with... other AIDA implementations !

 And I strongly encourage my AIDA colleagues to try it on their implementation !

 I have tested with a osc_batch / 16.11 and a ROOT/5.26.00 on my Mac
and also on lxplus with the osc_batch/16.8 under /afs/
and the ROOT/5.21.04 under /afs/ and it
worked straight.

 What is DEFINITELY NICE, is that in the process we are no more
limited / constrained to produce at the ROOT file format to see
the histos coming from the G4 examples within a ROOT TCanvas !
All the format known by an AIDA implementation will work. (And then
the "aida" XML one). And this mainly because we are not opening the file
with a TFile, but with an AIDA::ITree.

 The example I put in the write / read at the "aida" xml format.
But with the osc_batch implementation you can use also my HDF5 or zip
format (or event hbook) (only one line to change in the A2R_write.C / A2R.C script
to do that). 



Then the README :

 This directory contains material to show how to
use AIDA from the CERN-ROOT Interactive Program.

 The A2R.C example opens, by using an AIDA::ITree, the 
file produced by the AIDA/examples/cpp/osc/A2R.cpp compiled example
or by A2R_write.C executed from the root program.

 Then A2R.C converts an AIDA::IHistogram1D to a ATH1D,
inheriting TH1D, and plots the ATH1D in a TCanvas. The same
is done with a AIDA::IHistogram2D (then converted to a ATH2D
inheriting TH2D).

 Note that what is nice here is that we are not limited to the
root file format at writing / reading since the persitency
in both cases is handled by the OpenScientist AIDA implementation
which is not limited to the CERN-ROOT file format.
If you choose another format than the default "aida" one, take care
to be "format consistent" between the A2R_write.C (or A2R.cpp) producer
ant the A2R.C reader program. (For example don't ask to produce at
"aida" format and read back at the "root" format).

 To use A2R.C you have first to "source setup" an osc_batch kit
and CERN-ROOT. For example from a csh flavoured shell with something
as :
   csh> source /usr/local/osc_batch/<version>/setup.csh
   csh> source /usr/local/ROOT/<version>/bin/thisroot.csh

 Check that the programs root-config and aida-config,
used by the buid_A2R shell script, are at hand :
    OS> aida-config
    OS> root-config

 Build the A2R plugin with :
    OS> <cd to the A2R directory>
( UNIX> chmod a+x build_A2R )
    OS> ./build_A2R
You should have a plugin in the current directory.

 Produce the AIDA_example_A2R.[aida,root,hdf5,hbook] file with :
    OS> root
    root[] gSystem->Load("A2R");
    root[] .x A2R_write.C

( or with the compiled AIDA example :
with :
    OS> cp -R ${OSC_HOME_DIR}/Resources/AIDA/examples/cpp/osc .
    OS> cd osc
    OS> ./build A2R
    OS> ./AIDA_example_A2R [aida,root,hdf5,hbook] 
    OS> cd ..
    OS> mv ./osc/AIDA_example_A2R.[aida,root,hdf5,hbook] .

 Then execute A2R.C with :
    OS> root
    root[] gSystem->Load("A2R");
    root[] .x A2R.C
A TCanvas should open visualizing a ATH1D and a ATH2D. 

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: osc_A2R kit for Windows.   (Guy Barrand - 26 May, 2010)
(_ Ok: Re: osc_A2R kit for Windows.   (Wonmo - 28 May, 2010)
 Add Message Add Message
to: "The osc_A2R kit. Converting AIDA histos 1D, 2D to TH1D, 2D to plot them in a TCanvas."

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]