00001 #ifndef PSANA_ACQIRIS_DDL_H
00002 #define PSANA_ACQIRIS_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 Acqiris {
00013
00014
00015
00016
00017
00018
00019
00020 class VertV1 {
00021 public:
00022
00023
00024 enum Coupling {
00025 GND,
00026 DC,
00027 AC,
00028 DC50ohm,
00029 AC50ohm,
00030 };
00031 enum Bandwidth {
00032 None,
00033 MHz25,
00034 MHz700,
00035 MHz200,
00036 MHz20,
00037 MHz35,
00038 };
00039 VertV1(double arg__fullScale, double arg__offset, uint32_t arg__coupling, uint32_t arg__bandwidth)
00040 : _fullScale(arg__fullScale), _offset(arg__offset), _coupling(arg__coupling), _bandwidth(arg__bandwidth)
00041 {
00042 }
00043 VertV1() {}
00044
00045 double fullScale() const { return _fullScale; }
00046
00047 double offset() const { return _offset; }
00048
00049 uint32_t coupling() const { return _coupling; }
00050
00051 uint32_t bandwidth() const { return _bandwidth; }
00052
00053 double slope() const;
00054 static uint32_t _sizeof() { return 24; }
00055 private:
00056 double _fullScale;
00057 double _offset;
00058 uint32_t _coupling;
00059 uint32_t _bandwidth;
00060 };
00061 std::ostream& operator<<(std::ostream& str, Acqiris::VertV1::Coupling enval);
00062 std::ostream& operator<<(std::ostream& str, Acqiris::VertV1::Bandwidth enval);
00063
00064
00065
00066
00067
00068
00069
00070 class HorizV1 {
00071 public:
00072 HorizV1(double arg__sampInterval, double arg__delayTime, uint32_t arg__nbrSamples, uint32_t arg__nbrSegments)
00073 : _sampInterval(arg__sampInterval), _delayTime(arg__delayTime), _nbrSamples(arg__nbrSamples), _nbrSegments(arg__nbrSegments)
00074 {
00075 }
00076 HorizV1() {}
00077
00078 double sampInterval() const { return _sampInterval; }
00079
00080 double delayTime() const { return _delayTime; }
00081
00082 uint32_t nbrSamples() const { return _nbrSamples; }
00083
00084 uint32_t nbrSegments() const { return _nbrSegments; }
00085 static uint32_t _sizeof() { return 24; }
00086 private:
00087 double _sampInterval;
00088 double _delayTime;
00089 uint32_t _nbrSamples;
00090 uint32_t _nbrSegments;
00091 };
00092
00093
00094
00095
00096
00097
00098
00099 class TrigV1 {
00100 public:
00101
00102
00103 enum Source {
00104 Internal = 1,
00105 External = -1,
00106 };
00107 enum Coupling {
00108 DC = 0,
00109 AC = 1,
00110 HFreject = 2,
00111 DC50ohm = 3,
00112 AC50ohm = 4,
00113 };
00114
00115
00116 enum Slope {
00117 Positive,
00118 Negative,
00119 OutOfWindow,
00120 IntoWindow,
00121 HFDivide,
00122 SpikeStretcher,
00123 };
00124 TrigV1(uint32_t arg__coupling, uint32_t arg__input, uint32_t arg__slope, double arg__level)
00125 : _coupling(arg__coupling), _input(arg__input), _slope(arg__slope), _level(arg__level)
00126 {
00127 }
00128 TrigV1() {}
00129 uint32_t coupling() const { return _coupling; }
00130
00131 uint32_t input() const { return _input; }
00132
00133 uint32_t slope() const { return _slope; }
00134
00135 double level() const { return _level; }
00136 static uint32_t _sizeof() { return 20; }
00137 private:
00138 uint32_t _coupling;
00139 uint32_t _input;
00140 uint32_t _slope;
00141 double _level;
00142 };
00143 std::ostream& operator<<(std::ostream& str, Acqiris::TrigV1::Source enval);
00144 std::ostream& operator<<(std::ostream& str, Acqiris::TrigV1::Coupling enval);
00145 std::ostream& operator<<(std::ostream& str, Acqiris::TrigV1::Slope enval);
00146
00147
00148
00149
00150
00151
00152
00153 class ConfigV1 {
00154 public:
00155 enum { TypeId = Pds::TypeId::Id_AcqConfig };
00156 enum { Version = 1 };
00157 enum { MaxChan = 20 };
00158 virtual ~ConfigV1();
00159
00160 virtual uint32_t nbrConvertersPerChannel() const = 0;
00161
00162 virtual uint32_t channelMask() const = 0;
00163
00164 virtual uint32_t nbrBanks() const = 0;
00165
00166 virtual const Acqiris::TrigV1& trig() const = 0;
00167
00168 virtual const Acqiris::HorizV1& horiz() const = 0;
00169
00170 virtual ndarray<const Acqiris::VertV1, 1> vert() const = 0;
00171
00172 virtual uint32_t nbrChannels() const = 0;
00173 };
00174
00175
00176
00177
00178
00179
00180
00181 class TimestampV1 {
00182 public:
00183 TimestampV1(double arg__horPos, uint32_t arg__timeStampLo, uint32_t arg__timeStampHi)
00184 : _horPos(arg__horPos), _timeStampLo(arg__timeStampLo), _timeStampHi(arg__timeStampHi)
00185 {
00186 }
00187 TimestampV1() {}
00188
00189
00190 double pos() const { return _horPos; }
00191 uint32_t timeStampLo() const { return _timeStampLo; }
00192 uint32_t timeStampHi() const { return _timeStampHi; }
00193
00194
00195 uint64_t value() const;
00196 static uint32_t _sizeof() { return 16; }
00197 private:
00198 double _horPos;
00199
00200 uint32_t _timeStampLo;
00201 uint32_t _timeStampHi;
00202 };
00203
00204
00205
00206
00207
00208
00209 class ConfigV1;
00210
00211 class DataDescV1Elem {
00212 public:
00213 enum { NumberOfBits = 10 };
00214 enum { BitShift = 6 };
00215 enum { _extraSize = 32 };
00216 virtual ~DataDescV1Elem();
00217
00218 virtual uint32_t nbrSamplesInSeg() const = 0;
00219 virtual uint32_t indexFirstPoint() const = 0;
00220
00221 virtual uint32_t nbrSegments() const = 0;
00222
00223 virtual ndarray<const Acqiris::TimestampV1, 1> timestamp() const = 0;
00224
00225
00226
00227 virtual ndarray<const int16_t, 2> waveforms() const = 0;
00228 };
00229
00230
00231
00232
00233
00234
00235 class ConfigV1;
00236
00237 class DataDescV1 {
00238 public:
00239 enum { TypeId = Pds::TypeId::Id_AcqWaveform };
00240 enum { Version = 1 };
00241 virtual ~DataDescV1();
00242
00243 virtual const Acqiris::DataDescV1Elem& data(uint32_t i0) const = 0;
00244
00245 virtual std::vector<int> data_shape() const = 0;
00246 };
00247
00248
00249
00250
00251
00252
00253
00254 class TdcChannel {
00255 public:
00256
00257
00258 enum Channel {
00259 Veto = -2,
00260 Common = -1,
00261 Input1 = 1,
00262 Input2 = 2,
00263 Input3 = 3,
00264 Input4 = 4,
00265 Input5 = 5,
00266 Input6 = 6,
00267 };
00268 enum Mode {
00269 Active = 0,
00270 Inactive = 1,
00271 };
00272 enum Slope {
00273 Positive,
00274 Negative,
00275 };
00276 TdcChannel(Acqiris::TdcChannel::Channel arg__channel, Acqiris::TdcChannel::Slope arg__bf_slope, Acqiris::TdcChannel::Mode arg__bf_mode, double arg__level)
00277 : _channel(arg__channel), _mode(((arg__bf_slope) & 0x1)|(((arg__bf_mode) & 0x1)<<31)), _level(arg__level)
00278 {
00279 }
00280 TdcChannel() {}
00281
00282 Acqiris::TdcChannel::Channel channel() const { return Acqiris::TdcChannel::Channel(_channel); }
00283
00284
00285 uint32_t _mode_int() const { return _mode; }
00286 Acqiris::TdcChannel::Slope slope() const { return Slope(this->_mode & 0x1); }
00287 Acqiris::TdcChannel::Mode mode() const { return Mode((this->_mode>>31) & 0x1); }
00288 double level() const { return _level; }
00289 static uint32_t _sizeof() { return 16; }
00290 private:
00291 int32_t _channel;
00292 uint32_t _mode;
00293
00294 double _level;
00295 };
00296 std::ostream& operator<<(std::ostream& str, Acqiris::TdcChannel::Channel enval);
00297 std::ostream& operator<<(std::ostream& str, Acqiris::TdcChannel::Mode enval);
00298 std::ostream& operator<<(std::ostream& str, Acqiris::TdcChannel::Slope enval);
00299
00300
00301
00302
00303
00304
00305
00306 class TdcAuxIO {
00307 public:
00308 enum Channel {
00309 IOAux1 = 1,
00310 IOAux2 = 2,
00311 };
00312 enum Mode {
00313 BankSwitch = 1,
00314 Marker = 2,
00315 OutputLo = 32,
00316 OutputHi = 33,
00317 };
00318 enum Termination {
00319 ZHigh = 0,
00320 Z50 = 1,
00321 };
00322 TdcAuxIO(Acqiris::TdcAuxIO::Channel arg__channel, Acqiris::TdcAuxIO::Mode arg__signal, Acqiris::TdcAuxIO::Termination arg__qualifier)
00323 : _channel(arg__channel), _signal(arg__signal), _qualifier(arg__qualifier)
00324 {
00325 }
00326 TdcAuxIO() {}
00327 Acqiris::TdcAuxIO::Channel channel() const { return Acqiris::TdcAuxIO::Channel(_channel); }
00328 Acqiris::TdcAuxIO::Mode mode() const { return Acqiris::TdcAuxIO::Mode(_signal); }
00329 Acqiris::TdcAuxIO::Termination term() const { return Acqiris::TdcAuxIO::Termination(_qualifier); }
00330 static uint32_t _sizeof() { return 12; }
00331 private:
00332 uint32_t _channel;
00333 uint32_t _signal;
00334 uint32_t _qualifier;
00335 };
00336 std::ostream& operator<<(std::ostream& str, Acqiris::TdcAuxIO::Channel enval);
00337 std::ostream& operator<<(std::ostream& str, Acqiris::TdcAuxIO::Mode enval);
00338 std::ostream& operator<<(std::ostream& str, Acqiris::TdcAuxIO::Termination enval);
00339
00340
00341
00342
00343
00344
00345
00346 class TdcVetoIO {
00347 public:
00348 enum Channel {
00349 ChVeto = 13,
00350 };
00351 enum Mode {
00352 Veto = 1,
00353 SwitchVeto = 2,
00354 InvertedVeto = 3,
00355 InvertedSwitchVeto = 4,
00356 };
00357 enum Termination {
00358 ZHigh = 0,
00359 Z50 = 1,
00360 };
00361 TdcVetoIO(Acqiris::TdcVetoIO::Mode mode, Acqiris::TdcVetoIO::Termination term)
00362 : _channel(ChVeto), _signal(mode), _qualifier(term)
00363 {
00364 }
00365 TdcVetoIO() {}
00366 Acqiris::TdcVetoIO::Channel channel() const { return Acqiris::TdcVetoIO::Channel(_channel); }
00367 Acqiris::TdcVetoIO::Mode mode() const { return Acqiris::TdcVetoIO::Mode(_signal); }
00368 Acqiris::TdcVetoIO::Termination term() const { return Acqiris::TdcVetoIO::Termination(_qualifier); }
00369 static uint32_t _sizeof() { return 12; }
00370 private:
00371 uint32_t _channel;
00372 uint32_t _signal;
00373 uint32_t _qualifier;
00374 };
00375 std::ostream& operator<<(std::ostream& str, Acqiris::TdcVetoIO::Channel enval);
00376 std::ostream& operator<<(std::ostream& str, Acqiris::TdcVetoIO::Mode enval);
00377 std::ostream& operator<<(std::ostream& str, Acqiris::TdcVetoIO::Termination enval);
00378
00379
00380
00381
00382
00383
00384
00385 class TdcConfigV1 {
00386 public:
00387 enum { TypeId = Pds::TypeId::Id_AcqTdcConfig };
00388 enum { Version = 1 };
00389 enum { NChannels = 8 };
00390 enum { NAuxIO = 2 };
00391 virtual ~TdcConfigV1();
00392
00393 virtual ndarray<const Acqiris::TdcChannel, 1> channels() const = 0;
00394
00395 virtual ndarray<const Acqiris::TdcAuxIO, 1> auxio() const = 0;
00396 virtual const Acqiris::TdcVetoIO& veto() const = 0;
00397 };
00398
00399
00400
00401
00402
00403
00404
00405 class TdcDataV1_Item {
00406 public:
00407
00408
00409
00410 enum Source {
00411 Comm,
00412 Chan1,
00413 Chan2,
00414 Chan3,
00415 Chan4,
00416 Chan5,
00417 Chan6,
00418 AuxIO,
00419 };
00420 TdcDataV1_Item(uint32_t arg__bf_val, Acqiris::TdcDataV1_Item::Source arg__bf_source, uint8_t arg__bf_ovf)
00421 : _value(((arg__bf_val) & 0xfffffff)|(((arg__bf_source) & 0x7)<<28)|(((arg__bf_ovf) & 0x1)<<31))
00422 {
00423 }
00424 TdcDataV1_Item() {}
00425
00426
00427 uint32_t value() const { return _value; }
00428 uint32_t bf_val_() const { return uint32_t(this->_value & 0xfffffff); }
00429
00430
00431 Acqiris::TdcDataV1_Item::Source source() const { return Source((this->_value>>28) & 0x7); }
00432 uint8_t bf_ofv_() const { return uint8_t((this->_value>>31) & 0x1); }
00433 static uint32_t _sizeof() { return 4; }
00434 private:
00435 uint32_t _value;
00436
00437 };
00438 std::ostream& operator<<(std::ostream& str, Acqiris::TdcDataV1_Item::Source enval);
00439
00440
00441
00442
00443
00444
00445
00446 class TdcDataV1Common: public TdcDataV1_Item {
00447 public:
00448 TdcDataV1Common() {}
00449
00450 uint32_t nhits() const;
00451
00452 uint8_t overflow() const;
00453 static uint32_t _sizeof() { return ((((Acqiris::TdcDataV1_Item::_sizeof())+1)-1)/1)*1; }
00454 };
00455
00456
00457
00458
00459
00460
00461
00462 class TdcDataV1Channel: public TdcDataV1_Item {
00463 public:
00464 TdcDataV1Channel() {}
00465
00466 uint32_t ticks() const;
00467
00468 uint8_t overflow() const;
00469
00470 double time() const;
00471 static uint32_t _sizeof() { return ((((Acqiris::TdcDataV1_Item::_sizeof())+1)-1)/1)*1; }
00472 };
00473
00474
00475
00476
00477
00478
00479
00480 class TdcDataV1Marker: public TdcDataV1_Item {
00481 public:
00482
00483
00484 enum Type {
00485 AuxIOSwitch = 0,
00486 EventCntSwitch = 1,
00487 MemFullSwitch = 2,
00488 AuxIOMarker = 16,
00489 };
00490 TdcDataV1Marker() {}
00491
00492 Acqiris::TdcDataV1Marker::Type type() const;
00493 static uint32_t _sizeof() { return ((((Acqiris::TdcDataV1_Item::_sizeof())+1)-1)/1)*1; }
00494 };
00495 std::ostream& operator<<(std::ostream& str, Acqiris::TdcDataV1Marker::Type enval);
00496
00497
00498
00499
00500
00501
00502
00503
00504 class TdcDataV1 {
00505 public:
00506 enum { TypeId = Pds::TypeId::Id_AcqTdcData };
00507 enum { Version = 1 };
00508 virtual ~TdcDataV1();
00509
00510 virtual ndarray<const Acqiris::TdcDataV1_Item, 1> data() const = 0;
00511 };
00512 }
00513 }
00514 #endif // PSANA_ACQIRIS_DDL_H