mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +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
|
||||
)
|
||||
|
||||
|
||||
#TODO! Replace with target
|
||||
target_include_directories(ctbGui PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
||||
@ -44,6 +45,7 @@ target_include_directories(ctbGui PRIVATE
|
||||
|
||||
# Headders needed for ROOT dictionary generation
|
||||
set( HEADERS
|
||||
ctbDefs.h
|
||||
ctbMain.h
|
||||
ctbDacs.h
|
||||
ctbPattern.h
|
||||
@ -63,12 +65,15 @@ add_library(ctbRootLib SHARED ctbDict.cxx)
|
||||
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(ctbRootLib PUBLIC
|
||||
ROOT::Core
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
${ROOT_LIBRARIES}
|
||||
${ROOT_EXE_LINKER_FLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ctbGui PUBLIC
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
ctbRootLib
|
||||
${TIFF_LIBRARIES}
|
||||
)
|
||||
|
@ -24,7 +24,8 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbAcquisition.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ctbMain.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;
|
||||
bitPlot=NULL;
|
||||
@ -71,8 +72,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
||||
cFileSave->SetTextJustify(kTextRight);
|
||||
cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
|
||||
|
||||
|
||||
eFname = new TGTextEntry(hframe, (myDet->getFileName()).c_str());
|
||||
std::string temp = "run";
|
||||
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));
|
||||
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));
|
||||
eOutdir->MapWindow();
|
||||
@ -597,20 +605,11 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
acqThread = new TThread("acqThread",
|
||||
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;
|
||||
try{
|
||||
try {
|
||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
|
||||
cout <<"Done" << endl;
|
||||
|
||||
@ -664,10 +663,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
countsHisto[i]=h1;
|
||||
}
|
||||
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
photonFinder=NULL;
|
||||
@ -771,7 +766,7 @@ void ctbAcquisition::canvasClicked() {
|
||||
void ctbAcquisition::setCanvas(TCanvas* c) {
|
||||
myCanvas=c;
|
||||
myCanvas->cd();
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%x)->canvasClicked()",this));
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%p)->canvasClicked()",this));
|
||||
// myCanvas->AddExec("ex","canvasClicked()");
|
||||
}
|
||||
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
||||
@ -806,8 +801,6 @@ digital:
|
||||
sample0 (dbit0 + dbit1 +...)
|
||||
sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
std::vector <int> dbitlist;
|
||||
|
||||
@ -845,19 +838,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
||||
//#endif
|
||||
int ig=0;
|
||||
int i, ii, ich=0, ib, vv;
|
||||
int i, ii, ib;
|
||||
// TList *l= adcStack->GetHists();
|
||||
// TList *l1= countsStack->GetHists();
|
||||
TH1F *h;
|
||||
TH1F *h1;
|
||||
TH1F *hb;
|
||||
int nb, x,y;
|
||||
int x;
|
||||
double ped=0;
|
||||
int vv1,vv2;
|
||||
int dsize=-1;
|
||||
int *val=NULL;
|
||||
int nx=1, ny=1, jj;
|
||||
short unsigned int *va;
|
||||
int nx=1, ny=1;
|
||||
|
||||
if (dataStructure) {
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
|
||||
@ -873,7 +865,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
int nadc;
|
||||
int ndbit;
|
||||
|
||||
|
||||
tenG = 0;
|
||||
|
||||
|
||||
|
||||
@ -1032,7 +1024,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
} else {
|
||||
ii=0;
|
||||
int iii=0;
|
||||
int nb=dbitlist.size();
|
||||
for (const auto &value : dbitlist) {
|
||||
ib=value;
|
||||
hb=bitHisto[ib];
|
||||
@ -1198,10 +1189,10 @@ void ctbAcquisition::changeDetector(){
|
||||
photonFinder=NULL;
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
TH2F *h2DMapOld=h2DMapAn;
|
||||
|
||||
// TH2F *h2ScanOld=h2Scan;
|
||||
TH1F *h1DMapOld=h1DMap;
|
||||
int dim=2;
|
||||
|
||||
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
@ -1219,10 +1210,16 @@ void ctbAcquisition::changeDetector(){
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
if (myDet->enableTenGigabitEthernet(-1))
|
||||
|
||||
try {
|
||||
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
if (retval) {
|
||||
dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
|
||||
else
|
||||
} else {
|
||||
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
@ -1436,7 +1433,7 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
||||
float off=0;
|
||||
for (int ii=0; ii<NSIGNALS; ii++) {
|
||||
if (bitPlotFlag[ii]) {bitOffset[ii]=off;
|
||||
off+=1.5;
|
||||
off+=static_cast<float>(1.5);
|
||||
cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
|
||||
}
|
||||
}
|
||||
@ -1452,73 +1449,64 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
||||
void ctbAcquisition::setOutdir() {
|
||||
try {
|
||||
myDet->setFilePath(eOutdir->GetText());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
// // cout << "setting dac! "<< id << endl;
|
||||
|
||||
// myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
|
||||
// getValue();
|
||||
|
||||
} CATCH_DISPLAY ("Could not set file path", "ctbAcquisition::setOutdir")
|
||||
}
|
||||
|
||||
void ctbAcquisition::setFname() {
|
||||
try {
|
||||
myDet->setFileName(eFname->GetText());
|
||||
} catch (...) {
|
||||
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;
|
||||
|
||||
myDet->setFileNamePrefix(eFname->GetText());
|
||||
} CATCH_DISPLAY ("Could not set file name prefix", "ctbAcquisition::setFname")
|
||||
}
|
||||
|
||||
void ctbAcquisition::setFindex() {
|
||||
|
||||
try {
|
||||
myDet->setFileIndex(eFindex->GetNumber());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
myDet->setAcquisitionIndex(eFindex->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set acquisition index", "ctbAcquisition::setFindex")
|
||||
}
|
||||
|
||||
|
||||
void ctbAcquisition::setFsave(Bool_t b) {
|
||||
try {
|
||||
myDet->setFileWrite(b);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eFname->SetState(b);
|
||||
eOutdir->SetState(b);
|
||||
|
||||
} CATCH_DISPLAY ("Could not set file write", "ctbAcquisition::setFsave")
|
||||
}
|
||||
|
||||
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());
|
||||
eOutdir->SetState(cFileSave->IsOn());
|
||||
eFindex->SetState(cFileSave->IsOn());
|
||||
// eMeasurements->SetNumber(myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
roMode=myDet->setReadOutFlags();
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
setAnalogSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::update")
|
||||
|
||||
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);
|
||||
//nChannels=myDet->getTotalNumberOfChannels();
|
||||
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
|
||||
|
||||
updateChans();
|
||||
|
||||
if (dataStructure) {
|
||||
@ -1533,16 +1521,14 @@ void ctbAcquisition::update() {
|
||||
|
||||
}
|
||||
|
||||
try{
|
||||
dBitOffset=myDet->getReceiverDbitOffset();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
tenG=myDet->enableTenGigabitEthernet(-1);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try {
|
||||
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
// for (int i=0; i<10; i++)
|
||||
@ -1602,10 +1588,8 @@ void ctbAcquisition::loadPattern() {
|
||||
|
||||
cout << "Load: " << fname << endl;
|
||||
try {
|
||||
myDet->retrieveDetectorSetup(fname);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->loadParameters(fname);
|
||||
} CATCH_DISPLAY ("Could not load parameters", "ctbAcquisition::loadPattern")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1616,16 +1600,26 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
|
||||
/** update all infos useful for the acquisition! */
|
||||
|
||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
dBitOffset=myDet->getReceiverDbitOffset();
|
||||
roMode=myDet->setReadOutFlags();
|
||||
try {
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
setAnalogSamples(retval);
|
||||
} 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);
|
||||
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
|
||||
|
||||
// iScanStep=0;
|
||||
|
||||
cout << "Run" << endl;
|
||||
bStatus->SetText("Stop");
|
||||
ip=0;
|
||||
@ -1675,11 +1669,9 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
|
||||
} else {
|
||||
StopFlag=1;
|
||||
try {
|
||||
try{
|
||||
myDet->stopAcquisition();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
|
||||
stop=1;
|
||||
bStatus->SetText("Start");
|
||||
// acqThread->Kill();
|
||||
@ -1696,32 +1688,30 @@ void ctbAcquisition::acquisitionFinished() {
|
||||
void ctbAcquisition::startAcquisition(){
|
||||
cout << "Detector started " <<eMeasurements->GetNumber()<< endl;
|
||||
stop=0;
|
||||
|
||||
try {
|
||||
tenG=myDet->enableTenGigabitEthernet(-1);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::startAcquisition")
|
||||
|
||||
for (int im=0; im<eMeasurements->GetNumber(); im++) {
|
||||
try {
|
||||
myDet->acquire();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
cout << im << endl;
|
||||
if (stop) break;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not acquire", "ctbAcquisition::startAcquisition")
|
||||
|
||||
cout << im << endl;
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void* ctbAcquisition::ThreadHandle(void *arg)
|
||||
{
|
||||
ctbAcquisition *acq = static_cast<ctbAcquisition*>(arg);
|
||||
int i=0;
|
||||
|
||||
acq->startAcquisition();
|
||||
acq->acquisitionFinished();
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ctbAcquisition::progressCallback(double f,void* arg) {
|
||||
@ -1754,12 +1744,6 @@ void ctbAcquisition::setPatternCompiler(const char* t) {
|
||||
}
|
||||
void ctbAcquisition::setMeasurements() {
|
||||
|
||||
|
||||
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eMeasurements->GetNumber());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ctbAcquisition::setAnalogSamples(int n) {
|
||||
@ -1864,46 +1848,32 @@ void ctbAcquisition::setDbitEnable(Int_t reg){
|
||||
|
||||
void ctbAcquisition::updateChans() {
|
||||
|
||||
/** dbitlist updated */
|
||||
std::vector <int> dbl;
|
||||
// dbit list
|
||||
try {
|
||||
dbl = myDet->getReceiverDbitList();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto retval = myDet->getRxDbitList().tsquash("Different values");
|
||||
dbitlist.clear();
|
||||
if (dbl.empty())
|
||||
;
|
||||
else {
|
||||
for (const auto &value : dbl)
|
||||
if (!retval.empty()) {
|
||||
for (const auto &value : retval)
|
||||
dbitlist.push_back(value);
|
||||
}
|
||||
uint32_t reg;
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
|
||||
|
||||
// adc mask
|
||||
try {
|
||||
reg=myDet->getADCEnableMask();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
/* adc updated */
|
||||
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||
adclist.clear();
|
||||
// // updateChans();
|
||||
if (reg!=0xffffffff) {
|
||||
if (retval!=0xffffffff) {
|
||||
for (int i=0; i<NADCS; i++) {
|
||||
if (reg&(1<<i))
|
||||
if (retval&(1<<i)) {
|
||||
adclist.push_back(i);
|
||||
// // else enableFlag[i]=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get adc enable mask.", "ctbAcquisition::updateChans")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbAcquisition::resetPedestal() {
|
||||
if (photonFinder) {
|
||||
photonFinder->newDataSet();
|
||||
|
@ -23,7 +23,10 @@ class TH1F;
|
||||
class TGLabel;
|
||||
class TGTextButton;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
class detectorData;
|
||||
|
||||
template <class dataType> class slsDetectorData;
|
||||
@ -112,7 +115,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
// TH1I *plotAdc[NADCS];
|
||||
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
int plotFlag[NADCS];
|
||||
int bitPlotFlag[NSIGNALS];
|
||||
@ -169,7 +172,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
int deserializer;
|
||||
|
||||
public:
|
||||
ctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
|
||||
ctbAcquisition(TGVerticalFrame*, sls::Detector*);
|
||||
void setOutdir();
|
||||
void setFname();
|
||||
void setMeasurements();
|
||||
|
@ -24,14 +24,15 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbAdcs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
|
||||
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 *hframe=this;
|
||||
@ -155,7 +156,7 @@ void ctbAdc::setAdcAlias(char *tit, int plot, int color) {
|
||||
string ctbAdc::getAdcAlias() {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
|
||||
@ -272,7 +273,6 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
MapWindow();
|
||||
|
||||
char tit[100];
|
||||
|
||||
|
||||
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
|
||||
@ -415,108 +415,41 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
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 {
|
||||
if (reg > -1) {
|
||||
myDet->setADCEnableMask(reg);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||
eEnableMask->SetHexNumber(retval);
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||
|
||||
}
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// cout <<"enable: " << retval << endl;;
|
||||
// delete cmd;
|
||||
|
||||
// sscanf(retval.c_str(),"%x",&retreg);
|
||||
try {
|
||||
retreg=myDet->getADCEnableMask();
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eEnableMask->SetHexNumber(retreg);
|
||||
|
||||
return retreg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
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 {
|
||||
if (reg > -1) {
|
||||
myDet->setADCInvert(reg);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto retval = myDet->getADCInvert().tsquash("Different values");
|
||||
eInversionMask->SetHexNumber(retval);
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||
|
||||
//retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
||||
}
|
||||
try {
|
||||
retreg=myDet->getADCInvert();
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
// 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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbAdcs::update() {
|
||||
Int_t invreg;//=myDet->readRegister(67);//(120);
|
||||
Int_t disreg;//=myDet->readRegister(120);//(94);
|
||||
// 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);
|
||||
Int_t invreg;
|
||||
Int_t disreg;
|
||||
|
||||
disreg=setEnable();
|
||||
invreg=setInvert();
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++) {
|
||||
sAdc[is]->setAdcAlias(NULL,-1,-1);
|
||||
if (invreg & (1<<is) )
|
||||
@ -528,42 +461,29 @@ void ctbAdcs::update() {
|
||||
sAdc[is]->setEnable(kTRUE);
|
||||
else
|
||||
sAdc[is]->setEnable(kFALSE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Emit("AdcEnable(Int_t)", disreg);
|
||||
|
||||
}
|
||||
string ctbAdcs::getAdcParameters() {
|
||||
|
||||
ostringstream line;
|
||||
|
||||
line << "reg "<< hex << setInvert() << "# ADC invert 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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::CheckAll() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++){
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveAll() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++) {
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
@ -571,51 +491,32 @@ void ctbAdcs::RemoveAll() {
|
||||
|
||||
|
||||
void ctbAdcs::CheckHalf0() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS/2; is++) {
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveHalf0() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS/2; is++){
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void ctbAdcs::CheckHalf1() {
|
||||
|
||||
|
||||
for (int is=NADCS/2; is<NADCS; is++){
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveHalf1() {
|
||||
|
||||
|
||||
for (int is=NADCS/2; is<NADCS; is++){
|
||||
// sAdc[is]->setEnabled(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 is=-1, plot=0, color=-1;
|
||||
@ -657,33 +558,23 @@ void ctbAdcs::AdcEnable(Int_t b){
|
||||
|
||||
void ctbAdcs::ToggledAdcEnable(Int_t b){
|
||||
|
||||
|
||||
Int_t oreg=setEnable();//myDet->readRegister(67);
|
||||
Int_t oreg=setEnable();
|
||||
Int_t m=1<<b;
|
||||
|
||||
|
||||
if (sAdc[b]->getEnable())
|
||||
oreg|=m;
|
||||
else
|
||||
oreg&=~m;
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
setEnable(oreg);//)writeRegister(67, oreg);
|
||||
//oreg=setEnable();//myDet->readRegister(67);
|
||||
|
||||
setEnable(oreg);
|
||||
|
||||
Emit("AdcEnable(Int_t)", oreg);
|
||||
//cout << "enable!" << endl;
|
||||
// Emit("ToggledAdcPlot(Int_t)", b);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
|
||||
// char val[1000];
|
||||
Int_t oreg=setInvert();//myDet->readRegister(67);
|
||||
Int_t oreg=setInvert();
|
||||
Int_t m=1<<b;
|
||||
|
||||
|
||||
@ -692,15 +583,7 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
else
|
||||
oreg&=~m;
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
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);
|
||||
setInvert(oreg);
|
||||
}
|
||||
|
||||
|
||||
@ -710,22 +593,23 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
Pixel_t ctbAdcs::getColor(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getColor();
|
||||
return static_cast<Pixel_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getEnabled(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getEnabled();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getEnable(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getEnable();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getPlot(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getPlot();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
@ -28,7 +28,10 @@ class TGTab;
|
||||
|
||||
class TGraph;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -49,10 +52,10 @@ class ctbAdc : public TGHorizontalFrame {
|
||||
// TGraph *gADC;
|
||||
|
||||
int id;
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det);
|
||||
ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det);
|
||||
|
||||
|
||||
void setAdcAlias(char *tit, int plot, int color);
|
||||
@ -89,7 +92,7 @@ class ctbAdcs : public TGGroupFrame {
|
||||
private:
|
||||
|
||||
ctbAdc *sAdc[NADCS];
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
|
||||
TGTextButton *bCheckAll;
|
||||
@ -115,7 +118,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbAdcs(TGVerticalFrame *page, sls::Detector *det);
|
||||
int setAdcAlias(string line);
|
||||
string getAdcAlias();
|
||||
string getAdcParameters();
|
||||
|
@ -9,17 +9,14 @@
|
||||
#include <TGButton.h>
|
||||
|
||||
#include "ctbDacs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
|
||||
@ -104,12 +101,9 @@ int ctbDac::setLabel(char *tit, int mv) {
|
||||
}
|
||||
|
||||
string ctbDac::getLabel() {
|
||||
|
||||
ostringstream line;
|
||||
line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
return line.str();
|
||||
|
||||
}
|
||||
@ -119,65 +113,45 @@ void ctbDac::setValue(Long_t a) {setValue();}
|
||||
|
||||
void ctbDac::setValue() {
|
||||
|
||||
|
||||
|
||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||
|
||||
try {
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn()); } catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn());
|
||||
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
|
||||
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
void ctbDac::setOn(Bool_t b) {
|
||||
|
||||
|
||||
|
||||
// cout << "setting dac! "<< id << endl;
|
||||
|
||||
if ( dacsLabel->IsOn()) {
|
||||
setValue();
|
||||
} else {
|
||||
try {
|
||||
myDet->setDAC(-100, (slsDetectorDefs::dacIndex)id, 0);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->setDAC(-100, static_cast<slsDetectorDefs::dacIndex>(id), false);
|
||||
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
|
||||
}
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
int ctbDac::getValue() {
|
||||
int val;
|
||||
try {
|
||||
val=myDet->setDAC(-1,(slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
char s[100];
|
||||
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
|
||||
cout << "dac " << id << " " << val << endl;
|
||||
sprintf(s,"%d",val);
|
||||
dacsValue->SetText(s);
|
||||
if (val>=0) {
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val >= 0) {
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
} CATCH_DISPLAY ("Could not get dac " + to_string(id) + ".", "ctbDac::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||
|
||||
ctbDacs::ctbDacs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
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+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
|
||||
dacs[NDACS]->setLabel("ADC Vpp",2);
|
||||
dacs[NDACS+1]->setLabel("High Voltage",3);
|
||||
|
||||
dacs[NDACS]->setLabel((char*)"ADC Vpp",2);
|
||||
dacs[NDACS+1]->setLabel((char*)"High Voltage",3);
|
||||
}
|
||||
|
||||
|
||||
int ctbDacs::setDacAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
char tit[100];
|
||||
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++)
|
||||
line << dacs[i]->getLabel() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -225,8 +196,6 @@ string ctbDacs::getDacAlias() {
|
||||
|
||||
|
||||
string ctbDacs::getDacParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
|
||||
for (int i=0; i<NDACS; i++) {
|
||||
@ -234,18 +203,12 @@ string ctbDacs::getDacParameters() {
|
||||
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||
}
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbDacs::update() {
|
||||
|
||||
for (int idac=0; idac<NDACS+1; idac++) {
|
||||
dacs[idac]->getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ class TGNumberEntry;
|
||||
class TGCheckButton;
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -32,9 +35,9 @@ class ctbDac : public TGHorizontalFrame {
|
||||
TGLabel *dacsValue;
|
||||
int id;
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
public:
|
||||
ctbDac(TGGroupFrame*, int , multiSlsDetector*);
|
||||
ctbDac(TGGroupFrame*, int , sls::Detector*);
|
||||
void setValue();
|
||||
void setValue(Long_t);
|
||||
int getValue();
|
||||
@ -55,10 +58,10 @@ private:
|
||||
|
||||
ctbDac *dacs[NDACS+2];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
ctbDacs(TGVerticalFrame *page, multiSlsDetector*);
|
||||
ctbDacs(TGVerticalFrame *page, sls::Detector*);
|
||||
|
||||
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 <string>
|
||||
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
//#include "sls_receiver_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "ctbDefs.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -61,31 +61,27 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
cout << " *** " << endl;
|
||||
|
||||
sls::Detector *myDet = nullptr;
|
||||
try {
|
||||
/****** Create detector ****************/
|
||||
multiSlsDetector *myDet=new multiSlsDetector(id);
|
||||
// myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
||||
myDet=new sls::Detector(id);
|
||||
cout << "Created multi detector id " << id << endl;
|
||||
|
||||
//cout << id << " " << myDet << " " << myDet->setOnline() << endl;
|
||||
if (cf) {
|
||||
myDet->readConfigurationFile(cfname);
|
||||
} else
|
||||
myDet->loadConfig(cfname);
|
||||
cout << "Config file loaded successfully" << endl;
|
||||
} else {
|
||||
cout << "No config file specified" << endl;
|
||||
}
|
||||
cout << "hostname " << myDet->getHostname() << endl;
|
||||
|
||||
cout << "aa" << endl;
|
||||
|
||||
cout << "Created multi detector id " << id << " hostname " << myDet->getHostname() << endl;
|
||||
|
||||
|
||||
cout << "bb" << endl;
|
||||
if (pf) {
|
||||
myDet->retrieveDetectorSetup(pfname);
|
||||
} else
|
||||
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 *******************/
|
||||
TApplication theApp("App",&argc,argv);
|
||||
@ -141,7 +137,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
gROOT->ForceStyle();
|
||||
ctbMain *mf=new ctbMain(gClient->GetRoot(),myDet);
|
||||
ctbMain *mf=new ctbMain(gClient->GetRoot(), myDet);
|
||||
|
||||
cout << " *** " << argc << endl;
|
||||
for (int ia=0; ia<argc; ia++)
|
||||
|
@ -29,15 +29,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "ctbDacs.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) {
|
||||
|
||||
myDet=det;
|
||||
@ -304,7 +302,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
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;
|
||||
if (fi.fFilename)
|
||||
loadAlias(fi.fFilename);
|
||||
@ -320,13 +318,12 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
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;
|
||||
if (fi.fFilename)
|
||||
saveAlias(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
|
||||
cout << "Open Parameters" << endl;
|
||||
{
|
||||
@ -343,23 +340,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: //fMenuFile->AddEntry("Save Parameters", 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++);
|
||||
case 3: // fMenuFile->AddEntry("Open Configuration", im++);
|
||||
cout << "Open configuration" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -375,23 +356,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // fMenuFile->AddEntry("Save Configuration", 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++);
|
||||
case 4: //fMenuFile->AddEntry("Open Pattern", im++);
|
||||
cout << "Open pattern" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -407,7 +372,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||
case 5: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||
cout << "Save pattern" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -419,11 +384,11 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveParameters(fi.fFilename);
|
||||
savePattern(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: // fMenuFile->AddEntry("Exit", im++);
|
||||
case 6: // fMenuFile->AddEntry("Exit", im++);
|
||||
CloseWindow();
|
||||
|
||||
default:
|
||||
@ -439,7 +404,7 @@ int ctbMain::setADCPlot(Int_t i) {
|
||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||
// acq->setGraph(i,adcs->getGraph(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;
|
||||
// acq->setGraph(i,adcs->getGraph(i));
|
||||
acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadConfiguration(string fname) {
|
||||
|
||||
myDet->readConfigurationFile(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;
|
||||
|
||||
void ctbMain::loadConfiguration(string fname) {
|
||||
try{
|
||||
myDet->loadConfig(fname);
|
||||
} CATCH_DISPLAY ("Could not load config.", "ctbMain::loadConfiguration")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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::loadParameters(string fname) {
|
||||
try{
|
||||
myDet->loadParameters(fname);
|
||||
} CATCH_DISPLAY ("Could not load parameters.", "ctbMain::loadParameters")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
void ctbMain::savePattern(string fname) {
|
||||
try{
|
||||
myDet->savePattern(fname);
|
||||
} CATCH_DISPLAY ("Could not save pattern.", "ctbMain::savePattern")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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) {
|
||||
|
||||
|
||||
@ -589,7 +465,7 @@ int ctbMain::loadAlias(string fname) {
|
||||
else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
|
||||
pat->setPatternAlias(line);
|
||||
// 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);
|
||||
// cout << "+++++++++" << line<< endl;
|
||||
} else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
|
||||
@ -615,7 +491,6 @@ int ctbMain::saveAlias(string fname) {
|
||||
|
||||
|
||||
string line;
|
||||
int i;
|
||||
ofstream myfile (fname.c_str());
|
||||
if (myfile.is_open())
|
||||
{
|
||||
|
@ -33,7 +33,10 @@ class ctbPowers;
|
||||
|
||||
class ctbSignals;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
class ctbPattern;
|
||||
class ctbAdcs;
|
||||
@ -47,7 +50,7 @@ class ctbMain : public TGMainFrame {
|
||||
private:
|
||||
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
|
||||
|
||||
@ -96,15 +99,14 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
ctbMain(const TGWindow *p, multiSlsDetector *det);
|
||||
ctbMain(const TGWindow *p, sls::Detector *det);
|
||||
|
||||
|
||||
int loadAlias(string fname);
|
||||
int saveAlias(string fname);
|
||||
int loadParameters(string fname);
|
||||
int saveParameters(string fname);
|
||||
int loadConfiguration(string fname);
|
||||
int saveConfiguration(string fname);
|
||||
void loadParameters(string fname);
|
||||
void savePattern(string fname);
|
||||
void loadConfiguration(string fname);
|
||||
void tabSelected(Int_t);
|
||||
int setADCPlot(Int_t);
|
||||
int setSignalPlot(Int_t);
|
||||
|
@ -24,15 +24,16 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbPattern.h"
|
||||
#include "multiSlsDetector.h"
|
||||
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include <chrono>
|
||||
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;
|
||||
|
||||
@ -116,47 +117,27 @@ ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
||||
}
|
||||
|
||||
void ctbLoop::setNLoops() {
|
||||
|
||||
int start, stop, n;
|
||||
|
||||
|
||||
start=-1;
|
||||
stop=-1;
|
||||
n=eLoopNumber->GetNumber();
|
||||
try{
|
||||
myDet->setPatternLoops(id,start, stop,n);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
myDet->setPatternLoops(id, -1, -1, eLoopNumber->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbLoop::update() {
|
||||
try{
|
||||
|
||||
int start, stop, n;
|
||||
|
||||
std::array<int, 3> loop;
|
||||
|
||||
try {
|
||||
loop=myDet->getPatternLoops(id);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
auto loop = myDet->getPatternLoops(id).tsquash("Different values");
|
||||
eLoopStartAddr->SetHexNumber(loop[0]);
|
||||
eLoopStopAddr->SetHexNumber(loop[1]);
|
||||
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];
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -211,41 +192,25 @@ ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
||||
|
||||
|
||||
void ctbWait::setWaitTime() {
|
||||
|
||||
|
||||
Long64_t t=eWaitTime->GetNumber();
|
||||
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() {
|
||||
|
||||
int start, stop, n, addr;
|
||||
|
||||
Long64_t t=-1;
|
||||
try{
|
||||
|
||||
t=myDet->setPatternWaitTime(id,t);
|
||||
} catch (...) {
|
||||
auto time = myDet->getPatternWaitTime(id).tsquash("Different values");
|
||||
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);
|
||||
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) {
|
||||
|
||||
|
||||
@ -809,134 +774,64 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
}
|
||||
|
||||
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 {
|
||||
n=myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,-1,0);
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getDBITClock().tsquash("Different values");
|
||||
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 {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,-1,0);
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfFrames().tsquash("Different values");
|
||||
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 {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PHASE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
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]);
|
||||
try{
|
||||
auto retval = myDet->getPatternLoops(-1).tsquash("Different values");
|
||||
eStartAddr->SetHexNumber(retval[0]);
|
||||
eStopAddr->SetHexNumber(retval[1]);
|
||||
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||
|
||||
for (int iloop=0; iloop<NLOOPS; iloop++) {
|
||||
eLoop[iloop]->update();
|
||||
|
||||
}
|
||||
|
||||
for (int iwait=0; iwait<NWAITS; iwait++) {
|
||||
@ -946,8 +841,9 @@ try {
|
||||
getAnalogSamples();
|
||||
getDigitalSamples();
|
||||
getReadoutMode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setFile() {
|
||||
patternFileChanged(patternFile->GetText());
|
||||
|
||||
@ -984,7 +880,8 @@ void ctbPattern::setPatternAlias(string line){
|
||||
|
||||
string ctbPattern::getPatternAlias() {
|
||||
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() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,eFrames->GetNumber());
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setNumberOfFrames(eFrames->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
|
||||
}
|
||||
|
||||
void ctbPattern::setCycles() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,eFrames->GetNumber());
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setNumberOfTriggers(eCycles->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setCycles")
|
||||
}
|
||||
|
||||
// void ctbPattern::setMeasurements() {
|
||||
// try {
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eFrames->GetNumber());
|
||||
// } catch (...) {
|
||||
|
||||
// cout << "Do nothing for this error" << endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbPattern::setPeriod() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,ePeriod->GetNumber()*1E9);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
try{
|
||||
auto timeNs = ctbDefs::ConvertDoubleStoChronoNS(ePeriod->GetNumber());
|
||||
myDet->setPeriod(timeNs);
|
||||
} CATCH_DISPLAY ("Could not set period", "ctbPattern::setPeriod")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbPattern::setAdcFreq() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,eAdcClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setADCClock(eAdcClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc clock", "ctbPattern::setAdcFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setRunFreq() {
|
||||
try{
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,eRunClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
myDet->setRUNClock(eRunClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set run clock", "ctbPattern::setRunFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setDBitFreq() {
|
||||
// cout <<"Not setting dbit frequency to " << eDBitClkFreq->GetNumber()<< endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,eDBitClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setDBITClock(eDBitClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit clock", "ctbPattern::setDBitFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setAdcPhase() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_PHASE,eAdcClkPhase->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setADCPhase(eAdcClkPhase->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc phase shift", "ctbPattern::setAdcPhase")
|
||||
}
|
||||
|
||||
void ctbPattern::setDBitPhase() {
|
||||
// cout <<"Not setting dbit phase to " << eDBitClkPhase->GetNumber()<< endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,eDBitClkPhase->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setDBITPhase(eDBitClkPhase->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit phase shift", "ctbPattern::setDBitPhase")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setAdcPipeline() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,eAdcPipeline->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setADCPipeline(eAdcPipeline->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc pipeline", "ctbPattern::setAdcPipeline")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setDBitPipeline() {
|
||||
// cout <<"Not setting dbit pipeline to " << eDBitPipeline->GetNumber() << endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,eDBitPipeline->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setDBITPipeline(eDBitPipeline->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit pipeline", "ctbPattern::setDBitPipeline")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setAnalogSamples() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,eAnalogSamples->GetNumber());
|
||||
} catch (...) {
|
||||
try{
|
||||
myDet->setNumberOfAnalogSamples(eAnalogSamples->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of analog sampels", "ctbPattern::setAnalogSamples")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
analogSamplesChanged(eAnalogSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::setDigitalSamples() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,eDigitalSamples->GetNumber());
|
||||
} catch (...) {
|
||||
try{
|
||||
myDet->setNumberOfDigitalSamples(eDigitalSamples->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of digital samples", "ctbPattern::setDigitalSamples")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
digitalSamplesChanged(eDigitalSamples->GetNumber());
|
||||
}
|
||||
|
||||
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 {
|
||||
myDet->setReadOutFlags(flags);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
int flags = 0;
|
||||
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");
|
||||
}
|
||||
cout << "Set readout flags " << hex << flags << dec << endl;
|
||||
myDet->setReadoutMode(flags);
|
||||
cout << "Set readout flags: " << flags << endl;
|
||||
} CATCH_DISPLAY ("Could not set readout flags", "ctbPattern::setReadoutMode")
|
||||
|
||||
getReadoutMode();
|
||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
||||
//samplesChanged(eSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::readoutModeChanged(int flags) {
|
||||
@ -1188,70 +1034,55 @@ void ctbPattern::readoutModeChanged(int flags) {
|
||||
}
|
||||
|
||||
int ctbPattern::getReadoutMode() {
|
||||
// cout << "Get readout mode to be implemented" << endl;
|
||||
slsDetectorDefs::readOutFlags flags;
|
||||
try {
|
||||
flags=(slsDetectorDefs::readOutFlags) myDet->setReadOutFlags();
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
cout << "++++++++++++++++++++"<< hex << flags << dec << endl;
|
||||
if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
cout << "analog and digital" << hex << slsDetectorDefs::ANALOG_AND_DIGITAL << dec<< endl;
|
||||
try{
|
||||
auto retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
switch(retval) {
|
||||
case 2:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
} else if (flags&slsDetectorDefs::DIGITAL_ONLY) {
|
||||
cout << "digital only" << hex << slsDetectorDefs::DIGITAL_ONLY << dec << endl;
|
||||
break;
|
||||
case 1:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
}// else if (flags==slsDetectorDefs::NORMAL_READOUT) {
|
||||
// cbAnalog->SetOn(kTRUE);
|
||||
// cbDigital->SetOn(kFALSE);
|
||||
// }
|
||||
else {
|
||||
break;
|
||||
case 0:
|
||||
cout << "analog only" << endl;
|
||||
flags=slsDetectorDefs::NORMAL_READOUT;
|
||||
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")
|
||||
|
||||
Emit("readoutModeChanged(int)",(int)flags);
|
||||
return (int)flags;
|
||||
|
||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
||||
//samplesChanged(eSamples->GetNumber());
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getAnalogSamples() {
|
||||
int n;
|
||||
try {
|
||||
n=(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eAnalogSamples->SetNumber((Double_t)n);
|
||||
try{
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
eAnalogSamples->SetNumber((Double_t)retval);
|
||||
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
|
||||
return eAnalogSamples->GetNumber();
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
int n;
|
||||
try {
|
||||
|
||||
n=(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eDigitalSamples->SetNumber(((Double_t)n));
|
||||
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")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::analogSamplesChanged(const int t){
|
||||
|
@ -27,7 +27,10 @@ class energyCalibration;
|
||||
class TGTextButton;
|
||||
class TGTab;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
|
||||
#include <string>
|
||||
@ -46,10 +49,10 @@ class ctbLoop : public TGHorizontalFrame {
|
||||
|
||||
int id;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbLoop(TGGroupFrame *page, int i,multiSlsDetector *det);
|
||||
ctbLoop(TGGroupFrame *page, int i,sls::Detector *det);
|
||||
|
||||
void setNLoops();
|
||||
void update();
|
||||
@ -67,10 +70,10 @@ class ctbWait : public TGHorizontalFrame {
|
||||
|
||||
int id;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbWait(TGGroupFrame *page, int i,multiSlsDetector *det);
|
||||
ctbWait(TGGroupFrame *page, int i,sls::Detector *det);
|
||||
|
||||
void setWaitTime();
|
||||
void update();
|
||||
@ -122,11 +125,11 @@ private:
|
||||
|
||||
char pat[PATLEN*8];
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
|
||||
ctbPattern(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbPattern(TGVerticalFrame *page, sls::Detector *det);
|
||||
|
||||
void update();
|
||||
void setAdcFreq();
|
||||
|
@ -10,61 +10,48 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbDefs.h"
|
||||
#include "ctbDacs.h"
|
||||
#include "ctbPowers.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbPower::ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d)
|
||||
ctbPower::ctbPower(TGGroupFrame* f, int i, sls::Detector* d)
|
||||
: ctbDac(f, i, d)
|
||||
{
|
||||
cout << "****************************************************************power " << i << endl;
|
||||
dacsUnit->SetOn(kTRUE);
|
||||
dacsUnit->SetEnabled(kFALSE);
|
||||
int ii=0;
|
||||
|
||||
switch(i) {
|
||||
case slsDetectorDefs::V_POWER_IO:
|
||||
dacsLabel->SetText("VIO");
|
||||
ii=slsDetectorDefs::I_POWER_IO;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_A:
|
||||
dacsLabel->SetText("VA");
|
||||
ii=slsDetectorDefs::I_POWER_A;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_B:
|
||||
dacsLabel->SetText("VB");
|
||||
ii=slsDetectorDefs::I_POWER_B;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_C:
|
||||
dacsLabel->SetText("VC");
|
||||
ii=slsDetectorDefs::I_POWER_C;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_D:
|
||||
dacsLabel->SetText("VD");
|
||||
ii=slsDetectorDefs::I_POWER_D;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_CHIP:
|
||||
dacsLabel->SetText("VCHIP");
|
||||
dacsLabel->SetEnabled(kFALSE);
|
||||
ii=-1;
|
||||
break;
|
||||
default:
|
||||
dacsLabel->SetText("Bad index");
|
||||
ii=-1;
|
||||
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();
|
||||
e->Disconnect ("ReturnPressed()");
|
||||
@ -104,44 +91,45 @@ string ctbPower::getLabel() {
|
||||
}
|
||||
line << " " << dacsLabel->GetText() << endl;
|
||||
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() {
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
|
||||
|
||||
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, 1);
|
||||
try {
|
||||
myDet->setVoltage(dacsEntry->GetIntNumber(), static_cast<slsDetectorDefs::dacIndex>(id));
|
||||
} CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
|
||||
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ctbPower::getValue() {
|
||||
try {
|
||||
|
||||
int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, 1);
|
||||
char s[100];
|
||||
cout << "****************************Getting power " << val << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
||||
sprintf(s,"%d",val);
|
||||
dacsValue->SetText(s);
|
||||
if (val>0) {
|
||||
if (id!=slsDetectorDefs::V_POWER_CHIP)
|
||||
int val = myDet->getVoltage(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "****************************Getting power " << val << " " << id << " " << 1 << endl;
|
||||
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val > 0) {
|
||||
if (id != static_cast<int>(slsDetectorDefs::V_POWER_CHIP))
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@ -159,9 +147,8 @@ ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFr
|
||||
|
||||
int ctbPowers::setPwrAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
int is=-1;
|
||||
char tit[100];
|
||||
int narg;
|
||||
|
||||
if (sscanf(line.c_str(),"VA %s",tit)) {
|
||||
dacs[0]->setLabel(tit,1);
|
||||
@ -212,7 +199,6 @@ string ctbPowers::getPwrAlias() {
|
||||
|
||||
string ctbPowers::getPwrParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
line << "v_a" << " " << dacs[0]->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;
|
||||
// }
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbPowers::update() {
|
||||
|
||||
for (int idac=0; idac<NPOWERS; idac++) {
|
||||
|
||||
dacs[idac]->getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,7 @@
|
||||
|
||||
#include <TGFrame.h>
|
||||
|
||||
#ifndef CTB
|
||||
#define NPOWERS 0
|
||||
#else
|
||||
|
||||
#define NPOWERS 6
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -22,8 +15,10 @@ class TGCheckButton;
|
||||
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -36,7 +31,7 @@ class ctbPower : public ctbDac {
|
||||
|
||||
public:
|
||||
|
||||
ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d);
|
||||
ctbPower(TGGroupFrame* f, int i, sls::Detector* d);
|
||||
|
||||
string getLabel();
|
||||
|
||||
@ -54,11 +49,11 @@ class ctbPowers : public TGGroupFrame
|
||||
|
||||
ctbPower *dacs[NPOWERS];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
//ctbPowers();
|
||||
ctbPowers(TGVerticalFrame*, multiSlsDetector*);
|
||||
ctbPowers(TGVerticalFrame*, sls::Detector*);
|
||||
|
||||
int setPwrAlias(string);
|
||||
string getPwrAlias();
|
||||
|
@ -34,7 +34,8 @@
|
||||
|
||||
|
||||
#include "ctbSignals.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -43,7 +44,7 @@ using namespace std;
|
||||
//#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) {
|
||||
|
||||
|
||||
@ -178,10 +179,6 @@ int ctbSignal::fixOutput(int i) {
|
||||
|
||||
int ctbSignal::setDbitList(Long64_t r) {
|
||||
|
||||
Long64_t mask=((Long64_t)1<<id);
|
||||
|
||||
// cout << hex << r << dec <<endl;
|
||||
|
||||
if (r)
|
||||
sDbitList->SetOn(kTRUE,kFALSE);
|
||||
else
|
||||
@ -197,7 +194,6 @@ int ctbSignal::isPlot() { return sPlot->IsOn();}
|
||||
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
|
||||
|
||||
void ctbSignal::ToggledOutput(Bool_t b) {
|
||||
Long_t mask=b<<id;
|
||||
ToggledSignalOutput(id);
|
||||
if (b) {
|
||||
// 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) {
|
||||
|
||||
|
||||
@ -259,7 +255,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
|
||||
TGHorizontalFrame *hframe;
|
||||
char tit[100];
|
||||
|
||||
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
|
||||
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);
|
||||
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
hframe->MapWindow();
|
||||
@ -398,63 +363,68 @@ string ctbSignals::getSignalAlias() {
|
||||
|
||||
|
||||
void ctbSignals::update() {
|
||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
||||
// Long64_t creg=myDet->setPatternClockControl();//setCTBWord(-2,-1);
|
||||
try {
|
||||
|
||||
|
||||
char val[1000];
|
||||
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
cout << hex << oreg << dec << endl;
|
||||
// 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())
|
||||
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
|
||||
|
||||
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 {
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
||||
// 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() {
|
||||
|
||||
try {
|
||||
|
||||
auto val = myDet->getPatternIOControl().tsquash("Different values");
|
||||
ostringstream line;
|
||||
line << "patioctrl " << hex << myDet->setPatternIOControl() << dec << endl;//setCTBWord(-1,-1)
|
||||
line << "patioctrl " << hex << val << dec << endl;
|
||||
return line.str();
|
||||
|
||||
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::getSignalParameters")
|
||||
|
||||
return ("");
|
||||
}
|
||||
|
||||
void ctbSignals::ToggledOutReg(Int_t mask) {
|
||||
try {
|
||||
|
||||
char val[1000];
|
||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
||||
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
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;
|
||||
@ -464,55 +434,61 @@ void ctbSignals::ToggledOutReg(Int_t mask) {
|
||||
}
|
||||
cout << " after " << oreg << endl;
|
||||
|
||||
myDet->setPatternIOControl(oreg);//setCTBWord(-1,oreg);
|
||||
oreg=myDet->setPatternIOControl();//myDet->setCTBWord(-1,-1);
|
||||
|
||||
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;
|
||||
|
||||
sprintf(val,"%llX",oreg);
|
||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
||||
eIOCntrlRegister->SetText(val);
|
||||
// eIOCntrlRegister->SetNumber(oreg);
|
||||
eIOCntrlRegister->SetText(to_string(oreg).c_str());
|
||||
|
||||
} CATCH_DISPLAY ("Could not get/set patternIOcontrol.", "ctbSignals::ToggledOutReg")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbSignals::ToggledDbitList(Int_t mask){
|
||||
try {
|
||||
|
||||
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
|
||||
|
||||
cout << "************* Here" << endl;
|
||||
|
||||
|
||||
|
||||
std::vector <int> new_dbitlist;
|
||||
std::vector <int> old_dbitlist=myDet->getReceiverDbitList();
|
||||
|
||||
char val[1000];
|
||||
Long64_t m=((Long64_t)1)<<mask;
|
||||
|
||||
if (old_dbitlist.empty() && signals[mask]->isDbitList())
|
||||
// anyway all enabled
|
||||
if ((dbitlist.empty()) && (signals[mask]->isDbitList())) {
|
||||
;
|
||||
}
|
||||
// set the dbitlist
|
||||
else {
|
||||
int ns=0;
|
||||
std::vector <int> new_dbitlist;
|
||||
for (int is=0; is<64; is++) {
|
||||
if (signals[is]->isDbitList()){
|
||||
new_dbitlist.push_back(is);
|
||||
ns++;
|
||||
cout << is << " " << ns << endl;
|
||||
cout << is << " " << new_dbitlist.size() - 1 << endl;
|
||||
}
|
||||
}
|
||||
if (ns>63) new_dbitlist.clear();
|
||||
myDet->setReceiverDbitList(new_dbitlist);
|
||||
if (new_dbitlist.size() > 64)
|
||||
new_dbitlist.clear();
|
||||
myDet->setRxDbitList(new_dbitlist);
|
||||
// get list again
|
||||
dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
}
|
||||
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);
|
||||
|
||||
// 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/set receiver dbit list.", "ctbSignals::ToggledDbitList")
|
||||
}
|
||||
|
||||
|
||||
@ -533,16 +509,23 @@ void ctbSignals::ToggledSignalPlot(Int_t b) {
|
||||
|
||||
|
||||
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){
|
||||
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) {
|
||||
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 multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
class ctbSignal;
|
||||
|
||||
#include <string>
|
||||
@ -45,14 +48,14 @@ private:
|
||||
TGNumberEntry *sEntry;
|
||||
TGColorSelect *fColorSel;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
Int_t id;
|
||||
|
||||
TH1I *hsig;
|
||||
|
||||
public:
|
||||
|
||||
ctbSignal(TGFrame *page, int i, multiSlsDetector *det);
|
||||
ctbSignal(TGFrame *page, int i, sls::Detector *det);
|
||||
int setSignalAlias(char *tit, int plot, int col);
|
||||
string getSignalAlias();
|
||||
|
||||
@ -89,10 +92,10 @@ private:
|
||||
TGNumberEntry *eIOCntrlRegister;
|
||||
TGNumberEntry *eDbitOffset;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbSignals(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbSignals(TGVerticalFrame *page, sls::Detector *det);
|
||||
int setSignalAlias(string line);
|
||||
string getSignalAlias();
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
#include <TGButton.h>
|
||||
|
||||
#include "ctbSlowAdcs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
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;
|
||||
@ -55,9 +56,6 @@ ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TG
|
||||
b->SetTextJustify(kTextLeft);
|
||||
|
||||
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -66,38 +64,50 @@ int ctbSlowAdc::setLabel(char *tit) {
|
||||
if(tit)
|
||||
dacsLabel->SetText(tit);
|
||||
|
||||
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
string ctbSlowAdc::getLabel() {
|
||||
|
||||
ostringstream line;
|
||||
line << dacsLabel->GetText() << endl;
|
||||
|
||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ctbSlowAdc::getValue() {
|
||||
try {
|
||||
std::string s;
|
||||
|
||||
int val=myDet->getADC((slsDetectorDefs::dacIndex)id);
|
||||
char s[100];
|
||||
cout << "adc " << id << " " << val << endl;
|
||||
sprintf(s,"%d mV",val);
|
||||
if (id==999)
|
||||
sprintf(s,"%d °C",val);
|
||||
dacsValue->SetText(s);
|
||||
|
||||
// temp
|
||||
if (id == static_cast<int>(slsDetectorDefs::SLOW_ADC_TEMP)) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// 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);
|
||||
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;
|
||||
|
||||
|
||||
for (int idac=0; idac<NSLOWADCS; idac++) {
|
||||
for (int idac=0; idac<NSLOWADCS + 1; idac++) {
|
||||
|
||||
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
|
||||
|
||||
}
|
||||
adcs[NSLOWADCS]=new ctbSlowAdc(this, 999, myDet);
|
||||
adcs[NSLOWADCS]->setLabel("Temperature");
|
||||
|
||||
adcs[NSLOWADCS]->setLabel((char*)"Temperature");
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +140,7 @@ int ctbSlowAdcs::setSlowAdcAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
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)
|
||||
return -1;
|
||||
if (is>=0 && is<NSLOWADCS)
|
||||
@ -149,7 +156,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
||||
for (int i=0; i<NSLOWADCS; i++)
|
||||
line << adcs[i]->getLabel() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +163,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
||||
|
||||
string ctbSlowAdcs::getAdcParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
|
||||
for (int i=0; i<NSLOWADCS; i++) {
|
||||
@ -166,20 +171,12 @@ string ctbSlowAdcs::getAdcParameters() {
|
||||
}
|
||||
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbSlowAdcs::update() {
|
||||
|
||||
|
||||
for (int idac=0; idac<NSLOWADCS+1; idac++) {
|
||||
|
||||
adcs[idac]->getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,10 @@ class TGTextButton;
|
||||
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -35,9 +38,9 @@ class ctbSlowAdc : public TGHorizontalFrame {
|
||||
TGLabel *dacsValue;
|
||||
int id;
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
public:
|
||||
ctbSlowAdc(TGGroupFrame*, int , multiSlsDetector*);
|
||||
ctbSlowAdc(TGGroupFrame*, int , sls::Detector*);
|
||||
int getValue();
|
||||
|
||||
int setLabel(char *tit);
|
||||
@ -56,10 +59,10 @@ private:
|
||||
|
||||
ctbSlowAdc *adcs[NSLOWADCS+1];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector*);
|
||||
ctbSlowAdcs(TGVerticalFrame *page, sls::Detector*);
|
||||
|
||||
int setSlowAdcAlias(string line);
|
||||
// int setDacAlias(string line);
|
||||
|
@ -62,7 +62,7 @@ template <class dataType> class analogDetector {
|
||||
|
||||
|
||||
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)
|
||||
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) {
|
||||
double g=1.;
|
||||
double val;
|
||||
double val =0;
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
if (gmap) {
|
||||
g=gmap[iy*nx+ix];
|
||||
@ -927,6 +927,7 @@ template <class dataType> class analogDetector {
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
|
||||
@ -981,7 +982,7 @@ template <class dataType> class analogDetector {
|
||||
*/
|
||||
int *getNPhotons(char *data, int *nph=NULL) {
|
||||
|
||||
double val;
|
||||
//double val;
|
||||
if (nph==NULL)
|
||||
nph=image;
|
||||
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
|
||||
|
||||
*/
|
||||
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];
|
||||
mean2=new double[nROI];
|
||||
nCm=new double[nROI];
|
||||
@ -28,7 +28,7 @@ class commonModeSubtraction {
|
||||
/* } */
|
||||
|
||||
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*/
|
||||
|
@ -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) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
//int iarg;
|
||||
int64_t word, *wp;
|
||||
short unsigned int* val=new short unsigned int[nch];
|
||||
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) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
//int iarg;
|
||||
int64_t word, *wp;
|
||||
short unsigned int* val=new short unsigned int[nch];
|
||||
int bit[64];
|
||||
@ -57,7 +57,7 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
||||
int ioff=0;
|
||||
int idr=0;
|
||||
int ib=0;
|
||||
int ich=0;
|
||||
//int ich=0;
|
||||
int ii=0;
|
||||
int iw=0;
|
||||
bit[0]=17;//19;
|
||||
|
@ -8,9 +8,9 @@ class deserializer : public slsDetectorData<int> {
|
||||
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;};
|
||||
|
||||
@ -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) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
//int iarg;
|
||||
int64_t word, *wp;
|
||||
int* val=new int[nch];
|
||||
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) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
int64_t word;
|
||||
//int iarg;
|
||||
// int64_t word;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
//int ioff=0;
|
||||
int idr=0;
|
||||
int ib=0;
|
||||
int iw=0;
|
||||
@ -129,7 +129,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
ib=0;
|
||||
ich=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ioff=off;
|
||||
//ioff=off;
|
||||
idr=0;
|
||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||
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 > 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; */
|
||||
/* if (nas && nds) */
|
||||
@ -46,13 +46,13 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
|
||||
int row, col;
|
||||
|
||||
int isample;
|
||||
//int isample;
|
||||
int iadc;
|
||||
int ix, iy;
|
||||
// int ix, iy;
|
||||
|
||||
int npackets=40;
|
||||
// int npackets=40;
|
||||
int i;
|
||||
int adc4(0);
|
||||
//int adc4(0);
|
||||
|
||||
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 aoff=aSamples*2*32;
|
||||
// int aoff=aSamples*2*32;
|
||||
int irow;
|
||||
int isc=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) {
|
||||
char *retval=0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
// char *retval=0;
|
||||
// int nd;
|
||||
// int fnum = -1;
|
||||
np=0;
|
||||
int pn;
|
||||
//int pn;
|
||||
|
||||
// cout << dataSize << endl;
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, dataSize) ){
|
||||
|
@ -28,20 +28,20 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
||||
\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 row, col;
|
||||
|
||||
int isample;
|
||||
//int isample;
|
||||
int iadc;
|
||||
int ix, iy;
|
||||
//int ix, iy;
|
||||
|
||||
int npackets=40;
|
||||
// int npackets=40;
|
||||
int i;
|
||||
int adc4(0);
|
||||
//int adc4(0);
|
||||
|
||||
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) {
|
||||
char *retval=0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
// char *retval=0;
|
||||
//int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
int pn;
|
||||
//int pn;
|
||||
|
||||
// cout << dataSize << endl;
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, dataSize) ){
|
||||
|
@ -28,13 +28,13 @@ template <class dataType> class ghostSummation {
|
||||
~ghostSummation() {delete [] ghost;};
|
||||
|
||||
virtual ghostSummation *Clone() {
|
||||
new ghostSummation(this);
|
||||
return new ghostSummation(this);
|
||||
}
|
||||
|
||||
double getXTalk(){return xtalk;};
|
||||
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){
|
||||
for (int iy=0; iy<ny; iy++)
|
||||
|
@ -58,7 +58,7 @@ public analogDetector<uint16_t> {
|
||||
int sign=1,
|
||||
commonModeSubtraction *cm=NULL,
|
||||
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];
|
||||
|
||||
double rest[ny][nx];
|
||||
int cy=(clusterSizeY+1)/2; //quad size
|
||||
int cs=(clusterSize+1)/2; //quad size
|
||||
//int cy=(clusterSizeY+1)/2; //quad size
|
||||
//int cs=(clusterSize+1)/2; //quad size
|
||||
|
||||
int ccs=clusterSize; //cluster size
|
||||
int ccy=clusterSizeY; //cluster size
|
||||
//int ccs=clusterSize; //cluster size
|
||||
//int ccy=clusterSizeY; //cluster size
|
||||
|
||||
double g=1.;
|
||||
//double g=1.;
|
||||
|
||||
|
||||
double tthr=thr, tthr1, tthr2;
|
||||
@ -201,10 +201,10 @@ public analogDetector<uint16_t> {
|
||||
if (cmSub) cm=1;
|
||||
|
||||
if (thr>0) {
|
||||
cy=1;
|
||||
cs=1;
|
||||
ccs=1;
|
||||
ccy=1;
|
||||
//cy=1;
|
||||
//cs=1;
|
||||
//ccs=1;
|
||||
//ccy=1;
|
||||
}
|
||||
if (iframe<nDark) {
|
||||
// cout << "ped " << iframe << endl;
|
||||
@ -349,9 +349,9 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
double val[ny][nx];
|
||||
int cy=(clusterSizeY+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 good=1;
|
||||
if (cmSub) cm=1;
|
||||
|
@ -211,7 +211,7 @@ class single_photon_hit {
|
||||
|
||||
void print() {
|
||||
|
||||
int ix, iy;
|
||||
// int ix, iy;
|
||||
|
||||
for (int iy=0; iy<dy; iy++) {
|
||||
for (int ix=0; ix<dx; ix++) {
|
||||
|
@ -4,20 +4,20 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
// #undef cbf_failnez
|
||||
// #define cbf_failnez(x) \
|
||||
// { \
|
||||
// int err; \
|
||||
// err = (x); \
|
||||
// if (err) { \
|
||||
// fprintf(stderr,"\nCBFlib fatal error %x \n",err); \
|
||||
// exit(-1); \
|
||||
// } \
|
||||
// #define cbf_failnez(x)
|
||||
// {
|
||||
// int err;
|
||||
// err = (x);
|
||||
// if (err) {
|
||||
// fprintf(stderr,"\nCBFlib fatal error %x \n",err);
|
||||
// exit(-1);
|
||||
// }
|
||||
// }
|
||||
|
||||
void *WriteToTiff(float * imgData, const char * imgname, int nrow, int ncol){
|
||||
int sampleperpixel=1;
|
||||
// unsigned char * buff=NULL;
|
||||
tsize_t linebytes;
|
||||
//tsize_t linebytes;
|
||||
// cout << "--" <<endl;
|
||||
TIFF * tif = TIFFOpen(imgname,"w");
|
||||
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_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
|
||||
|
||||
linebytes = sampleperpixel*ncol;
|
||||
//linebytes = sampleperpixel*ncol;
|
||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
||||
for(int irow=0; irow<nrow; irow++){
|
||||
TIFFWriteScanline(tif,&imgData[irow*ncol],irow,0);
|
||||
@ -50,7 +50,7 @@ float *ReadFromTiff( const char * imgname, uint32 &nrow, uint32 &ncol){
|
||||
if (tif){
|
||||
uint32 bps;
|
||||
uint32 sampleperpixel=1;
|
||||
tsize_t linebytes;
|
||||
//tsize_t linebytes;
|
||||
|
||||
uint32 imagelength;
|
||||
|
||||
@ -61,9 +61,9 @@ float *ReadFromTiff( const char * imgname, uint32 &nrow, uint32 &ncol){
|
||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
|
||||
|
||||
float * imgData=new float[ncol*nrow];
|
||||
linebytes = sampleperpixel*ncol;
|
||||
//linebytes = sampleperpixel*ncol;
|
||||
// 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,&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 {
|
||||
return pimpl->Parallel(&slsDetector::setFileName, pos, "");
|
||||
return pimpl->Parallel(&slsDetector::getFileName, pos);
|
||||
}
|
||||
|
||||
void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setFileName, pos, fname);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user