Analysis¶
Output of the detector simulation can be analysed at various stages of the workflow using different approaches:
- analysing LCIO files using Python and
pyLCIO
- analysing LCIO files using a Marlin processor
- converting LCIO objects to a ROOT file and analysing that
We will consider the first option here. The second and third options are considered in previous tutorials.
As we have seen in previous sections, the LCIO data format has Python bindings called pyLCIO
, which allow to reading and writing objects in Python. Such analysis is slower to run than a Marlin processor written in C++, but makes the development process much faster and more flexible.
Shorter examples¶
Here are a few more little examples of analyzing the reconstructed files with pyLCIO
.
cd /scratch/${USER}/tutorial2024
# Should take less than 1 minute
python MuC-Tutorial/dumpers/print_calo_digi_relations.py -i output_reco.slcio
# Should take less than 1 minute
python MuC-Tutorial/dumpers/print_calo_cellid.py -i output_reco.slcio
These two examples use LCRelation
objects and cellid
attributes of hits. LCRelation
provide links between LCIO objects; for example, a link between a digitized CalorimeterHit
and its corresponding SimCalorimeterHit
. The cellid
attribute of a hit contains encoded information about the hits location within the detector; for example, its layer.
Longer examples¶
Here are a few more involved examples of analyzing with pyLCIO
. These use larger particle gun samples which are available on /ospool
.
cd /scratch/${USER}/tutorial2024
# Compare the reconstructed track, cluster, and PFO of pions
# Should take 1 minute
python MuC-Tutorial/analysis/pylcio/compare_track_cluster_pfo.py
# Measure the ecal occupancy per layer for high-energy photons
# Should take 1 minute
python MuC-Tutorial/analysis/pylcio/ecal_occupancy_per_layer.py
# Measure the timing of calorimeter deposits for a single photon
# Should take a few seconds
python MuC-Tutorial/analysis/pylcio/ecal_event_display_rt.py
# Make an r-z event display of BIB events
# Should take 1-2 minutes
python MuC-Tutorial/analysis/pylcio/calo_digi_display_rz.py
Pandas example¶
pyLCIO
is a Python library, and we can interface this with other popular Python libraries. Here's an example of converting LCIO information into a Pandas dataframe, from which we can make a plot using matplotlib.