small improvements of UI

This commit is contained in:
carina@hades 2022-10-07 17:03:27 -04:00
parent 4d3ced9b48
commit e556977729
7 changed files with 42 additions and 23 deletions

View File

@ -104,7 +104,7 @@ inline void Data::AllocateMemory(){
//TODO calculate Suitable buffer size //TODO calculate Suitable buffer size
BufferSize = 10* 1024* 1024; /// 10M byte BufferSize = 10* 1024* 1024; /// 10M byte
buffer = (char *) malloc( BufferSize); buffer = (char *) malloc( BufferSize);
printf("Allocated %d (%lu) byte for buffer \n", BufferSize, sizeof(buffer)); printf("Allocated %d byte for buffer \n", BufferSize);
///for( int i = 0 ; i < MaxNChannels ; i++ ) Events[i] = (CAEN_DGTZ_DPP_PHA_Event_t *) malloc( BufferSize); ///for( int i = 0 ; i < MaxNChannels ; i++ ) Events[i] = (CAEN_DGTZ_DPP_PHA_Event_t *) malloc( BufferSize);
///printf("Allocated %d byte for Events for each channel \n", BufferSize); ///printf("Allocated %d byte for Events for each channel \n", BufferSize);
@ -191,6 +191,7 @@ inline void Data::PrintBuffer(){
} }
//####################################################### Decode
inline void Data::DecodeBuffer(char * buffer, bool fastDecode, int verbose){ inline void Data::DecodeBuffer(char * buffer, bool fastDecode, int verbose){
this->buffer = buffer; this->buffer = buffer;
DecodeBuffer(fastDecode, verbose); DecodeBuffer(fastDecode, verbose);

View File

@ -679,7 +679,7 @@ int Digitizer::ProgramPHABoard(){
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::PreTrigger + 0x7000 , 124 ); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::PreTrigger + 0x7000 , 124 );
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::InputDynamicRange + 0x7000 , 0x0 ); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::InputDynamicRange + 0x7000 , 0x0 );
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::NumberEventsPerAggregate_G + 0x7000, 100); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::NumberEventsPerAggregate_G + 0x7000, 511);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::AggregateOrganization, 0); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::AggregateOrganization, 0);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::MaxAggregatePerBlockTransfer, 40); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::MaxAggregatePerBlockTransfer, 40);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::DPPAlgorithmControl + 0x7000, 0xe30200f); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::DPPAlgorithmControl + 0x7000, 0xe30200f);

View File

