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::chIDEntry = NULL;
TGComboBox* MainWindow::cbMode = NULL;
TGTextEntry * MainWindow::dataPrefix;
TGNumberEntry * MainWindow::runIDEntry;
TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL};
TH1F * MainWindow::hChannel[MaxNBoards] = {NULL};
@ -446,17 +448,12 @@ void MainWindow::StartRun(){
bPlotSingleTrace->SetEnabled(false);
bFitTrace->SetEnabled(false);
if( cbMode->GetSelected() == Mode_DataRun ) cbMode->SetEnabled(false);
digi[0]->StartACQ();
if( digi[0]->IsRunning() ) {
int mode = cbMode->GetSelected();
if( digi[0]->IsRunning() ) fillHistThread->Run();
if( mode == Mode_DataRun){
}else{
fillHistThread->Run();
}
}
}
void MainWindow::StopRun(){
@ -471,6 +468,7 @@ void MainWindow::StopRun(){
runIDEntry->SetState(true);
bPlotSingleTrace->SetEnabled(true);
bFitTrace->SetEnabled(true);
cbMode->SetEnabled(true);
if( cbMode->GetSelected() == Mode_DataRun ){
int runID = runIDEntry->GetNumber();
@ -647,6 +645,11 @@ void * MainWindow::FillHistogram(void * ptr){
uint32_t CurrentTime = 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->AllocateMemory();
@ -664,7 +667,7 @@ void * MainWindow::FillHistogram(void * ptr){
if( cbMode->GetSelected() == Mode_DataRun ){
// Rate graph?
data->SaveBuffer(dataFileName.Data());
}else{

View File

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