Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
flasherRadiusInDOM = 11.9*I3Units.cm
flasherZPosInDOM = 8.0*I3Units.cm
if "I3Orientation" in dir(dataclasses):
# new-style I3OMGeo (with full DOM orientation information):
# do calculations in DOM coordinate frame first (i.e. DOM axis points towards +z)
# the rotation of flashers is counter-clockwise when viewed from above
# (in DOM frame where the DOM points upwards).
# Flasher LED1 and LED7 (both flasherPosIndex==0) are assumed
# to point towards the DOM's x-axis.
flasherAziRotation = 60.*I3Units.deg * float(flasherPosIndex)
flasherUpwardsTiltAngle = 0.
if tiltedFlasher: flasherUpwardsTiltAngle=48.*I3Units.deg # (or 42deg down from the vertical)
flasherDir = dataclasses.I3Direction()
flasherDir.set_theta_phi(90.*I3Units.deg + flasherUpwardsTiltAngle, flasherAziRotation)
# now apply the DOM orientation (this will flip over the DOM)
flasherDir = omGeo.orientation.rotate_out(flasherDir)
#flasherDir = omGeo.orientation.rotate(flasherDir)
# for standard DOMs (i.e. pointing down), flashers are now
# ordered clockwise when viewed from above
flasherPos = dataclasses.I3Direction()
# flasher position on flasher board
flasherPos.set_theta_phi(90.*I3Units.deg, flasherAziRotation) # no upwards tilt for position
# flasher position in DOM coordinates
flasherPos = dataclasses.I3Position(flasherPos.x*flasherRadiusInDOM, flasherPos.y*flasherRadiusInDOM, flasherZPosInDOM)
# apply the DOM orientation (this will flip over the DOM)
#flasherPos = omGeo.orientation.rotate(flasherPos)
flasherPos = omGeo.orientation.rotate_out(flasherPos)
# shift to the actual position in global coordinates
flasherPos = dataclasses.I3Position(domPos.x + flasherPos.x, domPos.y + flasherPos.y, domPos.z - flasherPos.z)
else:
# old-style I3OMGeo (only up/down enum and aziangle for DOM orientation):
# do calculations in global coordinate system (DOM axis towards -z)
# the rotation of flashers is clockwise when viewed from above
# flasher LED1 and LED7 (both flasherPosIndex==0) are assumed
# to point towards the DOM's x-axis.
flasherAziRotation = -60.*I3Units.deg * float(flasherPosIndex)
flasherUpwardsTiltAngle = 0.
if tiltedFlasher: flasherUpwardsTiltAngle=48.*I3Units.deg # (or 42deg down from the vertical)
flasherDir = dataclasses.I3Direction()
flasherDir.set_theta_phi(90.*I3Units.deg - flasherUpwardsTiltAngle, flasherAziRotation - omGeo.aziangle)
flasherPos = dataclasses.I3Direction()
# flasher position on flasher board
flasherPos.set_theta_phi(90.*I3Units.deg, flasherAziRotation - omGeo.aziangle) # no upwards tilt for position
# flasher position in global coordinates
flasherPos = dataclasses.I3Position(domPos.x + flasherPos.x*flasherRadiusInDOM, domPos.y + flasherPos.y*flasherRadiusInDOM, domPos.z + flasherZPosInDOM)
newPulse = I3CLSimFlasherPulse()
if isColorDOM:
newPulse.type = FlasherInfoVectToFlasherPulseSeriesConverter.colorDOMledColors[i]
else:
newPulse.type = I3CLSimFlasherPulse.FlasherPulseType.LED405nm
newPulse.pos = flasherPos
newPulse.dir = flasherDir
newPulse.time = flasherInfo.flash_time
# FWHM according to http://wiki.icecube.wisc.edu/index.php/LED_output_time_profile :
newPulse.pulseWidth = (float(flasherInfo.width)/2.) * I3Units.ns
#flasherPos = omGeo.orientation.rotate(flasherPos)
flasherPos = omGeo.orientation.rotate_out(flasherPos)
# shift to the actual position in global coordinates
flasherPos = dataclasses.I3Position(domPos.x + flasherPos.x, domPos.y + flasherPos.y, domPos.z - flasherPos.z)
else:
# old-style I3OMGeo (only up/down enum and aziangle for DOM orientation):
# do calculations in global coordinate system (DOM axis towards -z)
# the rotation of flashers is clockwise when viewed from above
# flasher LED1 and LED7 (both flasherPosIndex==0) are assumed
# to point towards the DOM's x-axis.
flasherAziRotation = -60.*I3Units.deg * float(flasherPosIndex)
flasherUpwardsTiltAngle = 0.
if tiltedFlasher: flasherUpwardsTiltAngle=48.*I3Units.deg # (or 42deg down from the vertical)
flasherDir = dataclasses.I3Direction()
flasherDir.set_theta_phi(90.*I3Units.deg - flasherUpwardsTiltAngle, flasherAziRotation - omGeo.aziangle)
flasherPos = dataclasses.I3Direction()
# flasher position on flasher board
flasherPos.set_theta_phi(90.*I3Units.deg, flasherAziRotation - omGeo.aziangle) # no upwards tilt for position
# flasher position in global coordinates
flasherPos = dataclasses.I3Position(domPos.x + flasherPos.x*flasherRadiusInDOM, domPos.y + flasherPos.y*flasherRadiusInDOM, domPos.z + flasherZPosInDOM)
newPulse = I3CLSimFlasherPulse()
if isColorDOM:
newPulse.type = FlasherInfoVectToFlasherPulseSeriesConverter.colorDOMledColors[i]
else:
newPulse.type = I3CLSimFlasherPulse.FlasherPulseType.LED405nm
newPulse.pos = flasherPos
newPulse.dir = flasherDir