Framework/FDetector/Mirror.cc
Go to the documentation of this file.
1 #include <sstream>
2 
3 #include <boost/lexical_cast.hpp>
4 
5 #include <fdet/Mirror.h>
6 
7 #include <fdet/FDetector.h>
8 #include <fdet/Eye.h>
9 #include <fdet/Telescope.h>
10 
11 #include <utl/TabulatedFunction.h>
12 #include <utl/ErrorLogger.h>
13 
14 #include <det/VManager.h>
15 #include <det/Detector.h>
16 
17 using namespace std;
18 using namespace utl;
19 using namespace fdet;
20 using namespace det;
21 
22 
23 Mirror::Mirror(const unsigned int eyeId, const unsigned int telId,
24  const std::string& physEyeIdString,
25  const std::string& physTelIdString) :
26  fEyeId(eyeId),
27  fTelescopeId(telId),
28  fPhysicalEyeIdString(physEyeIdString),
29  fPhysicalTelescopeIdString(physTelIdString),
30  fRadiusOfCurvature(0),
31  fSigmaNormal(0),
32  fReflectivity(0)
33 {
34 }
35 
36 
38 {
39  delete fRadiusOfCurvature;
40  delete fSigmaNormal;
41  delete fReflectivity;
42 }
43 
45 
46  delete fRadiusOfCurvature;
48 
49  delete fSigmaNormal;
50  fSigmaNormal = 0;
51 
52  delete fReflectivity;
53  fReflectivity = 0;
54 }
55 
56 
57 double
59  const
60 {
61  return GetMirrorData(fRadiusOfCurvature, "radius", "mirror", "mirror radius of curvature");
62 }
63 
64 
65 double
67  const
68 {
69  return GetMirrorData(fSigmaNormal, "sigmaNormal", "mirror", "mirror sigma normal");
70 }
71 
72 
73 const TabulatedFunction&
75  const
76 {
77  return GetMirrorData(fReflectivity, "reflectivity", "mirror", "mirror reflectivity");
78 }
79 
80 
81 template<typename T>
82 inline
83 const T&
84 Mirror::GetMirrorData(T*& requestedData,
85  const std::string& property,
86  const std::string& component,
87  const std::string& errorMsg)
88  const
89 {
90  if (!requestedData) {
91  requestedData = new T;
92  GetMirrorData(*requestedData, property, component, errorMsg);
93  }
94  return *requestedData;
95 }
96 
97 
98 template<typename T>
99 inline
100 void
101 Mirror::GetMirrorData(T& requestedData,
102  const std::string& property,
103  const std::string& component,
104  const std::string& errorMsg)
105  const
106 {
107  const VManager& manager = Detector::GetInstance().GetFManagerRegister();
108 
109  VManager::IndexMap indexMap;
110  indexMap["eyeId"] = fPhysicalEyeIdString;
111  indexMap["telescopeId"] = fPhysicalTelescopeIdString;
112 
113  const VManager::Status foundFlag =
114  manager.GetData(requestedData, property, component, indexMap);
115 
116  if (foundFlag == VManager::eNotFound) {
117  ostringstream err;
118  err << "Did not find requested component for " << errorMsg<< "; "
119  << VManager::QueryInfoMessage(property, component, indexMap);
120  ERROR(err);
121  throw NonExistentComponentException(err.str());
122  }
123 }
124 
125 
126 // Configure (x)emacs for this file ...
127 // Local Variables:
128 // mode: c++
129 // compile-command: "make -C .. FDetector/Mirror.o -k"
130 // End:
double GetSigmaNormal() const
Variable to model the mirror surface imperfection.
Class to hold collection (x,y) points and provide interpolation between them.
const T & GetMirrorData(T *&requestedData, const std::string &property, const std::string &component, const std::string &errorMsg) const
Base class for exceptions trying to access non-existing components.
Interface for detector managers.
Definition: VManager.h:115
virtual Status GetData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
std::string fPhysicalTelescopeIdString
std::string fPhysicalEyeIdString
const utl::TabulatedFunction & GetReflectivity() const
Average reflectivity of the segments as a function of the wavelength.
fTelescopeId(t.GetTelescopeId())
utl::TabulatedFunction * fReflectivity
double GetRadiusOfCurvature() const
Average radius of curvature for the segments.
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
#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.