Eiger class added, DAC test

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@668 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
johnson_i
2013-09-13 13:17:11 +00:00
parent 78d2fa5bc6
commit 8f4a2cc182
7 changed files with 94 additions and 208 deletions

View File

@ -7,6 +7,7 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <fstream>
@ -79,11 +80,16 @@ Eiger::Eiger(){
Eiger::~Eiger(){
delete[] last_downloaded_trimbits;
ClearModules();
}
void Eiger::ClearModules(){
for(unsigned int i=0;i<modules.size();i++) delete modules[i];
modules.clear();
}
bool Eiger::Init(){
ClearModules();
AddModule(0,0xfff); //global send
@ -111,10 +117,8 @@ bool Eiger::Init(){
sprintf(st,"setup_mod%04d.txt",modules[i]->GetModuleNumber());
ReadSetUpFile(modules[i]->GetModuleNumber(),st);
}
CheckSetup();
return 1;
return CheckSetup();
}
@ -326,6 +330,21 @@ bool Eiger::CheckSetup(){
return ok;
}
unsigned int Eiger::GetNModules(){
if(modules.size()<=0) return 0;
return modules.size() - 1;
}
unsigned int Eiger::GetNHalfModules(){
unsigned int n_half_modules = 0;
for(unsigned int i=0;i<modules.size();i++){
if(modules[i]->TopAddressIsValid()) n_half_modules++;
if(modules[i]->BottomAddressIsValid()) n_half_modules++;
}
return n_half_modules;
}
bool Eiger::SetPhotonEnergy(unsigned int full_energy_eV){
photon_energy_eV = full_energy_eV;
cout<<"Setting photon energy to: "<<photon_energy_eV<<" eV"<<endl;
@ -538,6 +557,15 @@ bool Eiger::GetDAC(std::string s, float& ret_value){
return 1;
}
bool Eiger::GetDACName(unsigned int dac_num, std::string &s){
if(dac_num>=Module::ndacs){
cout<<"Warning: Eiger::GetDACName index out of range, "<<dac_num<<" invalid."<<endl;
return 0;
}
s = Module::dac_names[dac_num];
return 1;
}
bool Eiger::GetDACNumber(string s, unsigned int& n){
for(unsigned int i=0;i<Module::ndacs;i++){
if(!strcmp(Module::dac_names[i].c_str(),s.c_str())){