예제 #1
0
파일: blocks.py 프로젝트: damienst/sapphire
 def atom(self):
     if self.is_nucleus:
         return particles.name(self.atomic_number)
     else:
         return None
예제 #2
0
파일: blocks.py 프로젝트: damienst/sapphire
 def particle(self):
     return particles.name(self.id) if self.is_particle else None
예제 #3
0
파일: blocks.py 프로젝트: damienst/sapphire
    def __init__(self, subblock):
        self.id = subblock[0]
        self.event_number = subblock[1]
        self.particle_id = subblock[2]
        self.particle = particles.name(subblock[2])
        self.energy = subblock[3] * units.GeV
        self.starting_altitude = subblock[4] * units.g / units.cm2
        self.first_target = subblock[5]
        self.first_interaction_altitude = subblock[6] * units.cm
        self.p_x = subblock[7] * units.GeV
        self.p_y = subblock[8] * units.GeV
        self.p_z = -subblock[9] * units.GeV  # Same direction as axis
        self.zenith = subblock[10] * units.rad

        # CORSIKA coordinate conventions are shown in Figure 1 of the manual.
        # CORSIKA defines azimuth as the direction the shower points to,
        # HiSPARC defines azimuth as the direction the shower comes from.
        # CORSIKA allows azimuths in [-2pi, 2pi], HiSPARC uses [-pi, pi).
        # CORSIKA defines North as 0 rad, HiSPARC defines East as 0 rad.
        # So finally we need to subtract pi/2 rad from the azimuth and
        # normalize its range.
        azimuth_corsika = subblock[11] * units.rad
        azimuth = azimuth_corsika - (math.pi / 2.)
        if azimuth >= math.pi:
            self.azimuth = azimuth - (2 * math.pi)
        elif azimuth < -math.pi:
            self.azimuth = azimuth + (2 * math.pi)
        else:
            self.azimuth = azimuth

        self.n_seeds = subblock[12]
        self.seeds = numpy.array(
            zip(subblock[13:41:3], subblock[14:42:3], subblock[15:43:3]))

        self.run_number = subblock[43]
        self.date_start = subblock[44]
        self.version = subblock[45]

        self.n_observation_levels = subblock[46]
        self.observation_heights = numpy.array(subblock[47:57]) * units.cm

        self.spectral_slope = subblock[57]
        self.min_energy = subblock[58] * units.GeV
        self.max_energy = subblock[59] * units.GeV

        self.cutoff_hadrons = subblock[60] * units.GeV
        self.cutoff_muons = subblock[61] * units.GeV
        self.cutoff_electrons = subblock[62] * units.GeV
        self.cutoff_photons = subblock[63] * units.GeV

        self.NFLAIN = subblock[64]
        self.NFLDIF = subblock[65]
        self.NFLPI0 = subblock[66]
        self.NFLPIF = subblock[67]
        self.NFLCHE = subblock[68]
        self.NFRAGM = subblock[69]

        self.magnetic_field_x = subblock[70] * units.micro * units.tesla
        self.magnetic_field_z = subblock[71] * units.micro * units.tesla
        self.flag_EGS4 = subblock[72]
        self.flag_NKG = subblock[73]

        self.flag_hadron_model_low = subblock[74]
        self.flag_hadron_model_high = subblock[75]
        self.flag_Cherenkov = subblock[76]
        self.flag_neutrino = subblock[77]
        self.flag_curved = subblock[78]
        self.flag_computer = subblock[79]
        self.theta_min = subblock[80] * units.rad
        self.theta_max = subblock[81] * units.rad
        self.phi_min = subblock[82] * units.rad
        self.phi_max = subblock[83] * units.rad

        self.cherenkov_bunch = subblock[84]
        self.cherenkov_n_x = subblock[85]
        self.cherenkov_n_y = subblock[86]
        self.cherenkov_grid_x = subblock[87] * units.cm
        self.cherenkov_grid_y = subblock[88] * units.cm
        self.cherenkov_detector_x = subblock[89] * units.cm
        self.cherenkov_detector_y = subblock[90] * units.cm
        self.cherenkov_output_flag = subblock[91]

        self.array_rotation = subblock[92] * units.rad
        self.flag_extra_muon_information = subblock[93]

        self.multiple_scattering_step_length_factor = subblock[94]
        self.Cherenkov_wavelength_min = subblock[95] * units.nanometer
        self.Cherenkov_wavelength_max = subblock[96] * units.nanometer
        self.uses_of_Cherenkov_event = subblock[97]
        self.core_x = numpy.array(subblock[98:118]) * units.cm
        self.core_y = numpy.array(subblock[118:138]) * units.cm

        self.flag_SIBYLL = subblock[138]
        self.flag_SIBYLL_cross = subblock[139]
        self.flag_QGSJET = subblock[140]
        self.flag_QGSJET_cross = subblock[141]
        self.flag_DPMJET = subblock[142]
        self.flag_DPMJET_cross = subblock[143]
        self.flag_VENUS_cross = subblock[144]
        self.flag_muon_multiple = subblock[145]
        self.NKG_radial_range = subblock[146] * units.cm
        self.energy_fraction_thinning_hadronic = subblock[147]
        self.energy_fraction_thinning_em = subblock[148]
        self.weightlimit_thinning_hadronic = subblock[149]
        self.weightlimit_thinning_EM = subblock[150]
        self.radial_thinning_max_radius = subblock[151] * units.cm
        self.cone_inner_angle = subblock[152] * units.rad
        self.cone_outer_angle = subblock[153] * units.rad

        self.transistion_energy_high_low = subblock[154] * units.GeV
        self.flag_skimming_incidence = subblock[155]
        self.altitude_horizontal_shower_axis = subblock[156] * units.cm
        self.starting_height = subblock[157] * units.cm
        self.flag_charm = subblock[158]
        self.flag_hadron_origin = subblock[159]

        # CONEX
        self.min_vertical_depth_CONEX = subblock[160]
        self.high_threshold_hadron_CONEX = subblock[161]
        self.high_threshold_muon_CONEX = subblock[162]
        self.high_threshold_EM_CONEX = subblock[163]
        self.low_threshold_hadron_CONEX = subblock[164]
        self.low_threshold_muon_CONEX = subblock[165]
        self.low_threshold_EM_CONEX = subblock[166]
        self.flag_observation_level_curvature_CONEX = subblock[167]
        self.weightlimit_thinning_hadronic_CONEX = subblock[168]
        self.weightlimit_thinning_EM_CONEX = subblock[169]
        self.weightlimit_sampling_hadronic_CONEX = subblock[170]
        self.weightlimit_sampling_muons_CONEX = subblock[171]
        self.weightlimit_sampling_EM_CONEX = subblock[172]
