Advertisement
Guest User

visible energy

a guest
Aug 31st, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. def getVisibleEnergyFrame(frame):
  2.     # select I3MCTree
  3.     mctree = frame["I3MCTree"]
  4.     # get primary particle
  5.     p = mctree.most_energetic_primary
  6.     # get interaction type
  7.     interactionType = frame['I3MCWeightDict']['InteractionType']
  8.     frame["MCPrimaryVisible"]=dataclasses.I3Particle()
  9.     if (primary.type == dataclasses.I3Particle.NuMu) or (primary.type == dataclasses.I3Particle.NuMuBar):
  10.             if interactionType == 1:
  11.                 visible = getEnergy(primary)
  12.                 frame["MCPrimaryVisible"].energy=visible
  13.  
  14. def getVisibleEnergy(p):
  15.     # select I3MCTree
  16.     daughters = mctree.get_daughters(p)
  17.     energies = 0
  18.     if len(daughters) >0:
  19.         energies = 0
  20.         for d in daughters:
  21.             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]
  22.             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]]]))
  23.             if(icecube_xy_polygon.contains_point( (d.pos.x,d.pos.y) )):
  24.                 if(d.pos.z <600 and d.pos.z >-600):
  25.                     energies += getEnergy(d)
  26.                     return energies
  27.         else:
  28.             if p.is_neutrino:
  29.                 return 0
  30.             if p.energy == None:
  31.                 return 0
  32.             return p.energy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement