Added to repository.

This commit is contained in:
2004-06-17 13:40:48 +00:00
parent e38ca8310e
commit c7720cc66b
12 changed files with 4613 additions and 0 deletions

9
mcv3k/paw/gauss_ener.for Normal file
View File

@@ -0,0 +1,9 @@
function gauss_ener(x)
common /pawpar/ par(3)
sqpihalf=1.25331414
S2=1.414213562
fact1=10.*par(1)/sqpihalf/par(3)/erfc(-par(2)/s2/par(3))
c faktor 10 wegen 10keV binning im histogramm
gauss_ener=fact1*exp(-(x-par(2))**2/2/par(3)**2)
end

128
mcv3k/paw/mcv3k_ana.kumac Normal file
View File

@@ -0,0 +1,128 @@
* ~mc/mcv3k/paw/mcv3k_ana.kumac
*
* kumac to create some histograms from NTUPLE files
* of the MCV3K simulations of the muonium experiment
* at PSI performed at piE1 in May 1994.
* one input parameter - the filename of the NTUPLE file which
* must have the extension .NT - is required without extension.
* the relevant variables are E0 (energy in MeV) and T0 (time
* of flight between S1 and MCP2 ins ns), the NTUPLE id is 111.
* 1.6 ns are substracted from the TOF's to correct for the
* TOF S1 - Target foil. This is necessary since the experimental
* TOF's are also corrected for this time.
*
* the new histograms are
*
* - 3 TOF's with different binnings (0.5, 1.0 and 2.0 ns)
* in the intervall [0,200]ns
* - 3 energy histograms in the intervals [0,1500] keV with 10keV
* bins
* [0,100]keV with 1keV bins and
* [0,30]keV with 1keV bins
* the purpose of the last two ones is to get information
* on the fraction of muons having energies in the 10 keV region
* to be able to make some predictions on muonium formation
*
*
* no cuts are necessary since the NTUPLE data contain only those
* muons hitting the MCP2. The distances and dimensions of the
* various elementes from the Mylar foil and S1 to the MCP2
* were rechecked fro the MCV3K simulation and they should be ok now.
*
* at the end the new histograms are written to a .RZ file with the
* same name as the NTUPLE file had.
*
* TP, 20-July-1995
*
*
* added a second parameter to indicate if a Postscript output should
* be done ( if [2]=PS then post script)
*
*
* TP, 18-dec-1995 renamed from RUN7_ANA.KUMAC
* TP, 09-feb-1998 changed bin size of ID1 from 257ps to 258ps
* TP, 14-sep-2000 Unix version
*-----------------------------------------------------------------------------
*
* open the NTUPLE file
*
close 0 | first close all open units
file = $mcv3k_out/[1].nt
hi/file 20 [file] 4096
message NTUPLE file = [file]
*
* book now the histograms needed
*
do i =1,6 | delete existing histograms
hi/del [i]
enddo
1d 1 'TOF - 1.7ns, 0.258ns binning' 501 -.129 129.129
1d 2 'TOF - 1.7ns, 0.5ns binning' 401 -.25 200.25
1d 3 'TOF - 1.7ns, 1.0ns binning' 201 -.5 200.5
1d 4 'energy in keV' 301 -5. 3005.
1d 5 'energy below 100 keV' 101 -.5 100.5
1d 6 'energy below 30 keV' 31 -.5 30.5
*
* fill the histograms
*
opt liny
set ysiz 28
zone 2 3
opt nfil
title [1]
*
* open PostScript file if desired
*
if [2] .eq. 'PS' .or. [2] .eq. 'ps' then
for/file 66 $mcv3k_out/[1].ps
meta 66 -111
*
endif
nt/pl 111.(t0-1.7) id>1 ! -1 | id>1 necessary because of a little
nt/pl 111.(t0-1.7) id>1 ! -2 | mistake in the routine which creates
nt/pl 111.(t0-1.7) id>1 ! -3 | the ntuple files
nt/pl 111.1000*e0 id>1 ! -4 | energy in keV
nt/pl 111.1000*e0 id>1 ! -5
nt/pl 111.1000*e0 id>1 ! -6
*
* write histograms to RZ files
*
n = 0
do i = 1, 6
temp = $HINFO([i],'ENTRIES')
if ([temp].eq.0) then
n = [n] + 1
endif
enddo
if ( [n] .eq. 6) then
goto ret
endif
*
set ysiz
opt fit
set fit 111111
v/cre par(3) r 200 450 200
* hi/fit 4 gauss_ener.for l 3 par
hi/file 21 $mcv3k_out/[1].rz ! n | "! n" means new file
*
if [2] .eq. 'PS' .or. [2] .eq. 'ps' then
close 66
message PostScript file $mcv3k_out/[1].ps
endif
*
do i = 1,6
hrout [i]
enddo
message Histograms written to $mcv3k_out/[1].rz
close 20
close 21
set ysiz
opt file
title ' '
ret:
return
*
*------------------------------------------------------------------------------
*
* EOF ~/mc/mcv3k/paw/mcv3k_ana.kumac
*

