#ifndef _fdet_Telescope_h_ #define _fdet_Telescope_h_ /** \file \brief Detector description interface for Telescope-related data \author S. Argiro \author T. Paul \author Luis Prado Jr \version $Id: Telescope.h 17917 2010-11-03 15:51:37Z colin $ \date 23 Jun 2003 */ #include #include #include #include #include #include namespace utl { class Point; class Vector; class TimeStamp; } namespace det { class Detector; } namespace fevt { class Pixel; } namespace fdet { class Channel; class Diaphragm; class Filter; class Corrector; class Mirror; class Camera; class Eye; class Pixel; /** \class Telescope \brief Detector description interface for Telescope-related data \author S. Argiro \author T. Paul \author Luis Prado Jr \version $Id: Telescope.h 17917 2010-11-03 15:51:37Z colin $ \date 23 Jun 2003 \ingroup fdet */ class Telescope { private: // I beg nobody will ever think of a different camera geometry --RU ~2005 // // I beg nobody will ever think of a camera geometry that can't be // described with a number of columns and rows --Steffen 2009 // // last remaining hardcoded properties static const unsigned int kFirstChannel = 1; static const unsigned int kLastChannel = 480; public: const std::string& GetConfigSignature(const std::string& module) const; const std::string& GetConfigSignatureStr(const std::string& module) const; const utl::Point& GetPosition() const; const utl::Vector& GetAxis() const; /** The coordinate system in which the z axis is parallel to the optical axis, the y axis is parallel to a camera column and points down the x axis is parallel to a camera row and points right the position coincides with the eye position*/ utl::CoordinateSystemPtr GetTelescopeCoordinateSystem() const; unsigned int GetId() const { return fTelescopeId; } unsigned int GetEyeId() const { return fEyeId; } /** Numerical Id of parent physical eye. * Returns the ordinary eye id if this is a physical telescope */ unsigned int GetParentPhysicalEyeId() const { return fIdOfParentPhysicalEye == 0 ? fEyeId : fIdOfParentPhysicalEye; } /** Numerical Id of parent physical telescope. * Returns the ordinary telescope id if this is a physical telescope */ unsigned int GetParentPhysicalId() const { return fIdOfParentPhysicalEye == 0 ? fTelescopeId : fIdOfParentPhysicalTelescope; } /** Id of parent physical eye as string. * Returns the ordinary eye id if this is a physical telescope */ const std::string& GetParentPhysicalEyeIdString() const { return fIdOfParentPhysicalEye == 0 ? fEyeIdString : fIdOfParentPhysicalEyeString; } /** Id of parent physical telescope as string. * Returns the ordinary telescope id if this is a physical telescope */ const std::string& GetParentPhysicalIdString() const { return fIdOfParentPhysicalEye == 0 ? fTelescopeIdString : fIdOfParentPhysicalTelescopeString; } /// Returns whether this telescope belongs to a virtual eye bool IsVirtual() const { return fIdOfParentPhysicalEye != 0; } ///Get Channel by id, throw utl::NonExistentComponentException if n.a. const Channel& GetChannel(const unsigned int channelId) const; const Channel& GetChannel(const fdet::Pixel& p) const; const Channel& GetChannel(const fevt::Pixel& p) const; ///Get Pixel by id, throw utl::NonExistentComponentException if n.a. const Pixel& GetPixel(const unsigned int pixelId) const; ///Get Pixel by (row,coll),throw utl::NonExistentComponentException if n.a. const Pixel& GetPixel(const unsigned int row, const unsigned int col) const; /// flag for corrector ring presence bool HasCorrectorRing() const; /// Get the diaphragm that belongs to the telescope const Diaphragm& GetDiaphragm() const; /// Get the filter that belongs to the telescope const Filter& GetFilter() const; /// Get the Corrector (corrector ring) object that belongs to the telescope const Corrector& GetCorrector() const; /// Get the Mirror object that belongs to the telescope const Mirror& GetMirror() const; /// Get the Camera object that belongs to the telescope const Camera& GetCamera() const; /// Telescope commission time const utl::TimeStamp& GetCommissionTime() const; /// Telescope decommission time const utl::TimeStamp& GetDecommissionTime() const; double GetDiaphragmArea() const; double GetDiaphragmRadius() const; unsigned int GetFirstPixelId() const { return 1; } unsigned int GetLastPixelId() const; unsigned int GetFirstChannelId() const { return kFirstChannel; } unsigned int GetLastChannelId() const { return kLastChannel; } unsigned int GetFirstRow() const; unsigned int GetFirstColumn() const; unsigned int GetLastRow() const; unsigned int GetLastColumn() const; utl::Vector GetCameraPixelDirection(const unsigned int pixelId) const; utl::Vector GetCameraPixelDirection(const unsigned int row, const unsigned int col) const; /** Wavelength dependence of the optical efficiency, * calculated from the modeled efficiencies of the * telescope components such as mirror reflectivity. */ double GetModelRelativeEfficiency(const double wl) const; double GetModelMeanEfficiency(const std::string& configSignature, const double wl) const; /** Get the total detector response to light as a function of wavelength * The sum over all wavelengths is 1. */ double GetMeasuredRelativeEfficiency(const double wl) const; const utl::TabulatedFunction& GetMeasuredRelativeEfficiency() const; /** An iterator over out of border pixels, useful to check * if the light spot is contained in the camera */ typedef std::vector::const_iterator OutOfBorderPixelsIterator; /// Begin of pixels out of the border OutOfBorderPixelsIterator OutOfBorderPixelsBegin() const; /// End of pixels out of the border OutOfBorderPixelsIterator OutOfBorderPixelsEnd() const; // dynamic properties double GetUpTimeFraction() const; bool IsInAquisition() const; int GetDAQStatus() const; std::string GetTelescopePointingId() const; typedef std::map PointingAngleSet; PointingAngleSet GetTelescopePointingPhi() const; PointingAngleSet GetTelescopePointingElevation() const; double GetModelMinWavelength() const; double GetModelMaxWavelength() const; protected: double GetModelWavelengthDependence(const double wl) const; private: typedef std::map InternalChannelCollection; typedef std::map InternalPixelCollection; typedef std::vector InternalPixelDirCollection; void CacheTelescopePointing() const; Telescope(const unsigned int eyeId, const unsigned int telescopeId); ~Telescope(); Telescope(const Telescope& tel); Telescope& operator=(const Telescope& tel); void InitStrings(); mutable InternalChannelCollection fChannel; mutable InternalPixelCollection fPixel; unsigned int fEyeId; unsigned int fTelescopeId; std::string fEyeIdString; std::string fTelescopeIdString; // Quantities filled by lazy evaluation // ------------------------------------ mutable int fIdOfParentPhysicalEye; mutable int fIdOfParentPhysicalTelescope; std::string fIdOfParentPhysicalEyeString; std::string fIdOfParentPhysicalTelescopeString; mutable std::string* fConfigSignatureStr; mutable std::string* fConfigSignature; mutable std::string fConfigSignatureModule; mutable utl::Point* fPosition; mutable utl::Vector* fAxis; mutable utl::CoordinateSystemPtr fCoordinateSystem; mutable utl::TimeStamp* fCommissionTime; mutable utl::TimeStamp* fDecommissionTime; mutable utl::TabulatedFunction* fMeasuredRelativeEfficiency; /** The id of the default telescope pointing */ mutable std::string* fTelPointingId; /** Hold the azimuth of the various possible telescope pointing directions */ mutable PointingAngleSet* fTelPointingPhiMap; /** Hold the elevation of the various possible telescope pointing directions */ mutable PointingAngleSet* fTelPointingElevationMap; /** Hold the directions of "virtual" pixels that are one col/row outside the camera */ mutable InternalPixelDirCollection fOutBorderPixelsDir; /** Generate pixels for one row and one column outside the last actual pixels of the camera */ void GenerateOutOfBorderPixels() const; /// Hold the diaphragm properties like radius and area mutable Diaphragm* fDiaphragm; /** Hold the mirror properties like the reflectivity as function of the wavelength */ mutable Mirror* fMirror; /** Hold the filter properties like the trasmitance as function of the wavelength */ mutable Filter* fFilter; /** Hold the corrector ring properties like the transmitance as function of the wavelength */ mutable Corrector* fCorrector; /** Hold the camera properties like the radius of curvature, Mercedes geometry and efficiency as function of the wavelength */ mutable Camera* fCamera; void Update(); // up time info mutable det::ValidityStamp fUpTimeValidityStamp; mutable double fUpTimeFraction; mutable int fStatus; mutable std::map fCalibMap; mutable det::ValidityStamp fCalibValidityStamp; public: /// Cache calibration constants for pixels in one go (minimize DB access) void CachePixelCalibrations() const; /// Cache cloud coverage for pixels in one go (minimize DB access) bool CachePixelCloudData() const; void UpdateFdUpTime() const; private: template inline const T& GetTelescopeData(T*& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg) const; template inline void GetTelescopeData(T& requestedData, const std::string& property, const std::string& component, const std::string& errorMsg) const; friend class Eye; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // End: