]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/TFlukaCerenkov.cxx
Possibility to define reflectivity of optical medium.
[u/mrichter/AliRoot.git] / TFluka / TFlukaCerenkov.cxx
CommitLineData
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 32Double_t TFlukaCerenkov::fgGlobalMaximumEfficiency = 0.;
33
70f12a9d 34ClassImp(TFlukaCerenkov);
35
36
37TFlukaCerenkov::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
53TFlukaCerenkov::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];
3a242b1f 62
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;
70f12a9d 80 }
3a242b1f 81 // Find global maximum quantum efficiency
82 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
83 SetGlobalMaximumEfficiency(fMaximumEfficiency);
84 }
70f12a9d 85}
86
b2be0e73 87TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex, Float_t *refl)
88{
89 // Constructor including reflectivity
90 fSamples = npckov;
91 fEnergy = new Float_t[fSamples];
92 fWaveLength = new Float_t[fSamples];
93 fAbsorptionCoefficient = new Float_t[fSamples];
94 fRefractionIndex = new Float_t[fSamples];
95 fQuantumEfficiency = new Float_t[fSamples];
96
97
98 for (Int_t i = 0; i < fSamples; i++) {
99 fEnergy[i] = ppckov[i];
100 fWaveLength[i] = khc / ppckov[i];
101 if (absco[i] > 0.) {
102 fAbsorptionCoefficient[i] = 1./ absco[i];
103 } else {
104 fAbsorptionCoefficient[i] = 1.e15;
105 }
106 fRefractionIndex[i] = rindex[i];
107 fQuantumEfficiency[i] = effic[i];
108 //
109 // Find local maximum quantum efficiency
110 if (effic[i] > fMaximumEfficiency) fMaximumEfficiency = effic[i];
111 //
112 // Flag is sensitive if quantum efficiency 0 < eff < 1 for at least one value.
113 if (effic[i] < 1. && effic[i] > 0.) fIsSensitive = 1;
114 }
115 // Find global maximum quantum efficiency
116 if (fMaximumEfficiency > GetGlobalMaximumEfficiency()) {
117 SetGlobalMaximumEfficiency(fMaximumEfficiency);
118 }
119 fReflectivity = new Float_t[fSamples];
120 for (Int_t i = 0; i < fSamples; i++) fReflectivity[i] = refl[i];
121 fIsMetal = kTRUE;
122}
123
70f12a9d 124Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy)
125{
126//
127// Get AbsorptionCoefficient for given energy
128//
129 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
130
131}
132
133Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy)
134{
135//
136// Get RefractionIndex for given energy
137//
138 return Interpolate(energy, fEnergy, fRefractionIndex);
139
140}
141
b2be0e73 142Float_t TFlukaCerenkov::GetReflectivity(Float_t energy)
143{
144//
145// Get RefractionIndex for given energy
146//
147 return Interpolate(energy, fEnergy, fReflectivity);
148
149}
150
70f12a9d 151Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy)
152{
153//
154// Get QuantumEfficiency for given energy
155//
156 return Interpolate(energy, fEnergy, fQuantumEfficiency);
157
158}
159
160
161Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength)
162{
163//
164// Get AbsorptionCoefficient for given wavelength
165//
166 Float_t energy = khc / wavelength;
167 return Interpolate(energy, fEnergy, fAbsorptionCoefficient);
168
169}
170
171Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength)
172{
173//
174// Get RefractionIndex for given wavelenth
175//
176 Float_t energy = khc / wavelength;
177 return Interpolate(energy, fEnergy, fRefractionIndex);
178}
179
b2be0e73 180Float_t TFlukaCerenkov::GetReflectivityByWaveLength(Float_t wavelength)
181{
182//
183// Get RefractionIndex for given wavelenth
184//
185 Float_t energy = khc / wavelength;
186 return Interpolate(energy, fEnergy, fReflectivity);
187}
188
70f12a9d 189Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength)
190{
191//
192// Get QuantumEfficiency for given wavelength
193//
194 Float_t energy = khc / wavelength;
195 return Interpolate(energy, fEnergy, fQuantumEfficiency);
196}
197
198Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2)
199{
200//
201// Interpolate array values
202//
203 if (value < array1[0] && value >= array1[fSamples - 1]) {
204 Warning("Interpolate()", "Photon energy out of range. Returning 0.");
205 return (0.);
206 }
207
208 Int_t i = TMath::BinarySearch(fSamples, array1, value);
209 if (i == (fSamples-1)) {
210 return (array2[i]);
211 } else {
212 return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i]));
213 }
214}
215