User Tools

Site Tools


community:refhepsim_analysis

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
community:refhepsim_analysis [2015/05/10 20:49]
asc [HepSim Analysis Primer]
community:refhepsim_analysis [2016/04/28 15:24] (current)
asc [HepSim Analysis Primer]
Line 2: Line 2:
    
  
-This analysis tutorial covers Java/Jython codding. Look at the [[http://atlaswww.hep.anl.gov/hepsim/description.php|main description]] for other topics.+This analysis tutorial covers Python codding on the Java platform (Jython). Look at the [[http://atlaswww.hep.anl.gov/hepsim/description.php|main description]] for other topics.
 For C++/ROOT, please refer [[asc:promc| ProMC web page]]. For C++/ROOT, please refer [[asc:promc| ProMC web page]].
  
-To ensure platform independence and a possibility to run using web browsers, validation programs are written in Jython, which is an implementation of the Python language on the Java platform.+To ensure platform independence and a possibility to run programs using web browsers [(Cross-platform validation and analysis environment for particle physics, S.V. Chekanov, I. Pogrebnyak, D. Wilbern, arXiv:1510.06638 http://arxiv.org/abs/1510.06638)], validation programs are written in Jython, which is an implementation of the Python language on the Java platform.
 Look at several links: Look at several links:
  
   * [[http://www.jython.org/jythonbook/en/1.0/| Jython book]]   * [[http://www.jython.org/jythonbook/en/1.0/| Jython book]]
-  * [[http://jwork.org/dmelt/wikidoc/doku.php?id=start| DataMelt Jython manual]]+  * [[http://jwork.org/dmelt/wikidoc/doku.php?id=start| DMelt manual (community version)]]
  
  
Line 16: Line 16:
   *  Using Java web start from the browser.   *  Using Java web start from the browser.
   * "hs-ide file.py" command to launch the editor (from the hs-tools package)   * "hs-ide file.py" command to launch the editor (from the hs-tools package)
-  * "hs-run file.py" command to run using command-line batch mode (from the hs-tools package) +  * "hs-run file.py" command to run using command-line ("batch mode", from the hs-tools package) 
-  * [[http://jwork.org/dmelt/ |DataMelt  IDE]] +  * [[http://atlaswww.hep.anl.gov/asc/jas4pp/| Jas4pp]] 
 +  * [[http://jwork.org/dmelt/ |DMelt  IDE]] 
  
  
Line 64: Line 65:
 from proto import FileMC         from proto import FileMC        
 f=FileMC("data.promc"             # get input file from current directory (or URL) f=FileMC("data.promc"             # get input file from current directory (or URL)
 +des=f.getDescription()              # get description
 header = f.getHeader()              # to access information on this file header = f.getHeader()              # to access information on this file
 un=float(header.getMomentumUnit())  # conversion energy units un=float(header.getMomentumUnit())  # conversion energy units
Line 71: Line 73:
 The latter  2 values are needed to convert from integer presentation of 4-momenta, typically used for variable byte encoding to save space, The latter  2 values are needed to convert from integer presentation of 4-momenta, typically used for variable byte encoding to save space,
 to double values. The values are typically around 1000-10000, depending on importance of representing low-momentum with a better precision.  to double values. The values are typically around 1000-10000, depending on importance of representing low-momentum with a better precision. 
-The header file also stores some additional information. Look at Java API:+The header file also stores some additional information. Look at Java API
  
 +  * [[http://atlaswww.hep.anl.gov/asc/promc/hepsim/doc/api/ | HepSim API]] for FileMC
   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/promc/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for MC records   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/promc/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for MC records
   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for NLO records   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for NLO records
Line 100: Line 103:
   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMC.ProMCEvent.Particles.html | Particles]] for NLO   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMC.ProMCEvent.Particles.html | Particles]] for NLO
  
-In the above example, "pa" is an object [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMC.ProMCEvent.Particles.html | Particles]] with particle information. We can create a typical Lorentz particle using the class [[http://jwork.org/scavis/api/doc.php/hephysics/particle/LParticle|LParticle]] as:+In the above example, "pa" is an object [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMC.ProMCEvent.Particles.html | Particles]] with particle information. We can create a typical Lorentz particle using the class [[http://jwork.org/dmelt/api/doc.php/hephysics/particle/LParticle|LParticle]] as:
  
 <code python> <code python>
Line 118: Line 121:
            e= pa.getEnergy(j)/un     # energy            e= pa.getEnergy(j)/un     # energy
            m= pa.getMass(j)/un       # mass            m= pa.getMass(j)/un       # mass
-           p=LParticle(pa.getPx(j)/un,pa.getPy(j)/un,pa.getPz(j)/un,pa.getEnergy(j)/un,pa.getMass(j)/un)+           p=LParticle(px,py,pz,e,m# fill it
 </code> </code>
 To access the PDG status code, us "pa.getPdgId(j) method. For stable particles, use the HEPEVT status code (the method "pa.getStatus(j)"). To access the PDG status code, us "pa.getPdgId(j) method. For stable particles, use the HEPEVT status code (the method "pa.getStatus(j)").
Line 137: Line 140:
 Look at the API of the Lorentz-particle class: Look at the API of the Lorentz-particle class:
  
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/particle/LParticle|LParticle]] - a simple Lorentz particle with transformations +  * [[http://jwork.org/dmelt/api/doc.php/hephysics/particle/LParticle|LParticle]] - a simple Lorentz particle with transformations 
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/particle/HEParticle|HEParticle]] - a typical HEP particle based on the Lorentz particle with transformations+  * [[http://jwork.org/dmelt/api/doc.php/hephysics/particle/HEParticle|HEParticle]] - a typical HEP particle based on the Lorentz particle with transformations
  
-In addition, you can build an ArrayList with particles using a convenient class [[http://jwork.org/scavis/api/doc.php/hephysics/hepsim/PromcUtil|PromcUtil]]. +In addition, you can build an ArrayList with particles using a convenient class [[http://jwork.org/dmelt/api/doc.php/hephysics/hepsim/PromcUtil|PromcUtil]]. 
-Also, when pssible, use the method "getParticle()" that returns a [[http://jwork.org/scavis/api/doc.php/hephysics/particle/HEParticle|HEParticle]] particle with 4-momenta and postilion.+Also, when possible, use the method "getParticle()" that returns a [[http://jwork.org/dmelt/api/doc.php/hephysics/particle/HEParticle|HEParticle]] particle with 4-momenta and postilion.
  
 <code python> <code python>
Line 158: Line 161:
 The above example fills a list with all stable particles, without any cuts on pT and Eta (2 second arguments). The above example fills a list with all stable particles, without any cuts on pT and Eta (2 second arguments).
  
-The next example creates [[http://jwork.org/scavis/api/doc.php/hephysics/particle/HEParticle|HEParticle]] using [[http://jwork.org/scavis/api/doc.php/hephysics/hepsim/PromcUtil|PromcUtil]]:+The next example creates [[http://jwork.org/dmelt/api/doc.php/hephysics/particle/HEParticle|HEParticle]] using [[http://jwork.org/dmelt/api/doc.php/hephysics/hepsim/PromcUtil|PromcUtil]]:
 <code python> <code python>
 from proto import FileMC from proto import FileMC
Line 177: Line 180:
  
 In this example, we fill a list with all stable particles (status "1"), without any pT cut ("-1") and maximum absolute value of pseudo-rapidity 1000. In this example, we fill a list with all stable particles (status "1"), without any pT cut ("-1") and maximum absolute value of pseudo-rapidity 1000.
-The object "par" is a list with [[ http://jwork.org/scavis/api/doc.php/hephysics/jet/ParticleD|ParticleD]].+The object "par" is a list with [[ http://jwork.org/dmelt/api/doc.php/hephysics/jet/ParticleD|ParticleD]].
  
 Finality, let us extend the above example: we will create anti-kT jets using the list "par": Finality, let us extend the above example: we will create anti-kT jets using the list "par":
Line 201: Line 204:
                  print "pT of a leading jet =",jets[0].perp()," GeV"                   print "pT of a leading jet =",jets[0].perp()," GeV" 
 </code> </code>
-To build anti-kT jets, we use [[http://jwork.org/scavis/api/doc.php/hephysics/jet/JetN2|JetN2 clustering algorithm]] implemented in Java. It is a similar to FastJet N*N algorithm and typically shows +To build anti-kT jets, we use [[http://jwork.org/dmelt/api/doc.php/hephysics/jet/JetN2|JetN2 clustering algorithm]] implemented in Java. 
 +The description of this algorithm is given in [[http://arxiv.org/abs/1510.06638]]. 
 + It is a similar to FastJet N*N algorithm and typically shows 
 a performance similar to the C++ analogue. Tests indicate that the JetN2 clustering algorithm is about twice slower that C++, but by a factor 20 faster than the traditional N^3 jet clustering algorithms. You can find benchmarking results in [[https://github.com/chekanov/hepjet/|HepJet]] github repository. a performance similar to the C++ analogue. Tests indicate that the JetN2 clustering algorithm is about twice slower that C++, but by a factor 20 faster than the traditional N^3 jet clustering algorithms. You can find benchmarking results in [[https://github.com/chekanov/hepjet/|HepJet]] github repository.
 Look at a typical example of jet clustering in the [[http://atlaswww.hep.anl.gov/hepsim/code.php?item=88&code=qcd_pythia8_ptbins_jets.py| qcd_pythia8_ptbins_jets.py code]]. Look at a typical example of jet clustering in the [[http://atlaswww.hep.anl.gov/hepsim/code.php?item=88&code=qcd_pythia8_ptbins_jets.py| qcd_pythia8_ptbins_jets.py code]].
Line 226: Line 231:
 ====== Plots and histograms ====== ====== Plots and histograms ======
  
-HepSim uses histogram packages supported by SCaVis (and implemented using JAIDA and FreeHep).+HepSim uses histogram packages supported by DataMelt (and implemented using JAIDA and FreeHep).
  
 Here are a few most common classes: Here are a few most common classes:
  
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/HPlot|HPlot]] - simple canvas to show graphs +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/HPlot|HPlot]] - simple canvas to show graphs 
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/H1D|H1D]] - 1D histogram +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/H1D|H1D]] - 1D histogram 
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/H1D|H2D]] - 2D histogram +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/H1D|H2D]] - 2D histogram 
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/P1D|P1D]] - data container with support of errors+  * [[http://jwork.org/dmelt/api/doc.php/jhplot/P1D|P1D]] - data container with support of errors
  
-The main canvas to show histograms [[http://jwork.org/scavis/api/doc.php/jhplot/H1D|H1D]] and data points  [[http://jwork.org/scavis/api/doc.php/jhplot/P1D|P1D]]  is [[http://jwork.org/scavis/api/doc.php/jhplot/HPlot|HPlot]]. To process scripts in a background without a pop-up [[http://jwork.org/scavis/api/doc.php/jhplot/HPlot|HPlot]], use method "visible(False)", and set sys.exit(0) at the end of the scripts. +The main canvas to show histograms [[http://jwork.org/dmelt/api/doc.php/jhplot/H1D|H1D]] and data points  [[http://jwork.org/dmelt/api/doc.php/jhplot/P1D|P1D]]  is [[http://jwork.org/dmelt/api/doc.php/jhplot/HPlot|HPlot]]. To process scripts in a background without a pop-up [[http://jwork.org/dmelt/api/doc.php/jhplot/HPlot|HPlot]], use method "visible(False)", and set sys.exit(0) at the end of the scripts. 
  
 Usually, plots are saved in the vector-graphics SVG format. They can be converted on Linux to EPS as: Usually, plots are saved in the vector-graphics SVG format. They can be converted on Linux to EPS as:
Line 243: Line 248:
 However, one can also save images in PDF or EPS using the corresponding file extensions for the "export" command. However, one can also save images in PDF or EPS using the corresponding file extensions for the "export" command.
  
-In addition, data are saved in the form of XML (with the extension ".jdat") files. Look the manual [[http://jwork.org/scavis/wikidoc/doku.php?id=man:io:crossplatform|SCavIs IO]].+In addition, data are saved in the form of XML (with the extension ".jdat") files. Look the manual [[http://jwork.org/dmelt/wikidoc/doku.php?id=man:io:crossplatform|DatMelt IO]].
 For example, one can read such files and create histograms or data objects as: For example, one can read such files and create histograms or data objects as:
  
Line 253: Line 258:
 print p1.toString() print p1.toString()
 </code> </code>
-The object p1 belongs to the class [[http://jwork.org/scavis/api/doc.php/jhplot/P1D|P1D]]. Analogously, one can store histograms etc.+The object p1 belongs to the class [[http://jwork.org/dmelt/api/doc.php/jhplot/P1D|P1D]]. Analogously, one can store histograms etc.
 ====== HepSim API ====== ====== HepSim API ======
  
Line 260: Line 265:
 stored inside ProMC data files: stored inside ProMC data files:
  
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/HPlot | HPlot]] - simple canvas to show graphs +===== Histograms and plots ===== 
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/H1D | H1D]] - 1D histogram + 
-  * [[http://jwork.org/scavis/api/doc.php/jhplot/H1D | H2D]] - 2D histogram +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/HPlot|HPlot]] - canvas to show X-Y data and histograms in 2D 
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/hepsim/PromcUtil|PromcUtil]] convenient method to fill arrays with particles from ProMc files +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/HPlot|HPlot3D]] - canvas to show X-Y-Z data and histograms in 3D 
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/particle/LParticle|LParticle]] a HEP particle with the Lorentz transformations +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/H1D|H1D]] - 1D histogram 
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/jet/FastParticle|FastParticle]] a HEP particles with precomputed Et2,Eta,Phi for jet algorithms.  +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/H1D|H2D]] - 2D histogram 
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/jet/JetN2|JetN2]] recommended kt-type jet clustering algorithms (kT, anti-kT) implemented in Java using N^2 approach, similar to FastJet +  * [[http://jwork.org/dmelt/api/doc.php/jhplot/P1D|P1D]] - X-Y container with support of 2-level errors 
-  * [[http://jwork.org/scavis/api/doc.php/hephysics/jet/SCJet|SCJet]] traditional kt-type jet clustering algorithms (kT, anti-kT) implemented in Java using N^3 approach.+ 
 +See also other math and graphics classes in the [[http://jwork.org/dmelt/api/doc.php/jhplot/package-summary | jhplot package]].  
 +===== Lorentz particles and Jets ===== 
 + 
 +  * [[http://jwork.org/dmelt/api/doc.php/hephysics/hepsim/PromcUtil|PromcUtil]] convenient method to fill arrays with particles from ProMC files 
 +  * [[http://jwork.org/dmelt/api/doc.php/hephysics/particle/LParticle|LParticle]] a HEP particle with the Lorentz transformations 
 +  * [[http://jwork.org/dmelt/api/doc.php/hephysics/jet/FastParticle|FastParticle]] a HEP particles with precomputed Et2,Eta,Phi for jet algorithms.  
 +  * [[http://java.freehep.org/freehep-physics/apidocs/hep/physics/vec/package-summary.html|Physics vectors]] typical HEP physics vectors the Lorentz transformations 
 +  * [[http://jwork.org/dmelt/api/doc.php/hephysics/jet/JetN2|JetN2]] recommended kt-type jet clustering ng algorithms (kT, anti-kT, CA) implemented in Java using N^2 approach, similar to the FastJet algorithm. Recommended for hadron collisions 
 +  * [[http://jwork.org/dmelt/api/doc.php/hephysics/jet/SCJet|SCJet]] traditional kt-type jet clustering algorithms (kT, anti-kT) for pp implemented in Java using N^3 approach (slow)  
 +  * [[http://java.freehep.org/freehep-physics/apidocs/hep/physics/jet/package-summary.html|Jets and event shapes]] traditional jet algorithms and event shapes for e+e- (Geneva, Jade, Durham jets) 
      
      
 Java implementation of the longitudinally invariant kT and anti-kT clustering algorithms uses the E-scheme to combine particles (p1+p2) and Eta-Phi space (not Rapidity-Phi). Also, Cambridge/Aachen jets are supported.   [[https://github.com/chekanov/hepjet/|HepJet on github]] shows  benchmarks of the Java implementation of the anti-KT with the original FastJet package. Java implementation of the longitudinally invariant kT and anti-kT clustering algorithms uses the E-scheme to combine particles (p1+p2) and Eta-Phi space (not Rapidity-Phi). Also, Cambridge/Aachen jets are supported.   [[https://github.com/chekanov/hepjet/|HepJet on github]] shows  benchmarks of the Java implementation of the anti-KT with the original FastJet package.
  
-See also other classes in [[http://jwork.org/scavis/api/doc.php/jhplot/package-summary | jhplot package summary]].  + 
-You can build the standard kt-jets using [[http://jwork.org/scavis/api/doc.php/hephysics/hepsim/PromcUtil | PromcUtil]], followed by the  +You can build the standard kt-jets using [[http://jwork.org/dmelt/api/doc.php/hephysics/hepsim/PromcUtil | PromcUtil]], followed by the  
-[[http://jwork.org/scavis/api/doc.php/hephysics/jet/KTjet | KTjet]] class. Also, look at the ProMC Java API that is used to store data:+[[http://jwork.org/dmelt/api/doc.php/hephysics/jet/KTjet | KTjet]] class.  
 + 
 +===== Working with ProMC files ===== 
 + 
 +Also, look at the ProMC Java API that is used to store data:
  
   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/promc/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for MC and [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for NLO   * [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/promc/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for MC and [[http://atlaswww.hep.anl.gov/asc/promc/doc/api/pronlo/io/ProMCHeaderFile.ProMCHeader.html | ProMCHeader]] for NLO
Line 284: Line 303:
 It is simplified compared to full MC simulations, and also includes additional arrays "idata" and "fdata" to store It is simplified compared to full MC simulations, and also includes additional arrays "idata" and "fdata" to store
 information on event weights and uncertainties. information on event weights and uncertainties.
 +
 +The project uses the community edition of [[http://jwork.org/dmelt/|DMelt]] project and  the FreeHEP Java Libraries.
  
  --- //[[[email protected]|Sergei Chekanov]] 2015/03/06 08:49//  --- //[[[email protected]|Sergei Chekanov]] 2015/03/06 08:49//
community/refhepsim_analysis.1431290983.txt.gz · Last modified: 2015/05/10 20:49 by asc