00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "H5DataTypes/CsPadElementV2.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "hdf5pp/ArrayType.h"
00026 #include "hdf5pp/CompoundType.h"
00027 #include "hdf5pp/TypeTraits.h"
00028 #include "H5DataTypes/H5DataUtils.h"
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace H5DataTypes {
00039
00040 CsPadElementV2::CsPadElementV2 ( const XtcType& data )
00041 : tid(data.tid())
00042 , seq_count(data.seq_count())
00043 , ticks(data.ticks())
00044 , fiducials(data.fiducials())
00045 , acq_count(data.acq_count())
00046 , virtual_channel(data.virtual_channel())
00047 , lane(data.lane())
00048 , op_code(data.op_code())
00049 , quad(data.quad())
00050 , frame_type(data.frame_type())
00051 {
00052 const ndarray<const uint16_t, 1>& sb_temp = data.sb_temp();
00053 std::copy(sb_temp.begin(), sb_temp.end(), this->sb_temp);
00054 }
00055
00056 hdf5pp::Type
00057 CsPadElementV2::stored_type(unsigned nQuad)
00058 {
00059 return native_type(nQuad) ;
00060 }
00061
00062 hdf5pp::Type
00063 CsPadElementV2::native_type(unsigned nQuad)
00064 {
00065 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<CsPadElementV2>() ;
00066 type.insert_native<uint32_t>( "tid", offsetof(CsPadElementV2, tid) );
00067 type.insert_native<uint32_t>( "seq_count", offsetof(CsPadElementV2, seq_count) );
00068 type.insert_native<uint32_t>( "ticks", offsetof(CsPadElementV2, ticks) );
00069 type.insert_native<uint32_t>( "fiducials", offsetof(CsPadElementV2, fiducials) );
00070 type.insert_native<uint16_t>( "acq_count", offsetof(CsPadElementV2, acq_count) );
00071 type.insert_native<uint16_t>( "sb_temp", offsetof(CsPadElementV2, sb_temp), SbTempSize );
00072 type.insert_native<uint8_t>( "virtual_channel", offsetof(CsPadElementV2, virtual_channel) );
00073 type.insert_native<uint8_t>( "lane", offsetof(CsPadElementV2, lane) );
00074 type.insert_native<uint8_t>( "op_code", offsetof(CsPadElementV2, op_code) );
00075 type.insert_native<uint8_t>( "quad", offsetof(CsPadElementV2, quad) );
00076 type.insert_native<uint8_t>( "frame_type", offsetof(CsPadElementV2, frame_type) );
00077
00078 return hdf5pp::ArrayType::arrayType(type, nQuad);
00079 }
00080
00081 hdf5pp::Type
00082 CsPadElementV2::stored_data_type(unsigned nSect)
00083 {
00084 hdf5pp::Type baseType = hdf5pp::TypeTraits<int16_t>::native_type() ;
00085
00086 hsize_t dims[] = { nSect, Pds::CsPad::ColumnsPerASIC, Pds::CsPad::MaxRowsPerASIC*2 } ;
00087 return hdf5pp::ArrayType::arrayType ( baseType, 3, dims );
00088 }
00089
00090 hdf5pp::Type
00091 CsPadElementV2::cmode_data_type(unsigned nSect)
00092 {
00093 return hdf5pp::ArrayType::arrayType<float> ( nSect );
00094 }
00095
00096 }