added save data

This commit is contained in:
carina@hades 2022-10-03 14:35:56 -04:00
parent d119ebefd4
commit 3d4a621c94
2 changed files with 14 additions and 11 deletions

View File

@ -60,6 +60,8 @@ 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;
TGNumberEntry * MainWindow::runIDEntry;
TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL}; TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL};
TH1F * MainWindow::hChannel[MaxNBoards] = {NULL}; TH1F * MainWindow::hChannel[MaxNBoards] = {NULL};
@ -446,17 +448,12 @@ void MainWindow::StartRun(){
bPlotSingleTrace->SetEnabled(false); bPlotSingleTrace->SetEnabled(false);
bFitTrace->SetEnabled(false); bFitTrace->SetEnabled(false);
if( cbMode->GetSelected() == Mode_DataRun ) cbMode->SetEnabled(false);
digi[0]->StartACQ(); digi[0]->StartACQ();
if( digi[0]->IsRunning() ) { if( digi[0]->IsRunning() ) fillHistThread->Run();
int mode = cbMode->GetSelected();
if( mode == Mode_DataRun){
}else{
fillHistThread->Run();
}
}
} }
void MainWindow::StopRun(){ void MainWindow::StopRun(){
@ -471,6 +468,7 @@ void MainWindow::StopRun(){
runIDEntry->SetState(true); runIDEntry->SetState(true);
bPlotSingleTrace->SetEnabled(true); bPlotSingleTrace->SetEnabled(true);
bFitTrace->SetEnabled(true); bFitTrace->SetEnabled(true);
cbMode->SetEnabled(true);
if( cbMode->GetSelected() == Mode_DataRun ){ if( cbMode->GetSelected() == Mode_DataRun ){
int runID = runIDEntry->GetNumber(); int runID = runIDEntry->GetNumber();
@ -647,6 +645,11 @@ void * MainWindow::FillHistogram(void * ptr){
uint32_t CurrentTime = 0; uint32_t CurrentTime = 0;
uint32_t ElapsedTime = 0; uint32_t ElapsedTime = 0;
TString dataFileName = dataPrefix->GetText();
dataFileName += Form("_run_%03d.bin", (int) runIDEntry->GetNumber());
printf("|%s|\n", dataFileName.Data());
Data * data = digi[boardID]->GetData(); Data * data = digi[boardID]->GetData();
data->AllocateMemory(); data->AllocateMemory();
@ -664,7 +667,7 @@ void * MainWindow::FillHistogram(void * ptr){
if( cbMode->GetSelected() == Mode_DataRun ){ if( cbMode->GetSelected() == Mode_DataRun ){
// Rate graph? // Rate graph?
data->SaveBuffer(dataFileName.Data());
}else{ }else{

View File

@ -46,8 +46,8 @@ private:
TGTextButton *bStartRun; TGTextButton *bStartRun;
TGTextButton *bStopRun; TGTextButton *bStopRun;
static TGComboBox* cbMode; static TGComboBox* cbMode;
TGTextEntry * dataPrefix; static TGTextEntry * dataPrefix;
TGNumberEntry * runIDEntry; static TGNumberEntry * runIDEntry;
TGTextButton *bPlotSingleTrace; TGTextButton *bPlotSingleTrace;
TGTextButton *bFitTrace; TGTextButton *bFitTrace;