 |
Reading AIDA file and accessing histograms
Source code name: "io_read_aida.py"
Programming language: Python
Topic: File IO/Aida
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/io_read_aida_7162.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from java.awt import Color
from jhplot import *
from jhplot.io import *
# location of AIDA file (in /macro/examples/data)
# set it manually if you run withoutDataMelt IDE
file=SystemDir+fSep+"macros"+fSep+"examples"+fSep+"data"+fSep+"UsingJAIDAFromJython.aida"
# location of ROOT file
a= FileAida( file )
print a.getAllNames()
print a.getAllTypes()
# retrieve objects
c1d=a.get("Clouds/Cloud 1D")
c2d=a.get("Clouds/Cloud 2D")
h1=a.get("Histograms/Histogram 1D")
# Convert Histogrm1D to H1D so we can add some color etc
hh1=H1D(h1)
hh1.setColor(Color.red)
c1 = HPlot("Canvas",600,400,2,1)
c1.setGTitle("Reading AIDA objects from a file")
c1.visible(1)
c1.setAutoRange()
c1.cd(1,1)
c1.draw(c1d)
c1.draw(hh1)
c1.cd(2,1)
c1.setAutoRange()
c1.draw(c2d)
# export to some image (png,eps,pdf,jpeg...)
# c1.export(Editor.DocMasterName()+".png");
You see the box below because you did not login.