예제 #4
0
파일: blocks.py 프로젝트: damienst/sapphire
 def atom(self):
     if self.is_nucleus:
         return particles.name(self.atomic_number)
     else:
         return None
예제 #5
0
파일: blocks.py 프로젝트: damienst/sapphire
 def particle(self):
     return particles.name(self.id) if self.is_particle else None
예제 #6
0
파일: blocks.py 프로젝트: damienst/sapphire
    def __init__(self, subblock):
        self.id = subblock[0]
        self.event_number = subblock[1]
        self.particle_id = subblock[2]
        self.particle = particles.name(subblock[2])
        self.energy = subblock[3] * units.GeV
        self.starting_altitude = subblock[4] * units.g / units.cm2
        self.first_target = subblock[5]
        self.first_interaction_altitude = subblock[6] * units.cm
        self.p_x = subblock[7] * units.GeV
        self.p_y = subblock[8] * units.GeV
        self.p_z = - subblock[9] * units.GeV  # Same direction as axis
        self.zenith = subblock[10] * units.rad

        # CORSIKA coordinate conventions are shown in Figure 1 of the manual.
        # CORSIKA defines azimuth as the direction the shower points to,
        # HiSPARC defines azimuth as the direction the shower comes from.
        # CORSIKA allows azimuths in [-2pi, 2pi], HiSPARC uses [-pi, pi).
        # CORSIKA defines North as 0 rad, HiSPARC defines East as 0 rad.
        # So finally we need to subtract pi/2 rad from the azimuth and
        # normalize its range.
        azimuth_corsika = subblock[11] * units.rad
        azimuth = azimuth_corsika - (math.pi / 2.)
        if azimuth >= math.pi:
            self.azimuth = azimuth - (2 * math.pi)
        elif azimuth < -math.pi:
            self.azimuth = azimuth + (2 * math.pi)
        else:
            self.azimuth = azimuth

        self.n_seeds = subblock[12]
        self.seeds = numpy.array(zip(subblock[13:41:3],
                                     subblock[14:42:3],
                                     subblock[15:43:3]))

        self.run_number = subblock[43]
        self.date_start = subblock[44]
        self.version = subblock[45]

        self.n_observation_levels = subblock[46]
        self.observation_heights = numpy.array(subblock[47:57]) * units.cm

        self.spectral_slope = subblock[57]
        self.min_energy = subblock[58] * units.GeV
        self.max_energy = subblock[59] * units.GeV

        self.cutoff_hadrons = subblock[60] * units.GeV
        self.cutoff_muons = subblock[61] * units.GeV
        self.cutoff_electrons = subblock[62] * units.GeV
        self.cutoff_photons = subblock[63] * units.GeV

        self.NFLAIN = subblock[64]
        self.NFLDIF = subblock[65]
        self.NFLPI0 = subblock[66]
        self.NFLPIF = subblock[67]
        self.NFLCHE = subblock[68]
        self.NFRAGM = subblock[69]

        self.magnetic_field_x = subblock[70] * units.micro * units.tesla
        self.magnetic_field_z = subblock[71] * units.micro * units.tesla
        self.flag_EGS4 = subblock[72]
        self.flag_NKG = subblock[73]

        self.flag_hadron_model_low = subblock[74]
        self.flag_hadron_model_high = subblock[75]
        self.flag_Cherenkov = subblock[76]
        self.flag_neutrino = subblock[77]
        self.flag_curved = subblock[78]
        self.flag_computer = subblock[79]
        self.theta_min = subblock[80] * units.rad
        self.theta_max = subblock[81] * units.rad
        self.phi_min = subblock[82] * units.rad
        self.phi_max = subblock[83] * units.rad

        self.cherenkov_bunch = subblock[84]
        self.cherenkov_n_x = subblock[85]
        self.cherenkov_n_y = subblock[86]
        self.cherenkov_grid_x = subblock[87] * units.cm
        self.cherenkov_grid_y = subblock[88] * units.cm
        self.cherenkov_detector_x = subblock[89] * units.cm
        self.cherenkov_detector_y = subblock[90] * units.cm
        self.cherenkov_output_flag = subblock[91]

        self.array_rotation = subblock[92] * units.rad
        self.flag_extra_muon_information = subblock[93]

        self.multiple_scattering_step_length_factor = subblock[94]
        self.Cherenkov_wavelength_min = subblock[95] * units.nanometer
        self.Cherenkov_wavelength_max = subblock[96] * units.nanometer
        self.uses_of_Cherenkov_event = subblock[97]
        self.core_x = numpy.array(subblock[98:118]) * units.cm
        self.core_y = numpy.array(subblock[118:138]) * units.cm

        self.flag_SIBYLL = subblock[138]
        self.flag_SIBYLL_cross = subblock[139]
        self.flag_QGSJET = subblock[140]
        self.flag_QGSJET_cross = subblock[141]
        self.flag_DPMJET = subblock[142]
        self.flag_DPMJET_cross = subblock[143]
        self.flag_VENUS_cross = subblock[144]
        self.flag_muon_multiple = subblock[145]
        self.NKG_radial_range = subblock[146] * units.cm
        self.energy_fraction_thinning_hadronic = subblock[147]
        self.energy_fraction_thinning_em = subblock[148]
        self.weightlimit_thinning_hadronic = subblock[149]
        self.weightlimit_thinning_EM = subblock[150]
        self.radial_thinning_max_radius = subblock[151] * units.cm
        self.cone_inner_angle = subblock[152] * units.rad
        self.cone_outer_angle = subblock[153] * units.rad

        self.transistion_energy_high_low = subblock[154] * units.GeV
        self.flag_skimming_incidence = subblock[155]
        self.altitude_horizontal_shower_axis = subblock[156] * units.cm
        self.starting_height = subblock[157] * units.cm
        self.flag_charm = subblock[158]
        self.flag_hadron_origin = subblock[159]

        # CONEX
        self.min_vertical_depth_CONEX = subblock[160]
        self.high_threshold_hadron_CONEX = subblock[161]
        self.high_threshold_muon_CONEX = subblock[162]
        self.high_threshold_EM_CONEX = subblock[163]
        self.low_threshold_hadron_CONEX = subblock[164]
        self.low_threshold_muon_CONEX = subblock[165]
        self.low_threshold_EM_CONEX = subblock[166]
        self.flag_observation_level_curvature_CONEX = subblock[167]
        self.weightlimit_thinning_hadronic_CONEX = subblock[168]
        self.weightlimit_thinning_EM_CONEX = subblock[169]
        self.weightlimit_sampling_hadronic_CONEX = subblock[170]
        self.weightlimit_sampling_muons_CONEX = subblock[171]
        self.weightlimit_sampling_EM_CONEX = subblock[172]