Exemplo n.º 1
0
    def test_I3Trigger_equality(self):
        key1 = dataclasses.TriggerKey()
        key1.source = key1.source.IN_ICE
        key1.type = key1.type.MIN_BIAS
        key1.subtype = key1.subtype.M18
        key1.config_id = 101
        trig1 = dataclasses.I3Trigger()
        trig1.time = 350 * I3Units.ns
        trig1.length = 6.55 * I3Units.microsecond
        trig1.fired = False
        trig1.key = key1

        key2 = dataclasses.TriggerKey()
        key2.source = key2.source.IN_ICE
        key2.type = key2.type.MIN_BIAS
        key2.subtype = key2.subtype.M18
        key2.config_id = 101
        trig2 = dataclasses.I3Trigger()
        trig2.time = 350 * I3Units.ns
        trig2.length = 6.55 * I3Units.microsecond
        trig2.fired = False
        trig2.key = key2

        self.assertEqual(trig1, trig2, "these should be the same.")

        trig3 = dataclasses.I3Trigger()
        self.assertNotEqual(trig1, trig3, "these should not be the same.")
Exemplo n.º 2
0
def dummy_trig(frame):
    gt = dataclasses.I3TriggerHierarchy()
    gt.add_root(dataclasses.I3Trigger())
    frame["I3TriggerHierarchy"] = gt
#    No attempt to use all interfaces for each class has been made

print('Testing TriggerKey pybindings')
tk = dataclasses.TriggerKey(dataclasses.IN_ICE,
                            dataclasses.SIMPLE_MULTIPLICITY, 1002)
ENSURE(tk.check_config_id() == True, "CheckConfigID fail")
ENSURE(tk.config_id == 1002, "Wrong ConfigID")

ENSURE(tk.source == dataclasses.IN_ICE, "Wrong Trigger Source")

ENSURE(tk.type == dataclasses.SIMPLE_MULTIPLICITY, "Wrong Trigger Type")
print(tk)
tk.reset_config_id()
ENSURE(tk.check_config_id() == False, "CheckConfigID fail")

mytrig = dataclasses.I3Trigger()
mytrig.fired = True
mytrig.time = 5.0 * icetray.I3Units.microsecond
mytrig.length = 1.0 * icetray.I3Units.microsecond

print(mytrig)

my_th = dataclasses.I3TriggerHierarchy()
## TriggerHierarchy is RO right now from the python side.

print('Testing I3Constants')
print('NA', dataclasses.I3Constants.NA)
print('Coordinate_shift_x', dataclasses.I3Constants.Coordinate_shift_x)
print('Coordinate_shift_y', dataclasses.I3Constants.Coordinate_shift_y)
print('Coordinate_shift_z', dataclasses.I3Constants.Coordinate_shift_z)
print('OriginElev', dataclasses.I3Constants.OriginElev)
Exemplo n.º 4
0
def TestSetup(frame, add_empty_trigger=False, add_mchits=True):

    p = dataclasses.I3Particle()
    p.time = TIME

    frame["MCPrimary"] = p

    mctree = dataclasses.I3MCTree()
    mctree.add_primary(p)
    frame["MCTree"] = mctree

    # I3MMCTrack
    mmctrack = simclasses.I3MMCTrack()
    mmctrack.SetParticle(p)
    mmctrack.ti = TIME
    mmctrack.tc = TIME
    mmctrack.tf = TIME
    mmctracklist = simclasses.I3MMCTrackList()
    mmctracklist.append(mmctrack)
    frame["MMCTracks"] = mmctracklist

    # I3TriggerHierarchy
    t = dataclasses.I3Trigger()
    t.time = TIME
    t.fired = True
    trigger_h = dataclasses.I3TriggerHierarchy()
    if not add_empty_trigger:
        trigger_h.insert(t)
    frame["Trigger"] = trigger_h

    # I3VectorI3Trigger
    t1 = dataclasses.I3Trigger()
    t1.time = TIME
    t1.fired = True
    trigger_v = dataclasses.I3VectorI3Trigger()
    trigger_v.append(t1)
    frame["TriggerVector"] = trigger_v

    # I3FlasherInfoVector
    fi = dataclasses.I3FlasherInfo()
    fi.flash_time = TIME
    fi_v = dataclasses.I3FlasherInfoVect()
    fi_v.append(fi)
    frame["FlasherInfos"] = fi_v

    # I3DOMLaunchSeriesMap
    d = dataclasses.I3DOMLaunch()
    d.time = TIME
    launchseries = dataclasses.I3DOMLaunchSeries()
    launchseries.append(d)
    launchmap = dataclasses.I3DOMLaunchSeriesMap()
    launchmap[icetray.OMKey(21, 30)] = launchseries
    frame["DOMLaunchMap"] = launchmap

    # I3MCHit
    mchit = dataclasses.I3MCHit()
    mchit.time = TIME
    mchitseries = dataclasses.I3MCHitSeries()
    mchitseries.append(mchit)
    mchitmap = dataclasses.I3MCHitSeriesMap()
    mchitmap[icetray.OMKey(21, 30)] = mchitseries
    if add_mchits:
        frame["MCHitMap"] = mchitmap

    # I3MCPE
    mcpe = simclasses.I3MCPE()
    mcpe.time = TIME
    mcpeseries = simclasses.I3MCPESeries()
    mcpeseries.append(mcpe)
    mcpemap = simclasses.I3MCPESeriesMap()
    mcpemap[icetray.OMKey(21, 30)] = mcpeseries
    frame["MCPEMap"] = mcpemap

    # I3MCPulse
    mcpulse = simclasses.I3MCPulse()
    mcpulse.time = TIME
    mcpulseseries = simclasses.I3MCPulseSeries()
    mcpulseseries.append(mcpulse)
    mcpulsemap = simclasses.I3MCPulseSeriesMap()
    mcpulsemap[icetray.OMKey(21, 30)] = mcpulseseries
    frame["MCPulseMap"] = mcpulsemap

    # I3Double
    sometime = dataclasses.I3Double(TIME)
    frame["SomeTime"] = sometime
    nottime = dataclasses.I3Double(TIME)
    frame["NotTime"] = nottime