mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
trimbits not working yet, nth frame works for eiger, scans work for eiger
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -94,6 +93,7 @@ int EigerSendCMD(){
|
||||
}
|
||||
|
||||
int n = write(sockfd,eiger_message,eiger_message_length);
|
||||
|
||||
int ret_length = read(sockfd,eiger_message,eiger_max_message_length);
|
||||
|
||||
close(sockfd);
|
||||
@ -140,7 +140,7 @@ int EigerSetDAC(const char* iname,int v, int mV){
|
||||
|
||||
int EigerSetTrimbits(const int *data){
|
||||
eiger_ret_val=0;
|
||||
char tt[263681];
|
||||
/*char tt[263681];
|
||||
tt[263680]='\0';
|
||||
int ip=0, ich=0;
|
||||
int iy, ix;
|
||||
@ -150,16 +150,19 @@ int EigerSetTrimbits(const int *data){
|
||||
for(iy=0;iy<256;iy++) {
|
||||
for (ichip=0; ichip<4; ichip++) {
|
||||
for(ix=0;ix<256;ix++) {
|
||||
tt[ip++]=(char)(data[ich++]&(0x3f));
|
||||
tt[ip++]=(char)((data[ich++]&(0x3f))+'0');
|
||||
}
|
||||
if (ichip<3) {
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=(char)(0+'0');
|
||||
tt[ip++]=(char)(0+'0');
|
||||
}
|
||||
}
|
||||
}
|
||||
eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt);
|
||||
memcpy(saved_trimbits,data,256*256*4*sizeof(int));
|
||||
memcpy(saved_trimbits,data,256*256*4*sizeof(int));*/
|
||||
|
||||
eiger_message_length = sprintf(eiger_message,"settrimbits %d", 0);
|
||||
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
@ -167,41 +170,31 @@ int EigerSetTrimbits(const int *data){
|
||||
|
||||
int EigerSetAllTrimbits(unsigned int value){
|
||||
eiger_ret_val=0;
|
||||
char tt[263681];
|
||||
/*char tt[263681];
|
||||
tt[263680]='\0';
|
||||
int ip=0, ich=0;
|
||||
int iy, ix;
|
||||
int ichip;
|
||||
int sl=0;
|
||||
|
||||
|
||||
// convert the trimbits from int32 to chars and add border pixels.
|
||||
for(iy=0;iy<256;iy++) {
|
||||
for (ichip=0; ichip<4; ichip++) {
|
||||
for(ix=0;ix<256;ix++) {
|
||||
tt[ip++]=(char)(value&0x3f);
|
||||
tt[ip++]=(char)((value&0x3f)+'0');
|
||||
}
|
||||
if (ichip<3) {
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=(char)(0+'0');
|
||||
tt[ip++]=(char)(0+'0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char s2[270000];
|
||||
strcpy(s2,"settrimbits ");
|
||||
//for()
|
||||
sl=strlen(s2);
|
||||
strncpy(s2+sl,tt, 263680);
|
||||
s2[263680+sl]='\0';
|
||||
|
||||
eiger_message_length = strlen(s2);
|
||||
//eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt);
|
||||
for (iy=0;iy<263680;++iy)
|
||||
printf("%d:%c\t\t",iy,tt[iy]);
|
||||
printf("tfggt:%s , length :%d\n",tt, strlen(tt));
|
||||
printf("Command sent:%s , length :%d\n",s2, eiger_message_length);
|
||||
eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt);
|
||||
for(iy=0;iy<256*256*4;++iy)
|
||||
saved_trimbits[iy] = value;
|
||||
saved_trimbits[iy] = value;*/
|
||||
eiger_message_length = sprintf(eiger_message,"setalltrimbits %d", value);
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
@ -209,14 +202,16 @@ int EigerSetAllTrimbits(unsigned int value){
|
||||
|
||||
int EigerGetTrimbits(const int *data){
|
||||
eiger_ret_val=0;
|
||||
char tt[263681];
|
||||
/*char tt[263681];
|
||||
tt[263680]='\0';
|
||||
int ip=0, ich=0;
|
||||
int iy, ix;
|
||||
int ichip;
|
||||
|
||||
eiger_message_length = sprintf(eiger_message,"gettrimbits ");
|
||||
memcpy(data,saved_trimbits,256*256*4*sizeof(int));
|
||||
memcpy(data,saved_trimbits,256*256*4*sizeof(int));*/
|
||||
|
||||
eiger_message_length = sprintf(eiger_message,"gettrimbits ");
|
||||
return EigerSendCMD();
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ FebControl::FebControl(){
|
||||
staticBits=acquireNReadoutMode=triggerMode=externalEnableMode=subFrameMode=0;
|
||||
|
||||
trimbit_size=263680;
|
||||
last_downloaded_trimbits = new unsigned char [trimbit_size];
|
||||
last_downloaded_trimbits = new unsigned int [trimbit_size];
|
||||
|
||||
cout<<endl<<"Default Settings:"<<endl;
|
||||
nimages = 1;
|
||||
@ -697,19 +697,25 @@ float FebControl::GetDAC(string s){
|
||||
}
|
||||
*/
|
||||
|
||||
bool FebControl::SetTrimbits(unsigned int module_num, unsigned char *trimbits){
|
||||
printf("aaa\n");
|
||||
bool FebControl::SetTrimbits(unsigned int module_num, unsigned int *trimbits){
|
||||
printf("Setting Trimbits\n");
|
||||
|
||||
//for (int iy=10000;iy<20020;++iy)//263681
|
||||
//for (int iy=263670;iy<263680;++iy)//263681
|
||||
// printf("%d:%c\t\t",iy,trimbits[iy]);
|
||||
|
||||
|
||||
|
||||
unsigned int module_index=0;
|
||||
if(!GetModuleIndex(module_num,module_index)){
|
||||
cout<<"Warning could not set trimbits, bad module number."<<endl;
|
||||
return 0;
|
||||
}
|
||||
printf("bbb\n");
|
||||
|
||||
if(!Reset()) cout<<"Warning could not reset DAQ."<<endl;
|
||||
printf("ccc\n");
|
||||
|
||||
for(int l_r=0;l_r<2;l_r++){ // l_r loop
|
||||
unsigned int disable_chip_mask = l_r ? DAQ_CS_BAR_LEFT : DAQ_CS_BAR_RIGHT;
|
||||
|
||||
if(!(WriteRegister(0xfff,DAQ_REG_STATIC_BITS,disable_chip_mask|DAQ_STATIC_BIT_PROGRAM|DAQ_STATIC_BIT_M8)&&SetCommandRegister(DAQ_SET_STATIC_BIT)&&StartDAQOnlyNWaitForFinish())){
|
||||
cout<<"Could not select chips"<<endl;
|
||||
return 0;
|
||||
@ -733,31 +739,53 @@ bool FebControl::SetTrimbits(unsigned int module_num, unsigned char *trimbits){
|
||||
for(int row=0;row<16;row++){ //row loop
|
||||
int offset = 2*32*row;
|
||||
for(int sc=0;sc<32;sc++){ //supercolumn loop sc
|
||||
|
||||
int super_column_start_position_l = 1030*row + l_r *258 + sc*8;
|
||||
int super_column_start_position_r = 1030*row + 516 + l_r *258 + sc*8;
|
||||
|
||||
/*
|
||||
int super_column_start_position_l = 1024*row + l_r *256 + sc*8; //256 per row, 8 per super column
|
||||
int super_column_start_position_r = 1024*row + 512 + l_r *256 + sc*8; //256 per row, 8 per super column
|
||||
*/
|
||||
int chip_sc = 31 - sc;
|
||||
trimbits_to_load_l[offset+chip_sc] = 0;
|
||||
trimbits_to_load_r[offset+chip_sc] = 0;
|
||||
for(int i=0;i<8;i++){ // column loop i
|
||||
|
||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_l+i])<<((7-i)*4);//low
|
||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_l+i])>>3)<<((7-i)*4);//upper
|
||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_r+i])<<((7-i)*4);//low
|
||||
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_r+i])>>3)<<((7-i)*4);//upper
|
||||
/*
|
||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])<<((7-i)*4);//low
|
||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])>>3)<<((7-i)*4);//upper
|
||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])<<((7-i)*4);//low
|
||||
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])>>3)<<((7-i)*4);//upper
|
||||
*/
|
||||
|
||||
} // end column loop i
|
||||
} //end supercolumn loop sc
|
||||
} //end row loop
|
||||
|
||||
if(!WriteMemory(modules[0]->GetTopLeftAddress(),0,0,1024,trimbits_to_load_r)||!WriteMemory(modules[0]->GetTopRightAddress(),0,0,1024,trimbits_to_load_l)||!StartDAQOnlyNWaitForFinish()) return 0;
|
||||
/*
|
||||
if(!WriteMemory(modules[0]->GetTopLeftAddress(),0,0,1024,trimbits_to_load_r)||!WriteMemory(modules[0]->GetTopRightAddress(),0,0,1024,trimbits_to_load_l)||!StartDAQOnlyNWaitForFinish()){
|
||||
cout <<" some errror!"<< endl;
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
if(!WriteMemory(modules[0]->GetTopLeftAddress(),0,0,1023,trimbits_to_load_r)||!WriteMemory(modules[0]->GetTopRightAddress(),0,0,1023,trimbits_to_load_l)||!StartDAQOnlyNWaitForFinish()){
|
||||
cout <<" some errror!"<< endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} //end row_set loop (groups of 16 rows)
|
||||
} // end l_r loop
|
||||
|
||||
memcpy(last_downloaded_trimbits,trimbits,trimbit_size*sizeof(unsigned char));
|
||||
|
||||
return SetStaticBits(); //send the static bits
|
||||
}
|
||||
|
||||
|
||||
unsigned char* FebControl::GetTrimbits(){
|
||||
unsigned int* FebControl::GetTrimbits(){
|
||||
return last_downloaded_trimbits;
|
||||
}
|
||||
|
||||
@ -1191,4 +1219,79 @@ bool FebControl::StopAcquisition(){
|
||||
|
||||
|
||||
|
||||
bool FebControl::LoadTrimbitFile(){
|
||||
string filename = "/home/root/noise.snbeb040";
|
||||
ifstream input_file;
|
||||
|
||||
int ndacs =16;
|
||||
int dacs[ndacs];
|
||||
unsigned int chanregs[trimbit_size];
|
||||
|
||||
|
||||
input_file.open(filename.c_str() ,ifstream::binary);
|
||||
if(!input_file.is_open()){
|
||||
cout<<"Warning, could not open trimbit file: "<<filename<<endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//dacs
|
||||
for(int i=0;i<ndacs;++i){
|
||||
input_file.read((char*) &dacs[i],sizeof(int));
|
||||
cout << " dac " << i << ":"<< Module::dac_names[i] << ":" << dacs[i] << endl;
|
||||
SetDAC(Module::dac_names[i],dacs[i]);
|
||||
|
||||
}
|
||||
|
||||
cout << "Loading trimbits from file " << filename << endl;
|
||||
|
||||
//trimbits
|
||||
input_file.read((char*) chanregs,trimbit_size*sizeof(unsigned int));
|
||||
if(input_file.eof()){
|
||||
cout<<endl<<"Error, could not load trimbits end of file, "<<filename<<", reached."<<endl<<endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
input_file.close();
|
||||
|
||||
return SetTrimbits(0,chanregs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool FebControl::SaveTrimbitFile(){
|
||||
string filename = "/home/root/noise.snbeb040";
|
||||
ofstream output_file;
|
||||
|
||||
int ndacs =16;
|
||||
int dacs[ndacs];
|
||||
|
||||
output_file.open(filename.c_str() ,ofstream::binary);
|
||||
if(!output_file.is_open()){
|
||||
cout<<"Warning, could not open trimbit file: "<<filename<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cout << "Writing trimbits to file " << filename << endl;
|
||||
|
||||
//dacs
|
||||
for(int i=0;i<ndacs;++i){
|
||||
GetDAC(Module::dac_names[i], dacs[i]);
|
||||
output_file.write((char*) &dacs[i],sizeof(int));
|
||||
cout << " dac " << i << ":"<< Module::dac_names[i] << ":" << dacs[i] << endl;
|
||||
}
|
||||
|
||||
//trimbits
|
||||
output_file.write((char*) last_downloaded_trimbits,trimbit_size * sizeof(unsigned int));
|
||||
|
||||
output_file.close();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool FebControl::SaveAllTrimbitsTo(int value){
|
||||
unsigned int chanregs[trimbit_size];
|
||||
for(int i=0;i<trimbit_size;i++)
|
||||
chanregs[i] = value;
|
||||
return SetTrimbits(0,chanregs);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class FebControl:private FebInterface{
|
||||
float exposure_period_in_sec;
|
||||
|
||||
unsigned int trimbit_size;
|
||||
unsigned char* last_downloaded_trimbits;
|
||||
unsigned int* last_downloaded_trimbits;
|
||||
|
||||
void PrintModuleList();
|
||||
bool GetModuleIndex(unsigned int module_number, unsigned int& module_index);
|
||||
@ -150,11 +150,17 @@ class FebControl:private FebInterface{
|
||||
bool GetDAC(std::string s, int& ret_value, bool voltage_mv=0);
|
||||
bool GetDACName(unsigned int dac_num, std::string &s);
|
||||
|
||||
bool SetTrimbits(unsigned int module_num, unsigned char* trimbits);
|
||||
unsigned char* GetTrimbits();
|
||||
bool SetTrimbits(unsigned int module_num, unsigned int* trimbits);
|
||||
unsigned int* GetTrimbits();
|
||||
|
||||
|
||||
/**Added by Dhanya */
|
||||
bool LoadTrimbitFile();
|
||||
bool SaveTrimbitFile();
|
||||
bool SaveAllTrimbitsTo(int value);
|
||||
|
||||
|
||||
|
||||
bool Reset();
|
||||
bool StartAcquisition();
|
||||
bool StopAcquisition();
|
||||
|
@ -158,9 +158,9 @@ bool FebInterface::WriteMemory(unsigned int sub_num, unsigned int mem_num, unsig
|
||||
mem_num &= 0x3f;
|
||||
start_address &= 0x3fff;
|
||||
nwrites &= 0x3ff;
|
||||
if(!nwrites||nwrites>send_buffer_size-2) return 0;
|
||||
if(!nwrites||nwrites>send_buffer_size-2) {cout<<"error herer: nwrites:"<<nwrites<<endl;return 0;}//*d-1026
|
||||
|
||||
send_ndata = nwrites+2;
|
||||
send_ndata = nwrites+2;//*d-1025
|
||||
send_data[0] = 0xc0000000 | mem_num << 24 | nwrites << 14 | start_address; //cmd -> write to memory, nwrites, mem number, start address
|
||||
send_data[nwrites+1] = 0;
|
||||
for(unsigned int i=0;i<nwrites;i++) send_data[i+1] = values[i];
|
||||
|
@ -30,6 +30,7 @@ enum cmd_string {evNotFound,
|
||||
evSetDACValue,evGetDACValue,evSetDACVoltage,evGetDACVoltage,evSetHighVoltage,//evGetHighVoltage,
|
||||
|
||||
evSetTrimBits,
|
||||
evSetAllTrimBits,
|
||||
evGetTrimBits,
|
||||
//evLoadTrimBitFile,
|
||||
|
||||
@ -64,6 +65,7 @@ void init(){
|
||||
enum_map["getdacvoltage"] = evGetDACVoltage;
|
||||
enum_map["sethighvoltage"] = evSetHighVoltage;
|
||||
enum_map["settrimbits"] = evSetTrimBits;
|
||||
enum_map["setalltrimbits"] = evSetAllTrimBits;
|
||||
enum_map["gettrimbits"] = evGetTrimBits;
|
||||
// enum_map["loadtrimbitfile"] = evLoadTrimBitFile;
|
||||
enum_map["setbitmode"] = evSetBitMode;
|
||||
@ -118,8 +120,8 @@ int main(int argc, char* argv[]){
|
||||
if(!SetupListenSocket(port_number)) return 1;
|
||||
|
||||
|
||||
int length=1000;
|
||||
char data[1000];
|
||||
int length=270000;
|
||||
char data[270000];
|
||||
|
||||
int stop = 0;
|
||||
time_t rawtime;
|
||||
@ -128,13 +130,14 @@ int main(int argc, char* argv[]){
|
||||
|
||||
while(!stop){
|
||||
|
||||
cout<<endl<<"\n\n\n\nWaiting for command -> "<<flush;
|
||||
/*cout<<"Waiting for command -> "<<flush;*/
|
||||
int nread = AccpetConnectionAndWaitForData(data,length);
|
||||
|
||||
if(nread<=0) return 0;
|
||||
|
||||
time(&rawtime); timeinfo=localtime(&rawtime);
|
||||
cout<<asctime(timeinfo);
|
||||
cout<<" Command received: "<<data<<endl<<endl;
|
||||
/*cout<<" Command received: "<<data<<endl;*/
|
||||
|
||||
|
||||
|
||||
@ -142,13 +145,15 @@ int main(int argc, char* argv[]){
|
||||
float v[4];//,v2,v3,v4,v5;
|
||||
int n[5];
|
||||
|
||||
|
||||
|
||||
string cmd = GetNextString(data,1);
|
||||
int ret_val = 1;
|
||||
|
||||
string return_message = "\n\n\tCommand recieved: ";
|
||||
string return_message = "";/*\n\n\tCommand recieved: ";
|
||||
return_message.append(data);
|
||||
return_message.append("\n");
|
||||
|
||||
*/
|
||||
int return_start_pos;
|
||||
while(cmd.length()>0){
|
||||
int ret_parameter = 0;
|
||||
@ -211,7 +216,7 @@ int main(int argc, char* argv[]){
|
||||
tmp_str[0] = GetNextString(data);
|
||||
|
||||
if(tmp_str[0].length()>0&&feb_controler->GetDAC(tmp_str[0],ret_parameter)){
|
||||
return_message.append("\tExecuted: GetDACValue "); return_message.append(tmp_str[0]+" -> ");AddNumber(return_message,ret_parameter); return_message.append(" mV\n");
|
||||
return_message.append("\tExecuted: GetDACValue "); return_message.append(tmp_str[0]+" -> ");AddNumber(return_message,ret_parameter); return_message.append("\n");
|
||||
ret_val = 0;
|
||||
}else{
|
||||
return_message.append("\tError executing: GetDACValue <dac_name>\n");
|
||||
@ -260,19 +265,44 @@ int main(int argc, char* argv[]){
|
||||
|
||||
case evSetTrimBits :
|
||||
tmp_str[0] = GetNextString(data);
|
||||
/*char tt[263681];*/
|
||||
for(int i=0;i<10;i++)
|
||||
cout <<i<<":"<<tmp_str[0][i]<<"\t\t";
|
||||
printf("Cjhgkfdjg :%s\n",tmp_str[0].c_str());
|
||||
feb_controler->SetTrimbits(0,(unsigned char*)(tmp_str[0].c_str()));
|
||||
return_message.append("\tExecuted: SetTrimBits "); AddNumber(return_message,n[0]); return_message.append("\n");
|
||||
ret_val = 0;
|
||||
if(feb_controler->LoadTrimbitFile()){
|
||||
/* if(1){*/
|
||||
/*tmp_str[0] = GetNextString(data);
|
||||
feb_controler->SetTrimbits(0,(unsigned char*)(tmp_str[0].c_str()));*/
|
||||
return_message.append("\tExecuted: SetTrimBits\n");
|
||||
ret_val = 0;
|
||||
}else{
|
||||
return_message.append("\tError executing: SetTrimBits \n");
|
||||
ret_val = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case evSetAllTrimBits :
|
||||
tmp_str[0] = GetNextString(data);
|
||||
n[0] = atoi(tmp_str[0].data());
|
||||
if(feb_controler->SaveAllTrimbitsTo(n[0])){
|
||||
/*feb_controler->SetTrimbits(0,(unsigned char*)(tmp_str[0].c_str()));*/
|
||||
/*if(1){*/
|
||||
return_message.append("\tExecuted: SetAllTrimBits\n");
|
||||
ret_val = 0;
|
||||
}else{
|
||||
return_message.append("\tError executing: SetAllTrimBits \n");
|
||||
ret_val = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case evGetTrimBits :
|
||||
/*strcpy(ret_parameter, feb_controler->GetTrimbits()); parameter to pass string*/
|
||||
return_message.append("\tExecuted: GetTrimBits "); AddNumber(return_message,n[0]); return_message.append("\n");
|
||||
ret_val = 0;
|
||||
if(feb_controler->SaveTrimbitFile()){
|
||||
/*if(1){*/
|
||||
/*tmp_str[0] = GetNextString(data);
|
||||
feb_controler->GetTrimbits();*/
|
||||
return_message.append("\tExecuted: GetTrimBits\n");
|
||||
ret_val = 0;
|
||||
}else{
|
||||
return_message.append("\tError executing: GetTrimBits \n");
|
||||
ret_val = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -464,11 +494,11 @@ int main(int argc, char* argv[]){
|
||||
|
||||
cmd = GetNextString(data);
|
||||
}
|
||||
return_message.append("\n\n\n");
|
||||
/*return_message.append("\n\n\n");*/
|
||||
|
||||
AddNumber(return_message,ret_val,0,1);
|
||||
cout<<return_message.c_str()<<endl;
|
||||
cout<<"\treturn: "<<ret_val<<endl;
|
||||
cout<<return_message.c_str()<<"\t\t";
|
||||
cout<<"return: "<<ret_val<<endl;
|
||||
|
||||
if(!WriteNClose(return_message.c_str(),return_message.length())) return 0;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -27,7 +27,7 @@ int initDetector(){
|
||||
int imod,i,n;
|
||||
n = getNModBoard(1);
|
||||
|
||||
printf("This is the EIGER Server\n");
|
||||
printf("This is the EIGER Server of revision %llx\n", getDetectorId(DETECTOR_SOFTWARE_VERSION));
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("Board is for %d half modules\n",n);
|
||||
@ -307,6 +307,13 @@ int setModule(sls_detector_module myMod){
|
||||
|
||||
|
||||
int getModule(sls_detector_module *myMod){
|
||||
int i;
|
||||
int retval[2];
|
||||
for(i=0;i<NDAC;i++)
|
||||
setDAC((enum detDacIndex)i,-1,-1,0,retval);
|
||||
|
||||
EigerGetTrimbits(myMod->chanregs);
|
||||
|
||||
if (detectorModules)
|
||||
copyModule(myMod,detectorModules);/*copyModule(myMod,detectorModules+iMod);*/
|
||||
else
|
||||
|
@ -4420,7 +4420,7 @@ slsDetectorDefs::runStatus multiSlsDetector::startReceiverReadout(){
|
||||
}
|
||||
}
|
||||
|
||||
*stoppedFlag=1;
|
||||
/**stoppedFlag=1;*/
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -3561,9 +3561,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
if (t>=0)
|
||||
thisDetector->timerValue[index]=t;
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) {
|
||||
setDynamicRange();
|
||||
|
@ -423,7 +423,13 @@ int slsDetectorActions::executeScan(int level, int istep) {
|
||||
setThresholdEnergy((int)currentScanVariable[level]); //energy scan
|
||||
break;
|
||||
case thresholdScan:
|
||||
setDAC((dacs_t)currentScanVariable[level],THRESHOLD,0); // threshold scan
|
||||
if(getDetectorsType() == EIGER){
|
||||
setDAC((dacs_t)currentScanVariable[level],E_Vcmp_ll,0); // threshold scan
|
||||
setDAC((dacs_t)currentScanVariable[level],E_Vcmp_lr,0); // threshold scan
|
||||
setDAC((dacs_t)currentScanVariable[level],E_Vcmp_rl,0); // threshold scan
|
||||
setDAC((dacs_t)currentScanVariable[level],E_Vcmp_rr,0); // threshold scan
|
||||
}else
|
||||
setDAC((dacs_t)currentScanVariable[level],THRESHOLD,0); // threshold scan
|
||||
break;
|
||||
case trimbitsScan:
|
||||
trimbit=(int)currentScanVariable[level];
|
||||
|
@ -197,6 +197,11 @@ class slsDetectorActions : public virtual slsDetectorBase
|
||||
*/
|
||||
virtual dacs_t setDAC(dacs_t val, dacIndex index , int mV, int imod=-1)=0;
|
||||
|
||||
/** returns the detector type
|
||||
\param pos position in the multi detector structure (is -1 returns type of detector with id -1)
|
||||
\returns type
|
||||
*/
|
||||
virtual detectorType getDetectorsType(int pos=-1)=0;
|
||||
|
||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
||||
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
||||
|
@ -241,7 +241,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
case EIGER:
|
||||
infile.open(myfname.c_str(),ifstream::binary);
|
||||
if (infile.is_open()) {
|
||||
infile.read((char*) myMod->dacs,sizeof(int)*(myMod->ndac));
|
||||
infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac));
|
||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||
#ifdef VERBOSE
|
||||
for(int i=0;i<myMod->ndac;i++)
|
||||
@ -381,7 +381,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
||||
for(int i=0;i<mod.ndac;i++)
|
||||
std::cout << "dac " << i << ":" << mod.dacs[i] << std::endl;
|
||||
#endif
|
||||
outfile.write((char*)mod.dacs, sizeof(int)*(mod.ndac));
|
||||
outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac));
|
||||
outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan));
|
||||
|
||||
outfile.close();
|
||||
|
@ -461,7 +461,7 @@ void* postProcessing::processData(int delflag) {
|
||||
*/
|
||||
|
||||
|
||||
int progress = 0;
|
||||
int progress = -1;
|
||||
char currentfName[MAX_STR_LENGTH]="";
|
||||
int currentfIndex = -1;
|
||||
bool newData = false;
|
||||
@ -502,6 +502,7 @@ void* postProcessing::processData(int delflag) {
|
||||
|
||||
|
||||
if (dataReady){
|
||||
|
||||
//for random reads, ask only if it has new data
|
||||
if(!newData){
|
||||
if(currentfIndex > progress)
|
||||
@ -525,13 +526,12 @@ void* postProcessing::processData(int delflag) {
|
||||
currentfIndex = -1;
|
||||
cout<<"****Detector Data returned is NULL***"<<endl;
|
||||
}
|
||||
|
||||
if(nthframe){
|
||||
/*if(nthframe){
|
||||
if((currentfIndex == -1) || (currentfIndex == progress))
|
||||
currentfIndex = -1;
|
||||
else
|
||||
progress = currentfIndex;
|
||||
}
|
||||
}*/
|
||||
|
||||
//not garbage frame
|
||||
if (currentfIndex >= 0) {
|
||||
|
Reference in New Issue
Block a user