User Tools

Site Tools


asc:jas4pp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
asc:jas4pp [2021/02/17 00:08] – [Analysis of Delphes ROOT files] ascasc:jas4pp [2021/08/06 12:57] – [People] 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://www.lcsim.org|lcsim.org]] developed at SLAC   * [[http://www.lcsim.org|lcsim.org]] developed at SLAC
-  * Many file formats used in HEP, including ROOT6.  See Section [[asc:jas4pp#supported_file_formats|supported file formats]]. +  * Many file formats used in HEP, including ROOT5 / 6(partially).  See Section [[asc:jas4pp#supported_file_formats|supported file formats]]. 
-  * [[https://github.com/gavalian/groot/wiki|GROOT]] abd XROOTD -  data visualization and I/O used at JLab+  * [[https://github.com/gavalian/groot/wiki|GROOT]] and XROOTD -  data visualization and I/O used at JLab
   * [[https://github.com/gavalian/j4np |j4np-physics]] - Physics vectors from JLab   * [[https://github.com/gavalian/j4np |j4np-physics]] - Physics vectors from JLab
   * [[http://java.freehep.org/|FreeHep]] developed at SLAC   * [[http://java.freehep.org/|FreeHep]] developed at SLAC
Line 62: Line 62:
 bash> jaspp    bash> jaspp   
 </code> </code>
-The last command starts Jas4PP GUI.+The last command starts Jas4PP GUI
 + 
 + 
 +{{:asc:jas4pp.png?350|}} 
 + 
 +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: 
 + 
 +{{:asc:jas4pp1.png?350|}} 
  
 If you run Jython/Groovy code in a batch mode, use the following commands: If you run Jython/Groovy code in a batch mode, use the following commands:
Line 348: Line 357:
  
 reader = RootFileReader(xf) reader = RootFileReader(xf)
- 
 tree = reader.get("Delphes") tree = reader.get("Delphes")
-maxevents=tree.getEntries() 
 branches=tree.getBranches() branches=tree.getBranches()
 print "Nr of events=",tree.getEntries() print "Nr of events=",tree.getEntries()
Line 386: Line 393:
 Note this code only works for integer values since we did not specify which value needs to be extracted. Note this code only works for integer values since we did not specify which value needs to be extracted.
  
-If you need to extract double, float or boolean values, use the Java class "Delphes".+If you need to extract double, float or boolean values, use the [[https://atlaswww.hep.anl.gov/asc/jas4pp/api/rootio/Delphes.html|Delphes class]] and its "getmethods, 
 +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: Here is an example that uses high-level classes to read transverse momentum (PT) and pseudorapidity (ETA) of Monte Carlo particles:
  
Line 396: Line 404:
  
 reader = RootFileReader("mg5_ttbar_Njet_001.root" ) reader = RootFileReader("mg5_ttbar_Njet_001.root" )
-tree = reader.get("Delphes"); +tree = reader.get("Delphes")
-maxevents=tree.getEntries()+
 branches=tree.getBranches() branches=tree.getBranches()
 print "Nr of events=",tree.getEntries() print "Nr of events=",tree.getEntries()
 print "Nr of branches=",branches.size() print "Nr of branches=",branches.size()
 print "Branches:" print "Branches:"
-for l in xrange( branches.size()  ):+for l in xrange( branches.size() ):
    print "Branch=",l," name=",(branches.get(l)).getName()    print "Branch=",l," name=",(branches.get(l)).getName()
  
-particles=tree.getBranch("Particle") # get  generator particles +particles=tree.getBranch("Particle"       # generator particles
 ptEvents=Delphes.getFloat(particles,"PT"  # get PT array ptEvents=Delphes.getFloat(particles,"PT"  # get PT array
 etaEvents=Delphes.getFloat(particles,"Eta") # get ETA array etaEvents=Delphes.getFloat(particles,"Eta") # get ETA array
Line 433: Line 439:
 <note warning>Reading Delphes trees is an experimental feature. Under study </note> <note warning>Reading Delphes trees is an experimental feature. Under study </note>
  
 +======  Histograms from Fortran and C++ ======
 +
 +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://datamelt.org/?id=cfbook-library|CFBook]]). You can compile it using gcc (for C++ programs) or gfortran (for Fortran program). This library creates XML file with 1D and 2D histograms, that can be read by Jas4pp. Here is an example of reading 1D histogram from fortran.xml file:
 +
 +<hidden Click to show the Python code>
 +<code python>
 +from jhplot  import *
 +from jhplot.io import *
 +
 +hb = CFBook()
 +hb.read("fortran.xml")
 +print hb.listAll()
 +print hb.getKeysH1D() # list keys
 +h1=hb.getH1D(1)        # use the key 1 to retrive H1D
 +c1=HPlot("Test")
 +c1.setGTitle("Histograms from a file");
 +c1.visible(1)
 +c1.setAutoRange()
 +c1.draw(h1)
 +
 +</code>
 +</hidden>
  
 ====== Reading LCIO files ====== ====== Reading LCIO files ======
Line 766: Line 794:
   * N.Nikiforou   * N.Nikiforou
   * G.Gavalian (JLab)   * G.Gavalian (JLab)
 +  * Khushi Taori (ANL SULI 2021 student). ROOT6 support  validation
  
  
asc/jas4pp.txt · Last modified: 2024/01/30 15:50 by asc