Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getVisibleEnergyFrame(frame):
- # select I3MCTree
- mctree = frame["I3MCTree"]
- # get primary particle
- p = mctree.most_energetic_primary
- # get interaction type
- interactionType = frame['I3MCWeightDict']['InteractionType']
- frame["MCPrimaryVisible"]=dataclasses.I3Particle()
- if (primary.type == dataclasses.I3Particle.NuMu) or (primary.type == dataclasses.I3Particle.NuMuBar):
- if interactionType == 1:
- visible = getEnergy(primary)
- frame["MCPrimaryVisible"].energy=visible
- def getVisibleEnergy(p):
- # select I3MCTree
- daughters = mctree.get_daughters(p)
- energies = 0
- if len(daughters) >0:
- energies = 0
- for d in daughters:
- poly = [-570.90, -125.14, -347.88,451.52 , 22.11, 509.50 , 101.04, 412.79, 338.44, 463.72, 576.37, 170.92, 361, -422.83, -256.14, -521.08]
- icecube_xy_polygon = mplPath.Path(np.array([[poly[0], poly[1]], [poly[2],poly[3]], [poly[4], poly[5]], [poly[6], poly[7]], [poly[8], poly[9]], [poly[10], poly[11]], [poly[12], poly[13]], [poly[14], poly[15]], [poly[0], poly[1]]]))
- if(icecube_xy_polygon.contains_point( (d.pos.x,d.pos.y) )):
- if(d.pos.z <600 and d.pos.z >-600):
- energies += getEnergy(d)
- return energies
- else:
- if p.is_neutrino:
- return 0
- if p.energy == None:
- return 0
- return p.energy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement