00001
00002
00003
00004 #include "psddl_pds2psana/imp.ddl.h"
00005
00006 #include <cstddef>
00007
00008 #include <stdexcept>
00009
00010 namespace psddl_pds2psana {
00011 namespace Imp {
00012 Psana::Imp::ConfigV1::Registers pds_to_psana(Pds::Imp::ConfigV1::Registers e)
00013 {
00014 return Psana::Imp::ConfigV1::Registers(e);
00015 }
00016
00017 ConfigV1::ConfigV1(const boost::shared_ptr<const XtcType>& xtcPtr)
00018 : Psana::Imp::ConfigV1()
00019 , m_xtcObj(xtcPtr)
00020 {
00021 }
00022 ConfigV1::~ConfigV1()
00023 {
00024 }
00025
00026
00027 uint32_t ConfigV1::range() const {
00028 return m_xtcObj->range();
00029 }
00030
00031
00032 uint32_t ConfigV1::calRange() const {
00033 return m_xtcObj->calRange();
00034 }
00035
00036
00037 uint32_t ConfigV1::reset() const {
00038 return m_xtcObj->reset();
00039 }
00040
00041
00042 uint32_t ConfigV1::biasData() const {
00043 return m_xtcObj->biasData();
00044 }
00045
00046
00047 uint32_t ConfigV1::calData() const {
00048 return m_xtcObj->calData();
00049 }
00050
00051
00052 uint32_t ConfigV1::biasDacData() const {
00053 return m_xtcObj->biasDacData();
00054 }
00055
00056
00057 uint32_t ConfigV1::calStrobe() const {
00058 return m_xtcObj->calStrobe();
00059 }
00060
00061
00062 uint32_t ConfigV1::numberOfSamples() const {
00063 return m_xtcObj->numberOfSamples();
00064 }
00065
00066
00067 uint32_t ConfigV1::trigDelay() const {
00068 return m_xtcObj->trigDelay();
00069 }
00070
00071
00072 uint32_t ConfigV1::adcDelay() const {
00073 return m_xtcObj->adcDelay();
00074 }
00075
00076 Psana::Imp::Sample pds_to_psana(Pds::Imp::Sample pds)
00077 {
00078 return Psana::Imp::Sample(pds.channels().data());
00079 }
00080
00081 Psana::Imp::LaneStatus pds_to_psana(Pds::Imp::LaneStatus pds)
00082 {
00083 return Psana::Imp::LaneStatus(pds.linkErrCount(), pds.linkDownCount(), pds.cellErrCount(), pds.rxCount(), pds.locLinked(), pds.remLinked(), pds.zeros(), pds.powersOkay());
00084 }
00085
00086 template <typename Config>
00087 ElementV1<Config>::ElementV1(const boost::shared_ptr<const XtcType>& xtcPtr, const boost::shared_ptr<const Config>& cfgPtr)
00088 : Psana::Imp::ElementV1()
00089 , m_xtcObj(xtcPtr)
00090 , m_cfgPtr(cfgPtr)
00091 , _laneStatus(psddl_pds2psana::Imp::pds_to_psana(xtcPtr->laneStatus()))
00092 {
00093 {
00094 typedef ndarray<Psana::Imp::Sample, 1> NDArray;
00095 typedef ndarray<const Pds::Imp::Sample, 1> XtcNDArray;
00096 const XtcNDArray& xtc_ndarr = xtcPtr->samples(*cfgPtr);
00097 _samples_ndarray_storage_ = NDArray(xtc_ndarr.shape());
00098 NDArray::iterator out = _samples_ndarray_storage_.begin();
00099 for (XtcNDArray::iterator it = xtc_ndarr.begin(); it != xtc_ndarr.end(); ++ it, ++ out) {
00100 *out = psddl_pds2psana::Imp::pds_to_psana(*it);
00101 }
00102 }
00103 }
00104 template <typename Config>
00105 ElementV1<Config>::~ElementV1()
00106 {
00107 }
00108
00109
00110 template <typename Config>
00111 uint8_t ElementV1<Config>::vc() const {
00112 return m_xtcObj->vc();
00113 }
00114
00115
00116 template <typename Config>
00117 uint8_t ElementV1<Config>::lane() const {
00118 return m_xtcObj->lane();
00119 }
00120
00121
00122 template <typename Config>
00123 uint32_t ElementV1<Config>::frameNumber() const {
00124 return m_xtcObj->frameNumber();
00125 }
00126
00127
00128 template <typename Config>
00129 uint32_t ElementV1<Config>::range() const {
00130 return m_xtcObj->range();
00131 }
00132
00133 template <typename Config>
00134 const Psana::Imp::LaneStatus& ElementV1<Config>::laneStatus() const { return _laneStatus; }
00135 template <typename Config>
00136 ndarray<const Psana::Imp::Sample, 1> ElementV1<Config>::samples() const { return _samples_ndarray_storage_; }
00137 template class ElementV1<Pds::Imp::ConfigV1>;
00138 }
00139 }