H5DataTypes/src/CsPad2x2ConfigV1.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: CsPad2x2ConfigV1.cpp 6826 2013-09-24 21:08:01Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class CsPad2x2ConfigV1...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "H5DataTypes/CsPad2x2ConfigV1.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <algorithm>
00022 
00023 //-------------------------------
00024 // Collaborating Class Headers --
00025 //-------------------------------
00026 #include "hdf5pp/ArrayType.h"
00027 #include "hdf5pp/CompoundType.h"
00028 #include "hdf5pp/TypeTraits.h"
00029 #include "H5DataTypes/H5DataUtils.h"
00030 
00031 //-----------------------------------------------------------------------
00032 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00033 //-----------------------------------------------------------------------
00034 
00035 //              ----------------------------------------
00036 //              -- Public Function Member Definitions --
00037 //              ----------------------------------------
00038 
00039 namespace H5DataTypes {
00040 
00041 CsPad2x2DigitalPotsCfg::CsPad2x2DigitalPotsCfg(const Pds::CsPad2x2::CsPad2x2DigitalPotsCfg& o)
00042 {
00043   const ndarray<const uint8_t, 1>& pots = o.pots();
00044   std::copy(pots.begin(), pots.end(), this->pots);
00045 }
00046 
00047 hdf5pp::Type
00048 CsPad2x2DigitalPotsCfg::native_type()
00049 {
00050   hdf5pp::CompoundType digitalPotsType = hdf5pp::CompoundType::compoundType<CsPad2x2DigitalPotsCfg>() ;
00051   digitalPotsType.insert_native<uint8_t>( "pots", offsetof(CsPad2x2DigitalPotsCfg, pots), PotsPerQuad );
00052   return digitalPotsType;
00053 }
00054 
00055 
00056 CsPad2x2ReadOnlyCfg::CsPad2x2ReadOnlyCfg(const Pds::CsPad2x2::CsPad2x2ReadOnlyCfg& o)
00057   : shiftTest(o.shiftTest())
00058   , version(o.version())
00059 {
00060 }
00061 
00062 hdf5pp::Type
00063 CsPad2x2ReadOnlyCfg::native_type()
00064 {
00065   hdf5pp::CompoundType readOnlyType = hdf5pp::CompoundType::compoundType<CsPad2x2ReadOnlyCfg>() ;
00066   readOnlyType.insert_native<uint32_t>( "shiftTest", offsetof(CsPad2x2ReadOnlyCfg, shiftTest) ) ;
00067   readOnlyType.insert_native<uint32_t>( "version", offsetof(CsPad2x2ReadOnlyCfg, version) ) ;
00068   return readOnlyType;
00069 }
00070 
00071 
00072 CsPad2x2GainMapCfg::CsPad2x2GainMapCfg(const Pds::CsPad2x2::CsPad2x2GainMapCfg& src)
00073 {
00074   const ndarray<const uint16_t, 2>& gainMap = src.gainMap();
00075   std::copy(gainMap.begin(), gainMap.end(), this->gainMap[0]);
00076 }
00077 
00078 hdf5pp::Type
00079 CsPad2x2GainMapCfg::native_type()
00080 {
00081   hsize_t dims[2] = {CsPad2x2GainMapCfg::ColumnsPerASIC, CsPad2x2GainMapCfg::MaxRowsPerASIC};
00082   hdf5pp::Type baseMapType = hdf5pp::TypeTraits<uint16_t>::native_type();
00083   hdf5pp::ArrayType gainMapArrType = hdf5pp::ArrayType::arrayType(baseMapType, 2, dims);
00084   hdf5pp::CompoundType gainMapType = hdf5pp::CompoundType::compoundType<CsPad2x2GainMapCfg>() ;
00085   gainMapType.insert( "gainMap", offsetof(CsPad2x2GainMapCfg, gainMap), gainMapArrType );
00086   return gainMapType;
00087 }
00088 
00089 
00090 CsPad2x2ConfigV1QuadReg::CsPad2x2ConfigV1QuadReg(const Pds::CsPad2x2::ConfigV1QuadReg& src)
00091   : shiftSelect(src.shiftSelect())
00092   , edgeSelect(src.edgeSelect())
00093   , readClkSet(src.readClkSet())
00094   , readClkHold(src.readClkHold())
00095   , dataMode(src.dataMode())
00096   , prstSel(src.prstSel())
00097   , acqDelay(src.acqDelay())
00098   , intTime(src.intTime())
00099   , digDelay(src.digDelay())
00100   , ampIdle(src.ampIdle())
00101   , injTotal(src.injTotal())
00102   , rowColShiftPer(src.rowColShiftPer())
00103   , ampReset(src.ampReset())
00104   , digCount(src.digCount())
00105   , digPeriod(src.digPeriod())
00106   , PeltierEnable(src.PeltierEnable())
00107   , kpConstant(src.kpConstant())
00108   , kiConstant(src.kiConstant())
00109   , kdConstant(src.kdConstant())
00110   , humidThold(src.humidThold())
00111   , setPoint(src.setPoint())
00112   , readOnly(src.ro())
00113   , digitalPots(src.dp())
00114   , gainMap(src.gm())
00115 {
00116 }
00117 
00118 hdf5pp::Type
00119 CsPad2x2ConfigV1QuadReg::native_type()
00120 {
00121   hdf5pp::CompoundType quadType = hdf5pp::CompoundType::compoundType<CsPad2x2ConfigV1QuadReg>() ;
00122   quadType.insert_native<uint32_t>( "shiftSelect", offsetof(CsPad2x2ConfigV1QuadReg, shiftSelect) ) ;
00123   quadType.insert_native<uint32_t>( "edgeSelect", offsetof(CsPad2x2ConfigV1QuadReg, edgeSelect) ) ;
00124   quadType.insert_native<uint32_t>( "readClkSet", offsetof(CsPad2x2ConfigV1QuadReg, readClkSet) ) ;
00125   quadType.insert_native<uint32_t>( "readClkHold", offsetof(CsPad2x2ConfigV1QuadReg, readClkHold) ) ;
00126   quadType.insert_native<uint32_t>( "dataMode", offsetof(CsPad2x2ConfigV1QuadReg, dataMode) ) ;
00127   quadType.insert_native<uint32_t>( "prstSel", offsetof(CsPad2x2ConfigV1QuadReg, prstSel) ) ;
00128   quadType.insert_native<uint32_t>( "acqDelay", offsetof(CsPad2x2ConfigV1QuadReg, acqDelay) ) ;
00129   quadType.insert_native<uint32_t>( "intTime", offsetof(CsPad2x2ConfigV1QuadReg, intTime) ) ;
00130   quadType.insert_native<uint32_t>( "digDelay", offsetof(CsPad2x2ConfigV1QuadReg, digDelay) ) ;
00131   quadType.insert_native<uint32_t>( "ampIdle", offsetof(CsPad2x2ConfigV1QuadReg, ampIdle) ) ;
00132   quadType.insert_native<uint32_t>( "injTotal", offsetof(CsPad2x2ConfigV1QuadReg, injTotal) ) ;
00133   quadType.insert_native<uint32_t>( "rowColShiftPer", offsetof(CsPad2x2ConfigV1QuadReg, rowColShiftPer) ) ;
00134   quadType.insert_native<uint32_t>( "ampReset", offsetof(CsPad2x2ConfigV1QuadReg, ampReset) ) ;
00135   quadType.insert_native<uint32_t>( "digCount", offsetof(CsPad2x2ConfigV1QuadReg, digCount) ) ;
00136   quadType.insert_native<uint32_t>( "digPeriod", offsetof(CsPad2x2ConfigV1QuadReg, digPeriod) ) ;
00137   quadType.insert_native<uint32_t>( "PeltierEnable", offsetof(CsPad2x2ConfigV1QuadReg, PeltierEnable) ) ;
00138   quadType.insert_native<uint32_t>( "kpConstant", offsetof(CsPad2x2ConfigV1QuadReg, kpConstant) ) ;
00139   quadType.insert_native<uint32_t>( "kiConstant", offsetof(CsPad2x2ConfigV1QuadReg, kiConstant) ) ;
00140   quadType.insert_native<uint32_t>( "kdConstant", offsetof(CsPad2x2ConfigV1QuadReg, kdConstant) ) ;
00141   quadType.insert_native<uint32_t>( "humidThold", offsetof(CsPad2x2ConfigV1QuadReg, humidThold) ) ;
00142   quadType.insert_native<uint32_t>( "setPoint", offsetof(CsPad2x2ConfigV1QuadReg, setPoint) ) ;
00143   quadType.insert("readOnly", offsetof(CsPad2x2ConfigV1QuadReg, readOnly), CsPad2x2ReadOnlyCfg::native_type()) ;
00144   quadType.insert("digitalPots", offsetof(CsPad2x2ConfigV1QuadReg, digitalPots), CsPad2x2DigitalPotsCfg::native_type()) ;
00145   quadType.insert("gainMap", offsetof(CsPad2x2ConfigV1QuadReg, gainMap), CsPad2x2GainMapCfg::native_type()) ;
00146   return quadType;
00147 }
00148 
00149 
00150 CsPad2x2ProtectionSystemThreshold::CsPad2x2ProtectionSystemThreshold(const Pds::CsPad2x2::ProtectionSystemThreshold& o)
00151   : adcThreshold(o.adcThreshold())
00152   , pixelCountThreshold(o.pixelCountThreshold())
00153 {
00154 }
00155 
00156 hdf5pp::Type
00157 CsPad2x2ProtectionSystemThreshold::native_type()
00158 {
00159   hdf5pp::CompoundType protSysType = hdf5pp::CompoundType::compoundType<CsPad2x2ProtectionSystemThreshold>() ;
00160   protSysType.insert_native<uint32_t>( "adcThreshold", offsetof(CsPad2x2ProtectionSystemThreshold, adcThreshold) ) ;
00161   protSysType.insert_native<uint32_t>( "pixelCountThreshold", offsetof(CsPad2x2ProtectionSystemThreshold, pixelCountThreshold) ) ;
00162   return protSysType;
00163 }
00164 
00165 CsPad2x2ConfigV1::CsPad2x2ConfigV1 ( const XtcType& data )
00166   : quad(data.quad())
00167   , testDataIndex(data.tdi())
00168   , protectionThreshold(data.protectionThreshold())
00169   , protectionEnable(data.protectionEnable())
00170   , inactiveRunMode(data.inactiveRunMode())
00171   , activeRunMode(data.activeRunMode())
00172   , payloadSize(data.payloadSize())
00173   , badAsicMask(data.badAsicMask())
00174   , asicMask(data.asicMask())
00175   , roiMask(data.roiMask())
00176   , numAsicsRead(data.numAsicsRead())
00177   , numAsicsStored(data.numAsicsStored())
00178   , concentratorVersion(data.concentratorVersion())
00179 {
00180 }
00181 
00182 hdf5pp::Type
00183 CsPad2x2ConfigV1::stored_type()
00184 {
00185   return native_type() ;
00186 }
00187 
00188 hdf5pp::Type
00189 CsPad2x2ConfigV1::native_type()
00190 {
00191   hdf5pp::CompoundType confType = hdf5pp::CompoundType::compoundType<CsPad2x2ConfigV1>() ;
00192   confType.insert("quad", offsetof(CsPad2x2ConfigV1, quad), CsPad2x2ConfigV1QuadReg::native_type() ) ;
00193   confType.insert_native<uint32_t>( "testDataIndex", offsetof(CsPad2x2ConfigV1, testDataIndex) ) ;
00194   confType.insert("protectionThreshold", offsetof(CsPad2x2ConfigV1, protectionThreshold), CsPad2x2ProtectionSystemThreshold::native_type() ) ;
00195   confType.insert_native<uint32_t>( "protectionEnable", offsetof(CsPad2x2ConfigV1, protectionEnable) ) ;
00196   confType.insert_native<uint32_t>( "inactiveRunMode", offsetof(CsPad2x2ConfigV1, inactiveRunMode) ) ;
00197   confType.insert_native<uint32_t>( "activeRunMode", offsetof(CsPad2x2ConfigV1, activeRunMode) ) ;
00198   confType.insert_native<uint32_t>( "payloadSize", offsetof(CsPad2x2ConfigV1, payloadSize) ) ;
00199   confType.insert_native<uint32_t>( "badAsicMask", offsetof(CsPad2x2ConfigV1, badAsicMask) ) ;
00200   confType.insert_native<uint32_t>( "asicMask", offsetof(CsPad2x2ConfigV1, asicMask) ) ;
00201   confType.insert_native<uint32_t>( "roiMask", offsetof(CsPad2x2ConfigV1, roiMask) ) ;
00202   confType.insert_native<uint32_t>( "numAsicsRead", offsetof(CsPad2x2ConfigV1, numAsicsRead) ) ;
00203   confType.insert_native<uint32_t>( "numAsicsStored", offsetof(CsPad2x2ConfigV1, numAsicsStored) ) ;
00204   confType.insert_native<uint32_t>( "concentratorVersion", offsetof(CsPad2x2ConfigV1, concentratorVersion) ) ;
00205 
00206   return confType ;
00207 }
00208 
00209 void
00210 CsPad2x2ConfigV1::store( const XtcType& config, hdf5pp::Group grp )
00211 {
00212   // make scalar data set for main object
00213   CsPad2x2ConfigV1 data ( config ) ;
00214   storeDataObject ( data, "config", grp ) ;
00215 }
00216 
00217 } // namespace H5DataTypes

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7