6 #include <boost/lexical_cast.hpp>
8 #include <fdet/FFixCalibManager.h>
9 #include <fwk/CentralConfig.h>
10 #include <det/Detector.h>
12 #include <utl/ErrorLogger.h>
13 #include <utl/TimeStamp.h>
14 #include <utl/UTCDateTime.h>
15 #include <utl/Reader.h>
16 #include <utl/TabulatedFunction.h>
17 #include <utl/AugerException.h>
18 #include <utl/ShadowPtr.h>
20 #include <fdet/FManagerRegister.h>
21 #include <fdet/FDetector.h>
22 #include <fdet/Telescope.h>
37 fHasDefaultCalibConst =
false;
41 if (fHasDefaultCalibConst)
42 info <<
"fixed calibration constant is " << fCalibConst <<
" ph/ADC";
44 info <<
" no default fixed calibration constant";
46 if (!fPerTelescopeCalibConst.empty()) {
47 for (map<
int, map<int, double> >::const_iterator eyeIt = fPerTelescopeCalibConst.begin(),
48 eyeEnd = fPerTelescopeCalibConst.end(); eyeIt != eyeEnd; ++eyeIt) {
50 for (map<int, double>::const_iterator telIt = eyeIt->second.begin(),
51 telEnd = eyeIt->second.end(); telIt != telEnd; ++telIt) {
53 info <<
"\n Override eye " << eyeIt->first <<
" tel " << telIt->first
54 <<
": " << telIt->second <<
" ph/ADC";
64 FFixCalibManager::Initialize()
66 Branch defaultCalConstBranch = fBranch.
GetChild(
"fixedCalibrationConstant");
67 if (defaultCalConstBranch) {
68 defaultCalConstBranch.
GetData(fCalibConst);
69 fHasDefaultCalibConst =
true;
71 fHasDefaultCalibConst =
false;
82 AttributeMap::const_iterator attrEnd = attrs.end();
83 AttributeMap::const_iterator eyeIdIt = attrs.find(
"eyeId");
84 AttributeMap::const_iterator telIdIt = attrs.find(
"telId");
85 if (eyeIdIt == attrEnd || telIdIt == attrEnd) {
86 ERROR(
"telescopeCalibrationConstant tag is missing eyeId or telId attributes!");
89 const int eyeId = boost::lexical_cast<
int>(eyeIdIt->second);
90 const int telId = boost::lexical_cast<
int>(telIdIt->second);
91 fPerTelescopeCalibConst[eyeId][telId] = caliConst;
100 fAvailableComponents.insert(
"pixel_calibs");
101 fAvailableComponents.insert(
"status");
102 fAvailableComponents.insert(
"start_time");
103 fAvailableComponents.insert(
"end_time");
110 FFixCalibManager::GetData(
double& ,
111 const string& componentProperty,
112 const string& componentName,
117 if (componentName !=
"fd_calib")
121 if (fAvailableComponents.find(componentProperty) == fAvailableComponents.end())
129 FFixCalibManager::GetData(map<int, utl::TabulatedFunction>& returnData,
130 const string& componentProperty,
131 const string& componentName,
132 const IndexMap& componentIndex)
136 if (componentName !=
"fd_calib")
140 if (fAvailableComponents.find(componentProperty) == fAvailableComponents.end())
145 if (componentProperty ==
"pixel_calibs") {
146 const fdet::FDetector& fdet = det::Detector::GetInstance().GetFDetector();
149 const string& eyeIdString = componentIndex.find(
"eyeId")->second;
150 const string& telescopeIdString = componentIndex.find(
"telescopeId")->second;
151 const int eyeId = boost::lexical_cast<
int>(eyeIdString);
152 const int telId = boost::lexical_cast<
int>(telescopeIdString);
154 double calibConst = 0;
155 if (GetCalibConstForTelescope(eyeId, telId, calibConst)) {
157 for (
int iPix = 1; iPix <= 440; ++iPix) {
159 calVsWavelength.
PushBack(wavelength, calibConst);
160 returnData.insert(make_pair(iPix, calVsWavelength));
172 FFixCalibManager::GetCalibConstForTelescope(
const unsigned int eyeId,
173 const unsigned int telId,
177 map<int, map<int, double> >::const_iterator eyeIt = fPerTelescopeCalibConst.find(eyeId);
178 if (eyeIt == fPerTelescopeCalibConst.end()) {
179 if (fHasDefaultCalibConst) {
186 map<int, double>::const_iterator telIt = eyeIt->second.find(telId);
187 if (telIt == eyeIt->second.end()) {
188 if (fHasDefaultCalibConst) {
195 value = telIt->second;
201 FFixCalibManager::GetData(vector<int>& returnData,
202 const string& componentProperty,
203 const string& componentName,
207 if (componentProperty !=
"status" || componentName !=
"fd_calib")
210 returnData.resize(441, 0);
216 FFixCalibManager::GetData(
int& returnData,
217 const string& componentProperty,
218 const string& componentName,
223 if (componentName !=
"fd_calib")
227 if (fAvailableComponents.find(componentProperty) == fAvailableComponents.end())
230 if (componentProperty ==
"start_time") {
236 if (componentProperty ==
"end_time") {
Class to hold collection (x,y) points and provide interpolation between them.
std::map< std::string, std::string > AttributeMap
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
void PushBack(const double x, const double y)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Manager for FD calibration with fixed constants.
Detector description interface for FDetector-related data.
AttributeMap GetAttributes() const
Get a map<string, string> containing all the attributes of this Branch.
Branch GetNextSibling() const
Get next sibling of this branch.
Class representing a document branch.
void GetData(bool &b) const
Overloads of the GetData member template function.
double GetReferenceLambda() const
unsigned long GetGPSSecond() const
GPS second.
#define REGISTER_F_MANAGER(_name_, _Type_)
Branch GetFirstChild() const
Get first child of this Branch.
#define ERROR(message)
Macro for logging error messages.
TimeStamp GetTimeStamp() const
Status
Specifies success or (eventually) various possible failure modes.