mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
Ctbgui det (#58)
* WIP * WIP * WIP * WIP * WIP * WIP * defs added * ctb gui: tengiga bug fix * WIP * WIP
This commit is contained in:
parent
4f0634fe62
commit
e23b3b0471
@ -35,6 +35,7 @@ add_executable(ctbGui
|
|||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffIO.cpp
|
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffIO.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#TODO! Replace with target
|
#TODO! Replace with target
|
||||||
target_include_directories(ctbGui PRIVATE
|
target_include_directories(ctbGui PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
||||||
@ -44,6 +45,7 @@ target_include_directories(ctbGui PRIVATE
|
|||||||
|
|
||||||
# Headders needed for ROOT dictionary generation
|
# Headders needed for ROOT dictionary generation
|
||||||
set( HEADERS
|
set( HEADERS
|
||||||
|
ctbDefs.h
|
||||||
ctbMain.h
|
ctbMain.h
|
||||||
ctbDacs.h
|
ctbDacs.h
|
||||||
ctbPattern.h
|
ctbPattern.h
|
||||||
@ -63,12 +65,15 @@ add_library(ctbRootLib SHARED ctbDict.cxx)
|
|||||||
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_link_libraries(ctbRootLib PUBLIC
|
target_link_libraries(ctbRootLib PUBLIC
|
||||||
ROOT::Core
|
ROOT::Core
|
||||||
|
slsDetectorShared
|
||||||
|
slsSupportLib
|
||||||
${ROOT_LIBRARIES}
|
${ROOT_LIBRARIES}
|
||||||
${ROOT_EXE_LINKER_FLAGS}
|
${ROOT_EXE_LINKER_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(ctbGui PUBLIC
|
target_link_libraries(ctbGui PUBLIC
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
|
slsSupportLib
|
||||||
ctbRootLib
|
ctbRootLib
|
||||||
${TIFF_LIBRARIES}
|
${TIFF_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "ctbAcquisition.h"
|
#include "ctbAcquisition.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "ctbDefs.h"
|
||||||
|
#include "Detector.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "ctbMain.h"
|
#include "ctbMain.h"
|
||||||
#include "moench03CtbData.h"
|
#include "moench03CtbData.h"
|
||||||
@ -48,7 +49,7 @@ using namespace std;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), tenG(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), tenG(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
||||||
|
|
||||||
adcFit=NULL;
|
adcFit=NULL;
|
||||||
bitPlot=NULL;
|
bitPlot=NULL;
|
||||||
@ -71,8 +72,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
|||||||
cFileSave->SetTextJustify(kTextRight);
|
cFileSave->SetTextJustify(kTextRight);
|
||||||
cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
|
cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
|
||||||
|
|
||||||
|
std::string temp = "run";
|
||||||
eFname = new TGTextEntry(hframe, (myDet->getFileName()).c_str());
|
try {
|
||||||
|
temp = myDet->getFileNamePrefix().tsquash("Different values");
|
||||||
|
} CATCH_DISPLAY ("Could not get file name prefix.", "ctbAcquisition::ctbAcquisition")
|
||||||
|
eFname = new TGTextEntry(hframe, temp.c_str());
|
||||||
|
|
||||||
hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
||||||
eFname->MapWindow();
|
eFname->MapWindow();
|
||||||
@ -113,7 +117,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
eOutdir = new TGTextEntry(hframe, (myDet->getFilePath()).c_str());
|
temp = "/tmp/";
|
||||||
|
try {
|
||||||
|
temp = myDet->getFilePath().tsquash("Different values");
|
||||||
|
} CATCH_DISPLAY ("Could not get file path.", "ctbAcquisition::ctbAcquisition")
|
||||||
|
eOutdir = new TGTextEntry(hframe, temp.c_str());
|
||||||
|
|
||||||
hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
||||||
eOutdir->MapWindow();
|
eOutdir->MapWindow();
|
||||||
@ -597,20 +605,11 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
|||||||
|
|
||||||
acqThread = new TThread("acqThread",
|
acqThread = new TThread("acqThread",
|
||||||
ctbAcquisition::ThreadHandle,(void*)this);
|
ctbAcquisition::ThreadHandle,(void*)this);
|
||||||
// acqThread->Run();
|
|
||||||
// cout <<"Registering progress callback" << endl;
|
|
||||||
// try {
|
|
||||||
// myDet->registerProgressCallback(&progressCallback,(void*)this);
|
|
||||||
// } catch (...) {
|
|
||||||
// cout << "Do nothing for this error" << endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
cout <<"Registering data callback" << endl;
|
cout <<"Registering data callback" << endl;
|
||||||
try{
|
try {
|
||||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
cout <<"Done" << endl;
|
cout <<"Done" << endl;
|
||||||
|
|
||||||
@ -664,10 +663,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
|||||||
countsHisto[i]=h1;
|
countsHisto[i]=h1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nx,ny;
|
|
||||||
int csize=3;
|
|
||||||
int nsigma=5;
|
|
||||||
|
|
||||||
dataStructure=NULL;
|
dataStructure=NULL;
|
||||||
commonMode=NULL;
|
commonMode=NULL;
|
||||||
photonFinder=NULL;
|
photonFinder=NULL;
|
||||||
@ -771,7 +766,7 @@ void ctbAcquisition::canvasClicked() {
|
|||||||
void ctbAcquisition::setCanvas(TCanvas* c) {
|
void ctbAcquisition::setCanvas(TCanvas* c) {
|
||||||
myCanvas=c;
|
myCanvas=c;
|
||||||
myCanvas->cd();
|
myCanvas->cd();
|
||||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%x)->canvasClicked()",this));
|
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%p)->canvasClicked()",this));
|
||||||
// myCanvas->AddExec("ex","canvasClicked()");
|
// myCanvas->AddExec("ex","canvasClicked()");
|
||||||
}
|
}
|
||||||
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
||||||
@ -806,8 +801,6 @@ digital:
|
|||||||
sample0 (dbit0 + dbit1 +...)
|
sample0 (dbit0 + dbit1 +...)
|
||||||
sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||||
|
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
std::vector <int> dbitlist;
|
std::vector <int> dbitlist;
|
||||||
|
|
||||||
@ -845,19 +838,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
|||||||
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
||||||
//#endif
|
//#endif
|
||||||
int ig=0;
|
int ig=0;
|
||||||
int i, ii, ich=0, ib, vv;
|
int i, ii, ib;
|
||||||
// TList *l= adcStack->GetHists();
|
// TList *l= adcStack->GetHists();
|
||||||
// TList *l1= countsStack->GetHists();
|
// TList *l1= countsStack->GetHists();
|
||||||
TH1F *h;
|
TH1F *h;
|
||||||
TH1F *h1;
|
TH1F *h1;
|
||||||
TH1F *hb;
|
TH1F *hb;
|
||||||
int nb, x,y;
|
int x;
|
||||||
double ped=0;
|
double ped=0;
|
||||||
int vv1,vv2;
|
|
||||||
int dsize=-1;
|
int dsize=-1;
|
||||||
int *val=NULL;
|
int *val=NULL;
|
||||||
int nx=1, ny=1, jj;
|
int nx=1, ny=1;
|
||||||
short unsigned int *va;
|
|
||||||
if (dataStructure) {
|
if (dataStructure) {
|
||||||
dataStructure->getDetectorSize(nx,ny);
|
dataStructure->getDetectorSize(nx,ny);
|
||||||
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
|
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
|
||||||
@ -873,7 +865,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
|||||||
int nadc;
|
int nadc;
|
||||||
int ndbit;
|
int ndbit;
|
||||||
|
|
||||||
|
tenG = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1032,7 +1024,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
|||||||
} else {
|
} else {
|
||||||
ii=0;
|
ii=0;
|
||||||
int iii=0;
|
int iii=0;
|
||||||
int nb=dbitlist.size();
|
|
||||||
for (const auto &value : dbitlist) {
|
for (const auto &value : dbitlist) {
|
||||||
ib=value;
|
ib=value;
|
||||||
hb=bitHisto[ib];
|
hb=bitHisto[ib];
|
||||||
@ -1198,10 +1189,10 @@ void ctbAcquisition::changeDetector(){
|
|||||||
photonFinder=NULL;
|
photonFinder=NULL;
|
||||||
dataStructure=NULL;
|
dataStructure=NULL;
|
||||||
commonMode=NULL;
|
commonMode=NULL;
|
||||||
TH2F *h2DMapOld=h2DMapAn;
|
|
||||||
// TH2F *h2ScanOld=h2Scan;
|
// TH2F *h2ScanOld=h2Scan;
|
||||||
TH1F *h1DMapOld=h1DMap;
|
|
||||||
int dim=2;
|
|
||||||
int nx,ny;
|
int nx,ny;
|
||||||
int csize=3;
|
int csize=3;
|
||||||
int nsigma=5;
|
int nsigma=5;
|
||||||
@ -1219,10 +1210,16 @@ void ctbAcquisition::changeDetector(){
|
|||||||
// commonMode=new moench03CommonMode();
|
// commonMode=new moench03CommonMode();
|
||||||
break;
|
break;
|
||||||
case MOENCH04:
|
case MOENCH04:
|
||||||
if (myDet->enableTenGigabitEthernet(-1))
|
|
||||||
dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
|
try {
|
||||||
else
|
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||||
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
if (retval) {
|
||||||
|
dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
|
||||||
|
} else {
|
||||||
|
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||||
|
}
|
||||||
|
} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||||
|
|
||||||
cout << "MOENCH 0.4!" << endl;
|
cout << "MOENCH 0.4!" << endl;
|
||||||
commonMode=new moench03CommonMode();
|
commonMode=new moench03CommonMode();
|
||||||
break;
|
break;
|
||||||
@ -1436,7 +1433,7 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
|||||||
float off=0;
|
float off=0;
|
||||||
for (int ii=0; ii<NSIGNALS; ii++) {
|
for (int ii=0; ii<NSIGNALS; ii++) {
|
||||||
if (bitPlotFlag[ii]) {bitOffset[ii]=off;
|
if (bitPlotFlag[ii]) {bitOffset[ii]=off;
|
||||||
off+=1.5;
|
off+=static_cast<float>(1.5);
|
||||||
cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
|
cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1451,74 +1448,65 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
|||||||
|
|
||||||
void ctbAcquisition::setOutdir() {
|
void ctbAcquisition::setOutdir() {
|
||||||
try {
|
try {
|
||||||
myDet->setFilePath(eOutdir->GetText());
|
myDet->setFilePath(eOutdir->GetText());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set file path", "ctbAcquisition::setOutdir")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
// // cout << "setting dac! "<< id << endl;
|
|
||||||
|
|
||||||
// myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
|
||||||
|
|
||||||
// getValue();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbAcquisition::setFname() {
|
void ctbAcquisition::setFname() {
|
||||||
try {
|
try {
|
||||||
myDet->setFileName(eFname->GetText());
|
myDet->setFileNamePrefix(eFname->GetText());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set file name prefix", "ctbAcquisition::setFname")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
// int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
|
||||||
// char s[100];
|
|
||||||
|
|
||||||
// sprintf(s,"%d",val);
|
|
||||||
|
|
||||||
// dacsValue->SetText(s);
|
|
||||||
|
|
||||||
|
|
||||||
// return val;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbAcquisition::setFindex() {
|
void ctbAcquisition::setFindex() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
myDet->setFileIndex(eFindex->GetNumber());
|
myDet->setAcquisitionIndex(eFindex->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set acquisition index", "ctbAcquisition::setFindex")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbAcquisition::setFsave(Bool_t b) {
|
void ctbAcquisition::setFsave(Bool_t b) {
|
||||||
try {
|
try {
|
||||||
myDet->setFileWrite(b);
|
myDet->setFileWrite(b);
|
||||||
} catch (...) {
|
eFname->SetState(b);
|
||||||
cout << "Do nothing for this error" << endl;
|
eOutdir->SetState(b);
|
||||||
}
|
} CATCH_DISPLAY ("Could not set file write", "ctbAcquisition::setFsave")
|
||||||
eFname->SetState(b);
|
|
||||||
eOutdir->SetState(b);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbAcquisition::update() {
|
void ctbAcquisition::update() {
|
||||||
|
try {
|
||||||
|
auto retval = myDet->getFileNamePrefix().tsquash("Different values");
|
||||||
|
eFname->SetText(retval.c_str());
|
||||||
|
} CATCH_DISPLAY ("Could not get file name prefix", "ctbAcquisition::update")
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto retval = myDet->getAcquisitionIndex().tsquash("Different values");
|
||||||
|
eFindex->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get acquisition index", "ctbAcquisition::update")
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto retval = myDet->getFileWrite().tsquash("Different values");
|
||||||
|
cFileSave->SetOn(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get file write", "ctbAcquisition::update")
|
||||||
|
|
||||||
eFname->SetText((myDet->getFileName()).c_str());
|
|
||||||
eOutdir->SetText((myDet->getFilePath()).c_str());
|
|
||||||
eFindex->SetNumber(myDet->getFileIndex());
|
|
||||||
cFileSave->SetOn(myDet->getFileWrite());
|
|
||||||
eFname->SetState(cFileSave->IsOn());
|
eFname->SetState(cFileSave->IsOn());
|
||||||
eOutdir->SetState(cFileSave->IsOn());
|
eOutdir->SetState(cFileSave->IsOn());
|
||||||
eFindex->SetState(cFileSave->IsOn());
|
eFindex->SetState(cFileSave->IsOn());
|
||||||
// eMeasurements->SetNumber(myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
|
||||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
try {
|
||||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||||
roMode=myDet->setReadOutFlags();
|
setAnalogSamples(retval);
|
||||||
setReadoutMode(roMode);
|
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::update")
|
||||||
//nChannels=myDet->getTotalNumberOfChannels();
|
|
||||||
|
try {
|
||||||
|
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||||
|
setDigitalSamples(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::update")
|
||||||
|
|
||||||
|
try {
|
||||||
|
roMode = myDet->getReadoutMode().tsquash("Different values");
|
||||||
|
setReadoutMode(roMode);
|
||||||
|
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
|
||||||
|
|
||||||
updateChans();
|
updateChans();
|
||||||
|
|
||||||
if (dataStructure) {
|
if (dataStructure) {
|
||||||
@ -1533,16 +1521,14 @@ void ctbAcquisition::update() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try {
|
||||||
dBitOffset=myDet->getReceiverDbitOffset();
|
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
try {
|
||||||
try{
|
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||||
tenG=myDet->enableTenGigabitEthernet(-1);
|
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
|
||||||
} catch (...) {
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
// char aargs[10][100];
|
// char aargs[10][100];
|
||||||
// char *args[10];
|
// char *args[10];
|
||||||
// for (int i=0; i<10; i++)
|
// for (int i=0; i<10; i++)
|
||||||
@ -1602,10 +1588,8 @@ void ctbAcquisition::loadPattern() {
|
|||||||
|
|
||||||
cout << "Load: " << fname << endl;
|
cout << "Load: " << fname << endl;
|
||||||
try {
|
try {
|
||||||
myDet->retrieveDetectorSetup(fname);
|
myDet->loadParameters(fname);
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not load parameters", "ctbAcquisition::loadPattern")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1616,16 +1600,26 @@ void ctbAcquisition::toggleAcquisition() {
|
|||||||
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
|
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
|
||||||
/** update all infos useful for the acquisition! */
|
/** update all infos useful for the acquisition! */
|
||||||
|
|
||||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
try {
|
||||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||||
dBitOffset=myDet->getReceiverDbitOffset();
|
setAnalogSamples(retval);
|
||||||
roMode=myDet->setReadOutFlags();
|
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::toggleAcquisition")
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||||
|
setDigitalSamples(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition")
|
||||||
|
|
||||||
|
try {
|
||||||
|
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||||
|
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
|
||||||
|
|
||||||
|
try {
|
||||||
|
roMode = myDet->getReadoutMode().tsquash("Different values");
|
||||||
setReadoutMode(roMode);
|
setReadoutMode(roMode);
|
||||||
|
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// iScanStep=0;
|
|
||||||
|
|
||||||
cout << "Run" << endl;
|
cout << "Run" << endl;
|
||||||
bStatus->SetText("Stop");
|
bStatus->SetText("Stop");
|
||||||
ip=0;
|
ip=0;
|
||||||
@ -1675,11 +1669,9 @@ void ctbAcquisition::toggleAcquisition() {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
StopFlag=1;
|
StopFlag=1;
|
||||||
try {
|
try{
|
||||||
myDet->stopAcquisition();
|
myDet->stopAcquisition();
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
stop=1;
|
stop=1;
|
||||||
bStatus->SetText("Start");
|
bStatus->SetText("Start");
|
||||||
// acqThread->Kill();
|
// acqThread->Kill();
|
||||||
@ -1696,32 +1688,30 @@ void ctbAcquisition::acquisitionFinished() {
|
|||||||
void ctbAcquisition::startAcquisition(){
|
void ctbAcquisition::startAcquisition(){
|
||||||
cout << "Detector started " <<eMeasurements->GetNumber()<< endl;
|
cout << "Detector started " <<eMeasurements->GetNumber()<< endl;
|
||||||
stop=0;
|
stop=0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tenG=myDet->enableTenGigabitEthernet(-1);
|
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::startAcquisition")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
for (int im=0; im<eMeasurements->GetNumber(); im++) {
|
for (int im=0; im<eMeasurements->GetNumber(); im++) {
|
||||||
try {
|
try {
|
||||||
myDet->acquire();
|
myDet->acquire();
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not acquire", "ctbAcquisition::startAcquisition")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
cout << im << endl;
|
|
||||||
if (stop) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
cout << im << endl;
|
||||||
|
if (stop)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ctbAcquisition::ThreadHandle(void *arg)
|
void* ctbAcquisition::ThreadHandle(void *arg)
|
||||||
{
|
{
|
||||||
ctbAcquisition *acq = static_cast<ctbAcquisition*>(arg);
|
ctbAcquisition *acq = static_cast<ctbAcquisition*>(arg);
|
||||||
int i=0;
|
|
||||||
|
|
||||||
acq->startAcquisition();
|
acq->startAcquisition();
|
||||||
acq->acquisitionFinished();
|
acq->acquisitionFinished();
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbAcquisition::progressCallback(double f,void* arg) {
|
void ctbAcquisition::progressCallback(double f,void* arg) {
|
||||||
@ -1754,12 +1744,6 @@ void ctbAcquisition::setPatternCompiler(const char* t) {
|
|||||||
}
|
}
|
||||||
void ctbAcquisition::setMeasurements() {
|
void ctbAcquisition::setMeasurements() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eMeasurements->GetNumber());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbAcquisition::setAnalogSamples(int n) {
|
void ctbAcquisition::setAnalogSamples(int n) {
|
||||||
@ -1864,46 +1848,32 @@ void ctbAcquisition::setDbitEnable(Int_t reg){
|
|||||||
|
|
||||||
void ctbAcquisition::updateChans() {
|
void ctbAcquisition::updateChans() {
|
||||||
|
|
||||||
/** dbitlist updated */
|
// dbit list
|
||||||
std::vector <int> dbl;
|
|
||||||
try {
|
try {
|
||||||
dbl = myDet->getReceiverDbitList();
|
auto retval = myDet->getRxDbitList().tsquash("Different values");
|
||||||
} catch (...) {
|
dbitlist.clear();
|
||||||
cout << "Do nothing for this error" << endl;
|
if (!retval.empty()) {
|
||||||
}
|
for (const auto &value : retval)
|
||||||
dbitlist.clear();
|
dbitlist.push_back(value);
|
||||||
if (dbl.empty())
|
|
||||||
;
|
|
||||||
else {
|
|
||||||
for (const auto &value : dbl)
|
|
||||||
dbitlist.push_back(value);
|
|
||||||
}
|
|
||||||
uint32_t reg;
|
|
||||||
try {
|
|
||||||
reg=myDet->getADCEnableMask();
|
|
||||||
} catch (...) {
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
/* adc updated */
|
|
||||||
adclist.clear();
|
|
||||||
// // updateChans();
|
|
||||||
if (reg!=0xffffffff) {
|
|
||||||
for (int i=0; i<NADCS; i++) {
|
|
||||||
if (reg&(1<<i))
|
|
||||||
adclist.push_back(i);
|
|
||||||
// // else enableFlag[i]=1;
|
|
||||||
}
|
}
|
||||||
}
|
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
|
||||||
|
|
||||||
|
|
||||||
|
// adc mask
|
||||||
|
try {
|
||||||
|
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||||
|
adclist.clear();
|
||||||
|
if (retval!=0xffffffff) {
|
||||||
|
for (int i=0; i<NADCS; i++) {
|
||||||
|
if (retval&(1<<i)) {
|
||||||
|
adclist.push_back(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} CATCH_DISPLAY ("Could not get adc enable mask.", "ctbAcquisition::updateChans")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbAcquisition::resetPedestal() {
|
void ctbAcquisition::resetPedestal() {
|
||||||
if (photonFinder) {
|
if (photonFinder) {
|
||||||
photonFinder->newDataSet();
|
photonFinder->newDataSet();
|
||||||
|
@ -23,7 +23,10 @@ class TH1F;
|
|||||||
class TGLabel;
|
class TGLabel;
|
||||||
class TGTextButton;
|
class TGTextButton;
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
class detectorData;
|
class detectorData;
|
||||||
|
|
||||||
template <class dataType> class slsDetectorData;
|
template <class dataType> class slsDetectorData;
|
||||||
@ -112,7 +115,7 @@ class ctbAcquisition : public TGGroupFrame {
|
|||||||
// TH1I *plotAdc[NADCS];
|
// TH1I *plotAdc[NADCS];
|
||||||
|
|
||||||
|
|
||||||
multiSlsDetector* myDet;
|
sls::Detector* myDet;
|
||||||
|
|
||||||
int plotFlag[NADCS];
|
int plotFlag[NADCS];
|
||||||
int bitPlotFlag[NSIGNALS];
|
int bitPlotFlag[NSIGNALS];
|
||||||
@ -169,7 +172,7 @@ class ctbAcquisition : public TGGroupFrame {
|
|||||||
int deserializer;
|
int deserializer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
|
ctbAcquisition(TGVerticalFrame*, sls::Detector*);
|
||||||
void setOutdir();
|
void setOutdir();
|
||||||
void setFname();
|
void setFname();
|
||||||
void setMeasurements();
|
void setMeasurements();
|
||||||
|
@ -24,14 +24,15 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "ctbAdcs.h"
|
#include "ctbAdcs.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "ctbDefs.h"
|
||||||
|
#include "Detector.h"
|
||||||
#include "slsDetectorCommand.h"
|
#include "slsDetectorCommand.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det)
|
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det)
|
||||||
: TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
: TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||||
|
|
||||||
TGHorizontalFrame *hframe=this;
|
TGHorizontalFrame *hframe=this;
|
||||||
@ -155,7 +156,7 @@ void ctbAdc::setAdcAlias(char *tit, int plot, int color) {
|
|||||||
string ctbAdc::getAdcAlias() {
|
string ctbAdc::getAdcAlias() {
|
||||||
|
|
||||||
char line[1000];
|
char line[1000];
|
||||||
sprintf(line,"ADC%d %s %d %x\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
|
sprintf(line,"ADC%d %s %d %lx\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
|
||||||
return string(line);
|
return string(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +265,7 @@ void ctbAdc::setPlot(Bool_t b){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
ctbAdcs::ctbAdcs(TGVerticalFrame *page, sls::Detector *det)
|
||||||
: TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
|
: TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
|
||||||
|
|
||||||
|
|
||||||
@ -272,7 +273,6 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
|||||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||||
MapWindow();
|
MapWindow();
|
||||||
|
|
||||||
char tit[100];
|
|
||||||
|
|
||||||
|
|
||||||
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
|
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
|
||||||
@ -415,108 +415,41 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
|||||||
|
|
||||||
int ctbAdcs::setEnable(int reg) {
|
int ctbAdcs::setEnable(int reg) {
|
||||||
|
|
||||||
// char aargs[10][100];
|
|
||||||
// char *args[10];
|
|
||||||
string retval;
|
|
||||||
int retreg;
|
|
||||||
|
|
||||||
// for (int i=0; i<10; i++) args[i]=aargs[i];
|
|
||||||
|
|
||||||
// sprintf(args[0],"adcenable");
|
|
||||||
// sprintf(args[1],"%x",reg);
|
|
||||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
|
||||||
// if (reg>-1) {
|
|
||||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
|
||||||
// }
|
|
||||||
if (reg>-1) {
|
|
||||||
try {
|
|
||||||
myDet->setADCEnableMask(reg);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
|
||||||
// cout <<"enable: " << retval << endl;;
|
|
||||||
// delete cmd;
|
|
||||||
|
|
||||||
// sscanf(retval.c_str(),"%x",&retreg);
|
|
||||||
try {
|
try {
|
||||||
retreg=myDet->getADCEnableMask();
|
if (reg > -1) {
|
||||||
} catch (...) {
|
myDet->setADCEnableMask(reg);
|
||||||
|
}
|
||||||
|
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||||
|
eEnableMask->SetHexNumber(retval);
|
||||||
|
return retval;
|
||||||
|
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
eEnableMask->SetHexNumber(retreg);
|
|
||||||
|
|
||||||
return retreg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ctbAdcs::setInvert(int reg) {
|
int ctbAdcs::setInvert(int reg) {
|
||||||
|
|
||||||
// char aargs[10][100];
|
|
||||||
// char *args[10];
|
|
||||||
string retval;
|
|
||||||
int retreg;
|
|
||||||
|
|
||||||
// for (int i=0; i<10; i++) args[i]=aargs[i];
|
|
||||||
|
|
||||||
//sprint// f(args[0],"adcinvert");
|
|
||||||
// sprintf(args[1],"%x",reg);
|
|
||||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
|
||||||
|
|
||||||
if (reg>-1) {
|
|
||||||
try {
|
|
||||||
myDet->setADCInvert(reg);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
//retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
retreg=myDet->getADCInvert();
|
if (reg > -1) {
|
||||||
} catch (...) {
|
myDet->setADCInvert(reg);
|
||||||
|
}
|
||||||
|
auto retval = myDet->getADCInvert().tsquash("Different values");
|
||||||
|
eInversionMask->SetHexNumber(retval);
|
||||||
|
return retval;
|
||||||
|
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
|
||||||
// cout <<"invert: " << retval << endl;;
|
|
||||||
// delete cmd;
|
|
||||||
|
|
||||||
// sscanf(retval.c_str(),"%x",&retreg);
|
|
||||||
eInversionMask->SetHexNumber(retreg);
|
|
||||||
return retreg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbAdcs::update() {
|
void ctbAdcs::update() {
|
||||||
Int_t invreg;//=myDet->readRegister(67);//(120);
|
Int_t invreg;
|
||||||
Int_t disreg;//=myDet->readRegister(120);//(94);
|
Int_t disreg;
|
||||||
// for (int i=0; i<10; i++)
|
|
||||||
// args[i]=aargs[i];
|
|
||||||
|
|
||||||
// string retval;
|
|
||||||
// sprintf(args[0],"adcenable");
|
|
||||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
|
||||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
|
||||||
// delete cmd;
|
|
||||||
// // cout << retval << endl;
|
|
||||||
|
|
||||||
// sscanf(retval.c_str(),"adcenable %x",&disreg);
|
|
||||||
|
|
||||||
// eInversionMask->SetHexNumber(invreg);
|
|
||||||
// eEnableMask->SetHexNumber(disreg);
|
|
||||||
|
|
||||||
disreg=setEnable();
|
disreg=setEnable();
|
||||||
invreg=setInvert();
|
invreg=setInvert();
|
||||||
|
|
||||||
|
|
||||||
for (int is=0; is<NADCS; is++) {
|
for (int is=0; is<NADCS; is++) {
|
||||||
sAdc[is]->setAdcAlias(NULL,-1,-1);
|
sAdc[is]->setAdcAlias(NULL,-1,-1);
|
||||||
if (invreg & (1<<is) )
|
if (invreg & (1<<is) )
|
||||||
@ -528,42 +461,29 @@ void ctbAdcs::update() {
|
|||||||
sAdc[is]->setEnable(kTRUE);
|
sAdc[is]->setEnable(kTRUE);
|
||||||
else
|
else
|
||||||
sAdc[is]->setEnable(kFALSE);
|
sAdc[is]->setEnable(kFALSE);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Emit("AdcEnable(Int_t)", disreg);
|
Emit("AdcEnable(Int_t)", disreg);
|
||||||
|
|
||||||
}
|
}
|
||||||
string ctbAdcs::getAdcParameters() {
|
string ctbAdcs::getAdcParameters() {
|
||||||
|
ostringstream line;
|
||||||
ostringstream line;
|
|
||||||
|
|
||||||
line << "reg "<< hex << setInvert() << "# ADC invert reg" << dec << endl;
|
line << "reg "<< hex << setInvert() << "# ADC invert reg" << dec << endl;
|
||||||
line << "reg "<< hex << setEnable() << " # ADC enable reg"<< dec << endl;
|
line << "reg "<< hex << setEnable() << " # ADC enable reg"<< dec << endl;
|
||||||
// line << "reg "<< hex << 67 << " " << myDet->readRegister(67) << "# ADC invert reg" << dec << endl;
|
|
||||||
// line << "reg "<< hex << 120 << " " << myDet->readRegister(120) << " # ADC enable reg"<< dec << endl;
|
|
||||||
// // line << "reg "<< hex << 94 << " " << myDet->readRegister(94) << " # ADC enable reg"<< dec << endl;
|
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbAdcs::CheckAll() {
|
void ctbAdcs::CheckAll() {
|
||||||
|
|
||||||
|
|
||||||
for (int is=0; is<NADCS; is++){
|
for (int is=0; is<NADCS; is++){
|
||||||
sAdc[is]->setPlot(kTRUE);
|
sAdc[is]->setPlot(kTRUE);
|
||||||
// sAdc[is]->setEnabled(kTRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbAdcs::RemoveAll() {
|
void ctbAdcs::RemoveAll() {
|
||||||
|
|
||||||
|
|
||||||
for (int is=0; is<NADCS; is++) {
|
for (int is=0; is<NADCS; is++) {
|
||||||
// sAdc[is]->setEnabled(kFALSE);
|
|
||||||
sAdc[is]->setPlot(kFALSE);
|
sAdc[is]->setPlot(kFALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -571,51 +491,32 @@ void ctbAdcs::RemoveAll() {
|
|||||||
|
|
||||||
|
|
||||||
void ctbAdcs::CheckHalf0() {
|
void ctbAdcs::CheckHalf0() {
|
||||||
|
|
||||||
|
|
||||||
for (int is=0; is<NADCS/2; is++) {
|
for (int is=0; is<NADCS/2; is++) {
|
||||||
sAdc[is]->setPlot(kTRUE);
|
sAdc[is]->setPlot(kTRUE);
|
||||||
// sAdc[is]->setEnabled(kTRUE)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbAdcs::RemoveHalf0() {
|
void ctbAdcs::RemoveHalf0() {
|
||||||
|
|
||||||
|
|
||||||
for (int is=0; is<NADCS/2; is++){
|
for (int is=0; is<NADCS/2; is++){
|
||||||
// sAdc[is]->setEnabled(kFALSE);
|
|
||||||
sAdc[is]->setPlot(kFALSE);
|
sAdc[is]->setPlot(kFALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbAdcs::CheckHalf1() {
|
void ctbAdcs::CheckHalf1() {
|
||||||
|
|
||||||
|
|
||||||
for (int is=NADCS/2; is<NADCS; is++){
|
for (int is=NADCS/2; is<NADCS; is++){
|
||||||
sAdc[is]->setPlot(kTRUE);
|
sAdc[is]->setPlot(kTRUE);
|
||||||
// sAdc[is]->setEnabled(kTRUE)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbAdcs::RemoveHalf1() {
|
void ctbAdcs::RemoveHalf1() {
|
||||||
|
|
||||||
|
|
||||||
for (int is=NADCS/2; is<NADCS; is++){
|
for (int is=NADCS/2; is<NADCS; is++){
|
||||||
// sAdc[is]->setEnabled(kFALSE);
|
|
||||||
sAdc[is]->setPlot(kFALSE);
|
sAdc[is]->setPlot(kFALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TGraph* ctbAdcs::getGraph(int i) {
|
|
||||||
|
|
||||||
// if (i>=0 && i<NADCS)
|
|
||||||
// return sAdc[i]->getGraph();
|
|
||||||
// return NULL;
|
|
||||||
// }
|
|
||||||
|
|
||||||
int ctbAdcs::setAdcAlias(string line) {
|
int ctbAdcs::setAdcAlias(string line) {
|
||||||
|
|
||||||
int is=-1, plot=0, color=-1;
|
int is=-1, plot=0, color=-1;
|
||||||
@ -657,33 +558,23 @@ void ctbAdcs::AdcEnable(Int_t b){
|
|||||||
|
|
||||||
void ctbAdcs::ToggledAdcEnable(Int_t b){
|
void ctbAdcs::ToggledAdcEnable(Int_t b){
|
||||||
|
|
||||||
|
Int_t oreg=setEnable();
|
||||||
Int_t oreg=setEnable();//myDet->readRegister(67);
|
|
||||||
Int_t m=1<<b;
|
Int_t m=1<<b;
|
||||||
|
|
||||||
|
|
||||||
if (sAdc[b]->getEnable())
|
if (sAdc[b]->getEnable())
|
||||||
oreg|=m;
|
oreg|=m;
|
||||||
else
|
else
|
||||||
oreg&=~m;
|
oreg&=~m;
|
||||||
|
|
||||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
setEnable(oreg);
|
||||||
|
|
||||||
setEnable(oreg);//)writeRegister(67, oreg);
|
|
||||||
//oreg=setEnable();//myDet->readRegister(67);
|
|
||||||
|
|
||||||
|
|
||||||
Emit("AdcEnable(Int_t)", oreg);
|
Emit("AdcEnable(Int_t)", oreg);
|
||||||
//cout << "enable!" << endl;
|
|
||||||
// Emit("ToggledAdcPlot(Int_t)", b);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbAdcs::ToggledAdcInvert(Int_t b){
|
void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||||
|
|
||||||
// char val[1000];
|
Int_t oreg=setInvert();
|
||||||
Int_t oreg=setInvert();//myDet->readRegister(67);
|
|
||||||
Int_t m=1<<b;
|
Int_t m=1<<b;
|
||||||
|
|
||||||
|
|
||||||
@ -692,15 +583,7 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
|||||||
else
|
else
|
||||||
oreg&=~m;
|
oreg&=~m;
|
||||||
|
|
||||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
setInvert(oreg);
|
||||||
|
|
||||||
setInvert(oreg);//)writeRegister(67, oreg);
|
|
||||||
// oreg=setInvert();//myDet->readRegister(67);
|
|
||||||
|
|
||||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
|
||||||
|
|
||||||
//sprintf(val,"%X",oreg);
|
|
||||||
//eInversionMask->SetHexNumber(oreg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -710,22 +593,23 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
|||||||
Pixel_t ctbAdcs::getColor(int i){
|
Pixel_t ctbAdcs::getColor(int i){
|
||||||
if (i>=0 && i<NADCS)
|
if (i>=0 && i<NADCS)
|
||||||
return sAdc[i]->getColor();
|
return sAdc[i]->getColor();
|
||||||
|
return static_cast<Pixel_t>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool_t ctbAdcs::getEnabled(int i){
|
Bool_t ctbAdcs::getEnabled(int i){
|
||||||
if (i>=0 && i<NADCS)
|
if (i>=0 && i<NADCS)
|
||||||
return sAdc[i]->getEnabled();
|
return sAdc[i]->getEnabled();
|
||||||
|
return static_cast<Bool_t>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool_t ctbAdcs::getEnable(int i){
|
Bool_t ctbAdcs::getEnable(int i){
|
||||||
if (i>=0 && i<NADCS)
|
if (i>=0 && i<NADCS)
|
||||||
return sAdc[i]->getEnable();
|
return sAdc[i]->getEnable();
|
||||||
|
return static_cast<Bool_t>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool_t ctbAdcs::getPlot(int i){
|
Bool_t ctbAdcs::getPlot(int i){
|
||||||
if (i>=0 && i<NADCS)
|
if (i>=0 && i<NADCS)
|
||||||
return sAdc[i]->getPlot();
|
return sAdc[i]->getPlot();
|
||||||
|
return static_cast<Bool_t>(-1);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,10 @@ class TGTab;
|
|||||||
|
|
||||||
class TGraph;
|
class TGraph;
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -49,10 +52,10 @@ class ctbAdc : public TGHorizontalFrame {
|
|||||||
// TGraph *gADC;
|
// TGraph *gADC;
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det);
|
ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det);
|
||||||
|
|
||||||
|
|
||||||
void setAdcAlias(char *tit, int plot, int color);
|
void setAdcAlias(char *tit, int plot, int color);
|
||||||
@ -89,7 +92,7 @@ class ctbAdcs : public TGGroupFrame {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
ctbAdc *sAdc[NADCS];
|
ctbAdc *sAdc[NADCS];
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
|
|
||||||
TGTextButton *bCheckAll;
|
TGTextButton *bCheckAll;
|
||||||
@ -115,7 +118,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det);
|
ctbAdcs(TGVerticalFrame *page, sls::Detector *det);
|
||||||
int setAdcAlias(string line);
|
int setAdcAlias(string line);
|
||||||
string getAdcAlias();
|
string getAdcAlias();
|
||||||
string getAdcParameters();
|
string getAdcParameters();
|
||||||
|
@ -9,17 +9,14 @@
|
|||||||
#include <TGButton.h>
|
#include <TGButton.h>
|
||||||
|
|
||||||
#include "ctbDacs.h"
|
#include "ctbDacs.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "ctbDefs.h"
|
||||||
|
#include "Detector.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
ctbDac::ctbDac(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||||
|
|
||||||
|
|
||||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
|
||||||
|
|
||||||
|
|
||||||
TGHorizontalFrame *hframe=this;
|
TGHorizontalFrame *hframe=this;
|
||||||
|
|
||||||
@ -104,12 +101,9 @@ int ctbDac::setLabel(char *tit, int mv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string ctbDac::getLabel() {
|
string ctbDac::getLabel() {
|
||||||
|
|
||||||
ostringstream line;
|
ostringstream line;
|
||||||
line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
|
line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
|
||||||
|
|
||||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||||
|
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -119,65 +113,45 @@ void ctbDac::setValue(Long_t a) {setValue();}
|
|||||||
|
|
||||||
void ctbDac::setValue() {
|
void ctbDac::setValue() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn()); } catch (...) {
|
myDet->setDAC(dacsEntry->GetIntNumber(), static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn());
|
||||||
cout << "Do nothing for this error" << endl;
|
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
|
||||||
}
|
|
||||||
|
|
||||||
getValue();
|
getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbDac::setOn(Bool_t b) {
|
void ctbDac::setOn(Bool_t b) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cout << "setting dac! "<< id << endl;
|
// cout << "setting dac! "<< id << endl;
|
||||||
|
|
||||||
if ( dacsLabel->IsOn()) {
|
if ( dacsLabel->IsOn()) {
|
||||||
setValue();
|
setValue();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
myDet->setDAC(-100, (slsDetectorDefs::dacIndex)id, 0);
|
myDet->setDAC(-100, static_cast<slsDetectorDefs::dacIndex>(id), false);
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getValue();
|
getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ctbDac::getValue() {
|
int ctbDac::getValue() {
|
||||||
int val;
|
|
||||||
try {
|
try {
|
||||||
val=myDet->setDAC(-1,(slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
|
||||||
} catch (...) {
|
cout << "dac " << id << " " << val << endl;
|
||||||
cout << "Do nothing for this error" << endl;
|
dacsValue->SetText(to_string(val).c_str());
|
||||||
}
|
if (val >= 0) {
|
||||||
char s[100];
|
dacsLabel->SetOn(kTRUE);
|
||||||
cout << "dac " << id << " " << val << endl;
|
} else {
|
||||||
sprintf(s,"%d",val);
|
dacsLabel->SetOn(kFALSE);
|
||||||
dacsValue->SetText(s);
|
}
|
||||||
if (val>=0) {
|
return val;
|
||||||
dacsLabel->SetOn(kTRUE);
|
} CATCH_DISPLAY ("Could not get dac " + to_string(id) + ".", "ctbDac::getValue")
|
||||||
} else {
|
|
||||||
dacsLabel->SetOn(kFALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return val;
|
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ctbDacs::ctbDacs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||||
|
|
||||||
|
|
||||||
ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
|
||||||
|
|
||||||
|
|
||||||
SetTitlePos(TGGroupFrame::kLeft);
|
SetTitlePos(TGGroupFrame::kLeft);
|
||||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||||
@ -192,14 +166,12 @@ ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(
|
|||||||
}
|
}
|
||||||
dacs[NDACS]=new ctbDac(this, slsDetectorDefs::ADC_VPP, myDet);
|
dacs[NDACS]=new ctbDac(this, slsDetectorDefs::ADC_VPP, myDet);
|
||||||
dacs[NDACS+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
|
dacs[NDACS+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
|
||||||
dacs[NDACS]->setLabel("ADC Vpp",2);
|
dacs[NDACS]->setLabel((char*)"ADC Vpp",2);
|
||||||
dacs[NDACS+1]->setLabel("High Voltage",3);
|
dacs[NDACS+1]->setLabel((char*)"High Voltage",3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ctbDacs::setDacAlias(string line) {
|
int ctbDacs::setDacAlias(string line) {
|
||||||
|
|
||||||
int is=-1, mv=0;
|
int is=-1, mv=0;
|
||||||
char tit[100];
|
char tit[100];
|
||||||
int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
|
int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
|
||||||
@ -217,7 +189,6 @@ string ctbDacs::getDacAlias() {
|
|||||||
for (int i=0; i<NDACS; i++)
|
for (int i=0; i<NDACS; i++)
|
||||||
line << dacs[i]->getLabel() << endl;
|
line << dacs[i]->getLabel() << endl;
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -225,8 +196,6 @@ string ctbDacs::getDacAlias() {
|
|||||||
|
|
||||||
|
|
||||||
string ctbDacs::getDacParameters() {
|
string ctbDacs::getDacParameters() {
|
||||||
|
|
||||||
|
|
||||||
ostringstream line;
|
ostringstream line;
|
||||||
|
|
||||||
for (int i=0; i<NDACS; i++) {
|
for (int i=0; i<NDACS; i++) {
|
||||||
@ -234,18 +203,12 @@ string ctbDacs::getDacParameters() {
|
|||||||
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||||
}
|
}
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbDacs::update() {
|
void ctbDacs::update() {
|
||||||
|
|
||||||
for (int idac=0; idac<NDACS+1; idac++) {
|
for (int idac=0; idac<NDACS+1; idac++) {
|
||||||
dacs[idac]->getValue();
|
dacs[idac]->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,10 @@ class TGNumberEntry;
|
|||||||
class TGCheckButton;
|
class TGCheckButton;
|
||||||
|
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -32,9 +35,9 @@ class ctbDac : public TGHorizontalFrame {
|
|||||||
TGLabel *dacsValue;
|
TGLabel *dacsValue;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
multiSlsDetector* myDet;
|
sls::Detector* myDet;
|
||||||
public:
|
public:
|
||||||
ctbDac(TGGroupFrame*, int , multiSlsDetector*);
|
ctbDac(TGGroupFrame*, int , sls::Detector*);
|
||||||
void setValue();
|
void setValue();
|
||||||
void setValue(Long_t);
|
void setValue(Long_t);
|
||||||
int getValue();
|
int getValue();
|
||||||
@ -55,10 +58,10 @@ private:
|
|||||||
|
|
||||||
ctbDac *dacs[NDACS+2];
|
ctbDac *dacs[NDACS+2];
|
||||||
|
|
||||||
multiSlsDetector* myDet;
|
sls::Detector* myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbDacs(TGVerticalFrame *page, multiSlsDetector*);
|
ctbDacs(TGVerticalFrame *page, sls::Detector*);
|
||||||
|
|
||||||
int setDacAlias(string line);
|
int setDacAlias(string line);
|
||||||
// int setDacAlias(string line);
|
// int setDacAlias(string line);
|
||||||
|
84
ctbGui/ctbDefs.h
Executable file
84
ctbGui/ctbDefs.h
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
//#include "sls_detector_exceptions.h"
|
||||||
|
//#include "ansi.h"
|
||||||
|
#define RED "\x1b[31m"
|
||||||
|
#define RESET "\x1b[0m"
|
||||||
|
#define BOLD "\x1b[1m"
|
||||||
|
#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
#define CATCH_DISPLAY(m, s) catch(...) { ctbDefs::DisplayExceptions(m, s); }
|
||||||
|
#define CATCH_HANDLE(...) catch(...) { ctbDefs::HandleExceptions(__VA_ARGS__); }
|
||||||
|
|
||||||
|
class ctbDefs {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Empty Constructor
|
||||||
|
*/
|
||||||
|
ctbDefs(){};
|
||||||
|
|
||||||
|
// convert double seconds to chrono ns
|
||||||
|
static std::chrono::nanoseconds ConvertDoubleStoChronoNS(double timeS) {
|
||||||
|
using std::chrono::duration;
|
||||||
|
using std::chrono::duration_cast;
|
||||||
|
using std::chrono::nanoseconds;
|
||||||
|
return duration_cast<nanoseconds>(duration<double>(timeS));
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert chrono ns to doubel s
|
||||||
|
static double ConvertChronoNStoDoubleS(std::chrono::nanoseconds timeNs) {
|
||||||
|
using std::chrono::duration;
|
||||||
|
using std::chrono::duration_cast;
|
||||||
|
return duration_cast<duration<double>>(timeNs).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||||
|
try {
|
||||||
|
throw;
|
||||||
|
} /* catch (const sls::SocketError &e) {
|
||||||
|
throw;
|
||||||
|
} catch (const sls::SharedMemoryError &e) {
|
||||||
|
throw;
|
||||||
|
} */catch (const std::exception &e) {
|
||||||
|
ExceptionMessage(emsg, e.what(), src);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class CT> struct NonDeduced { using type = CT; };
|
||||||
|
template <class S, typename RT, typename... CT>
|
||||||
|
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
||||||
|
RT (S::*somefunc)(CT...),
|
||||||
|
typename NonDeduced<CT>::type... Args) {
|
||||||
|
try {
|
||||||
|
throw;
|
||||||
|
} /*catch (const sls::SocketError &e) {
|
||||||
|
throw;
|
||||||
|
} catch (const sls::SharedMemoryError &e) {
|
||||||
|
throw;
|
||||||
|
} */catch (const std::exception &e) {
|
||||||
|
|
||||||
|
ExceptionMessage(emsg, e.what(), src);
|
||||||
|
(s->*somefunc)(Args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void ExceptionMessage(std::string message,
|
||||||
|
std::string exceptionMessage,
|
||||||
|
std::string source) {
|
||||||
|
// because sls_detector_exceptions cannot be included
|
||||||
|
if (exceptionMessage.find("hared memory")) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
if (exceptionMessage.find("annot connect")) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());
|
||||||
|
//return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
@ -9,11 +9,11 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "Detector.h"
|
||||||
#include "multiSlsDetector.h"
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
//#include "sls_receiver_defs.h"
|
//#include "sls_receiver_defs.h"
|
||||||
#include "ctbMain.h"
|
#include "ctbMain.h"
|
||||||
|
#include "ctbDefs.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
} else if (strcmp(argv[ia],"-par")==0) {
|
} else if (strcmp(argv[ia],"-par")==0) {
|
||||||
if (ia+1<argc) {
|
if (ia+1<argc) {
|
||||||
pfname=argv[ia+1];
|
pfname=argv[ia+1];
|
||||||
ia++;
|
ia++;
|
||||||
pf=1;
|
pf=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,31 +61,27 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
|
|
||||||
cout << " *** " << endl;
|
cout << " *** " << endl;
|
||||||
|
sls::Detector *myDet = nullptr;
|
||||||
|
try {
|
||||||
|
/****** Create detector ****************/
|
||||||
|
myDet=new sls::Detector(id);
|
||||||
|
cout << "Created multi detector id " << id << endl;
|
||||||
|
|
||||||
/****** Create detector ****************/
|
if (cf) {
|
||||||
multiSlsDetector *myDet=new multiSlsDetector(id);
|
myDet->loadConfig(cfname);
|
||||||
// myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
cout << "Config file loaded successfully" << endl;
|
||||||
|
} else {
|
||||||
//cout << id << " " << myDet << " " << myDet->setOnline() << endl;
|
cout << "No config file specified" << endl;
|
||||||
if (cf) {
|
}
|
||||||
myDet->readConfigurationFile(cfname);
|
cout << "hostname " << myDet->getHostname() << endl;
|
||||||
} else
|
|
||||||
cout << "No config file specified" << endl;
|
|
||||||
|
|
||||||
cout << "aa" << endl;
|
|
||||||
|
|
||||||
cout << "Created multi detector id " << id << " hostname " << myDet->getHostname() << endl;
|
|
||||||
|
|
||||||
|
|
||||||
cout << "bb" << endl;
|
|
||||||
if (pf) {
|
|
||||||
myDet->retrieveDetectorSetup(pfname);
|
|
||||||
} else
|
|
||||||
cout << "No parameter file specified" << endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (pf) {
|
||||||
|
myDet->loadParameters(pfname);
|
||||||
|
cout << "Loaded parameter file successfully" << endl;
|
||||||
|
} else{
|
||||||
|
cout << "No parameter file specified" << endl;
|
||||||
|
}
|
||||||
|
} CATCH_DISPLAY ("Could not create detector/ load config/parameters.", "ctbGui::main")
|
||||||
|
|
||||||
/***********Create GUI stuff *******************/
|
/***********Create GUI stuff *******************/
|
||||||
TApplication theApp("App",&argc,argv);
|
TApplication theApp("App",&argc,argv);
|
||||||
@ -141,7 +137,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
|
|
||||||
gROOT->ForceStyle();
|
gROOT->ForceStyle();
|
||||||
ctbMain *mf=new ctbMain(gClient->GetRoot(),myDet);
|
ctbMain *mf=new ctbMain(gClient->GetRoot(), myDet);
|
||||||
|
|
||||||
cout << " *** " << argc << endl;
|
cout << " *** " << argc << endl;
|
||||||
for (int ia=0; ia<argc; ia++)
|
for (int ia=0; ia<argc; ia++)
|
||||||
|
@ -29,15 +29,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "multiSlsDetector.h"
|
#include "Detector.h"
|
||||||
|
#include "ctbDefs.h"
|
||||||
#include "ctbMain.h"
|
#include "ctbMain.h"
|
||||||
#include "ctbDacs.h"
|
#include "ctbDacs.h"
|
||||||
#include "ctbSlowAdcs.h"
|
#include "ctbSlowAdcs.h"
|
||||||
@ -52,7 +50,7 @@ using namespace std;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
|
||||||
: TGMainFrame(p,800,800), pwrs(NULL), senses(NULL) {
|
: TGMainFrame(p,800,800), pwrs(NULL), senses(NULL) {
|
||||||
|
|
||||||
myDet=det;
|
myDet=det;
|
||||||
@ -147,7 +145,7 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
|||||||
tf = mtab->AddTab("Power Supplies");
|
tf = mtab->AddTab("Power Supplies");
|
||||||
page=new TGVerticalFrame(tf, 1500,1200);
|
page=new TGVerticalFrame(tf, 1500,1200);
|
||||||
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
||||||
pwrs=new ctbPowers(page, myDet);
|
pwrs=new ctbPowers(page, myDet);
|
||||||
|
|
||||||
i_pwrs=i_page++;
|
i_pwrs=i_page++;
|
||||||
|
|
||||||
@ -155,7 +153,7 @@ ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
|||||||
tf = mtab->AddTab("Sense");
|
tf = mtab->AddTab("Sense");
|
||||||
page=new TGVerticalFrame(tf, 1500,1200);
|
page=new TGVerticalFrame(tf, 1500,1200);
|
||||||
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
|
||||||
senses=new ctbSlowAdcs(page, myDet);
|
senses=new ctbSlowAdcs(page, myDet);
|
||||||
|
|
||||||
i_senses=i_page++;
|
i_senses=i_page++;
|
||||||
|
|
||||||
@ -304,7 +302,7 @@ void ctbMain::HandleMenu(Int_t id)
|
|||||||
fi.fIniDir = StrDup(dir);
|
fi.fIniDir = StrDup(dir);
|
||||||
printf("fIniDir = %s\n", fi.fIniDir);
|
printf("fIniDir = %s\n", fi.fIniDir);
|
||||||
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
|
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
|
||||||
printf("Open file: %s (dir: %s)\n", fi.fFilename);
|
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||||
// dir = fi.fIniDir;
|
// dir = fi.fIniDir;
|
||||||
if (fi.fFilename)
|
if (fi.fFilename)
|
||||||
loadAlias(fi.fFilename);
|
loadAlias(fi.fFilename);
|
||||||
@ -320,13 +318,12 @@ void ctbMain::HandleMenu(Int_t id)
|
|||||||
fi.fIniDir = StrDup(dir);
|
fi.fIniDir = StrDup(dir);
|
||||||
printf("fIniDir = %s\n", fi.fIniDir);
|
printf("fIniDir = %s\n", fi.fIniDir);
|
||||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||||
printf("Save file: %s (dir: %s)\n", fi.fFilename);
|
printf("Save file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||||
// dir = fi.fIniDir;
|
// dir = fi.fIniDir;
|
||||||
if (fi.fFilename)
|
if (fi.fFilename)
|
||||||
saveAlias(fi.fFilename);
|
saveAlias(fi.fFilename);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
|
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
|
||||||
cout << "Open Parameters" << endl;
|
cout << "Open Parameters" << endl;
|
||||||
{
|
{
|
||||||
@ -343,23 +340,7 @@ void ctbMain::HandleMenu(Int_t id)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: //fMenuFile->AddEntry("Save Parameters", im++);
|
case 3: // fMenuFile->AddEntry("Open Configuration", im++);
|
||||||
cout << "Save Parameters" << endl;
|
|
||||||
{
|
|
||||||
static TString dir(".");
|
|
||||||
TGFileInfo fi;
|
|
||||||
//fi.fFileTypes = filetypes;
|
|
||||||
fi.fIniDir = StrDup(dir);
|
|
||||||
printf("fIniDir = %s\n", fi.fIniDir);
|
|
||||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
|
||||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
|
||||||
// dir = fi.fIniDir;
|
|
||||||
if (fi.fFilename)
|
|
||||||
saveParameters(fi.fFilename);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4: // fMenuFile->AddEntry("Open Configuration", im++);
|
|
||||||
cout << "Open configuration" << endl;
|
cout << "Open configuration" << endl;
|
||||||
{
|
{
|
||||||
static TString dir(".");
|
static TString dir(".");
|
||||||
@ -375,23 +356,7 @@ void ctbMain::HandleMenu(Int_t id)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // fMenuFile->AddEntry("Save Configuration", im++);
|
case 4: //fMenuFile->AddEntry("Open Pattern", im++);
|
||||||
cout << "Save configuration" << endl;
|
|
||||||
{
|
|
||||||
static TString dir(".");
|
|
||||||
TGFileInfo fi;
|
|
||||||
//fi.fFileTypes = filetypes;
|
|
||||||
fi.fIniDir = StrDup(dir);
|
|
||||||
printf("fIniDir = %s\n", fi.fIniDir);
|
|
||||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
|
||||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
|
||||||
// dir = fi.fIniDir;
|
|
||||||
if (fi.fFilename)
|
|
||||||
saveConfiguration(fi.fFilename);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6: //fMenuFile->AddEntry("Open Pattern", im++);
|
|
||||||
cout << "Open pattern" << endl;
|
cout << "Open pattern" << endl;
|
||||||
{
|
{
|
||||||
static TString dir(".");
|
static TString dir(".");
|
||||||
@ -407,7 +372,7 @@ void ctbMain::HandleMenu(Int_t id)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: //fMenuFile->AddEntry("Save Pattern", im++);
|
case 5: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||||
cout << "Save pattern" << endl;
|
cout << "Save pattern" << endl;
|
||||||
{
|
{
|
||||||
static TString dir(".");
|
static TString dir(".");
|
||||||
@ -419,11 +384,11 @@ void ctbMain::HandleMenu(Int_t id)
|
|||||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||||
// dir = fi.fIniDir;
|
// dir = fi.fIniDir;
|
||||||
if (fi.fFilename)
|
if (fi.fFilename)
|
||||||
saveParameters(fi.fFilename);
|
savePattern(fi.fFilename);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: // fMenuFile->AddEntry("Exit", im++);
|
case 6: // fMenuFile->AddEntry("Exit", im++);
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -439,7 +404,7 @@ int ctbMain::setADCPlot(Int_t i) {
|
|||||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||||
// acq->setGraph(i,adcs->getGraph(i));
|
// acq->setGraph(i,adcs->getGraph(i));
|
||||||
acq->setGraph(i,adcs->getEnabled(i),adcs->getColor(i));
|
acq->setGraph(i,adcs->getEnabled(i),adcs->getColor(i));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -448,120 +413,31 @@ int ctbMain::setSignalPlot(Int_t i) {
|
|||||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||||
// acq->setGraph(i,adcs->getGraph(i));
|
// acq->setGraph(i,adcs->getGraph(i));
|
||||||
acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
|
acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ctbMain::loadConfiguration(string fname) {
|
void ctbMain::loadConfiguration(string fname) {
|
||||||
|
try{
|
||||||
myDet->readConfigurationFile(fname);
|
myDet->loadConfig(fname);
|
||||||
|
} CATCH_DISPLAY ("Could not load config.", "ctbMain::loadConfiguration")
|
||||||
// string line;
|
|
||||||
// int i;
|
|
||||||
// ifstream myfile (fname.c_str());
|
|
||||||
// if (myfile.is_open())
|
|
||||||
// {
|
|
||||||
// while ( getline (myfile,line) )
|
|
||||||
// {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
// myfile.close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// else cout << "Unable to open file";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ctbMain::loadParameters(string fname) {
|
||||||
|
try{
|
||||||
|
myDet->loadParameters(fname);
|
||||||
|
} CATCH_DISPLAY ("Could not load parameters.", "ctbMain::loadParameters")
|
||||||
int ctbMain::saveConfiguration(string fname) {
|
|
||||||
|
|
||||||
|
|
||||||
myDet->writeConfigurationFile(fname);
|
|
||||||
// string line;
|
|
||||||
// int i;
|
|
||||||
// ofstream myfile (fname.c_str());
|
|
||||||
// if (myfile.is_open())
|
|
||||||
// {
|
|
||||||
|
|
||||||
|
|
||||||
// myfile.close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// else cout << "Unable to open file";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ctbMain::savePattern(string fname) {
|
||||||
|
try{
|
||||||
|
myDet->savePattern(fname);
|
||||||
|
} CATCH_DISPLAY ("Could not save pattern.", "ctbMain::savePattern")
|
||||||
|
|
||||||
|
|
||||||
int ctbMain::loadParameters(string fname) {
|
|
||||||
|
|
||||||
myDet->retrieveDetectorSetup(fname);
|
|
||||||
|
|
||||||
// string line;
|
|
||||||
// int i;
|
|
||||||
// ifstream myfile (fname.c_str());
|
|
||||||
// if (myfile.is_open())
|
|
||||||
// {
|
|
||||||
// while ( getline (myfile,line) )
|
|
||||||
// {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
// myfile.close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// else cout << "Unable to open file";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ctbMain::saveParameters(string fname) {
|
|
||||||
|
|
||||||
|
|
||||||
string line;
|
|
||||||
int i;
|
|
||||||
myDet->dumpDetectorSetup(fname);
|
|
||||||
// ofstream myfile (fname.c_str());
|
|
||||||
// if (myfile.is_open())
|
|
||||||
// {
|
|
||||||
|
|
||||||
// myfile << dacs->getDacParameters();
|
|
||||||
// myfile << sig->getSignalParameters();
|
|
||||||
// myfile << adcs->getAdcParameters();
|
|
||||||
|
|
||||||
// myfile.close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// else cout << "Unable to open file";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ctbMain::loadAlias(string fname) {
|
int ctbMain::loadAlias(string fname) {
|
||||||
|
|
||||||
|
|
||||||
@ -589,7 +465,7 @@ int ctbMain::loadAlias(string fname) {
|
|||||||
else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
|
else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
|
||||||
pat->setPatternAlias(line);
|
pat->setPatternAlias(line);
|
||||||
// cout << "---------" << line<< endl;
|
// cout << "---------" << line<< endl;
|
||||||
} else if (sscanf(line.c_str(),"V%s",&i)>0) {
|
} else if (sscanf(line.c_str(),"V%s",aaaa)>0) {
|
||||||
if (pwrs) pwrs->setPwrAlias(line);
|
if (pwrs) pwrs->setPwrAlias(line);
|
||||||
// cout << "+++++++++" << line<< endl;
|
// cout << "+++++++++" << line<< endl;
|
||||||
} else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
|
} else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
|
||||||
@ -615,7 +491,6 @@ int ctbMain::saveAlias(string fname) {
|
|||||||
|
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
int i;
|
|
||||||
ofstream myfile (fname.c_str());
|
ofstream myfile (fname.c_str());
|
||||||
if (myfile.is_open())
|
if (myfile.is_open())
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,10 @@ class ctbPowers;
|
|||||||
|
|
||||||
class ctbSignals;
|
class ctbSignals;
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
|
|
||||||
class ctbPattern;
|
class ctbPattern;
|
||||||
class ctbAdcs;
|
class ctbAdcs;
|
||||||
@ -47,7 +50,7 @@ class ctbMain : public TGMainFrame {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,15 +99,14 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbMain(const TGWindow *p, multiSlsDetector *det);
|
ctbMain(const TGWindow *p, sls::Detector *det);
|
||||||
|
|
||||||
|
|
||||||
int loadAlias(string fname);
|
int loadAlias(string fname);
|
||||||
int saveAlias(string fname);
|
int saveAlias(string fname);
|
||||||
int loadParameters(string fname);
|
void loadParameters(string fname);
|
||||||
int saveParameters(string fname);
|
void savePattern(string fname);
|
||||||
int loadConfiguration(string fname);
|
void loadConfiguration(string fname);
|
||||||
int saveConfiguration(string fname);
|
|
||||||
void tabSelected(Int_t);
|
void tabSelected(Int_t);
|
||||||
int setADCPlot(Int_t);
|
int setADCPlot(Int_t);
|
||||||
int setSignalPlot(Int_t);
|
int setSignalPlot(Int_t);
|
||||||
|
@ -24,15 +24,16 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "ctbPattern.h"
|
#include "ctbPattern.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "ctbDefs.h"
|
||||||
|
#include "Detector.h"
|
||||||
|
#include <chrono>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
ctbLoop::ctbLoop(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||||
|
|
||||||
TGHorizontalFrame *hframe=this;
|
TGHorizontalFrame *hframe=this;
|
||||||
|
|
||||||
@ -116,47 +117,27 @@ ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ctbLoop::setNLoops() {
|
void ctbLoop::setNLoops() {
|
||||||
|
try{
|
||||||
int start, stop, n;
|
myDet->setPatternLoops(id, -1, -1, eLoopNumber->GetNumber());
|
||||||
|
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
|
||||||
|
|
||||||
start=-1;
|
|
||||||
stop=-1;
|
|
||||||
n=eLoopNumber->GetNumber();
|
|
||||||
try{
|
|
||||||
myDet->setPatternLoops(id,start, stop,n);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbLoop::update() {
|
void ctbLoop::update() {
|
||||||
|
try{
|
||||||
|
|
||||||
int start, stop, n;
|
auto loop = myDet->getPatternLoops(id).tsquash("Different values");
|
||||||
|
|
||||||
std::array<int, 3> loop;
|
|
||||||
|
|
||||||
try {
|
|
||||||
loop=myDet->getPatternLoops(id);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
eLoopStartAddr->SetHexNumber(loop[0]);
|
eLoopStartAddr->SetHexNumber(loop[0]);
|
||||||
eLoopStopAddr->SetHexNumber(loop[1]);
|
eLoopStopAddr->SetHexNumber(loop[1]);
|
||||||
eLoopNumber->SetNumber(loop[2]);
|
eLoopNumber->SetNumber(loop[2]);
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
ctbWait::ctbWait(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||||
|
|
||||||
char tit[100];
|
char tit[100];
|
||||||
TGHorizontalFrame *hframe=this;
|
TGHorizontalFrame *hframe=this;
|
||||||
@ -211,41 +192,25 @@ ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
|||||||
|
|
||||||
|
|
||||||
void ctbWait::setWaitTime() {
|
void ctbWait::setWaitTime() {
|
||||||
|
|
||||||
|
|
||||||
Long64_t t=eWaitTime->GetNumber();
|
|
||||||
try{
|
try{
|
||||||
t=myDet->setPatternWaitTime(id,t);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
myDet->setPatternWaitTime(id, eWaitTime->GetNumber());
|
||||||
}
|
|
||||||
|
} CATCH_DISPLAY ("Could not set pattern wait time for level " + to_string(id) + ".", "ctbWait::setWaitTime")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbWait::update() {
|
void ctbWait::update() {
|
||||||
|
|
||||||
int start, stop, n, addr;
|
|
||||||
|
|
||||||
Long64_t t=-1;
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
t=myDet->setPatternWaitTime(id,t);
|
auto time = myDet->getPatternWaitTime(id).tsquash("Different values");
|
||||||
} catch (...) {
|
auto addr = myDet->getPatternWaitAddr(id).tsquash("Different values");
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
addr=myDet->setPatternWaitAddr(id,-1);
|
|
||||||
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
eWaitAddr->SetHexNumber(addr);
|
eWaitAddr->SetHexNumber(addr);
|
||||||
eWaitTime->SetNumber(t);
|
eWaitTime->SetNumber(time);
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbWait::update")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -256,7 +221,7 @@ void ctbWait::update() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
|
||||||
: TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
|
: TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
|
||||||
|
|
||||||
|
|
||||||
@ -809,134 +774,64 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::update() {
|
void ctbPattern::update() {
|
||||||
|
try{
|
||||||
|
auto retval = myDet->getRUNClock().tsquash("Different values");
|
||||||
|
eRunClkFreq->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get run clock.", "ctbPattern::update")
|
||||||
|
|
||||||
int start, stop, n, addr;
|
try{
|
||||||
|
auto retval = myDet->getADCClock().tsquash("Different values");
|
||||||
|
eAdcClkFreq->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get adc clock.", "ctbPattern::update")
|
||||||
|
|
||||||
Long_t t;
|
try{
|
||||||
|
auto retval = myDet->getADCPhase().tsquash("Different values");
|
||||||
|
eAdcClkPhase->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get adc phase shift.", "ctbPattern::update")
|
||||||
|
|
||||||
|
try{
|
||||||
|
auto retval = myDet->getADCPipeline().tsquash("Different values");
|
||||||
|
eAdcPipeline->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get adc pipeline.", "ctbPattern::update")
|
||||||
|
|
||||||
try {
|
try{
|
||||||
n=myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,-1,0);
|
auto retval = myDet->getDBITClock().tsquash("Different values");
|
||||||
} catch (...) {
|
eDBitClkFreq->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get dbit clock.", "ctbPattern::update")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
try{
|
||||||
}
|
auto retval = myDet->getDBITPhase().tsquash("Different values");
|
||||||
|
eDBitClkPhase->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||||
|
|
||||||
eRunClkFreq->SetNumber(n);
|
try{
|
||||||
|
auto retval = myDet->getDBITPipeline().tsquash("Different values");
|
||||||
|
eDBitPipeline->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get dbit pipeline.", "ctbPattern::update")
|
||||||
|
|
||||||
try {
|
try{
|
||||||
n=myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,-1,0);
|
auto retval = myDet->getNumberOfFrames().tsquash("Different values");
|
||||||
} catch (...) {
|
eFrames->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get number of frames.", "ctbPattern::update")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
try{
|
||||||
}
|
auto timeNs = myDet->getPeriod().tsquash("Different values");
|
||||||
|
ePeriod->SetNumber(ctbDefs::ConvertChronoNStoDoubleS(timeNs));
|
||||||
|
} CATCH_DISPLAY ("Could not get period.", "ctbPattern::update")
|
||||||
|
|
||||||
eAdcClkFreq->SetNumber(n);
|
try{
|
||||||
|
auto retval = myDet->getNumberOfTriggers().tsquash("Different values");
|
||||||
|
eCycles->SetNumber(retval);
|
||||||
|
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||||
|
|
||||||
try {
|
try{
|
||||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PHASE,-1,0);
|
auto retval = myDet->getPatternLoops(-1).tsquash("Different values");
|
||||||
} catch (...) {
|
eStartAddr->SetHexNumber(retval[0]);
|
||||||
|
eStopAddr->SetHexNumber(retval[1]);
|
||||||
cout << "Do nothing for this error" << endl;
|
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||||
}
|
|
||||||
|
|
||||||
eAdcClkPhase->SetNumber(n);
|
|
||||||
|
|
||||||
try {
|
|
||||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,-1,0);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
eAdcPipeline->SetNumber(n);
|
|
||||||
|
|
||||||
try {
|
|
||||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,-1,0);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
eDBitClkFreq->SetNumber(n);
|
|
||||||
|
|
||||||
try {
|
|
||||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,-1,0);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
eDBitClkPhase->SetNumber(n);
|
|
||||||
try {
|
|
||||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,-1,0);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
eDBitPipeline->SetNumber(n);
|
|
||||||
|
|
||||||
try {
|
|
||||||
n=myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
eFrames->SetNumber(n);
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
n=myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ePeriod->SetNumber(((Double_t)n)*1E-9);
|
|
||||||
|
|
||||||
try {
|
|
||||||
n=myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
eCycles->SetNumber(n);
|
|
||||||
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1);
|
|
||||||
// } catch (...) {
|
|
||||||
|
|
||||||
// cout << "Do nothing for this error" << endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// eMeasurements->SetNumber(n);
|
|
||||||
|
|
||||||
start=-1;
|
|
||||||
stop=-1;
|
|
||||||
n=-1;
|
|
||||||
std::array<int, 3> loop;
|
|
||||||
|
|
||||||
try {
|
|
||||||
loop=myDet->getPatternLoops(-1);
|
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
eStartAddr->SetHexNumber(loop[0]);
|
|
||||||
eStopAddr->SetHexNumber(loop[1]);
|
|
||||||
|
|
||||||
for (int iloop=0; iloop<NLOOPS; iloop++) {
|
for (int iloop=0; iloop<NLOOPS; iloop++) {
|
||||||
eLoop[iloop]->update();
|
eLoop[iloop]->update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int iwait=0; iwait<NWAITS; iwait++) {
|
for (int iwait=0; iwait<NWAITS; iwait++) {
|
||||||
@ -946,8 +841,9 @@ try {
|
|||||||
getAnalogSamples();
|
getAnalogSamples();
|
||||||
getDigitalSamples();
|
getDigitalSamples();
|
||||||
getReadoutMode();
|
getReadoutMode();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::setFile() {
|
void ctbPattern::setFile() {
|
||||||
patternFileChanged(patternFile->GetText());
|
patternFileChanged(patternFile->GetText());
|
||||||
|
|
||||||
@ -984,7 +880,8 @@ void ctbPattern::setPatternAlias(string line){
|
|||||||
|
|
||||||
string ctbPattern::getPatternAlias() {
|
string ctbPattern::getPatternAlias() {
|
||||||
char line[100000];
|
char line[100000];
|
||||||
sprintf("PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
|
sprintf(line, "PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
|
||||||
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1032,154 +929,103 @@ string ctbPattern::getPatternFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setFrames() {
|
void ctbPattern::setFrames() {
|
||||||
try {
|
try{
|
||||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,eFrames->GetNumber());
|
myDet->setNumberOfFrames(eFrames->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setCycles() {
|
void ctbPattern::setCycles() {
|
||||||
try {
|
try{
|
||||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,eFrames->GetNumber());
|
myDet->setNumberOfTriggers(eCycles->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setCycles")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void ctbPattern::setMeasurements() {
|
|
||||||
// try {
|
|
||||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eFrames->GetNumber());
|
|
||||||
// } catch (...) {
|
|
||||||
|
|
||||||
// cout << "Do nothing for this error" << endl;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::setPeriod() {
|
void ctbPattern::setPeriod() {
|
||||||
try {
|
using std::chrono::duration;
|
||||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,ePeriod->GetNumber()*1E9);
|
using std::chrono::duration_cast;
|
||||||
} catch (...) {
|
using std::chrono::nanoseconds;
|
||||||
|
try{
|
||||||
cout << "Do nothing for this error" << endl;
|
auto timeNs = ctbDefs::ConvertDoubleStoChronoNS(ePeriod->GetNumber());
|
||||||
}
|
myDet->setPeriod(timeNs);
|
||||||
|
} CATCH_DISPLAY ("Could not set period", "ctbPattern::setPeriod")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::setAdcFreq() {
|
void ctbPattern::setAdcFreq() {
|
||||||
try {
|
try{
|
||||||
myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,eAdcClkFreq->GetNumber(),0);
|
myDet->setADCClock(eAdcClkFreq->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set adc clock", "ctbPattern::setAdcFreq")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setRunFreq() {
|
void ctbPattern::setRunFreq() {
|
||||||
try{
|
try{
|
||||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,eRunClkFreq->GetNumber(),0);
|
myDet->setRUNClock(eRunClkFreq->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set run clock", "ctbPattern::setRunFreq")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setDBitFreq() {
|
void ctbPattern::setDBitFreq() {
|
||||||
// cout <<"Not setting dbit frequency to " << eDBitClkFreq->GetNumber()<< endl;
|
try{
|
||||||
try {
|
myDet->setDBITClock(eDBitClkFreq->GetNumber());
|
||||||
myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,eDBitClkFreq->GetNumber(),0);
|
} CATCH_DISPLAY ("Could not set dbit clock", "ctbPattern::setDBitFreq")
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setAdcPhase() {
|
void ctbPattern::setAdcPhase() {
|
||||||
try {
|
try{
|
||||||
myDet->setSpeed(slsDetectorDefs::ADC_PHASE,eAdcClkPhase->GetNumber(),0);
|
myDet->setADCPhase(eAdcClkPhase->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set adc phase shift", "ctbPattern::setAdcPhase")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setDBitPhase() {
|
void ctbPattern::setDBitPhase() {
|
||||||
// cout <<"Not setting dbit phase to " << eDBitClkPhase->GetNumber()<< endl;
|
try{
|
||||||
try {
|
myDet->setDBITPhase(eDBitClkPhase->GetNumber());
|
||||||
myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,eDBitClkPhase->GetNumber(),0);
|
} CATCH_DISPLAY ("Could not set dbit phase shift", "ctbPattern::setDBitPhase")
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::setAdcPipeline() {
|
void ctbPattern::setAdcPipeline() {
|
||||||
try {
|
try{
|
||||||
myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,eAdcPipeline->GetNumber(),0);
|
myDet->setADCPipeline(eAdcPipeline->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set adc pipeline", "ctbPattern::setAdcPipeline")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::setDBitPipeline() {
|
void ctbPattern::setDBitPipeline() {
|
||||||
// cout <<"Not setting dbit pipeline to " << eDBitPipeline->GetNumber() << endl;
|
try{
|
||||||
try {
|
myDet->setDBITPipeline(eDBitPipeline->GetNumber());
|
||||||
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,eDBitPipeline->GetNumber(),0);
|
} CATCH_DISPLAY ("Could not set dbit pipeline", "ctbPattern::setDBitPipeline")
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::setAnalogSamples() {
|
void ctbPattern::setAnalogSamples() {
|
||||||
try {
|
try{
|
||||||
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,eAnalogSamples->GetNumber());
|
myDet->setNumberOfAnalogSamples(eAnalogSamples->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set number of analog sampels", "ctbPattern::setAnalogSamples")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
analogSamplesChanged(eAnalogSamples->GetNumber());
|
analogSamplesChanged(eAnalogSamples->GetNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setDigitalSamples() {
|
void ctbPattern::setDigitalSamples() {
|
||||||
try {
|
try{
|
||||||
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,eDigitalSamples->GetNumber());
|
myDet->setNumberOfDigitalSamples(eDigitalSamples->GetNumber());
|
||||||
} catch (...) {
|
} CATCH_DISPLAY ("Could not set number of digital samples", "ctbPattern::setDigitalSamples")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
digitalSamplesChanged(eDigitalSamples->GetNumber());
|
digitalSamplesChanged(eDigitalSamples->GetNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::setReadoutMode(Bool_t) {
|
void ctbPattern::setReadoutMode(Bool_t) {
|
||||||
// cout << "Set readout mode to be implemented" << endl;
|
|
||||||
slsDetectorDefs::readOutFlags flags;
|
|
||||||
if (cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::ANALOG_AND_DIGITAL;
|
|
||||||
else if (~cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::DIGITAL_ONLY;
|
|
||||||
else if (cbAnalog->IsOn() && ~cbDigital->IsOn()) flags=slsDetectorDefs::NORMAL_READOUT;
|
|
||||||
else flags=slsDetectorDefs::GET_READOUT_FLAGS;
|
|
||||||
try {
|
try {
|
||||||
myDet->setReadOutFlags(flags);
|
int flags = 0;
|
||||||
} catch (...) {
|
if (cbAnalog->IsOn() && cbDigital->IsOn())
|
||||||
|
flags=2;
|
||||||
|
else if (~cbAnalog->IsOn() && cbDigital->IsOn())
|
||||||
|
flags=1;
|
||||||
|
else if (cbAnalog->IsOn() && ~cbDigital->IsOn())
|
||||||
|
flags=0;
|
||||||
|
else {
|
||||||
|
throw runtime_error("unkown readout flag");
|
||||||
|
}
|
||||||
|
myDet->setReadoutMode(flags);
|
||||||
|
cout << "Set readout flags: " << flags << endl;
|
||||||
|
} CATCH_DISPLAY ("Could not set readout flags", "ctbPattern::setReadoutMode")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
cout << "Set readout flags " << hex << flags << dec << endl;
|
|
||||||
getReadoutMode();
|
getReadoutMode();
|
||||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
|
||||||
//samplesChanged(eSamples->GetNumber());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbPattern::readoutModeChanged(int flags) {
|
void ctbPattern::readoutModeChanged(int flags) {
|
||||||
@ -1188,72 +1034,57 @@ void ctbPattern::readoutModeChanged(int flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ctbPattern::getReadoutMode() {
|
int ctbPattern::getReadoutMode() {
|
||||||
// cout << "Get readout mode to be implemented" << endl;
|
try{
|
||||||
slsDetectorDefs::readOutFlags flags;
|
auto retval = myDet->getReadoutMode().tsquash("Different values");
|
||||||
try {
|
switch(retval) {
|
||||||
flags=(slsDetectorDefs::readOutFlags) myDet->setReadOutFlags();
|
case 2:
|
||||||
} catch (...) {
|
cout << "analog and digital" << endl;
|
||||||
|
cbAnalog->SetOn(kTRUE);
|
||||||
|
cbDigital->SetOn(kTRUE);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
cout << "digital only" << endl;
|
||||||
|
cbAnalog->SetOn(kFALSE);
|
||||||
|
cbDigital->SetOn(kTRUE);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
cout << "analog only" << endl;
|
||||||
|
cbAnalog->SetOn(kTRUE);
|
||||||
|
cbDigital->SetOn(kFALSE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw("unknown readout flag");
|
||||||
|
}
|
||||||
|
Emit("readoutModeChanged(int)",retval);
|
||||||
|
return retval;
|
||||||
|
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
cout << "++++++++++++++++++++"<< hex << flags << dec << endl;
|
|
||||||
if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
|
||||||
cout << "analog and digital" << hex << slsDetectorDefs::ANALOG_AND_DIGITAL << dec<< endl;
|
|
||||||
cbAnalog->SetOn(kTRUE);
|
|
||||||
cbDigital->SetOn(kTRUE);
|
|
||||||
} else if (flags&slsDetectorDefs::DIGITAL_ONLY) {
|
|
||||||
cout << "digital only" << hex << slsDetectorDefs::DIGITAL_ONLY << dec << endl;
|
|
||||||
cbAnalog->SetOn(kFALSE);
|
|
||||||
cbDigital->SetOn(kTRUE);
|
|
||||||
}// else if (flags==slsDetectorDefs::NORMAL_READOUT) {
|
|
||||||
// cbAnalog->SetOn(kTRUE);
|
|
||||||
// cbDigital->SetOn(kFALSE);
|
|
||||||
// }
|
|
||||||
else {
|
|
||||||
cout << "analog only" << endl;
|
|
||||||
flags=slsDetectorDefs::NORMAL_READOUT;
|
|
||||||
cbAnalog->SetOn(kTRUE);
|
|
||||||
cbDigital->SetOn(kFALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Emit("readoutModeChanged(int)",(int)flags);
|
|
||||||
return (int)flags;
|
|
||||||
|
|
||||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
|
||||||
//samplesChanged(eSamples->GetNumber());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ctbPattern::getAnalogSamples() {
|
int ctbPattern::getAnalogSamples() {
|
||||||
int n;
|
try{
|
||||||
try {
|
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||||
n=(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
eAnalogSamples->SetNumber((Double_t)retval);
|
||||||
} catch (...) {
|
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
|
||||||
|
return eAnalogSamples->GetNumber();
|
||||||
|
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
return -1;
|
||||||
}
|
|
||||||
eAnalogSamples->SetNumber((Double_t)n);
|
|
||||||
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
|
|
||||||
return eAnalogSamples->GetNumber();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ctbPattern::getDigitalSamples() {
|
int ctbPattern::getDigitalSamples() {
|
||||||
int n;
|
try{
|
||||||
try {
|
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||||
|
eDigitalSamples->SetNumber((Double_t)retval);
|
||||||
|
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||||
|
return eDigitalSamples->GetNumber();
|
||||||
|
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||||
|
|
||||||
n=(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
return -1;
|
||||||
} catch (...) {
|
|
||||||
|
|
||||||
cout << "Do nothing for this error" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
eDigitalSamples->SetNumber(((Double_t)n));
|
|
||||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
|
||||||
return eDigitalSamples->GetNumber();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbPattern::analogSamplesChanged(const int t){
|
void ctbPattern::analogSamplesChanged(const int t){
|
||||||
Emit("analogSamplesChanged(const int)", t);
|
Emit("analogSamplesChanged(const int)", t);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,10 @@ class energyCalibration;
|
|||||||
class TGTextButton;
|
class TGTextButton;
|
||||||
class TGTab;
|
class TGTab;
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -46,10 +49,10 @@ class ctbLoop : public TGHorizontalFrame {
|
|||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbLoop(TGGroupFrame *page, int i,multiSlsDetector *det);
|
ctbLoop(TGGroupFrame *page, int i,sls::Detector *det);
|
||||||
|
|
||||||
void setNLoops();
|
void setNLoops();
|
||||||
void update();
|
void update();
|
||||||
@ -67,10 +70,10 @@ class ctbWait : public TGHorizontalFrame {
|
|||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbWait(TGGroupFrame *page, int i,multiSlsDetector *det);
|
ctbWait(TGGroupFrame *page, int i,sls::Detector *det);
|
||||||
|
|
||||||
void setWaitTime();
|
void setWaitTime();
|
||||||
void update();
|
void update();
|
||||||
@ -122,11 +125,11 @@ private:
|
|||||||
|
|
||||||
char pat[PATLEN*8];
|
char pat[PATLEN*8];
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ctbPattern(TGVerticalFrame *page, multiSlsDetector *det);
|
ctbPattern(TGVerticalFrame *page, sls::Detector *det);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void setAdcFreq();
|
void setAdcFreq();
|
||||||
|
@ -10,61 +10,48 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "ctbDefs.h"
|
||||||
#include "ctbDacs.h"
|
#include "ctbDacs.h"
|
||||||
#include "ctbPowers.h"
|
#include "ctbPowers.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "Detector.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbPower::ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d)
|
ctbPower::ctbPower(TGGroupFrame* f, int i, sls::Detector* d)
|
||||||
: ctbDac(f, i, d)
|
: ctbDac(f, i, d)
|
||||||
{
|
{
|
||||||
cout << "****************************************************************power " << i << endl;
|
cout << "****************************************************************power " << i << endl;
|
||||||
dacsUnit->SetOn(kTRUE);
|
dacsUnit->SetOn(kTRUE);
|
||||||
dacsUnit->SetEnabled(kFALSE);
|
dacsUnit->SetEnabled(kFALSE);
|
||||||
int ii=0;
|
|
||||||
|
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case slsDetectorDefs::V_POWER_IO:
|
case slsDetectorDefs::V_POWER_IO:
|
||||||
dacsLabel->SetText("VIO");
|
dacsLabel->SetText("VIO");
|
||||||
ii=slsDetectorDefs::I_POWER_IO;
|
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::V_POWER_A:
|
case slsDetectorDefs::V_POWER_A:
|
||||||
dacsLabel->SetText("VA");
|
dacsLabel->SetText("VA");
|
||||||
ii=slsDetectorDefs::I_POWER_A;
|
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::V_POWER_B:
|
case slsDetectorDefs::V_POWER_B:
|
||||||
dacsLabel->SetText("VB");
|
dacsLabel->SetText("VB");
|
||||||
ii=slsDetectorDefs::I_POWER_B;
|
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::V_POWER_C:
|
case slsDetectorDefs::V_POWER_C:
|
||||||
dacsLabel->SetText("VC");
|
dacsLabel->SetText("VC");
|
||||||
ii=slsDetectorDefs::I_POWER_C;
|
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::V_POWER_D:
|
case slsDetectorDefs::V_POWER_D:
|
||||||
dacsLabel->SetText("VD");
|
dacsLabel->SetText("VD");
|
||||||
ii=slsDetectorDefs::I_POWER_D;
|
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::V_POWER_CHIP:
|
case slsDetectorDefs::V_POWER_CHIP:
|
||||||
dacsLabel->SetText("VCHIP");
|
dacsLabel->SetText("VCHIP");
|
||||||
dacsLabel->SetEnabled(kFALSE);
|
dacsLabel->SetEnabled(kFALSE);
|
||||||
ii=-1;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dacsLabel->SetText("Bad index");
|
dacsLabel->SetText("Bad index");
|
||||||
ii=-1;
|
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ctbSlowAdc *vm=new ctbSlowAdc(f,i,d);
|
|
||||||
// vm->setLabel("V: ");
|
|
||||||
// if (ii>=0) {
|
|
||||||
// ctbSlowAdc *im=new ctbSlowAdc(f,ii,d);
|
|
||||||
// im->setLabel("I: ");
|
|
||||||
// }
|
|
||||||
|
|
||||||
TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
|
TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
|
||||||
e->Disconnect ("ReturnPressed()");
|
e->Disconnect ("ReturnPressed()");
|
||||||
@ -104,44 +91,45 @@ string ctbPower::getLabel() {
|
|||||||
}
|
}
|
||||||
line << " " << dacsLabel->GetText() << endl;
|
line << " " << dacsLabel->GetText() << endl;
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ctbPower::setValue(Long_t a) {ctbPower::setValue();}
|
||||||
|
|
||||||
void ctbPower::setValue(Long_t a) {cout << "ssssssssss" << endl; ctbPower::setValue();}
|
|
||||||
void ctbPower::setValue() {
|
void ctbPower::setValue() {
|
||||||
|
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
|
||||||
|
|
||||||
|
try {
|
||||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
myDet->setVoltage(dacsEntry->GetIntNumber(), static_cast<slsDetectorDefs::dacIndex>(id));
|
||||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, 1);
|
} CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
|
||||||
|
|
||||||
getValue();
|
getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ctbPower::getValue() {
|
int ctbPower::getValue() {
|
||||||
|
try {
|
||||||
|
|
||||||
int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, 1);
|
int val = myDet->getVoltage(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||||
char s[100];
|
cout << "****************************Getting power " << val << " " << id << " " << 1 << endl;
|
||||||
cout << "****************************Getting power " << val << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
|
||||||
sprintf(s,"%d",val);
|
dacsValue->SetText(to_string(val).c_str());
|
||||||
dacsValue->SetText(s);
|
if (val > 0) {
|
||||||
if (val>0) {
|
if (id != static_cast<int>(slsDetectorDefs::V_POWER_CHIP))
|
||||||
if (id!=slsDetectorDefs::V_POWER_CHIP)
|
|
||||||
dacsLabel->SetOn(kTRUE);
|
dacsLabel->SetOn(kTRUE);
|
||||||
} else {
|
} else {
|
||||||
dacsLabel->SetOn(kFALSE);
|
dacsLabel->SetOn(kFALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get power " + to_string(id) + ".", "ctbPower::getValue")
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
|
ctbPowers::ctbPowers(TGVerticalFrame* page, sls::Detector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
|
||||||
|
|
||||||
|
|
||||||
SetTitlePos(TGGroupFrame::kLeft);
|
SetTitlePos(TGGroupFrame::kLeft);
|
||||||
@ -159,9 +147,8 @@ ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFr
|
|||||||
|
|
||||||
int ctbPowers::setPwrAlias(string line) {
|
int ctbPowers::setPwrAlias(string line) {
|
||||||
|
|
||||||
int is=-1, mv=0;
|
int is=-1;
|
||||||
char tit[100];
|
char tit[100];
|
||||||
int narg;
|
|
||||||
|
|
||||||
if (sscanf(line.c_str(),"VA %s",tit)) {
|
if (sscanf(line.c_str(),"VA %s",tit)) {
|
||||||
dacs[0]->setLabel(tit,1);
|
dacs[0]->setLabel(tit,1);
|
||||||
@ -212,7 +199,6 @@ string ctbPowers::getPwrAlias() {
|
|||||||
|
|
||||||
string ctbPowers::getPwrParameters() {
|
string ctbPowers::getPwrParameters() {
|
||||||
|
|
||||||
|
|
||||||
ostringstream line;
|
ostringstream line;
|
||||||
line << "v_a" << " " << dacs[0]->getValue() << " mv" << endl;
|
line << "v_a" << " " << dacs[0]->getValue() << " mv" << endl;
|
||||||
line << "v_b" << " " << dacs[1]->getValue() << " mv" << endl;
|
line << "v_b" << " " << dacs[1]->getValue() << " mv" << endl;
|
||||||
@ -225,19 +211,13 @@ string ctbPowers::getPwrParameters() {
|
|||||||
// line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
// line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||||
// }
|
// }
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbPowers::update() {
|
void ctbPowers::update() {
|
||||||
|
|
||||||
for (int idac=0; idac<NPOWERS; idac++) {
|
for (int idac=0; idac<NPOWERS; idac++) {
|
||||||
|
|
||||||
dacs[idac]->getValue();
|
dacs[idac]->getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,7 @@
|
|||||||
|
|
||||||
#include <TGFrame.h>
|
#include <TGFrame.h>
|
||||||
|
|
||||||
#ifndef CTB
|
|
||||||
#define NPOWERS 0
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define NPOWERS 6
|
#define NPOWERS 6
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -22,8 +15,10 @@ class TGCheckButton;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -36,7 +31,7 @@ class ctbPower : public ctbDac {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d);
|
ctbPower(TGGroupFrame* f, int i, sls::Detector* d);
|
||||||
|
|
||||||
string getLabel();
|
string getLabel();
|
||||||
|
|
||||||
@ -54,11 +49,11 @@ class ctbPowers : public TGGroupFrame
|
|||||||
|
|
||||||
ctbPower *dacs[NPOWERS];
|
ctbPower *dacs[NPOWERS];
|
||||||
|
|
||||||
multiSlsDetector* myDet;
|
sls::Detector* myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//ctbPowers();
|
//ctbPowers();
|
||||||
ctbPowers(TGVerticalFrame*, multiSlsDetector*);
|
ctbPowers(TGVerticalFrame*, sls::Detector*);
|
||||||
|
|
||||||
int setPwrAlias(string);
|
int setPwrAlias(string);
|
||||||
string getPwrAlias();
|
string getPwrAlias();
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "ctbSignals.h"
|
#include "ctbSignals.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "ctbDefs.h"
|
||||||
|
#include "Detector.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ using namespace std;
|
|||||||
//#define DEFAULTFN "run_0.encal"
|
//#define DEFAULTFN "run_0.encal"
|
||||||
|
|
||||||
|
|
||||||
ctbSignal::ctbSignal(TGFrame *page, int i, multiSlsDetector *det)
|
ctbSignal::ctbSignal(TGFrame *page, int i, sls::Detector *det)
|
||||||
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
|
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
|
||||||
|
|
||||||
|
|
||||||
@ -178,10 +179,6 @@ int ctbSignal::fixOutput(int i) {
|
|||||||
|
|
||||||
int ctbSignal::setDbitList(Long64_t r) {
|
int ctbSignal::setDbitList(Long64_t r) {
|
||||||
|
|
||||||
Long64_t mask=((Long64_t)1<<id);
|
|
||||||
|
|
||||||
// cout << hex << r << dec <<endl;
|
|
||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
sDbitList->SetOn(kTRUE,kFALSE);
|
sDbitList->SetOn(kTRUE,kFALSE);
|
||||||
else
|
else
|
||||||
@ -197,7 +194,6 @@ int ctbSignal::isPlot() { return sPlot->IsOn();}
|
|||||||
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
|
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
|
||||||
|
|
||||||
void ctbSignal::ToggledOutput(Bool_t b) {
|
void ctbSignal::ToggledOutput(Bool_t b) {
|
||||||
Long_t mask=b<<id;
|
|
||||||
ToggledSignalOutput(id);
|
ToggledSignalOutput(id);
|
||||||
if (b) {
|
if (b) {
|
||||||
// sClock->SetEnabled(kTRUE);
|
// sClock->SetEnabled(kTRUE);
|
||||||
@ -249,7 +245,7 @@ void ctbSignal::ToggledSignalPlot(Int_t b){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
ctbSignals::ctbSignals(TGVerticalFrame *page, sls::Detector *det)
|
||||||
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
|
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
|
||||||
|
|
||||||
|
|
||||||
@ -259,7 +255,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
|||||||
|
|
||||||
|
|
||||||
TGHorizontalFrame *hframe;
|
TGHorizontalFrame *hframe;
|
||||||
char tit[100];
|
|
||||||
|
|
||||||
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
|
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
|
||||||
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||||
@ -290,36 +285,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #ifdef CTB
|
|
||||||
// idac=62;
|
|
||||||
// signals[idac]=new ctbSignal(vframe,idac,myDet);
|
|
||||||
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
|
||||||
// signals[idac]->MapWindow();
|
|
||||||
// sprintf(tit,"DBIT Latch");
|
|
||||||
|
|
||||||
// signals[idac]->setSignalAlias(tit,-1,-1);
|
|
||||||
|
|
||||||
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
|
|
||||||
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
|
|
||||||
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
|
|
||||||
|
|
||||||
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
|
|
||||||
// idac=63;
|
|
||||||
// signals[idac]=new ctbSignal(vframe,idac,myDet);
|
|
||||||
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
|
||||||
// signals[idac]->MapWindow();
|
|
||||||
// sprintf(tit,"ADC Latch");
|
|
||||||
|
|
||||||
// signals[idac]->setSignalAlias(tit,-1,-1);
|
|
||||||
|
|
||||||
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
|
|
||||||
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
|
|
||||||
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
|
|
||||||
|
|
||||||
|
|
||||||
hframe=new TGHorizontalFrame(vframe, 800,50);
|
hframe=new TGHorizontalFrame(vframe, 800,50);
|
||||||
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||||
hframe->MapWindow();
|
hframe->MapWindow();
|
||||||
@ -398,121 +363,132 @@ string ctbSignals::getSignalAlias() {
|
|||||||
|
|
||||||
|
|
||||||
void ctbSignals::update() {
|
void ctbSignals::update() {
|
||||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
try {
|
||||||
// Long64_t creg=myDet->setPatternClockControl();//setCTBWord(-2,-1);
|
|
||||||
|
|
||||||
|
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||||
|
cout << hex << oreg << dec << endl;
|
||||||
|
|
||||||
char val[1000];
|
for (int idac=0; idac<NIOSIGNALS; idac++) {
|
||||||
cout << hex << oreg << dec << endl;
|
signals[idac]->setOutput(oreg);
|
||||||
// cout << hex << creg << dec << endl;
|
|
||||||
|
|
||||||
sprintf(val,"%llX",oreg);
|
|
||||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
|
||||||
|
|
||||||
|
|
||||||
for (int idac=0; idac<NIOSIGNALS; idac++) {
|
|
||||||
signals[idac]->setOutput(oreg);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Long64_t mask;
|
|
||||||
std::vector <int> dbitlist=myDet->getReceiverDbitList();
|
|
||||||
if (dbitlist.empty())
|
|
||||||
for (int is=0; is<64; is++) {
|
|
||||||
signals[is]->setDbitList(1);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
|
||||||
for (const auto &value : dbitlist) {
|
|
||||||
signals[value]->setDbitList(1);
|
try {
|
||||||
|
|
||||||
|
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||||
|
// enable all
|
||||||
|
if (dbitlist.empty()) {
|
||||||
|
for (int is=0; is<64; is++) {
|
||||||
|
signals[is]->setDbitList(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// disable all
|
||||||
|
for (int is=0; is<64; is++) {
|
||||||
|
signals[is]->setDbitList(0);
|
||||||
|
}
|
||||||
|
// enable selected
|
||||||
|
for (const auto &value : dbitlist) {
|
||||||
|
signals[value]->setDbitList(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update")
|
||||||
|
|
||||||
eDbitOffset->SetNumber(myDet->getReceiverDbitOffset());
|
try {
|
||||||
|
auto val = myDet->getRxDbitOffset().tsquash("Different values");
|
||||||
|
eDbitOffset->SetNumber(val);
|
||||||
|
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ctbSignals::getSignalParameters() {
|
string ctbSignals::getSignalParameters() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
ostringstream line;
|
auto val = myDet->getPatternIOControl().tsquash("Different values");
|
||||||
line << "patioctrl " << hex << myDet->setPatternIOControl() << dec << endl;//setCTBWord(-1,-1)
|
ostringstream line;
|
||||||
return line.str();
|
line << "patioctrl " << hex << val << dec << endl;
|
||||||
|
return line.str();
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::getSignalParameters")
|
||||||
|
|
||||||
|
return ("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbSignals::ToggledOutReg(Int_t mask) {
|
void ctbSignals::ToggledOutReg(Int_t mask) {
|
||||||
|
try {
|
||||||
|
|
||||||
char val[1000];
|
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
Long64_t m=((Long64_t)1)<<mask;
|
||||||
Long64_t m=((Long64_t)1)<<mask;
|
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
|
||||||
|
|
||||||
|
if (signals[mask]->isOutput()) {
|
||||||
|
cout << " or " << m ;
|
||||||
|
oreg|=m;
|
||||||
|
} else {
|
||||||
|
cout << " not " << ~m ;
|
||||||
|
oreg&=~m;
|
||||||
|
}
|
||||||
|
cout << " after " << oreg << endl;
|
||||||
|
|
||||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
|
myDet->setPatternIOControl(static_cast<uint64_t>(oreg));
|
||||||
|
oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||||
|
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||||
|
|
||||||
|
eIOCntrlRegister->SetText(to_string(oreg).c_str());
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get/set patternIOcontrol.", "ctbSignals::ToggledOutReg")
|
||||||
if (signals[mask]->isOutput()) {
|
|
||||||
cout << " or " << m ;
|
|
||||||
oreg|=m;
|
|
||||||
} else {
|
|
||||||
cout << " not " << ~m ;
|
|
||||||
oreg&=~m;
|
|
||||||
}
|
|
||||||
cout << " after " << oreg << endl;
|
|
||||||
|
|
||||||
myDet->setPatternIOControl(oreg);//setCTBWord(-1,oreg);
|
|
||||||
oreg=myDet->setPatternIOControl();//myDet->setCTBWord(-1,-1);
|
|
||||||
|
|
||||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
|
||||||
|
|
||||||
sprintf(val,"%llX",oreg);
|
|
||||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
|
||||||
eIOCntrlRegister->SetText(val);
|
|
||||||
// eIOCntrlRegister->SetNumber(oreg);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbSignals::ToggledDbitList(Int_t mask){
|
void ctbSignals::ToggledDbitList(Int_t mask){
|
||||||
|
try {
|
||||||
|
|
||||||
|
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||||
|
|
||||||
|
// anyway all enabled
|
||||||
|
if ((dbitlist.empty()) && (signals[mask]->isDbitList())) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
// set the dbitlist
|
||||||
|
else {
|
||||||
|
std::vector <int> new_dbitlist;
|
||||||
|
for (int is=0; is<64; is++) {
|
||||||
|
if (signals[is]->isDbitList()){
|
||||||
|
new_dbitlist.push_back(is);
|
||||||
|
cout << is << " " << new_dbitlist.size() - 1 << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (new_dbitlist.size() > 64)
|
||||||
|
new_dbitlist.clear();
|
||||||
|
myDet->setRxDbitList(new_dbitlist);
|
||||||
|
// get list again
|
||||||
|
dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||||
|
}
|
||||||
|
|
||||||
cout << "************* Here" << endl;
|
// enable all
|
||||||
|
if (dbitlist.empty()) {
|
||||||
|
for (int is=0; is<64; is++) {
|
||||||
|
signals[is]->setDbitList(1);
|
||||||
std::vector <int> new_dbitlist;
|
}
|
||||||
std::vector <int> old_dbitlist=myDet->getReceiverDbitList();
|
}
|
||||||
|
else {
|
||||||
char val[1000];
|
// disable all
|
||||||
Long64_t m=((Long64_t)1)<<mask;
|
for (int is=0; is<64; is++) {
|
||||||
|
signals[is]->setDbitList(0);
|
||||||
if (old_dbitlist.empty() && signals[mask]->isDbitList())
|
}
|
||||||
;
|
// enable selected
|
||||||
else {
|
for (const auto &value : dbitlist) {
|
||||||
int ns=0;
|
signals[value]->setDbitList(1);
|
||||||
for (int is=0; is<64; is++) {
|
|
||||||
if (signals[is]->isDbitList()){
|
|
||||||
new_dbitlist.push_back(is);
|
|
||||||
ns++;
|
|
||||||
cout << is << " " << ns << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ns>63) new_dbitlist.clear();
|
|
||||||
myDet->setReceiverDbitList(new_dbitlist);
|
|
||||||
}
|
|
||||||
std::vector <int> dbitlist=myDet->getReceiverDbitList();
|
|
||||||
if (dbitlist.empty())
|
|
||||||
for (int is=0; is<64; is++) signals[is]->setDbitList(1);
|
|
||||||
else
|
|
||||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
|
||||||
for (const auto &value : dbitlist) signals[value]->setDbitList(1);
|
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get/set receiver dbit list.", "ctbSignals::ToggledDbitList")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -533,16 +509,23 @@ void ctbSignals::ToggledSignalPlot(Int_t b) {
|
|||||||
|
|
||||||
|
|
||||||
Pixel_t ctbSignals::getColor(int i){
|
Pixel_t ctbSignals::getColor(int i){
|
||||||
if (i>=0 && i<NSIGNALS) return signals[i]->getColor();
|
if (i>=0 && i<NSIGNALS)
|
||||||
|
return signals[i]->getColor();
|
||||||
|
return static_cast<Pixel_t>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ctbSignals::getPlot(int i){
|
int ctbSignals::getPlot(int i){
|
||||||
if (i>=0 && i<NSIGNALS) return signals[i]->isPlot();
|
if (i>=0 && i<NSIGNALS)
|
||||||
|
return signals[i]->isPlot();
|
||||||
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ctbSignals::setDbitOffset(Long_t) {
|
void ctbSignals::setDbitOffset(Long_t) {
|
||||||
setDbitOffset();
|
setDbitOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctbSignals::setDbitOffset(){
|
void ctbSignals::setDbitOffset(){
|
||||||
myDet->setReceiverDbitOffset(eDbitOffset->GetNumber());
|
try {
|
||||||
|
myDet->setRxDbitOffset(eDbitOffset->GetNumber());
|
||||||
|
} CATCH_DISPLAY ("Could not set receiver dbit offset.", "ctbSignals::setDbitOffset")
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,10 @@ class TGColorSelect;
|
|||||||
|
|
||||||
|
|
||||||
class TGNumberEntry;
|
class TGNumberEntry;
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
class ctbSignal;
|
class ctbSignal;
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -45,14 +48,14 @@ private:
|
|||||||
TGNumberEntry *sEntry;
|
TGNumberEntry *sEntry;
|
||||||
TGColorSelect *fColorSel;
|
TGColorSelect *fColorSel;
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
Int_t id;
|
Int_t id;
|
||||||
|
|
||||||
TH1I *hsig;
|
TH1I *hsig;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ctbSignal(TGFrame *page, int i, multiSlsDetector *det);
|
ctbSignal(TGFrame *page, int i, sls::Detector *det);
|
||||||
int setSignalAlias(char *tit, int plot, int col);
|
int setSignalAlias(char *tit, int plot, int col);
|
||||||
string getSignalAlias();
|
string getSignalAlias();
|
||||||
|
|
||||||
@ -89,10 +92,10 @@ private:
|
|||||||
TGNumberEntry *eIOCntrlRegister;
|
TGNumberEntry *eIOCntrlRegister;
|
||||||
TGNumberEntry *eDbitOffset;
|
TGNumberEntry *eDbitOffset;
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
sls::Detector *myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbSignals(TGVerticalFrame *page, multiSlsDetector *det);
|
ctbSignals(TGVerticalFrame *page, sls::Detector *det);
|
||||||
int setSignalAlias(string line);
|
int setSignalAlias(string line);
|
||||||
string getSignalAlias();
|
string getSignalAlias();
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
#include <TGButton.h>
|
#include <TGButton.h>
|
||||||
|
|
||||||
#include "ctbSlowAdcs.h"
|
#include "ctbSlowAdcs.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "ctbDefs.h"
|
||||||
|
#include "Detector.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -17,7 +18,7 @@ using namespace std;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||||
|
|
||||||
|
|
||||||
TGHorizontalFrame *hframe=this;
|
TGHorizontalFrame *hframe=this;
|
||||||
@ -55,9 +56,6 @@ ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TG
|
|||||||
b->SetTextJustify(kTextLeft);
|
b->SetTextJustify(kTextLeft);
|
||||||
|
|
||||||
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
|
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,38 +64,50 @@ int ctbSlowAdc::setLabel(char *tit) {
|
|||||||
if(tit)
|
if(tit)
|
||||||
dacsLabel->SetText(tit);
|
dacsLabel->SetText(tit);
|
||||||
|
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string ctbSlowAdc::getLabel() {
|
string ctbSlowAdc::getLabel() {
|
||||||
|
|
||||||
ostringstream line;
|
ostringstream line;
|
||||||
line << dacsLabel->GetText() << endl;
|
line << dacsLabel->GetText() << endl;
|
||||||
|
|
||||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||||
|
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ctbSlowAdc::getValue() {
|
int ctbSlowAdc::getValue() {
|
||||||
|
try {
|
||||||
|
std::string s;
|
||||||
|
|
||||||
int val=myDet->getADC((slsDetectorDefs::dacIndex)id);
|
// temp
|
||||||
char s[100];
|
if (id == static_cast<int>(slsDetectorDefs::SLOW_ADC_TEMP)) {
|
||||||
cout << "adc " << id << " " << val << endl;
|
|
||||||
sprintf(s,"%d mV",val);
|
|
||||||
if (id==999)
|
|
||||||
sprintf(s,"%d °C",val);
|
|
||||||
dacsValue->SetText(s);
|
|
||||||
|
|
||||||
|
int val = myDet->getTemperature(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||||
|
cout << "slow adc temp" << " " << val << endl;
|
||||||
|
|
||||||
|
s = to_string(val) + " " + to_string(0x00b0) + "C";//<2F>C
|
||||||
|
dacsValue->SetText(s.c_str());
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
// mv
|
||||||
|
else {
|
||||||
|
|
||||||
|
int val = myDet->getSlowADC(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||||
|
cout << "slow adc " << id << " " << val << endl;
|
||||||
|
|
||||||
|
s = to_string(val) + " mV";
|
||||||
|
dacsValue->SetText(s.c_str());
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
} CATCH_DISPLAY ("Could not get slow dac " + to_string(id) + ".", "ctbSlowAdc::getValue")
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -106,8 +116,7 @@ int ctbSlowAdc::getValue() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
|
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
|
||||||
|
|
||||||
|
|
||||||
SetTitlePos(TGGroupFrame::kLeft);
|
SetTitlePos(TGGroupFrame::kLeft);
|
||||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||||
@ -116,14 +125,12 @@ ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGro
|
|||||||
// cout << "window mapped " << endl;
|
// cout << "window mapped " << endl;
|
||||||
|
|
||||||
|
|
||||||
for (int idac=0; idac<NSLOWADCS; idac++) {
|
for (int idac=0; idac<NSLOWADCS + 1; idac++) {
|
||||||
|
|
||||||
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
|
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
|
||||||
|
|
||||||
}
|
}
|
||||||
adcs[NSLOWADCS]=new ctbSlowAdc(this, 999, myDet);
|
adcs[NSLOWADCS]->setLabel((char*)"Temperature");
|
||||||
adcs[NSLOWADCS]->setLabel("Temperature");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,7 +140,7 @@ int ctbSlowAdcs::setSlowAdcAlias(string line) {
|
|||||||
|
|
||||||
int is=-1, mv=0;
|
int is=-1, mv=0;
|
||||||
char tit[100];
|
char tit[100];
|
||||||
int narg=sscanf(line.c_str(),"SENSE%d %s",&is,tit,&mv);
|
int narg=sscanf(line.c_str(),"SENSE%d %s %d",&is,tit,&mv);
|
||||||
if (narg<2)
|
if (narg<2)
|
||||||
return -1;
|
return -1;
|
||||||
if (is>=0 && is<NSLOWADCS)
|
if (is>=0 && is<NSLOWADCS)
|
||||||
@ -149,7 +156,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
|||||||
for (int i=0; i<NSLOWADCS; i++)
|
for (int i=0; i<NSLOWADCS; i++)
|
||||||
line << adcs[i]->getLabel() << endl;
|
line << adcs[i]->getLabel() << endl;
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +163,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
|||||||
|
|
||||||
string ctbSlowAdcs::getAdcParameters() {
|
string ctbSlowAdcs::getAdcParameters() {
|
||||||
|
|
||||||
|
|
||||||
ostringstream line;
|
ostringstream line;
|
||||||
|
|
||||||
for (int i=0; i<NSLOWADCS; i++) {
|
for (int i=0; i<NSLOWADCS; i++) {
|
||||||
@ -166,20 +171,12 @@ string ctbSlowAdcs::getAdcParameters() {
|
|||||||
}
|
}
|
||||||
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
|
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
|
||||||
return line.str();
|
return line.str();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ctbSlowAdcs::update() {
|
void ctbSlowAdcs::update() {
|
||||||
|
|
||||||
|
|
||||||
for (int idac=0; idac<NSLOWADCS+1; idac++) {
|
for (int idac=0; idac<NSLOWADCS+1; idac++) {
|
||||||
|
|
||||||
adcs[idac]->getValue();
|
adcs[idac]->getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,10 @@ class TGTextButton;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class multiSlsDetector;
|
namespace sls
|
||||||
|
{
|
||||||
|
class Detector;
|
||||||
|
};
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -35,9 +38,9 @@ class ctbSlowAdc : public TGHorizontalFrame {
|
|||||||
TGLabel *dacsValue;
|
TGLabel *dacsValue;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
multiSlsDetector* myDet;
|
sls::Detector* myDet;
|
||||||
public:
|
public:
|
||||||
ctbSlowAdc(TGGroupFrame*, int , multiSlsDetector*);
|
ctbSlowAdc(TGGroupFrame*, int , sls::Detector*);
|
||||||
int getValue();
|
int getValue();
|
||||||
|
|
||||||
int setLabel(char *tit);
|
int setLabel(char *tit);
|
||||||
@ -56,10 +59,10 @@ private:
|
|||||||
|
|
||||||
ctbSlowAdc *adcs[NSLOWADCS+1];
|
ctbSlowAdc *adcs[NSLOWADCS+1];
|
||||||
|
|
||||||
multiSlsDetector* myDet;
|
sls::Detector* myDet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector*);
|
ctbSlowAdcs(TGVerticalFrame *page, sls::Detector*);
|
||||||
|
|
||||||
int setSlowAdcAlias(string line);
|
int setSlowAdcAlias(string line);
|
||||||
// int setDacAlias(string line);
|
// int setDacAlias(string line);
|
||||||
|
@ -62,7 +62,7 @@ template <class dataType> class analogDetector {
|
|||||||
|
|
||||||
|
|
||||||
analogDetector(slsDetectorData<dataType> *d, int sign=1,
|
analogDetector(slsDetectorData<dataType> *d, int sign=1,
|
||||||
commonModeSubtraction *cm=NULL, int nped=1000, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<dataType> *gs=NULL) : det(d), nx(nnx), ny(nny), stat(NULL), cmSub(cm), iframe(-1), dataSign(sign), gmap(gm), ghSum(gs), id(0) {
|
commonModeSubtraction *cm=NULL, int nped=1000, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<dataType> *gs=NULL) : det(d), nx(nnx), ny(nny), stat(NULL), cmSub(cm), dataSign(sign), iframe(-1), gmap(gm), ghSum(gs), id(0) {
|
||||||
|
|
||||||
if (det)
|
if (det)
|
||||||
det->getDetectorSize(nx,ny);
|
det->getDetectorSize(nx,ny);
|
||||||
@ -880,7 +880,7 @@ template <class dataType> class analogDetector {
|
|||||||
|
|
||||||
virtual double subtractPedestal(char *data, int ix, int iy=0, int cm=0) {
|
virtual double subtractPedestal(char *data, int ix, int iy=0, int cm=0) {
|
||||||
double g=1.;
|
double g=1.;
|
||||||
double val;
|
double val =0;
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||||
if (gmap) {
|
if (gmap) {
|
||||||
g=gmap[iy*nx+ix];
|
g=gmap[iy*nx+ix];
|
||||||
@ -927,6 +927,7 @@ template <class dataType> class analogDetector {
|
|||||||
#endif
|
#endif
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -981,7 +982,7 @@ template <class dataType> class analogDetector {
|
|||||||
*/
|
*/
|
||||||
int *getNPhotons(char *data, int *nph=NULL) {
|
int *getNPhotons(char *data, int *nph=NULL) {
|
||||||
|
|
||||||
double val;
|
//double val;
|
||||||
if (nph==NULL)
|
if (nph==NULL)
|
||||||
nph=image;
|
nph=image;
|
||||||
newFrame(data);
|
newFrame(data);
|
||||||
|
@ -14,7 +14,7 @@ class commonModeSubtraction {
|
|||||||
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
||||||
|
|
||||||
*/
|
*/
|
||||||
commonModeSubtraction(int iroi=1, int ns=3) : nROI(iroi), nsigma(ns) {
|
commonModeSubtraction(int iroi=1, int ns=3) : nsigma(ns), nROI(iroi) {
|
||||||
mean=new double[nROI];
|
mean=new double[nROI];
|
||||||
mean2=new double[nROI];
|
mean2=new double[nROI];
|
||||||
nCm=new double[nROI];
|
nCm=new double[nROI];
|
||||||
@ -28,7 +28,7 @@ class commonModeSubtraction {
|
|||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
virtual commonModeSubtraction *Clone() {
|
virtual commonModeSubtraction *Clone() {
|
||||||
new commonModeSubtraction(this->nROI, this->nsigma);
|
return new commonModeSubtraction(this->nROI, this->nsigma);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** clears the moving average and the sum of pedestals calculation - virtual func*/
|
/** clears the moving average and the sum of pedestals calculation - virtual func*/
|
||||||
|
@ -45,7 +45,7 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
|||||||
|
|
||||||
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
int iarg;
|
//int iarg;
|
||||||
int64_t word, *wp;
|
int64_t word, *wp;
|
||||||
short unsigned int* val=new short unsigned int[nch];
|
short unsigned int* val=new short unsigned int[nch];
|
||||||
int bit[64];
|
int bit[64];
|
||||||
|
@ -49,7 +49,7 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
|||||||
|
|
||||||
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
int iarg;
|
//int iarg;
|
||||||
int64_t word, *wp;
|
int64_t word, *wp;
|
||||||
short unsigned int* val=new short unsigned int[nch];
|
short unsigned int* val=new short unsigned int[nch];
|
||||||
int bit[64];
|
int bit[64];
|
||||||
@ -57,7 +57,7 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
|||||||
int ioff=0;
|
int ioff=0;
|
||||||
int idr=0;
|
int idr=0;
|
||||||
int ib=0;
|
int ib=0;
|
||||||
int ich=0;
|
//int ich=0;
|
||||||
int ii=0;
|
int ii=0;
|
||||||
int iw=0;
|
int iw=0;
|
||||||
bit[0]=17;//19;
|
bit[0]=17;//19;
|
||||||
|
@ -8,9 +8,9 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
deserializer( std::vector <int> dbl, int nch=64*3,int dr=24, int off=2): slsDetectorData<int>(nch,1,nch*dr*8+off*8,NULL,NULL,NULL), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
deserializer( std::vector <int> dbl, int nch=64*3,int dr=24, int off=2): slsDetectorData<int>(nch,1,nch*dr*8+off*8,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch), dbitlist(dbl) {};
|
||||||
|
|
||||||
deserializer( std::vector <int> dbl, int nch,int dr, int off, int ds): slsDetectorData<int>(nch,1,ds,NULL,NULL,NULL), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
deserializer( std::vector <int> dbl, int nch,int dr, int off, int ds): slsDetectorData<int>(nch,1,ds,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch), dbitlist(dbl) {};
|
||||||
|
|
||||||
virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;};
|
virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;};
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
|
|
||||||
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
int iarg;
|
//int iarg;
|
||||||
int64_t word, *wp;
|
int64_t word, *wp;
|
||||||
int* val=new int[nch];
|
int* val=new int[nch];
|
||||||
int ioff=0;
|
int ioff=0;
|
||||||
@ -107,10 +107,10 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
|
|
||||||
static int* deserializeList(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
static int* deserializeList(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
int iarg;
|
//int iarg;
|
||||||
int64_t word;
|
// int64_t word;
|
||||||
int* val=new int[nch];
|
int* val=new int[nch];
|
||||||
int ioff=0;
|
//int ioff=0;
|
||||||
int idr=0;
|
int idr=0;
|
||||||
int ib=0;
|
int ib=0;
|
||||||
int iw=0;
|
int iw=0;
|
||||||
@ -129,7 +129,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
ib=0;
|
ib=0;
|
||||||
ich=0;
|
ich=0;
|
||||||
for (const auto &bit : dbl) {
|
for (const auto &bit : dbl) {
|
||||||
ioff=off;
|
//ioff=off;
|
||||||
idr=0;
|
idr=0;
|
||||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||||
val[ich]|=(*dval)<<idr;
|
val[ich]|=(*dval)<<idr;
|
||||||
|
@ -29,7 +29,7 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
//moench04CtbZmq10GbData(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) {
|
//moench04CtbZmq10GbData(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) {
|
||||||
moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, (nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) {
|
moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, (nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8), nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
||||||
|
|
||||||
/* int ds; */
|
/* int ds; */
|
||||||
/* if (nas && nds) */
|
/* if (nas && nds) */
|
||||||
@ -46,13 +46,13 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
int isample;
|
//int isample;
|
||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
// int ix, iy;
|
||||||
|
|
||||||
int npackets=40;
|
// int npackets=40;
|
||||||
int i;
|
int i;
|
||||||
int adc4(0);
|
//int adc4(0);
|
||||||
|
|
||||||
for (int is=0; is<aSamples; is++) {
|
for (int is=0; is<aSamples; is++) {
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getGain(char *data, int x, int y) {
|
int getGain(char *data, int x, int y) {
|
||||||
int aoff=aSamples*2*32;
|
// int aoff=aSamples*2*32;
|
||||||
int irow;
|
int irow;
|
||||||
int isc=x/sc_width;
|
int isc=x/sc_width;
|
||||||
int icol=x%sc_width;
|
int icol=x%sc_width;
|
||||||
@ -237,15 +237,15 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
// char *retval=0;
|
||||||
int nd;
|
// int nd;
|
||||||
int fnum = -1;
|
// int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
int pn;
|
//int pn;
|
||||||
|
|
||||||
// cout << dataSize << endl;
|
// cout << dataSize << endl;
|
||||||
if (ff>=0)
|
if (ff>=0)
|
||||||
fnum=ff;
|
// fnum=ff;
|
||||||
|
|
||||||
if (filebin.is_open()) {
|
if (filebin.is_open()) {
|
||||||
if (filebin.read(data, dataSize) ){
|
if (filebin.read(data, dataSize) ){
|
||||||
|
@ -28,20 +28,20 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
\param c crosstalk parameter for the output buffer
|
\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) {
|
moench04CtbZmqData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
||||||
|
|
||||||
|
|
||||||
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 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 row, col;
|
||||||
|
|
||||||
int isample;
|
//int isample;
|
||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
//int ix, iy;
|
||||||
|
|
||||||
int npackets=40;
|
// int npackets=40;
|
||||||
int i;
|
int i;
|
||||||
int adc4(0);
|
//int adc4(0);
|
||||||
|
|
||||||
for (int is=0; is<aSamples; is++) {
|
for (int is=0; is<aSamples; is++) {
|
||||||
|
|
||||||
@ -223,15 +223,15 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
// char *retval=0;
|
||||||
int nd;
|
//int nd;
|
||||||
int fnum = -1;
|
//int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
int pn;
|
//int pn;
|
||||||
|
|
||||||
// cout << dataSize << endl;
|
// cout << dataSize << endl;
|
||||||
if (ff>=0)
|
if (ff>=0)
|
||||||
fnum=ff;
|
// fnum=ff;
|
||||||
|
|
||||||
if (filebin.is_open()) {
|
if (filebin.is_open()) {
|
||||||
if (filebin.read(data, dataSize) ){
|
if (filebin.read(data, dataSize) ){
|
||||||
|
@ -28,13 +28,13 @@ template <class dataType> class ghostSummation {
|
|||||||
~ghostSummation() {delete [] ghost;};
|
~ghostSummation() {delete [] ghost;};
|
||||||
|
|
||||||
virtual ghostSummation *Clone() {
|
virtual ghostSummation *Clone() {
|
||||||
new ghostSummation(this);
|
return new ghostSummation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
double getXTalk(){return xtalk;};
|
double getXTalk(){return xtalk;};
|
||||||
void setXTalk(double g) {xtalk=g;};
|
void setXTalk(double g) {xtalk=g;};
|
||||||
|
|
||||||
virtual double calcGhost(char *data, int ix, int iy=1){ghost[iy*nx+ix]=0;};
|
virtual double calcGhost(char *data, int ix, int iy=1){ghost[iy*nx+ix]=0; return 0;};
|
||||||
|
|
||||||
virtual void calcGhost(char *data){
|
virtual void calcGhost(char *data){
|
||||||
for (int iy=0; iy<ny; iy++)
|
for (int iy=0; iy<ny; iy++)
|
||||||
|
@ -58,7 +58,7 @@ public analogDetector<uint16_t> {
|
|||||||
int sign=1,
|
int sign=1,
|
||||||
commonModeSubtraction *cm=NULL,
|
commonModeSubtraction *cm=NULL,
|
||||||
int nped=1000,
|
int nped=1000,
|
||||||
int nd=100, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<uint16_t> *gs=NULL) : analogDetector<uint16_t>(d, sign, cm, nped, nnx, nny, gm, gs), nDark(nd), eventMask(NULL),nSigma (nsigma), clusterSize(csize), clusterSizeY(csize), clusters(NULL), quad(UNDEFINED_QUADRANT), tot(0), quadTot(0), eMin(-1), eMax(-1) {
|
int nd=100, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<uint16_t> *gs=NULL) : analogDetector<uint16_t>(d, sign, cm, nped, nnx, nny, gm, gs), nDark(nd), eventMask(NULL),nSigma (nsigma), eMin(-1), eMax(-1), clusterSize(csize), clusterSizeY(csize), clusters(NULL), quad(UNDEFINED_QUADRANT), tot(0), quadTot(0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -183,13 +183,13 @@ public analogDetector<uint16_t> {
|
|||||||
//nph=new int[nx*ny];
|
//nph=new int[nx*ny];
|
||||||
|
|
||||||
double rest[ny][nx];
|
double rest[ny][nx];
|
||||||
int cy=(clusterSizeY+1)/2; //quad size
|
//int cy=(clusterSizeY+1)/2; //quad size
|
||||||
int cs=(clusterSize+1)/2; //quad size
|
//int cs=(clusterSize+1)/2; //quad size
|
||||||
|
|
||||||
int ccs=clusterSize; //cluster size
|
//int ccs=clusterSize; //cluster size
|
||||||
int ccy=clusterSizeY; //cluster size
|
//int ccy=clusterSizeY; //cluster size
|
||||||
|
|
||||||
double g=1.;
|
//double g=1.;
|
||||||
|
|
||||||
|
|
||||||
double tthr=thr, tthr1, tthr2;
|
double tthr=thr, tthr1, tthr2;
|
||||||
@ -201,10 +201,10 @@ public analogDetector<uint16_t> {
|
|||||||
if (cmSub) cm=1;
|
if (cmSub) cm=1;
|
||||||
|
|
||||||
if (thr>0) {
|
if (thr>0) {
|
||||||
cy=1;
|
//cy=1;
|
||||||
cs=1;
|
//cs=1;
|
||||||
ccs=1;
|
//ccs=1;
|
||||||
ccy=1;
|
//ccy=1;
|
||||||
}
|
}
|
||||||
if (iframe<nDark) {
|
if (iframe<nDark) {
|
||||||
// cout << "ped " << iframe << endl;
|
// cout << "ped " << iframe << endl;
|
||||||
@ -349,9 +349,9 @@ int *getClusters(char *data, int *ph=NULL) {
|
|||||||
double val[ny][nx];
|
double val[ny][nx];
|
||||||
int cy=(clusterSizeY+1)/2;
|
int cy=(clusterSizeY+1)/2;
|
||||||
int cs=(clusterSize+1)/2;
|
int cs=(clusterSize+1)/2;
|
||||||
int ir, ic;
|
//int ir, ic;
|
||||||
|
|
||||||
double max=0, tl=0, tr=0, bl=0,br=0, *v, vv;
|
double max=0, tl=0, tr=0, bl=0,br=0, *v;
|
||||||
int cm=0;
|
int cm=0;
|
||||||
int good=1;
|
int good=1;
|
||||||
if (cmSub) cm=1;
|
if (cmSub) cm=1;
|
||||||
|
@ -211,7 +211,7 @@ class single_photon_hit {
|
|||||||
|
|
||||||
void print() {
|
void print() {
|
||||||
|
|
||||||
int ix, iy;
|
// int ix, iy;
|
||||||
|
|
||||||
for (int iy=0; iy<dy; iy++) {
|
for (int iy=0; iy<dy; iy++) {
|
||||||
for (int ix=0; ix<dx; ix++) {
|
for (int ix=0; ix<dx; ix++) {
|
||||||
|
@ -4,20 +4,20 @@
|
|||||||
#include<iostream>
|
#include<iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
// #undef cbf_failnez
|
// #undef cbf_failnez
|
||||||
// #define cbf_failnez(x) \
|
// #define cbf_failnez(x)
|
||||||
// { \
|
// {
|
||||||
// int err; \
|
// int err;
|
||||||
// err = (x); \
|
// err = (x);
|
||||||
// if (err) { \
|
// if (err) {
|
||||||
// fprintf(stderr,"\nCBFlib fatal error %x \n",err); \
|
// fprintf(stderr,"\nCBFlib fatal error %x \n",err);
|
||||||
// exit(-1); \
|
// exit(-1);
|
||||||
// } \
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void *WriteToTiff(float * imgData, const char * imgname, int nrow, int ncol){
|
void *WriteToTiff(float * imgData, const char * imgname, int nrow, int ncol){
|
||||||
int sampleperpixel=1;
|
int sampleperpixel=1;
|
||||||
// unsigned char * buff=NULL;
|
// unsigned char * buff=NULL;
|
||||||
tsize_t linebytes;
|
//tsize_t linebytes;
|
||||||
// cout << "--" <<endl;
|
// cout << "--" <<endl;
|
||||||
TIFF * tif = TIFFOpen(imgname,"w");
|
TIFF * tif = TIFFOpen(imgname,"w");
|
||||||
if (tif) {
|
if (tif) {
|
||||||
@ -30,7 +30,7 @@ void *WriteToTiff(float * imgData, const char * imgname, int nrow, int ncol){
|
|||||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
||||||
TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
|
TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
|
||||||
|
|
||||||
linebytes = sampleperpixel*ncol;
|
//linebytes = sampleperpixel*ncol;
|
||||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
||||||
for(int irow=0; irow<nrow; irow++){
|
for(int irow=0; irow<nrow; irow++){
|
||||||
TIFFWriteScanline(tif,&imgData[irow*ncol],irow,0);
|
TIFFWriteScanline(tif,&imgData[irow*ncol],irow,0);
|
||||||
@ -50,7 +50,7 @@ float *ReadFromTiff( const char * imgname, uint32 &nrow, uint32 &ncol){
|
|||||||
if (tif){
|
if (tif){
|
||||||
uint32 bps;
|
uint32 bps;
|
||||||
uint32 sampleperpixel=1;
|
uint32 sampleperpixel=1;
|
||||||
tsize_t linebytes;
|
//tsize_t linebytes;
|
||||||
|
|
||||||
uint32 imagelength;
|
uint32 imagelength;
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ float *ReadFromTiff( const char * imgname, uint32 &nrow, uint32 &ncol){
|
|||||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
|
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
|
||||||
|
|
||||||
float * imgData=new float[ncol*nrow];
|
float * imgData=new float[ncol*nrow];
|
||||||
linebytes = sampleperpixel*ncol;
|
//linebytes = sampleperpixel*ncol;
|
||||||
// TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
// TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
||||||
for(int irow=0; irow<nrow; irow++){
|
for(uint32 irow=0; irow<nrow; irow++){
|
||||||
//tiffreadscanline(tif, buf, row);
|
//tiffreadscanline(tif, buf, row);
|
||||||
TIFFReadScanline(tif,&imgData[irow*ncol],irow);
|
TIFFReadScanline(tif,&imgData[irow*ncol],irow);
|
||||||
}
|
}
|
||||||
|
@ -580,8 +580,9 @@ void Detector::setFilePath(const std::string &fpath, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<std::string> Detector::getFileNamePrefix(Positions pos) const {
|
Result<std::string> Detector::getFileNamePrefix(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::setFileName, pos, "");
|
return pimpl->Parallel(&slsDetector::getFileName, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
||||||
pimpl->Parallel(&slsDetector::setFileName, pos, fname);
|
pimpl->Parallel(&slsDetector::setFileName, pos, fname);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user