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
BufferSize = 10* 1024* 1024; /// 10M byte
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);
///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){
this->buffer = buffer;
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::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::MaxAggregatePerBlockTransfer, 40);
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::chIDEntry = NULL;
TGComboBox* MainWindow::cbMode = NULL;
TGTextEntry * MainWindow::dataPrefix;
TGNumberEntry * MainWindow::runIDEntry;
TGTextEntry * MainWindow::dataPrefix = NULL;
TGNumberEntry * MainWindow::runIDEntry = NULL;
BoardSetting * MainWindow::boardSetting = NULL;
TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL};
TH1F * MainWindow::hChannel[MaxNBoards] = {NULL};
@ -416,7 +418,7 @@ void MainWindow::OpenDigitizers(){
bStartRun->SetEnabled(true);
if( nDigi <= 1) boardIDEntry->SetState(true);
if( nDigi > 1) boardIDEntry->SetState(true);
chIDEntry->SetState(true);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi-1);
@ -499,9 +501,16 @@ void MainWindow::StartRun(){
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();
}
@ -509,12 +518,12 @@ void MainWindow::StopRun(){
LogMsg(Form("%s",__func__));
if( digi == NULL) return;
digi[0]->StopACQ();
//Save last bit of buffer;
for( int i = 0; i < nDigi; i++){
digi[i]->StopACQ();
//Save last bit of buffer
///===== clear data;
digi[0]->GetData()->ClearTriggerRate();
digi[i]->GetData()->ClearTriggerRate();
}
bStartRun->SetEnabled(true);
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){
printf("=== %s\n", __func__);
if( digi == NULL ) return 0;
//int boardID = boardIDEntry->GetNumber();
//int ch = chIDEntry->GetNumber();
int boardID = 0;
int boardID = boardIDEntry->GetNumber();
int ch = 0;
int ch2ns = 4;
int traceLength = 0;
@ -710,6 +718,7 @@ void * MainWindow::FillHistogram(void * ptr){
usleep(100*1000); /// wait 100 msec
digi[boardID]->ReadData();
if( boardSetting != NULL ) boardSetting->ReadStatus();
ch2ns = (int) digi[boardID]->GetCh2ns();
ch = chIDEntry->GetNumber();

View File

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

View File

@ -185,7 +185,6 @@ namespace Register {
const uint32_t EarlyBaselineFreeze = 0x10D8; /// R/W
}
}
}
#endif

View File

@ -731,6 +731,14 @@ void BoardSetting::LogMsg(TString msg){
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(){
if( digi == NULL ) return;
@ -738,7 +746,7 @@ void BoardSetting::ReadStatus(){
/// 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);
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
///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 ){
txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue);
}else{

View File

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