00001 #ifndef PSANA_LUSI_DDL_H
00002 #define PSANA_LUSI_DDL_H 1
00003
00004
00005
00006 #include <vector>
00007 #include <iosfwd>
00008 #include <cstring>
00009 #include "ndarray/ndarray.h"
00010 #include "pdsdata/xtc/TypeId.hh"
00011 namespace Psana {
00012 namespace Lusi {
00013
00014
00015
00016
00017
00018
00019
00020 class DiodeFexConfigV1 {
00021 public:
00022 enum { TypeId = Pds::TypeId::Id_DiodeFexConfig };
00023 enum { Version = 1 };
00024 enum { NRANGES = 3 };
00025 DiodeFexConfigV1(const float* arg__base, const float* arg__scale)
00026 {
00027 if (arg__base) std::copy(arg__base, arg__base+(3), &_base[0]);
00028 if (arg__scale) std::copy(arg__scale, arg__scale+(3), &_scale[0]);
00029 }
00030 DiodeFexConfigV1() {}
00031
00032
00033 ndarray<const float, 1> base() const { return make_ndarray(&_base[0], NRANGES); }
00034
00035
00036 ndarray<const float, 1> scale() const { return make_ndarray(&_scale[0], NRANGES); }
00037 static uint32_t _sizeof() { return (((((0+(4*(NRANGES)))+(4*(NRANGES)))+4)-1)/4)*4; }
00038 private:
00039 float _base[NRANGES];
00040 float _scale[NRANGES];
00041 };
00042
00043
00044
00045
00046
00047
00048
00049 class DiodeFexConfigV2 {
00050 public:
00051 enum { TypeId = Pds::TypeId::Id_DiodeFexConfig };
00052 enum { Version = 2 };
00053 enum { NRANGES = 16 };
00054 DiodeFexConfigV2(const float* arg__base, const float* arg__scale)
00055 {
00056 if (arg__base) std::copy(arg__base, arg__base+(16), &_base[0]);
00057 if (arg__scale) std::copy(arg__scale, arg__scale+(16), &_scale[0]);
00058 }
00059 DiodeFexConfigV2() {}
00060
00061
00062 ndarray<const float, 1> base() const { return make_ndarray(&_base[0], NRANGES); }
00063
00064
00065 ndarray<const float, 1> scale() const { return make_ndarray(&_scale[0], NRANGES); }
00066 static uint32_t _sizeof() { return (((((0+(4*(NRANGES)))+(4*(NRANGES)))+4)-1)/4)*4; }
00067 private:
00068 float _base[NRANGES];
00069 float _scale[NRANGES];
00070 };
00071
00072
00073
00074
00075
00076
00077
00078 class DiodeFexV1 {
00079 public:
00080 enum { TypeId = Pds::TypeId::Id_DiodeFex };
00081 enum { Version = 1 };
00082 DiodeFexV1(float arg__value)
00083 : _value(arg__value)
00084 {
00085 }
00086 DiodeFexV1() {}
00087 float value() const { return _value; }
00088 static uint32_t _sizeof() { return 4; }
00089 private:
00090 float _value;
00091 };
00092
00093
00094
00095
00096
00097
00098
00099 class IpmFexConfigV1 {
00100 public:
00101 enum { TypeId = Pds::TypeId::Id_IpmFexConfig };
00102 enum { Version = 1 };
00103 enum { NCHANNELS = 4 };
00104 virtual ~IpmFexConfigV1();
00105 virtual ndarray<const Lusi::DiodeFexConfigV1, 1> diode() const = 0;
00106 virtual float xscale() const = 0;
00107 virtual float yscale() const = 0;
00108 };
00109
00110
00111
00112
00113
00114
00115
00116 class IpmFexConfigV2 {
00117 public:
00118 enum { TypeId = Pds::TypeId::Id_IpmFexConfig };
00119 enum { Version = 2 };
00120 enum { NCHANNELS = 4 };
00121 virtual ~IpmFexConfigV2();
00122 virtual ndarray<const Lusi::DiodeFexConfigV2, 1> diode() const = 0;
00123 virtual float xscale() const = 0;
00124 virtual float yscale() const = 0;
00125 };
00126
00127
00128
00129
00130
00131
00132
00133 class IpmFexV1 {
00134 public:
00135 enum { TypeId = Pds::TypeId::Id_IpmFex };
00136 enum { Version = 1 };
00137 enum { NCHANNELS = 4 };
00138 IpmFexV1(const float* arg__channel, float arg__sum, float arg__xpos, float arg__ypos)
00139 : _sum(arg__sum), _xpos(arg__xpos), _ypos(arg__ypos)
00140 {
00141 if (arg__channel) std::copy(arg__channel, arg__channel+(4), &_channel[0]);
00142 }
00143 IpmFexV1() {}
00144
00145
00146 ndarray<const float, 1> channel() const { return make_ndarray(&_channel[0], NCHANNELS); }
00147 float sum() const { return _sum; }
00148 float xpos() const { return _xpos; }
00149 float ypos() const { return _ypos; }
00150 static uint32_t _sizeof() { return (((((((0+(4*(NCHANNELS)))+4)+4)+4)+4)-1)/4)*4; }
00151 private:
00152 float _channel[NCHANNELS];
00153 float _sum;
00154 float _xpos;
00155 float _ypos;
00156 };
00157
00158
00159
00160
00161
00162
00163
00164 class PimImageConfigV1 {
00165 public:
00166 enum { TypeId = Pds::TypeId::Id_PimImageConfig };
00167 enum { Version = 1 };
00168 PimImageConfigV1(float arg__xscale, float arg__yscale)
00169 : _xscale(arg__xscale), _yscale(arg__yscale)
00170 {
00171 }
00172 PimImageConfigV1() {}
00173 float xscale() const { return _xscale; }
00174 float yscale() const { return _yscale; }
00175 static uint32_t _sizeof() { return 8; }
00176 private:
00177 float _xscale;
00178 float _yscale;
00179 };
00180 }
00181 }
00182 #endif // PSANA_LUSI_DDL_H