Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
hepsim:jas4pp [2017/02/07 02:54] hepsim17 |
hepsim:jas4pp [2021/02/17 16:15] hepsim17 [Reading ROOT files] |
||
---|---|---|---|
Line 6: | Line 6: | ||
====== | ====== | ||
- | [[http:// | + | [[https:// |
a data-analysis environment for detector and physics studies of future circular colliders. | 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:// | + | Jas4PP is a merge of several open-source Java projects, such as [[http:// |
The installation does not have external dependencies besides Java. Make sure that Oracle Java8 and above is installed (not OpenJDK). | The installation does not have external dependencies besides Java. Make sure that Oracle Java8 and above is installed (not OpenJDK). | ||
- | You can download the Jas4pp program using the [[http:// | + | You can download the Jas4pp program using the [[https:// |
Then run these commands to install the package using Linux/Mac with the " | Then run these commands to install the package using Linux/Mac with the " | ||
<code bash> | <code bash> | ||
- | wget http:// | + | wget https:// |
tar -zvxf jas4pp.tgz | tar -zvxf jas4pp.tgz | ||
cd jas4pp | cd jas4pp | ||
Line 41: | Line 41: | ||
* Downloading and searching HepSim data | * Downloading and searching HepSim data | ||
* Processing ProMC files from HepSim | * Processing ProMC files from HepSim | ||
+ | * Processing ROOT files created by the Delphes program for fast simulation | ||
* Running over SLCIO files with Geant4 simulated / reconstructed events. | * Running over SLCIO files with Geant4 simulated / reconstructed events. | ||
* Data analysis (jets, physics vectors, histogram packages) | * Data analysis (jets, physics vectors, histogram packages) | ||
- | * Visualisation | + | * Visualization |
- | + | ||
- | You can find more details in [[http:// | + | |
+ | You can find more details in [[https:// | ||
+ | <note tip>Note that you can also use the [[hepsim: | ||
+ | Jas4pp</ | ||
====== Examples ====== | ====== Examples ====== | ||
Line 59: | Line 61: | ||
fpad examples/ | fpad examples/ | ||
</ | </ | ||
- | The last example from the [[http:// | + | The last example from the [[https:// |
You can also run these examples as " | You can also run these examples as " | ||
Line 110: | Line 112: | ||
{{: | {{: | ||
</ | </ | ||
+ | |||
====== Reading LCIO files ====== | ====== Reading LCIO files ====== | ||
Line 189: | Line 192: | ||
Note that we explicitly mange memory in case of very large files, forcing the garbage collector for each file. In many cases, this is not needed since JVM takes care of memory leakage. | Note that we explicitly mange memory in case of very large files, forcing the garbage collector for each file. In many cases, this is not needed since JVM takes care of memory leakage. | ||
- | You can find more examples in [[community: | + | You can find more examples in [[: |
+ | |||
+ | Also, look at concrete example of how to analyze single particles in [[: | ||
+ | |||
+ | |||
+ | ====== | ||
+ | |||
+ | Jas4pp natively reads commonly used objects and data structures from [[https:// | ||
+ | ROOT files can be loaded using the Jas4pp menu [File]-[Open data source]-[Root file] (*.root). | ||
+ | |||
+ | In addition, one can work with ROOT files using Python/ | ||
+ | One can find some examples in the directory " | ||
+ | |||
+ | <hidden Show example of a Python code here> | ||
+ | <code python> | ||
+ | from hep.io.root.interfaces import TTree | ||
+ | from hep.io.root import RootFileReader | ||
+ | |||
+ | reader = RootFileReader(" | ||
+ | |||
+ | tree = reader.get(" | ||
+ | maxevents=tree.getEntries() | ||
+ | |||
+ | leaves = tree.getLeaves() | ||
+ | nrleaves=leaves.size() | ||
+ | |||
+ | print "Nr of events=", | ||
+ | print "Nr of leaves=", | ||
+ | |||
+ | print " | ||
+ | for l in xrange( nrleaves ): | ||
+ | print " | ||
+ | |||
+ | print "Run over events" | ||
+ | f0=leaves.get(0); | ||
+ | f1=leaves.get(1); | ||
+ | f2=leaves.get(2); | ||
+ | for i in xrange(tree.getEntries()): | ||
+ | print f0.getValue(i), | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | The example directory also shows how to read histograms. | ||
+ | Similar examples can be made using Java or Groovy scripting. | ||
+ | |||
+ | The supported ROOT interfaces are: | ||
+ | |||
+ | <hidden show more details on ROOT interfaces here> | ||
+ | TArrayC | ||
+ | TArrayD | ||
+ | TArrayF | ||
+ | TArrayI | ||
+ | TArray | ||
+ | TArrayL | ||
+ | TAttAxis | ||
+ | TAttFill | ||
+ | TAttLine | ||
+ | TAttMarker | ||
+ | TAxis | ||
+ | TBasket | ||
+ | TBranchClones | ||
+ | TBranchElement | ||
+ | TBranch | ||
+ | TBranchObject | ||
+ | TClonesArray | ||
+ | TCollection | ||
+ | TDatime | ||
+ | TDirectory | ||
+ | TFile | ||
+ | TGraph | ||
+ | TH1D | ||
+ | TH1F | ||
+ | TH1 | ||
+ | TH2D | ||
+ | TH2F | ||
+ | TH2 | ||
+ | TKey | ||
+ | TLeafB | ||
+ | TLeafC | ||
+ | TLeafD | ||
+ | TLeafElement | ||
+ | TLeafF | ||
+ | TLeafI | ||
+ | TLeaf | ||
+ | TLeafL | ||
+ | TLeafObject | ||
+ | TLeafO | ||
+ | TLeafS | ||
+ | TList | ||
+ | TMap | ||
+ | TNamed | ||
+ | TObjArray | ||
+ | TObject | ||
+ | TProfile | ||
+ | TSeqCollection | ||
+ | TStreamerBase | ||
+ | TStreamerBasicPointer | ||
+ | TStreamerBasicType | ||
+ | TStreamerElement | ||
+ | TStreamerInfo | ||
+ | TStreamerLoop | ||
+ | TStreamerObjectAny | ||
+ | TStreamerObject | ||
+ | TStreamerObjectPointer | ||
+ | TStreamerString | ||
+ | TString | ||
+ | TTree | ||
+ | </ | ||
+ | |||
+ | One can browser histogram (or ROOT objects) using this: | ||
+ | |||
+ | <code python> | ||
+ | import rootio | ||
+ | rootio.HBrowser(" | ||
+ | rootio.Browser(" | ||
+ | </ | ||
+ | |||
+ | You will see the browsers: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The script that call these browsers | ||
+ | |||
+ | |||
+ | To read ROOT files from Delphes simulations, | ||
+ | [[https:// | ||
+ | getFloat, getDouble, getInt, and getBool. But first, explore the Delphes ROOT file using the browser shown above. | ||
+ | |||
+ | Here is an example that uses high-level classes to read transverse momentum (PT) and pseudorapidity (ETA) of Monte Carlo particles: | ||
+ | |||
+ | |||
+ | <hidden Click here to show a Python code to read Delphes files> | ||
+ | <code python> | ||
+ | from hep.io.root import RootFileReader | ||
+ | from rootio import * | ||
+ | |||
+ | reader = RootFileReader(" | ||
+ | tree = reader.get(" | ||
+ | maxevents=tree.getEntries() | ||
+ | branches=tree.getBranches() | ||
+ | print "Nr of events=", | ||
+ | print "Nr of branches=", | ||
+ | print " | ||
+ | for l in xrange( branches.size() | ||
+ | print " | ||
+ | |||
+ | particles=tree.getBranch(" | ||
+ | |||
+ | ptEvents=Delphes.getFloat(particles," | ||
+ | etaEvents=Delphes.getFloat(particles," | ||
+ | |||
+ | from jhplot import * | ||
+ | h1 = H1D(" | ||
+ | h2 = H1D(" | ||
+ | for i in xrange(tree.getEntries()): | ||
+ | | ||
+ | for j in xrange(len(pt)): | ||
+ | | ||
+ | | ||
+ | c=HPlot(" | ||
+ | c.visible() | ||
+ | c.setAutoRange() | ||
+ | c.draw(h1) | ||
+ | |||
+ | c.cd(2,1) | ||
+ | c.setAutoRange() | ||
+ | c.draw(h2) | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | <note warning> | ||
+ | |||
+ | ====== Using GUI mode ====== | ||
+ | |||
+ | |||
+ | You can also run Jas4pp in a GUI mode. You can process scripts that read PROMC and LCIO files from these HepSim pages: | ||
+ | |||
+ | - [[https:// | ||
+ | - [[https:// | ||
+ | |||
+ | |||
+ | Download any of these scripts, and open it using the " | ||
+ | |||
+ | {{: | ||
+ | |||
- | Also, look at concrete example of how to analyze single particles in [[fcs: | ||
====== Programming with HepSim ====== | ====== Programming with HepSim ====== | ||
Jas4pp can be used to write Jython scripts to validate HepSim ProMC files. Please look at | Jas4pp can be used to write Jython scripts to validate HepSim ProMC files. Please look at | ||
- | [[asc: | + | [[https:// |
Line 212: | Line 404: | ||
Here are a few most common classes: | Here are a few most common classes: | ||
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
The main canvas to show histograms [[http:// | The main canvas to show histograms [[http:// | ||
- | In addition, data are saved in the form of XML (with the extension " | + | In addition, data are saved in the form of XML (with the extension " |
===== Lorentz particles and Jets ===== | ===== Lorentz particles and Jets ===== | ||
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
* [[http:// | * [[http:// | ||
- | * [[http://jwork.org/dmlt/ | + | * [[https://datamelt.org/ |
- | * [[http://jwork.org/dmelt/ | + | * [[https://datamelt.org/ |
* [[http:// | * [[http:// | ||
| | ||
Line 235: | Line 427: | ||
- | You can build the standard kt-jets using [[http://jwork.org/dmelt/ | + | You can build the standard kt-jets using [[http://datamelt.org/ |
- | [[http://jwork.org/dmelt/ | + | [[https://datamelt.org/ |
- | + | ====== Visualizing | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ====== Visualizing | + | |
You can run Jas+Wired to visualize the simulated events. | You can run Jas+Wired to visualize the simulated events. | ||
Line 251: | Line 438: | ||
</ | </ | ||
This will start a Jas3-like environment | This will start a Jas3-like environment | ||
- | Then copy the detector geometry file from the [[http:// | + | Then copy the detector geometry file from the [[https:// |
<code bash> | <code bash> | ||
- | wget http:// | + | wget https:// |
</ | </ | ||
This will create a directory " | This will create a directory " | ||
Line 271: | Line 458: | ||
| | ||
Now press [Go] again to look at next event. | Now press [Go] again to look at next event. | ||
- | + | If you want to see how data records are organized inside the slcio file, | |
- | If you want to see how data records are organized inside the slcio file, | + | |
do this **[File]-[New]-[LCSim Event browser]** | do this **[File]-[New]-[LCSim Event browser]** | ||
- | Generally, when you open a SLCIO file from the HepSim, you do not need to load the geometry file. The geometry file will be downloaded automatically from HepSim and will be put to " | + | |
+ | Here is an example of how to visualize LCIO files from the [[http:// | ||
+ | |||
+ | <code bash> | ||
+ | wget https:// | ||
+ | ./jaspp pgun_muon1024gev_001_pandora.slcio | ||
+ | </ | ||
+ | |||
+ | Click " | ||
+ | " | ||
+ | Then go to the next event, click "Go next" in the menu. This image illustrates a single electron event: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Similarly, you can view any events form the HepSim directory. The LCIO event file automatically installs | ||
+ | the required detector geometry, i.e. | ||
Line 311: | Line 512: | ||
* S.Chekanov (ANL, main developer) | * S.Chekanov (ANL, main developer) | ||
* E.May (ANL, debugging, Wired4) | * E.May (ANL, debugging, Wired4) | ||
+ | * Gagik Gavalian (JLab) | ||
Line 318: | Line 520: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | * [[http://jwork.org/dmelt]] - DMelt | + | * [[http://datamelt.org]] - DataMelt |
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// |