JetAnalysis
- class JetAnalysis.JetAnalysis[source]
This class analyzes simulation output using the fastjet python package. For further information on the jet finding algorithms please have a look at the documentation.
Attention: For a proper jet hole subtraction the status of the particles has to be set. This is only given for read in from Jetscape output. With Oscar read in this has to be set by hand before doing the jet finding.
Notes
The columns of the output file include the following quantities:
Quantity
Description
index
Index of the particle in the jet. Index 0 is always the jet itself, all higher values are the associated particles of the jet.
\(p_{\mathrm{T}}\)
Transverse momentum of the jet / associated particle.
\(\eta\)
Pseudorapidity of the jet / associated particle.
\(\varphi\)
Azimuth of the jet / associated particle.
status flag
Always set to 10.
jet pid
Always set to 10.
energy
Energy of the jet / associated particle.
event index
Index of the event in the input hadron data.
Examples
First import your hadron data and maybe perform some cuts:
1>>> from sparkx.Jetscape import Jetscape 2>>> from sparkx.JetAnalysis import JetAnalysis 3>>> 4>>> JETSCAPE_FILE_PATH = [Jetscape_directory]/particle_lists.dat 5>>> 6>>> # Jetscape object containing all events 7>>> hadron_data_set = Jetscape(JETSCAPE_FILE_PATH) 8>>> hadron_data = hadron_data_set.charged_particles().particle_objects_list()
Then you can perform the jet analysis:
1>>> JET_ANALYSIS_OUTPUT_PATH = [Jetscape_directory]/jet_analysis.dat 2>>> 3>>> # Create an instance of the JetAnalysis class 4>>> jet_analysis = JetAnalysis() 5>>> 6>>> # Perform the jet analysis 7>>> jet_analysis.perform_jet_finding(hadron_data, jet_R=0.4, jet_eta_range=(-2., 2.), jet_pt_range=(10., None), output_filename=JET_ANALYSIS_OUTPUT_PATH)
If you want to analyze the jets further, you have to read in the jet data from the file like:
1>>> # Create an instance of the JetAnalysis class 2>>> jet_analysis = JetAnalysis() 3>>> 4>>> # Read the jets from file 5>>> jet_analysis.read_jet_data(JET_ANALYSIS_OUTPUT_PATH) 6>>> 7>>> # list of the jets (all lines with index 0 in first column) 8>>> jets = jet_analysis.get_jets() 9>>> # list of the associated particles for all jets (associated hadrons for each jet have a sub-list) 10>>> assoc_hadrons = jet_analysis.get_associated_particles()
- Attributes:
- hadron_data_: list
List of hadron data for each event.
- jet_R_: float
Jet radius parameter.
- jet_eta_range_: tuple
Minimum and maximum pseudorapidity for jet selection.
- jet_pt_range_: tuple
Minimum transverse momentum for jet selection and maximum transverse momentum to write out the jet.
- jet_data_: list
List containing the jet data after
read_jet_data
is used.
Methods
create_fastjet_PseudoJets(event_hadrons):
Convert hadron data to a list of fastjet.PseudoJet objects.
fill_associated_particles(jet, event):
Select particles in the jet cone.
write_jet_output(output_filename, jet, associated_hadrons, new_file=False):
Write the jet and associated hadron information to a CSV file.
perform_jet_finding(output_filename):
Perform the jet analysis for multiple events.
read_jet_data:
Read the jet data from a CSV file.
get_jets:
Get a list of jets from the jet data.
get_associated_particles:
Get a list of associated particles for all jets.
- JetAnalysis.perform_jet_finding(hadron_data, jet_R, jet_eta_range, jet_pt_range, output_filename, assoc_only_charged=True, jet_algorithm=2)[source]
Perform the jet analysis for multiple events. The function generates a file containing the jets consisting of a leading particle and associated hadrons in the jet cone.
- Parameters:
- hadron_data: list
List of hadron data for each event. Use the for example the Jetscape class and generate a
particle_objects_list
.- jet_R: float
Jet radius parameter.
- jet_eta_range: tuple
Minimum and maximum pseudorapidity for jet selection.
None
values are allowed and are exchanged by \(-\infty\) or \(+\infty\) automatically.- jet_pt_range: tuple
Minimum transverse momentum for jet finding algorithm and maximum transverse momentum to write out the jet to a file. Values can be
None
, then the lower bound is set to zero and the upper one to \(+\infty\).- output_filename: str
Filename for the jet output.
- assoc_only_charged: bool
Selects if the associated particles are only charged ones. Default is True.
- jet_algorithm: fastjet.JetAlgorithm, optional
Jet algorithm for jet finding. Default is
fastjet.antikt_algorithm
.
Notes
The standard recombination scheme
E_scheme
of the fastjet package is fixed here.
- JetAnalysis.read_jet_data(input_filename)[source]
Read the jet data from a CSV file and store it in the
JetAnalysis
object.- Parameters:
- input_filename: str
Filename of the CSV file containing the jet data.
- JetAnalysis.get_jets()[source]
Get a list of jets from the jet data.
- Returns:
- list
List of jets. Contains all data of the jet output file rows in each element of the list (
[jet][column]
).
- JetAnalysis.get_associated_particles()[source]
Get a list of associated particles for all jets.
- Returns:
- list
List of associated particles for each jet in each element (
[jet][associated_particle][column]
).
- JetAnalysis.create_fastjet_PseudoJets(event_hadrons)[source]
Convert hadron data to a list of fastjet.PseudoJet objects.
- Parameters:
- event_hadrons: list
List of Particle objects representing hadrons.
- Returns:
- list
List of fastjet.PseudoJet objects.
- JetAnalysis.fill_associated_particles(jet, event, status_selection, only_charged)[source]
Select particles in the jet cone.
- Parameters:
- jet: fastjet.PseudoJet
The jet to check for associated particles.
- event: int
The event index.
- status_selection: str
The selection status to find the associated particles. This can be ‘negative’ or ‘positive’ hadrons status.
- only_charged: bool
Select only charged particles as associated particles.
- Returns:
- list
List of associated particles in the jet cone.