H5DataTypes/src/CsPadElementV1.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: CsPadElementV1.cpp 6826 2013-09-24 21:08:01Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class CsPadElementV1...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "H5DataTypes/CsPadElementV1.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "hdf5pp/ArrayType.h"
00026 #include "hdf5pp/CompoundType.h"
00027 #include "hdf5pp/TypeTraits.h"
00028 #include "H5DataTypes/H5DataUtils.h"
00029 
00030 //-----------------------------------------------------------------------
00031 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00032 //-----------------------------------------------------------------------
00033 
00034 //              ----------------------------------------
00035 //              -- Public Function Member Definitions --
00036 //              ----------------------------------------
00037 
00038 namespace H5DataTypes {
00039 
00040 
00041 CsPadElementV1::CsPadElementV1 ( const XtcType& data )
00042   : tid(data.tid())
00043   , seq_count(data.seq_count())
00044   , ticks(data.ticks())
00045   , fiducials(data.fiducials())
00046   , acq_count(data.acq_count())
00047   , virtual_channel(data.virtual_channel())
00048   , lane(data.lane())
00049   , op_code(data.op_code())
00050   , quad(data.quad())
00051   , frame_type(data.frame_type())
00052 {
00053   const ndarray<const uint16_t, 1>& sb_temp = data.sb_temp();
00054   std::copy(sb_temp.begin(), sb_temp.end(), this->sb_temp);
00055 }
00056 
00057 hdf5pp::Type
00058 CsPadElementV1::stored_type(unsigned nQuad)
00059 {
00060   return native_type(nQuad) ;
00061 }
00062 
00063 hdf5pp::Type
00064 CsPadElementV1::native_type(unsigned nQuad)
00065 {
00066   hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<CsPadElementV1>() ;
00067   type.insert_native<uint32_t>( "tid", offsetof(CsPadElementV1, tid) );
00068   type.insert_native<uint32_t>( "seq_count", offsetof(CsPadElementV1, seq_count) );
00069   type.insert_native<uint32_t>( "ticks", offsetof(CsPadElementV1, ticks) );
00070   type.insert_native<uint32_t>( "fiducials", offsetof(CsPadElementV1, fiducials) );
00071   type.insert_native<uint16_t>( "acq_count", offsetof(CsPadElementV1, acq_count) );
00072   type.insert_native<uint16_t>( "sb_temp", offsetof(CsPadElementV1, sb_temp), SbTempSize );
00073   type.insert_native<uint8_t>( "virtual_channel", offsetof(CsPadElementV1, virtual_channel) );
00074   type.insert_native<uint8_t>( "lane", offsetof(CsPadElementV1, lane) );
00075   type.insert_native<uint8_t>( "op_code", offsetof(CsPadElementV1, op_code) );
00076   type.insert_native<uint8_t>( "quad", offsetof(CsPadElementV1, quad) );
00077   type.insert_native<uint8_t>( "frame_type", offsetof(CsPadElementV1, frame_type) );
00078 
00079   return hdf5pp::ArrayType::arrayType(type, nQuad);
00080 }
00081 
00082 hdf5pp::Type
00083 CsPadElementV1::stored_data_type(unsigned nQuad, unsigned nSect)
00084 {
00085   hdf5pp::Type baseType = hdf5pp::TypeTraits<int16_t>::native_type() ;
00086 
00087   hsize_t dims[] = { nQuad, nSect, Pds::CsPad::ColumnsPerASIC, Pds::CsPad::MaxRowsPerASIC*2 } ;
00088   return hdf5pp::ArrayType::arrayType ( baseType, 4, dims );
00089 }
00090 
00091 hdf5pp::Type
00092 CsPadElementV1::cmode_data_type(unsigned nQuad, unsigned nSect)
00093 {
00094   hdf5pp::Type baseType = hdf5pp::TypeTraits<float>::native_type() ;
00095 
00096   hsize_t dims[] = { nQuad, nSect } ;
00097   return hdf5pp::ArrayType::arrayType ( baseType, 2, dims );
00098 }
00099 
00100 } // namespace H5DataTypes

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7