print("   %s : this DOM has no domcal entry!!!" % str(omkey))
            else:
                print("        impedance = %f ohms" %
                      ((domcal[omkey].front_end_impedance) / I3Units.ohm))
            if omkey not in domstat:
                print("   %s : this DOM has no domstat entry!!!" % str(omkey))
            else:
                print("        voltage = %f V" %
                      ((domstat[omkey].pmt_hv) / I3Units.V))
                print("        statusATWDa = %s" %
                      domstat[omkey].status_atwd_a)
                print("        statusATWDb = %s" %
                      domstat[omkey].status_atwd_b)
                print("        lcWindowPost = %s ns" %
                      domstat[omkey].lc_window_post)

            if omkey in domcal and omkey in domstat:
                print("        gain = %f " %
                      (dataclasses.pmt_gain(domstat[omkey], domcal[omkey])))
                print(
                    "        ttime = %f ns " %
                    (dataclasses.transit_time(domstat[omkey], domcal[omkey]) /
                     I3Units.ns))

print("number of bad DOMs with hits = ", len(bad_doms_with_hits))
print("len(badDOMList) = ", len(badDOMList))
print("len(badDOMListSLC) = ", len(badDOMListSLC))

for d in bad_doms_with_hits:
    print(d)
print('Testing I3Direction')
dir = dataclasses.I3Direction(1.0, 1.0, 1.0)
print("Directions!", dir.theta, dir.phi, dir.azimuth, dir.zenith)

dir2 = dataclasses.I3Direction(1.0, 0.0, 0.0)
print(dir2)

dir2.rotate_z(90 * icetray.I3Units.deg)
print(dir2)

# Testing DOMFunctions
print('Testing I3DOMFunctions')
ds = dataclasses.I3DOMStatus()
dc = dataclasses.I3DOMCalibration()

transittime = dataclasses.transit_time(ds, dc)

dc.mean_fadc_charge = 0.6
dc.mean_atwd_charge = 0.7

spe_charge_dist = dataclasses.SPEChargeDistribution()

spe_charge_dist.exp1_amp = 0.1
spe_charge_dist.exp1_width = 0.2
spe_charge_dist.exp2_amp = 0.1
spe_charge_dist.exp2_width = 0.2
spe_charge_dist.gaus_amp = 0.3
spe_charge_dist.gaus_mean = 0.4
spe_charge_dist.gaus_width = 0.5
spe_charge_dist.compensation_factor = 0.9
spe_charge_dist.slc_gaus_mean = 0.5
示例#3
0
def dom_launcher_test(omkey, geo, cal, stat):

    success = True
    # pathological voltages will cause DOMLauncher to log_fatal
    if stat.pmt_hv < 0 or isnan(stat.pmt_hv):
        print('  %s  pmt_hv = %s V !!' % (str(omkey), stat.pmt_hv / I3Units.V))
        success = False

    # PMT threshold
    if geo.omtype == dc.I3OMGeo.OMType.IceTop:
        # check that both MPE and SPE thresholds are greater than 0
        if dc.old_mpe_threshold(stat) <= 0 or \
           isnan(dc.old_mpe_threshold(stat)) :
            thresh = dc.old_mpe_threshold(stat)
            print('  %s  IceTop PMT MPE thresh = %s V !!' %
                  (str(omkey), thresh / I3Units.V))
            success = False

        if dc.old_spe_threshold(stat) <= 0 or \
           isnan(dc.old_spe_threshold(stat)) :
            thresh = dc.old_spe_threshold(stat)
            print('  %s  IceTop PMT SPE thresh = %s V !!' %
                  (str(omkey), thresh / I3Units.V))
            success = False

    if geo.omtype == dc.I3OMGeo.OMType.IceCube:
        if dc.spe_pmt_threshold(stat, cal) <= 0 or \
           isnan(dc.old_mpe_threshold(stat)) :
            thresh = dc.old_mpe_threshold(stat)
            print('  %s  IceTop PMT thresh = %s V !!' %
                  (str(omkey), thresh / I3Units.V))
            success = False

    # FrontEndImpedance
    fei = cal.front_end_impedance
    if isnan(fei) \
           or fei < 30 * I3Units.ohm or fei > 50 * I3Units.ohm :
        print('  %s  front end impedance = %s ohms !!' %
              (str(omkey), fei / I3Units.ohms))
        success = False

    # SPEMean
    spemean = dc.spe_mean(stat, cal)
    if isnan(spemean) or not spemean > 0.0:
        print('  %s  SPE Mean = %s !!' % (str(omkey), dc.spe_mean(stat, cal)))
        success = False

    # TransitTime
    transittime = dc.transit_time(stat, cal)
    if isnan(transittime):
        print('  %s  transit time = %s ns !!' %
              (str(omkey), transittime / I3Units.ns))
        success = False

    # ATWD Gains

    # ATWD Beacon Baslines

    # ATWD DeltaTs

    # ATWD BinCalibFit

    # FADC Gain

    # FADC Beacon Basline

    # FADC DeltaT

    # LC Window Pre

    # LC Window Post

    # ATWD Status A

    # ATWD Status B

    # LC Mode

    # TX Mode

    # LCSpan

    # DOM Gain Type

    # ATWDSamplingRate

    # DiscriminatorPulse template

    return success
