]>
Commit | Line | Data |
---|---|---|
446f22a8 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$*/ | |
17 | ||
18 | // | |
19 | // Stores user defined cerenkov properties of media like | |
20 | // absorption coefficient, refraction index and quantum efficiency. | |
21 | // The properties are stored in arrays. The array index corresponds to discrete | |
22 | // optical photon energies defined in fEnergy. | |
23 | // Access to the properties is provided by interpolation. | |
24 | // | |
25 | // Author: | |
26 | // A. Morsch | |
27 | // andreas.morsch@cern.ch | |
28 | // | |
29 | ||
70f12a9d | 30 | #include "TFlukaCerenkov.h" |
31 | ||
3a242b1f | 32 | Double_t TFlukaCerenkov::fgGlobalMaximumEfficiency = 0.; |
33 | ||
8be76537 | 34 | ClassImp(TFlukaCerenkov) |
70f12a9d | 35 | |
36 | ||
37 | TFlukaCerenkov::TFlukaCerenkov() | |
38 | : fSamples(0), | |
058fcd99 | 39 | fIsMetal(kFALSE), |
40 | fIsSensitive(kFALSE), | |
70f12a9d | 41 | fEnergy(0), |
42 | fWaveLength(0), | |
43 | fAbsorptionCoefficient(0), | |
44 | fQuantumEfficiency(0), | |
3a242b1f | 45 | fRefractionIndex(0), |
b2be0e73 | 46 | fReflectivity(0), |
3a242b1f | 47 | fMaximumEfficiency(0.) |
70f12a9d | 48 | { |
49 | // Default constructor | |
50 | } | |
51 | ||
52 | ||
53 | TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex) | |
54 | { | |
55 | // Constructor | |
56 | fSamples = npckov; | |
058fcd99 | 57 | fEnergy = new Float_t[fSamples]; |
58 | fWaveLength = new Float_t[fSamples]; | |
59 | fAbsorptionCoefficient = new Float_t[fSamples]; | |
60 | fRefractionIndex = new Float_t[fSamples]; | |
61 | fQuantumEfficiency = new Float_t[fSamples]; | |
30c7827f | 62 | fReflectivity = new Float_t[fSamples]; |
b2be0e73 | 63 | |
70f12a9d | 64 | for (Int_t i = 0; i < fSamples; i++) { |
65 | fEnergy[i] = ppckov[i]; | |
66 | fWaveLength[i] = khc / ppckov[i]; | |
67 | if (absco[i] > 0.) { | |
68 | fAbsorptionCoefficient[i] = 1./ absco[i]; | |
69 | } else { | |
70 | fAbsorptionCoefficient[i] = 1.e15; | |
71 | } | |
72 | fRefractionIndex[i] = rindex[i]; | |
73 | fQuantumEfficiency[i] = effic[i]; | |
058fcd99 | 74 | // |
3a242b1f | 75 | // Find local maximum quantum efficiency |
76 | if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i]; | |
77 | // | |
058fcd99 | 78 | // Flag is sensitive if quantum efficiency 0 < eff < 1 for at least one value. |
79 | if (effic[i] < 1. && effic[i] > 0.) fIsSensitive = 1; | |
30c7827f | 80 | // G3 way to define metal |
81 | if (rindex[0] == 0.) { | |
82 | fIsMetal = kTRUE; | |
83 | fReflectivity[i] = absco[i]; | |
84 | } | |
70f12a9d | 85 | } |
3a242b1f | 86 | // Find global maximum quantum efficiency |
87 | if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) { | |
88 | SetGlobalMaximumEfficiency(fMaximumEfficiency); | |
89 | } | |
70f12a9d | 90 | } |
91 | ||
b2be0e73 | 92 | TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex, Float_t *refl) |
93 | { | |
94 | // Constructor including reflectivity | |
95 | fSamples = npckov; | |
96 | fEnergy = new Float_t[fSamples]; | |
97 | fWaveLength = new Float_t[fSamples]; | |
98 | fAbsorptionCoefficient = new Float_t[fSamples]; | |
99 | fRefractionIndex = new Float_t[fSamples]; | |
100 | fQuantumEfficiency = new Float_t[fSamples]; | |
101 | ||
102 | ||
103 | for (Int_t i = 0; i < fSamples; i++) { | |
104 | fEnergy[i] = ppckov[i]; | |
105 | fWaveLength[i] = khc / ppckov[i]; | |
106 | if (absco[i] > 0.) { | |
107 | fAbsorptionCoefficient[i] = 1./ absco[i]; | |
108 | } else { | |
109 | fAbsorptionCoefficient[i] = 1.e15; | |
110 | } | |
111 | fRefractionIndex[i] = rindex[i]; | |
112 | fQuantumEfficiency[i] = effic[i]; | |
113 | // | |
114 | // Find local maximum quantum efficiency | |
115 | if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i]; | |
116 | // | |
117 | // Flag is sensitive if quantum efficiency 0 < eff < 1 for at least one value. | |
118 | if (effic[i] < 1. && effic[i] > 0.) fIsSensitive = 1; | |
30c7827f | 119 | // |
120 | ||
b2be0e73 | 121 | } |
122 | // Find global maximum quantum efficiency | |
123 | if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) { | |
124 | SetGlobalMaximumEfficiency(fMaximumEfficiency); | |
125 | } | |
126 | fReflectivity = new Float_t[fSamples]; | |
127 | for (Int_t i = 0; i < fSamples; i++) fReflectivity[i] = refl[i]; | |
128 | fIsMetal = kTRUE; | |
129 | } | |
130 | ||
70f12a9d | 131 | Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy) |
132 | { | |
133 | // | |
134 | // Get AbsorptionCoefficient for given energy | |
135 | // | |
136 | return Interpolate(energy, fEnergy, fAbsorptionCoefficient); | |
137 | ||
138 | } | |
139 | ||
140 | Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy) | |
141 | { | |
142 | // | |
143 | // Get RefractionIndex for given energy | |
144 | // | |
145 | return Interpolate(energy, fEnergy, fRefractionIndex); | |
146 | ||
147 | } | |
148 | ||
b2be0e73 | 149 | Float_t TFlukaCerenkov::GetReflectivity(Float_t energy) |
150 | { | |
151 | // | |
152 | // Get RefractionIndex for given energy | |
153 | // | |
154 | return Interpolate(energy, fEnergy, fReflectivity); | |
155 | ||
156 | } | |
157 | ||
70f12a9d | 158 | Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy) |
159 | { | |
160 | // | |
161 | // Get QuantumEfficiency for given energy | |
162 | // | |
163 | return Interpolate(energy, fEnergy, fQuantumEfficiency); | |
164 | ||
165 | } | |
166 | ||
167 | ||
168 | Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength) | |
169 | { | |
170 | // | |
171 | // Get AbsorptionCoefficient for given wavelength | |
172 | // | |
173 | Float_t energy = khc / wavelength; | |
174 | return Interpolate(energy, fEnergy, fAbsorptionCoefficient); | |
175 | ||
176 | } | |
177 | ||
178 | Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength) | |
179 | { | |
180 | // | |
181 | // Get RefractionIndex for given wavelenth | |
182 | // | |
183 | Float_t energy = khc / wavelength; | |
184 | return Interpolate(energy, fEnergy, fRefractionIndex); | |
185 | } | |
186 | ||
b2be0e73 | 187 | Float_t TFlukaCerenkov::GetReflectivityByWaveLength(Float_t wavelength) |
188 | { | |
189 | // | |
190 | // Get RefractionIndex for given wavelenth | |
191 | // | |
192 | Float_t energy = khc / wavelength; | |
193 | return Interpolate(energy, fEnergy, fReflectivity); | |
194 | } | |
195 | ||
70f12a9d | 196 | Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength) |
197 | { | |
198 | // | |
199 | // Get QuantumEfficiency for given wavelength | |
200 | // | |
201 | Float_t energy = khc / wavelength; | |
202 | return Interpolate(energy, fEnergy, fQuantumEfficiency); | |
203 | } | |
204 | ||
205 | Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2) | |
206 | { | |
207 | // | |
208 | // Interpolate array values | |
209 | // | |
210 | if (value < array1[0] && value >= array1[fSamples - 1]) { | |
211 | Warning("Interpolate()", "Photon energy out of range. Returning 0."); | |
212 | return (0.); | |
213 | } | |
214 | ||
215 | Int_t i = TMath::BinarySearch(fSamples, array1, value); | |
216 | if (i == (fSamples-1)) { | |
217 | return (array2[i]); | |
218 | } else { | |
219 | return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i])); | |
220 | } | |
221 | } | |
222 |