#ifndef _rdet_RDetector_h_ #define _rdet_RDetector_h_ #include #include #include #include #include #include #include #include #include namespace det { class Detector; } namespace utl { class NonExistentComponentException; class TabulatedFunctionComplexLgAmpPhase; } namespace revt { class Station; } namespace rdet { class Station; /** \class RDetector RDetector.h "rdet/RDetector.h" \brief Detector description interface for RDetector-related data \author J. Rautenberg \date Aug 2007 \version $Id$ \ingroup rdet */ class RDetector { private: typedef std::map InternalStationMap; typedef InternalStationMap::const_iterator InternalStationIterator; struct InternalStationFunctor { const rdet::Station& operator()(const InternalStationMap::value_type& pair) const { return *pair.second; } }; public: /// StationIterator returns a pointer to a station typedef boost::transform_iterator StationIterator; /// Beginning of the collection of pointers to commissioned stations StationIterator StationsBegin() const { return StationIterator(fFullStationMap.begin()); } /// End of the collection of pointers to commissioned stations StationIterator StationsEnd() const { return StationIterator(fFullStationMap.end()); } /// Get station by Station Id const Station& GetStation(const int stationId) const; /// Get rdet::Station from a revt::Station const Station& GetStation(const revt::Station& station) const; /// Get list of ID's for all stations available in the database or configuration file const std::vector& GetFullStationList() const; /// Get the response (TabulatedFunctionComplexLgAmpPhase) which corresponds to a hardware profile identifier const utl::TabulatedFunctionComplexLgAmpPhase& GetHardwareResponseProfile(const std::string& identifier) const; /// Get vector of Beacon Frequencies for given detector-time from Manager const std::vector& GetBeaconFrequencies() const; /// Get beacon reference phases for one station double GetBeaconReferencePhase(const int stationId, const double beaconFreq) const; unsigned long long int GetBadStationReason(const int stationId) const; double GetTemperature(const std::string& site) const; /// Helper method to do the redundant work of preparing requests for detector data, // sending it to the manager and reporting any errors. // The indexMap is not used here, but kept for the interface template void GetDetectorData(T*& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg, const det::VManager::IndexMap& indexMap = det::VManager::IndexMap()) const { if (!requestedData) { requestedData = new T; const det::VManager& manager = det::Detector::GetInstance().GetRManagerRegister(); const det::VManager::Status foundFlag = manager.GetData(*requestedData, property, component, indexMap); if (foundFlag == det::VManager::eNotFound) { std::ostringstream err; err << "Did not find requested component: " << errorMsg; ERROR(err); throw utl::NonExistentComponentException(err.str()); } } } private: RDetector(); ~RDetector(); const std::string fRDetectorName; RDetector(const RDetector& rdetector); RDetector& operator=(const RDetector& rdetector); void Update(); // List of all stations available in the external sources // (external sources are, for example, the XML file with // station list or perhaps some MySQL database) mutable utl::Validated > fFullStationList; //mutable std::vector fFullStationList; mutable InternalStationMap fFullStationMap; typedef std::map HardwareResponseProfileMap; mutable HardwareResponseProfileMap fHardwareResponseProfileMap; mutable std::vector* fBeaconFreq; mutable double* fBeaconReferencePhase; friend class det::Detector; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // End: