cspad_mod/src/ElementT.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: ElementT.cpp 5253 2013-01-30 17:56:28Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class ElementT...
00007 //
00008 // Author List:
00009 //      Andy Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "cspad_mod/ElementT.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 
00026 //-----------------------------------------------------------------------
00027 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00028 //-----------------------------------------------------------------------
00029 
00030 //              ----------------------------------------
00031 //              -- Public Function Member Definitions --
00032 //              ----------------------------------------
00033 
00034 namespace cspad_mod {
00035 
00036 //----------------
00037 // Constructors --
00038 //----------------
00039 template <typename ElemType>
00040 ElementT<ElemType>::ElementT (const ElemType& elem,
00041     int16_t* data,
00042     const float* common_mode)
00043   : ElemType()
00044   , m_virtual_channel(elem.virtual_channel())
00045   , m_lane(elem.lane())
00046   , m_tid(elem.tid())
00047   , m_acq_count(elem.acq_count())
00048   , m_op_code(elem.op_code())
00049   , m_quad(elem.quad())
00050   , m_seq_count(elem.seq_count())
00051   , m_ticks(elem.ticks())
00052   , m_fiducials(elem.fiducials())
00053   , m_sb_temp()
00054   , m_frame_type(elem.frame_type())
00055   , m_data(data)
00056   , m_sectionMask(elem.sectionMask())
00057   , m_common_mode()
00058 {
00059   // copy sb_temp array
00060   const ndarray<const uint16_t, 1>& sb_temp = elem.sb_temp();
00061   std::copy(sb_temp.begin(), sb_temp.end(), m_sb_temp);
00062 
00063   // copy data shape
00064   const ndarray<const int16_t, 3>& edata = elem.data();
00065   std::copy(edata.shape(), edata.shape()+3, m_data_shape);
00066 
00067   // copy common_mode array
00068   int nsect = m_data_shape[0];
00069   std::copy(common_mode, common_mode+nsect, m_common_mode);
00070 }
00071 
00072 //--------------
00073 // Destructor --
00074 //--------------
00075 template <typename ElemType>
00076 ElementT<ElemType>::~ElementT ()
00077 {
00078   delete [] m_data;
00079 }
00080 
00081 
00082 // Explicit instantiation
00083 template class ElementT<Psana::CsPad::ElementV1>;
00084 template class ElementT<Psana::CsPad::ElementV2>;
00085 
00086 } // namespace cspad_mod

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7