00001 #ifndef PSDDL_PDS2PSANA_TIMEPIXDATAV1TOV2_H 00002 #define PSDDL_PDS2PSANA_TIMEPIXDATAV1TOV2_H 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: TimepixDataV1ToV2.h 6820 2013-09-24 21:02:05Z salnikov@SLAC.STANFORD.EDU $ 00007 // 00008 // Description: 00009 // Class TimepixDataV1ToV2. 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------- 00014 // C/C++ Headers -- 00015 //----------------- 00016 #include <boost/shared_ptr.hpp> 00017 00018 //---------------------- 00019 // Base Class Headers -- 00020 //---------------------- 00021 #include "psddl_psana/timepix.ddl.h" 00022 00023 //------------------------------- 00024 // Collaborating Class Headers -- 00025 //------------------------------- 00026 #include "pdsdata/psddl/timepix.ddl.h" 00027 00028 //------------------------------------ 00029 // Collaborating Class Declarations -- 00030 //------------------------------------ 00031 00032 // --------------------- 00033 // -- Class Interface -- 00034 // --------------------- 00035 00036 namespace psddl_pds2psana { 00037 00038 /// @addtogroup psddl_pds2psana 00039 00040 /** 00041 * @ingroup psddl_pds2psana 00042 * 00043 * @brief Special implementation of Psana::Timepix::DataV2 interface 00044 * which can be constructed from Pds::Timepix::DataV1 class. 00045 * 00046 * This special implementation is needed to re-shuffle data inside 00047 * DataV1 class which is not usable directly without re-shuffling. 00048 * Note that we use DataV2 interface instead of dataV1 to make this 00049 * thing compatible with other places which do re-shuffling by 00050 * converting DataV1 class into DataV2. 00051 * 00052 * This software was developed for the LCLS project. If you use all or 00053 * part of it, please give an appropriate acknowledgment. 00054 * 00055 * @version $Id: TimepixDataV1ToV2.h 6820 2013-09-24 21:02:05Z salnikov@SLAC.STANFORD.EDU $ 00056 * 00057 * @author Andy Salnikov 00058 */ 00059 00060 class TimepixDataV1ToV2 : public Psana::Timepix::DataV2 { 00061 public: 00062 00063 typedef Pds::Timepix::DataV1 XtcType; 00064 typedef Psana::Timepix::DataV2 PsanaType; 00065 00066 // Default constructor 00067 TimepixDataV1ToV2(const boost::shared_ptr<const XtcType>& xtcPtr); 00068 00069 // Destructor 00070 virtual ~TimepixDataV1ToV2 () ; 00071 00072 virtual uint16_t width() const; 00073 virtual uint16_t height() const; 00074 virtual uint32_t timestamp() const; 00075 virtual uint16_t frameCounter() const; 00076 virtual uint16_t lostRows() const; 00077 virtual ndarray<const uint16_t, 2> data() const; 00078 virtual uint32_t depth() const; 00079 virtual uint32_t depth_bytes() const; 00080 virtual uint32_t data_size() const; 00081 const XtcType& _xtcObj() const { return *m_xtcObj; } 00082 00083 private: 00084 00085 boost::shared_ptr<const Pds::Timepix::DataV1> m_xtcObj; 00086 mutable uint16_t* m_data; 00087 00088 }; 00089 00090 } // namespace psddl_pds2psana 00091 00092 #endif // PSDDL_PDS2PSANA_TIMEPIXDATAV1TOV2_H