1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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.
27 // andreas.morsch@cern.ch
30 #include "TFlukaCerenkov.h"
32 Double_t TFlukaCerenkov::fgGlobalMaximumEfficiency = 0.;
34 ClassImp(TFlukaCerenkov)
37 TFlukaCerenkov::TFlukaCerenkov()
43 fAbsorptionCoefficient(0),
44 fQuantumEfficiency(0),
47 fMaximumEfficiency(0.)
49 // Default constructor
53 TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex)
57 fEnergy(new Float_t[fSamples]),
58 fWaveLength(new Float_t[fSamples]),
59 fAbsorptionCoefficient(new Float_t[fSamples]),
60 fQuantumEfficiency(new Float_t[fSamples]),
61 fRefractionIndex(new Float_t[fSamples]),
62 fReflectivity(new Float_t[fSamples]),
63 fMaximumEfficiency(0.)
68 // fEnergy = new Float_t[fSamples];
69 // fWaveLength = new Float_t[fSamples];
70 // fAbsorptionCoefficient = new Float_t[fSamples];
71 // fRefractionIndex = new Float_t[fSamples];
72 // fQuantumEfficiency = new Float_t[fSamples];
73 // fReflectivity = new Float_t[fSamples];
75 for (Int_t i = 0; i < fSamples; i++) {
76 fEnergy[i] = ppckov[i];
77 fWaveLength[i] = khc / ppckov[i];
79 fAbsorptionCoefficient[i] = 1./ absco[i];
81 fAbsorptionCoefficient[i] = 1.e15;
83 fRefractionIndex[i] = rindex[i];
84 fQuantumEfficiency[i] = effic[i];
86 // Find local maximum quantum efficiency
87 if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i];
89 // Flag is sensitive if quantum efficiency 0 < eff < 1 for at least one value.
90 if (effic[i] < 1. && effic[i] > 0.) fIsSensitive = 1;
91 // G3 way to define metal
92 if (rindex[0] == 0.) {
94 fReflectivity[i] = absco[i];
97 // Find global maximum quantum efficiency
98 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
99 SetGlobalMaximumEfficiency(fMaximumEfficiency);
103 TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex, Float_t *refl)
106 fIsSensitive(kFALSE),
107 fEnergy(new Float_t[fSamples]),
108 fWaveLength(new Float_t[fSamples]),
109 fAbsorptionCoefficient(new Float_t[fSamples]),
110 fQuantumEfficiency(new Float_t[fSamples]),
111 fRefractionIndex(new Float_t[fSamples]),
112 fReflectivity(new Float_t[fSamples]),
113 fMaximumEfficiency(0.)
115 // Constructor including reflectivity
116 // fSamples = npckov;
117 // fEnergy = new Float_t[fSamples];
118 // fWaveLength = new Float_t[fSamples];
119 // fAbsorptionCoefficient = new Float_t[fSamples];
120 // fRefractionIndex = new Float_t[fSamples];
121 // fQuantumEfficiency = new Float_t[fSamples];
124 for (Int_t i = 0; i < fSamples; i++) {
125 fEnergy[i] = ppckov[i];
126 fWaveLength[i] = khc / ppckov[i];
128 fAbsorptionCoefficient[i] = 1./ absco[i];
130 fAbsorptionCoefficient[i] = 1.e15;
132 fRefractionIndex[i] = rindex[i];
133 fQuantumEfficiency[i] = effic[i];
135 // Find local maximum quantum efficiency
136 if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i];
138 // Flag is sensitive if quantum efficiency 0 < eff < 1 for at least one value.
139 if (effic[i] < 1. && effic[i] > 0.) fIsSensitive = 1;
143 // Find global maximum quantum efficiency
144 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
145 SetGlobalMaximumEfficiency(fMaximumEfficiency);
147 // fReflectivity = new Float_t[fSamples];
148 for (Int_t i = 0; i < fSamples; i++) fReflectivity[i] = refl[i];
152 Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy)
155 // Get AbsorptionCoefficient for given energy
157 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
161 Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy)
164 // Get RefractionIndex for given energy
166 return Interpolate(energy, fEnergy, fRefractionIndex);
170 Float_t TFlukaCerenkov::GetReflectivity(Float_t energy)
173 // Get RefractionIndex for given energy
175 return Interpolate(energy, fEnergy, fReflectivity);
179 Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy)
182 // Get QuantumEfficiency for given energy
184 return Interpolate(energy, fEnergy, fQuantumEfficiency);
189 Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength)
192 // Get AbsorptionCoefficient for given wavelength
194 Float_t energy = khc / wavelength;
195 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
199 Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength)
202 // Get RefractionIndex for given wavelenth
204 Float_t energy = khc / wavelength;
205 return Interpolate(energy, fEnergy, fRefractionIndex);
208 Float_t TFlukaCerenkov::GetReflectivityByWaveLength(Float_t wavelength)
211 // Get RefractionIndex for given wavelenth
213 Float_t energy = khc / wavelength;
214 return Interpolate(energy, fEnergy, fReflectivity);
217 Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength)
220 // Get QuantumEfficiency for given wavelength
222 Float_t energy = khc / wavelength;
223 return Interpolate(energy, fEnergy, fQuantumEfficiency);
226 Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2)
229 // Interpolate array values
231 if (value < array1[0] && value >= array1[fSamples - 1]) {
232 Warning("Interpolate()", "Photon energy out of range. Returning 0.");
236 Int_t i = TMath::BinarySearch(fSamples, array1, value);
237 if (i == (fSamples-1)) {
240 return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i]));