130
mcv3k/paw/plot_range.kumac Normal file
View File

@@ -0,0 +1,130 @@
*
* $mcv3k_root\paw\plot_range.kumac
*
* Plot mu+ ranges in Al up to p_in = 29.8 MeV/c and fit
* a1xp**3.5 to the data.
* Ranges calculated with mcv3k.
* Histograms saved in $mcv3_root\data\al_range.rz.
*
* requires one input parameter:
*
* [1] material, for example al
*
* TP, 28-Nov-2000, PSI LEM group
*
*-----------------------------------------------------------------------------
*
if ( [#] = 0 ) then
mess
mess Need input parameter to build input file name.
mess For example:
mess
mess plot_range al
mess
mess Input file name will be $mcv3k_root/data/al_range.rz
mess
exitm
endif
*
mat = [1]
*
*------------------------------------------------------------------------------
*
close 0 | close all open units
hi/de 0 | delete all histograms in //pawc
v/de * | delete all vectors
*
v/crea hid(100) | vector for histogram ID's
v/crea x0(2) | for defining graphic window
v/crea y0(2) | same for y
*
*-------------------------------
*
file = $mcv3k_root/data/[mat]_range.rz | file with range histograms
if ( $fexist([file]) = 0) then
mess
mess File [file] does not exist ?!
mess
exitm
endif
*
* open file
*
hi/file 20 [file]
hrin 0
close 20
nhist = 0
do i = 1, 300 | look for histograms; ID = 10 x momentum [MeV/c]
if ( $hexist([i]) ) then
mess Found histogram [i]
nhist = [nhist] + 1
v/inp hid([nhist]) [i]
endif
enddo
*
* now we are ready to extract information from histograms
*
v/crea r([nhist]) | vector for mean ranges
v/crea er([nhist]) | vector for RMS range
v/crea p([nhist]) | vector for momenta
v/crea ep([nhist]) r 8*0. | error in momentum = 0
*
do i = 1, [nhist]
id = hid([i])
mom = [id]/10.
range = $hinfo([id],'MEAN')
rms = $hinfo([id],'RMS')
v/inp r([i]) [range]
v/inp er([i]) [rms]
v/inp p([i]) [mom]
enddo
xmax = [mom]*1.15
ymax = [range]*1.07
v/inp x0(1) 0.
v/inp y0(1) 0.
v/inp x0(2) [xmax]
v/inp y0(2) [ymax]
*
* plot
*
set ysiz
zone
opt grid
mat = $upper([mat])
title [mat]//', [m]^+! mean range, [D]p=0'
*
*
*
graph 2 x0 y0 aw
hpl/err p r ep er [nhist] 20 0.3
*
* fit to data par(1)xp**3.5
*
v/crea par(1) r 1.
opt nstat
opt fit
set fit 111
v/fit p r er $mcv3k_root/paw/range.f s 1 par
scale = par(1)
max = p(1)
func/pl [scale]*x**3.5 0. [max] s
atitle 'p (MeV/c)' 'mean range ([m]m)'
*
xpos = 0.05*x0(2)
ypos = 0.95*r([nhist])
str = $mcv3k_root/paw/plot"-#range.kumac
text [xpos] [ypos] [str] 0.2
ypos = 0.90*r([nhist])
text [xpos] [ypos] 'Fit function "J# P1 x p^3.5!' .25
*
*
*
title ' '
opt ngri
opt stat
*
*-------------------------------------------------------------------------------
*