#ifndef _fevt_Telescope_h_ #define _fevt_Telescope_h_ #include #include #include #include #include #include #include #include #include namespace fevt { class TelescopeSimData; class TelescopeRecData; class TelescopeTriggerData; class Channel; class Pixel; /** \brief Fluorescence Detector Telescope Event \author Stefano Argiro' \version $Id$ \ingroup fevt */ class Telescope { private: typedef std::list InternalChannelContainer; typedef InternalChannelContainer::iterator InternalChannelIterator; typedef InternalChannelContainer::const_iterator InternalConstChannelIterator; typedef std::list InternalPixelContainer; typedef InternalPixelContainer::iterator InternalPixelIterator; typedef InternalPixelContainer::const_iterator InternalConstPixelIterator; /// An iterator over all pixels for read and write typedef boost::indirect_iterator AllPixelIterator; /// An iterator over pixels for read typedef boost::indirect_iterator ConstAllPixelIterator; typedef std::vector InternalPixelDirCollection; AllPixelIterator AllPixelsBegin() { return AllPixelIterator(fPixels.begin()); } AllPixelIterator AllPixelsEnd() { return AllPixelIterator(fPixels.end()); } ConstAllPixelIterator AllPixelsBegin() const { return ConstAllPixelIterator(fPixels.begin()); } ConstAllPixelIterator AllPixelsEnd() const { return ConstAllPixelIterator(fPixels.end()); } public: Telescope(const Telescope& theTelescope); Telescope& operator=(const Telescope& theTelescope); unsigned int GetId() const { return fTelescopeId; } unsigned int GetEyeId() const { return fEyeId; } void SetId(const unsigned int id); void SetEyeId(const unsigned int id); /// An iterator over available channels for r/w typedef boost::indirect_iterator ChannelIterator; /// An iterator over available channles for read typedef boost::indirect_iterator ConstChannelIterator; unsigned int GetNActiveChannels() const { return fChannels.size(); } Channel& GetChannel(const unsigned int channelId); const Channel& GetChannel(const unsigned int channelId) const; bool HasChannel(const unsigned int channelId) const; void MakeChannel(const unsigned int channelId); ChannelIterator ChannelsBegin() { return ChannelIterator(fChannels.begin()); } ChannelIterator ChannelsEnd() { return ChannelIterator(fChannels.end()); } ConstChannelIterator ChannelsBegin() const { return ConstChannelIterator(fChannels.begin()); } ConstChannelIterator ChannelsEnd() const { return ConstChannelIterator(fChannels.end()); } unsigned int GetNActivePixels() const { return fPixels.size(); } /// Retrieve Pixel by Id, throw exception if not existent Pixel& GetPixel(const unsigned int pixelId, const ComponentSelector::Status status = ComponentSelector::eHasData); const Pixel& GetPixel(const unsigned int pixelId, const ComponentSelector::Status status = ComponentSelector::eHasData) const; /// Make Pixel telescopeId void MakePixel(const unsigned int pixelId, const ComponentSelector::Status status = ComponentSelector::eHasData); /// Check if the pixel is in the event bool HasPixel(const unsigned int pixelId, const ComponentSelector::Status status = ComponentSelector::eHasData) const; /// selective Pixel iterators typedef boost::filter_iterator PixelIterator; typedef boost::filter_iterator ConstPixelIterator; /// iterator pointing to first available pixel of given status PixelIterator PixelsBegin(const ComponentSelector::Status status) { return PixelIterator(ComponentSelector(status), AllPixelsBegin(), AllPixelsEnd()); } /// iterator pointing to first available pixel of status eHasData (DEPRECATED) PixelIterator PixelsBegin(); /// iterator pointing to end of available pixels of given status PixelIterator PixelsEnd(const ComponentSelector::Status status) { return PixelIterator(ComponentSelector(status), AllPixelsEnd(), AllPixelsEnd()); } /// iterator pointing to end of available pixels of status eHasData (DEPRECATED) PixelIterator PixelsEnd(); /// first available pixel of given status ConstPixelIterator PixelsBegin(const ComponentSelector::Status status) const { return ConstPixelIterator(ComponentSelector(status), AllPixelsBegin(), AllPixelsEnd()); } /// first available pixel of status eHasData (DEPRECATED) ConstPixelIterator PixelsBegin()const ; /// end of available pixels of given status ConstPixelIterator PixelsEnd(const ComponentSelector::Status status) const { return ConstPixelIterator(ComponentSelector(status), AllPixelsEnd(), AllPixelsEnd()); } /// end of available pixels of status eHasData (DEPRECATED) ConstPixelIterator PixelsEnd() const; /** Start Time of all the traces in this object * and in the associated Pixels and Channels */ utl::TimeStamp GetTracesStartTime() const { return fTracesStartTime; } void SetTracesStartTime(const utl::TimeStamp& tstamp) { fTracesStartTime = tstamp; } TelescopeSimData& GetSimData(); const TelescopeSimData& GetSimData() const; void MakeSimData(); bool HasSimData() const { return fSimData; } TelescopeTriggerData& GetTriggerData(); const TelescopeTriggerData& GetTriggerData() const; void MakeTriggerData(); bool HasTriggerData() const { return fTriggerData; } /// Reconstructed data for this telescope fevt::TelescopeRecData& GetRecData(); const fevt::TelescopeRecData& GetRecData() const; void MakeRecData(); bool HasRecData() const { return fRecData; } ///Time offset of this Telescope compared to fevt::Header::GetTime [ns] unsigned int GetTimeOffset() const { return fTimeOffset; } void SetTimeOffset(const unsigned int toffset) { fTimeOffset = toffset; } /// The pointing std::string GetRawTelPointing() const { return fRawTelPointing; } void SetRawTelPointing(const std::string& pointing) { fRawTelPointing = pointing; } void SetStatus(const ComponentSelector::Status status) {fStatus=status;} ComponentSelector::Status GetStatus() const {return fStatus;} /** An iterator over mirror event border pixels */ typedef std::vector::const_iterator ConstMirrorEventBorderPixelsIterator; /// Begin of list of pixels just outside the mirror event ConstMirrorEventBorderPixelsIterator MirrorEventBorderPixelsBegin() const; /// End of list of pixels just outside the mirror event ConstMirrorEventBorderPixelsIterator MirrorEventBorderPixelsEnd() const; private: Telescope(const unsigned int eyeId, const unsigned int telescopeId, const ComponentSelector::Status status = ComponentSelector::eHasData); ~Telescope(); unsigned int fTelescopeId; unsigned int fEyeId; utl::ShadowPtr fSimData; utl::ShadowPtr fRecData; utl::ShadowPtr fTriggerData; utl::TimeStamp fTracesStartTime; InternalChannelContainer fChannels; InternalPixelContainer fPixels; unsigned int fTimeOffset; std::string fRawTelPointing; /// This is for HEAT to determine pointing ComponentSelector::Status fStatus; /** Hold the directions of the pixels that are one col/row outside the pixels that have been read out for the mirror event */ mutable InternalPixelDirCollection fMirrorEventBorderPixelsDir; /** Generate pixels for one row and one column outside the last actual pixels of the mirror event */ void GenerateMirrorEventBorderPixels() const; friend class Eye; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // End: