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),
46 fMaximumEfficiency(0.)
48 // Default constructor
52 TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex)
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];
62 for (Int_t i = 0; i < fSamples; i++) {
63 fEnergy[i] = ppckov[i];
64 fWaveLength[i] = khc / ppckov[i];
66 fAbsorptionCoefficient[i] = 1./ absco[i];
68 fAbsorptionCoefficient[i] = 1.e15;
70 fRefractionIndex[i] = rindex[i];
71 fQuantumEfficiency[i] = effic[i];
73 // Find local maximum quantum efficiency
74 if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i];
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;
79 // Find global maximum quantum efficiency
80 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
81 SetGlobalMaximumEfficiency(fMaximumEfficiency);
85 Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy)
88 // Get AbsorptionCoefficient for given energy
90 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
94 Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy)
97 // Get RefractionIndex for given energy
99 return Interpolate(energy, fEnergy, fRefractionIndex);
103 Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy)
106 // Get QuantumEfficiency for given energy
108 return Interpolate(energy, fEnergy, fQuantumEfficiency);
113 Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength)
116 // Get AbsorptionCoefficient for given wavelength
118 Float_t energy = khc / wavelength;
119 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
123 Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength)
126 // Get RefractionIndex for given wavelenth
128 Float_t energy = khc / wavelength;
129 return Interpolate(energy, fEnergy, fRefractionIndex);
132 Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength)
135 // Get QuantumEfficiency for given wavelength
137 Float_t energy = khc / wavelength;
138 return Interpolate(energy, fEnergy, fQuantumEfficiency);
141 Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2)
144 // Interpolate array values
146 if (value < array1[0] && value >= array1[fSamples - 1]) {
147 Warning("Interpolate()", "Photon energy out of range. Returning 0.");
151 Int_t i = TMath::BinarySearch(fSamples, array1, value);
152 if (i == (fSamples-1)) {
155 return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i]));