MirrorSegment.cc
Go to the documentation of this file.
1 #include <fdet/MirrorSegment.h>
2 
3 #include <det/Detector.h>
4 #include <det/VManager.h>
5 
6 #include <utl/TabulatedFunction.h>
7 #include <utl/ErrorLogger.h>
8 
9 #include <sstream>
10 
11 using namespace std;
12 using namespace utl;
13 using namespace fdet;
14 using namespace det;
15 
16 
17 MirrorSegment::MirrorSegment() :
18  fRadiusOfCurvature(0),
19  fSigmaNormal(0),
20  fReflectivity(0)
21 {
22 }
23 
25 {
26  delete fRadiusOfCurvature;
27  delete fSigmaNormal;
28  delete fReflectivity;
29 }
30 
31 //TabulatedFunction MirrorSegment::GetReflectivity() const {
32 
33 //if (!fReflectivity) {
34 // fReflectivity = new TabulatedFunction;
35  //GetTelescopeData(*fReflectivity, "reflectivity", "mirror", "mirror reflectivity");
36 //}
37 //return *fReflectivity;
38 //}
39 
40 
41 
42 
43 
44 template <typename T>
45 inline
46 const T&
48  const std::string& property,
49  const std::string& component,
50  const std::string& errorMsg)
51  const
52 {
53  if (!requestedData) {
54  requestedData = new T;
55  GetMirrorSegmentData(*requestedData, property, component, errorMsg);
56  }
57  return *requestedData;
58 }
59 
60 
61 template <typename T>
62 inline
63 void
65  const std::string& property,
66  const std::string& component,
67  const std::string& errorMsg)
68  const
69 {
70  const VManager& manager = Detector::GetInstance().GetFManagerRegister();
71  VManager::IndexMap indexMap;
72 
73  //indexMap["eyeId"] = fEyeIdString;
74  //indexMap["telescopeId"] = fTelescopeIdString;
75  //indexMap["mirrorsegmentId"] = fTelescopeIdString;
76 
77  const VManager::Status foundFlag = manager.GetData(requestedData, property,
78  component, indexMap);
79 
80  if (foundFlag == VManager::eNotFound) {
81  ostringstream err;
82  err << "Did not find requested component: '" << errorMsg;
83  ERROR(err);
84  throw NonExistentComponentException(err.str());
85  }
86 }
87 
88 // Configure (x)emacs for this file ...
89 // Local Variables:
90 // mode:c++
91 // compile-command: "make -C .. FDetector/MirrorSegment.o -k"
92 // End:
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::map< std::string, std::string > IndexMap
Definition: VManager.h:133
utl::TabulatedFunction * fReflectivity
Definition: MirrorSegment.h:68
double * fRadiusOfCurvature
Definition: MirrorSegment.h:66
#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
const T & GetMirrorSegmentData(T *&requestedData, const std::string &property, const std::string &component, const std::string &errorMsg) const

, generated on Tue Sep 26 2023.