-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoxsi4_deteff.pro
133 lines (110 loc) · 5.39 KB
/
foxsi4_deteff.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Function foxsi4_deteff, energy_arr = energy_arr, cdte = cdte, cmos = cmos, timepix = timepix, elec_coverage = elec_coverage, plot = plot, $
let_file = let_file
; Purpose:
; Get FOXSI-4 detector efficiency
;
; Notes:
; Efficiency is theoretical based on materials and their thicknesses.
; For CdTe:
; Detector thickness, electrodes thickness and coverage, and the efficiency curve at low energy threshold are taken into account.
; The electrode coverage is not uniform accross the detector (0.5 for finest pitch, 0.375 for the second finest pitch, and 0.3
; for the coarsest pitch); here the average value of 0.36 is used for default - differences when using 0.5 are very small. The low energy threshold
; efficiency curve is generated based on Fe-55 threshold scan data measured by Nagasawa san (see Ishikawa et al 2016
; for method https://arxiv.org/abs/1606.03887).
; For CMOS:
; Only consider photoabsorption of Si.
; For Timepix:
; This is a rough estimate based on Timepix thickness but with FOXSI-3 CdTe detector electrodes.
; Low energy threshold efficiency not implemented.
; Need to update.
;
; Keywords:
; energy_arr: 1d energy array in keV (bin centers)
; cdte: set this to 1 to get efficiency for the CdTe strip detector
; cmos: set this to 1 to get efficiency for the CMOS detector
; timepix: set this to 1 to get efficiency for the Timepix3 detector
; elec_coverage: electrode coverage (fraction). If not set, use 0.5 for CdTe and Timepix. Ignored for CMOS.
; plot: set this to 1 to efficiency vs energy
; let_file: energy vs efficiency file for different low energy thresholds
;
; Outputs:
; Data structure that consists of energies in keV and efficiency.
;
; Examples:
; deteff = foxsi4_deteff(energy_arr = indgen(150)*0.2+1.0, cdte = 1, plot = 1)
; deteff = foxsi4_deteff(cmos = 1, plot = 1)
; deteff = foxsi4_deteff(timepix = 1, elec_coverage = 0.4, plot = 1)
;
; History:
; Oct 2023, created by Y. Zhang
; Apr 2024, add effiency files for different low energy thresholds
Default, energy_arr, indgen(300)*0.1+1.0
Default, cdte, 0
Default, cmos, 0
Default, timepix, 0
Default, plot, 0
Default, let_file, 'vth_5.csv'
db_dir = 'material_data/'
If total(cdte+cmos+timepix) ne 1 then begin
print, 'Error: please choose 1 detector - set (only) one of below keywords: cdte, cmos, timepix'
return, 0
Endif
; -----------------------------------------------------------------------------------------------------------------------------------
; CdTe detector
If cdte eq 1 then begin
; transmission of the electrodes: Pt(~30nm) + Au(30nm) + Ni(1000nm) + Au(50nm)
pt_thick_um = 0.03
au_thick_um = 0.08
ni_thick_um = 1.
If not keyword_set(elec_coverage) then elec_coverage = 0.36 ; electrode coverage
pt_trans = get_material_transmission(db_dir + 'pt_att_len.txt', pt_thick_um, energy_arr = energy_arr)
au_trans = get_material_transmission(db_dir + 'au_att_len.txt', au_thick_um, energy_arr = energy_arr)
ni_trans = get_material_transmission(db_dir + 'ni_att_len.txt', ni_thick_um, energy_arr = energy_arr)
elec_trans = pt_trans.transmission * au_trans.transmission * ni_trans.transmission * elec_coverage + (1 - elec_coverage)
; absorption of CdTe
cdte_thick_um = 750
cdte_trans = get_material_transmission(db_dir + 'cdte_att_len.txt', cdte_thick_um, energy_arr = energy_arr)
cdte_absor = 1 - cdte_trans.transmission
; low energy threshold
; see Ishikawa et al 2016 for method (https://arxiv.org/abs/1606.03887)
; using data and fit parameters from Nagasawa san
;let = 0.5*(erf((energy_arr/0.6865-5)/sqrt(2)/2.769)+1)
; load the low energy threshold efficiency file
path = '/Users/zyx/Documents/foxsi/foxsi4sim_v2/cdte_let_eff/'
filename = path + let_file
data = read_csv(filename)
let = interpol(data.field2, data.field1, energy_arr)
det_eff = elec_trans * cdte_absor * let
Endif
; -----------------------------------------------------------------------------------------------------------------------------------
; CMOS detector
If cmos eq 1 then begin
; absorption of Si
si_thick_um = 25
si_trans = get_material_transmission(db_dir + 'si_att_len.txt', si_thick_um, energy_arr = energy_arr)
si_absor = 1 - si_trans.transmission
det_eff = si_absor
Endif
; -----------------------------------------------------------------------------------------------------------------------------------
; Timepix detector
; This is temporary using cdte strip electrodes and LET. (Need to update!)
If timepix eq 1 then begin
; transmission of the electrodes
au_thick_um = 0.1
pt_thick_um = 0.05
If not keyword_set(elec_coverage) then elec_coverage = 0.3
au_trans = get_material_transmission(db_dir + 'au_att_len.txt', au_thick_um, energy_arr = energy_arr)
pt_trans = get_material_transmission(db_dir + 'pt_att_len.txt', pt_thick_um, energy_arr = energy_arr)
elec_trans = au_trans.transmission * pt_trans.transmission * elec_coverage + (1 - elec_coverage)
; absorption of CdTe
cdte_thick_um = 1000
cdte_trans = get_material_transmission(db_dir + 'cdte_att_len.txt', cdte_thick_um, energy_arr = energy_arr)
cdte_absor = 1 - cdte_trans.transmission
; low energy threshold efficiency (to be implemented)
let = 1.
det_eff = elec_trans * cdte_absor * let
Endif
If keyword_set(plot) then plot, energy_arr, det_eff, xtitle = 'Energy (keV)', ytitle = 'Efficiency', charsize = 1.4
eff = create_struct("energy_keV", energy_arr, "efficiency", det_eff)
return, eff
End