Skip to content

Commit

Permalink
Merge branch 'jgalan_bipo' of github.com:rest-for-physics/rawlib into…
Browse files Browse the repository at this point in the history
… jgalan_bipo
  • Loading branch information
jgalan committed May 17, 2023
2 parents 68fc33d + 727f4e3 commit 5c49bed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
37 changes: 18 additions & 19 deletions inc/TRestRawBiPoToSignalProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,28 @@
#include "TRestRawSignalEvent.h"
#include "TRestRawToSignalProcess.h"

static const size_t CTAG_SZ = 4;
static constexpr size_t CTAG_SZ = 4;

const int MATACQ_N_CH = 4; // Number of channels
const int MATACQ_MAX_DATA_SAMP = 10240; // Max number of samples for
const int MATACQ_BIPO_TIMEOUT = 0; // BiPo mode timeout
constexpr int MATACQ_N_CH = 4; // Number of channels
constexpr int MATACQ_MAX_DATA_SAMP = 10240; // Max number of samples for
constexpr int MATACQ_BIPO_TIMEOUT = 0; // BiPo mode timeout
static constexpr uint32_t MATACQ_UNDERFLOW = 0x0000;
static constexpr uint32_t MATACQ_ZERO = 0x8000;
static constexpr uint32_t MATACQ_OVERFLOW = 0xFFFF;

static const int MATACQ_UNDERFLOW = 0x0000;
static const int MATACQ_ZERO = 0x8000;
static const int MATACQ_OVERFLOW = 0xFFFF;

const std::string TAG_RUN_START = "STA";
const std::string TAG_RUN_BIPO = "ST2";
const std::string TAG_RUN_STOP = "STO";
const std::string TAG_ACQ = "ACQ";
const std::string TAG_ACQ_2 = "AC2";
constexpr std::string TAG_RUN_START = "STA";
constexpr std::string TAG_RUN_BIPO = "ST2";
constexpr std::string TAG_RUN_STOP = "STO";
constexpr std::string TAG_ACQ = "ACQ";
constexpr std::string TAG_ACQ_2 = "AC2";

/// A structure to store the configuration settings of Matacq board
struct MatacqBoard {
/// The base memory address of the Matacq board
int32_t address;

int32_t en_ch[MATACQ_N_CH];
int32_t trg_ch[MATACQ_N_CH];
std::array<int32_t, MATACQ_N_CH> en_ch;
std::array<int32_t, MATACQ_N_CH> trg_ch;

int32_t Trig_Type;

Expand All @@ -62,7 +61,7 @@ struct MatacqBoard {

int32_t Sampling_GHz;

int32_t ch_shifts[MATACQ_N_CH];
std::array<int32_t, MATACQ_N_CH> ch_shifts;

int32_t nChannels;
};
Expand All @@ -74,9 +73,9 @@ struct BiPoSettings {
int32_t Win1_Posttrig;
int32_t Timeout_200KHz;

int32_t Trig_Chan[MATACQ_N_CH];
int32_t Level1_mV[MATACQ_N_CH];
int32_t Level2_mV[MATACQ_N_CH];
std::array<int32_t, MATACQ_N_CH> Trig_Chan;
std::array<int32_t, MATACQ_N_CH> Level1_mV;
std::array<int32_t, MATACQ_N_CH> Level2_mV;

int32_t t1_window;
int32_t t2_window;
Expand Down
6 changes: 3 additions & 3 deletions src/TRestRawBiPoToSignalProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void TRestRawBiPoToSignalProcess::ReadBiPoSetup() {
/// the triggered board address will be returned and it will be used
/// later on to generate a signal id.
///
Int_t TRestRawBiPoToSignalProcess::ReadBiPoEventData(uint16_t* mdata) {
Int_t TRestRawBiPoToSignalProcess::ReadBiPoEventData(std::vector<uint16_t>& mdata) {
int32_t tmp;
if (fread(&tmp, sizeof(int32_t), 1, fInputBinFile) != 1) {
printf("Error: could not read tmp .\n");
Expand Down Expand Up @@ -502,8 +502,8 @@ Int_t TRestRawBiPoToSignalProcess::ReadBiPoEventData(uint16_t* mdata) {
}
totalBytesReaded += sizeof(int32_t);
RESTDebug << " T1-T2 distance --> " << tmp << RESTendl;

if (fread(mdata, sizeof(uint16_t), data_size, fInputBinFile) != (size_t)data_size) {
mdata.resize(data_size);
if (fread(&mdata[0], sizeof(uint16_t), data_size, fInputBinFile) != (size_t)data_size) {
printf("Error: could not read MATACQ data.\n");
exit(1);
}
Expand Down

0 comments on commit 5c49bed

Please sign in to comment.