# aidar - Reading AIDA files into R
This package allows to read histograms and tuples from AIDA files.
The various objects from the file will be converted into R's dataframes.
## Installing the development version of aidar from github:
(from )
install.packages("devtools")
library(devtools)
dev_mode(on=T) # switch to development mode (if you want)
install_github("aidar", username="apfeiffer1")
library(aidar)
# now you can use the aidar library - see the "examples of usage" below
# when finished do:
dev_mode(on=F) # ... and you are back to having stable ggplot2
## Examples of usage
### Listing the content of a file
First use R's system tools to create the filename, for this example we use a gzip compressed XML file from the package:
histoFile = system.file("inst", "data", "histos.xml.gz", package="aidar")
If you want to use your own file, do not use this method, but rather specify the path to your file:
histoFile = "/path/to/my/files/histos.xml.gz"
We can list the content of the file via:
info = getFileInfo(histoFile)
print(info)
You can of course also use a string as a file name, e.g. to use the file "myHistos.xml.gz" from the current working directory in your R session, do:
info = getFileInfo("myHistos.xml.gz")
print(info)
### Getting the annotation (summary info) of an object
Now we can get the annotation of the object with the name "1" from the file:
a1 = getAnnotation(histoFile, '1')
### Retrieve the content of a histogram (or other object) as a data.frame
And that's how we get the (content of the) 1D histogram named '1' in the file into a R data-frame:
h1 = getHisto1D(histoFile, '1')
Similar for a tuple named '100' in the gzip-compressed XML file (this will take a few seconds):
tupleFile = system.file("inst", "data", "tuple.xml.gz", package="aidar")
aTup = getAnnotation(tupleFile, '100')
t100 = getTuple(tupleFile, '100')
... and plot one of the tuple's columns:
plot(t100$sin)
## Full list of functions available in the package
The full list of methods available to retrieve AIDA objects and information about them are (replace `` and `` with your values, as usual):
### Information
info = getFileInfo( )
ann = getAnnotation( , )
### Retrieving objects as data.frames
h1d = getHisto1D( , )
h2d = getHisto2D( , )
h3d = getHisto3D( , )
c1d = getCloud1D( , )
c2d = getCloud2D( , )
c3d = getCloud3D( , )
p1d = getProfile1D( , )
p2d = getProfile2D( , )
tup = getTuple( , )