]>
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 | ||
70f12a9d | 34 | ClassImp(TFlukaCerenkov); |
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), |
46 | fMaximumEfficiency(0.) | |
70f12a9d | 47 | { |
48 | // Default constructor | |
49 | } | |
50 | ||
51 | ||
52 | TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex) | |
53 | { | |
54 | // Constructor | |
55 | fSamples = npckov; | |
058fcd99 | 56 | fEnergy = new Float_t[fSamples]; |
57 | fWaveLength = new Float_t[fSamples]; | |
58 | fAbsorptionCoefficient = new Float_t[fSamples]; | |
59 | fRefractionIndex = new Float_t[fSamples]; | |
60 | fQuantumEfficiency = new Float_t[fSamples]; | |
3a242b1f | 61 | |
70f12a9d | 62 | for (Int_t i = 0; i < fSamples; i++) { |
63 | fEnergy[i] = ppckov[i]; | |
64 | fWaveLength[i] = khc / ppckov[i]; | |
65 | if (absco[i] > 0.) { | |
66 | fAbsorptionCoefficient[i] = 1./ absco[i]; | |
67 | } else { | |
68 | fAbsorptionCoefficient[i] = 1.e15; | |
69 | } | |
70 | fRefractionIndex[i] = rindex[i]; | |
71 | fQuantumEfficiency[i] = effic[i]; | |
058fcd99 | 72 | // |
3a242b1f | 73 | // Find local maximum quantum efficiency |
74 | if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i]; | |
75 | // | |
058fcd99 | 76 | // Flag is sensitive if quantum efficiency 0 < eff < 1 for at least one value. |
77 | if (effic[i] < 1. && effic[i] > 0.) fIsSensitive = 1; | |
70f12a9d | 78 | } |
3a242b1f | 79 | // Find global maximum quantum efficiency |
80 | if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) { | |
81 | SetGlobalMaximumEfficiency(fMaximumEfficiency); | |
82 | } | |
70f12a9d | 83 | } |
84 | ||
85 | Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy) | |
86 | { | |
87 | // | |
88 | // Get AbsorptionCoefficient for given energy | |
89 | // | |
90 | return Interpolate(energy, fEnergy, fAbsorptionCoefficient); | |
91 | ||
92 | } | |
93 | ||
94 | Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy) | |
95 | { | |
96 | // | |
97 | // Get RefractionIndex for given energy | |
98 | // | |
99 | return Interpolate(energy, fEnergy, fRefractionIndex); | |
100 | ||
101 | } | |
102 | ||
103 | Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy) | |
104 | { | |
105 | // | |
106 | // Get QuantumEfficiency for given energy | |
107 | // | |
108 | return Interpolate(energy, fEnergy, fQuantumEfficiency); | |
109 | ||
110 | } | |
111 | ||
112 | ||
113 | Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength) | |
114 | { | |
115 | // | |
116 | // Get AbsorptionCoefficient for given wavelength | |
117 | // | |
118 | Float_t energy = khc / wavelength; | |
119 | return Interpolate(energy, fEnergy, fAbsorptionCoefficient); | |
120 | ||
121 | } | |
122 | ||
123 | Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength) | |
124 | { | |
125 | // | |
126 | // Get RefractionIndex for given wavelenth | |
127 | // | |
128 | Float_t energy = khc / wavelength; | |
129 | return Interpolate(energy, fEnergy, fRefractionIndex); | |
130 | } | |
131 | ||
132 | Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength) | |
133 | { | |
134 | // | |
135 | // Get QuantumEfficiency for given wavelength | |
136 | // | |
137 | Float_t energy = khc / wavelength; | |
138 | return Interpolate(energy, fEnergy, fQuantumEfficiency); | |
139 | } | |
140 | ||
141 | Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2) | |
142 | { | |
143 | // | |
144 | // Interpolate array values | |
145 | // | |
146 | if (value < array1[0] && value >= array1[fSamples - 1]) { | |
147 | Warning("Interpolate()", "Photon energy out of range. Returning 0."); | |
148 | return (0.); | |
149 | } | |
150 | ||
151 | Int_t i = TMath::BinarySearch(fSamples, array1, value); | |
152 | if (i == (fSamples-1)) { | |
153 | return (array2[i]); | |
154 | } else { | |
155 | return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i])); | |
156 | } | |
157 | } | |
158 |