!/* +---------------------- Copyright notice -------------------------------+ */
!/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr)    | */
!/* |   Permission to use, copy, modify, and distribute this software       | */
!/* |   and its documentation for any purpose and without fee is hereby     | */
!/* |   granted, provided that the above copyright notice appear in all     | */
!/* |   copies and that both that copyright notice and this permission      | */
!/* |   notice appear in supporting documentation.  This software is        | */
!/* |   provided "as is" without express or implied warranty.               | */
!/* +---------------------- Copyright notice -------------------------------+ */
!----------------------------
begin OInterface
 prefix = EXPO_
 resources = \
Wo*XoCamera.borderWidth:3
 createCallback = G4>\
  /init/all\
  /tracking/storeTrajectory 1\
  #/gun/particle gamma\
  #/gun/particle geantino\
  /gun/particle e-\
  /gun/direction 0.1 1 0\
  /gun/energy 1 GeV\
  #/particle/dump\
  #/event/verbose 1\
  #/tracking/verbose 1
end
!----------------------------
begin OWidget
 name = EXPO_1
 type = TopLevelShell
 children = EXPO_9
 mappedWhenManaged = true
 geometry = 500x500+0+0
 title = Visualization GEANT4
end
!----------------------------
begin OWidget
 name = EXPO_9
 type = Form
 children = EXPO_4 EXPO_camera
end
!----------------------------
begin OWidget
 name = EXPO_4
 type = Box
 children = EXPO_5 EXPO_EXPO_casc EXPO_g4_casc
 background = lightgrey
 top        = chaintop
 left       = chainleft
 right      = chainright
! bottom     = chainbottom
 resizable  = true
 horizDistance = 1
 vertDistance = 1
end
!----------------------------
begin OWidget
 name = EXPO_5
 type = MenuButton
 background = lightgrey
 label = File
 menuName = EXPO_6
 children = EXPO_6
end
!----------------------------
begin OWidget
 name = EXPO_6
 type = SimpleMenu
 mappedWhenManaged = false
 children = EXPO_exit 
 background = lightgrey
end
!----------------------------
begin OWidget
 name = EXPO_exit
 type = SmeBSB
 label = Exit
 callback = osh> do Wo sendExitOnly
end
!----------------------------
begin OWidget
 name = EXPO_camera
 type = XoCamera
! depthTreatment = zbuffer
 createCallback = osh>\
  set Widget target `thisWidget`\
  camera=`thisCamera`\
  # EXPO\
  setWidgetResource EXPO_camera viewLimits '-2000. 2000.'\
  set OContext color pink; collect PhysicalVolume where name eq WorldPhys | represent - | viewNode - $camera\
  set OContext color pink; collect PhysicalVolume where name eq CalorPhys | represent - | viewNode - $camera\
  set OContext modeling wire_frame\
  set OContext color lightgrey;   collect PhysicalVolume where name eq ChambPhys | represent - | viewNode - $camera
 background = black
 collectCallback = osh> getCameraNodes `thisCamera` | collect ONode where highlight eq 1 | get - name | dump -
 vertDistance  = 1
 fromVert      = EXPO_4
 height        = 1000
 left          = chainleft
 right         = chainright
 bottom        = chainbottom
 horizDistance = 1
end
!----------------------------
begin OWidget
 name = EXPO_g4_casc
 type = MenuButton
 background = lightgrey
 label = G4
 menuName = EXPO_g4_pdm
 children = EXPO_g4_pdm
end
!----------------------------
begin OWidget
 name = EXPO_g4_pdm
 type = SimpleMenu
 mappedWhenManaged = false
 children = EXPO_particles
 background = lightgrey
end
!----------------------------
begin OWidget
 name = EXPO_particles
 type = SmeBSB
 label = Particle dump
 callback = G4> /particle/dump
end
!----------------------------
begin OWidget
 name = EXPO_EXPO_casc
 type = MenuButton
 background = lightgrey
 label = EXPO
 menuName = EXPO_EXPO_pdm
 children = EXPO_EXPO_pdm
end
!----------------------------
begin OWidget
 name = EXPO_EXPO_pdm
 type = SimpleMenu
 mappedWhenManaged = false
 children = EXPO_startRun EXPO_nextEvent EXPO_abortRun
 background = lightgrey
end
!----------------------------
begin OWidget
 name = EXPO_startRun
 type = SmeBSB
 label = Start run
 createCallback = osh> setWidgetResource EXPO_nextEvent sensitive False
! SmeBSB is a gadget then &osh> crashes.
 callback = osh>\
  setWidgetResource EXPO_exit      sensitive False\
  setWidgetResource EXPO_startRun  sensitive False\
  setWidgetResource EXPO_nextEvent sensitive True\
  setWidgetResource EXPO_abortRun  sensitive True\
  #eventn=`ask 'Number of event' 10`\
  eventn='10'\
  string=`printf '/run/beamOn %s' $eventn`\
  G4 $string\
  setWidgetResource EXPO_exit      sensitive True\
  setWidgetResource EXPO_startRun  sensitive True\
  setWidgetResource EXPO_nextEvent sensitive False\
  setWidgetResource EXPO_abortRun  sensitive False
end
!----------------------------
begin OWidget
 name = EXPO_nextEvent
 type = SmeBSB
 label = Next event
 callback = osh> do Wo sendExitOnly
end
!----------------------------
begin OWidget
 name = EXPO_abortRun
 type = SmeBSB
 label = Abort run
 createCallback = osh>\
  setWidgetResource EXPO_nextEvent sensitive False\
  setWidgetResource EXPO_abortRun  sensitive False
 callback = osh>\
  G4 /run/abort\
  do Wo sendExitOnly
end





