-
Notifications
You must be signed in to change notification settings - Fork 1
/
crcalib_mp_mpa.pro
100 lines (92 loc) · 2.73 KB
/
crcalib_mp_mpa.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
pro crcalib_mp_mpa, iocstr, hv=hv, st=st, cgain=cgain, fgain=fgain,$
offset=offset, pza=pza, nch=nch, maxc=maxc
;This program creates or modifies an input output structure for
;calibration of MPA event lists or structures.
;INPUT/OUTPUT
;iocstr : The structure that holds all the relevant info for
;calibration
;
;OPTIONAL INPUTS/OUTPUTS
;
;hv: High voltage for the measurements
;st: shaping time
;cgain: Coarse Gain
;fgain: Fine Gain
;offset: Offset
;pza: point zero
;nch: number of channels in the spectrum
;maxc: number of pixels
;
;May 2 2011
;
;A bug was fixed so that if input structure is provided, it prints the
;parameters from the input structure, not the defaults
;
;Floats turned into integers
IF NOT keyword_set(maxc) THEN maxc=15
IF NOT keyword_set(hv) THEN hv=300
IF NOT keyword_set(st) THEN st=1
IF NOT keyword_set(cgain) THEN cgain=0
IF NOT keyword_set(fgain) THEN fgain=6
IF NOT keyword_set(offset) THEN offset=65
IF NOT keyword_set(pza) THEN pza=50
IF NOT keyword_set(nch) THEN nch=4096
IF NOT keyword_set(iocstr) THEN BEGIN
calib=create_struct('maxc',maxc,'hv',hv,'st',st,'cgain',cgain,$
'fgain',fgain,'offset',offset,'pza',pza,$
'nch',nch,'ach2e',fltarr(maxc,2),'pch2e',[0.,0.])
cont=1
ENDIF ELSE BEGIN
ques = DIALOG_MESSAGE('Warning, you are about to modify an existing structure, are you sure you want to continue?', /Ques)
IF Ques eq 'Yes' THEN cont=1 ELSE cont=0
calib=iocstr
ENDELSE
IF cont THEN BEGIN
cond3='No'
WHILE cond3 eq 'No' DO BEGIN
PRINT, 'These are the parameters to be saved'
PRINT, '1. High Voltage: ',calib.hv
PRINT, '2. Shaping Time: ',calib.st
PRINT, '3. Coarse Gain: ',calib.cgain
PRINT, '4. Fine Gain: ',calib.fgain
PRINT, '5. Offset: 65', calib.offset
PRINT, '6. Pole Zero Adj.', calib.pza
PRINT, '7. Number of ADC Channels: ',calib.nch
wait,0.25
inp=''
READ, 'TYPE the number of parameter to be changed, or PRESS any other key to exit:',inp
CASE inp OF
'1': BEGIN
READ,'New High Voltage: ',hv
calib.hv=hv
END
'2': BEGIN
READ,'New shaping time (us): ',st
calib.st=st
END
'3': BEGIN
READ,'New Coarse Gain: ',cgain
calib.cgain=cgain
END
'4': BEGIN
READ,'New Fine Gain: ',fgain
calib.fgain=fgain
END
'5': BEGIN
READ,'New Offset: ',offset
calib.offset=offset
END
'6': BEGIN
READ,'New Pole Zero Adjustment: ',pza
calib.pza=pza
END
'7': BEGIN
READ,'New number of ADC channels: ',nch
calib.nch=nch
END
ELSE: cond3 = 'Yes'
ENDCASE
ENDWHILE
iocstr=calib
ENDIF ELSE print,'Nothing to be done!'
END