From: morsch Date: Tue, 30 Mar 2004 08:56:50 +0000 (+0000) Subject: Class to store optical properties for cerenkov photon transport. X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=70f12a9d0ee263341fa1dce8c1b0cbc2a2ae493d Class to store optical properties for cerenkov photon transport. --- diff --git a/TFluka/TFlukaCerenkov.cxx b/TFluka/TFlukaCerenkov.cxx new file mode 100644 index 00000000000..30e1da99286 --- /dev/null +++ b/TFluka/TFlukaCerenkov.cxx @@ -0,0 +1,115 @@ +#include "TFlukaCerenkov.h" + +ClassImp(TFlukaCerenkov); + + +TFlukaCerenkov::TFlukaCerenkov() + : fSamples(0), + fIsMetal(0), + fEnergy(0), + fWaveLength(0), + fAbsorptionCoefficient(0), + fQuantumEfficiency(0), + fRefractionIndex(0) +{ +// Default constructor +} + + +TFlukaCerenkov::TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex) +{ +// Constructor + fSamples = npckov; + fEnergy = new Float_t[fSamples]; + fWaveLength = new Float_t[fSamples]; + fAbsorptionCoefficient = new Float_t[fSamples]; + fRefractionIndex = new Float_t[fSamples]; + fQuantumEfficiency = new Float_t[fSamples]; + for (Int_t i = 0; i < fSamples; i++) { + fEnergy[i] = ppckov[i]; + fWaveLength[i] = khc / ppckov[i]; + if (absco[i] > 0.) { + fAbsorptionCoefficient[i] = 1./ absco[i]; + } else { + fAbsorptionCoefficient[i] = 1.e15; + } + fRefractionIndex[i] = rindex[i]; + fQuantumEfficiency[i] = effic[i]; + if (effic[i] < 1. && effic[i] > 0.) fIsMetal = 1; + } +} + +Float_t TFlukaCerenkov::GetAbsorptionCoefficient(Float_t energy) +{ +// +// Get AbsorptionCoefficient for given energy +// + return Interpolate(energy, fEnergy, fAbsorptionCoefficient); + +} + +Float_t TFlukaCerenkov::GetRefractionIndex(Float_t energy) +{ +// +// Get RefractionIndex for given energy +// + return Interpolate(energy, fEnergy, fRefractionIndex); + +} + +Float_t TFlukaCerenkov::GetQuantumEfficiency(Float_t energy) +{ +// +// Get QuantumEfficiency for given energy +// + return Interpolate(energy, fEnergy, fQuantumEfficiency); + +} + + +Float_t TFlukaCerenkov::GetAbsorptionCoefficientByWaveLength(Float_t wavelength) +{ +// +// Get AbsorptionCoefficient for given wavelength +// + Float_t energy = khc / wavelength; + return Interpolate(energy, fEnergy, fAbsorptionCoefficient); + +} + +Float_t TFlukaCerenkov::GetRefractionIndexByWaveLength(Float_t wavelength) +{ +// +// Get RefractionIndex for given wavelenth +// + Float_t energy = khc / wavelength; + return Interpolate(energy, fEnergy, fRefractionIndex); +} + +Float_t TFlukaCerenkov::GetQuantumEfficiencyByWaveLength(Float_t wavelength) +{ +// +// Get QuantumEfficiency for given wavelength +// + Float_t energy = khc / wavelength; + return Interpolate(energy, fEnergy, fQuantumEfficiency); +} + +Float_t TFlukaCerenkov::Interpolate(Float_t value, Float_t* array1, Float_t* array2) +{ +// +// Interpolate array values +// + if (value < array1[0] && value >= array1[fSamples - 1]) { + Warning("Interpolate()", "Photon energy out of range. Returning 0."); + return (0.); + } + + Int_t i = TMath::BinarySearch(fSamples, array1, value); + if (i == (fSamples-1)) { + return (array2[i]); + } else { + return (array2[i] + (array2[i+1] - array2[i]) / (array1[i+1] - array1[i]) * (value - array1[i])); + } +} + diff --git a/TFluka/TFlukaCerenkov.h b/TFluka/TFlukaCerenkov.h new file mode 100644 index 00000000000..cb1f3814c5a --- /dev/null +++ b/TFluka/TFlukaCerenkov.h @@ -0,0 +1,61 @@ +#ifndef TFLUKACERENKOV +#define TFLUKACERENKOV + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +// // +// // +// Class that gives access to optical properties for Cerenkov photon // +// production and transport // +// // +// // +/////////////////////////////////////////////////////////////////////////////// + + +#include +#include + +const Double_t khc = 2. * TMath::Pi() * 0.1973269602e-13; // GeV cm + + +class TFlukaCerenkov : public TObject +{ + +public: + // constructors + TFlukaCerenkov(); + TFlukaCerenkov(Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex); + virtual Float_t GetAbsorptionCoefficient(Float_t energy); + virtual Float_t GetQuantumEfficiency(Float_t energy); + virtual Float_t GetRefractionIndex(Float_t energy); + virtual Float_t GetAbsorptionCoefficientByWaveLength(Float_t energy); + virtual Float_t GetQuantumEfficiencyByWaveLength(Float_t energy); + virtual Float_t GetRefractionIndexByWaveLength(Float_t energy); + virtual Float_t GetMinimumEnergy() {return fEnergy[0];} + virtual Float_t GetMaximumEnergy() {return fEnergy[fSamples-1];} + virtual Float_t GetMinimumWavelength() {return khc / fEnergy[fSamples-1];} + virtual Float_t GetMaximumWavelength() {return khc / fEnergy[0];} + virtual Int_t GetNSamples() {return fSamples;} + virtual Bool_t IsMetal() {return fIsMetal;} + + protected: + virtual Float_t Interpolate(Float_t energy, Float_t* array1, Float_t* array2); + + protected: + Int_t fSamples; // Number of sampling points + Bool_t fIsMetal; // Flag for metals + Float_t* fEnergy; // [fSamples] Energy (GeV) + Float_t* fWaveLength; // [fSamples] Wafelength (cm) + Float_t* fAbsorptionCoefficient; // [fSamples] Absorption Coefficient (1/cm) + Float_t* fQuantumEfficiency; // [fSamples] Quantum efficiency + Float_t* fRefractionIndex; // [fSamples] Refraction Index + + ClassDef(TFlukaCerenkov, 1) // CerenkovProperties +}; + +#endif +