Corrector.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <sstream>
3 
4 #include <boost/lexical_cast.hpp>
5 
6 #include <fdet/Corrector.h>
7 
8 #include <utl/TabulatedFunction.h>
9 #include <utl/ErrorLogger.h>
10 
11 
12 #include <fdet/FDetector.h>
13 #include <fdet/Eye.h>
14 #include <fdet/Telescope.h>
15 #include <det/VManager.h>
16 #include <det/Detector.h>
17 
18 #include <utl/Math.h>
19 
20 using namespace std;
21 using namespace utl;
22 using namespace fdet;
23 using namespace det;
24 
25 
26 Corrector::Corrector(const unsigned int eyeId, const unsigned int telId,
27  const std::string& physEyeIdString,
28  const std::string& physTelIdString) :
29  fEyeId(eyeId),
30  fTelescopeId(telId),
31  fPhysicalEyeIdString(physEyeIdString),
32  fPhysicalTelescopeIdString(physTelIdString),
33  fInnerRadius(0),
34  fOuterRadius(0),
35  fLensThickness(0),
36  fSigmaNormal(0),
37  fTransmittance(0),
38  fRefractiveIndex(0)
39 {
40 }
41 
42 
44 {
45  delete fInnerRadius;
46  delete fOuterRadius;
47  delete fLensThickness;
48  delete fSigmaNormal;
49  delete fTransmittance;
50  delete fRefractiveIndex;
51 }
52 
54 
55  //std::list<CorrectorSegment*> fSegment;
56 
57  delete fInnerRadius;
58  fInnerRadius = 0;
59 
60  delete fOuterRadius;
61  fOuterRadius = 0;
62 
63  delete fLensThickness;
64  fLensThickness = 0;
65 
66  delete fSigmaNormal;
67  fSigmaNormal = 0;
68 
69  delete fTransmittance;
70  fTransmittance = 0;
71 
72  delete fRefractiveIndex;
73  fRefractiveIndex = 0;
74 }
75 
76 
77 double
79  const
80 {
81  return GetCorrectorData(fInnerRadius, "innerRadius", "corrector", "corrector ring inner radius");
82 }
83 
84 
85 double
87  const
88 {
89  return GetCorrectorData(fOuterRadius, "outerRadius", "corrector", "corrector ring outer radius");
90 }
91 
92 
93 double
95  const
96 {
97  return GetCorrectorData(fLensThickness, "lensThickness", "corrector", "corrector lens mean thickness");
98 }
99 
100 
101 double
103  const
104 {
105  return GetCorrectorData(fSigmaNormal, "sigmaNormal", "corrector", "corrector lens sigma normal");
106 }
107 
108 
109 const TabulatedFunction&
111  const
112 {
113  return GetCorrectorData(fTransmittance, "transmittance", "corrector", "corrector lens transmittance");
114 }
115 
116 
117 const TabulatedFunction&
119  const
120 {
121  // -------------------
122  // Tilo's KA prototyp:
123  // return 1.476 + pow ((69.*nanometer/lambda), 2);
124  // -------------------
125 
126  // Schott BK7 glass
127  // input: wave length lambda of transmittance
128 
129  // data from
130  // http://www.schott.com/optics_devices/german/download/schott-11-01-2006.zip
131 
132  if (!fRefractiveIndex) {
133 
135  const TabulatedFunction& trans = GetTransmittance();
136 
137  const double b1 = 1.039612120E+00;
138  const double c1 = 6.000698670E-03;
139  const double b2 = 2.317923440E-01;
140  const double c2 = 2.001791440E-02;
141  const double b3 = 1.010469450E+00;
142  const double c3 = 1.035606530E+02;
143 
144  // dispersion relation from
145  // http://www.schott.com/optics_devices/german/download/katalog-optisches-glas-infos-2003.pdf
146 
147  const TabulatedFunction::ConstIterator transEnd = trans.End();
148  for (TabulatedFunction::ConstIterator iWl = trans.Begin();
149  iWl != transEnd; ++iWl) {
150 
151  const double lambda = iWl->X() / nanometer;
152  const double l2 = Sqr(lambda)*1.e-6;
153  const double n = sqrt(b1*l2/(l2-c1) + b2*l2/(l2-c2) + b3*l2/(l2-c3) + 1);
154  fRefractiveIndex->PushBack(lambda*nanometer, n);
155 
156  }
157 
158  }
159 
160  return *fRefractiveIndex;
161 }
162 
163 
164 template<typename T>
165 inline
166 const T&
167 Corrector::GetCorrectorData(T*& requestedData,
168  const string& property,
169  const string& component,
170  const string& errorMsg)
171  const
172 {
173  if (!requestedData) {
174 
175  requestedData = new T;
176 
177  const VManager& manager = Detector::GetInstance().GetFManagerRegister();
178 
179  VManager::IndexMap indexMap;
180  indexMap["eyeId"] = fPhysicalEyeIdString;
181  indexMap["telescopeId"] = fPhysicalTelescopeIdString;
182 
183  const VManager::Status status =
184  manager.GetData(*requestedData, property, component, indexMap);
185 
186  if (status == VManager::eNotFound) {
187 
188  ostringstream err;
189  err << "Did not find requested component for " << errorMsg << "; "
190  << VManager::QueryInfoMessage(property, component, indexMap);
191  ERROR(err);
192  throw NonExistentComponentException(err.str());
193  }
194  }
195 
196  return *requestedData;
197 }
198 
199 
200 // Configure (x)emacs for this file ...
201 // Local Variables:
202 // mode: c++
203 // compile-command: "make -C .. FDetector/Corrector.o -k"
204 // End:
constexpr T Sqr(const T &x)
std::string fPhysicalEyeIdString
Definition: Corrector.h:60
const T & GetCorrectorData(T *&requestedData, const std::string &property, const std::string &component, const std::string &errorMsg) const
Definition: Corrector.cc:167
double GetInnerRadius() const
Inner radius of the ring.
Definition: Corrector.cc:78
double * fInnerRadius
Definition: Corrector.h:78
Class to hold collection (x,y) points and provide interpolation between them.
const utl::TabulatedFunction & GetTransmittance() const
Transmittance as a function of the wavelength.
Definition: Corrector.cc:110
Base class for exceptions trying to access non-existing components.
Interface for detector managers.
Definition: VManager.h:115
void PushBack(const double x, const double y)
double * fOuterRadius
Definition: Corrector.h:79
double GetSigmaNormal() const
Variable to model the lens surface imperfection.
Definition: Corrector.cc:102
constexpr double nanometer
Definition: AugerUnits.h:102
double X() const
Definition: Pair.h:31
virtual Status GetData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
double GetOuterRadius() const
Outer radius of the ring.
Definition: Corrector.cc:86
std::string fPhysicalTelescopeIdString
Definition: Corrector.h:61
double * fSigmaNormal
Definition: Corrector.h:81
fTelescopeId(t.GetTelescopeId())
double * fLensThickness
Definition: Corrector.h:80
const utl::TabulatedFunction & GetRefractiveIndex() const
Index of refraction as a funcction of the wavelength.
Definition: Corrector.cc:118
utl::TabulatedFunction * fTransmittance
Definition: Corrector.h:82
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
utl::TabulatedFunction * fRefractiveIndex
Definition: Corrector.h:83
double GetMeanLensThickness() const
Mean thickness of the lens.
Definition: Corrector.cc:94
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127

, generated on Tue Sep 26 2023.