*MOCADI with charge exchange, 2 MUSICs example
* H. Weick, 24.08.2015 for MOCADI 4-0c

*Saves:
* #1 after window
* #2 before gas MUSIC 1
* #3  after gas MUSIC 1
* #4 before gas MUSIC 2
* #5  after gas MUSIC 2

* >close 1 ; hi/file 1 two_musics.hbk
* >set hcol 1104 ; opt stat ; size 30 20

* three fragments with Z= 89, 90, 91
* compound gases approximated by effective Z
* plot charge-state distributions
* >nt/plot 1.elnum(2)
* >nt/plot 1.elnum(3)
* >nt/plot 1.elnum(3)%elnum(2) ; hi/plot 1000000 colz

* set energy spread from reaction to zero (target option 1 -> 4)
* correction factor for energy-loss depending on q_i not Z (d_chstr=0.75)
* omit collisional energy-loss straggling in MUSIC gas
* then derive MUSIC signal from energy deposition in MUSIC
* calibration factor to match the known Z=90 for E_in = 550 MeV/u
* plot calibrated MUSIC spectrum (Z_1)
* >nt/plot 1.sqrt((energy(2)-energy(3))/12.02)*90 

* as option convolute in a Gaussian for resolution with fixed charge
* sigma_Z = 0.17 adjusted to old experiment data
* >nt/plot 1.sqrt((energy(2)-energy(3))/12.02)*90+x(2)*1.7 

* plot with both MUSICs Z_1 vs. Z_2
* >nt/plot 1.sqrt((energy(2)-energy(3))/12.02)*90+x(2)*1.7%sqrt((energy(4)-energy(5))/12.22)*90+x(2)*1.7

* for nicer plot define histogram with more bins
* >hi/cre/2dhist 2000 'MUSIC1 vs MUSIC2' 100 86.3 92 100 86.3 92
* plot into histogram (add idh=2000), and replot with log. color scale
* >opt logz ; hist/plot 2000 colz

* The example shows that resolution is not good anymore.
* Energy is too low, too much charge exchange


option listmode cwn      
*option listmode tree    
atima-1.0    
atima_splines_gziped
EPAX 3
*
 BEAM
 10000
 550, 0, 238, 92
 2
 0.10,  0.10, 0, 0, 0
 2
 0.10,  0.10, 0, 0, 0
 4
 0.0,  0, 0, 0, 0
*
 TARGET
 9., 4, 1840, 4	        target material, shape of distribution
 232, 90          	set fragment A, Z
 5, 0.1, 0.0, 0.0, 0.0	target thickness
 1, 1, 0, 0, 0, 0	reaction options
*Fklwi, Fenstr, Fgold, Fwico, Fkauf, Fspalt
*
FRAGMENT
2, 2
89, 232
91, 232
*
*ERWARTUNGSWERTE
*SAVE
*
* equlibrium charge-state distribution after Ti-window
CHARGE_STATES
4, 0
63.0 32.6 4.4 0.0
*
ERWARTUNGSWERTE
SAVE
*------ MUSIC 1 --------
*glass entrance window Z_eff(SiO2) = 11
MATTER    
22, 11, 2230
3, 52.71
0
0., 0., 0.
0, 0, 1
0, 0, 0, 0
*
ERWARTUNGSWERTE
SAVE
*
*MUSIC gas Z_eff(CF4) = 8 
MATTER
18, 8, 3.66
3, 153.7
0
0., 0., 0.
0, 0.0, 0.75
0, 0, 0, 0                 
*
ERWARTUNGSWERTE
SAVE
*
*glass exit window Z_eff(SiO2) = 11
MATTER    
22, 11, 2230
3, 52.71
0
0., 0., 0.
0, 0, 1
0, 0, 0, 0
*
*------ MUSIC 2 --------
*glass entrance window Z_eff(SiO2) = 11
MATTER    
22, 11, 2230
3, 52.71
0
0., 0., 0.
0, 0, 1
0, 0, 0, 0
*
ERWARTUNGSWERTE
SAVE
*
*MUSIC gas Z_eff(CF4) = 8 
MATTER
18, 8, 3.66
3, 153.7
0
0., 0., 0.
0, 0.0, 0.75
0, 0, 0, 0                 
*
ERWARTUNGSWERTE
SAVE
*
*glass exit window Z_eff(SiO2) = 11
MATTER    
22, 11, 2230
3, 52.71
0
0., 0., 0.
0, 0, 1
0, 0, 0, 0
*
*ERWARTUNGSWERTE
*SAVE
*
END
