11 #include <fwk/CentralConfig.h>
12 #include <fwk/RunController.h>
14 #include <utl/Reader.h>
15 #include <utl/TimeStamp.h>
16 #include <utl/UTCDateTime.h>
17 #include <utl/ErrorLogger.h>
19 #include <det/Detector.h>
21 #include <fdet/FDetector.h>
22 #include <fdet/EventPointingManager.h>
24 #include <evt/Event.h>
25 #include <fevt/FEvent.h>
27 #include <fevt/Telescope.h>
46 ERROR(
"No configuration file found ....");
51 const string id = FindComponent<string>(
"id", cB.GetAttributes());
53 cB.GetChild(
"minElevation").GetData(pointing.minElevation);
54 cB.GetChild(
"maxElevation").GetData(pointing.maxElevation);
56 if (pointing.minElevation > pointing.maxElevation) {
58 err <<
"You defined minimal elevation larger than maximal elevation! Please fix!\n"
59 <<
" Error in : id=" <<
id
60 <<
" minElevation=" << pointing.minElevation/
deg <<
" deg, "
61 <<
" maxElevation=" << pointing.maxElevation/
deg <<
" deg\n";
66 for (vector<Pointing>::const_iterator iP = fPointings.begin();
67 iP != fPointings.end(); ++iP) {
68 if ((pointing.minElevation > iP->minElevation &&
69 pointing.minElevation < iP->maxElevation ) ||
70 (pointing.maxElevation > iP->minElevation &&
71 pointing.maxElevation < iP->maxElevation ) ||
72 (pointing.minElevation < iP->minElevation &&
73 pointing.maxElevation > iP->maxElevation ) ||
74 (
id == iP->pointingId) ) {
76 err <<
"You defined overlapping pointing elevation ranges! Please fix!\n"
77 <<
" Range with problem: id=" <<
id
78 <<
" minElevation=" << pointing.minElevation/
deg <<
" deg, "
79 <<
" maxElevation=" << pointing.maxElevation/
deg <<
" deg\n"
80 <<
" overlapping with: id=" << iP->pointingId
81 <<
" minElevation=" << iP->minElevation/
deg <<
" deg, "
82 <<
" maxElevation=" << iP->maxElevation/
deg <<
" deg";
87 fPointings.push_back(pointing);
94 EventPointingManager::GetPointing(
string& returnData,
95 const string& componentProperty,
100 if (componentProperty !=
"pointing")
103 IndexMap::const_iterator iEyeId, iTelId;
104 iEyeId = componentIndex.find(
"eyeId");
105 iTelId = componentIndex.find(
"telescopeId");
106 if (iEyeId == componentIndex.end() ||
107 iTelId == componentIndex.end()) {
108 INFO(
"Called EventPointingManager with wrong number of arguments!");
113 istringstream ssEyeId(iEyeId->second);
115 istringstream ssTelId(iTelId->second);
120 returnData =
"downward";
134 const evt::Event&
event = fwk::RunController::GetInstance().GetCurrentEvent();
135 if (!event.HasFEvent())
148 istringstream pointingSS(pointing);
152 if (what ==
"data:") {
156 for (vector<Pointing>::const_iterator iP = fPointings.begin();
157 iP != fPointings.end(); ++iP) {
158 if (angle > iP->minElevation/
deg && angle < iP->maxElevation/
deg) {
159 returnData = iP->pointingId;
163 if (IsReportingErrors()) {
165 info <<
"Pointing for angle=" << angle <<
" not defined. Available settings are:";
166 for (vector<Pointing>::const_iterator iP = fPointings.begin();
167 iP != fPointings.end(); ++iP) {
168 info <<
"\n id=" << iP->pointingId <<
","
169 <<
" minElevation=" << iP->minElevation/
deg <<
" deg, "
170 <<
" maxElevation=" << iP->maxElevation/
deg <<
" deg";
177 else if (what ==
"sim:") {
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
Fluorescence Detector Eye Event.
std::string GetRawTelPointing() const
The pointing.
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Exception for errors encountered when parsing XML.
Branch GetNextSibling() const
Get next sibling of this branch.
Class representing a document branch.
Top of Fluorescence Detector event hierarchy.
Eye & GetEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
return Eye by id
reads the telescope point from the current Fd event
bool HasEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
#define REGISTER_F_MANAGER(_name_, _Type_)
std::map< std::string, std::string > IndexMap
bool HasTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the telescope is in the event.
Branch GetFirstChild() const
Get first child of this Branch.
Fluorescence Detector Telescope Event.
#define ERROR(message)
Macro for logging error messages.
Status
Specifies success or (eventually) various possible failure modes.