diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 6f29795..752f235 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -20,7 +20,7 @@ enum MenuIdentifiers{ - M_DIGITIZER_SCAN, + M_DIGITIZER_OPEN, M_FILE_OPEN, M_EXIT, M_TRIGGER_SUMMARY, @@ -60,7 +60,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0)); fMenuDigitizers = new TGPopupMenu(gClient->GetRoot()); - fMenuDigitizers->AddEntry("Scan &Digitizers", M_DIGITIZER_SCAN); + fMenuDigitizers->AddEntry("&Open Digitizers", M_DIGITIZER_OPEN); fMenuDigitizers->AddEntry("&Trigger Summary", M_TRIGGER_SUMMARY); fMenuDigitizers->AddSeparator(); fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS); @@ -89,7 +89,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { ///================= Open digitizers TGTextButton *bOpenDigitizers = new TGTextButton(hframe,"Open Digitizers"); - bOpenDigitizers->Connect("Clicked()","MainWindow",this,"DetectDigitizer()"); + bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()"); hframe->AddFrame(bOpenDigitizers, uniLayoutHints); ///================= Start Run @@ -136,7 +136,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { LogMsg("Please \"Open Digitizers\" to start."); - //HandleMenu(M_DIGITIZER_SCAN); + //HandleMenu(M_DIGITIZER_OPEN); // //HandleMenu(M_BOARD_SETTINGS); //HandleMenu(M_CH_SETTING_PHA); @@ -175,42 +175,13 @@ void MainWindow::HandleMenu(Int_t id){ switch(id){ ///========================= Scan digitizers - case M_DIGITIZER_SCAN:{ + case M_DIGITIZER_OPEN:{ - LogMsg("============= detect digitizers \n"); - DetectDigitizer(); - printf("============= Connect %d digitizers...\n", nDigi); + OpenDigitizers(); - if( nDigi > 0 ) { - - digi = new Digitizer * [nDigi]; - - //pha = new DigitizerPHA * [nPHA]; - //psd = new DigitizerPHA * [nPSD]; - // - //iPHA = 0; - //iPSD = 0; - - for( int i = 0; i < nDigi; i++){ - printf("------------ %d \n", i); - if( DPPType[i] == V1730_DPP_PSD_CODE ) { - digi[i] = new DigitizerPSD(boardID[i], portID[i]); - printf("Open as PSD\n"); - }else if( DPPType[i] == V1730_DPP_PHA_CODE ){ - digi[i] = new DigitizerPHA(boardID[i], portID[i]); - printf("Open as PHA\n"); - }else{ - digi[i] = new Digitizer(boardID[i], portID[i]); - printf("Open as Ordinary Digitizer\n"); - } - digi[i]->CreateAndSaveSettingBinary("setting_" + to_string(digi[i]->GetSerialNumber()) + ".bin"); - } - - //fMenuDigitizers->EnableEntry( M_TRIGGER_SUMMARY); - //fMenuDigitizers->EnableEntry( M_BOARD_SETTINGS); - //fMenuDigitizers->EnableEntry( M_CH_SETTING); - - } + //fMenuDigitizers->EnableEntry( M_TRIGGER_SUMMARY); + //fMenuDigitizers->EnableEntry( M_BOARD_SETTINGS); + //fMenuDigitizers->EnableEntry( M_CH_SETTING); }break; @@ -277,8 +248,9 @@ void MainWindow::HandleMenu(Int_t id){ } -void MainWindow::DetectDigitizer(){ +void MainWindow::OpenDigitizers(){ + LogMsg("============= detect digitizers \n"); DPPType.clear(); portID.clear(); boardID.clear(); @@ -302,13 +274,42 @@ void MainWindow::DetectDigitizer(){ } } - LogMsg(Form("========== found %d digitizer \n", nDigi)); + LogMsg(Form("========== found %d digitizer", nDigi)); for( int i = 0 ; i < nDigi ; i++){ - LogMsg(Form("port: %d, board: %d, DPP Type : %d \n", portID[i], boardID[i], DPPType[i])); + LogMsg(Form("port: %d, board: %d, DPP Type : %d", portID[i], boardID[i], DPPType[i])); } - LogMsg(Form("Number of PHA : %d \n", nPHA)); - LogMsg(Form("Number of PSD : %d \n", nPSD)); + LogMsg(Form("Number of PHA : %d", nPHA)); + LogMsg(Form("Number of PSD : %d", nPSD)); + + if( nDigi > 0 ) { + LogMsg(Form("============= Connect %d digitizers...", nDigi)); + + digi = new Digitizer * [nDigi]; + + //pha = new DigitizerPHA * [nPHA]; + //psd = new DigitizerPHA * [nPSD]; + // + //iPHA = 0; + //iPSD = 0; + + for( int i = 0; i < nDigi; i++){ + printf("------------ %d \n", i); + if( DPPType[i] == V1730_DPP_PSD_CODE ) { + digi[i] = new DigitizerPSD(boardID[i], portID[i]); + printf("Open as PSD\n"); + }else if( DPPType[i] == V1730_DPP_PHA_CODE ){ + digi[i] = new DigitizerPHA(boardID[i], portID[i]); + printf("Open as PHA\n"); + }else{ + digi[i] = new Digitizer(boardID[i], portID[i]); + printf("Open as Ordinary Digitizer\n"); + } + digi[i]->CreateAndSaveSettingBinary("setting_" + to_string(digi[i]->GetSerialNumber()) + ".bin"); + } + + } + } Double_t standardPulse(Double_t *x, Double_t * par){ diff --git a/FSUDAQ.h b/FSUDAQ.h index f1f846d..27056b0 100644 --- a/FSUDAQ.h +++ b/FSUDAQ.h @@ -78,7 +78,7 @@ public: void HandleMenu(Int_t id); - void DetectDigitizer(); + void OpenDigitizers(); //void GetADCTrace(); //void GetBaseLine(); diff --git a/settingSummary.h b/settingSummary.h new file mode 100644 index 0000000..e3dbeb5 --- /dev/null +++ b/settingSummary.h @@ -0,0 +1,29 @@ +#ifndef SETTING_SUMMARY_H +#define SETTING_SUMMARY_H + +#include +#include +#include +#include +#include +#include +#include +#include "DigitizerPHA.h" +#include "DigitizerPSD.h" +#include "macro.h" + +class TGWindow; +class TGMainFrame; + +class SettingSummary{ + + private: + + + public: + SettingSummary(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address); + virtual ~SettingSummary(); + +} + +#endif