@ -62,8 +62,10 @@ TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
TGNumberEntry * MainWindow::boardIDEntry = NULL; TGNumberEntry * MainWindow::boardIDEntry = NULL;
TGNumberEntry * MainWindow::chIDEntry = NULL; TGNumberEntry * MainWindow::chIDEntry = NULL;
TGComboBox* MainWindow::cbMode = NULL; TGComboBox* MainWindow::cbMode = NULL;
TGTextEntry * MainWindow::dataPrefix; TGTextEntry * MainWindow::dataPrefix = NULL;
TGNumberEntry * MainWindow::runIDEntry; TGNumberEntry * MainWindow::runIDEntry = NULL;
BoardSetting * MainWindow::boardSetting = NULL;
TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL}; TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL};
TH1F * MainWindow::hChannel[MaxNBoards] = {NULL}; TH1F * MainWindow::hChannel[MaxNBoards] = {NULL};
@ -416,7 +418,7 @@ void MainWindow::OpenDigitizers(){
bStartRun->SetEnabled(true); bStartRun->SetEnabled(true);
if( nDigi <= 1) boardIDEntry->SetState(true); if( nDigi > 1) boardIDEntry->SetState(true);
chIDEntry->SetState(true); chIDEntry->SetState(true);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi-1); boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi-1);
@ -499,22 +501,29 @@ void MainWindow::StartRun(){
if( cbMode->GetSelected() == Mode_DataRun ) cbMode->SetEnabled(false); if( cbMode->GetSelected() == Mode_DataRun ) cbMode->SetEnabled(false);
digi[0]->StartACQ();
if( digi[0]->IsRunning() ) fillHistThread->Run(); bool threadFlag = false;
for( int i = 0 ; i < nDigi; i++) {
digi[i]->StartACQ();
if( digi[i]->IsRunning() ) threadFlag = true;
}
if( threadFlag ) fillHistThread->Run();
if( boardSetting != NULL ) boardSetting->ReadStatus();
} }
void MainWindow::StopRun(){ void MainWindow::StopRun(){
LogMsg(Form("%s",__func__)); LogMsg(Form("%s",__func__));
if( digi == NULL) return; if( digi == NULL) return;
digi[0]->StopACQ(); for( int i = 0; i < nDigi; i++){
digi[i]->StopACQ();
//Save last bit of buffer; //Save last bit of buffer
///===== clear data;
///===== clear data; digi[i]->GetData()->ClearTriggerRate();
digi[0]->GetData()->ClearTriggerRate(); }
bStartRun->SetEnabled(true); bStartRun->SetEnabled(true);
bStopRun->SetEnabled(false); bStopRun->SetEnabled(false);
@ -682,14 +691,13 @@ void MainWindow::FitTrace(){
} }
//TODO use the ptr to tell which board, and each digitizer has an indivual thread for savign data and filling hists.
void * MainWindow::FillHistogram(void * ptr){ void * MainWindow::FillHistogram(void * ptr){
printf("=== %s\n", __func__); printf("=== %s\n", __func__);
if( digi == NULL ) return 0; if( digi == NULL ) return 0;
//int boardID = boardIDEntry->GetNumber(); int boardID = boardIDEntry->GetNumber();
//int ch = chIDEntry->GetNumber();
int boardID = 0;
int ch = 0; int ch = 0;
int ch2ns = 4; int ch2ns = 4;
int traceLength = 0; int traceLength = 0;
@ -710,6 +718,7 @@ void * MainWindow::FillHistogram(void * ptr){
usleep(100*1000); /// wait 100 msec usleep(100*1000); /// wait 100 msec
digi[boardID]->ReadData(); digi[boardID]->ReadData();
if( boardSetting != NULL ) boardSetting->ReadStatus();
ch2ns = (int) digi[boardID]->GetCh2ns(); ch2ns = (int) digi[boardID]->GetCh2ns();
ch = chIDEntry->GetNumber(); ch = chIDEntry->GetNumber();

View File

@ -57,7 +57,7 @@ private:
vector<int> serialNum; vector<int> serialNum;
static Digitizer ** digi; static Digitizer ** digi;
BoardSetting * boardSetting; static BoardSetting * boardSetting;
ChannelSettingPHA * channelSettingPHA; ChannelSettingPHA * channelSettingPHA;
ChannelSettingPSD * channelSettingPSD; ChannelSettingPSD * channelSettingPSD;
RegisterSetting * registerSetting; RegisterSetting * registerSetting;

View File

@ -184,8 +184,7 @@ namespace Register {
const uint32_t DPPAlgorithmControl2_G = 0x1084; /// R/W const uint32_t DPPAlgorithmControl2_G = 0x1084; /// R/W
const uint32_t EarlyBaselineFreeze = 0x10D8; /// R/W const uint32_t EarlyBaselineFreeze = 0x10D8; /// R/W
} }
} }
} }
#endif #endif

View File

@ -731,6 +731,14 @@ void BoardSetting::LogMsg(TString msg){
Emit("LogMsg(char*)", msg.Data()); Emit("LogMsg(char*)", msg.Data());
} }
void BoardSetting::DisableEdit(){ // When ACQ is running, disable all control
}
void BoardSetting::EnableEdit(){ // When ACQ is running, disable all control
}
void BoardSetting::ReadStatus(){ void BoardSetting::ReadStatus(){
if( digi == NULL ) return; if( digi == NULL ) return;
@ -738,7 +746,7 @@ void BoardSetting::ReadStatus(){
/// ACQ Status /// ACQ Status
///digi[boardID]->PrintRegister(Register::DPP::AcquisitionStatus, "ACQ Status"); ///digi[boardID]->PrintRegister(Register::DPP::AcquisitionStatus, "ACQ Status");
uint32_t temp = digi[boardID]->GetSettingFromMemory(Register::DPP::AcquisitionStatus_R); uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::AcquisitionStatus_R);
txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue); txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue);
txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events", false); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue); txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events", false); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue);
@ -759,7 +767,7 @@ void BoardSetting::ReadStatus(){
/// Redaout Status /// Redaout Status
///digi[boardID]->PrintRegister(Register::DPP::ReadoutStatus, "Readout Status"); ///digi[boardID]->PrintRegister(Register::DPP::ReadoutStatus, "Readout Status");
temp = digi[boardID]->GetSettingFromMemory(Register::DPP::ReadoutStatus_R); temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus_R);
if( (temp & 0x1) == 1 ){ if( (temp & 0x1) == 1 ){
txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue); txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue);
}else{ }else{

View File

@ -134,6 +134,8 @@ class BoardSetting{
void CloseWindow() { delete this;} void CloseWindow() { delete this;}
void ChangeBoard(); void ChangeBoard();
void DisableEdit();
void EnableEdit();
void ReadStatus(); void ReadStatus();