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 fRefractionIndex = new Float_t[fSamples];
61 fQuantumEfficiency = new Float_t[fSamples];
62 fReflectivity = new Float_t[fSamples];
64 for (Int_t i = 0; i < fSamples; i++) {
65 fEnergy[i] = ppckov[i];
66 fWaveLength[i] = khc / ppckov[i];
68 fAbsorptionCoefficient[i] = 1./ absco[i];
70 fAbsorptionCoefficient[i] = 1.e15;
72 fRefractionIndex[i] = rindex[i];
73 fQuantumEfficiency[i] = effic[i];
75 // Find local maximum quantum efficiency
76 if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i];
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;
80 // G3 way to define metal
81 if (rindex[0] == 0.) {
83 fReflectivity[i] = absco[i];
86 // Find global maximum quantum efficiency
87 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
88 SetGlobalMaximumEfficiency(fMaximumEfficiency);
92 TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex, Float_t *refl)
94 // Constructor including reflectivity
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];
103 for (Int_t i = 0; i < fSamples; i++) {
104 fEnergy[i] = ppckov[i];
105 fWaveLength[i] = khc / ppckov[i];
107 fAbsorptionCoefficient[i] = 1./ absco[i];
109 fAbsorptionCoefficient[i] = 1.e15;
111 fRefractionIndex[i] = rindex[i];
112 fQuantumEfficiency[i] = effic[i];
114 // Find local maximum quantum efficiency
115 if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i];
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;
122 // Find global maximum quantum efficiency
123 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
124 SetGlobalMaximumEfficiency(fMaximumEfficiency);
126 fReflectivity = new Float_t[fSamples];
127 for (Int_t i = 0; i < fSamples; i++) fReflectivity[i] = refl[i];
131 Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy)
134 // Get AbsorptionCoefficient for given energy
136 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
140 Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy)
143 // Get RefractionIndex for given energy
145 return Interpolate(energy, fEnergy, fRefractionIndex);
149 Float_t TFlukaCerenkov::GetReflectivity(Float_t energy)
152 // Get RefractionIndex for given energy
154 return Interpolate(energy, fEnergy, fReflectivity);
158 Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy)
161 // Get QuantumEfficiency for given energy
163 return Interpolate(energy, fEnergy, fQuantumEfficiency);
168 Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength)
171 // Get AbsorptionCoefficient for given wavelength
173 Float_t energy = khc / wavelength;
174 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
178 Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength)
181 // Get RefractionIndex for given wavelenth
183 Float_t energy = khc / wavelength;
184 return Interpolate(energy, fEnergy, fRefractionIndex);
187 Float_t TFlukaCerenkov::GetReflectivityByWaveLength(Float_t wavelength)
190 // Get RefractionIndex for given wavelenth
192 Float_t energy = khc / wavelength;
193 return Interpolate(energy, fEnergy, fReflectivity);
196 Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength)
199 // Get QuantumEfficiency for given wavelength
201 Float_t energy = khc / wavelength;
202 return Interpolate(energy, fEnergy, fQuantumEfficiency);
205 Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2)
208 // Interpolate array values
210 if (value < array1[0] && value >= array1[fSamples - 1]) {
211 Warning("Interpolate()", "Photon energy out of range. Returning 0.");
215 Int_t i = TMath::BinarySearch(fSamples, array1, value);
216 if (i == (fSamples-1)) {
219 return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i]));