JetscapeLoader
- class JetscapeLoader.JetscapeLoader(JETSCAPE_FILE: str)[source]
A class to load and process JETSCAPE data files.
- Attributes:
- PATH_JETSCAPE_str
The path to the JETSCAPE data file.
- particle_type_str
The type of particles to load (‘hadron’ or ‘parton’).
Methods
load(**kwargs)
Loads the data from the JETSCAPE file based on the specified optional arguments.
get_last_line(file_path)
Returns the last line of a file.
get_sigmaGen()
Retrieves the sigmaGen values with error from the last line of a file.
get_particle_type_defining_string()
Returns the string which defines the particle type in the JETSCAPE file.
get_particle_type()
Returns the particle type of the JETSCAPE file.
get_event_header_information()
Returns the event header information of the JETSCAPE file.
- event_end_lines() List[str][source]
Returns the list of event end lines.
This method returns the list of strings that mark the end of events in the Jetscape data.
- Returns:
- List[str]
A list of strings that mark the end of events in the Jetscape data.
- get_event_header_information() List[Dict[str, int | float]][source]
Returns the event header information of the Jetscape file. They are read as a list of dictionaries from event header lines of the file.
- Returns:
- list
A list containing the event header information in a dictionary for each event. The keys of the dictionary are the names of the header information.
- get_last_line(file_path: str) str[source]
Returns the last line of a file.
- Parameters:
- file_pathstr
The path to the file.
- Returns:
- str
The last line of the file, stripped of leading and trailing whitespace.
- get_particle_type() str[source]
Returns the particle type of the Jetscape file.
- Returns:
- string
The particle type.
- get_particle_type_defining_string() str[source]
Returns the string which defines the particle type in the Jetscape file.
- Returns:
- string
The particle type defining string.
- get_sigmaGen() Tuple[float, float][source]
Retrieves the sigmaGen values with error from the last line of a file.
- Returns:
- tuple
A tuple containing the first and second sigmaGen values as floats.
- load(**kwargs: Any) Tuple[List[List[Particle]], int, ndarray, List[str]][source]
Loads the data from the JETSCAPE file based on the specified optional arguments.
This method reads the JETSCAPE data file and applies any filters specified in the ‘filters’ key of the kwargs dictionary. It also adjusts the number of events and the number of output lines per event based on the ‘events’ key in the kwargs dictionary. If the ‘particletype’ key is specified, it sets the particle type to either ‘hadron’ or ‘parton’. If any other keys are specified in the kwargs dictionary, it raises a ValueError.
- Parameters:
- kwargsdict
A dictionary of optional arguments. The following keys are recognized:
‘events’: Either a tuple of two integers specifying the range of events to load, or a single integer specifying a single event to load.
‘filters’: A list of filters to apply to the data.
‘particletype’: A string specifying the type of particles to load (‘hadron’ or ‘parton’).
- Returns:
- tuple
A tuple containing the list of Particle objects loaded from the JETSCAPE data file, the number of events, and the number of output lines per event.
- Raises:
- ValueError
If an unknown keyword argument is used, if the first value of the ‘events’ tuple is larger than the second value, if an event number is negative, or if the ‘particletype’ is not ‘hadron’ or ‘parton’.
- TypeError
If the ‘events’ key is not a tuple or an integer, or if the ‘particletype’ key is not a string.