print('Testing I3Direction')
dir = dataclasses.I3Direction(1.0, 1.0, 1.0)
print("Directions!", dir.theta, dir.phi, dir.azimuth, dir.zenith)

dir2 = dataclasses.I3Direction(1.0, 0.0, 0.0)
print(dir2)

dir2.rotate_z(90*icetray.I3Units.deg)
print(dir2)

# Testing DOMFunctions
print('Testing I3DOMFunctions')
ds = dataclasses.I3DOMStatus()
dc = dataclasses.I3DOMCalibration()

transittime = dataclasses.transit_time(ds, dc)

dc.mean_fadc_charge = 0.6
dc.mean_atwd_charge = 0.7

spe_charge_dist = dataclasses.SPEChargeDistribution()

spe_charge_dist.exp_amp = 0.1
spe_charge_dist.exp_width = 0.2
spe_charge_dist.gaus_amp = 0.3
spe_charge_dist.gaus_mean = 0.4
spe_charge_dist.gaus_width = 0.5

dc.combined_spe_charge_distribution = spe_charge_dist
ENSURE(dc.combined_spe_charge_distribution.is_valid == True, "This should be true.")
            if omkey not in calwfmap :
                print("   %s : ERROR this DOM has no calibrated waveforms!!!")
            else:
                print("   %s : OK this DOM has %d calibrated waveforms." % len(calwfmap[omkey]))

            if omkey not in domcal :
                print("   %s : this DOM has no domcal entry!!!" % str(omkey))
            else:
                print("        impedance = %f ohms" % ( (domcal[omkey].front_end_impedance)/I3Units.ohm))
            if omkey not in domstat :
                print("   %s : this DOM has no domstat entry!!!" % str(omkey))
            else:
                print("        voltage = %f V" % ( (domstat[omkey].pmt_hv)/I3Units.V))
                print("        statusATWDa = %s" % domstat[omkey].status_atwd_a)
                print("        statusATWDb = %s" % domstat[omkey].status_atwd_b)
                print("        lcWindowPost = %s ns" % domstat[omkey].lc_window_post)

            if omkey in domcal and omkey in domstat :
                print("        gain = %f " % ( dataclasses.pmt_gain(domstat[omkey],domcal[omkey]) ))
                print("        ttime = %f ns " % ( dataclasses.transit_time(domstat[omkey],domcal[omkey])/I3Units.ns ))
            

print("number of bad DOMs with hits = ",len(bad_doms_with_hits))
print("len(badDOMList) = ",len(badDOMList))
print("len(badDOMListSLC) = ",len(badDOMListSLC))

for d in bad_doms_with_hits:
    print(d)