Пример #1
0
    def DAQ(self, frame):
        # only inject it once
        if self.has_been_injected:
            self.PushFrame(frame)
            return
        self.has_been_injected = True

        geometry = dataclasses.I3Geometry()
        calibration = dataclasses.I3Calibration()
        detectorStatus = dataclasses.I3DetectorStatus()

        # fill the geometry map
        omgeomap = geometry.omgeo
        domcalmap = calibration.dom_cal
        domstatusmap = detectorStatus.dom_status

        for i, pos in enumerate(omPositions):
            shiftedPos = pos
            shiftedPos[0] += self.xCoord * I3Units.m
            shiftedPos[1] += self.yCoord * I3Units.m
            shiftedPos[2] += self.zCoord * I3Units.m

            omkey = omKeys[i]

            newomgeo = dataclasses.I3OMGeo()
            newomgeo.omtype = dataclasses.I3OMGeo.OMType.IceCube
            newomgeo.orientation = dataclasses.I3Orientation(
                dataclasses.I3Direction(0., 0., -1.))
            newomgeo.position = dataclasses.I3Position(shiftedPos[0],
                                                       shiftedPos[1],
                                                       shiftedPos[2])
            omgeomap[omkey] = newomgeo

            newdomcal = dataclasses.I3DOMCalibration()
            newdomcal.relative_dom_eff = 1.0
            domcalmap[omkey] = newdomcal

            newdomstatus = dataclasses.I3DOMStatus()
            newdomstatus.pmt_hv = 1345. * I3Units.V  # some arbitrary setting: >0 and not NaN
            domstatusmap[omkey] = newdomstatus

        # make GCD frames and fill them with objects
        Gframe = icetray.I3Frame(icetray.I3Frame.Geometry)
        Cframe = icetray.I3Frame(icetray.I3Frame.Calibration)
        Dframe = icetray.I3Frame(icetray.I3Frame.DetectorStatus)

        Gframe["I3Geometry"] = geometry
        Cframe["I3Calibration"] = calibration
        Dframe["I3DetectorStatus"] = detectorStatus

        # push the new GCD frames
        self.PushFrame(Gframe)
        self.PushFrame(Cframe)
        self.PushFrame(Dframe)

        # push the original Q-frame
        self.PushFrame(frame)
    def test_MeanSPECharge_equality(self):
        fit1 = dataclasses.LinearFit()
        fit2 = dataclasses.LinearFit()
        ds1 = dataclasses.I3DOMStatus()
        dc1 = dataclasses.I3DOMCalibration()
        ds2 = dataclasses.I3DOMStatus()
        dc2 = dataclasses.I3DOMCalibration()

        fit1.slope = 1.618
        fit2.slope = 1.618
        fit1.intercept = 1.20205
        fit2.intercept = 1.20205
        ds1.dac_fadc_ref = 0.1234
        ds2.dac_fadc_ref = 0.1234

        dc1.fadc_baseline_fit = fit1
        dc2.fadc_baseline_fit = fit2

        mspe1 = dataclasses.mean_spe_charge(ds1, dc1)
        mspe2 = dataclasses.mean_spe_charge(ds2, dc2)

        self.assertEqual(mspe1, mspe2, "these should be the same.")
    def test_FADCBaseline_equality(self):
        fit1 = dataclasses.LinearFit()
        fit2 = dataclasses.LinearFit()
        ds1 = dataclasses.I3DOMStatus()
        dc1 = dataclasses.I3DOMCalibration()
        ds2 = dataclasses.I3DOMStatus()
        dc2 = dataclasses.I3DOMCalibration()

        fit1.slope = 1.618
        fit2.slope = 1.618
        fit1.intercept = 1.20205
        fit2.intercept = 1.20205
        ds1.dac_fadc_ref = 0.1234
        ds2.dac_fadc_ref = 0.1234

        dc1.fadc_baseline_fit = fit1
        dc2.fadc_baseline_fit = fit2

        fadcb1 = dataclasses.fadc_baseline(ds1, dc1)
        fadcb2 = dataclasses.fadc_baseline(ds2, dc2)

        self.assertEqual(fadcb1, fadcb2, "these should be the same.")
print('SurfaceElev', dataclasses.I3Constants.SurfaceElev)
print('c', dataclasses.I3Constants.c)

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
Пример #5
0
newDOMCalib.atwd_freq_fit[1] = freqQuadFit2

# unable to access these fields
# newDOMCalib.atwd_beacon_baseline = allI3DOMCalibrations[6].atwd_beacon_baseline
# newDOMCalib.atwd_bin_calib_slope = allI3DOMCalibrations[6].atwd_bin_calib_slope

# setting SPE scaling factor and above
newScalingFactor = sum([
    scalingfactor for scalingfactor in speScalingFactors.values()
    if not is_nan(scalingfactor)
]) / len(speScalingFactors.values())
newAbove = sum([above for above in speabove.values() if not is_nan(above)
                ]) / len(speabove.values())

# setting dom detector status
newDOMStatus = dataclasses.I3DOMStatus()
newDOMStatus.trig_mode = dataclasses.I3DOMStatus.TrigMode.SPE  # standard trigger mode
newDOMStatus.lc_mode = dataclasses.I3DOMStatus.LCMode.UpOrDown  # detect local coincidence from either up or down
newDOMStatus.tx_mode = dataclasses.I3DOMStatus.LCMode.UpAndDown  # send local coincidence info both up and down
newDOMStatus.lc_span = 2  # standard local coincidence span
newDOMStatus.lc_window_pre = 1000  # value shared across all doms in input file
newDOMStatus.lc_window_post = 1000  # value shared across all doms in input file
newDOMStatus.pmt_hv = sum([
    domstat.pmt_hv
    for domstat in allI3DOMStatuses if not is_nan(domstat.pmt_hv)
]) / len(allI3DOMStatuses)
newDOMStatus.spe_threshold = sum([
    domstat.spe_threshold
    for domstat in allI3DOMStatuses if not is_nan(domstat.spe_threshold)
]) / len(allI3DOMStatuses)
newDOMStatus.dac_trigger_bias_0 = sum([
    omkey = omKeys[i]

    newomgeo = dataclasses.I3OMGeo()
    newomgeo.omtype = dataclasses.I3OMGeo.OMType.IceCube
    newomgeo.orientation = dataclasses.I3Orientation(dataclasses.I3Direction(0.,0.,-1.))
    newomgeo.position = dataclasses.I3Position(shiftedPos[0], shiftedPos[1], shiftedPos[2])
    omgeomap[omkey] = newomgeo


    newdomcal = dataclasses.I3DOMCalibration()
    newdomcal.relative_dom_eff = 1.0
    domcalmap[omkey] = newdomcal


    newdomstatus = dataclasses.I3DOMStatus()
    newdomstatus.pmt_hv = 1345.*I3Units.V # some arbitrary setting: >0 and not NaN
    domstatusmap[omkey] = newdomstatus



Gframe = icetray.I3Frame(icetray.I3Frame.Geometry)
Cframe = icetray.I3Frame(icetray.I3Frame.Calibration)
Dframe = icetray.I3Frame(icetray.I3Frame.DetectorStatus)

Gframe["I3Geometry"] = geometry
Cframe["I3Calibration"] = calibration
Dframe["I3DetectorStatus"] = detectorStatus

i3file = dataio.I3File(outfile, 'w')
i3file.push(Gframe)