#ifndef _fdet_Eye_h_ #define _fdet_Eye_h_ #include #include #include #include #include #include namespace utl { class Point; class TabulatedFunction; class TimeInterval; } namespace det{ class Detector; } namespace fdet { class Telescope; class FDetector; //! Predicate specifying whether telescope is commissioned struct TelIsCommissioned { bool operator()(const fdet::Telescope& tel) const; }; /** \class Eye \brief Detector description interface for Eye-related data \author S. Argiro \author T. Paul \version $Id: Eye.h 17317 2010-07-09 14:30:16Z smueller $ \date 23 Jun 2003 \ingroup fdet */ class Eye { private: typedef std::list FullTelescopeIdList; typedef std::list FullTelescopeList; typedef FullTelescopeList::iterator FullTelescopeIterator; typedef FullTelescopeList::const_iterator FullTelescopeConstIterator; typedef boost::indirect_iterator InternalTelescopeIterator; typedef boost::indirect_iterator InternalConstTelescopeIterator; InternalTelescopeIterator FullTelescopesBegin() { return InternalTelescopeIterator(fFullTelescopeList.begin()); } InternalConstTelescopeIterator FullTelescopesBegin() const { return InternalConstTelescopeIterator(fFullTelescopeList.begin()); } InternalTelescopeIterator FullTelescopesEnd() { return InternalTelescopeIterator(fFullTelescopeList.end()); } InternalConstTelescopeIterator FullTelescopesEnd() const { return InternalConstTelescopeIterator(fFullTelescopeList.end()); } public: /// First telescope id in the eye unsigned int GetFirstTelescopeId() const; /// Last telescope id in the eye unsigned int GetLastTelescopeId() const; /// An iterator over telescopes typedef boost::filter_iterator TelescopeIterator; /// Beginning of the collection of telescopes TelescopeIterator TelescopesBegin() const { return TelescopeIterator(TelIsCommissioned(), FullTelescopesBegin(), FullTelescopesEnd()); } /// End of the collection of telescopes TelescopeIterator TelescopesEnd() const { return TelescopeIterator(TelIsCommissioned(), FullTelescopesEnd(), FullTelescopesEnd()); } /// Find Telescope by numerical Id const Telescope& GetTelescope(const unsigned int telescopeId) const; /// Eye position const utl::Point& GetPosition() const; /// Returns the Eye Coordinate system /** Eye Coordinate system : -x axis parallel to backwall and pointing right -y axis parallel to division between bays 3 and 4, pointing out -z axis parallel to the vertical -origin in the center of the eye (including the elevation) */ utl::CoordinateSystemPtr GetEyeCoordinateSystem() const; /// The Auger coordinate system (x to east, z local verical) for this eye /** The origin is tangent to the reference ellipsoid */ utl::CoordinateSystemPtr GetLocalCoordinateSystem() const; /** Returns the angle of the eye's back wall to the east. * For most practical purposes you should use the GetEyeCoordinateSystem * method instead! */ double GetBackwallAngle() const; /// Eye name const std::string& GetName() const; /// Eye numerical Id unsigned int GetId() const { return fEyeId; } /** Numerical Id of parent physical eye. * Returns the eye id if this is a physical eye */ unsigned int GetParentPhysicalId() const { return fIdOfParentPhysicalEye == 0 ? fEyeId : fIdOfParentPhysicalEye; } /** Id of parent physical eye as string. * Returns the eye id if this is a physical eye */ const std::string& GetParentPhysicalIdString() const { return fIdOfParentPhysicalEye == 0 ? fEyeIdString : fIdOfParentPhysicalEyeString; } /// Returns whether this eye is a virtual eye bool IsVirtual() const { return fIdOfParentPhysicalEye != 0; } /// Returns a list of eye id's that participate in this (virtual) eye std::set GetParticipatingEyeIds() const; ///Get the 10MHz oscillator correction factors ///X-axis is month+12*(year-2004) const utl::TabulatedFunction& GetTimeCorrectionFactors() const; /// Time Offset of this eye with respect to SD const utl::TimeInterval& GetSDTimeOffset() const; double GetUpTimeFraction() const; double GetFDASVetoFraction() const; double GetCDASVetoFraction() const; bool IsInAquisition() const; /// 0 == not in DAQ int GetDAQStatus() const; double GetModelMinWavelength() const; double GetModelMaxWavelength() const; private: Eye(const unsigned int eyeId); ~Eye(); Eye(const Eye&); Eye& operator=(const Eye&); void Update(); void GetFullTelescopeList() const; void UpdateFdUpTime() const; template inline const T& GetEyeData(T*& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg) const; template inline void GetEyeData(T& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg) const; unsigned int fEyeId; // Id held also as a string as that is what is passed through the manager interface std::string fEyeIdString; // If this is > 0, we have a virtual eye mutable int fIdOfParentPhysicalEye; std::string fIdOfParentPhysicalEyeString; mutable FullTelescopeList fFullTelescopeList; // List of all Telescopes available in the external sources // (external sources are, for example, the XML files containing // the telescope/eye list or perhaps at some point a MySQL database mutable FullTelescopeIdList* fFullTelescopeIdList; // Quantities filled by lazy evaluation // ------------------------------------ mutable utl::Point* fPosition; mutable std::string* fName; mutable utl::CoordinateSystemPtr fCoordinateSystem; mutable double* fBackwallAngle; // angle of the back wall from the east mutable utl::TabulatedFunction* fTimeCorrectionFactors; mutable utl::TimeInterval* fSDTimeOffset; // up time info mutable det::ValidityStamp fUpTimeValidityStamp; mutable double fUpTimeFraction; mutable double fCDASVetoFraction; mutable double fFDASVetoFraction; mutable int fStatus; friend class FDetector; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. FDetector/Eye.o -k" // End: