mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
Merge branch 'developer' into gui
This commit is contained in:
commit
b6bba0b7bc
@ -38,7 +38,7 @@
|
|||||||
#include "Mythen3_01_jctbData.h"
|
#include "Mythen3_01_jctbData.h"
|
||||||
#include "Mythen3_02_jctbData.h"
|
#include "Mythen3_02_jctbData.h"
|
||||||
#include "adcSar2_jctbData.h"
|
#include "adcSar2_jctbData.h"
|
||||||
#include "moench04CtbReceiverData.h"
|
#include "moench04CtbZmqData.h"
|
||||||
#include "deserializer.h"
|
#include "deserializer.h"
|
||||||
#include "detectorData.h"
|
#include "detectorData.h"
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
|||||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||||
hframe->AddFrame(eNumCount,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
hframe->AddFrame(eNumCount,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||||
eNumCount->MapWindow();;
|
eNumCount->MapWindow();;
|
||||||
eNumCount->SetNumber(64*3);
|
eNumCount->SetNumber(128*3);
|
||||||
e= eNumCount->TGNumberEntry::GetNumberEntry();
|
e= eNumCount->TGNumberEntry::GetNumberEntry();
|
||||||
eNumCount->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeNumberOfChannels(Long_t)");
|
eNumCount->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeNumberOfChannels(Long_t)");
|
||||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeNumberOfChannels()");
|
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeNumberOfChannels()");
|
||||||
@ -633,8 +633,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
|||||||
|
|
||||||
|
|
||||||
// mgAdcs=new TMultiGraph();
|
// mgAdcs=new TMultiGraph();
|
||||||
// bitStack=new THStack();
|
bitStack=new THStack();
|
||||||
bitStack=adcStack;
|
// bitStack=adcStack;
|
||||||
TH1F *hb;
|
TH1F *hb;
|
||||||
for (int i=0; i<NSIGNALS; i++) {
|
for (int i=0; i<NSIGNALS; i++) {
|
||||||
sprintf(tit,"bit%d",i);
|
sprintf(tit,"bit%d",i);
|
||||||
@ -670,7 +670,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
|||||||
dataStructure=NULL;
|
dataStructure=NULL;
|
||||||
commonMode=NULL;
|
commonMode=NULL;
|
||||||
photonFinder=NULL;
|
photonFinder=NULL;
|
||||||
h2DMap=NULL;
|
h2DMapAn=NULL;
|
||||||
|
h2DMapDig=NULL;
|
||||||
//h2Scan=NULL;
|
//h2Scan=NULL;
|
||||||
h1DMap=NULL;
|
h1DMap=NULL;
|
||||||
|
|
||||||
@ -901,86 +902,46 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
|||||||
|
|
||||||
uint16_t aval;
|
uint16_t aval;
|
||||||
i=0;
|
i=0;
|
||||||
for (ip=0; ip<nAnalogSamples; ip++) {
|
|
||||||
for (ii=0; ii<nadc; ii++) {
|
|
||||||
//for (ip=0; ip<adclist.size(); ip++) {
|
char *d_data= data->cvalues+2*nadc*nAnalogSamples;
|
||||||
|
char dval;
|
||||||
|
|
||||||
|
|
||||||
|
if (dataStructure) {
|
||||||
|
|
||||||
|
|
||||||
|
for (int x=0; x<nx; x++) {
|
||||||
|
for (int y=0; y<ny; y++) {
|
||||||
|
ped=0;
|
||||||
|
aval=dataStructure->getValue(data->cvalues,x,y);
|
||||||
|
|
||||||
if (adclist.empty())
|
|
||||||
ig=ii;
|
|
||||||
else
|
|
||||||
ig=adclist.at(ii);
|
|
||||||
|
|
||||||
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
|
||||||
|
|
||||||
// cout << "asample " << ip << " adc " << ig << " " << i << " " << aval << endl;
|
|
||||||
|
|
||||||
ped=0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dataStructure) {
|
|
||||||
dataStructure->getPixel(i,x,y);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (cbGetPedestal->IsOn()) {
|
if (cbGetPedestal->IsOn()) {
|
||||||
if (photonFinder) {
|
if (photonFinder) {
|
||||||
photonFinder->addToPedestal(aval,x,y);
|
photonFinder->addToPedestal(aval,x,y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plotFlag[ig]) {
|
if (cbSubtractPedestal->IsOn()) {
|
||||||
|
if (photonFinder) {
|
||||||
if (cbSubtractPedestal->IsOn()) {
|
ped=photonFinder->getPedestal(x,y,cmSub);
|
||||||
if (photonFinder) {
|
|
||||||
ped=photonFinder->getPedestal(x,y,cmSub);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//normal filling except when deserializer
|
|
||||||
if (h2DMap)
|
|
||||||
h2DMap->SetBinContent(x+1,y+1,aval-ped);
|
|
||||||
if (h1DMap){
|
|
||||||
h1DMap->SetBinContent(x+1,aval-ped);
|
|
||||||
// cout << "plotting 1D " << endl;
|
|
||||||
}
|
|
||||||
// if (h2Scan) {
|
|
||||||
// //cout << "plotting Scan " << endl;
|
|
||||||
// h2Scan->SetBinContent((x+1)+y*nx,iScanStep+1,data->getChannel(i)-ped);
|
|
||||||
// } else
|
|
||||||
// cout << "No scan (analog)" << endl;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (h2DMapAn)
|
||||||
|
h2DMapAn->SetBinContent(x+1,y+1,aval-ped);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (h2DMapDig)
|
||||||
|
h2DMapDig->SetBinContent(x+1,y+1,dataStructure->getGain(data->cvalues,x,y));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (enableFlag[ig]) {
|
|
||||||
h=adcHisto[ig];
|
|
||||||
h1=countsHisto[ig];
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (plotFlag[ig]) {
|
|
||||||
// cout << data->getChannel(i) << endl;
|
|
||||||
h->SetBinContent(ip+1,aval-ped);
|
|
||||||
h1->Fill(aval-ped);
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
}
|
|
||||||
|
|
||||||
char *d_data= data->cvalues+2*nadc*nAnalogSamples;
|
|
||||||
char dval;
|
|
||||||
|
|
||||||
|
|
||||||
/**** Digital Samples ****/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (deserializer) {
|
if (deserializer) {
|
||||||
|
cout << "deserializer"<< endl;
|
||||||
if (dbitlist.empty())
|
if (dbitlist.empty())
|
||||||
val=deserializer::deserializeAll(d_data,plotlist,dr,nx,soff);//dataStructure->getData(d_data);
|
val=deserializer::deserializeAll(d_data,plotlist,dr,nx,soff);//dataStructure->getData(d_data);
|
||||||
else
|
else
|
||||||
@ -988,168 +949,210 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
|||||||
|
|
||||||
|
|
||||||
if (val) {
|
if (val) {
|
||||||
// if (h2DMap) {
|
|
||||||
// for (x=0; x<nx; x++) {
|
|
||||||
// for (y=0; y<ny; y++) {
|
|
||||||
// h2DMap->SetBinContent(x+1,y+1,val[y][x]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (h1DMap){
|
if (h1DMap){
|
||||||
for (x=0; x<nx; x++) {
|
for (x=0; x<nx; x++) {
|
||||||
h1DMap->SetBinContent(x+1,val[x]);
|
h1DMap->SetBinContent(x+1,val[x]);
|
||||||
// cout << dec << x << " " << val[0][x] << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (h2Scan) {
|
|
||||||
// for (x=0; x<nx; x++) {
|
|
||||||
// for (y=0; y<ny; y++) {
|
|
||||||
// //cout << "plotting Scan " << (x+1)+y*nx << " " << iScanStep+1 << " " << val[y][x] << endl;
|
|
||||||
// h2Scan->SetBinContent((x+1)+y*nx,iScanStep+1,val[y][x]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else
|
|
||||||
// cout << "No scan (digital)" << endl;
|
|
||||||
|
|
||||||
|
|
||||||
delete [] val;
|
delete [] val;
|
||||||
} else
|
} else
|
||||||
cout << "get val did not succeed"<<endl;
|
cout << "get val did not succeed"<<endl;
|
||||||
}
|
} else {
|
||||||
|
cout << "analog histo " << endl;
|
||||||
|
for (ip=0; ip<nAnalogSamples; ip++) {
|
||||||
|
for (ii=0; ii<nadc; ii++) {
|
||||||
|
//for (ip=0; ip<adclist.size(); ip++) {
|
||||||
|
if (adclist.empty())
|
||||||
|
ig=ii;
|
||||||
|
else
|
||||||
|
ig=adclist.at(ii);
|
||||||
|
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
||||||
|
|
||||||
|
if (plotFlag[ig]) {
|
||||||
|
|
||||||
|
//if (enableFlag[ig]) {
|
||||||
|
h=adcHisto[ig];
|
||||||
|
h1=countsHisto[ig];
|
||||||
|
//}
|
||||||
|
|
||||||
|
// cout << data->getChannel(i) << endl;
|
||||||
|
h->SetBinContent(ip+1,aval);
|
||||||
|
h1->Fill(aval);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cout << "bit histo"<< endl;
|
||||||
|
|
||||||
|
if (dbitlist.empty()) {
|
||||||
|
for (ip=0; ip<nDigitalSamples; ip++) {
|
||||||
if (dbitlist.empty()) {
|
for (ig=0; ig<8; ig++) {
|
||||||
for (ip=0; ip<nDigitalSamples; ip++) {
|
|
||||||
for (ig=0; ig<8; ig++) {
|
dval=*(d_data+ip*8+ig);
|
||||||
|
|
||||||
dval=*(d_data+ip*8+ig);
|
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
|
||||||
|
if (bitPlotFlag[ib]) {
|
||||||
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
|
hb=bitHisto[ib];
|
||||||
// cout << "dsample " << ip << " bit " << ib << endl;
|
|
||||||
// cout << "Bit number " << ib << endl;
|
|
||||||
if (bitPlotFlag[ib]) {
|
|
||||||
hb=bitHisto[ib];
|
|
||||||
// if (bitStack->GetHists()->Contains(hb)==0) cout << "ERROR!" << endl;
|
|
||||||
//#define ADCSAR2
|
|
||||||
// #ifdef ADCSAR2
|
|
||||||
// if (ib==0) vv1=dval;
|
|
||||||
// if (ib==16) vv2=dval;
|
|
||||||
// cout << ib << " " << hex << vv << dec << endl;
|
|
||||||
// #endif
|
|
||||||
if (dval&(1<<(ib%8)))
|
if (dval&(1<<(ib%8)))
|
||||||
hb->SetBinContent(ip+1,1+bitOffset[ib]);
|
hb->SetBinContent(ip+1,1+bitOffset[ib]);
|
||||||
else
|
else
|
||||||
hb->SetBinContent(ip+1,bitOffset[ib]);
|
hb->SetBinContent(ip+1,bitOffset[ib]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// #ifdef ADCSAR2
|
|
||||||
// //this is a deserializer similar to MYTHEN!
|
|
||||||
// hb=bitHisto[0];
|
|
||||||
// int adcvalue=0;
|
|
||||||
// // int startbit= ig;
|
|
||||||
// for (int jj=0;jj<8;jj++){
|
|
||||||
// adcvalue=adcvalue+ (((vv1>>(jj*2)) & 0x1)<<(jj));
|
|
||||||
// }
|
|
||||||
// for (int jj=0;jj<4;jj++){
|
|
||||||
// adcvalue=adcvalue+ (((vv2>>(jj*2)) & 0x1)<<(jj+8));
|
|
||||||
// }
|
|
||||||
// hb->SetBinContent(ip+1, adcvalue);
|
|
||||||
// printf(" %d 0x%x 0x%x adc=%d \n", i, vv1, vv2, adcvalue);
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ii=0;
|
|
||||||
int iii=0;
|
|
||||||
int nb=dbitlist.size();
|
|
||||||
for (const auto &value : dbitlist) {
|
|
||||||
ib=value;
|
|
||||||
hb=bitHisto[ib];
|
|
||||||
cout << dec <<endl << "Bit " << ib << " " << (nDigitalSamples-dBitOffset)/8 << endl;
|
|
||||||
iii=0;
|
|
||||||
for (ip=0; ip<(nDigitalSamples-dBitOffset)/8; ip++) {
|
|
||||||
if (bitPlotFlag[ib]) {
|
|
||||||
dval=*(d_data+ii*nDigitalSamples/8+ip);
|
|
||||||
|
|
||||||
for (int jj=0; jj<8; jj++) {
|
|
||||||
if (dval&(1<<jj))
|
|
||||||
hb->SetBinContent(iii,1+bitOffset[ib]);
|
|
||||||
else
|
|
||||||
hb->SetBinContent(iii,bitOffset[ib]);
|
|
||||||
iii++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ii++;
|
} else {
|
||||||
|
ii=0;
|
||||||
|
int iii=0;
|
||||||
|
int nb=dbitlist.size();
|
||||||
|
for (const auto &value : dbitlist) {
|
||||||
|
ib=value;
|
||||||
|
hb=bitHisto[ib];
|
||||||
|
// cout << dec <<endl << "Bit " << ib << " " << (nDigitalSamples-dBitOffset)/8 << endl;
|
||||||
|
iii=0;
|
||||||
|
for (ip=0; ip<(nDigitalSamples-dBitOffset)/8; ip++) {
|
||||||
|
if (bitPlotFlag[ib]) {
|
||||||
|
dval=*(d_data+ii*nDigitalSamples/8+ip);
|
||||||
|
|
||||||
|
for (int jj=0; jj<8; jj++) {
|
||||||
|
if (dval&(1<<jj))
|
||||||
|
hb->SetBinContent(iii,1+bitOffset[ib]);
|
||||||
|
else
|
||||||
|
hb->SetBinContent(iii,bitOffset[ib]);
|
||||||
|
iii++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ii++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw();
|
Draw();
|
||||||
// iScanStep++;
|
// iScanStep++;
|
||||||
if (photonFinder)
|
if (photonFinder)
|
||||||
photonFinder->newFrame();
|
photonFinder->newFrame();
|
||||||
return i;
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbAcquisition::Draw(){
|
void ctbAcquisition::Draw(){
|
||||||
if (globalPlot) {
|
if (globalPlot) {
|
||||||
// TThread::Lock();
|
// TThread::Lock();
|
||||||
cout << "Draw" << endl;
|
cout << "Draw" << endl;
|
||||||
if (myCanvas && globalPlot!=0) {
|
if (myCanvas) {
|
||||||
myCanvas->cd();
|
if (adcPlot && dbitPlot) {
|
||||||
myCanvas->Modified();
|
|
||||||
myCanvas->Update();
|
myCanvas->cd(1);
|
||||||
|
// myCanvas->Modified();
|
||||||
|
// myCanvas->Update();
|
||||||
|
gPad->Modified();
|
||||||
|
gPad->Update();
|
||||||
|
|
||||||
|
myCanvas->cd(2);
|
||||||
|
// myCanvas->Modified();
|
||||||
|
// myCanvas->Update();
|
||||||
|
gPad->Modified();
|
||||||
|
gPad->Update();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
myCanvas->cd();
|
||||||
|
myCanvas->Modified();
|
||||||
|
myCanvas->Update();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TThread::UnLock();
|
// TThread::UnLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//here!!
|
||||||
void ctbAcquisition::changePlot(){
|
void ctbAcquisition::changePlot(){
|
||||||
if (rbPlotOff->IsOn()) {
|
if (rbPlotOff->IsOn()) {
|
||||||
globalPlot=0;
|
adcPlot=0;
|
||||||
|
dbitPlot=0;
|
||||||
} else {
|
} else {
|
||||||
globalPlot=0;
|
adcPlot=0;
|
||||||
|
dbitPlot=0;
|
||||||
for (int ii=0; ii<NADCS; ii++)
|
for (int ii=0; ii<NADCS; ii++)
|
||||||
if (plotFlag[ii]==1) globalPlot=1;
|
if (plotFlag[ii]==1) adcPlot=1;
|
||||||
for (int ii=0; ii<NSIGNALS; ii++)
|
for (int ii=0; ii<NSIGNALS; ii++)
|
||||||
if (bitPlotFlag[ii]==1) globalPlot=1;
|
if (bitPlotFlag[ii]==1) dbitPlot=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalPlot=adcPlot || dbitPlot;
|
||||||
|
|
||||||
if (globalPlot!=0 && myCanvas) {
|
if (globalPlot!=0 && myCanvas) {
|
||||||
if (rbWaveform->IsOn())
|
if (adcPlot && dbitPlot) {
|
||||||
if (adcStack)
|
if (myCanvas->GetPad(1)==NULL || myCanvas->GetPad(2)==NULL) {
|
||||||
adcStack->Draw("NOSTACK");
|
myCanvas->Clear();
|
||||||
|
myCanvas->Divide(1,2);
|
||||||
|
} else
|
||||||
|
cout << "Pad already there" << endl;
|
||||||
|
myCanvas->cd(1);
|
||||||
|
} else {
|
||||||
|
myCanvas->Clear();
|
||||||
|
// myCanvas->Divide(1,1);
|
||||||
|
myCanvas->cd();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adcPlot) {
|
||||||
|
if (rbWaveform->IsOn())
|
||||||
|
if (adcStack)
|
||||||
|
adcStack->Draw("NOSTACK");
|
||||||
|
else
|
||||||
|
cout << "adcStack is NULL" << endl;
|
||||||
|
else if (rbDistribution->IsOn())
|
||||||
|
if (countsStack)
|
||||||
|
countsStack->Draw("NOSTACK");
|
||||||
|
else
|
||||||
|
cout << "countsStack is NULL" << endl;
|
||||||
|
else if (rb2D->IsOn()) {
|
||||||
|
if (h2DMapAn)
|
||||||
|
h2DMapAn->Draw("colz");
|
||||||
|
else if (h1DMap)
|
||||||
|
h1DMap->Draw();
|
||||||
|
else
|
||||||
|
cout << "h2DMap and h1DMap are NULL" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbitPlot) {
|
||||||
|
if (adcPlot)
|
||||||
|
myCanvas->cd(2);
|
||||||
|
if (rb2D->IsOn()) {
|
||||||
|
if (h2DMapDig)
|
||||||
|
h2DMapDig->Draw("colz");
|
||||||
|
} else if (bitStack)
|
||||||
|
bitStack->Draw("NOSTACK");
|
||||||
else
|
else
|
||||||
cout << "adcStack is NULL" << endl;
|
cout << "bitStack is NULL" << endl;
|
||||||
else if (rbDistribution->IsOn())
|
|
||||||
if (countsStack)
|
|
||||||
countsStack->Draw("NOSTACK");
|
|
||||||
else
|
}
|
||||||
cout << "countsStack is NULL" << endl;
|
|
||||||
else if (rb2D->IsOn()) {
|
|
||||||
if (h2DMap)
|
// else if (rbScan->IsOn()) {
|
||||||
h2DMap->Draw("colz");
|
|
||||||
else if (h1DMap)
|
|
||||||
h1DMap->Draw();
|
|
||||||
else
|
|
||||||
cout << "h2DMap and h1DMap are NULL" << endl;
|
|
||||||
} // else if (rbScan->IsOn()) {
|
|
||||||
// if (h2Scan)
|
// if (h2Scan)
|
||||||
// h2Scan->Draw("colz");
|
// h2Scan->Draw("colz");
|
||||||
// else
|
// else
|
||||||
// cout << "h2Scan is NULL" << endl;
|
// cout << "h2Scan is NULL" << endl;
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
Draw();
|
Draw();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1158,28 +1161,30 @@ void ctbAcquisition::changePlot(){
|
|||||||
|
|
||||||
void ctbAcquisition::changeDetector(){
|
void ctbAcquisition::changeDetector(){
|
||||||
// cout << "change detector " << i << " old " << cbDetType->GetSelected() << endl;
|
// cout << "change detector " << i << " old " << cbDetType->GetSelected() << endl;
|
||||||
|
|
||||||
if (dataStructure) delete dataStructure;
|
if (dataStructure) delete dataStructure;
|
||||||
if (commonMode) delete commonMode;
|
if (commonMode) delete commonMode;
|
||||||
if (photonFinder) delete photonFinder;
|
if (photonFinder) delete photonFinder;
|
||||||
if (h2DMap) delete h2DMap;
|
if (h2DMapAn) delete h2DMapAn;
|
||||||
|
if (h2DMapDig) delete h2DMapDig;
|
||||||
if (h1DMap) delete h1DMap;
|
if (h1DMap) delete h1DMap;
|
||||||
// if (h2Scan) delete h2Scan;
|
// if (h2Scan) delete h2Scan;
|
||||||
h2DMap=NULL;
|
h2DMapAn=NULL;
|
||||||
|
h2DMapDig=NULL;
|
||||||
h1DMap=NULL;
|
h1DMap=NULL;
|
||||||
// h2Scan=NULL;
|
// h2Scan=NULL;
|
||||||
photonFinder=NULL;
|
photonFinder=NULL;
|
||||||
dataStructure=NULL;
|
dataStructure=NULL;
|
||||||
commonMode=NULL;
|
commonMode=NULL;
|
||||||
TH2F *h2DMapOld=h2DMap;
|
TH2F *h2DMapOld=h2DMapAn;
|
||||||
// TH2F *h2ScanOld=h2Scan;
|
// TH2F *h2ScanOld=h2Scan;
|
||||||
TH1F *h1DMapOld=h1DMap;
|
TH1F *h1DMapOld=h1DMap;
|
||||||
int dim=2;
|
int dim=2;
|
||||||
int nx,ny;
|
int nx,ny;
|
||||||
int csize=3;
|
int csize=3;
|
||||||
int nsigma=5;
|
int nsigma=5;
|
||||||
commonModeSubtraction* cm=0;
|
commonModeSubtraction* cm=0;
|
||||||
eNumCount->SetState(kFALSE);
|
eNumCount->SetState(kFALSE);
|
||||||
eDynRange->SetState(kFALSE);
|
eDynRange->SetState(kFALSE);
|
||||||
eSerOff->SetState(kFALSE);
|
eSerOff->SetState(kFALSE);
|
||||||
deserializer=0;
|
deserializer=0;
|
||||||
@ -1187,12 +1192,12 @@ void ctbAcquisition::changeDetector(){
|
|||||||
switch (cbDetType->GetSelected()) {
|
switch (cbDetType->GetSelected()) {
|
||||||
case DESERIALIZER:
|
case DESERIALIZER:
|
||||||
deserializer=1;
|
deserializer=1;
|
||||||
// cout << "DESERIALIZER!" << endl;
|
cout << "DESERIALIZER!" << endl;
|
||||||
// dataStructure=new moench03T1CtbData();
|
// dataStructure=new moench03T1CtbData();
|
||||||
// commonMode=new moench03CommonMode();
|
// commonMode=new moench03CommonMode();
|
||||||
break;
|
break;
|
||||||
case MOENCH04:
|
case MOENCH04:
|
||||||
dataStructure=new moench04CtbReceiverData();
|
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||||
cout << "MOENCH 0.4!" << endl;
|
cout << "MOENCH 0.4!" << endl;
|
||||||
commonMode=new moench03CommonMode();
|
commonMode=new moench03CommonMode();
|
||||||
break;
|
break;
|
||||||
@ -1263,6 +1268,9 @@ void ctbAcquisition::changeDetector(){
|
|||||||
if (deserializer) {
|
if (deserializer) {
|
||||||
ny=1;
|
ny=1;
|
||||||
nx=eNumCount->GetIntNumber();
|
nx=eNumCount->GetIntNumber();
|
||||||
|
eNumCount->SetState(kTRUE);
|
||||||
|
eDynRange->SetState(kTRUE);
|
||||||
|
eSerOff->SetState(kTRUE);
|
||||||
}
|
}
|
||||||
// cout << "h size is " << nx << " " << ny << endl;
|
// cout << "h size is " << nx << " " << ny << endl;
|
||||||
int ymax=ny, xmax=nx;
|
int ymax=ny, xmax=nx;
|
||||||
@ -1271,9 +1279,14 @@ void ctbAcquisition::changeDetector(){
|
|||||||
cout << "*** " << nx << " " << ny << endl;
|
cout << "*** " << nx << " " << ny << endl;
|
||||||
if (rb2D->IsOn()) {
|
if (rb2D->IsOn()) {
|
||||||
if (ny>1) {
|
if (ny>1) {
|
||||||
h2DMap=new TH2F("h2dmap","",nx,0,xmax,ny,0,ymax);
|
h2DMapAn=new TH2F("h2dmapAn","",nx,0,xmax,ny,0,ymax);
|
||||||
h2DMap->SetStats(kFALSE);
|
h2DMapAn->SetStats(kFALSE);
|
||||||
cout << "Created h2DMap"<< endl;
|
cout << "Created h2DMapAn"<< endl;
|
||||||
|
if (dbitPlot && adcPlot){
|
||||||
|
h2DMapDig=new TH2F("h2dmapDig","",nx,0,xmax,ny,0,ymax);
|
||||||
|
h2DMapDig->SetStats(kFALSE);
|
||||||
|
cout << "Created h2DMapDig"<< endl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
h1DMap=new TH1F("h1dmap","",nx,0,xmax);
|
h1DMap=new TH1F("h1dmap","",nx,0,xmax);
|
||||||
h1DMap->SetStats(kFALSE);
|
h1DMap->SetStats(kFALSE);
|
||||||
@ -1598,8 +1611,10 @@ void ctbAcquisition::toggleAcquisition() {
|
|||||||
for (int i=0; i<NSIGNALS; i++) {
|
for (int i=0; i<NSIGNALS; i++) {
|
||||||
bitHisto[i]->Reset();
|
bitHisto[i]->Reset();
|
||||||
}
|
}
|
||||||
cout << "reset 2d" << endl;;
|
cout << "reset 2d an" << endl;;
|
||||||
if (h2DMap) h2DMap->Reset();
|
if (h2DMapAn) h2DMapAn->Reset();
|
||||||
|
cout << "reset 2d dig" << endl;;
|
||||||
|
if (h2DMapDig) h2DMapDig->Reset();
|
||||||
cout << "reset 1d" << endl;;
|
cout << "reset 1d" << endl;;
|
||||||
if (h1DMap) h1DMap->Reset();
|
if (h1DMap) h1DMap->Reset();
|
||||||
cout << "done" << endl;;
|
cout << "done" << endl;;
|
||||||
@ -1953,42 +1968,44 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
|
|||||||
|
|
||||||
|
|
||||||
void ctbAcquisition::ChangeSerialOffset(){
|
void ctbAcquisition::ChangeSerialOffset(){
|
||||||
if (dataStructure) {
|
// if (dataStructure) {
|
||||||
|
|
||||||
cout << cbDetType->GetSelected()<< endl;
|
// // cout << cbDetType->GetSelected()<< endl;
|
||||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||||
cout << "settings offsets for MYTHEN" << endl;
|
// // cout << "settings offsets for MYTHEN" << endl;
|
||||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||||
ms->setSerialOffset(eSerOff->GetIntNumber());
|
// // ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||||
|
|
||||||
}
|
// // }
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void ctbAcquisition::ChangeDynamicRange(){
|
void ctbAcquisition::ChangeDynamicRange(){
|
||||||
if (dataStructure) {
|
// if (dataStructure) {
|
||||||
|
|
||||||
cout << cbDetType->GetSelected()<< endl;
|
// cout << cbDetType->GetSelected()<< endl;
|
||||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||||
cout << "settings dynamic range for MYTHEN" << endl;
|
// cout << "settings dynamic range for MYTHEN" << endl;
|
||||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||||
ms->setDynamicRange(eDynRange->GetIntNumber());
|
// ms->setDynamicRange(eDynRange->GetIntNumber());
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
void ctbAcquisition::ChangeNumberOfChannels(){
|
void ctbAcquisition::ChangeNumberOfChannels(){
|
||||||
if (dataStructure) {
|
// if (dataStructure) {
|
||||||
cout << cbDetType->GetSelected()<< endl;
|
// cout << cbDetType->GetSelected()<< endl;
|
||||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||||
cout << "settings number of channels for MYTHEN" << endl;
|
// cout << "settings number of channels for MYTHEN" << endl;
|
||||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||||
ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
// ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
if (deserializer)
|
||||||
|
changePlot();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -2023,9 +2040,9 @@ void ctbAcquisition::ChangeHistoLimitsPedSub(){
|
|||||||
if (cMinMaxPedSub->IsOn()) {
|
if (cMinMaxPedSub->IsOn()) {
|
||||||
adcStack->SetMaximum( eMaxPedSub->GetNumber());
|
adcStack->SetMaximum( eMaxPedSub->GetNumber());
|
||||||
adcStack->SetMinimum( eMinPedSub->GetNumber());
|
adcStack->SetMinimum( eMinPedSub->GetNumber());
|
||||||
if (h2DMap) {
|
if (h2DMapAn) {
|
||||||
h2DMap->SetMaximum( eMaxPedSub->GetNumber());
|
h2DMapAn->SetMaximum( eMaxPedSub->GetNumber());
|
||||||
h2DMap->SetMinimum( eMinPedSub->GetNumber());
|
h2DMapAn->SetMinimum( eMinPedSub->GetNumber());
|
||||||
}
|
}
|
||||||
if (h1DMap) {
|
if (h1DMap) {
|
||||||
h1DMap->SetMaximum( eMaxPedSub->GetNumber());
|
h1DMap->SetMaximum( eMaxPedSub->GetNumber());
|
||||||
@ -2036,11 +2053,11 @@ void ctbAcquisition::ChangeHistoLimitsPedSub(){
|
|||||||
} else {
|
} else {
|
||||||
if (adcStack->GetHistogram())
|
if (adcStack->GetHistogram())
|
||||||
adcStack->GetHistogram()->GetYaxis()->UnZoom();
|
adcStack->GetHistogram()->GetYaxis()->UnZoom();
|
||||||
if (h2DMap) {
|
if (h2DMapAn) {
|
||||||
h2DMap->GetZaxis()->UnZoom();
|
h2DMapAn->GetZaxis()->UnZoom();
|
||||||
}
|
}
|
||||||
if (h1DMap) {
|
if (h1DMap) {
|
||||||
h1DMap->GetYaxis()->UnZoom();
|
h1DMap->GetYaxis()->UnZoom();
|
||||||
}
|
}
|
||||||
if (countsStack->GetHistogram())
|
if (countsStack->GetHistogram())
|
||||||
countsStack->GetHistogram()->GetXaxis()->UnZoom();
|
countsStack->GetHistogram()->GetXaxis()->UnZoom();
|
||||||
@ -2061,9 +2078,9 @@ void ctbAcquisition::ChangeHistoLimitsRaw(){
|
|||||||
if (cMinMaxRaw->IsOn()) {
|
if (cMinMaxRaw->IsOn()) {
|
||||||
adcStack->SetMaximum( eMaxRaw->GetNumber());
|
adcStack->SetMaximum( eMaxRaw->GetNumber());
|
||||||
adcStack->SetMinimum( eMinRaw->GetNumber());
|
adcStack->SetMinimum( eMinRaw->GetNumber());
|
||||||
if (h2DMap) {
|
if (h2DMapAn) {
|
||||||
h2DMap->SetMaximum( eMaxRaw->GetNumber());
|
h2DMapAn->SetMaximum( eMaxRaw->GetNumber());
|
||||||
h2DMap->SetMinimum( eMinRaw->GetNumber());
|
h2DMapAn->SetMinimum( eMinRaw->GetNumber());
|
||||||
}
|
}
|
||||||
if (h1DMap) {
|
if (h1DMap) {
|
||||||
h1DMap->SetMaximum( eMaxRaw->GetNumber());
|
h1DMap->SetMaximum( eMaxRaw->GetNumber());
|
||||||
@ -2075,8 +2092,8 @@ void ctbAcquisition::ChangeHistoLimitsRaw(){
|
|||||||
|
|
||||||
if (adcStack->GetHistogram())
|
if (adcStack->GetHistogram())
|
||||||
adcStack->GetHistogram()->GetYaxis()->UnZoom();
|
adcStack->GetHistogram()->GetYaxis()->UnZoom();
|
||||||
if (h2DMap) {
|
if (h2DMapAn) {
|
||||||
h2DMap->GetZaxis()->UnZoom();
|
h2DMapAn->GetZaxis()->UnZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h1DMap) {
|
if (h1DMap) {
|
||||||
|
@ -20,8 +20,8 @@ class TTimer;
|
|||||||
class TCanvas;
|
class TCanvas;
|
||||||
class TH2F;
|
class TH2F;
|
||||||
class TH1F;
|
class TH1F;
|
||||||
class TGLabel;
|
class TGLabel;
|
||||||
class TGTextButton;
|
class TGTextButton;
|
||||||
|
|
||||||
class multiSlsDetector;
|
class multiSlsDetector;
|
||||||
class detectorData;
|
class detectorData;
|
||||||
@ -103,7 +103,8 @@ class ctbAcquisition : public TGGroupFrame {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
TH2F *h2DMap; // for 2D detectors
|
TH2F *h2DMapAn; // for 2D detectors
|
||||||
|
TH2F *h2DMapDig; // for 2D detectors
|
||||||
TH1F *h1DMap; //for 1D detectors
|
TH1F *h1DMap; //for 1D detectors
|
||||||
|
|
||||||
// TH2F *h2Scan; // for 2D detectors
|
// TH2F *h2Scan; // for 2D detectors
|
||||||
@ -148,6 +149,8 @@ class ctbAcquisition : public TGGroupFrame {
|
|||||||
char patternCompiler[10000];
|
char patternCompiler[10000];
|
||||||
|
|
||||||
int globalPlot;
|
int globalPlot;
|
||||||
|
int adcPlot;
|
||||||
|
int dbitPlot;
|
||||||
|
|
||||||
int nAnalogSamples, nDigitalSamples;
|
int nAnalogSamples, nDigitalSamples;
|
||||||
// int iScanStep;
|
// int iScanStep;
|
||||||
|
@ -126,7 +126,7 @@ void setwaittime(int iloop, uint64_t t) {
|
|||||||
void pw(){
|
void pw(){
|
||||||
if (iaddr<MAXWORDS)
|
if (iaddr<MAXWORDS)
|
||||||
PAT[iaddr]= pat;
|
PAT[iaddr]= pat;
|
||||||
fprintf(fd,"patword %04x %016llx\n",iaddr, pat);
|
fprintf(fd,"patword 0x%04x 0x%016llx\n",iaddr, pat);
|
||||||
iaddr++;
|
iaddr++;
|
||||||
if (iaddr>=MAXWORDS) printf("ERROR: too many word in the pattern (%d instead of %d)!",iaddr, MAXWORDS);
|
if (iaddr>=MAXWORDS) printf("ERROR: too many word in the pattern (%d instead of %d)!",iaddr, MAXWORDS);
|
||||||
}
|
}
|
||||||
@ -154,18 +154,18 @@ main(void) {
|
|||||||
fd=fopen(OUTFILE,"w");
|
fd=fopen(OUTFILE,"w");
|
||||||
#include INFILE
|
#include INFILE
|
||||||
|
|
||||||
fprintf(fd,"patioctrl %016llx\n",iopat);
|
fprintf(fd,"patioctrl 0x%016llx\n",iopat);
|
||||||
fprintf(fd,"patclkctrl %016llx\n",clkpat);
|
fprintf(fd,"patclkctrl 0x%016llx\n",clkpat);
|
||||||
fprintf(fd,"patlimits %04x %04x\n",start, stop);
|
fprintf(fd,"patlimits 0x%04x 0x%04x\n",start, stop);
|
||||||
|
|
||||||
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
||||||
fprintf(fd,"patloop%d %04x %04x\n",iloop, startloopaddr[iloop], stoploopaddr[iloop]);
|
fprintf(fd,"patloop%d 0x%04x 0x%04x\n",iloop, startloopaddr[iloop], stoploopaddr[iloop]);
|
||||||
if ( startloopaddr[iloop]<0 || stoploopaddr[iloop]<= startloopaddr[iloop]) nloop[iloop]=0;
|
if ( startloopaddr[iloop]<0 || stoploopaddr[iloop]<= startloopaddr[iloop]) nloop[iloop]=0;
|
||||||
fprintf(fd,"patnloop%d %d\n",iloop, nloop[iloop]);
|
fprintf(fd,"patnloop%d %d\n",iloop, nloop[iloop]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iloop=0; iloop<MAXTIMERS; iloop++) {
|
for (iloop=0; iloop<MAXTIMERS; iloop++) {
|
||||||
fprintf(fd,"patwait%d %04x\n",iloop, waitaddr[iloop]);
|
fprintf(fd,"patwait%d 0x%04x\n",iloop, waitaddr[iloop]);
|
||||||
if (waitaddr[iloop]<0) waittime[iloop]=0;
|
if (waitaddr[iloop]<0) waittime[iloop]=0;
|
||||||
fprintf(fd,"patwaittime%d %lld\n",iloop, waittime[iloop]);
|
fprintf(fd,"patwaittime%d %lld\n",iloop, waittime[iloop]);
|
||||||
}
|
}
|
||||||
|
276
slsDetectorCalibration/dataStructures/moench04CtbZmqData.h
Normal file
276
slsDetectorCalibration/dataStructures/moench04CtbZmqData.h
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
#ifndef MOENCH04ZMQDATA_H
|
||||||
|
#define MOENCH04ZMQDATA_H
|
||||||
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int iframe;
|
||||||
|
int nadc;
|
||||||
|
int sc_width;
|
||||||
|
int sc_height;
|
||||||
|
const int aSamples;
|
||||||
|
const int dSamples;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
|
*/
|
||||||
|
moench04CtbZmqData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) {
|
||||||
|
|
||||||
|
|
||||||
|
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
|
||||||
|
|
||||||
|
int row, col;
|
||||||
|
|
||||||
|
int isample;
|
||||||
|
int iadc;
|
||||||
|
int ix, iy;
|
||||||
|
|
||||||
|
int npackets=40;
|
||||||
|
int i;
|
||||||
|
int adc4(0);
|
||||||
|
|
||||||
|
for (int is=0; is<aSamples; is++) {
|
||||||
|
|
||||||
|
for (iadc=0; iadc<nadc; iadc++) {
|
||||||
|
i=is;
|
||||||
|
// adc4=(int)iadc/4;
|
||||||
|
if (i<sc_width*sc_height) {
|
||||||
|
// for (int i=0; i<sc_width*sc_height; i++) {
|
||||||
|
col=(adc_nr[iadc]%16)*sc_width+(i%sc_width);
|
||||||
|
// if (adc4%2==0) {
|
||||||
|
if (iadc<16) {
|
||||||
|
row=199-i/sc_width;
|
||||||
|
} else {
|
||||||
|
row=200+i/sc_width;
|
||||||
|
}
|
||||||
|
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
|
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||||
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){ */
|
||||||
|
/* xmap[ibyte]=-1; */
|
||||||
|
/* ymap[ibyte]=-1; */
|
||||||
|
/* } */
|
||||||
|
/* int off=sizeof(sls_detector_header)/2; */
|
||||||
|
|
||||||
|
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
||||||
|
|
||||||
|
|
||||||
|
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
||||||
|
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
||||||
|
/* i=ipacket*8208/2+ibyte; */
|
||||||
|
/* isample=ii/nadc; */
|
||||||
|
/* if (isample<nSamples) { */
|
||||||
|
/* iadc=ii%nadc; */
|
||||||
|
/* adc4 = (int)iadc/4; */
|
||||||
|
/* ix=isample%sc_width; */
|
||||||
|
/* iy=isample/sc_width; */
|
||||||
|
/* if (adc4%2==0) { */
|
||||||
|
/* xmap[i+off]=adc_nr[iadc]+ix; */
|
||||||
|
/* ymap[i+off]=ny/2-1-iy; */
|
||||||
|
/* } else { */
|
||||||
|
/* xmap[i+off]=adc_nr[iadc]+ix; */
|
||||||
|
/* ymap[i+off]=ny/2+iy; */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
/* ii++; */
|
||||||
|
/* // } */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
iframe=0;
|
||||||
|
// cout << "data struct created" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getGain(char *data, int x, int y) {
|
||||||
|
int aoff=aSamples*2*32;
|
||||||
|
int irow;
|
||||||
|
int isc=x/sc_width;
|
||||||
|
int icol=x%sc_width;
|
||||||
|
if (y<200) irow=sc_height-1-y;
|
||||||
|
else {
|
||||||
|
irow=y-sc_height;
|
||||||
|
isc++;
|
||||||
|
}
|
||||||
|
int ibit[32]={-1,-1,-1,-1,-1,-1,1,3,5,7,-1,-1,-1,-1,-1,-1,62,60,58,56,54,52,50,48,63,61,59,57,55,53,51,49};
|
||||||
|
int isample=irow*sc_width+icol;
|
||||||
|
|
||||||
|
uint64_t sample;
|
||||||
|
char *ptr;
|
||||||
|
if (isc<0 || isc>=32) return 0;
|
||||||
|
if (ibit[isc]<0 || ibit[isc]>=64) return 0;
|
||||||
|
if (dSamples>isample) {
|
||||||
|
ptr=data+aoff+8*isample;
|
||||||
|
sample=*((uint64_t*)ptr);
|
||||||
|
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
|
||||||
|
if (sample & (1<<ibit[isc]))
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
|
\param buff pointer to the dataset
|
||||||
|
\returns frame number
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* class jfrau_packet_header_t { */
|
||||||
|
/* public: */
|
||||||
|
/* unsigned char reserved[4]; */
|
||||||
|
/* unsigned char packetNumber[1]; */
|
||||||
|
/* unsigned char frameNumber[3]; */
|
||||||
|
/* unsigned char bunchid[8]; */
|
||||||
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int getFrameNumber(char *buff){return iframe;};//((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the packet number for the given dataset. purely virtual func
|
||||||
|
\param buff pointer to the dataset
|
||||||
|
\returns packet number number
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
//int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
|
|
||||||
|
/* /\** */
|
||||||
|
|
||||||
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
|
/* \param data pointer to the memory to be analyzed */
|
||||||
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
|
|
||||||
|
/* *\/ */
|
||||||
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
|
|
||||||
|
|
||||||
|
/* /\** */
|
||||||
|
|
||||||
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
|
/* \param filebin input file stream (binary) */
|
||||||
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
|
|
||||||
|
/* *\/ */
|
||||||
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
|
/* // int afifo_length=0; */
|
||||||
|
/* uint16_t *afifo_cont; */
|
||||||
|
/* int ib=0; */
|
||||||
|
/* if (filebin.is_open()) { */
|
||||||
|
/* afifo_cont=new uint16_t[dataSize/2]; */
|
||||||
|
/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */
|
||||||
|
/* ib+=2; */
|
||||||
|
/* if (ib==dataSize) break; */
|
||||||
|
/* } */
|
||||||
|
/* if (ib>0) { */
|
||||||
|
/* iframe++; */
|
||||||
|
/* // cout << ib << "-" << endl; */
|
||||||
|
/* return (char*)afifo_cont; */
|
||||||
|
/* } else { */
|
||||||
|
/* delete [] afifo_cont; */
|
||||||
|
/* return NULL; */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
/* return NULL; */
|
||||||
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
|
int ff=-1, np=-1;
|
||||||
|
return readNextFrame(filebin, ff, np);
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||||
|
int np=-1;
|
||||||
|
return readNextFrame(filebin, ff, np);
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
|
char *data=new char[dataSize];
|
||||||
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
|
char *retval=0;
|
||||||
|
int nd;
|
||||||
|
int fnum = -1;
|
||||||
|
np=0;
|
||||||
|
int pn;
|
||||||
|
|
||||||
|
// cout << dataSize << endl;
|
||||||
|
if (ff>=0)
|
||||||
|
fnum=ff;
|
||||||
|
|
||||||
|
if (filebin.is_open()) {
|
||||||
|
if (filebin.read(data, dataSize) ){
|
||||||
|
ff=getFrameNumber(data);
|
||||||
|
// np=getPacketNumber(data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
|
\param data pointer to the memory to be analyzed
|
||||||
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
|
\param dsize size of the memory slot to be analyzed
|
||||||
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
|
if (dsize<dataSize) ndata=dsize;
|
||||||
|
else ndata=dataSize;
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -261,6 +261,8 @@ class slsDetectorData {
|
|||||||
return d^m;
|
return d^m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual int getGain(char *data, int ix, int iy=0){return 0;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
|
@ -10,7 +10,8 @@ INSTMODE = 0777
|
|||||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
||||||
OBJS = $(SRC_CLNT:.c=.o)
|
OBJS = $(SRC_CLNT:.c=.o)
|
||||||
|
|
||||||
all: clean versioning $(PROGS)
|
#all: clean versioning $(PROGS)
|
||||||
|
all: clean $(PROGS)
|
||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1633,7 +1633,7 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tConfiguring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
FILE_LOG(logDEBUG1, ("\tConfiguring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
||||||
int valShift = val;
|
int valShift = val;
|
||||||
// convert to phase shift
|
// convert to phase shift
|
||||||
if (degrees) {
|
if (degrees) {
|
||||||
@ -1649,6 +1649,7 @@ void configurePhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
|
FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
FILE_LOG(logINFOBLUE, ("\tConfiguring Phase of C%d(%s) to %d (degree mode: %d)\n", ind, clock_names[ind], val, degrees));
|
||||||
|
|
||||||
int phase = 0;
|
int phase = 0;
|
||||||
if (relativePhase > 0) {
|
if (relativePhase > 0) {
|
||||||
@ -1723,15 +1724,32 @@ void configureFrequency(enum CLKINDEX ind, int val) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset phase
|
// Remembering adcphase/ dbit phase
|
||||||
if (ind == ADC_CLK || ind == DBIT_CLK) {
|
int adcPhase = getPhase(ADC_CLK, 0);
|
||||||
FILE_LOG(logINFO, ("\tReseting phase of %s\n", clock_names[ind]));
|
FILE_LOG(logDEBUG1, ("\tRemembering ADC phase: %d\n", adcPhase));
|
||||||
configurePhase(ind, 0, 0);
|
int dbitPhase = getPhase(DBIT_CLK, 0);
|
||||||
}
|
FILE_LOG(logDEBUG1, ("\tRemembering DBIT phase: %d\n", dbitPhase));
|
||||||
|
|
||||||
// Calculate and set output frequency
|
// Calculate and set output frequency
|
||||||
clkDivider[ind] = ALTERA_PLL_SetOuputFrequency (ind, PLL_VCO_FREQ_MHZ, val);
|
clkDivider[ind] = ALTERA_PLL_SetOuputFrequency (ind, PLL_VCO_FREQ_MHZ, val);
|
||||||
FILE_LOG(logINFO, ("\tC%d(%s): Frequency set to %d MHz\n", ind, clock_names[ind], clkDivider[ind]));
|
FILE_LOG(logINFO, ("\tC%d(%s): Frequency set to %d MHz\n", ind, clock_names[ind], clkDivider[ind]));
|
||||||
|
|
||||||
|
// adc and dbit phase is reset by pll (when setting output frequency)
|
||||||
|
clkPhase[ADC_CLK] = 0;
|
||||||
|
clkPhase[DBIT_CLK] = 0;
|
||||||
|
|
||||||
|
// set the phase if custom set
|
||||||
|
if (clkPhase[ADC_CLK] != adcPhase) {
|
||||||
|
FILE_LOG(logINFO, ("\tPhase reset by PLL\n\tCorrecting ADC phase to %d\n", adcPhase));
|
||||||
|
configurePhase(ADC_CLK, adcPhase, 0);
|
||||||
|
}
|
||||||
|
if (clkPhase[DBIT_CLK] != dbitPhase) {
|
||||||
|
FILE_LOG(logINFO, ("\tPhase reset by PLL\n\tCorrecting DBIT phase to %d\n", dbitPhase));
|
||||||
|
configurePhase(DBIT_CLK, dbitPhase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// required to reconfigure as adc clock is stopped temporarily when resetting pll (in changing output frequency)
|
||||||
|
AD9257_Configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getFrequency(enum CLKINDEX ind) {
|
int getFrequency(enum CLKINDEX ind) {
|
||||||
|
@ -267,21 +267,13 @@ void AD9257_Configure(){
|
|||||||
FILE_LOG(logINFO, ("\tPower mode chip run\n"));
|
FILE_LOG(logINFO, ("\tPower mode chip run\n"));
|
||||||
AD9257_Set(AD9257_POWER_MODE_REG, AD9257_INT_CHIP_RUN_VAL);
|
AD9257_Set(AD9257_POWER_MODE_REG, AD9257_INT_CHIP_RUN_VAL);
|
||||||
|
|
||||||
// binary offset
|
// binary offset, lvds-iee reduced
|
||||||
FILE_LOG(logINFO, ("\tBinary offset\n"));
|
FILE_LOG(logINFO, ("\tBinary offset, Lvds-ieee reduced\n"));
|
||||||
AD9257_Set(AD9257_OUT_MODE_REG, AD9257_OUT_BINARY_OFST_VAL);
|
AD9257_Set(AD9257_OUT_MODE_REG, AD9257_OUT_BINARY_OFST_VAL | AD9257_OUT_LVDS_IEEE_VAL);
|
||||||
|
|
||||||
//output clock phase
|
//output clock phase
|
||||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD)
|
FILE_LOG(logINFO, ("\tOutput clock phase: 180\n"));
|
||||||
FILE_LOG(logINFO, ("\tOutput clock phase is at default: 180\n"));
|
AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL);
|
||||||
#else
|
|
||||||
FILE_LOG(logINFO, ("\tOutput clock phase: 60\n"));
|
|
||||||
AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_60_VAL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// lvds-iee reduced , binary offset
|
|
||||||
FILE_LOG(logINFO, ("\tLvds-iee reduced, binary offset\n"));
|
|
||||||
AD9257_Set(AD9257_OUT_MODE_REG, AD9257_OUT_LVDS_IEEE_VAL);
|
|
||||||
|
|
||||||
// all devices on chip to receive next command
|
// all devices on chip to receive next command
|
||||||
FILE_LOG(logINFO, ("\tAll devices on chip to receive next command\n"));
|
FILE_LOG(logINFO, ("\tAll devices on chip to receive next command\n"));
|
||||||
@ -298,9 +290,7 @@ void AD9257_Configure(){
|
|||||||
AD9257_SetVrefVoltage(AD9257_VREF_DEFAULT_VAL, 0);
|
AD9257_SetVrefVoltage(AD9257_VREF_DEFAULT_VAL, 0);
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logINFO, ("\tVref 1.33\n"));
|
FILE_LOG(logINFO, ("\tVref 1.33\n"));
|
||||||
//AD9257_Set(AD9257_VREF_REG, AD9257_VREF_1_33_VAL);
|
|
||||||
AD9257_SetVrefVoltage(AD9257_VREF_1_33_VAL, 0);
|
AD9257_SetVrefVoltage(AD9257_VREF_1_33_VAL, 0);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// no test mode
|
// no test mode
|
||||||
|
@ -225,7 +225,7 @@ int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) {
|
|||||||
// write frequency (post-scale output counter C)
|
// write frequency (post-scale output counter C)
|
||||||
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_C_COUNTER_REG, val);
|
ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_C_COUNTER_REG, val);
|
||||||
|
|
||||||
// reset required to keep the phase
|
// reset required to keep the phase (must reconfigure adcs again after this as adc clock is stopped temporarily when resetting pll)
|
||||||
ALTERA_PLL_ResetPLL ();
|
ALTERA_PLL_ResetPLL ();
|
||||||
|
|
||||||
/*double temp = ((double)pllVCOFreqMhz / (double)(low_count + high_count));
|
/*double temp = ((double)pllVCOFreqMhz / (double)(low_count + high_count));
|
||||||
|
@ -102,9 +102,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page test
|
/*! \page test
|
||||||
- <b>exitreceiver</b> Shuts down all the receivers. Don't use it!!!!
|
- <b>rx_exit</b> Shuts down all the receivers. Don't use it!!!!
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "exitreceiver";
|
descrToFuncMap[i].m_pFuncName = "rx_exit";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -497,9 +497,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- <b>checkrecversion</b> Checks the version compatibility with receiver server (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
- <b>rx_checkversion</b> Checks the version compatibility with receiver server (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "checkrecversion";
|
descrToFuncMap[i].m_pFuncName = "rx_checkversion";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSN;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSN;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -532,9 +532,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- <b>receiverversion</b> Gets the software version of receiver. Only get! \c Returns \c (long int) in hexadecimal
|
- <b>rx_version</b> Gets the software version of receiver. Only get! \c Returns \c (long int) in hexadecimal
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "receiverversion";
|
descrToFuncMap[i].m_pFuncName = "rx_version";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSN;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSN;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -1522,9 +1522,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \page output
|
/*! \page output
|
||||||
- <b>outdir [dir]</b> Sets/gets the file output directory. \c Returns \c (string)
|
- <b>fpath [dir]</b> Sets/gets the file output directory. \c Returns \c (string)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "outdir";
|
descrToFuncMap[i].m_pFuncName = "fpath";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOutDir;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOutDir;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -1536,37 +1536,37 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page output
|
/*! \page output
|
||||||
- <b>index [i]</b> Sets/gets the current file index. \c Returns \c (int)
|
- <b>findex [i]</b> Sets/gets the current file index. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "index";
|
descrToFuncMap[i].m_pFuncName = "findex";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFileIndex;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFileIndex;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page output
|
/*! \page output
|
||||||
- <b>enablefwrite [i]</b> Enables/disables file writing. 1 enables, 0 disables. \c Returns \c (int)
|
- <b>fwrite [i]</b> Enables/disables file writing. 1 enables, 0 disables. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "enablefwrite";
|
descrToFuncMap[i].m_pFuncName = "fwrite";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdEnablefwrite;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdEnablefwrite;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page output
|
/*! \page output
|
||||||
- <b>overwrite [i]</b> enables(1) /disables(0) file overwriting. \c Returns \c (int)
|
- <b>foverwrite [i]</b> enables(1) /disables(0) file overwriting. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "overwrite";
|
descrToFuncMap[i].m_pFuncName = "foverwrite";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOverwrite;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOverwrite;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page output
|
/*! \page output
|
||||||
- <b>fileformat [i]</b> sets/gets the file format for data in receiver. Options: [binary, hdf5]. \c Returns \c (string)
|
- <b>fformat [i]</b> sets/gets the file format for data in receiver. Options: [binary, hdf5]. \c Returns \c (string)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "fileformat";
|
descrToFuncMap[i].m_pFuncName = "fformat";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFileName;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFileName;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page output
|
/*! \page output
|
||||||
- <b>masterfile [i]</b> sets/gets the master file write enable in receiver. \c Returns \c (int)
|
- <b>fmaster [i]</b> sets/gets the master file write enable in receiver. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "masterfile";
|
descrToFuncMap[i].m_pFuncName = "fmaster";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdEnablefwrite;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdEnablefwrite;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -1790,23 +1790,23 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>receiver [s]</b> starts/stops the receiver to listen to detector packets. Options: [ \c start, \c stop]. \c Returns \c (string) status of receiver[ \c idle, \c running].
|
- <b>rx_status [s]</b> starts/stops the receiver to listen to detector packets. Options: [ \c start, \c stop]. \c Returns \c (string) status of receiver[ \c idle, \c running].
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "receiver";
|
descrToFuncMap[i].m_pFuncName = "rx_status";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_online [i]</b> sets/gets the receiver in online/offline mode. 1 is online, 0 is offline. Get is from shared memory. \c Returns \c (int)
|
- <b>rx_online [i]</b> sets/gets the receiver in online/offline mode. 1 is online, 0 is offline. Get is from shared memory. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_online";
|
descrToFuncMap[i].m_pFuncName = "rx_online";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOnline;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOnline;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_checkonline</b> Checks the receiver if it is online/offline mode. Only get! \c Returns (string) "All online" or "[list of offline hostnames] : Not online".
|
- <b>rx_checkonline</b> Checks the receiver if it is online/offline mode. Only get! \c Returns (string) "All online" or "[list of offline hostnames] : Not online".
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_checkonline";
|
descrToFuncMap[i].m_pFuncName = "rx_checkonline";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOnline;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOnline;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -1832,23 +1832,23 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_lock [i]</b> locks/unlocks the receiver to communicate with only this client. 1 locks, 0 unlocks. \c Returns \c (int)
|
- <b>rx_lock [i]</b> locks/unlocks the receiver to communicate with only this client. 1 locks, 0 unlocks. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_lock";
|
descrToFuncMap[i].m_pFuncName = "rx_lock";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdLock;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdLock;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_lastclient</b> gets the last client communicating with the receiver. Only get! \c Returns \c (int)
|
- <b>rx_lastclient</b> gets the last client communicating with the receiver. Only get! \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_lastclient";
|
descrToFuncMap[i].m_pFuncName = "rx_lastclient";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdLastClient;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdLastClient;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_readfreq [i]</b> sets/gets the stream frequency of data from receiver to client. i > 0 is the nth frame being streamed. 0 sets frequency to a default timer (200ms). \c Returns \c (int)
|
- <b>rx_readfreq [i]</b> sets/gets the stream frequency of data from receiver to client. i > 0 is the nth frame being streamed. 0 sets frequency to a default timer (200ms). \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_readfreq";
|
descrToFuncMap[i].m_pFuncName = "rx_readfreq";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -1860,30 +1860,30 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_silent [i]</b> sets/gets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets. \c Returns \c (int)
|
- <b>rx_silent [i]</b> sets/gets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_silent";
|
descrToFuncMap[i].m_pFuncName = "rx_silent";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_framesperfile [i]</b> sets/gets the frames per file in receiver to i. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
- <b>rx_framesperfile [i]</b> sets/gets the frames per file in receiver to i. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_framesperfile";
|
descrToFuncMap[i].m_pFuncName = "rx_framesperfile";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames. \c Returns \c (int)
|
- <b>rx_discardpolicy</b> sets/gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_discardpolicy";
|
descrToFuncMap[i].m_pFuncName = "rx_discardpolicy";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>r_padding</b> sets/gets the frame padding in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames. \c Returns \c (int)
|
- <b>rx_padding</b> sets/gets the frame padding in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "r_padding";
|
descrToFuncMap[i].m_pFuncName = "rx_padding";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
@ -2205,13 +2205,13 @@ std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
int r_online = myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
int rx_online = myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (myDet->acquire() == FAIL)
|
if (myDet->acquire() == FAIL)
|
||||||
return std::string("acquire failed");
|
return std::string("acquire failed");
|
||||||
if (r_online) {
|
if (rx_online) {
|
||||||
char answer[100];
|
char answer[100];
|
||||||
sprintf(answer, "\nAcquired %d", myDet->getFramesCaughtByReceiver(detPos));
|
sprintf(answer, "\nAcquired %d", myDet->getFramesCaughtByReceiver(detPos));
|
||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
@ -2487,7 +2487,7 @@ std::string slsDetectorCommand::cmdExitServer(int narg, const char * const args[
|
|||||||
return std::string("Server shut down.");
|
return std::string("Server shut down.");
|
||||||
else
|
else
|
||||||
return std::string("Error closing server\n");
|
return std::string("Error closing server\n");
|
||||||
} else if (cmd == "exitreceiver") {
|
} else if (cmd == "rx_exit") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (myDet->exitReceiver(detPos) == OK)
|
if (myDet->exitReceiver(detPos) == OK)
|
||||||
return std::string("Receiver shut down\n");
|
return std::string("Receiver shut down\n");
|
||||||
@ -2514,7 +2514,7 @@ std::string slsDetectorCommand::cmdExitServer(int narg, const char * const args[
|
|||||||
std::string slsDetectorCommand::helpExitServer(int action) {
|
std::string slsDetectorCommand::helpExitServer(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << std::string("exitserver \t shuts down all the detector servers. Don't use it!!!!\n");
|
os << std::string("exitserver \t shuts down all the detector servers. Don't use it!!!!\n");
|
||||||
os << std::string("exitreceiver \t shuts down all the receiver servers.\n");
|
os << std::string("rx_exit \t shuts down all the receiver servers.\n");
|
||||||
os << std::string("execcommand \t executes command in detector server. Don't use it if you do not know what you are doing.\n");
|
os << std::string("execcommand \t executes command in detector server. Don't use it if you do not know what you are doing.\n");
|
||||||
os << std::string("rx_execcommand \t executes command in receiver server. Don't use it if you do not know what you are doing.\n");
|
os << std::string("rx_execcommand \t executes command in receiver server. Don't use it if you do not know what you are doing.\n");
|
||||||
return os.str();
|
return os.str();
|
||||||
@ -2593,9 +2593,9 @@ std::string slsDetectorCommand::cmdOutDir(int narg, const char * const args[], i
|
|||||||
std::string slsDetectorCommand::helpOutDir(int action) {
|
std::string slsDetectorCommand::helpOutDir(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION)
|
if (action == GET_ACTION || action == HELP_ACTION)
|
||||||
os << std::string("outdir \t gets the directory where the output files will be written\n");
|
os << std::string("fpath \t gets the directory where the output files will be written\n");
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION)
|
if (action == PUT_ACTION || action == HELP_ACTION)
|
||||||
os << std::string("outdir dir \t sets the directory where the output files will be written\n");
|
os << std::string("fpath dir \t sets the directory where the output files will be written\n");
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2608,7 +2608,7 @@ std::string slsDetectorCommand::cmdFileName(int narg, const char * const args[],
|
|||||||
myDet->setFileName(std::string(args[1]), detPos);
|
myDet->setFileName(std::string(args[1]), detPos);
|
||||||
|
|
||||||
return std::string(myDet->getFileName(detPos));
|
return std::string(myDet->getFileName(detPos));
|
||||||
} else if (cmd == "fileformat") {
|
} else if (cmd == "fformat") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (std::string(args[1]) == "binary")
|
if (std::string(args[1]) == "binary")
|
||||||
myDet->setFileFormat(BINARY, detPos);
|
myDet->setFileFormat(BINARY, detPos);
|
||||||
@ -2626,11 +2626,11 @@ std::string slsDetectorCommand::helpFileName(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << std::string("fname \t gets the filename for the data without index and extension\n");
|
os << std::string("fname \t gets the filename for the data without index and extension\n");
|
||||||
os << std::string("fileformat \t gets the file format for data\n");
|
os << std::string("fformat \t gets the file format for data\n");
|
||||||
}
|
}
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << std::string("fname s \t sets the filename for the data (index and extension will be automatically appended)\n");
|
os << std::string("fname s \t sets the filename for the data (index and extension will be automatically appended)\n");
|
||||||
os << std::string("fileformat s \t sets the file format for the data (binary, hdf5)\n");
|
os << std::string("fformat s \t sets the file format for the data (binary, hdf5)\n");
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -2643,7 +2643,7 @@ std::string slsDetectorCommand::cmdEnablefwrite(int narg, const char * const arg
|
|||||||
if (action == HELP_ACTION) {
|
if (action == HELP_ACTION) {
|
||||||
return helpEnablefwrite(action);
|
return helpEnablefwrite(action);
|
||||||
}
|
}
|
||||||
if (cmd == "enablefwrite") {
|
if (cmd == "fwrite") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (sscanf(args[1], "%d", &i))
|
if (sscanf(args[1], "%d", &i))
|
||||||
myDet->setFileWrite(i, detPos);
|
myDet->setFileWrite(i, detPos);
|
||||||
@ -2654,7 +2654,7 @@ std::string slsDetectorCommand::cmdEnablefwrite(int narg, const char * const arg
|
|||||||
return std::string(ans);
|
return std::string(ans);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "masterfile") {
|
else if (cmd == "fmaster") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (sscanf(args[1], "%d", &i))
|
if (sscanf(args[1], "%d", &i))
|
||||||
myDet->setMasterFileWrite(i, detPos);
|
myDet->setMasterFileWrite(i, detPos);
|
||||||
@ -2671,12 +2671,12 @@ std::string slsDetectorCommand::cmdEnablefwrite(int narg, const char * const arg
|
|||||||
std::string slsDetectorCommand::helpEnablefwrite(int action) {
|
std::string slsDetectorCommand::helpEnablefwrite(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << std::string("enablefwrite \t When Enabled writes the data into the file\n");
|
os << std::string("fwrite \t When Enabled writes the data into the file\n");
|
||||||
os << std::string("masterfile \t When Enabled writes the master file\n");
|
os << std::string("fmaster \t When Enabled writes the master file\n");
|
||||||
}
|
}
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << std::string("enablefwrite i \t should be 1 or 0\n");
|
os << std::string("fwrite i \t should be 1 or 0\n");
|
||||||
os << std::string("masterfile i \t sets the master file write enable. should be 1 or 0\n");
|
os << std::string("fmaster i \t sets the master file write enable. should be 1 or 0\n");
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -2692,7 +2692,7 @@ std::string slsDetectorCommand::cmdOverwrite(int narg, const char * const args[]
|
|||||||
if (sscanf(args[1], "%d", &i))
|
if (sscanf(args[1], "%d", &i))
|
||||||
myDet->setFileOverWrite(i, detPos);
|
myDet->setFileOverWrite(i, detPos);
|
||||||
else
|
else
|
||||||
return std::string("could not decode overwrite");
|
return std::string("could not decode foverwrite");
|
||||||
}
|
}
|
||||||
sprintf(ans, "%d", myDet->getFileOverWrite(detPos));
|
sprintf(ans, "%d", myDet->getFileOverWrite(detPos));
|
||||||
return std::string(ans);
|
return std::string(ans);
|
||||||
@ -2701,9 +2701,9 @@ std::string slsDetectorCommand::cmdOverwrite(int narg, const char * const args[]
|
|||||||
std::string slsDetectorCommand::helpOverwrite(int action) {
|
std::string slsDetectorCommand::helpOverwrite(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION)
|
if (action == GET_ACTION || action == HELP_ACTION)
|
||||||
os << std::string("overwrite \t When Enabled overwrites files\n");
|
os << std::string("foverwrite \t When Enabled overwrites files\n");
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION)
|
if (action == PUT_ACTION || action == HELP_ACTION)
|
||||||
os << std::string("overwrite i \t should be 1 or 0 or -1\n");
|
os << std::string("foverwrite i \t should be 1 or 0 or -1\n");
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2721,9 +2721,9 @@ std::string slsDetectorCommand::cmdFileIndex(int narg, const char * const args[]
|
|||||||
std::string slsDetectorCommand::helpFileIndex(int action) {
|
std::string slsDetectorCommand::helpFileIndex(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION)
|
if (action == GET_ACTION || action == HELP_ACTION)
|
||||||
os << std::string("index \t gets the file index for the next the data file\n");
|
os << std::string("findex \t gets the file index for the next the data file\n");
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION)
|
if (action == PUT_ACTION || action == HELP_ACTION)
|
||||||
os << std::string("index i \t sets the fileindex for the next data file\n");
|
os << std::string("findex i \t sets the fileindex for the next data file\n");
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3195,7 +3195,7 @@ std::string slsDetectorCommand::cmdLock(int narg, const char * const args[], int
|
|||||||
sprintf(ans, "%d", myDet->lockServer(-1, detPos));
|
sprintf(ans, "%d", myDet->lockServer(-1, detPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "r_lock") {
|
else if (cmd == "rx_lock") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (sscanf(args[1], "%d", &val))
|
if (sscanf(args[1], "%d", &val))
|
||||||
@ -3217,11 +3217,11 @@ std::string slsDetectorCommand::helpLock(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << "lock i \n locks (1) or unlocks (0) the detector to communicate to this client" << std::endl;
|
os << "lock i \n locks (1) or unlocks (0) the detector to communicate to this client" << std::endl;
|
||||||
os << "r_lock i \n locks (1) or unlocks (0) the receiver to communicate to this client" << std::endl;
|
os << "rx_lock i \n locks (1) or unlocks (0) the receiver to communicate to this client" << std::endl;
|
||||||
}
|
}
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "lock \n returns the detector lock status" << std::endl;
|
os << "lock \n returns the detector lock status" << std::endl;
|
||||||
os << "r_lock \n returns the receiver lock status" << std::endl;
|
os << "rx_lock \n returns the receiver lock status" << std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -3239,7 +3239,7 @@ std::string slsDetectorCommand::cmdLastClient(int narg, const char * const args[
|
|||||||
return myDet->getLastClientIP(detPos);
|
return myDet->getLastClientIP(detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "r_lastclient") {
|
else if (cmd == "rx_lastclient") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
return myDet->getReceiverLastClientIP(detPos);
|
return myDet->getReceiverLastClientIP(detPos);
|
||||||
}
|
}
|
||||||
@ -3252,7 +3252,7 @@ std::string slsDetectorCommand::helpLastClient(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "lastclient \n returns the last client communicating with the detector" << std::endl;
|
os << "lastclient \n returns the last client communicating with the detector" << std::endl;
|
||||||
os << "r_lastclient \n returns the last client communicating with the receiver" << std::endl;
|
os << "rx_lastclient \n returns the last client communicating with the receiver" << std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -3301,7 +3301,7 @@ std::string slsDetectorCommand::cmdOnline(int narg, const char * const args[], i
|
|||||||
}
|
}
|
||||||
int ret = myDet->setDeactivatedRxrPaddingMode(-1, detPos);
|
int ret = myDet->setDeactivatedRxrPaddingMode(-1, detPos);
|
||||||
sprintf(ans, "%d %s", myDet->activate(-1, detPos), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
sprintf(ans, "%d %s", myDet->activate(-1, detPos), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
||||||
} else if (cmd == "r_online") {
|
} else if (cmd == "rx_online") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (sscanf(args[1], "%d", &ival))
|
if (sscanf(args[1], "%d", &ival))
|
||||||
myDet->setReceiverOnline(ival, detPos);
|
myDet->setReceiverOnline(ival, detPos);
|
||||||
@ -3328,14 +3328,14 @@ std::string slsDetectorCommand::helpOnline(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << "online i \n sets the detector in online (1) or offline (0) mode" << std::endl;
|
os << "online i \n sets the detector in online (1) or offline (0) mode" << std::endl;
|
||||||
os << "r_online i \n sets the receiver in online (1) or offline (0) mode" << std::endl;
|
os << "rx_online i \n sets the receiver in online (1) or offline (0) mode" << std::endl;
|
||||||
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger." << std::endl;
|
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger." << std::endl;
|
||||||
}
|
}
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "online \n gets the detector online (1) or offline (0) mode" << std::endl;
|
os << "online \n gets the detector online (1) or offline (0) mode" << std::endl;
|
||||||
os << "checkonline \n returns the hostnames of all detectors in offline mode" << std::endl;
|
os << "checkonline \n returns the hostnames of all detectors in offline mode" << std::endl;
|
||||||
os << "r_online \n gets the receiver online (1) or offline (0) mode" << std::endl;
|
os << "rx_online \n gets the receiver online (1) or offline (0) mode" << std::endl;
|
||||||
os << "r_checkonline \n returns the hostnames of all receiver in offline mode" << std::endl;
|
os << "rx_checkonline \n returns the hostnames of all receiver in offline mode" << std::endl;
|
||||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger." << std::endl;
|
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger." << std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
@ -3655,7 +3655,7 @@ std::string slsDetectorCommand::cmdSN(int narg, const char * const args[], int a
|
|||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == "receiverversion") {
|
if (cmd == "rx_version") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
int64_t retval = myDet->getReceiverSoftwareVersion(detPos);
|
int64_t retval = myDet->getReceiverSoftwareVersion(detPos);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
@ -3673,7 +3673,7 @@ std::string slsDetectorCommand::cmdSN(int narg, const char * const args[], int a
|
|||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == "checkrecversion") {
|
if (cmd == "rx_checkversion") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
int retval = myDet->checkReceiverVersionCompatibility(detPos);
|
int retval = myDet->checkReceiverVersionCompatibility(detPos);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
@ -3690,12 +3690,12 @@ std::string slsDetectorCommand::helpSN(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "checkdetversion \n gets the version compatibility with detector server (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible." << std::endl;
|
os << "checkdetversion \n gets the version compatibility with detector server (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible." << std::endl;
|
||||||
os << "checkrecversion \n gets the version compatibility with receiver server (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible." << std::endl;
|
os << "rx_checkversion \n gets the version compatibility with receiver server (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible." << std::endl;
|
||||||
os << "detectornumber \n gets the serial number of the detector (MAC)" << std::endl;
|
os << "detectornumber \n gets the serial number of the detector (MAC)" << std::endl;
|
||||||
os << "detectorversion \n gets the firmware version of the detector" << std::endl;
|
os << "detectorversion \n gets the firmware version of the detector" << std::endl;
|
||||||
os << "softwareversion \n gets the software version of the detector" << std::endl;
|
os << "softwareversion \n gets the software version of the detector" << std::endl;
|
||||||
os << "thisversion \n gets the version of this software" << std::endl;
|
os << "thisversion \n gets the version of this software" << std::endl;
|
||||||
os << "receiverversion \n gets the version of the receiver" << std::endl;
|
os << "rx_version \n gets the version of the receiver" << std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
@ -5060,7 +5060,7 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
|
|
||||||
if (cmd == "receiver") {
|
if (cmd == "rx_status") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (!strcasecmp(args[1], "start"))
|
if (!strcasecmp(args[1], "start"))
|
||||||
myDet->startReceiver(detPos);
|
myDet->startReceiver(detPos);
|
||||||
@ -5100,7 +5100,7 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
sprintf(answer, "%lu", myDet->getReceiverCurrentFrameIndex(detPos));
|
sprintf(answer, "%lu", myDet->getReceiverCurrentFrameIndex(detPos));
|
||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
} else if (cmd == "r_readfreq") {
|
} else if (cmd == "rx_readfreq") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (!sscanf(args[1], "%d", &ival))
|
if (!sscanf(args[1], "%d", &ival))
|
||||||
return std::string("Could not scan read frequency mode ") + std::string(args[1]);
|
return std::string("Could not scan read frequency mode ") + std::string(args[1]);
|
||||||
@ -5136,10 +5136,10 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "r_silent") {
|
else if (cmd == "rx_silent") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (!sscanf(args[1], "%d", &ival))
|
if (!sscanf(args[1], "%d", &ival))
|
||||||
return std::string("Could not scan r_online input ") + std::string(args[1]);
|
return std::string("Could not scan rx_online input ") + std::string(args[1]);
|
||||||
if (ival >= 0)
|
if (ival >= 0)
|
||||||
sprintf(answer, "%d", myDet->setReceiverSilentMode(ival, detPos));
|
sprintf(answer, "%d", myDet->setReceiverSilentMode(ival, detPos));
|
||||||
} else
|
} else
|
||||||
@ -5148,7 +5148,7 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "r_framesperfile") {
|
else if (cmd == "rx_framesperfile") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (sscanf(args[1], "%d", &ival)) {
|
if (sscanf(args[1], "%d", &ival)) {
|
||||||
myDet->setFramesPerFile(ival, detPos);
|
myDet->setFramesPerFile(ival, detPos);
|
||||||
@ -5160,7 +5160,7 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
return std::string(answer);
|
return std::string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "r_discardpolicy") {
|
else if (cmd == "rx_discardpolicy") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
frameDiscardPolicy f = myDet->getReceiverFrameDiscardPolicy(std::string(args[1]));
|
frameDiscardPolicy f = myDet->getReceiverFrameDiscardPolicy(std::string(args[1]));
|
||||||
if (f == GET_FRAME_DISCARD_POLICY)
|
if (f == GET_FRAME_DISCARD_POLICY)
|
||||||
@ -5170,7 +5170,7 @@ std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[],
|
|||||||
return myDet->getReceiverFrameDiscardPolicy(myDet->setReceiverFramesDiscardPolicy(GET_FRAME_DISCARD_POLICY, detPos));
|
return myDet->getReceiverFrameDiscardPolicy(myDet->setReceiverFramesDiscardPolicy(GET_FRAME_DISCARD_POLICY, detPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (cmd == "r_padding") {
|
else if (cmd == "rx_padding") {
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (sscanf(args[1], "%d", &ival)) {
|
if (sscanf(args[1], "%d", &ival)) {
|
||||||
myDet->setPartialFramesPadding(ival, detPos);
|
myDet->setPartialFramesPadding(ival, detPos);
|
||||||
@ -5205,13 +5205,13 @@ std::string slsDetectorCommand::helpReceiver(int action) {
|
|||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start, stop." << std::endl;
|
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start, stop." << std::endl;
|
||||||
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
|
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
|
||||||
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
|
os << "rx_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
|
||||||
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
|
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
|
||||||
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
|
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
|
||||||
os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
|
os << "rx_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
|
||||||
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
os << "rx_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||||
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
os << "rx_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||||
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
os << "rx_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||||
os << "rx_jsonaddheader [t]\n sets additional json header to be streamed "
|
os << "rx_jsonaddheader [t]\n sets additional json header to be streamed "
|
||||||
"out with the zmq from receiver. Default is empty. t must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
"out with the zmq from receiver. Default is empty. t must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
|
||||||
"Use only if it needs to be processed by an intermediate process." << std::endl;
|
"Use only if it needs to be processed by an intermediate process." << std::endl;
|
||||||
@ -5222,13 +5222,13 @@ std::string slsDetectorCommand::helpReceiver(int action) {
|
|||||||
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
||||||
os << "framescaught \t returns the number of frames caught by receiver(average for multi)" << std::endl;
|
os << "framescaught \t returns the number of frames caught by receiver(average for multi)" << std::endl;
|
||||||
os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl;
|
os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl;
|
||||||
os << "r_readfreq \t returns the gui read frequency of the receiver" << std::endl;
|
os << "rx_readfreq \t returns the gui read frequency of the receiver" << std::endl;
|
||||||
os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl;
|
os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl;
|
||||||
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
|
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
|
||||||
os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
|
os << "rx_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
|
||||||
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
os << "rx_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||||
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
os << "rx_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||||
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
os << "rx_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||||
os << "rx_jsonaddheader \n gets additional json header to be streamed "
|
os << "rx_jsonaddheader \n gets additional json header to be streamed "
|
||||||
"out with the zmq from receiver." << std::endl;
|
"out with the zmq from receiver." << std::endl;
|
||||||
os << "rx_jsonpara [k] \n gets value of additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found." << std::endl;
|
os << "rx_jsonpara [k] \n gets value of additional json header parameter k to be streamed out with the zmq from receiver. If empty, then no parameter found." << std::endl;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "tests/globals.h"
|
||||||
|
|
||||||
auto GET = slsDetectorDefs::GET_ACTION;
|
auto GET = slsDetectorDefs::GET_ACTION;
|
||||||
auto PUT = slsDetectorDefs::PUT_ACTION;
|
auto PUT = slsDetectorDefs::PUT_ACTION;
|
||||||
|
|
||||||
@ -47,119 +49,120 @@ TEST_CASE("frames", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("receiver", "[.cmd]") {
|
TEST_CASE("rx_status", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("receiver start", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_status start", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "receiver running\n");
|
REQUIRE(oss.str() == "rx_status running\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("receiver", GET, nullptr, oss);
|
multiSlsDetectorClient("rx_status", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "receiver running\n");
|
REQUIRE(oss.str() == "rx_status running\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("receiver stop", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_status stop", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "receiver idle\n");
|
REQUIRE(oss.str() == "rx_status idle\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("receiver", GET, nullptr, oss);
|
multiSlsDetectorClient("rx_status", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "receiver idle\n");
|
REQUIRE(oss.str() == "rx_status idle\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("enablefwrite", "[.cmd]") {
|
TEST_CASE("fwrite", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("enablefwrite 1", PUT, nullptr, oss);
|
multiSlsDetectorClient("fwrite 1", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "enablefwrite 1\n");
|
REQUIRE(oss.str() == "fwrite 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("enablefwrite", GET, nullptr, oss);
|
multiSlsDetectorClient("fwrite", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "enablefwrite 1\n");
|
REQUIRE(oss.str() == "fwrite 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("enablefwrite 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("fwrite 0", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "enablefwrite 0\n");
|
REQUIRE(oss.str() == "fwrite 0\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("enableoverwrite", "[.cmd]") {
|
TEST_CASE("enablefoverwrite", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("overwrite 1", PUT, nullptr, oss);
|
multiSlsDetectorClient("foverwrite 1", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "overwrite 1\n");
|
REQUIRE(oss.str() == "foverwrite 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("overwrite", GET, nullptr, oss);
|
multiSlsDetectorClient("foverwrite", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "overwrite 1\n");
|
REQUIRE(oss.str() == "foverwrite 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("overwrite 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("foverwrite 0", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "overwrite 0\n");
|
REQUIRE(oss.str() == "foverwrite 0\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("activatecmd", "[.cmd]") {
|
//EIGER ONLY
|
||||||
|
// TEST_CASE("activatecmd", "[.cmd]") {
|
||||||
|
|
||||||
|
// {
|
||||||
|
// // TODO! read padding from somewhere
|
||||||
|
// std::ostringstream oss;
|
||||||
|
// multiSlsDetectorClient("activate 0", PUT, nullptr, oss);
|
||||||
|
// REQUIRE(oss.str() == "activate 0 padding\n");
|
||||||
|
// }
|
||||||
|
// {
|
||||||
|
// std::ostringstream oss;
|
||||||
|
// multiSlsDetectorClient("activate", GET, nullptr, oss);
|
||||||
|
// REQUIRE(oss.str() == "activate 0 padding\n");
|
||||||
|
// }
|
||||||
|
// {
|
||||||
|
// std::ostringstream oss;
|
||||||
|
// multiSlsDetectorClient("activate 1", PUT, nullptr, oss);
|
||||||
|
// REQUIRE(oss.str() == "activate 1 padding\n");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
TEST_CASE("fmaster", "[.cmd]") {
|
||||||
{
|
{
|
||||||
// TODO! read padding from somewhere
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("activate 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("fmaster 0", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "activate 0 padding\n");
|
REQUIRE(oss.str() == "fmaster 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("activate", GET, nullptr, oss);
|
multiSlsDetectorClient("fmaster", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "activate 0 padding\n");
|
REQUIRE(oss.str() == "fmaster 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("activate 1", PUT, nullptr, oss);
|
multiSlsDetectorClient("fmaster 1", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "activate 1 padding\n");
|
REQUIRE(oss.str() == "fmaster 1\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("masterfile", "[.cmd]") {
|
TEST_CASE("findex", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("masterfile 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("findex 57", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "masterfile 0\n");
|
REQUIRE(oss.str() == "findex 57\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("masterfile", GET, nullptr, oss);
|
multiSlsDetectorClient("findex", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "masterfile 0\n");
|
REQUIRE(oss.str() == "findex 57\n");
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
multiSlsDetectorClient("masterfile 1", PUT, nullptr, oss);
|
|
||||||
REQUIRE(oss.str() == "masterfile 1\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("index", "[.cmd]") {
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
multiSlsDetectorClient("index 57", PUT, nullptr, oss);
|
|
||||||
REQUIRE(oss.str() == "index 57\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
multiSlsDetectorClient("index", GET, nullptr, oss);
|
|
||||||
REQUIRE(oss.str() == "index 57\n");
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("index 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("findex 0", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "index 0\n");
|
REQUIRE(oss.str() == "findex 0\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,21 +232,21 @@ TEST_CASE("resetframescaught get framescaught", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("r_silent", "[.cmd]") {
|
TEST_CASE("rx_silent", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_silent 1", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_silent 1", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_silent 1\n");
|
REQUIRE(oss.str() == "rx_silent 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_silent", GET, nullptr, oss);
|
multiSlsDetectorClient("rx_silent", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_silent 1\n");
|
REQUIRE(oss.str() == "rx_silent 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_silent 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_silent 0", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_silent 0\n");
|
REQUIRE(oss.str() == "rx_silent 0\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,63 +278,138 @@ TEST_CASE("r_silent", "[.cmd]") {
|
|||||||
// REQUIRE(oss.str() == "rx_udpsocksize 104857600\n");
|
// REQUIRE(oss.str() == "rx_udpsocksize 104857600\n");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
TEST_CASE("r_framesperfile", "[.cmd]") {
|
TEST_CASE("rx_framesperfile", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_framesperfile 50", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_framesperfile 50", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_framesperfile 50\n");
|
REQUIRE(oss.str() == "rx_framesperfile 50\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_framesperfile", GET, nullptr, oss);
|
multiSlsDetectorClient("rx_framesperfile", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_framesperfile 50\n");
|
REQUIRE(oss.str() == "rx_framesperfile 50\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_framesperfile 10000", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_framesperfile 10000", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_framesperfile 10000\n");
|
REQUIRE(oss.str() == "rx_framesperfile 10000\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("r_discardpolicy", "[.cmd]") {
|
TEST_CASE("rx_discardpolicy", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_discardpolicy discardempty", PUT, nullptr,
|
multiSlsDetectorClient("rx_discardpolicy discardempty", PUT, nullptr,
|
||||||
oss);
|
oss);
|
||||||
REQUIRE(oss.str() == "r_discardpolicy discardempty\n");
|
REQUIRE(oss.str() == "rx_discardpolicy discardempty\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_discardpolicy", GET, nullptr, oss);
|
multiSlsDetectorClient("rx_discardpolicy", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_discardpolicy discardempty\n");
|
REQUIRE(oss.str() == "rx_discardpolicy discardempty\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_discardpolicy discardpartial", PUT, nullptr,
|
multiSlsDetectorClient("rx_discardpolicy discardpartial", PUT, nullptr,
|
||||||
oss);
|
oss);
|
||||||
REQUIRE(oss.str() == "r_discardpolicy discardpartial\n");
|
REQUIRE(oss.str() == "rx_discardpolicy discardpartial\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_discardpolicy nodiscard", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_discardpolicy nodiscard", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_discardpolicy nodiscard\n");
|
REQUIRE(oss.str() == "rx_discardpolicy nodiscard\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("r_padding", "[.cmd]") {
|
TEST_CASE("rx_padding", "[.cmd]") {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_padding 0", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_padding 0", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_padding 0\n");
|
REQUIRE(oss.str() == "rx_padding 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_padding", GET, nullptr, oss);
|
multiSlsDetectorClient("rx_padding", GET, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_padding 0\n");
|
REQUIRE(oss.str() == "rx_padding 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
multiSlsDetectorClient("r_padding 1", PUT, nullptr, oss);
|
multiSlsDetectorClient("rx_padding 1", PUT, nullptr, oss);
|
||||||
REQUIRE(oss.str() == "r_padding 1\n");
|
REQUIRE(oss.str() == "rx_padding 1\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("rx_readfreq", "[.cmd]") {
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_readfreq 1", PUT, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_readfreq 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_readfreq", GET, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_readfreq 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_readfreq 0", PUT, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_readfreq 0\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("rx_lock", "[.cmd]") {
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_lock 1", PUT, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_lock 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_lock", GET, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_lock 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_lock 0", PUT, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_lock 0\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("rx_lastclient", "[.cmd]") {
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_lastclient", GET, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_lastclient " + test::my_ip + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("rx_online", "[.cmd]") {
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_online 0", PUT, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_online 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_online", GET, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_online 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_online 1", PUT, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_online 1\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("rx_checkonline", "[.cmd]") {
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_checkonline", GET, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_checkonline All receiver online\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("rx_checkversion", "[.cmd]") {
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
multiSlsDetectorClient("rx_checkversion", GET, nullptr, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_checkversion compatible\n");
|
||||||
|
}
|
@ -37,7 +37,7 @@ template <typename T> class CmdProxy {
|
|||||||
auto d_it = depreciated_functions.find(command);
|
auto d_it = depreciated_functions.find(command);
|
||||||
if (d_it != depreciated_functions.end()) {
|
if (d_it != depreciated_functions.end()) {
|
||||||
FILE_LOG(logWARNING)
|
FILE_LOG(logWARNING)
|
||||||
<< "WARNING: " << command
|
<< command
|
||||||
<< " is depreciated and will be removed. Please migrate to: "
|
<< " is depreciated and will be removed. Please migrate to: "
|
||||||
<< d_it->second;
|
<< d_it->second;
|
||||||
command = d_it->second;
|
command = d_it->second;
|
||||||
@ -60,11 +60,25 @@ template <typename T> class CmdProxy {
|
|||||||
// Initialize maps for translating name and function
|
// Initialize maps for translating name and function
|
||||||
FunctionMap functions{{"newfunc", &CmdProxy::NewFunction}};
|
FunctionMap functions{{"newfunc", &CmdProxy::NewFunction}};
|
||||||
|
|
||||||
StringMap depreciated_functions{{"oldvrfcmd", "vrf"},
|
StringMap depreciated_functions{{"r_readfreq", "rx_readfreq"},
|
||||||
{"veryveryold", "vcp"},
|
{"r_padding", "rx_padding"},
|
||||||
{"anothercmd", "vrs"},
|
{"r_silent", "rx_silent"},
|
||||||
{"this_as_well", "enablefwrite"}};
|
{"r_lastclient", "rx_lastclient"},
|
||||||
|
{"r_lock", "rx_lock"},
|
||||||
|
{"r_online", "rx_online"},
|
||||||
|
{"r_checkonline", "rx_checkonline"},
|
||||||
|
{"r_framesperfile", "rx_framesperfile"},
|
||||||
|
{"r_discardpolicy", "rx_discardpolicy"},
|
||||||
|
{"receiverversion", "rx_version"},
|
||||||
|
{"receiver", "rx_status"},
|
||||||
|
{"index", "findex"},
|
||||||
|
{"exitreceiver", "rx_exit"},
|
||||||
|
{"enablefwrite", "fwrite"},
|
||||||
|
{"checkrecversion", "rx_checkversion"},
|
||||||
|
{"masterfile", "fmaster"},
|
||||||
|
{"outdir", "fpath"},
|
||||||
|
{"fileformat", "fformat"},
|
||||||
|
{"overwrite", "foverwrite"}};
|
||||||
|
|
||||||
template <typename U> std::string ResultToString(const U &ret) {
|
template <typename U> std::string ResultToString(const U &ret) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
@ -76,21 +90,22 @@ template <typename T> class CmdProxy {
|
|||||||
|
|
||||||
void WrongNumberOfParameters(size_t expected) {
|
void WrongNumberOfParameters(size_t expected) {
|
||||||
throw RuntimeError("ERROR: Expected " + std::to_string(expected) +
|
throw RuntimeError("ERROR: Expected " + std::to_string(expected) +
|
||||||
" parameters but got " + std::to_string(args.size()) +
|
" parameters but got " +
|
||||||
"\n");
|
std::to_string(args.size()) + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mapped functions
|
// Mapped functions
|
||||||
|
|
||||||
//example
|
// example
|
||||||
std::string NewFunction() {
|
std::string NewFunction() {
|
||||||
if(args.size() == 0){
|
if (args.size() == 0) {
|
||||||
std::cout << "This is the new function function\n";
|
std::cout << "This is the new function function\n";
|
||||||
return ResultToString(det->setExposureTime(-1, true));
|
return ResultToString(det->setExposureTime(-1, true));
|
||||||
}else if(args.size() == 1){
|
} else if (args.size() == 1) {
|
||||||
std::cout << "Setting exposure time to " << args[0] << "s\n";
|
std::cout << "Setting exposure time to " << args[0] << "s\n";
|
||||||
return ResultToString(det->setExposureTime(std::stod(args[0]), true, det_id));
|
return ResultToString(
|
||||||
}else{
|
det->setExposureTime(std::stod(args[0]), true, det_id));
|
||||||
|
} else {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,10 @@ using ti = slsDetectorDefs::timerIndex;
|
|||||||
using ro = slsDetectorDefs::readOutFlags;
|
using ro = slsDetectorDefs::readOutFlags;
|
||||||
using sv = slsDetectorDefs::speedVariable;
|
using sv = slsDetectorDefs::speedVariable;
|
||||||
using defs = slsDetectorDefs;
|
using defs = slsDetectorDefs;
|
||||||
|
|
||||||
|
namespace test {
|
||||||
extern std::string hostname;
|
extern std::string hostname;
|
||||||
extern std::string detector_type;
|
extern std::string detector_type;
|
||||||
extern dt type;
|
extern dt type;
|
||||||
extern std::string my_ip;
|
extern std::string my_ip;
|
||||||
|
} // namespace test
|
||||||
|
@ -12,22 +12,24 @@
|
|||||||
using Opt = Catch::clara::Opt;
|
using Opt = Catch::clara::Opt;
|
||||||
using dt = slsDetectorDefs::detectorType;
|
using dt = slsDetectorDefs::detectorType;
|
||||||
|
|
||||||
|
namespace test {
|
||||||
std::string hostname;
|
std::string hostname;
|
||||||
std::string detector_type;
|
std::string detector_type;
|
||||||
std::string my_ip;
|
std::string my_ip;
|
||||||
dt type;
|
dt type;
|
||||||
|
} // namespace test
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
my_ip = "undefined";
|
test::my_ip = "undefined";
|
||||||
|
|
||||||
Catch::Session session;
|
Catch::Session session;
|
||||||
auto cli = session.cli() |
|
auto cli =
|
||||||
Opt(hostname, "hostname")["-hn"]["--hostname"](
|
session.cli() |
|
||||||
"Detector hostname for integration tests") |
|
Opt(test::hostname, "hostname")["-hn"]["--hostname"](
|
||||||
Opt(detector_type, "detector_type")["-dt"]["--detector_type"](
|
"Detector hostname for integration tests") |
|
||||||
"Detector type for integration tests") |
|
Opt(test::detector_type, "detector_type")["-dt"]["--detector_type"](
|
||||||
Opt(my_ip, "my_ip")["-hip"]["--host_ip"](
|
"Detector type for integration tests") |
|
||||||
"Host ip address");
|
Opt(test::my_ip, "my_ip")["-hip"]["--host_ip"]("Host ip address");
|
||||||
|
|
||||||
session.cli(cli);
|
session.cli(cli);
|
||||||
|
|
||||||
@ -36,7 +38,7 @@ int main(int argc, char *argv[]) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = slsDetectorDefs::detectorTypeToEnum(detector_type);
|
test::type = slsDetectorDefs::detectorTypeToEnum(test::detector_type);
|
||||||
|
|
||||||
return session.run();
|
return session.run();
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user