i3extractor

Base I3Extractor class(es).

class graphnet.data.extractors.icecube.i3extractor.I3Extractor(extractor_name, exclude=[None], is_corsika)[source]

Bases: Extractor

Base class for extracting information from physics I3-frames.

Contains functionality required to extract data from i3 files, used by the IceCube Neutrino Observatory.

All classes inheriting from I3Extractor should implement the __call__ method.

Construct I3Extractor.

Parameters:
  • extractor_name (str) – Name of the I3Extractor instance. Used to keep track of the provenance of different data, and to name tables to which this data is saved.

  • exclude (list, default: [None]) – List of keys to exclude from the extracted data.

  • is_corsika (bool, default: False) – Boolean indicating if the event files being processed are Corsika simulations. Defaults to False.

set_gcd(i3_file, gcd_file)[source]

Extract GFrame and CFrame from i3/gcd-file pair.

Information from these frames will be set as member variables of I3Extractor.

Parameters:
  • i3_file (str) – Path to i3 file that is being converted.

  • gcd_file (Optional[str], default: None) – Path to GCD file. Defaults to None. If no GCD file is given, the method will attempt to find C and G frames in the i3 file instead. If either one of those are not present, RuntimeErrors will be raised.

Return type:

None

check_primary_energy(frame, primaries)[source]

Check that primary energy exists for the particle(s).

If the primary energy is not available, the daughters of the primary particle(s) are returned instead.

Parameters:
  • frame (I3Frame) – I3Frame object.

  • primaries (Union[ListI3Particle, I3Particle]) – Primary particle or a list of primary particles.

Return type:

Union[ListI3Particle, I3Particle]

get_primaries(frame, daughters, highest_energy_primary)[source]

Get the primary particles in the event.

For Corsika events the primary particles are all the primaries. For NuGen there are different options: - daughters set to True: the function returns the first in-ice neutrino

that is a daughter of the primary neutrino or the primary neutrino itself

  • daughters set to False and highest_energy_primary set to True:

    in this case the highest_energy_primary is returned

  • daughters set to False and highest_energy_primary set to False:

    In this case all primaries are returned. Analogous to the Corsika case.

Input: frame: I3Frame object daughters: If True only daughters of the primary neutrino are returned highest_energy_primary: If True, return the primary with the highest

energy. If False, return all primaries. NOTE: only used for non corsika events and only makes a difference if daughters is False.

Return type:

ListI3Particle

Parameters:
  • frame (icecube.icetray.I3Frame)

  • daughters (bool)

  • highest_energy_primary (bool)

find_in_ice_daughters(frame, particles, mctree)[source]

Find in-ice particles in the frame.

Return type:

ListI3Particle

Parameters:
  • frame (icecube.icetray.I3Frame)

  • particles (icecube.dataclasses.ListI3Particle)

  • mctree (str)