Commit ff2fee11 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Move ClockDiv, AllTrimBits, ThresholdEnergy to Eiger, add HighVoltage

parent 3be56345
......@@ -50,7 +50,6 @@ public:
typedef Defs::Settings Settings;
typedef Defs::DACIndex DACIndex;
typedef Defs::ADCIndex ADCIndex;
typedef Defs::ClockDiv ClockDiv;
typedef Defs::DetStatus DetStatus;
typedef Defs::NetworkParameter NetworkParameter;
......@@ -131,17 +130,8 @@ public:
void getADC(int sub_mod_idx, ADCIndex adc_idx, int& val);
void getADCList(ADCIndex adc_idx, IntList& val_list);
void setAllTrimBits(int sub_mod_idx, int val);
void getAllTrimBits(int sub_mod_idx, int& val);
void getAllTrimBitsList(IntList& val_list);
void setSettings(Settings settings);
void getSettings(Settings& settings);
void setThresholdEnergy(int thres);
void getThresholdEnergy(int& thres);
void setClockDiv(ClockDiv clock_div);
void getClockDiv(ClockDiv& clock_div);
void setNetworkParameter(NetworkParameter net_param, std::string& val);
void getNetworkParameter(NetworkParameter net_param, std::string& val);
......
......@@ -45,6 +45,8 @@ class Eiger : public Model
typedef unsigned short Word;
typedef unsigned int Long;
typedef Defs::ClockDiv ClockDiv;
enum ParallelMode {
NonParallel, Parallel, Safe,
};
......@@ -83,6 +85,19 @@ class Eiger : public Model
void setParallelMode(ParallelMode mode);
void getParallelMode(ParallelMode& mode);
void setClockDiv(ClockDiv clock_div);
void getClockDiv(ClockDiv& clock_div);
void setAllTrimBits(int sub_mod_idx, int val);
void getAllTrimBits(int sub_mod_idx, int& val);
void getAllTrimBitsList(IntList& val_list);
void setHighVoltage(int hvolt);
void getHighVoltage(int& hvolt);
void setThresholdEnergy(int thres);
void getThresholdEnergy(int& thres);
protected:
virtual void updateImageSize();
......@@ -319,7 +334,7 @@ class Eiger : public Model
}
int getNbEigerModules()
{ return m_nb_det_modules / 2; }
{ return getNbDetModules() / 2; }
static double KiloHzPeriod(double f)
{ return 1e6 / (f * 1e3); }
......@@ -343,7 +358,6 @@ class Eiger : public Model
static const int HalfModuleChips;
static const int RecvPorts;
int m_nb_det_modules;
FrameDim m_recv_frame_dim;
CorrList m_corr_list;
PortGeometryList m_port_geom_list;
......
......@@ -55,6 +55,12 @@ class Model
Type getType()
{ return m_type; }
int getNbDetModules()
{ return m_nb_det_modules; }
int getNbDetSubModules()
{ return m_nb_det_submodules; }
virtual std::string getName() = 0;
virtual void getPixelSize(double& x_size, double& y_size) = 0;
......@@ -68,6 +74,7 @@ class Model
protected:
void updateCameraModel();
void updateTimeRanges();
virtual void updateImageSize() = 0;
......@@ -90,6 +97,8 @@ class Model
Camera *m_cam;
Type m_type;
int m_nb_det_modules;
int m_nb_det_submodules;
protected:
AutoPtr<slsDetectorUsers> m_det;
......
......@@ -88,17 +88,8 @@ public:
void getADCList(SlsDetector::Defs::ADCIndex adc_idx,
std::vector<int>& val_list /Out/);
void setAllTrimBits(int sub_mod_idx, int val);
void getAllTrimBits(int sub_mod_idx, int& val /Out/);
void getAllTrimBitsList(std::vector<int>& val_list /Out/);
void setSettings(SlsDetector::Defs::Settings settings);
void getSettings(SlsDetector::Defs::Settings& settings /Out/);
void setThresholdEnergy(int thres);
void getThresholdEnergy(int& thres /Out/);
void setClockDiv(SlsDetector::Defs::ClockDiv clock_div);
void getClockDiv(SlsDetector::Defs::ClockDiv& clock_div /Out/);
void setNetworkParameter(SlsDetector::Defs::NetworkParameter net_param,
std::string& val /In,Out/);
......
......@@ -69,6 +69,19 @@ class Eiger : public SlsDetector::Model
void setParallelMode(SlsDetector::Eiger::ParallelMode mode);
void getParallelMode(SlsDetector::Eiger::ParallelMode& mode);
void setClockDiv(SlsDetector::Defs::ClockDiv clock_div);
void getClockDiv(SlsDetector::Defs::ClockDiv& clock_div /Out/);
void setAllTrimBits(int sub_mod_idx, int val);
void getAllTrimBits(int sub_mod_idx, int& val /Out/);
void getAllTrimBitsList(std::vector<int>& val_list /Out/);
void setHighVoltage(int hvolt);
void getHighVoltage(int& hvolt /Out/);
void setThresholdEnergy(int thres);
void getThresholdEnergy(int& thres /Out/);
protected:
virtual void updateImageSize();
......
......@@ -975,45 +975,6 @@ void Camera::getADCList(ADCIndex adc_idx, IntList& val_list)
getADC(i, adc_idx, val_list[i]);
}
void Camera::setAllTrimBits(int sub_mod_idx, int val)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(sub_mod_idx, val);
if ((sub_mod_idx < -1) || (sub_mod_idx >= getNbDetSubModules()))
THROW_HW_ERROR(InvalidValue) << DEB_VAR1(sub_mod_idx);
int ret = m_det->setAllTrimbits(val, sub_mod_idx);
if (ret == MultiSlsDetectorErr)
THROW_HW_ERROR(Error) << "Error setting all trim bits"
<< " on (sub)module " << sub_mod_idx;
}
void Camera::getAllTrimBits(int sub_mod_idx, int& val)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(sub_mod_idx);
if ((sub_mod_idx < 0) || (sub_mod_idx >= getNbDetSubModules()))
THROW_HW_ERROR(InvalidValue) << DEB_VAR1(sub_mod_idx);
int ret = m_det->setAllTrimbits(-1, sub_mod_idx);
if (ret == MultiSlsDetectorErr)
THROW_HW_ERROR(Error) << "Error getting all trim bits"
<< " on (sub)module " << sub_mod_idx;
val = ret;
DEB_RETURN() << DEB_VAR1(val);
}
void Camera::getAllTrimBitsList(IntList& val_list)
{
DEB_MEMBER_FUNCT();
int nb_sub_modules = getNbDetSubModules();
val_list.resize(nb_sub_modules);
for (int i = 0; i < nb_sub_modules; ++i)
getAllTrimBits(i, val_list[i]);
}
void Camera::setSettings(Settings settings)
{
DEB_MEMBER_FUNCT();
......@@ -1035,39 +996,6 @@ void Camera::getSettings(Settings& settings)
DEB_RETURN() << DEB_VAR1(settings);
}
void Camera::setThresholdEnergy(int thres)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(thres);
m_det->setThresholdEnergy(thres);
}
void Camera::getThresholdEnergy(int& thres)
{
DEB_MEMBER_FUNCT();
thres = m_det->getThresholdEnergy();
DEB_RETURN() << DEB_VAR1(thres);
}
void Camera::setClockDiv(ClockDiv clock_div)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(clock_div);
m_det->setClockDivider(clock_div);
if (m_model)
updateTimeRanges();
}
void Camera::getClockDiv(ClockDiv& clock_div)
{
DEB_MEMBER_FUNCT();
int ret = m_det->setClockDivider(-1);
if (ret == MultiSlsDetectorErr)
THROW_HW_ERROR(Error) << "Error getting clock divider";
clock_div = ClockDiv(ret);
DEB_RETURN() << DEB_VAR1(clock_div);
}
void Camera::setNetworkParameter(NetworkParameter net_param, string& val)
{
DEB_MEMBER_FUNCT();
......
......@@ -304,10 +304,10 @@ Eiger::Eiger(Camera *cam)
{
DEB_CONSTRUCTOR();
m_nb_det_modules = getCamera()->getNbDetModules();
DEB_TRACE() << "Using Eiger detector, " << DEB_VAR1(m_nb_det_modules);
int nb_det_modules = getNbDetModules();
DEB_TRACE() << "Using Eiger detector, " << DEB_VAR1(nb_det_modules);
for (int i = 0; i < m_nb_det_modules; ++i) {
for (int i = 0; i < nb_det_modules; ++i) {
for (int j = 0; j < RecvPorts; ++j) {
RecvPortGeometry *g = new RecvPortGeometry(this, i, j);
m_port_geom_list.push_back(g);
......@@ -329,7 +329,7 @@ void Eiger::getFrameDim(FrameDim& frame_dim, bool raw)
DEB_PARAM() << DEB_VAR1(raw);
getRecvFrameDim(frame_dim, raw, true);
Size size = frame_dim.getSize();
size *= Point(1, m_nb_det_modules);
size *= Point(1, getNbDetModules());
if (!raw)
for (int i = 0; i < getNbEigerModules() - 1; ++i)
size += Point(0, getInterModuleGap(i));
......@@ -466,7 +466,7 @@ void Eiger::getTimeRanges(TimeRanges& time_ranges)
ParallelMode parallel_mode;
getParallelMode(parallel_mode);
ClockDiv clock_div;
cam->getClockDiv(clock_div);
getClockDiv(clock_div);
PixelDepth pixel_depth;
cam->getPixelDepth(pixel_depth);
......@@ -578,6 +578,91 @@ void Eiger::getParallelMode(ParallelMode& mode)
DEB_RETURN() << DEB_VAR1(mode);
}
void Eiger::setClockDiv(ClockDiv clock_div)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(clock_div);
m_det->setClockDivider(clock_div);
updateTimeRanges();
}
void Eiger::getClockDiv(ClockDiv& clock_div)
{
DEB_MEMBER_FUNCT();
int ret = m_det->setClockDivider(-1);
if (ret == MultiSlsDetectorErr)
THROW_HW_ERROR(Error) << "Error getting clock divider";
clock_div = ClockDiv(ret);
DEB_RETURN() << DEB_VAR1(clock_div);
}
void Eiger::setAllTrimBits(int sub_mod_idx, int val)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(sub_mod_idx, val);
if ((sub_mod_idx < -1) || (sub_mod_idx >= getNbDetSubModules()))
THROW_HW_ERROR(InvalidValue) << DEB_VAR1(sub_mod_idx);
int ret = m_det->setAllTrimbits(val, sub_mod_idx);
if (ret == MultiSlsDetectorErr)
THROW_HW_ERROR(Error) << "Error setting all trim bits"
<< " on (sub)module " << sub_mod_idx;
}
void Eiger::getAllTrimBits(int sub_mod_idx, int& val)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(sub_mod_idx);
if ((sub_mod_idx < 0) || (sub_mod_idx >= getNbDetSubModules()))
THROW_HW_ERROR(InvalidValue) << DEB_VAR1(sub_mod_idx);
int ret = m_det->setAllTrimbits(-1, sub_mod_idx);
if (ret == MultiSlsDetectorErr)
THROW_HW_ERROR(Error) << "Error getting all trim bits"
<< " on (sub)module " << sub_mod_idx;
val = ret;
DEB_RETURN() << DEB_VAR1(val);
}
void Eiger::getAllTrimBitsList(IntList& val_list)
{
DEB_MEMBER_FUNCT();
int nb_sub_modules = getNbDetSubModules();
val_list.resize(nb_sub_modules);
for (int i = 0; i < nb_sub_modules; ++i)
getAllTrimBits(i, val_list[i]);
}
void Eiger::setHighVoltage(int hvolt)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(hvolt);
m_det->setHighVoltage(hvolt);
}
void Eiger::getHighVoltage(int& hvolt)
{
DEB_MEMBER_FUNCT();
hvolt = m_det->setHighVoltage(-1);
DEB_RETURN() << DEB_VAR1(hvolt);
}
void Eiger::setThresholdEnergy(int thres)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(thres);
m_det->setThresholdEnergy(thres);
}
void Eiger::getThresholdEnergy(int& thres)
{
DEB_MEMBER_FUNCT();
thres = m_det->setThresholdEnergy(-1);
DEB_RETURN() << DEB_VAR1(thres);
}
int Eiger::getRecvPorts()
{
DEB_MEMBER_FUNCT();
......
......@@ -32,6 +32,9 @@ Model::Model(Camera *cam, Type type)
{
DEB_CONSTRUCTOR();
DEB_PARAM() << DEB_VAR1(type);
m_nb_det_modules = m_cam->getNbDetModules();
m_nb_det_submodules = m_cam->getNbDetSubModules();
}
Model::~Model()
......@@ -48,6 +51,12 @@ void Model::updateCameraModel()
m_cam->setModel(this);
}
void Model::updateTimeRanges()
{
DEB_MEMBER_FUNCT();
m_cam->updateTimeRanges();
}
void Model::putCmd(const string& s, int idx)
{
DEB_MEMBER_FUNCT();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment