FSUDAQ/boardSetting.cpp
2022-08-23 13:43:05 -04:00

118 lines
4.6 KiB
C++

#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGTableContainer.h>
#include <TGFileDialog.h>
#include "boardSetting.h"
TString boardSettingName[NUM_BOARD_SETTING] = {
"Model",
"Board Info",
"Link Type",
"Serial Number",
"Number of channels",
"Sampling rate",
"ADC bit",
"ROC version",
"AMC version",
"Channel Enable Mask",
"Board Config",
"Aggregate Organization",
"Max Num. Of Aggregate Per Block Transfer",
"Acquisition Control",
"Acquisition Status",
"Global Trigger Mask",
"Disable External Trigger",
"Trigger Validation Mask",
"Extended Veto Delay",
"Front Panel TRG-OUT Enable Mask",
"Front Panel IO Control",
"Front Panel LVDS IO New Features",
"LVDS IO Data",
"AnalogMonitor Mode",
"FanSpeed Control",
"Readout Control",
"Readout Status"
};
BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){
this->digi = digi;
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Board Settings ");
fMain->Connect("CloseWindow()", "BoardSetting", this, "CloseWindow()");
TGVerticalFrame * vframe = new TGVerticalFrame(fMain);
fMain->AddFrame(vframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
///==========Module choose
TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 );
vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
TGLabel * lb0 = new TGLabel(hframe0, "Board ID :");
hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
boardIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
boardIDEntry->SetWidth(50);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard);
boardIDEntry->Connect("Modified()", "BoardSetting", this, "ChangeBoard()");
if( nBoard <= 1 ) boardIDEntry->SetState(false);
hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
int modID = boardIDEntry->GetNumber();
int comboBoxWidth = 135;
int comboBoxHeigth = 30;
TGHorizontalFrame *hframe[NUM_BOARD_SETTING];
TGLabel * lb[NUM_BOARD_SETTING];
for( int i = 0 ; i < NUM_BOARD_SETTING; i++){
hframe[i] = new TGHorizontalFrame(vframe, 50, 50 );
vframe->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2));
//int temp = digi[0]->GetSerialNumber();
int temp = 0;
lb[i] = new TGLabel(hframe[i], boardSettingName[i]);
hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 3, 4));
entry[i] = new TGTextEntry(hframe[i], new TGTextBuffer(1));
entry[i]->SetEnabled(false);
entry[i]->SetText( Form("0x%x", temp) );
hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4));
}
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
isOpened = true;
}
BoardSetting::~BoardSetting(){
isOpened = false;
delete boardIDEntry;
//delete entry;
/// fMain must be delete last;
fMain->Cleanup();
delete fMain;
}
void BoardSetting::ChangeBoard(){
int boardID = boardIDEntry->GetNumber();
return;
}