asc:jas4pp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
asc:jas4pp [2021/02/17 00:04] – [Reading ROOT files] asc | asc:jas4pp [2024/01/30 15:50] (current) – [Reading LCIO files] asc | ||
---|---|---|---|
Line 27: | Line 27: | ||
a data-analysis environment for detector and physics studies of future circular colliders. Jas4PP is a merge of several open-source Java projects, such as | a data-analysis environment for detector and physics studies of future circular colliders. Jas4PP is a merge of several open-source Java projects, such as | ||
* [[http:// | * [[http:// | ||
- | * Many file formats used in HEP, including | + | * Many file formats used in HEP, including |
- | * [[https:// | + | * [[https:// |
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
Line 43: | Line 43: | ||
+ | ====== Installation | ||
The installation does not have external dependencies. | The installation does not have external dependencies. | ||
One can find Oracle JDK or JRE versions from the [[http:// | One can find Oracle JDK or JRE versions from the [[http:// | ||
Line 48: | Line 49: | ||
- | <note tip>Although Jas4pp works on JDK8, we strongly recommend to use JDK9 (or OpenJDK9) and above. This will significantly increase the speed for numeric computations. | + | <note tip>We strongly recommend to use JDK18 (or OpenJDK18) and above. This will significantly increase the speed for numeric computations. |
</ | </ | ||
You can download the Jas4pp program using the [[http:// | You can download the Jas4pp program using the [[http:// | ||
- | Then run these commands to install the package using Linux/Mac with the " | + | |
+ | You can use Jas4pp installer program (jas4pp-[VERSION]-installer.jar). | ||
+ | It asks several questions and creates an icon on a desktop. It is recommended to install the program in " | ||
+ | |||
+ | Alternatively, | ||
+ | Run these commands to install the package using Linux/Mac with the " | ||
<code bash> | <code bash> | ||
Line 62: | Line 68: | ||
bash> jaspp | bash> jaspp | ||
</ | </ | ||
- | The last command starts Jas4PP GUI. | + | The last command starts Jas4PP GUI: |
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | ====== How to run ====== | ||
+ | |||
+ | Use this GUI to explore examples with data visualisation shown in the main window: | ||
+ | [JAS4PP examples]-[Python examples] and then [F2] (or use the mouse menu) to execute: | ||
+ | |||
+ | {{: | ||
If you run Jython/ | If you run Jython/ | ||
Line 332: | Line 349: | ||
rootio.Browser(" | rootio.Browser(" | ||
</ | </ | ||
+ | The browser | ||
The process the tree " | The process the tree " | ||
Here is a simple code to show a histogram with particle ID: | Here is a simple code to show a histogram with particle ID: | ||
- | |||
<hidden Click here to show a Python code to read Delphes files> | <hidden Click here to show a Python code to read Delphes files> | ||
<code python> | <code python> | ||
Line 348: | Line 365: | ||
reader = RootFileReader(xf) | reader = RootFileReader(xf) | ||
- | |||
tree = reader.get(" | tree = reader.get(" | ||
- | maxevents=tree.getEntries() | ||
branches=tree.getBranches() | branches=tree.getBranches() | ||
print "Nr of events=", | print "Nr of events=", | ||
Line 369: | Line 384: | ||
print PID.getName(), | print PID.getName(), | ||
- | ### plot particle ID ## | ||
from jhplot import * | from jhplot import * | ||
- | h1 = H1D(" | + | h1 = H1D(" |
pid=leaves.get(0) # get values with PID for all events | pid=leaves.get(0) # get values with PID for all events | ||
Line 385: | Line 399: | ||
- | Note this code only works for integer values. If you need to extract double, float or boolean, use the Java class "Delphes". | + | Note this code only works for integer values |
- | Here is an example that use high-level classes to read PT and ETA of particles: | + | |
+ | If you need to extract double, float or boolean | ||
+ | getFloat, getDouble, getInt, and getBool. | ||
+ | Here is an example that uses high-level classes to read transverse momentum (PT) and pseudorapidity (ETA) of Monte Carlo particles: | ||
Line 394: | Line 411: | ||
from rootio import * | from rootio import * | ||
- | xf=" | + | reader |
- | + | tree = reader.get(" | |
- | # examine file before doing anything | + | |
- | # import rootio | + | |
- | # rootio.Browser(xf) | + | |
- | + | ||
- | reader = RootFileReader(xf) | + | |
- | tree = reader.get(" | + | |
- | maxevents=tree.getEntries() | + | |
branches=tree.getBranches() | branches=tree.getBranches() | ||
print "Nr of events=", | print "Nr of events=", | ||
print "Nr of branches=", | print "Nr of branches=", | ||
print " | print " | ||
- | for l in xrange( branches.size() | + | for l in xrange( branches.size() ): |
print " | print " | ||
- | particles=tree.getBranch(" | + | particles=tree.getBranch(" |
ptEvents=Delphes.getFloat(particles," | ptEvents=Delphes.getFloat(particles," | ||
etaEvents=Delphes.getFloat(particles," | etaEvents=Delphes.getFloat(particles," | ||
Line 438: | Line 447: | ||
<note warning> | <note warning> | ||
+ | ====== | ||
+ | |||
+ | Jas4pp can visualize histograms created by Fortran or C++ code (but without using ROOT). For this, use a light stand-alone library called CFBook (See [[https:// | ||
+ | |||
+ | <hidden Click to show the Python code> | ||
+ | <code python> | ||
+ | from jhplot | ||
+ | from jhplot.io import * | ||
+ | |||
+ | hb = CFBook() | ||
+ | hb.read(" | ||
+ | print hb.listAll() | ||
+ | print hb.getKeysH1D() # list keys | ||
+ | h1=hb.getH1D(1) | ||
+ | c1=HPlot(" | ||
+ | c1.setGTitle(" | ||
+ | c1.visible(1) | ||
+ | c1.setAutoRange() | ||
+ | c1.draw(h1) | ||
+ | |||
+ | </ | ||
+ | </ | ||
====== Reading LCIO files ====== | ====== Reading LCIO files ====== | ||
Line 519: | Line 550: | ||
See [[http:// | See [[http:// | ||
+ | ====== Reading LCIO files from Delphes ====== | ||
+ | |||
+ | The Delphes program has somewhat different containers, but they alos can be processed by Jas4pp using Python code. You can find Delphes LCIO files in [[https:// | ||
+ | |||
Line 771: | Line 806: | ||
* N.Nikiforou | * N.Nikiforou | ||
* G.Gavalian (JLab) | * G.Gavalian (JLab) | ||
+ | * Khushi Taori (ANL SULI 2021 student). ROOT6 support | ||
asc/jas4pp.1613520290.txt.gz · Last modified: 2021/02/17 00:04 by asc