diff --git a/geant4/PQt_musrSim/CBeamLine.mac b/geant4/PQt_musrSim/CBeamLine.mac
new file mode 100644
index 0000000..f63a395
--- /dev/null
+++ b/geant4/PQt_musrSim/CBeamLine.mac
@@ -0,0 +1,790 @@
+# Template suitable for beam profile detectioon
+# Zaher Salman 19/3/2010
+
+# This is a template mac file for tuning the lem beamline with a spin rotator
+# You can use this to generate a beam envelope profile along z
+# Variables top set
+# L1VOLTAGE = The voltage on L1 lens
+# L3VOLTAGE = The voltage on L3 lens
+# BMAGSEPMAP= The name of the magnetic field map for the spin rotator
+# BMAGVAL = The value of magnetic field at the center
+# ELECSEPMAP= The name of the electric field map for the spin rotator
+# ELECVAL = The value of electric field at the center
+# RAVOLTAGE = The voltage on the ring anode sections (all equal)
+# PROFILEZ = The z coordinate to measure beam envelope
+
+# save_slices_lines should be replaced by slices of save volumes to track the beam, e.g.:
+#/musr/command construct tubs save0 0 39 1.5 0 360 G4_Galactic 0 0 -2500 log_World norot dead 851
+#/musr/command construct tubs save1 0 39 1.5 0 360 G4_Galactic 0 0 -2450 log_World norot dead 852
+#/musr/command construct tubs save2 0 39 1.5 0 360 G4_Galactic 0 0 -2400 log_World norot dead 853
+#/musr/command construct tubs save3 0 39 1.5 0 360 G4_Galactic 0 0 -2350 log_World norot dead 854
+#/musr/command construct tubs save4 0 39 1.5 0 360 G4_Galactic 0 0 -2300 log_World norot dead 855
+#/musr/command construct tubs save5 0 39 1.5 0 360 G4_Galactic 0 0 -2250 log_World norot dead 856
+#/musr/command construct tubs save6 0 39 1.5 0 360 G4_Galactic 0 0 -2200 log_World norot dead 857
+# Make sure there is no overlap between slices and other volumes.
+
+################################################################################################################
+# -- ROTATION MATRICES --
+################################################################################################################
+
+# 3 parameters -> Define Euler angles (the 4th par. is set to zero).
+# 4 parameters -> Define axis + rotation.
+# HEP computations ordinarily use the active rotation viewpoint (object is rotated NOT axes).
+# Therefore, rotations about an axis imply ACTIVE COUNTER-CLOCKWISE rotation in this package.
+# Rotation around a specified axis means counter-clockwise rot. around the positive direction of the axis.
+
+# Define rotations for the field maps of Trigger and Ring Anode:
+/musr/command rotation rotTrig 0 1 0 -45
+/musr/command rotation rotRAnR 0 0 1 -90
+/musr/command rotation rotRAnL 0 0 1 90
+/musr/command rotation rotRAnD 0 0 1 180
+
+# More Rotations
+/musr/command rotation rotD1 0 0 1 11.250
+/musr/command rotation rotD2 0 0 1 33.750
+/musr/command rotation rotD3 0 0 1 56.250
+/musr/command rotation rotD4 0 0 1 78.750
+/musr/command rotation rotD5 0 0 1 101.250
+/musr/command rotation rotD6 0 0 1 123.750
+/musr/command rotation rotD7 0 0 1 146.250
+/musr/command rotation rotD8 0 0 1 168.750
+/musr/command rotation rotD9 0 0 1 191.250
+/musr/command rotation rotD10 0 0 1 213.750
+/musr/command rotation rotD11 0 0 1 236.250
+/musr/command rotation rotD12 0 0 1 258.750
+/musr/command rotation rotD13 0 0 1 281.250
+/musr/command rotation rotD14 0 0 1 303.750
+/musr/command rotation rotD15 0 0 1 326.250
+/musr/command rotation rotD16 0 0 1 348.750
+
+/musr/command rotation rotD17 0 0 1 11.250
+/musr/command rotation rotD18 0 0 1 33.750
+/musr/command rotation rotD19 0 0 1 56.250
+/musr/command rotation rotD20 0 0 1 78.750
+/musr/command rotation rotD21 0 0 1 101.250
+/musr/command rotation rotD22 0 0 1 123.750
+/musr/command rotation rotD23 0 0 1 146.250
+/musr/command rotation rotD24 0 0 1 168.750
+/musr/command rotation rotD25 0 0 1 191.250
+/musr/command rotation rotD26 0 0 1 213.750
+/musr/command rotation rotD27 0 0 1 236.250
+/musr/command rotation rotD28 0 0 1 258.750
+/musr/command rotation rotD29 0 0 1 281.250
+/musr/command rotation rotD30 0 0 1 303.750
+/musr/command rotation rotD31 0 0 1 326.250
+/musr/command rotation rotD32 0 0 1 348.750
+
+################################################################################################################
+# -- LEM GEOMETRY --
+################################################################################################################
+
+# WORLD = Laboratory reference frame, the origin is in the centre of the LEM sample tube
+/musr/command construct box World 350 350 2600 G4_Galactic 0 0 0 no_logical_volume norot dead -1
+/musr/command visattributes log_World invisible
+
+# These are slices to map the beam envelope along the beam line. The radius should be less than 50mm
+/musr/command construct tubs save0 0 39 1.5 0 360 G4_Galactic 0 0 -2500 log_World norot dead 851
+/musr/command construct tubs save1 0 39 1.5 0 360 G4_Galactic 0 0 -2450 log_World norot dead 852
+/musr/command construct tubs save2 0 39 1.5 0 360 G4_Galactic 0 0 -2400 log_World norot dead 853
+/musr/command construct tubs save3 0 39 1.5 0 360 G4_Galactic 0 0 -2350 log_World norot dead 854
+/musr/command construct tubs save4 0 39 1.5 0 360 G4_Galactic 0 0 -2300 log_World norot dead 855
+/musr/command construct tubs save5 0 39 1.5 0 360 G4_Galactic 0 0 -2250 log_World norot dead 856
+/musr/command construct tubs save6 0 39 1.5 0 360 G4_Galactic 0 0 -2200 log_World norot dead 857
+/musr/command construct tubs save7 0 39 1.5 0 360 G4_Galactic 0 0 -2150 log_World norot dead 858
+/musr/command construct tubs save8 0 39 1.5 0 360 G4_Galactic 0 0 -2100 log_World norot dead 859
+/musr/command construct tubs save9 0 39 1.5 0 360 G4_Galactic 0 0 -2050 log_World norot dead 860
+/musr/command construct tubs save10 0 39 1.5 0 360 G4_Galactic 0 0 -2000 log_World norot dead 861
+/musr/command construct tubs save11 0 39 1.5 0 360 G4_Galactic 0 0 -1950 log_World norot dead 862
+/musr/command construct tubs save12 0 39 1.5 0 360 G4_Galactic 0 0 -1900 log_World norot dead 863
+/musr/command construct tubs save13 0 39 1.5 0 360 G4_Galactic 0 0 -1850 log_World norot dead 864
+/musr/command construct tubs save14 0 39 1.5 0 360 G4_Galactic 0 0 -1800 log_World norot dead 865
+/musr/command construct tubs save15 0 39 1.5 0 360 G4_Galactic 0 0 -1750 log_World norot dead 866
+/musr/command construct tubs save16 0 39 1.5 0 360 G4_Galactic 0 0 -1700 log_World norot dead 867
+/musr/command construct tubs save17 0 39 1.5 0 360 G4_Galactic 0 0 -1650 log_World norot dead 868
+/musr/command construct tubs save18 0 39 1.5 0 360 G4_Galactic 0 0 -1600 log_World norot dead 869
+/musr/command construct tubs save19 0 39 1.5 0 360 G4_Galactic 0 0 -1550 log_World norot dead 870
+/musr/command construct tubs save20 0 39 1.5 0 360 G4_Galactic 0 0 -1500 log_World norot dead 871
+/musr/command construct tubs save21 0 39 1.5 0 360 G4_Galactic 0 0 -1450 log_World norot dead 872
+/musr/command construct tubs save22 0 39 1.5 0 360 G4_Galactic 0 0 -1400 log_World norot dead 873
+/musr/command construct tubs save23 0 39 1.5 0 360 G4_Galactic 0 0 -1350 log_World norot dead 874
+/musr/command construct tubs save24 0 39 1.5 0 360 G4_Galactic 0 0 -1300 log_World norot dead 875
+/musr/command construct tubs save25 0 39 1.5 0 360 G4_Galactic 0 0 -1250 log_World norot dead 876
+/musr/command construct tubs save26 0 39 1.5 0 360 G4_Galactic 0 0 -1200 log_World norot dead 877
+/musr/command construct tubs save27 0 39 1.5 0 360 G4_Galactic 0 0 -1150 log_World norot dead 878
+/musr/command construct tubs save28 0 39 1.5 0 360 G4_Galactic 0 0 -1100 log_World norot dead 879
+/musr/command construct tubs save29 0 39 1.5 0 360 G4_Galactic 0 0 -1050 log_World norot dead 880
+/musr/command construct tubs save30 0 39 1.5 0 360 G4_Galactic 0 0 -1000 log_World norot dead 881
+/musr/command construct tubs save31 0 39 1.5 0 360 G4_Galactic 0 0 -950 log_World norot dead 882
+/musr/command construct tubs save32 0 39 1.5 0 360 G4_Galactic 0 0 -900 log_World norot dead 883
+/musr/command construct tubs save33 0 39 1.5 0 360 G4_Galactic 0 0 -850 log_World norot dead 884
+/musr/command construct tubs save34 0 39 1.5 0 360 G4_Galactic 0 0 -800 log_World norot dead 885
+/musr/command construct tubs save35 0 39 1.5 0 360 G4_Galactic 0 0 -750 log_World norot dead 886
+/musr/command construct tubs save36 0 39 1.5 0 360 G4_Galactic 0 0 -700 log_World norot dead 887
+/musr/command construct tubs save37 0 39 1.5 0 360 G4_Galactic 0 0 -650 log_World norot dead 888
+/musr/command construct tubs save38 0 39 1.5 0 360 G4_Galactic 0 0 -600 log_World norot dead 889
+/musr/command construct tubs save39 0 39 1.5 0 360 G4_Galactic 0 0 -550 log_World norot dead 890
+/musr/command construct tubs save40 0 39 1.5 0 360 G4_Galactic 0 0 -500 log_World norot dead 891
+/musr/command construct tubs save41 0 39 1.5 0 360 G4_Galactic 0 0 -450 log_World norot dead 892
+/musr/command construct tubs save42 0 39 1.5 0 360 G4_Galactic 0 0 -400 log_World norot dead 893
+/musr/command construct tubs save43 0 39 1.5 0 360 G4_Galactic 0 0 -350 log_World norot dead 894
+/musr/command construct tubs save44 0 39 1.5 0 360 G4_Galactic 0 0 -300 log_World norot dead 895
+/musr/command construct tubs save45 0 39 1.5 0 360 G4_Galactic 0 0 -250 log_World norot dead 896
+/musr/command construct tubs save46 0 39 1.5 0 360 G4_Galactic 0 0 -200 log_World norot dead 897
+/musr/command construct tubs save47 0 39 1.5 0 360 G4_Galactic 0 0 -150 log_World norot dead 898
+/musr/command construct tubs save48 0 39 1.5 0 360 G4_Galactic 0 0 -100 log_World norot dead 899
+/musr/command construct tubs save49 0 39 1.5 0 360 G4_Galactic 0 0 -50 log_World norot dead 900
+/musr/command construct tubs save50 0 39 1.5 0 360 G4_Galactic 0 0 0 log_World norot dead 901
+/musr/command construct tubs save51 0 39 1.5 0 360 G4_Galactic 0 0 50 log_World norot dead 902
+/musr/command construct tubs save52 0 39 1.5 0 360 G4_Galactic 0 0 100 log_World norot dead 903
+/musr/command construct tubs save53 0 39 1.5 0 360 G4_Galactic 0 0 150 log_World norot dead 904
+
+
+################################################################################################################
+# -- APD Scintillators --
+################################################################################################################
+
+# Detectors volume (0,0,0) coninsides with World (0,0,0)
+/musr/command construct tubs DetV 80 105 133 0 360 G4_Galactic 0 0 0 log_World norot dead 100
+/musr/command visattributes log_DetV invisible
+
+# For final design set
+# BackHW=60
+# BackCR=-60
+# ForwHW=65.5
+# ForwCR=66.5
+
+# Back inner sections (Upstream) (v.i.)
+# Current design (30 June 09) BackHW=60.0mm (Half width or length), BackCR=-120+BackHW=-60.0mm (Center z coordinate)
+/musr/command construct trd90y ScD1 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 86.799497 -17.265493 -60 log_DetV rotD1 musr/ScintSD 1
+/musr/command construct trd90y ScD2 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 73.585061 -49.167966 -60 log_DetV rotD2 musr/ScintSD 2
+/musr/command construct trd90y ScD3 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 49.167966 -73.585061 -60 log_DetV rotD3 musr/ScintSD 3
+/musr/command construct trd90y ScD4 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.265493 -86.799497 -60 log_DetV rotD4 musr/ScintSD 4
+/musr/command construct trd90y ScD5 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.265493 -86.799497 -60 log_DetV rotD5 musr/ScintSD 5
+/musr/command construct trd90y ScD6 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -49.167966 -73.585061 -60 log_DetV rotD6 musr/ScintSD 6
+/musr/command construct trd90y ScD7 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -73.585061 -49.167966 -60 log_DetV rotD7 musr/ScintSD 7
+/musr/command construct trd90y ScD8 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -86.799497 -17.265493 -60 log_DetV rotD8 musr/ScintSD 8
+/musr/command construct trd90y ScD9 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -86.799497 17.265493 -60 log_DetV rotD9 musr/ScintSD 9
+/musr/command construct trd90y ScD10 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -73.585061 49.167966 -60 log_DetV rotD10 musr/ScintSD 10
+/musr/command construct trd90y ScD11 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -49.167966 73.585061 -60 log_DetV rotD11 musr/ScintSD 11
+/musr/command construct trd90y ScD12 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.265493 86.799497 -60 log_DetV rotD12 musr/ScintSD 12
+/musr/command construct trd90y ScD13 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.265493 86.799497 -60 log_DetV rotD13 musr/ScintSD 13
+/musr/command construct trd90y ScD14 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 49.167966 73.585061 -60 log_DetV rotD14 musr/ScintSD 14
+/musr/command construct trd90y ScD15 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 73.585061 49.167966 -60 log_DetV rotD15 musr/ScintSD 15
+/musr/command construct trd90y ScD16 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 86.799497 17.265493 -60 log_DetV rotD16 musr/ScintSD 16
+
+# Forward inner sections (Downstream) (h.i.)
+# Current design (30 June 09) ForwHW=65.5mm (Half width or length), ForwCR=132-ForwHW=66.5mm (Center z coordinate)
+/musr/command construct trd90y ScD17 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 85.818712 -17.070403 66.5 log_DetV rotD17 musr/ScintSD 17
+/musr/command construct trd90y ScD18 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 72.753591 -48.612395 66.5 log_DetV rotD18 musr/ScintSD 18
+/musr/command construct trd90y ScD19 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 48.612395 -72.753591 66.5 log_DetV rotD19 musr/ScintSD 19
+/musr/command construct trd90y ScD20 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.070403 -85.818712 66.5 log_DetV rotD20 musr/ScintSD 20
+/musr/command construct trd90y ScD21 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.070403 -85.818712 66.5 log_DetV rotD21 musr/ScintSD 21
+/musr/command construct trd90y ScD22 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -48.612395 -72.753591 66.5 log_DetV rotD22 musr/ScintSD 22
+/musr/command construct trd90y ScD23 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -72.753591 -48.612395 66.5 log_DetV rotD23 musr/ScintSD 23
+/musr/command construct trd90y ScD24 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -85.818712 -17.070403 66.5 log_DetV rotD24 musr/ScintSD 24
+/musr/command construct trd90y ScD25 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -85.818712 17.070403 66.5 log_DetV rotD25 musr/ScintSD 25
+/musr/command construct trd90y ScD26 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -72.753591 48.612395 66.5 log_DetV rotD26 musr/ScintSD 26
+/musr/command construct trd90y ScD27 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -48.612395 72.753591 66.5 log_DetV rotD27 musr/ScintSD 27
+/musr/command construct trd90y ScD28 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.070403 85.818712 66.5 log_DetV rotD28 musr/ScintSD 28
+/musr/command construct trd90y ScD29 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.070403 85.818712 66.5 log_DetV rotD29 musr/ScintSD 29
+/musr/command construct trd90y ScD30 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 48.612395 72.753591 66.5 log_DetV rotD30 musr/ScintSD 30
+/musr/command construct trd90y ScD31 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 72.753591 48.612395 66.5 log_DetV rotD31 musr/ScintSD 31
+/musr/command construct trd90y ScD32 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 85.818712 17.070403 66.5 log_DetV rotD32 musr/ScintSD 32
+
+# Back outer sections (v.a.)
+/musr/command construct trd ScD33 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 93.664994 -18.631126 -60 log_DetV rotD1 musr/ScintSD 33
+/musr/command construct trd ScD34 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 79.405348 -53.056957 -60 log_DetV rotD2 musr/ScintSD 34
+/musr/command construct trd ScD35 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 53.056957 -79.405348 -60 log_DetV rotD3 musr/ScintSD 35
+/musr/command construct trd ScD36 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.631126 -93.664994 -60 log_DetV rotD4 musr/ScintSD 36
+/musr/command construct trd ScD37 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.631126 -93.664994 -60 log_DetV rotD5 musr/ScintSD 37
+/musr/command construct trd ScD38 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -53.056957 -79.405348 -60 log_DetV rotD6 musr/ScintSD 38
+/musr/command construct trd ScD39 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -79.405348 -53.056957 -60 log_DetV rotD7 musr/ScintSD 39
+/musr/command construct trd ScD40 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -93.664994 -18.631126 -60 log_DetV rotD8 musr/ScintSD 40
+/musr/command construct trd ScD41 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -93.664994 18.631126 -60 log_DetV rotD9 musr/ScintSD 41
+/musr/command construct trd ScD42 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -79.405348 53.056957 -60 log_DetV rotD10 musr/ScintSD 42
+/musr/command construct trd ScD43 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -53.056957 79.405348 -60 log_DetV rotD11 musr/ScintSD 43
+/musr/command construct trd ScD44 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.631126 93.664994 -60 log_DetV rotD12 musr/ScintSD 44
+/musr/command construct trd ScD45 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.631126 93.664994 -60 log_DetV rotD13 musr/ScintSD 45
+/musr/command construct trd ScD46 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 53.056957 79.405348 -60 log_DetV rotD14 musr/ScintSD 46
+/musr/command construct trd ScD47 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 79.405348 53.056957 -60 log_DetV rotD15 musr/ScintSD 47
+/musr/command construct trd ScD48 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 93.664994 18.631126 -60 log_DetV rotD16 musr/ScintSD 48
+
+# Forward outer sections (h.a.)
+/musr/command construct trd ScD49 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 92.684209 -18.436035 66.5 log_DetV rotD1 musr/ScintSD 49
+/musr/command construct trd ScD50 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 78.573878 -52.501387 66.5 log_DetV rotD2 musr/ScintSD 50
+/musr/command construct trd ScD51 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 52.501387 -78.573878 66.5 log_DetV rotD3 musr/ScintSD 51
+/musr/command construct trd ScD52 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.436035 -92.684209 66.5 log_DetV rotD4 musr/ScintSD 52
+/musr/command construct trd ScD53 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.436035 -92.684209 66.5 log_DetV rotD5 musr/ScintSD 53
+/musr/command construct trd ScD54 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -52.501387 -78.573878 66.5 log_DetV rotD6 musr/ScintSD 54
+/musr/command construct trd ScD55 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -78.573878 -52.501387 66.5 log_DetV rotD7 musr/ScintSD 55
+/musr/command construct trd ScD56 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -92.684209 -18.436035 66.5 log_DetV rotD8 musr/ScintSD 56
+/musr/command construct trd ScD57 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -92.684209 18.436035 66.5 log_DetV rotD9 musr/ScintSD 57
+/musr/command construct trd ScD58 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -78.573878 52.501387 66.5 log_DetV rotD10 musr/ScintSD 58
+/musr/command construct trd ScD59 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -52.501387 78.573878 66.5 log_DetV rotD11 musr/ScintSD 59
+/musr/command construct trd ScD60 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.436035 92.684209 66.5 log_DetV rotD12 musr/ScintSD 60
+/musr/command construct trd ScD61 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.436035 92.684209 66.5 log_DetV rotD13 musr/ScintSD 61
+/musr/command construct trd ScD62 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 52.501387 78.573878 66.5 log_DetV rotD14 musr/ScintSD 62
+/musr/command construct trd ScD63 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 78.573878 52.501387 66.5 log_DetV rotD15 musr/ScintSD 63
+/musr/command construct trd ScD64 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 92.684209 18.436035 66.5 log_DetV rotD16 musr/ScintSD 64
+
+# Structural support inside the detectors vessel
+# Al tube, inner radius 80, thickness 2 mm.
+# Additional Al plate, 2 mm thick for h.i and h.a and 3 mm thick for v.i. and v.a
+/musr/command construct tubs hInShell 80.0 84.0 65.5 0 360 G4_Al 0 0 66.5 log_DetV norot dead 70
+/musr/command construct tubs vInShell 80.0 85.0 60.0 0 360 G4_Al 0 0 -60.0 log_DetV norot dead 70
+
+
+# Old detectors
+## Inner Scintillators - I
+#/musr/command construct tubs ScID1 90 95 130 45 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 011
+#/musr/command construct tubs ScIR 90 95 130 135 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 012
+#/musr/command construct tubs ScID 90 95 130 225 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 013
+#/musr/command construct tubs ScIL 90 95 130 315 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 014
+
+## Outer Scintillators - O
+#/musr/command construct tubs ScOU 96 101 130 45 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 021
+#/musr/command construct tubs ScOR 96 101 130 135 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 022
+#/musr/command construct tubs ScOD 96 101 130 225 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 023
+#/musr/command construct tubs ScOL 96 101 130 315 90 G4_PLASTIC_SC_VINYLTOLUENE 0 0 0 log_DetV norot musr/ScintSD 024
+
+# For testing dimensions
+#/musr/command construct box test 2.5 19.7 60. Steel -88.5 -0.0 -60. log_DetV norot dead 3206
+#/musr/command construct sphere test 0 2 0 360 0 360 Steel 37.6643 -17.2901 1.17977 log_ScD1 norot dead 3206
+
+# Visual attributes (optional)
+/musr/command visattributes G4_PLASTIC_SC_VINYLTOLUENE green
+#/musr/command visattributes log_ScD49 green
+#/musr/command visattributes log_ScD50 green
+#/musr/command visattributes log_test red
+
+################################################################################################################
+# Sample vacuum/tube up to gate valve - Can host either the Cryostat or the MCP2
+################################################################################################################
+
+# Vacuum space
+# /musr/command construct tubs SamV 0 75.0 254.5 0 360 G4_Galactic 0 0 -92.5 log_World norot dead 100
+# Sample tube
+/musr/command construct tubs SamS 75.0 78.0 162.0 0 360 Steel 0 0 0 log_World norot dead 101
+
+# F160 - 160 CF flange upstream of MCP2 tube
+/musr/command construct tubs F160 78.0 101.25 11 0 360 Steel 0 0 -151.0 log_World norot dead 102
+# F100 (Blank end flange)
+#/musr/command construct tubs F100 0 75.0 10 0 360 Steel 0 0 172.0 log_World norot dead 103
+
+# 200 CF flange upstream of MCP2 tube covering the whole length of the gate valve chamber.
+/musr/command construct tubs GATS 103.25 126.5 92.5 0 360 Steel 0 0 -254.5 log_World norot dead 371
+
+# F200 - 200 CF flange upstream of MCP2 tube to connect to gate valve chamber
+/musr/command construct tubs F200 76.5 103.25 12 0 360 Steel 0 0 -174.0 log_World norot dead 372
+
+# Visual attributes (optional)
+#/musr/command visattributes log_SamV invisible
+/musr/command visattributes log_SamS oxsteel
+/musr/command visattributes log_F160 oxsteel
+#/musr/command visattributes log_F100 oxsteel
+/musr/command visattributes log_GATS oxsteel
+/musr/command visattributes log_F200 oxsteel
+
+
+################################################################################################################
+# RA - Ring Anode, M - middle part (closer to Ground Anode), E - end part (farther from the Ground Anode)
+# U - up, D - down, L - left, R - right (with respect to muon's view - momentum direction)
+# Note: 3.0 mm HALF gap at 45.1469 mm half radius => delta_ang = asin(3.0/45.1469)*180/pi = 3.81 deg.
+# Note: delta_ang = 3.1744 deg. for 2.5 mm HG. The angular extension goes e.g. from (45 + da) to (90 - 2*da).
+# Note: Ring Anode - Ground Anode distance was 15 mm => CHANGED to 12 mm! (Positions: 11.5 -> 8.5, -33.5 -> -36.5)
+################################################################################################################
+
+# RA_Ez = -10.35+2.25 = -8.1 cm; RA_Mz= -10.35 - 2.25 = -12.6 cm; RA_Gz= -25.45+3.75 = -21.7 cm; mcpv_z = -9.25 cm
+/musr/command construct cons RA_EU 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World norot dead 301
+/musr/command construct cons RA_MU 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World norot dead 302
+/musr/command construct cons RA_ER 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World rotRAnR dead 303
+/musr/command construct cons RA_MR 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World rotRAnR dead 304
+/musr/command construct cons RA_ED 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World rotRAnD dead 305
+/musr/command construct cons RA_MD 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World rotRAnD dead 306
+/musr/command construct cons RA_EL 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World rotRAnL dead 307
+/musr/command construct cons RA_ML 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World rotRAnL dead 308
+
+# Dummy, thin cylindres used for applying the SAME RA field-map (ROTATED by 90 deg.) to different anodes.
+# NOTE: EM field cannot be applied to non simply connected bodies, as e.g. rings, cons, tori, etc.!
+/musr/command construct tubs RA_U 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.00 log_World norot dead 322
+/musr/command construct tubs RA_R 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.02 log_World rotRAnR dead 324
+/musr/command construct tubs RA_D 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.04 log_World rotRAnD dead 326
+/musr/command construct tubs RA_L 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.06 log_World rotRAnL dead 328
+
+# RA_G - Ring Anode Ground Cylinder
+/musr/command construct tubs RA_G 58 62.5 58.0 0 360 G4_Cu 0 0 -221.5 log_World norot dead 351
+
+# Ring Anodes visual attributes (optional)
+#/musr/command visattributes log_RA_EU invisible
+#/musr/command visattributes log_RA_MR invisible
+/musr/command visattributes log_RA_G invisible
+#/musr/command visattributes log_RA_G Grid_style
+
+
+################################################################################################################
+# L3 - 3rd Einzel Lens # L3z = -56.7 cm.
+# Lens Gap = 12.0 mm => G/D = 12/130 ~ 0.1 (Lens Gap = gap between Ground and Anode, D - Diameter)
+################################################################################################################
+
+# L3 volume
+/musr/command construct tubs L3V 65 127 220 0 360 G4_Galactic 0 0 -567 log_World norot dead 400
+
+# Lens 3 Steel tube (inner dia: 200 mm, outer dia: 206 mm, length: 720 mm)
+/musr/command construct tubs L3ST 100 103 220 0 360 Steel 0 0 0 log_L3V norot dead 401
+
+# Lens 3 Flange 1, z = L3z + 208 mm
+/musr/command construct tubs L3F1 103 126.5 12 0 360 Steel 0 0 -208 log_L3V norot dead 402
+
+# Lens 3 Flange 2, z = L3z - 208 mm
+/musr/command construct tubs L3F2 103 126.5 12 0 360 Steel 0 0 208 log_L3V norot dead 403
+
+# GPn - Ground Potential Electrodes
+# n = 1-4 (further from TD) and 5-8 (closer to TD) - components of the Ground Electrodes
+# Ground Electrode (inner dia: 130 mm, outer dia: 134 mm, length: 133 mm)
+/musr/command construct tubs L3GP1 65 67 66.5 0 360 Steel 0 0 133.5 log_L3V norot dead 421
+# Outer electrode surface (LN2 cooling vessel)
+/musr/command construct tubs L3GP2 81 83 66.5 0 360 Steel 0 0 133.5 log_L3V norot dead 422
+# First ring cap
+/musr/command construct tubs L3GP3 67 81 4 0 360 Steel 0 0 196.0 log_L3V norot dead 423
+# Second ring cap
+/musr/command construct tubs L3GP4 67 81 4 0 360 Steel 0 0 71.0 log_L3V norot dead 424
+
+/musr/command construct tubs L3GP5 65 67 66.5 0 360 Steel 0 0 -133.5 log_L3V norot dead 431
+/musr/command construct tubs L3GP6 81 83 66.5 0 360 Steel 0 0 -133.5 log_L3V norot dead 432
+/musr/command construct tubs L3GP7 67 81 4 0 360 Steel 0 0 -196.0 log_L3V norot dead 433
+/musr/command construct tubs L3GP8 67 81 4 0 360 Steel 0 0 -71.0 log_L3V norot dead 434
+
+# HP - High Potential Electrode (Central Anode - usually at +8.7 kV, for a 15 keV muon beam)
+/musr/command construct tubs L3HP 65 83 55 0 360 Steel 0 0 0 log_L3V norot dead 451
+
+# Lens 3 visual attributes (optional)
+/musr/command visattributes log_L3V invisible
+/musr/command visattributes log_L3ST oxsteel
+/musr/command visattributes log_L3F1 oxsteel
+/musr/command visattributes log_L3F2 oxsteel
+/musr/command visattributes log_L3HP darkred
+
+################################################################################################################
+# IP - Intermediate Piece (between Trigger Detector and Einzel Lens 3)
+# Original name was CGate - B-field Coil Compensation Gate?! # CompGatez = -86.55 cm; // L3z - 22 - 7.85 cm
+################################################################################################################
+
+# IPV (but also others) are just empty volumes "filled" with vacuum. Sometimes used to apply EM fields to restricted areas.
+/musr/command construct tubs IPV 65 127 78.5 0 360 G4_Galactic 0 0 -865.5 log_World norot dead 500 nofield
+# IPCF - Intermediate Piece Central Flange (same as L3 Flanges)
+# IPST - Intermediate Piece Steel Tube (same diameter as L3 Steel Tube)
+/musr/command construct tubs IPCF 103 126.5 12.0 0 360 Steel 0 0 0 log_IPV norot dead 501 nofield
+/musr/command construct tubs IPST 100 103 78.5 0 360 Steel 0 0 0 log_IPV norot dead 502 nofield
+
+
+# IP visual attributes (optional)
+/musr/command visattributes log_IPV invisible
+/musr/command visattributes log_IPCF blue_style
+/musr/command visattributes log_IPST gray
+
+
+################################################################################################################
+# Trigger - Trigger Detector # Triggerz = -1092 mm; total length of TD is 110 mm; carbon foil at -1144 mm.
+################################################################################################################
+
+# Trigger volume
+/musr/command construct tubs TrigV 90 127 148 0 360 G4_Galactic 0 0 -1092 log_World norot dead 600
+# Trigger tube
+/musr/command construct tubs TrigS 100 103 148 0 360 Steel 0 0 0 log_TrigV norot dead 601
+
+# TF - Trigger tube flanges
+/musr/command construct tubs TF1 103 126.5 12 0 360 Steel 0 0 136 log_TrigV norot dead 611
+/musr/command construct tubs TF2 103 126.5 12 0 360 Steel 0 0 -136 log_TrigV norot dead 612
+
+# trigger foil is 52mm upstream of Triggerz, i.e. at -1144 mm
+# Carbon Foil (default HALF-thickness 0.000005147 mm, see below => CFoil thick = 10.3 nm).
+# USE THE NAME CFoil or coulombCFoil, otherwise musrMuFormation won't work!
+/musr/command construct box CFoil 60 60 0.0000044 G4_GRAPHITE 0 0 -1144 log_World norot dead 621
+
+# Notes: NIST tables use G4_GRAPHITE with 1.7 g/cm3 and 78 eV ioniz. energy.
+# An area density of 2.20 ug/cm2 implies a CF thickn. = (2.20*1.e-6/1.70)*cm = 1.294e-5 mm - Total thickness
+# An area density of 1.75 ug/cm2 implies a CF thickn. = (1.75*1.e-6/1.70)*cm = 1.029e-5 mm - Total thickness
+# If necessary, use Graphite as defined in musrDetectorConstruction.cc and set any density.
+
+
+# Trigger visual attributes (optional)
+/musr/command visattributes log_TrigV oxsteel
+/musr/command visattributes log_TrigS oxsteel
+/musr/command visattributes log_TF1 oxsteel
+/musr/command visattributes log_TF2 oxsteel
+#*/musr/command visattributes saveCFoil MACOR_style
+#*/musr/command visattributes log_saveAfterTD darkred
+
+
+# One can set visible attrib. also on a MATERIAL basis, rather than on log_VOL.
+# E.g. /musr/command visattributes Steel red
+
+################################################################################################################
+# L2 - 2nd Einzel Lens # L2z = -136.3 cm.
+# Lens Gap = 12.0 mm => G/D = 12/130 ~ 0.1 (Lens Gap = gap between Ground and Anode, D - Diameter)
+################################################################################################################
+
+# L2 volume
+/musr/command construct tubs L2V 64 127 123 0 360 G4_Galactic 0 0 -1363 log_World norot dead 800
+
+# Lens 2 Steel tube (inner dia: 200 mm, outer dia: 206 mm, length: 246 mm)
+/musr/command construct tubs L2ST 70 73 123 0 360 Steel 0 0 0 log_L2V norot dead 801
+
+# Lens 2 Flange 1, z = L2z + 111 mm
+/musr/command construct tubs L2F1 73 106.5 12 0 360 Steel 0 0 -111 log_L2V norot dead 802
+
+# Lens 2 Flange 2, z = L2z - 111 mm
+/musr/command construct tubs L2F2 73 126.5 12 0 360 Steel 0 0 111 log_L2V norot dead 803
+
+# GPn - Ground Potential Electrodes
+# Ground Electrode (inner dia: 130 mm, outer dia: 134 mm, length: 60 mm)
+/musr/command construct tubs L2GP1 64 66 16.5 0 360 Steel 0 0 -106.5 log_L2V norot dead 804
+/musr/command construct tubs L2GP2 64 66 50 0 360 Steel 0 0 44 log_L2V norot dead 805
+
+# HP - High Potential Electrode (Central Anode - usually at +??8.7 kV, for a 15 keV muon beam)
+/musr/command construct tubs L2HP 64 66 30 0 360 Steel 0 0 -48 log_L2V norot dead 806
+
+# Lens 3 visual attributes (optional)
+/musr/command visattributes log_L2V invisible
+/musr/command visattributes log_L2ST oxsteel
+/musr/command visattributes log_L2F1 oxsteel
+/musr/command visattributes log_L2F2 oxsteel
+/musr/command visattributes log_L2HP darkred
+
+
+################################################################################################################
+# Lens 1 - 1st Einzel Lens
+################################################################################################################
+# L1ENV - Lens 1 envelope - for easy positioning of lens parts (outer dia: 100 mm, length: 300 mm)
+/musr/command construct tubs L1ENV 40 100 150 0 360 G4_Galactic 0 0 -1929.5 log_World norot dead 600
+/musr/command visattributes log_L1ENV invisible
+
+# GPn - Ground Potential Electrodes. (n = 1-2, inner dia: 80 mm, outer dia: 84 mm, length: 100 mm)
+# n = 1 - Ground Electrode 1 (further from SR).
+/musr/command construct tubs L1GP1 40 44 50 0 360 Steel 0 0 -100 log_L1ENV norot dead 651
+# n = 2 - Ground Electrode 2 (closer to SR).
+/musr/command construct tubs L1GP2 40 44 50 0 360 Steel 0 0 100 log_L1ENV norot dead 653
+# HP - High Potential Electrode (Central Anode - usually at +8.5 kV, for a 15 keV muon beam)
+/musr/command construct tubs L1HP 40 44 40 0 360 Steel 0 0 0 log_L1ENV norot dead 652
+
+# Lens 1 visual attributes (optional)
+/musr/command visattributes log_L1HP darkred
+
+
+
+
+
+###################################################################################
+################### E L E C T R O M G N E T I C F I E L D S ##################
+###################################################################################
+
+# Use ABSOLUTE coordinates to specify the field position (i.e. with respect to GLOBAL WORLD)!
+# Default field units: Magnetic - T, Electric - kV/mm (or kV for E-field maps).
+# NOTE: Applying a field to an invisible log_vol makes is visible!
+
+# Dummy, thin cylindres used for applying the field maps.
+# NOTE: EM field cannot be applied to non simply connected bodies, as e.g. rings, cones, tori, etc.!
+# For L1
+/musr/command construct tubs L1EField 0 0.01 0.005 0 360 G4_Galactic 0 0 -1929.5 log_World norot dead 706 nofield
+# For L2
+/musr/command construct tubs L2EField 0 0.01 0.005 0 360 G4_Galactic 0 0 -1411 log_World norot dead 707 nofield
+# For L3
+/musr/command construct tubs L3EField 0 0.01 0.005 0 360 G4_Galactic 0 0 -567.0 log_World norot dead 708 nofield
+
+# LENS 1. Best L1 settings: 8.5 kV for 15 keV muons, 11.33 kV for 20 keV muons
+/musr/command globalfield Lens1EField 0. 0. -1929.5 fromfile 2DE L1_Erz.map log_L1EField 9
+
+# LENS 2. Best L2 settings: 13 kV for 15 keV muons, 17.33 kV for 20 keV muons
+/musr/command globalfield Lens2EField 0. 0. -1411 fromfile 2DE L2_Erz.map log_L2EField 13.0
+
+# LENS 3. Best L3 settings: 8.35 kV for 15 keV muons, 11.41 kV for 20 keV muons
+/musr/command globalfield Lens3EField 0. 0. -567.0 fromfile 2DE L3_Erz.map log_L3EField 8.35
+
+# Electrical Field areas in the Trigger Detector
+# En = Electrical Field n: TnFieldMgr (n = 1-3)
+# Original TriggE2: [4.*sqrt(2), 4.5, 0.7/sqrt(2)] cm -> changed due to overlaps with E1 and E3
+/musr/command construct box TriggE0 45 45 5 G4_Galactic 0 0 -1149.15 log_World norot dead 630 nofield
+/musr/command construct box TriggE1 45 45 4 G4_Galactic 0 0 -1140. log_World norot dead 631 nofield
+/musr/command construct box TriggE2 45 45 4.9497 G4_Galactic 0 0 -1089.75 log_World rotTrig dead 632 nofield
+/musr/command construct box TriggE3 45 45 4 G4_Galactic 0 0 -1038.0 log_World norot dead 633
+
+### Electric field at TRIGGER Detector TD: Three different uniform fields
+/musr/command globalfield Trigg0_field 45 45 5 uniform 0. 0. -1149.15 log_TriggE0 0 0 0 0 0 0.373
+/musr/command globalfield Trigg1_field 45 45 4 uniform 0. 0. -1140. log_TriggE1 0 0 0 0 0 -0.02375
+/musr/command globalfield Trigg2_field 45 45 4.9497 uniform 0. 0. -1089.75 log_TriggE2 0 0 0 0 0 0.041416
+/musr/command globalfield Trigg3_field 45 45 4 uniform 0. 0. -1038.0 log_TriggE3 0 0 0 0 0 -0.49375
+
+### Electric field at RING ANODE - from 3DE field map
+# Typically set at +11.0 kV for a muon beam at 15 keV
+# To create an arbitrary configuration, switch on all fields and set different potentials.
+#######/musr/command globalfield RngAnU_field 0. 0. -167.00 fromfile 3DE EM_3D_extc.map log_RA_U 11.0
+/musr/command globalfield RngAnU_field 0. 0. -143.00 fromfile 3DE EM_3D_ext_gridf.map log_RA_U 11
+/musr/command globalfield RngAnR_field 0. 0. -143.02 fromfile 3DE EM_3D_ext_gridf.map log_RA_R 11
+/musr/command globalfield RngAnD_field 0. 0. -143.04 fromfile 3DE EM_3D_ext_gridf.map log_RA_D 11
+/musr/command globalfield RngAnL_field 0. 0. -143.06 fromfile 3DE EM_3D_ext_gridf.map log_RA_L 11
+
+# Set parameters for particle tracking in an EM field
+/musr/command globalfield setparameter SetLargestAcceptableStep 5
+/musr/command globalfield setparameter SetMinimumEpsilonStep 5e-5
+/musr/command globalfield setparameter SetMaximumEpsilonStep 0.001
+/musr/command globalfield setparameter SetDeltaOneStep 0.1
+/musr/command globalfield setparameter SetDeltaIntersection 0.01
+/musr/command globalfield printparameters
+
+# TESTING EM FIELD
+/musr/command globalfield printFieldValueAtPoint 0. 0. 0.
+/musr/command globalfield printFieldValueAtPoint 0. 35. -670.
+
+
+###################################################################################
+######################### P H Y S I C S P R O C E S S E S ##################
+###################################################################################
+# Geant 4.9.3
+/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
+/musr/command process addDiscreteProcess gamma G4ComptonScattering
+/musr/command process addDiscreteProcess gamma G4GammaConversion
+/musr/command process addDiscreteProcess gamma G4RayleighScattering
+/musr/command process addProcess e- G4eMultipleScattering -1 1 1
+/musr/command process addProcess e- G4eIonisation -1 2 2
+/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
+/musr/command process addProcess e+ G4eMultipleScattering -1 1 1
+/musr/command process addProcess e+ G4eIonisation -1 2 2
+/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
+/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
+/musr/command process addProcess mu- G4MuMultipleScattering -1 1 1
+/musr/command process addProcess mu- G4MuIonisation -1 2 2
+/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
+/musr/command process addProcess mu- G4MuPairProduction -1 4 4
+/musr/command process addProcess mu+ G4MuMultipleScattering -1 1 1
+#/musr/command process addModel mu+ G4MuMultipleScattering G4UrbanMscModel92 0
+#/musr/command process addModel mu+ G4MuMultipleScattering G4WentzelVIModel 0
+#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
+#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
+#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
+#/musr/command process addDiscreteProcess mu+ G4CoulombScattering
+
+###################################################################################
+################## S O M E O T H E R P A R A M E T E R S ##################
+###################################################################################
+# Set the overall range cut
+#/run/setCut 1 mm
+# Set the range cut on a particular volumes (in mm)
+#/musr/command SetUserLimits log_target 0.01
+#/musr/command SetUserLimits log_targetscint 0.01
+#/musr/command SetUserLimits log_M0 0.01
+# Store all events into the ROOT tree or just the interesting ones ? (true is default)
+/musr/command storeOnlyEventsWithHits false
+# Set the minimum time separation between two subsequent signals in the same detector (in ns)
+#/musr/command signalSeparationTime 0.1
+#
+/musr/run/howOftenToPrintEvent 1000
+/musr/run/randomOption 1
+
+################################################################################################################
+# -- Setting simulation PARAMETERS --
+################################################################################################################
+
+# Set the overall range cut (default 0.1 mm)
+#*/run/setCut 1 mm
+
+# Set the range cut on particular volumes (in mm)
+/musr/command SetUserLimits log_CFoil 1e-8 -1 -1 -1 -1
+#*/musr/command SetUserLimits log_target 0.01
+#*/musr/command SetUserLimits log_targetscint 0.01
+#*/musr/command SetUserLimits log_cryostatscint 0.01
+
+# Set particle energy cuts on particular volumes (in eV)
+#/musr/command SetUserLimits log_World ustepMax(mm) utrakMax(mm) utimeMax(ns) uekinMin(MeV) urangMin(mm)
+/musr/command SetUserLimits log_World -1 -1 -1 1e-7 -1
+
+# Store ALL the events in a ROOT tree or just the interesting ones? (default is true)
+#*/musr/command storeOnlyEventsWithHits false
+
+# Set the minimum time separation between two subsequent signals in the same detector (in ns)
+/musr/command signalSeparationTime 0.1
+
+# Override runID number
+#*/musr/run/runID 21
+
+# Set the frequency of event printing
+/musr/run/howOftenToPrintEvent 1000
+
+# RANDOM option choices: (specify the random number generator initialisation)
+# 0 ... no initialisation (default)
+# 1 ... use actual computer time to initialise now
+# 2 ... use event number to initialise at the beginning of each event
+# 3 ... read in the random no. initial values for each event from a file
+/musr/run/randomOption 2
+
+# VISUALIZATION options
+# To enable or disable visualization uncomment one of these lines
+# To modify visualization options edit the file vis.mac
+#*/vis/disable
+/control/execute vis.mac
+#*/control/execute visdawn.mac
+
+
+###################################################################################
+######################### R O O T O U T P U T ##############################
+###################################################################################
+#/musr/command rootOutput runID off
+#/musr/command rootOutput eventID off
+#/musr/command rootOutput weight off
+#/musr/command rootOutput BFieldAtDecay off
+#/musr/command rootOutput muIniPosX off
+#/musr/command rootOutput muIniPosY off
+#/musr/command rootOutput muIniPosZ off
+#/musr/command rootOutput muIniMomX off
+#/musr/command rootOutput muIniMomY off
+#/musr/command rootOutput muIniMomZ off
+#/musr/command rootOutput muIniPolX off
+#/musr/command rootOutput muIniPolY off
+#/musr/command rootOutput muIniPolZ off
+#/musr/command rootOutput muDecayDetID off
+#/musr/command rootOutput muDecayPosX off
+#/musr/command rootOutput muDecayPosY off
+#/musr/command rootOutput muDecayPosZ off
+#/musr/command rootOutput muDecayTime off
+#/musr/command rootOutput muDecayPolX off
+#/musr/command rootOutput muDecayPolY off
+#/musr/command rootOutput muDecayPolZ off
+#/musr/command rootOutput muTargetTime off
+#/musr/command rootOutput muTargetPolX off
+#/musr/command rootOutput muTargetPolY off
+#/musr/command rootOutput muTargetPolZ off
+#/musr/command rootOutput muM0Time off
+#/musr/command rootOutput muM0PolX off
+#/musr/command rootOutput muM0PolY off
+#/musr/command rootOutput muM0PolZ off
+/musr/command rootOutput muM1Time off
+/musr/command rootOutput muM1PolX off
+/musr/command rootOutput muM1PolY off
+/musr/command rootOutput muM1PolZ off
+/musr/command rootOutput muM2Time off
+/musr/command rootOutput muM2PolX off
+/musr/command rootOutput muM2PolY off
+/musr/command rootOutput muM2PolZ off
+#/musr/command rootOutput posIniMomX off
+#/musr/command rootOutput posIniMomY off
+#/musr/command rootOutput posIniMomZ off
+#/musr/command rootOutput fieldNomVal off
+#/musr/command rootOutput det_ID off
+#/musr/command rootOutput det_edep off
+#/musr/command rootOutput det_edep_el off
+#/musr/command rootOutput det_edep_pos off
+#/musr/command rootOutput det_edep_gam off
+#/musr/command rootOutput det_edep_mup off
+#/musr/command rootOutput det_nsteps off
+#/musr/command rootOutput det_length off
+#/musr/command rootOutput det_start off
+#/musr/command rootOutput det_end off
+#/musr/command rootOutput det_x off
+#/musr/command rootOutput det_y off
+#/musr/command rootOutput det_z off
+#/musr/command rootOutput det_kine off
+/musr/command rootOutput det_VrtxKine off
+/musr/command rootOutput det_VrtxX off
+/musr/command rootOutput det_VrtxY off
+/musr/command rootOutput det_VrtxZ off
+/musr/command rootOutput det_VrtxVolID off
+/musr/command rootOutput det_VrtxProcID off
+/musr/command rootOutput det_VrtxTrackID off
+/musr/command rootOutput det_VrtxParticleID off
+/musr/command rootOutput det_VvvKine off
+/musr/command rootOutput det_VvvX off
+/musr/command rootOutput det_VvvY off
+/musr/command rootOutput det_VvvZ off
+/musr/command rootOutput det_VvvVolID off
+/musr/command rootOutput det_VvvProcID off
+/musr/command rootOutput det_VvvTrackID off
+/musr/command rootOutput det_VvvParticleID off
+### Root variables that are not written out by default, but can be switched on:
+#/musr/command rootOutput fieldIntegralBx on
+#/musr/command rootOutput fieldIntegralBy on
+#/musr/command rootOutput fieldIntegralBz on
+#/musr/command rootOutput fieldIntegralBz1 on
+#/musr/command rootOutput fieldIntegralBz2 on
+#/musr/command rootOutput fieldIntegralBz3 on
+
+/musr/command storeOnlyEventsWithHits false
+
+
+
+################################################################################################################
+# -- Setting PARTICLE GUN parameters --
+################################################################################################################
+
+# Default momentum direction: 001, i.e. 0z.
+# Default muon spin direction: 100, i.e. 0x.
+# Default particle type: mu+ (can be changed to Mu)
+
+# Set particle type
+#*/gun/particle Mu
+/gun/particle mu+
+
+# Set beam vertex
+# CFoil at -1144 mm, acceleration starts at -1154.15 mm
+/gun/vertex 0. 0. -2119.5 mm
+
+# A point-like uniform beam
+#/gun/vertexsigma -0.1 -0.1 0 mm
+
+# Set beam transverse spread (default GAUSSIAN spread)
+# If FWHM = 10 mm ==> sigma = 10/2.354 = 4.2481 mm (last 0 is a dummy value)
+# Negative sigma values => random FLAT RECTANGULAR distribution (area 2x.2y)
+# Use vertexboundary with (vb < sigma_xy) to obtain a CIRCULAR beam spot
+# /gun/vertexsigma 0 0 0 mm ==> Very SLOW with mag. field ON and centered beam
+/gun/vertexsigma 6.83 6.83 0 mm
+#/gun/vertexsigma -20 -20 0 mm
+#/gun/vertexboundary 20 -1e6 1e6 mm
+
+# /gun/vertexboundary: rMaxAllowed, zMinAllowed, zMaxAllowed # Beam AND gating
+#*/gun/vertexboundary 7 -1314.4 -1305 mm
+# Without restrictions in z, but only on r:
+#*/gun/vertexboundary 3 -1e6 1e6 mm
+
+# Set beam momentum (USE only as an ALTERNATIVE to setting energy!)
+# /gun/momentum 0 0 29.79 MeV
+#*/gun/momentum 0 0 1.8 MeV
+# Energy loss at p = 1.2 MeV/c (E = 6.8 keV) => 1.23 +/- 0.2 keV
+# Energy loss at p = 1.8 MeV/c (E = 15.3 keV) => 1.25 +/- 0.3 keV
+# 1.2 MeV/c -> 6.8 keV, 1.8 MeV/c -> 15.3 keV
+# muon rest mass = 105.658 MeV/c2
+
+# Set muon energy before hitting TD; a constant field in front of the C-foil accelerates the muons
+# to add 3.73 keV
+/gun/kenergy 15.0 keV
+
+# Set beam momentum direction
+/gun/direction 0.0 0.0 1.0
+
+# Set muon spin direction
+/gun/muonPolarizVector 1 0 0
+
+
+# Other useful test parameters:
+#
+# FWHM = 3% ==> sigma = 29.79*0.03/2.354 = 0.37965 MeV/c
+#*/gun/momentumsmearing 0.37965 MeV
+#---/gun/momentumboundary: pMinAllowed, pMaxAllowed, dummy
+#*/gun/momentumboundary 20 40 0 MeV
+#---/gun/tilt: xangle, yangle, dummy
+#*/gun/tilt 0 0.0 0 deg
+#---/gun/tiltsigma: xangleSigma, yangleSigma, dummy (1 degree at 1 m => 17 mm)
+#*/gun/tiltsigma 0.2 0.2 0 deg
+#*/gun/pitch 0.0 deg
+#---/gun/decaytimelimits: decayMin, decayMax, decayTime
+#*/gun/decaytimelimits 10400 10420 2197.03 ns
+/gun/tiltsigma 1.4 1.4 0 deg
+
+# Selectively inactivate or activate sensitive detectors
+#*/hits/inactivate /musr/ScintSD
+
+# Only for code debugging!
+#/tracking/verbose 1
+
+# BEAM ON
+#/run/beamOn 1000000
+#/run/beamOn 1
+#/run/beamOn 10000
+
diff --git a/geant4/PQt_musrSim/QmuSRSim.pl b/geant4/PQt_musrSim/QmuSRSim.pl
index 6a16470..521a4cc 100644
--- a/geant4/PQt_musrSim/QmuSRSim.pl
+++ b/geant4/PQt_musrSim/QmuSRSim.pl
@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'QmuSRSim.ui'
#
-# Created: Fri Apr 1 13:15:48 2011
+# Created: Thu Apr 7 17:22:13 2011
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@@ -32,7 +32,7 @@ use Qt::slots
CreateAllInput => [],
StartCalc => [];
use Qt::attributes qw(
- tabWidget3
+ Tabs
tab
frame5
textLabel2_2_2_2_2_3
@@ -40,9 +40,6 @@ use Qt::attributes qw(
SR_B
textLabel2_2_2_2_3
textLabel2
- L1
- L3
- textLabel2_3_2_2
textLabel2_2_2
textLabel2_2_3
BFIELD
@@ -55,6 +52,12 @@ use Qt::attributes qw(
textLabel2_2_2_2
RA_R
TL
+ textLabel2_3_2_2
+ textLabel2_3_2_2_2
+ ENERGY
+ textLabel2_3_2_2_2_2
+ L1
+ L3
tab_2
frame5_2
textLabel2_3_2_3_2
@@ -70,9 +73,12 @@ use Qt::attributes qw(
textLabel2_2_2_2_2_2_3
textLabel2_2_2_2_4
RA_R_2
- L3_2
L1_2
+ textLabel2_3_2_2_2_3
+ ENERGY_2
+ textLabel2_3_2_2_2_2_2
L2_2
+ L3_2
Start
MenuBar
fileMenu
@@ -17854,10 +17860,10 @@ sub NEW
$LayoutWidget->setGeometry( Qt::Rect(0, 10, 830, 350) );
my $layout7 = Qt::VBoxLayout($LayoutWidget, 11, 6, '$layout7');
- tabWidget3 = Qt::TabWidget($LayoutWidget, "tabWidget3");
- tabWidget3->setBackgroundOrigin( &Qt::TabWidget::WidgetOrigin() );
+ Tabs = Qt::TabWidget($LayoutWidget, "Tabs");
+ Tabs->setBackgroundOrigin( &Qt::TabWidget::WidgetOrigin() );
- tab = Qt::Widget(tabWidget3, "tab");
+ tab = Qt::Widget(Tabs, "tab");
frame5 = Qt::Frame(tab, "frame5");
frame5->setGeometry( Qt::Rect(0, 0, 811, 271) );
@@ -17897,18 +17903,6 @@ sub NEW
textLabel2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
- L1 = Qt::LineEdit(frame5, "L1");
- L1->setGeometry( Qt::Rect(69, 100, 55, 24) );
-
- L3 = Qt::LineEdit(frame5, "L3");
- L3->setGeometry( Qt::Rect(350, 230, 55, 24) );
-
- textLabel2_3_2_2 = Qt::Label(frame5, "textLabel2_3_2_2");
- textLabel2_3_2_2->setGeometry( Qt::Rect(313, 230, 31, 24) );
- textLabel2_3_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
- textLabel2_3_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
- textLabel2_3_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
-
textLabel2_2_2 = Qt::Label(frame5, "textLabel2_2_2");
textLabel2_2_2->setGeometry( Qt::Rect(453, 230, 31, 24) );
textLabel2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
@@ -17970,9 +17964,41 @@ sub NEW
TL = Qt::LineEdit(frame5, "TL");
TL->setGeometry( Qt::Rect(490, 230, 55, 24) );
- tabWidget3->insertTab( tab, "" );
- tab_2 = Qt::Widget(tabWidget3, "tab_2");
+ textLabel2_3_2_2 = Qt::Label(frame5, "textLabel2_3_2_2");
+ textLabel2_3_2_2->setGeometry( Qt::Rect(313, 230, 31, 24) );
+ textLabel2_3_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
+ textLabel2_3_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
+ textLabel2_3_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
+
+ my $LayoutWidget_4 = Qt::Widget(frame5, '$LayoutWidget_4');
+ $LayoutWidget_4->setGeometry( Qt::Rect(210, 20, 180, 26) );
+ my $layout10 = Qt::HBoxLayout($LayoutWidget_4, 0, 0, '$layout10');
+
+ textLabel2_3_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_3_2_2_2");
+ textLabel2_3_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
+ textLabel2_3_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
+ textLabel2_3_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
+ $layout10->addWidget(textLabel2_3_2_2_2);
+
+ ENERGY = Qt::LineEdit($LayoutWidget_4, "ENERGY");
+ ENERGY->setBackgroundOrigin( &Qt::LineEdit::ParentOrigin() );
+ $layout10->addWidget(ENERGY);
+
+ textLabel2_3_2_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_3_2_2_2_2");
+ textLabel2_3_2_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
+ textLabel2_3_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
+ textLabel2_3_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
+ $layout10->addWidget(textLabel2_3_2_2_2_2);
+
+ L1 = Qt::LineEdit(frame5, "L1");
+ L1->setGeometry( Qt::Rect(69, 100, 55, 24) );
+
+ L3 = Qt::LineEdit(frame5, "L3");
+ L3->setGeometry( Qt::Rect(350, 230, 55, 24) );
+ Tabs->insertTab( tab, "" );
+
+ tab_2 = Qt::Widget(Tabs, "tab_2");
frame5_2 = Qt::Frame(tab_2, "frame5_2");
frame5_2->setGeometry( Qt::Rect(0, 0, 811, 271) );
@@ -18007,26 +18033,26 @@ sub NEW
BFIELD_2 = Qt::LineEdit(frame5_2, "BFIELD_2");
BFIELD_2->setGeometry( Qt::Rect(680, 230, 55, 24) );
- my $LayoutWidget_4 = Qt::Widget(frame5_2, '$LayoutWidget_4');
- $LayoutWidget_4->setGeometry( Qt::Rect(630, 30, 100, 98) );
- my $layout3_3 = Qt::GridLayout($LayoutWidget_4, 1, 1, 0, 0, '$layout3_3');
+ my $LayoutWidget_5 = Qt::Widget(frame5_2, '$LayoutWidget_5');
+ $LayoutWidget_5->setGeometry( Qt::Rect(630, 30, 100, 98) );
+ my $layout3_3 = Qt::GridLayout($LayoutWidget_5, 1, 1, 0, 0, '$layout3_3');
- textLabel2_2_2_2_2_4 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_2_4");
+ textLabel2_2_2_2_2_4 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_2_4");
textLabel2_2_2_2_2_4->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_2_4->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_2_4, 1, 0);
- RA_B_2 = Qt::LineEdit($LayoutWidget_4, "RA_B_2");
+ RA_B_2 = Qt::LineEdit($LayoutWidget_5, "RA_B_2");
$layout3_3->addWidget(RA_B_2, 1, 1);
- RA_T_2 = Qt::LineEdit($LayoutWidget_4, "RA_T_2");
+ RA_T_2 = Qt::LineEdit($LayoutWidget_5, "RA_T_2");
RA_T_2->setAcceptDrops( 0 );
$layout3_3->addWidget(RA_T_2, 0, 1);
- RA_L_2 = Qt::LineEdit($LayoutWidget_4, "RA_L_2");
+ RA_L_2 = Qt::LineEdit($LayoutWidget_5, "RA_L_2");
my $pal = Qt::Palette();
my $cg = Qt::ColorGroup();
$cg->setColor(&Qt::ColorGroup::Foreground, &black);
@@ -18084,38 +18110,58 @@ sub NEW
$layout3_3->addWidget(RA_L_2, 3, 1);
- textLabel2_2_2_2_2_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_2_2_2_2");
+ textLabel2_2_2_2_2_2_2_2 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_2_2_2_2");
textLabel2_2_2_2_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_2_2_2_2, 3, 0);
- textLabel2_2_2_2_2_2_3 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_2_2_3");
+ textLabel2_2_2_2_2_2_3 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_2_2_3");
textLabel2_2_2_2_2_2_3->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_2_2_3->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_2_2_3, 2, 0);
- textLabel2_2_2_2_4 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_4");
+ textLabel2_2_2_2_4 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_4");
textLabel2_2_2_2_4->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_4->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_4, 0, 0);
- RA_R_2 = Qt::LineEdit($LayoutWidget_4, "RA_R_2");
+ RA_R_2 = Qt::LineEdit($LayoutWidget_5, "RA_R_2");
$layout3_3->addWidget(RA_R_2, 2, 1);
- L3_2 = Qt::LineEdit(frame5_2, "L3_2");
- L3_2->setGeometry( Qt::Rect(460, 230, 55, 24) );
-
L1_2 = Qt::LineEdit(frame5_2, "L1_2");
L1_2->setGeometry( Qt::Rect(69, 100, 55, 24) );
+ my $LayoutWidget_6 = Qt::Widget(frame5_2, '$LayoutWidget_6');
+ $LayoutWidget_6->setGeometry( Qt::Rect(210, 20, 180, 26) );
+ my $layout10_2 = Qt::HBoxLayout($LayoutWidget_6, 0, 0, '$layout10_2');
+
+ textLabel2_3_2_2_2_3 = Qt::Label($LayoutWidget_6, "textLabel2_3_2_2_2_3");
+ textLabel2_3_2_2_2_3->setBackgroundMode( &Qt::Label::PaletteBackground() );
+ textLabel2_3_2_2_2_3->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
+ textLabel2_3_2_2_2_3->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
+ $layout10_2->addWidget(textLabel2_3_2_2_2_3);
+
+ ENERGY_2 = Qt::LineEdit($LayoutWidget_6, "ENERGY_2");
+ ENERGY_2->setBackgroundOrigin( &Qt::LineEdit::ParentOrigin() );
+ $layout10_2->addWidget(ENERGY_2);
+
+ textLabel2_3_2_2_2_2_2 = Qt::Label($LayoutWidget_6, "textLabel2_3_2_2_2_2_2");
+ textLabel2_3_2_2_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
+ textLabel2_3_2_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
+ textLabel2_3_2_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
+ $layout10_2->addWidget(textLabel2_3_2_2_2_2_2);
+
L2_2 = Qt::LineEdit(frame5_2, "L2_2");
L2_2->setGeometry( Qt::Rect(190, 230, 55, 24) );
- tabWidget3->insertTab( tab_2, "" );
- $layout7->addWidget(tabWidget3);
+
+ L3_2 = Qt::LineEdit(frame5_2, "L3_2");
+ L3_2->setGeometry( Qt::Rect(460, 230, 55, 24) );
+ Tabs->insertTab( tab_2, "" );
+ $layout7->addWidget(Tabs);
my $layout6 = Qt::HBoxLayout(undef, 0, 6, '$layout6');
@@ -18210,7 +18256,7 @@ sub NEW
Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()");
Qt::Object::connect(Start, SIGNAL "clicked()", this, SLOT "StartCalc()");
- setTabOrder(tabWidget3, L1);
+ setTabOrder(Tabs, L1);
setTabOrder(L1, SR_B);
setTabOrder(SR_B, SR_E);
setTabOrder(SR_E, L3);
@@ -18241,14 +18287,17 @@ sub languageChange
textLabel2_2_2_2_2_3->setText( trUtf8("SR_E") );
textLabel2_2_2_2_3->setText( trUtf8("SR_B") );
textLabel2->setText( trUtf8("L1") );
- textLabel2_3_2_2->setText( trUtf8("L3") );
textLabel2_2_2->setText( trUtf8("TL") );
textLabel2_2_3->setText( trUtf8("B Field") );
textLabel2_2_2_2_2->setText( trUtf8("RA_B") );
textLabel2_2_2_2_2_2_2->setText( trUtf8("RA_L") );
textLabel2_2_2_2_2_2->setText( trUtf8("RA_R") );
textLabel2_2_2_2->setText( trUtf8("RA_T") );
- tabWidget3->changeTab( tab, trUtf8("Spin Rotator") );
+ textLabel2_3_2_2->setText( trUtf8("L3") );
+ textLabel2_3_2_2_2->setText( trUtf8("Energy") );
+ textLabel2_3_2_2_2_2->setText( trUtf8("keV") );
+ L3->setText( undef );
+ Tabs->changeTab( tab, trUtf8("Spin Rotator") );
textLabel2_3_2_3_2->setText( trUtf8("L1") );
textLabel2_3_2_3->setText( trUtf8("L2") );
textLabel2_3_2->setText( trUtf8("L3") );
@@ -18257,7 +18306,9 @@ sub languageChange
textLabel2_2_2_2_2_2_2_2->setText( trUtf8("RA_L") );
textLabel2_2_2_2_2_2_3->setText( trUtf8("RA_R") );
textLabel2_2_2_2_4->setText( trUtf8("RA_T") );
- tabWidget3->changeTab( tab_2, trUtf8("Current") );
+ textLabel2_3_2_2_2_3->setText( trUtf8("Energy") );
+ textLabel2_3_2_2_2_2_2->setText( trUtf8("keV") );
+ Tabs->changeTab( tab_2, trUtf8("Current") );
Start->setText( trUtf8("Start") );
fileNewAction->setText( trUtf8("New") );
fileNewAction->setMenuText( trUtf8("&New") );
@@ -18412,13 +18463,16 @@ sub CreateAllInput
{
my %All=();
- my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E",
- "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2");
+ my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E","ENERGY",
+ "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2","ENERGY_2");
foreach my $Param (@AllParams) {
my $Child = child($Param);
my $Value = $Child->text;
$All{$Param}=$Value;
+# print "$Param=".$All{$Param}."\n";
}
+# Return Hash with all important values
+ return %All;
}
@@ -18426,6 +18480,57 @@ sub StartCalc
{
my %All=CreateAllInput();
+ my $Page = Tabs->currentPageIndex;
+ my %ToReplace=();
+ my @SpaceHolder=();
+ my $FName="SRBeamLine.mac";
+# 0 for spin rotator and 1 for current.
+ if ($Page == 0) {
+ %ToReplace= (
+ "L1"=>"L1VOLTAGE",
+ "L3"=>"L3VOLTAGE",
+ "TL"=>"TLVOLTAGE",
+ "BFIELD"=>"SAM_BFIELD",
+ "RA_T"=>"RA_TVOL",
+ "RA_B"=>"RA_BVOL",
+ "RA_R"=>"RA_RVOL",
+ "RA_L"=>"RA_LVOL",
+ "SR_B"=>"SR_BFIELD",
+ "SR_E"=>"SR_EFIELD",
+ "ENERGY"=>"ENERGY"
+ );
+# Use the following template
+ $FName="SRBeamLine.mac";
+ } elsif ($Page == 1) {
+ %ToReplace= (
+ "L1_2"=>"L1VOLTAGE",
+ "L2_2"=>"L2VOLTAGE",
+ "L3_2"=>"L3VOLTAGE",
+ "BFIELD_2"=>"SAM_BFIELD",
+ "RA_T_2"=>"RA_TVOL",
+ "RA_B_2"=>"RA_BVOL",
+ "RA_R_2"=>"RA_RVOL",
+ "RA_L_2"=>"RA_LVOL",
+ "ENERGY_2"=>"ENERGY"
+ );
+# Use the following template
+ $FName="CBeamLine.mac";
+ }
+
+ open(MACF,"$FName");
+ my @lines=;
+ close(MACF);
+
+ for my $key (keys %ToReplace) {
+# Need to check values of replace parameters...
+ map(s/$ToReplace{$key}/$All{$key}/, @lines);
+ print "Replacing \t".$ToReplace{$key}."\t by \t".$All{$key}."\n";
+ }
+
+ open(NEWMACF,">1000.mac");
+ print (NEWMACF "@lines");
+ close(NEWMACF);
+
}
diff --git a/geant4/PQt_musrSim/QmuSRSim.ui b/geant4/PQt_musrSim/QmuSRSim.ui
index 64f6671..4e32893 100644
--- a/geant4/PQt_musrSim/QmuSRSim.ui
+++ b/geant4/PQt_musrSim/QmuSRSim.ui
@@ -33,7 +33,7 @@
- tabWidget3
+ Tabs
WidgetOrigin
@@ -183,65 +183,6 @@
<b><font size="+1">L1</font></b>
-
-
- L1
-
-
-
- 69
- 100
- 55
- 24
-
-
-
-
-
- L3
-
-
-
- 350
- 230
- 55
- 24
-
-
-
-
-
- textLabel2_3_2_2
-
-
-
- 313
- 230
- 31
- 24
-
-
-
- PaletteBackground
-
-
-
- 0
- 0
- 0
-
-
-
-
- 255
- 255
- 255
-
-
-
- <b><font size="+1">L3</font></b>
-
-
textLabel2_2_2
@@ -474,6 +415,150 @@
+
+
+ textLabel2_3_2_2
+
+
+
+ 313
+ 230
+ 31
+ 24
+
+
+
+ PaletteBackground
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+ <b><font size="+1">L3</font></b>
+
+
+
+
+ layout10
+
+
+
+ 210
+ 20
+ 180
+ 26
+
+
+
+
+ unnamed
+
+
+ 0
+
+
+ 0
+
+
+
+ textLabel2_3_2_2_2
+
+
+ PaletteBackground
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+ <b><font size="+1">Energy</font></b>
+
+
+
+
+ ENERGY
+
+
+ ParentOrigin
+
+
+
+
+ textLabel2_3_2_2_2_2
+
+
+ PaletteBackground
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+ <b><font size="+1">keV</font></b>
+
+
+
+
+
+
+ L1
+
+
+
+ 69
+ 100
+ 55
+ 24
+
+
+
+
+
+ L3
+
+
+
+ 350
+ 230
+ 55
+ 24
+
+
+
+
+
+
@@ -1045,19 +1130,6 @@
-
-
- L3_2
-
-
-
- 460
- 230
- 55
- 24
-
-
-
L1_2
@@ -1071,6 +1143,88 @@
+
+
+ layout10_2
+
+
+
+ 210
+ 20
+ 180
+ 26
+
+
+
+
+ unnamed
+
+
+ 0
+
+
+ 0
+
+
+
+ textLabel2_3_2_2_2_3
+
+
+ PaletteBackground
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+ <b><font size="+1">Energy</font></b>
+
+
+
+
+ ENERGY_2
+
+
+ ParentOrigin
+
+
+
+
+ textLabel2_3_2_2_2_2_2
+
+
+ PaletteBackground
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+ <b><font size="+1">keV</font></b>
+
+
+
+
L2_2
@@ -1084,6 +1238,19 @@
+
+
+ L3_2
+
+
+
+ 460
+ 230
+ 55
+ 24
+
+
+
@@ -1543,7 +1710,7 @@
- tabWidget3
+ Tabs
L1
SR_B
SR_E
diff --git a/geant4/PQt_musrSim/QmuSRSim.ui.h b/geant4/PQt_musrSim/QmuSRSim.ui.h
index 11990c4..d452e40 100644
--- a/geant4/PQt_musrSim/QmuSRSim.ui.h
+++ b/geant4/PQt_musrSim/QmuSRSim.ui.h
@@ -124,13 +124,16 @@ void QmuSRSim::helpAbout()
void QmuSRSim::CreateAllInput()
{
my %All=();
- my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E",
- "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2");
+ my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E","ENERGY",
+ "L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2","ENERGY_2");
foreach my $Param (@AllParams) {
my $Child = child($Param);
my $Value = $Child->text;
$All{$Param}=$Value;
+# print "$Param=".$All{$Param}."\n";
}
+# Return Hash with all important values
+ return %All;
}
@@ -138,5 +141,56 @@ void QmuSRSim::CreateAllInput()
void QmuSRSim::StartCalc()
{
my %All=CreateAllInput();
+ my $Page = Tabs->currentPageIndex;
+ my %ToReplace=();
+ my @SpaceHolder=();
+ my $FName="SRBeamLine.mac";
+# 0 for spin rotator and 1 for current.
+ if ($Page == 0) {
+ %ToReplace= (
+ "L1"=>"L1VOLTAGE",
+ "L3"=>"L3VOLTAGE",
+ "TL"=>"TLVOLTAGE",
+ "BFIELD"=>"SAM_BFIELD",
+ "RA_T"=>"RA_TVOL",
+ "RA_B"=>"RA_BVOL",
+ "RA_R"=>"RA_RVOL",
+ "RA_L"=>"RA_LVOL",
+ "SR_B"=>"SR_BFIELD",
+ "SR_E"=>"SR_EFIELD",
+ "ENERGY"=>"ENERGY"
+ );
+# Use the following template
+ $FName="SRBeamLine.mac";
+ } elsif ($Page == 1) {
+ %ToReplace= (
+ "L1_2"=>"L1VOLTAGE",
+ "L2_2"=>"L2VOLTAGE",
+ "L3_2"=>"L3VOLTAGE",
+ "BFIELD_2"=>"SAM_BFIELD",
+ "RA_T_2"=>"RA_TVOL",
+ "RA_B_2"=>"RA_BVOL",
+ "RA_R_2"=>"RA_RVOL",
+ "RA_L_2"=>"RA_LVOL",
+ "ENERGY_2"=>"ENERGY"
+ );
+# Use the following template
+ $FName="CBeamLine.mac";
+ }
+
+ open(MACF,"$FName");
+ my @lines=;
+ close(MACF);
+
+ for my $key (keys %ToReplace) {
+# Need to check values of replace parameters...
+ map(s/$ToReplace{$key}/$All{$key}/, @lines);
+ print "Replacing \t".$ToReplace{$key}."\t by \t".$All{$key}."\n";
+ }
+
+ open(NEWMACF,">1000.mac");
+ print (NEWMACF "@lines");
+ close(NEWMACF);
+
}
diff --git a/geant4/PQt_musrSim/SRBeamLine.mac b/geant4/PQt_musrSim/SRBeamLine.mac
new file mode 100644
index 0000000..158e0be
--- /dev/null
+++ b/geant4/PQt_musrSim/SRBeamLine.mac
@@ -0,0 +1,776 @@
+# Template suitable for beam profile detectioon with the spin rotator in place
+# Zaher Salman 7/10/2010
+
+# This is a template mac file for tuning the lem beamline with a spin rotator
+# You can use this to generate a beam envelope profile along z
+
+################################################################################################################
+# -- ROTATION MATRICES --
+################################################################################################################
+# Define rotations for the field maps of Trigger and Ring Anode:
+/musr/command rotation rotTrig 0 1 0 -45
+/musr/command rotation rotRAnR 0 0 1 -90
+/musr/command rotation rotRAnL 0 0 1 90
+/musr/command rotation rotRAnD 0 0 1 180
+
+# More Rotations
+/musr/command rotation rotD1 0 0 1 11.250
+/musr/command rotation rotD2 0 0 1 33.750
+/musr/command rotation rotD3 0 0 1 56.250
+/musr/command rotation rotD4 0 0 1 78.750
+/musr/command rotation rotD5 0 0 1 101.250
+/musr/command rotation rotD6 0 0 1 123.750
+/musr/command rotation rotD7 0 0 1 146.250
+/musr/command rotation rotD8 0 0 1 168.750
+/musr/command rotation rotD9 0 0 1 191.250
+/musr/command rotation rotD10 0 0 1 213.750
+/musr/command rotation rotD11 0 0 1 236.250
+/musr/command rotation rotD12 0 0 1 258.750
+/musr/command rotation rotD13 0 0 1 281.250
+/musr/command rotation rotD14 0 0 1 303.750
+/musr/command rotation rotD15 0 0 1 326.250
+/musr/command rotation rotD16 0 0 1 348.750
+
+/musr/command rotation rotD17 0 0 1 11.250
+/musr/command rotation rotD18 0 0 1 33.750
+/musr/command rotation rotD19 0 0 1 56.250
+/musr/command rotation rotD20 0 0 1 78.750
+/musr/command rotation rotD21 0 0 1 101.250
+/musr/command rotation rotD22 0 0 1 123.750
+/musr/command rotation rotD23 0 0 1 146.250
+/musr/command rotation rotD24 0 0 1 168.750
+/musr/command rotation rotD25 0 0 1 191.250
+/musr/command rotation rotD26 0 0 1 213.750
+/musr/command rotation rotD27 0 0 1 236.250
+/musr/command rotation rotD28 0 0 1 258.750
+/musr/command rotation rotD29 0 0 1 281.250
+/musr/command rotation rotD30 0 0 1 303.750
+/musr/command rotation rotD31 0 0 1 326.250
+/musr/command rotation rotD32 0 0 1 348.750
+
+################################################################################################################
+# -- LEM GEOMETRY --
+################################################################################################################
+
+# WORLD = Laboratory reference frame, the origin is in the centre of the LEM sample tube
+/musr/command construct box World 350 350 2600 G4_Galactic 0 0 0 no_logical_volume norot dead -1
+/musr/command visattributes log_World invisible
+
+# These are slices to map the beam envelope along the beam line. The radius should be less than 50mm
+/musr/command construct tubs save0 0 39 0.05 0 360 G4_Galactic 0 0 -2500 log_World norot dead 851
+/musr/command construct tubs save1 0 39 0.05 0 360 G4_Galactic 0 0 -2450 log_World norot dead 852
+/musr/command construct tubs save2 0 39 0.05 0 360 G4_Galactic 0 0 -2400 log_World norot dead 853
+/musr/command construct tubs save3 0 39 0.05 0 360 G4_Galactic 0 0 -2350 log_World norot dead 854
+/musr/command construct tubs save4 0 39 0.05 0 360 G4_Galactic 0 0 -2300 log_World norot dead 855
+/musr/command construct tubs save5 0 39 0.05 0 360 G4_Galactic 0 0 -2250 log_World norot dead 856
+/musr/command construct tubs save6 0 39 0.05 0 360 G4_Galactic 0 0 -2200 log_World norot dead 857
+/musr/command construct tubs save7 0 39 0.05 0 360 G4_Galactic 0 0 -2150 log_World norot dead 858
+/musr/command construct tubs save8 0 39 0.05 0 360 G4_Galactic 0 0 -2100 log_World norot dead 859
+/musr/command construct tubs save9 0 39 0.05 0 360 G4_Galactic 0 0 -2050 log_World norot dead 860
+/musr/command construct tubs save10 0 39 0.05 0 360 G4_Galactic 0 0 -2000 log_World norot dead 861
+/musr/command construct tubs save11 0 39 0.05 0 360 G4_Galactic 0 0 -1950 log_World norot dead 862
+/musr/command construct tubs save12 0 39 0.05 0 360 G4_Galactic 0 0 -1900 log_World norot dead 863
+/musr/command construct tubs save13 0 39 0.05 0 360 G4_Galactic 0 0 -1850 log_World norot dead 864
+/musr/command construct tubs save14 0 39 0.05 0 360 G4_Galactic 0 0 -1800 log_World norot dead 865
+/musr/command construct tubs save15 0 39 0.05 0 360 G4_Galactic 0 0 -1750 log_World norot dead 866
+/musr/command construct tubs save16 0 39 0.05 0 360 G4_Galactic 0 0 -1700 log_World norot dead 867
+/musr/command construct tubs save17 0 39 0.05 0 360 G4_Galactic 0 0 -1650 log_World norot dead 868
+/musr/command construct tubs save18 0 39 0.05 0 360 G4_Galactic 0 0 -1600 log_World norot dead 869
+/musr/command construct tubs save19 0 39 0.05 0 360 G4_Galactic 0 0 -1550 log_World norot dead 870
+/musr/command construct tubs save20 0 39 0.05 0 360 G4_Galactic 0 0 -1500 log_World norot dead 871
+/musr/command construct tubs save21 0 39 0.05 0 360 G4_Galactic 0 0 -1450 log_World norot dead 872
+/musr/command construct tubs save22 0 39 0.05 0 360 G4_Galactic 0 0 -1400 log_World norot dead 873
+/musr/command construct tubs save23 0 39 0.05 0 360 G4_Galactic 0 0 -1350 log_World norot dead 874
+/musr/command construct tubs save24 0 39 0.05 0 360 G4_Galactic 0 0 -1300 log_World norot dead 875
+/musr/command construct tubs save25 0 39 0.05 0 360 G4_Galactic 0 0 -1250 log_World norot dead 876
+/musr/command construct tubs save26 0 39 0.05 0 360 G4_Galactic 0 0 -1200 log_World norot dead 877
+/musr/command construct tubs save27 0 39 0.05 0 360 G4_Galactic 0 0 -1150 log_World norot dead 878
+/musr/command construct tubs save28 0 39 0.05 0 360 G4_Galactic 0 0 -1100 log_World norot dead 879
+/musr/command construct tubs save29 0 39 0.05 0 360 G4_Galactic 0 0 -1050 log_World norot dead 880
+/musr/command construct tubs save30 0 39 0.05 0 360 G4_Galactic 0 0 -1000 log_World norot dead 881
+/musr/command construct tubs save31 0 39 0.05 0 360 G4_Galactic 0 0 -950 log_World norot dead 882
+/musr/command construct tubs save32 0 39 0.05 0 360 G4_Galactic 0 0 -900 log_World norot dead 883
+/musr/command construct tubs save33 0 39 0.05 0 360 G4_Galactic 0 0 -850 log_World norot dead 884
+/musr/command construct tubs save34 0 39 0.05 0 360 G4_Galactic 0 0 -800 log_World norot dead 885
+/musr/command construct tubs save35 0 39 0.05 0 360 G4_Galactic 0 0 -750 log_World norot dead 886
+/musr/command construct tubs save36 0 39 0.05 0 360 G4_Galactic 0 0 -700 log_World norot dead 887
+/musr/command construct tubs save37 0 39 0.05 0 360 G4_Galactic 0 0 -650 log_World norot dead 888
+/musr/command construct tubs save38 0 39 0.05 0 360 G4_Galactic 0 0 -600 log_World norot dead 889
+/musr/command construct tubs save39 0 39 0.05 0 360 G4_Galactic 0 0 -550 log_World norot dead 890
+/musr/command construct tubs save40 0 39 0.05 0 360 G4_Galactic 0 0 -500 log_World norot dead 891
+/musr/command construct tubs save41 0 39 0.05 0 360 G4_Galactic 0 0 -450 log_World norot dead 892
+/musr/command construct tubs save42 0 39 0.05 0 360 G4_Galactic 0 0 -400 log_World norot dead 893
+/musr/command construct tubs save43 0 39 0.05 0 360 G4_Galactic 0 0 -350 log_World norot dead 894
+/musr/command construct tubs save44 0 39 0.05 0 360 G4_Galactic 0 0 -300 log_World norot dead 895
+/musr/command construct tubs save45 0 39 0.05 0 360 G4_Galactic 0 0 -250 log_World norot dead 896
+/musr/command construct tubs save46 0 39 0.05 0 360 G4_Galactic 0 0 -200 log_World norot dead 897
+/musr/command construct tubs save47 0 39 0.05 0 360 G4_Galactic 0 0 -150 log_World norot dead 898
+/musr/command construct tubs save48 0 39 0.05 0 360 G4_Galactic 0 0 -100 log_World norot dead 899
+/musr/command construct tubs save49 0 39 0.05 0 360 G4_Galactic 0 0 -50 log_World norot dead 900
+/musr/command construct tubs save50 0 39 0.05 0 360 G4_Galactic 0 0 0 log_World norot dead 901
+/musr/command construct tubs save51 0 39 0.05 0 360 G4_Galactic 0 0 50 log_World norot dead 902
+/musr/command construct tubs save52 0 39 0.05 0 360 G4_Galactic 0 0 100 log_World norot dead 903
+/musr/command construct tubs save53 0 39 0.05 0 360 G4_Galactic 0 0 150 log_World norot dead 904
+
+
+################################################################################################################
+# -- APD Scintillators --
+################################################################################################################
+
+# Detectors volume (0,0,0) coninsides with World (0,0,0)
+/musr/command construct tubs DetV 80 105 133 0 360 G4_Galactic 0 0 0 log_World norot dead 100
+/musr/command visattributes log_DetV invisible
+
+# For final design set
+# BackHW=60
+# BackCR=-60
+# ForwHW=65.5
+# ForwCR=66.5
+
+# Back inner sections (Upstream) (v.i.)
+# Current design (30 June 09) BackHW=60.0mm (Half width or length), BackCR=-120+BackHW=-60.0mm (Center z coordinate)
+/musr/command construct trd90y ScD1 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 86.799497 -17.265493 -60 log_DetV rotD1 musr/ScintSD 1
+/musr/command construct trd90y ScD2 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 73.585061 -49.167966 -60 log_DetV rotD2 musr/ScintSD 2
+/musr/command construct trd90y ScD3 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 49.167966 -73.585061 -60 log_DetV rotD3 musr/ScintSD 3
+/musr/command construct trd90y ScD4 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.265493 -86.799497 -60 log_DetV rotD4 musr/ScintSD 4
+/musr/command construct trd90y ScD5 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.265493 -86.799497 -60 log_DetV rotD5 musr/ScintSD 5
+/musr/command construct trd90y ScD6 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -49.167966 -73.585061 -60 log_DetV rotD6 musr/ScintSD 6
+/musr/command construct trd90y ScD7 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -73.585061 -49.167966 -60 log_DetV rotD7 musr/ScintSD 7
+/musr/command construct trd90y ScD8 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -86.799497 -17.265493 -60 log_DetV rotD8 musr/ScintSD 8
+/musr/command construct trd90y ScD9 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -86.799497 17.265493 -60 log_DetV rotD9 musr/ScintSD 9
+/musr/command construct trd90y ScD10 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -73.585061 49.167966 -60 log_DetV rotD10 musr/ScintSD 10
+/musr/command construct trd90y ScD11 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -49.167966 73.585061 -60 log_DetV rotD11 musr/ScintSD 11
+/musr/command construct trd90y ScD12 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.265493 86.799497 -60 log_DetV rotD12 musr/ScintSD 12
+/musr/command construct trd90y ScD13 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.265493 86.799497 -60 log_DetV rotD13 musr/ScintSD 13
+/musr/command construct trd90y ScD14 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 49.167966 73.585061 -60 log_DetV rotD14 musr/ScintSD 14
+/musr/command construct trd90y ScD15 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 73.585061 49.167966 -60 log_DetV rotD15 musr/ScintSD 15
+/musr/command construct trd90y ScD16 60 60 17.7 16.7 2.5 G4_PLASTIC_SC_VINYLTOLUENE 86.799497 17.265493 -60 log_DetV rotD16 musr/ScintSD 16
+
+# Forward inner sections (Downstream) (h.i.)
+# Current design (30 June 09) ForwHW=65.5mm (Half width or length), ForwCR=132-ForwHW=66.5mm (Center z coordinate)
+/musr/command construct trd90y ScD17 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 85.818712 -17.070403 66.5 log_DetV rotD17 musr/ScintSD 17
+/musr/command construct trd90y ScD18 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 72.753591 -48.612395 66.5 log_DetV rotD18 musr/ScintSD 18
+/musr/command construct trd90y ScD19 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 48.612395 -72.753591 66.5 log_DetV rotD19 musr/ScintSD 19
+/musr/command construct trd90y ScD20 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.070403 -85.818712 66.5 log_DetV rotD20 musr/ScintSD 20
+/musr/command construct trd90y ScD21 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.070403 -85.818712 66.5 log_DetV rotD21 musr/ScintSD 21
+/musr/command construct trd90y ScD22 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -48.612395 -72.753591 66.5 log_DetV rotD22 musr/ScintSD 22
+/musr/command construct trd90y ScD23 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -72.753591 -48.612395 66.5 log_DetV rotD23 musr/ScintSD 23
+/musr/command construct trd90y ScD24 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -85.818712 -17.070403 66.5 log_DetV rotD24 musr/ScintSD 24
+/musr/command construct trd90y ScD25 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -85.818712 17.070403 66.5 log_DetV rotD25 musr/ScintSD 25
+/musr/command construct trd90y ScD26 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -72.753591 48.612395 66.5 log_DetV rotD26 musr/ScintSD 26
+/musr/command construct trd90y ScD27 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -48.612395 72.753591 66.5 log_DetV rotD27 musr/ScintSD 27
+/musr/command construct trd90y ScD28 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE -17.070403 85.818712 66.5 log_DetV rotD28 musr/ScintSD 28
+/musr/command construct trd90y ScD29 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 17.070403 85.818712 66.5 log_DetV rotD29 musr/ScintSD 29
+/musr/command construct trd90y ScD30 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 48.612395 72.753591 66.5 log_DetV rotD30 musr/ScintSD 30
+/musr/command construct trd90y ScD31 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 72.753591 48.612395 66.5 log_DetV rotD31 musr/ScintSD 31
+/musr/command construct trd90y ScD32 65.5 65.5 17.5 16.5 2.5 G4_PLASTIC_SC_VINYLTOLUENE 85.818712 17.070403 66.5 log_DetV rotD32 musr/ScintSD 32
+
+# Back outer sections (v.a.)
+/musr/command construct trd ScD33 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 93.664994 -18.631126 -60 log_DetV rotD1 musr/ScintSD 33
+/musr/command construct trd ScD34 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 79.405348 -53.056957 -60 log_DetV rotD2 musr/ScintSD 34
+/musr/command construct trd ScD35 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 53.056957 -79.405348 -60 log_DetV rotD3 musr/ScintSD 35
+/musr/command construct trd ScD36 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.631126 -93.664994 -60 log_DetV rotD4 musr/ScintSD 36
+/musr/command construct trd ScD37 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.631126 -93.664994 -60 log_DetV rotD5 musr/ScintSD 37
+/musr/command construct trd ScD38 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -53.056957 -79.405348 -60 log_DetV rotD6 musr/ScintSD 38
+/musr/command construct trd ScD39 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -79.405348 -53.056957 -60 log_DetV rotD7 musr/ScintSD 39
+/musr/command construct trd ScD40 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -93.664994 -18.631126 -60 log_DetV rotD8 musr/ScintSD 40
+/musr/command construct trd ScD41 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -93.664994 18.631126 -60 log_DetV rotD9 musr/ScintSD 41
+/musr/command construct trd ScD42 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -79.405348 53.056957 -60 log_DetV rotD10 musr/ScintSD 42
+/musr/command construct trd ScD43 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -53.056957 79.405348 -60 log_DetV rotD11 musr/ScintSD 43
+/musr/command construct trd ScD44 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.631126 93.664994 -60 log_DetV rotD12 musr/ScintSD 44
+/musr/command construct trd ScD45 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.631126 93.664994 -60 log_DetV rotD13 musr/ScintSD 45
+/musr/command construct trd ScD46 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 53.056957 79.405348 -60 log_DetV rotD14 musr/ScintSD 46
+/musr/command construct trd ScD47 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 79.405348 53.056957 -60 log_DetV rotD15 musr/ScintSD 47
+/musr/command construct trd ScD48 60 60 19.1 18.1 2.5 G4_PLASTIC_SC_VINYLTOLUENE 93.664994 18.631126 -60 log_DetV rotD16 musr/ScintSD 48
+
+# Forward outer sections (h.a.)
+/musr/command construct trd ScD49 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 92.684209 -18.436035 66.5 log_DetV rotD1 musr/ScintSD 49
+/musr/command construct trd ScD50 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 78.573878 -52.501387 66.5 log_DetV rotD2 musr/ScintSD 50
+/musr/command construct trd ScD51 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 52.501387 -78.573878 66.5 log_DetV rotD3 musr/ScintSD 51
+/musr/command construct trd ScD52 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.436035 -92.684209 66.5 log_DetV rotD4 musr/ScintSD 52
+/musr/command construct trd ScD53 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.436035 -92.684209 66.5 log_DetV rotD5 musr/ScintSD 53
+/musr/command construct trd ScD54 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -52.501387 -78.573878 66.5 log_DetV rotD6 musr/ScintSD 54
+/musr/command construct trd ScD55 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -78.573878 -52.501387 66.5 log_DetV rotD7 musr/ScintSD 55
+/musr/command construct trd ScD56 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -92.684209 -18.436035 66.5 log_DetV rotD8 musr/ScintSD 56
+/musr/command construct trd ScD57 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -92.684209 18.436035 66.5 log_DetV rotD9 musr/ScintSD 57
+/musr/command construct trd ScD58 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -78.573878 52.501387 66.5 log_DetV rotD10 musr/ScintSD 58
+/musr/command construct trd ScD59 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -52.501387 78.573878 66.5 log_DetV rotD11 musr/ScintSD 59
+/musr/command construct trd ScD60 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE -18.436035 92.684209 66.5 log_DetV rotD12 musr/ScintSD 60
+/musr/command construct trd ScD61 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 18.436035 92.684209 66.5 log_DetV rotD13 musr/ScintSD 61
+/musr/command construct trd ScD62 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 52.501387 78.573878 66.5 log_DetV rotD14 musr/ScintSD 62
+/musr/command construct trd ScD63 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 78.573878 52.501387 66.5 log_DetV rotD15 musr/ScintSD 63
+/musr/command construct trd ScD64 65.5 65.5 18.9 17.9 2.5 G4_PLASTIC_SC_VINYLTOLUENE 92.684209 18.436035 66.5 log_DetV rotD16 musr/ScintSD 64
+
+# Structural support inside the detectors vessel
+# Al tube, inner radius 80, thickness 2 mm.
+# Additional Al plate, 2 mm thick for h.i and h.a and 3 mm thick for v.i. and v.a
+/musr/command construct tubs hInShell 80.0 84.0 65.5 0 360 G4_Al 0 0 66.5 log_DetV norot dead 70
+/musr/command construct tubs vInShell 80.0 85.0 60.0 0 360 G4_Al 0 0 -60.0 log_DetV norot dead 70
+
+# Visual attributes (optional)
+/musr/command visattributes G4_PLASTIC_SC_VINYLTOLUENE green
+#/musr/command visattributes log_ScD49 green
+#/musr/command visattributes log_ScD50 green
+#/musr/command visattributes log_test red
+
+################################################################################################################
+# Sample vacuum/tube up to gate valve - Can host either the Cryostat or the MCP2
+################################################################################################################
+
+# Vacuum space
+# /musr/command construct tubs SamV 0 75.0 254.5 0 360 G4_Galactic 0 0 -92.5 log_World norot dead 100
+# Sample tube
+/musr/command construct tubs SamS 75.0 78.0 162.0 0 360 Steel 0 0 0 log_World norot dead 101
+
+# F160 - 160 CF flange upstream of MCP2 tube
+/musr/command construct tubs F160 78.0 101.25 11 0 360 Steel 0 0 -151.0 log_World norot dead 102
+# F100 (Blank end flange)
+#/musr/command construct tubs F100 0 75.0 10 0 360 Steel 0 0 172.0 log_World norot dead 103
+
+# 200 CF flange upstream of MCP2 tube covering the whole length of the gate valve chamber.
+/musr/command construct tubs GATS 103.25 126.5 92.5 0 360 Steel 0 0 -254.5 log_World norot dead 371
+
+# F200 - 200 CF flange upstream of MCP2 tube to connect to gate valve chamber
+/musr/command construct tubs F200 76.5 103.25 12 0 360 Steel 0 0 -174.0 log_World norot dead 372
+
+# Visual attributes (optional)
+#/musr/command visattributes log_SamV invisible
+/musr/command visattributes log_SamS oxsteel
+/musr/command visattributes log_F160 oxsteel
+#/musr/command visattributes log_F100 oxsteel
+/musr/command visattributes log_GATS oxsteel
+/musr/command visattributes log_F200 oxsteel
+
+
+################################################################################################################
+# RA - Ring Anode, M - middle part (closer to Ground Anode), E - end part (farther from the Ground Anode)
+# U - up, D - down, L - left, R - right (with respect to muon's view - momentum direction)
+# Note: 3.0 mm HALF gap at 45.1469 mm half radius => delta_ang = asin(3.0/45.1469)*180/pi = 3.81 deg.
+# Note: delta_ang = 3.1744 deg. for 2.5 mm HG. The angular extension goes e.g. from (45 + da) to (90 - 2*da).
+# Note: Ring Anode - Ground Anode distance was 15 mm => CHANGED to 12 mm! (Positions: 11.5 -> 8.5, -33.5 -> -36.5)
+################################################################################################################
+
+# RA_Ez = -10.35+2.25 = -8.1 cm; RA_Mz= -10.35 - 2.25 = -12.6 cm; RA_Gz= -25.45+3.75 = -21.7 cm; mcpv_z = -9.25 cm
+/musr/command construct cons RA_EU 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World norot dead 301
+/musr/command construct cons RA_MU 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World norot dead 302
+/musr/command construct cons RA_ER 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World rotRAnR dead 303
+/musr/command construct cons RA_MR 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World rotRAnR dead 304
+/musr/command construct cons RA_ED 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World rotRAnD dead 305
+/musr/command construct cons RA_MD 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World rotRAnD dead 306
+/musr/command construct cons RA_EL 45.1469 62.5 33.5 39.0 22.5 48.81 82.38 Steel 0 0 -84.0 log_World rotRAnL dead 307
+/musr/command construct cons RA_ML 56.7937 62.5 45.147 62.5 22.5 48.81 82.38 Steel 0 0 -129. log_World rotRAnL dead 308
+
+# Dummy, thin cylindres used for applying the SAME RA field-map (ROTATED by 90 deg.) to different anodes.
+# NOTE: EM field cannot be applied to non simply connected bodies, as e.g. rings, cons, tori, etc.!
+/musr/command construct tubs RA_U 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.00 log_World norot dead 322
+/musr/command construct tubs RA_R 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.02 log_World rotRAnR dead 324
+/musr/command construct tubs RA_D 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.04 log_World rotRAnD dead 326
+/musr/command construct tubs RA_L 0 0.01 0.005 0 360 G4_Galactic 0 0 -143.06 log_World rotRAnL dead 328
+
+# RA_G - Ring Anode Ground Cylinder
+/musr/command construct tubs RA_G 58 62.5 58.0 0 360 G4_Cu 0 0 -221.5 log_World norot dead 351
+
+# Ring Anodes visual attributes (optional)
+#/musr/command visattributes log_RA_EU invisible
+#/musr/command visattributes log_RA_MR invisible
+/musr/command visattributes log_RA_G invisible
+#/musr/command visattributes log_RA_G Grid_style
+
+
+################################################################################################################
+# Trigger - Trigger Detector # Triggerz = -1092 mm; total length of TD is 110 mm; carbon foil at -1144 mm.
+################################################################################################################
+
+# Trigger volume
+/musr/command construct tubs TrigV 90 127 148 0 360 G4_Galactic 0 0 -495 log_World norot dead 600
+# Trigger tube
+/musr/command construct tubs TrigS 100 103 148 0 360 Steel 0 0 0 log_TrigV norot dead 601
+
+# TF - Trigger tube flanges
+/musr/command construct tubs TF1 103 126.5 12 0 360 Steel 0 0 136 log_TrigV norot dead 611
+/musr/command construct tubs TF2 103 126.5 12 0 360 Steel 0 0 -136 log_TrigV norot dead 612
+
+# trigger foil is 52-55mm upstream of TrigV center
+# Carbon Foil (default HALF-thickness 0.000005147 mm, see below => CFoil thick = 10.3 nm).
+# USE THE NAME CFoil or coulombCFoil, otherwise musrMuFormation won't work!
+/musr/command construct box CFoil 60 60 0.0000044 G4_GRAPHITE 0 0 -550 log_World norot dead 621
+
+# Notes: NIST tables use G4_GRAPHITE with 1.7 g/cm3 and 78 eV ioniz. energy.
+# An area density of 2.20 ug/cm2 implies a CF thickn. = (2.20*1.e-6/1.70)*cm = 1.294e-5 mm - Total thickness
+# An area density of 1.75 ug/cm2 implies a CF thickn. = (1.75*1.e-6/1.70)*cm = 1.029e-5 mm - Total thickness
+# If necessary, use Graphite as defined in musrDetectorConstruction.cc and set any density.
+
+
+# Trigger visual attributes (optional)
+/musr/command visattributes log_TrigV oxsteel
+/musr/command visattributes log_TrigS oxsteel
+/musr/command visattributes log_TF1 oxsteel
+/musr/command visattributes log_TF2 oxsteel
+#*/musr/command visattributes saveCFoil MACOR_style
+#*/musr/command visattributes log_saveAfterTD darkred
+
+
+# One can set visible attrib. also on a MATERIAL basis, rather than on log_VOL.
+# E.g. /musr/command visattributes Steel red
+
+
+################################################################################################################
+# L3 - 3rd Einzel Lens # L3z = -56.7 cm.
+# Lens Gap = 12.0 mm => G/D = 12/130 ~ 0.1 (Lens Gap = gap between Ground and Anode, D - Diameter)
+################################################################################################################
+
+# L3 volume
+/musr/command construct tubs L3V 65 127 220 0 360 G4_Galactic 0 0 -863 log_World norot dead 400
+
+# Lens 3 Steel tube (inner dia: 200 mm, outer dia: 206 mm, length: 720 mm)
+/musr/command construct tubs L3ST 100 103 220 0 360 Steel 0 0 0 log_L3V norot dead 401
+
+# Lens 3 Flange 1, z = L3z + 208 mm
+/musr/command construct tubs L3F1 103 126.5 12 0 360 Steel 0 0 -208 log_L3V norot dead 402
+
+# Lens 3 Flange 2, z = L3z - 208 mm
+/musr/command construct tubs L3F2 103 126.5 12 0 360 Steel 0 0 208 log_L3V norot dead 403
+
+# GPn - Ground Potential Electrodes
+# n = 1-4 (further from TD) and 5-8 (closer to TD) - components of the Ground Electrodes
+# Ground Electrode (inner dia: 130 mm, outer dia: 134 mm, length: 133 mm)
+/musr/command construct tubs L3GP1 65 67 66.5 0 360 Steel 0 0 133.5 log_L3V norot dead 421
+# Outer electrode surface (LN2 cooling vessel)
+/musr/command construct tubs L3GP2 81 83 66.5 0 360 Steel 0 0 133.5 log_L3V norot dead 422
+# First ring cap
+/musr/command construct tubs L3GP3 67 81 4 0 360 Steel 0 0 196.0 log_L3V norot dead 423
+# Second ring cap
+/musr/command construct tubs L3GP4 67 81 4 0 360 Steel 0 0 71.0 log_L3V norot dead 424
+
+/musr/command construct tubs L3GP5 65 67 66.5 0 360 Steel 0 0 -133.5 log_L3V norot dead 431
+/musr/command construct tubs L3GP6 81 83 66.5 0 360 Steel 0 0 -133.5 log_L3V norot dead 432
+/musr/command construct tubs L3GP7 67 81 4 0 360 Steel 0 0 -196.0 log_L3V norot dead 433
+/musr/command construct tubs L3GP8 67 81 4 0 360 Steel 0 0 -71.0 log_L3V norot dead 434
+
+# HP - High Potential Electrode (Central Anode - usually at +8.7 kV, for a 15 keV muon beam)
+/musr/command construct tubs L3HP 65 83 55 0 360 Steel 0 0 0 log_L3V norot dead 451
+
+# Lens 3 visual attributes (optional)
+/musr/command visattributes log_L3V invisible
+/musr/command visattributes log_L3ST oxsteel
+/musr/command visattributes log_L3F1 oxsteel
+/musr/command visattributes log_L3F2 oxsteel
+/musr/command visattributes log_L3HP darkred
+
+
+
+
+################################################################################################################
+# -- SPIN ROTATOR GEOMETRY --
+################################################################################################################
+
+# Spin Rotator volume
+/musr/command construct tubs SRENV 50 320 201.5 0 360 G4_Galactic 0 0 -1284.5 log_World norot dead 100
+/musr/command visattributes log_SRENV invisible
+
+# Electromagnet with iron yoke
+# U - up, D - down, L - left, R - right (with respect to muon's view - momentum direction)
+
+/musr/command construct box NPole 200 10 150 G4_Fe 0 85 0 log_SRENV norot dead 201
+/musr/command construct box NYoke 150 22.5 50 G4_Fe 0 117.5 0 log_SRENV norot dead 202
+/musr/command construct box NConn 225 17.5 196.5 G4_Fe 0 157.5 0 log_SRENV norot dead 203
+
+/musr/command construct box SPole 200 10 150 G4_Fe 0 -85 0 log_SRENV norot dead 205
+/musr/command construct box SYoke 150 22.5 50 G4_Fe 0 -117.5 0 log_SRENV norot dead 206
+/musr/command construct box SConn 225 17.5 196.5 G4_Fe 0 -157.5 0 log_SRENV norot dead 207
+
+# Front mirror plate
+/musr/command construct box FShU 225 50 5 G4_Fe 0 125 -196.5 log_SRENV norot dead 301
+/musr/command construct box FShD 225 50 5 G4_Fe 0 -125 -196.5 log_SRENV norot dead 302
+/musr/command construct box FShL 75 75 5 G4_Fe 150 0 -196.5 log_SRENV norot dead 303
+/musr/command construct box FShR 75 75 5 G4_Fe -150 0 -196.5 log_SRENV norot dead 304
+
+# Back mirror plate
+/musr/command construct box BShU 225 50 5 G4_Fe 0 125 196.5 log_SRENV norot dead 321
+/musr/command construct box BShD 225 50 5 G4_Fe 0 -125 196.5 log_SRENV norot dead 322
+/musr/command construct box BShL 75 75 5 G4_Fe 150 0 196.5 log_SRENV norot dead 323
+/musr/command construct box BShR 75 75 5 G4_Fe -150 0 196.5 log_SRENV norot dead 324
+
+# Top coils
+/musr/command construct box TCoil1 170 22.5 10 G4_Cu 0 117.5 -60 log_SRENV norot dead 401
+/musr/command construct box TCoil2 170 22.5 10 G4_Cu 0 117.5 60 log_SRENV norot dead 402
+/musr/command construct box TCoil3 10 22.5 50 G4_Cu 160 117.5 0 log_SRENV norot dead 403
+/musr/command construct box TCoil4 10 22.5 50 G4_Cu -160 117.5 0 log_SRENV norot dead 404
+
+# Bottom coils
+/musr/command construct box BCoil1 170 22.5 10 G4_Cu 0 -117.5 -60 log_SRENV norot dead 421
+/musr/command construct box BCoil2 170 22.5 10 G4_Cu 0 -117.5 60 log_SRENV norot dead 422
+/musr/command construct box BCoil3 10 22.5 50 G4_Cu 160 -117.5 0 log_SRENV norot dead 423
+/musr/command construct box BCoil4 10 22.5 50 G4_Cu -160 -117.5 0 log_SRENV norot dead 424
+
+# Capacitor
+/musr/command construct box Cap_p 0.5 60 150 Brass 55 0 0 log_SRENV norot dead 501
+/musr/command construct box Cap_n 0.5 60 150 Brass -55 0 0 log_SRENV norot dead 502
+#*/musr/command construct box Uniform 49 49 150 G4_Galactic 0 0 0 log_SRENV norot dead 503
+/musr/command construct tubs RodCapUp 0 5 150 90 180 Brass 55 55 0 log_SRENV norot dead 504
+/musr/command construct tubs RodCapUn 0 5 150 -90 180 Brass -55 55 0 log_SRENV norot dead 505
+/musr/command construct tubs RodCapDp 0 5 150 90 180 Brass 55 -55 0 log_SRENV norot dead 506
+/musr/command construct tubs RodCapDn 0 5 150 -90 180 Brass -55 -55 0 log_SRENV norot dead 507
+
+
+# Rods
+/musr/command construct tubs RodPosU 0 5 150 0 360 Brass 27.5 55 0 log_SRENV norot dead 511
+/musr/command construct tubs Rod0U 0 5 150 0 360 Brass 0 55 0 log_SRENV norot dead 512
+/musr/command construct tubs RodNegU 0 5 150 0 360 Brass -27.5 55 0 log_SRENV norot dead 513
+/musr/command construct tubs RodPosD 0 5 150 0 360 Brass 27.5 -55 0 log_SRENV norot dead 514
+/musr/command construct tubs Rod0D 0 5 150 0 360 Brass 0 -55 0 log_SRENV norot dead 515
+/musr/command construct tubs RodNegD 0 5 150 0 360 Brass -27.5 -55 0 log_SRENV norot dead 516
+
+
+# Vacuum vessel
+/musr/command construct box TVac1 75 2.5 191.5 Steel 0 72.5 0 log_SRENV norot dead 601
+/musr/command construct box TVac2 2.5 75 191.5 Steel 72.5 0 0 log_SRENV norot dead 602
+/musr/command construct box TVac3 75 2.5 191.5 Steel 0 -72.5 0 log_SRENV norot dead 603
+/musr/command construct box TVac4 2.5 74 191.5 Steel -72.5 0 0 log_SRENV norot dead 604
+
+# Dummy, thin cylindres used for applying the field maps.
+# NOTE: EM field cannot be applied to non simply connected bodies, as e.g. rings, cones, tori, etc.!
+# For Spin Rotator
+/musr/command construct tubs SREField 0 0.01 0.005 0 360 G4_Galactic 0 0 -1284.5 log_World norot dead 630 nofield
+/musr/command construct tubs SRBField 0 0.01 0.005 0 360 G4_Galactic 0 0 -1284.51 log_World norot dead 631 nofield
+
+/musr/command visattributes G4_Cu red
+/musr/command visattributes G4_Fe blue
+/musr/command visattributes Brass yellow
+
+
+################################################################################################################
+# Lens 1 - 1st Einzel Lens
+################################################################################################################
+# L1ENV - Lens 1 envelope - for easy positioning of lens parts (outer dia: 100 mm, length: 300 mm)
+/musr/command construct tubs L1ENV 40 100 150 0 360 G4_Galactic 0 0 -1929.5 log_World norot dead 600
+/musr/command visattributes log_L1ENV invisible
+
+# GPn - Ground Potential Electrodes. (n = 1-2, inner dia: 80 mm, outer dia: 84 mm, length: 100 mm)
+# n = 1 - Ground Electrode 1 (further from SR).
+/musr/command construct tubs L1GP1 40 44 50 0 360 Steel 0 0 -100 log_L1ENV norot dead 651
+# n = 2 - Ground Electrode 2 (closer to SR).
+/musr/command construct tubs L1GP2 40 44 50 0 360 Steel 0 0 100 log_L1ENV norot dead 653
+# HP - High Potential Electrode (Central Anode - usually at +8.5 kV, for a 15 keV muon beam)
+/musr/command construct tubs L1HP 40 44 40 0 360 Steel 0 0 0 log_L1ENV norot dead 652
+
+# Lens 1 visual attributes (optional)
+/musr/command visattributes log_L1HP darkred
+
+###################################################################################
+################### E L E C T R O M G N E T I C F I E L D S ##################
+###################################################################################
+
+# Use ABSOLUTE coordinates to specify the field position (i.e. with respect to GLOBAL WORLD)!
+# Default field units: Magnetic - T, Electric - kV/mm (or kV for E-field maps).
+# NOTE: Applying a field to an invisible log_vol makes is visible!
+
+# Dummy, thin cylindres used for applying the field maps.
+# NOTE: EM field cannot be applied to non simply connected bodies, as e.g. rings, cones, tori, etc.!
+# For L1
+/musr/command construct tubs L1EField 0 0.01 0.005 0 360 G4_Galactic 0 0 -1929.5 log_World norot dead 706 nofield
+# For L3
+/musr/command construct tubs L3EField 0 0.01 0.005 0 360 G4_Galactic 0 0 -863.0 log_World norot dead 708 nofield
+
+# LENS 1. Best L1 settings: 8.5 kV for 15 keV muons, 11.33 kV for 20 keV muons
+/musr/command globalfield Lens1EField 0. 0. -1929.5 fromfile 2DE L1_Erz.map log_L1EField L1VOLTAGE
+
+# LENS 3. Best L3 settings: 8.35 kV for 15 keV muons, 11.41 kV for 20 keV muons
+/musr/command globalfield Lens3EField 0. 0. -863.0 fromfile 2DE L3_Erz.map log_L3EField L3VOLTAGE
+
+# Spin rotator
+# Electric field should be 370mm plates
+# Magnetic field should be 260mm poles sep_5b_exp
+/musr/command globalfield Ele_field 0. 0. -1284.5 fromfile 3DE E_Sep_P37.5cm.map log_SREField SR_EFIELD
+/musr/command globalfield Mag_field 0. 0. -1284.51 fromfile 3DB sep_5b_ext.map log_SRBField SR_BFIELD
+
+# Electrical Field areas in the Trigger Detector
+# En = Electrical Field n: TnFieldMgr (n = 1-3)
+# Original TriggE2: [4.*sqrt(2), 4.5, 0.7/sqrt(2)] cm -> changed due to overlaps with E1 and E3
+# 57.15mm upstream center
+/musr/command construct box TriggE0 45 45 5 G4_Galactic 0 0 -552.15 log_World norot dead 630 nofield
+# 48mm upstream center
+/musr/command construct box TriggE1 45 45 4 G4_Galactic 0 0 -543. log_World norot dead 631 nofield
+# 2.25mm downstream center
+/musr/command construct box TriggE2 45 45 4.9479 G4_Galactic 0 0 -492.75 log_World rotTrig dead 632 nofield
+# 54mm downstream center
+/musr/command construct box TriggE3 45 45 4 G4_Galactic 0 0 -441.0 log_World norot dead 633
+
+### Electric field at TRIGGER Detector TD: Three different uniform fields
+/musr/command globalfield Trigg0_field 45 45 5 uniform 0. 0. -552.15 log_TriggE0 0 0 0 0 0 0.373
+/musr/command globalfield Trigg1_field 45 45 4 uniform 0. 0. -543. log_TriggE1 0 0 0 0 0 -0.02375
+/musr/command globalfield Trigg2_field 45 45 4.9497 uniform 0. 0. -492.75 log_TriggE2 0 0 0 0 0 0.041416
+/musr/command globalfield Trigg3_field 45 45 4 uniform 0. 0. -441.0 log_TriggE3 0 0 0 0 0 -0.49375
+
+### Electric field at RING ANODE - from 3DE field map
+# To create an arbitrary configuration, switch on all fields and set different potentials.
+/musr/command globalfield RngAnT_field 0. 0. -143.00 fromfile 3DE EM_3D_ext_gridf.map log_RA_T RA_TVOL
+/musr/command globalfield RngAnR_field 0. 0. -143.02 fromfile 3DE EM_3D_ext_gridf.map log_RA_R RA_RVOL
+/musr/command globalfield RngAnB_field 0. 0. -143.04 fromfile 3DE EM_3D_ext_gridf.map log_RA_B RA_BVOL
+/musr/command globalfield RngAnL_field 0. 0. -143.06 fromfile 3DE EM_3D_ext_gridf.map log_RA_L RA_LVOL
+
+# Set parameters for particle tracking in an EM field
+/musr/command globalfield setparameter SetLargestAcceptableStep 5
+/musr/command globalfield setparameter SetMinimumEpsilonStep 5e-5
+/musr/command globalfield setparameter SetMaximumEpsilonStep 0.001
+/musr/command globalfield setparameter SetDeltaOneStep 0.1
+/musr/command globalfield setparameter SetDeltaIntersection 0.01
+/musr/command globalfield printparameters
+
+# TESTING EM FIELD
+/musr/command globalfield printFieldValueAtPoint 0. 0. 0.
+/musr/command globalfield printFieldValueAtPoint 0. 35. -670.
+
+
+###################################################################################
+######################### P H Y S I C S P R O C E S S E S ##################
+###################################################################################
+# Geant 4.9.3
+/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
+/musr/command process addDiscreteProcess gamma G4ComptonScattering
+/musr/command process addDiscreteProcess gamma G4GammaConversion
+/musr/command process addDiscreteProcess gamma G4RayleighScattering
+/musr/command process addProcess e- G4eMultipleScattering -1 1 1
+/musr/command process addProcess e- G4eIonisation -1 2 2
+/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
+/musr/command process addProcess e+ G4eMultipleScattering -1 1 1
+/musr/command process addProcess e+ G4eIonisation -1 2 2
+/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
+/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
+/musr/command process addProcess mu- G4MuMultipleScattering -1 1 1
+/musr/command process addProcess mu- G4MuIonisation -1 2 2
+/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
+/musr/command process addProcess mu- G4MuPairProduction -1 4 4
+/musr/command process addProcess mu+ G4MuMultipleScattering -1 1 1
+#/musr/command process addModel mu+ G4MuMultipleScattering G4UrbanMscModel92 0
+#/musr/command process addModel mu+ G4MuMultipleScattering G4WentzelVIModel 0
+#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
+#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
+#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
+#/musr/command process addDiscreteProcess mu+ G4CoulombScattering
+
+###################################################################################
+################## S O M E O T H E R P A R A M E T E R S ##################
+###################################################################################
+# Set the overall range cut
+#/run/setCut 1 mm
+# Set the range cut on a particular volumes (in mm)
+#/musr/command SetUserLimits log_target 0.01
+#/musr/command SetUserLimits log_targetscint 0.01
+#/musr/command SetUserLimits log_M0 0.01
+# Store all events into the ROOT tree or just the interesting ones ? (true is default)
+/musr/command storeOnlyEventsWithHits false
+# Set the minimum time separation between two subsequent signals in the same detector (in ns)
+#/musr/command signalSeparationTime 0.1
+#
+/musr/run/howOftenToPrintEvent 1000
+/musr/run/randomOption 1
+
+################################################################################################################
+# -- Setting simulation PARAMETERS --
+################################################################################################################
+
+# Set the overall range cut (default 0.1 mm)
+#*/run/setCut 1 mm
+
+# Set the range cut on particular volumes (in mm)
+/musr/command SetUserLimits log_CFoil 1e-8 -1 -1 -1 -1
+#*/musr/command SetUserLimits log_target 0.01
+#*/musr/command SetUserLimits log_targetscint 0.01
+#*/musr/command SetUserLimits log_cryostatscint 0.01
+
+# Set particle energy cuts on particular volumes (in eV)
+#/musr/command SetUserLimits log_World ustepMax(mm) utrakMax(mm) utimeMax(ns) uekinMin(MeV) urangMin(mm)
+/musr/command SetUserLimits log_World -1 -1 -1 1e-7 -1
+
+# Store ALL the events in a ROOT tree or just the interesting ones? (default is true)
+#*/musr/command storeOnlyEventsWithHits false
+
+# Set the minimum time separation between two subsequent signals in the same detector (in ns)
+/musr/command signalSeparationTime 0.1
+
+# Override runID number
+#*/musr/run/runID 21
+
+# Set the frequency of event printing
+/musr/run/howOftenToPrintEvent 1000
+
+# RANDOM option choices: (specify the random number generator initialisation)
+# 0 ... no initialisation (default)
+# 1 ... use actual computer time to initialise now
+# 2 ... use event number to initialise at the beginning of each event
+# 3 ... read in the random no. initial values for each event from a file
+/musr/run/randomOption 2
+
+# VISUALIZATION options
+# To enable or disable visualization uncomment one of these lines
+# To modify visualization options edit the file vis.mac
+#*/vis/disable
+/control/execute vis.mac
+#*/control/execute visdawn.mac
+
+
+###################################################################################
+######################### R O O T O U T P U T ##############################
+###################################################################################
+#/musr/command rootOutput runID off
+#/musr/command rootOutput eventID off
+#/musr/command rootOutput weight off
+#/musr/command rootOutput BFieldAtDecay off
+#/musr/command rootOutput muIniPosX off
+#/musr/command rootOutput muIniPosY off
+#/musr/command rootOutput muIniPosZ off
+#/musr/command rootOutput muIniMomX off
+#/musr/command rootOutput muIniMomY off
+#/musr/command rootOutput muIniMomZ off
+#/musr/command rootOutput muIniPolX off
+#/musr/command rootOutput muIniPolY off
+#/musr/command rootOutput muIniPolZ off
+#/musr/command rootOutput muDecayDetID off
+#/musr/command rootOutput muDecayPosX off
+#/musr/command rootOutput muDecayPosY off
+#/musr/command rootOutput muDecayPosZ off
+#/musr/command rootOutput muDecayTime off
+#/musr/command rootOutput muDecayPolX off
+#/musr/command rootOutput muDecayPolY off
+#/musr/command rootOutput muDecayPolZ off
+#/musr/command rootOutput muTargetTime off
+#/musr/command rootOutput muTargetPolX off
+#/musr/command rootOutput muTargetPolY off
+#/musr/command rootOutput muTargetPolZ off
+#/musr/command rootOutput muM0Time off
+#/musr/command rootOutput muM0PolX off
+#/musr/command rootOutput muM0PolY off
+#/musr/command rootOutput muM0PolZ off
+/musr/command rootOutput muM1Time off
+/musr/command rootOutput muM1PolX off
+/musr/command rootOutput muM1PolY off
+/musr/command rootOutput muM1PolZ off
+/musr/command rootOutput muM2Time off
+/musr/command rootOutput muM2PolX off
+/musr/command rootOutput muM2PolY off
+/musr/command rootOutput muM2PolZ off
+#/musr/command rootOutput posIniMomX off
+#/musr/command rootOutput posIniMomY off
+#/musr/command rootOutput posIniMomZ off
+#/musr/command rootOutput fieldNomVal off
+#/musr/command rootOutput det_ID off
+#/musr/command rootOutput det_edep off
+#/musr/command rootOutput det_edep_el off
+#/musr/command rootOutput det_edep_pos off
+#/musr/command rootOutput det_edep_gam off
+#/musr/command rootOutput det_edep_mup off
+#/musr/command rootOutput det_nsteps off
+#/musr/command rootOutput det_length off
+#/musr/command rootOutput det_start off
+#/musr/command rootOutput det_end off
+#/musr/command rootOutput det_x off
+#/musr/command rootOutput det_y off
+#/musr/command rootOutput det_z off
+#/musr/command rootOutput det_kine off
+/musr/command rootOutput det_VrtxKine off
+/musr/command rootOutput det_VrtxX off
+/musr/command rootOutput det_VrtxY off
+/musr/command rootOutput det_VrtxZ off
+/musr/command rootOutput det_VrtxVolID off
+/musr/command rootOutput det_VrtxProcID off
+/musr/command rootOutput det_VrtxTrackID off
+/musr/command rootOutput det_VrtxParticleID off
+/musr/command rootOutput det_VvvKine off
+/musr/command rootOutput det_VvvX off
+/musr/command rootOutput det_VvvY off
+/musr/command rootOutput det_VvvZ off
+/musr/command rootOutput det_VvvVolID off
+/musr/command rootOutput det_VvvProcID off
+/musr/command rootOutput det_VvvTrackID off
+/musr/command rootOutput det_VvvParticleID off
+### Root variables that are not written out by default, but can be switched on:
+#/musr/command rootOutput fieldIntegralBx on
+#/musr/command rootOutput fieldIntegralBy on
+#/musr/command rootOutput fieldIntegralBz on
+#/musr/command rootOutput fieldIntegralBz1 on
+#/musr/command rootOutput fieldIntegralBz2 on
+#/musr/command rootOutput fieldIntegralBz3 on
+
+/musr/command storeOnlyEventsWithHits false
+
+
+
+################################################################################################################
+# -- Setting PARTICLE GUN parameters --
+################################################################################################################
+
+# Default momentum direction: 001, i.e. 0z.
+# Default muon spin direction: 100, i.e. 0x.
+# Default particle type: mu+ (can be changed to Mu)
+
+# Set particle type
+#*/gun/particle Mu
+/gun/particle mu+
+
+# Set beam vertex
+# CFoil at -1144 mm, acceleration starts at -1154.15 mm
+/gun/vertex 0. 0. -2119.5 mm
+
+# A point-like uniform beam
+#/gun/vertexsigma -0.1 -0.1 0 mm
+
+# Set beam transverse spread (default GAUSSIAN spread)
+# If FWHM = 10 mm ==> sigma = 10/2.354 = 4.2481 mm (last 0 is a dummy value)
+# Negative sigma values => random FLAT RECTANGULAR distribution (area 2x.2y)
+# Use vertexboundary with (vb < sigma_xy) to obtain a CIRCULAR beam spot
+# /gun/vertexsigma 0 0 0 mm ==> Very SLOW with mag. field ON and centered beam
+/gun/vertexsigma 6.83 6.83 0 mm
+#/gun/vertexsigma -20 -20 0 mm
+#/gun/vertexboundary 20 -1e6 1e6 mm
+
+# /gun/vertexboundary: rMaxAllowed, zMinAllowed, zMaxAllowed # Beam AND gating
+#*/gun/vertexboundary 7 -1314.4 -1305 mm
+# Without restrictions in z, but only on r:
+#*/gun/vertexboundary 3 -1e6 1e6 mm
+
+# Set beam momentum (USE only as an ALTERNATIVE to setting energy!)
+# /gun/momentum 0 0 29.79 MeV
+#*/gun/momentum 0 0 1.8 MeV
+# Energy loss at p = 1.2 MeV/c (E = 6.8 keV) => 1.23 +/- 0.2 keV
+# Energy loss at p = 1.8 MeV/c (E = 15.3 keV) => 1.25 +/- 0.3 keV
+# 1.2 MeV/c -> 6.8 keV, 1.8 MeV/c -> 15.3 keV
+# muon rest mass = 105.658 MeV/c2
+
+# Set muon energy before hitting TD; a constant field in front of the C-foil accelerates the muons
+# to add 3.73 keV
+/gun/kenergy 15.0 keV
+
+# Set beam momentum direction
+/gun/direction 0.0 0.0 1.0
+
+# Set muon spin direction
+/gun/muonPolarizVector 1 0 0
+
+
+# Other useful test parameters:
+#
+# FWHM = 3% ==> sigma = 29.79*0.03/2.354 = 0.37965 MeV/c
+#*/gun/momentumsmearing 0.37965 MeV
+#---/gun/momentumboundary: pMinAllowed, pMaxAllowed, dummy
+#*/gun/momentumboundary 20 40 0 MeV
+#---/gun/tilt: xangle, yangle, dummy
+#*/gun/tilt 0 0.0 0 deg
+#---/gun/tiltsigma: xangleSigma, yangleSigma, dummy (1 degree at 1 m => 17 mm)
+#*/gun/tiltsigma 0.2 0.2 0 deg
+#*/gun/pitch 0.0 deg
+#---/gun/decaytimelimits: decayMin, decayMax, decayTime
+#*/gun/decaytimelimits 10400 10420 2197.03 ns
+/gun/tiltsigma 1.4 1.4 0 deg
+
+# Selectively inactivate or activate sensitive detectors
+#*/hits/inactivate /musr/ScintSD
+
+# Only for code debugging!
+#/tracking/verbose 1
+
+# BEAM ON
+#/run/beamOn 1000000
+#/run/beamOn 1
+#/run/beamOn 10000
+