clean up FSQDAQ.h/cpp a bit
This commit is contained in:
parent
58cb570542
commit
f29dfb1438
164
FSUDAQ.cpp
164
FSUDAQ.cpp
|
@ -36,80 +36,100 @@ enum MenuIdentifiers{
|
|||
};
|
||||
///make static members
|
||||
Digitizer ** MainWindow::digi = NULL;
|
||||
DigitizerPHA ** MainWindow::pha = NULL;
|
||||
DigitizerPSD ** MainWindow::psd = NULL;
|
||||
TGTextEdit * MainWindow::teLog = NULL;
|
||||
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
|
||||
|
||||
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||
|
||||
nDigi = 0;
|
||||
nPSD = 0;
|
||||
nPHA = 0;
|
||||
|
||||
/// Create a main frame
|
||||
fMain = new TGMainFrame(p,w,h);
|
||||
///fMain->SetWMPosition(500, 500); //does not work
|
||||
fMain->Connect("CloseWindow()", "MainWindow", this, "GoodBye()");
|
||||
///======================= menu
|
||||
fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame);
|
||||
fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
|
||||
fMenuFile = new TGPopupMenu(gClient->GetRoot());
|
||||
fMenuFile->AddEntry("&Open File", M_FILE_OPEN);
|
||||
fMenuFile->AddSeparator();
|
||||
fMenuFile->AddEntry("E&xit", M_EXIT);
|
||||
fMenuFile->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
||||
fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
||||
|
||||
fMenuDigitizers = new TGPopupMenu(gClient->GetRoot());
|
||||
fMenuDigitizers->AddEntry("&Open Digitizers", M_DIGITIZER_OPEN);
|
||||
fMenuDigitizers->AddEntry("&Load Settings", M_LOAD_SETTINGS);
|
||||
fMenuDigitizers->AddEntry("&Trigger Summary", M_TRIGGER_SUMMARY);
|
||||
fMenuDigitizers->AddSeparator();
|
||||
fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS);
|
||||
fMenuDigitizers->AddEntry("&Channel Settings (PHA)", M_CH_SETTING_PHA);
|
||||
fMenuDigitizers->AddEntry("&Channel Settings (PSD)", M_CH_SETTING_PSD);
|
||||
fMenuDigitizers->AddSeparator();
|
||||
fMenuDigitizers->AddEntry("&Program Settings", M_PROGRAM_SETTINGS);
|
||||
fMenuDigitizers->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
||||
fMenuBar->AddPopup("&Digitizers", fMenuDigitizers, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
||||
|
||||
fMenuDigitizers->DisableEntry( M_TRIGGER_SUMMARY);
|
||||
fMenuDigitizers->DisableEntry( M_LOAD_SETTINGS);
|
||||
//fMenuDigitizers->DisableEntry( M_BOARD_SETTINGS);
|
||||
//fMenuDigitizers->DisableEntry( M_CH_SETTING);
|
||||
{///======================= menu
|
||||
fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame);
|
||||
fMain->AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
|
||||
fMenuFile = new TGPopupMenu(gClient->GetRoot());
|
||||
fMenuFile->AddEntry("&Open File", M_FILE_OPEN);
|
||||
fMenuFile->AddSeparator();
|
||||
fMenuFile->AddEntry("E&xit", M_EXIT);
|
||||
fMenuFile->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
||||
fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
||||
|
||||
fMenuDigitizers = new TGPopupMenu(gClient->GetRoot());
|
||||
fMenuDigitizers->AddEntry("&Open Digitizers", M_DIGITIZER_OPEN);
|
||||
fMenuDigitizers->AddEntry("&Load Settings", M_LOAD_SETTINGS);
|
||||
fMenuDigitizers->AddEntry("&Trigger Summary", M_TRIGGER_SUMMARY);
|
||||
fMenuDigitizers->AddSeparator();
|
||||
fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS);
|
||||
fMenuDigitizers->AddEntry("&Channel Settings (PHA)", M_CH_SETTING_PHA);
|
||||
fMenuDigitizers->AddEntry("&Channel Settings (PSD)", M_CH_SETTING_PSD);
|
||||
fMenuDigitizers->AddSeparator();
|
||||
fMenuDigitizers->AddEntry("&Program Settings", M_PROGRAM_SETTINGS);
|
||||
fMenuDigitizers->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
||||
fMenuBar->AddPopup("&Digitizers", fMenuDigitizers, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
||||
|
||||
fMenuDigitizers->DisableEntry( M_TRIGGER_SUMMARY);
|
||||
fMenuDigitizers->DisableEntry( M_LOAD_SETTINGS);
|
||||
//fMenuDigitizers->DisableEntry( M_BOARD_SETTINGS);
|
||||
//fMenuDigitizers->DisableEntry( M_CH_SETTING);
|
||||
|
||||
fMenuUtility = new TGPopupMenu(gClient->GetRoot());
|
||||
fMenuUtility->AddEntry("Plot Channels Rate", M_SHOW_CHANNELS_RATE);
|
||||
fMenuDigitizers->AddSeparator();
|
||||
fMenuUtility->AddEntry("Find &Peaks", M_FINDPEAKS);
|
||||
fMenuUtility->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
||||
fMenuBar->AddPopup("&Utility", fMenuUtility, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
||||
TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom
|
||||
|
||||
///================= Create a horizontal frame widget with buttons
|
||||
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain,200,40);
|
||||
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
||||
fMenuUtility = new TGPopupMenu(gClient->GetRoot());
|
||||
fMenuUtility->AddEntry("Plot Channels Rate", M_SHOW_CHANNELS_RATE);
|
||||
fMenuDigitizers->AddSeparator();
|
||||
fMenuUtility->AddEntry("Find &Peaks", M_FINDPEAKS);
|
||||
fMenuUtility->Connect("Activated(Int_t)", "MainWindow", this, "HandleMenu(Int_t)");
|
||||
fMenuBar->AddPopup("&Utility", fMenuUtility, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
|
||||
}
|
||||
|
||||
///================= Open digitizers
|
||||
bOpenDigitizers = new TGTextButton(hframe,"Open Digitizers");
|
||||
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()");
|
||||
hframe->AddFrame(bOpenDigitizers, uniLayoutHints);
|
||||
|
||||
///================= Start Run
|
||||
TGTextButton *bStartRun = new TGTextButton(hframe,"Start Run"); hframe->AddFrame(bStartRun, uniLayoutHints);
|
||||
|
||||
///================= Stop Run
|
||||
TGTextButton *bStopRun = new TGTextButton(hframe,"Stop Run"); hframe->AddFrame(bStopRun, uniLayoutHints);
|
||||
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain); fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
||||
|
||||
///================= signal Channel group
|
||||
TGGroupFrame * group1 = new TGGroupFrame(hframe, "Single Channel", kHorizontalFrame);
|
||||
hframe->AddFrame(group1 );
|
||||
{///================= Create a horizontal frame widget with buttons
|
||||
TGGroupFrame * group0 = new TGGroupFrame(hframe, "Hahaha", kHorizontalFrame); hframe->AddFrame(group0 );
|
||||
TGHorizontalFrame *hfg0 = new TGHorizontalFrame(group0,200,30); group0->AddFrame(hfg0 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||
|
||||
TGLayoutHints * uniLayoutHints = new TGLayoutHints(kLHintsNormal, 2,2,10,0); ///left, right, top, bottom
|
||||
|
||||
bOpenDigitizers = new TGTextButton(hfg0,"Open Digitizers"); hfg0->AddFrame(bOpenDigitizers, uniLayoutHints);
|
||||
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()");
|
||||
|
||||
TGTextButton *bStartRun = new TGTextButton(hfg0,"Start Run"); hfg0->AddFrame(bStartRun, uniLayoutHints);
|
||||
bStartRun->Connect("Clicked()", "MainWindow", this, "StartRun()");
|
||||
|
||||
TGTextButton *bStopRun = new TGTextButton(hfg0,"Stop Run"); hfg0->AddFrame(bStopRun, uniLayoutHints);
|
||||
bStopRun->Connect("Clicked()", "MainWindow", this, "StopRun()");
|
||||
|
||||
TGCheckButton* bSaveData = new TGCheckButton(hfg0, "ACQ Start/Arm", 1); hfg0->AddFrame(bSaveData, uniLayoutHints);
|
||||
bSaveData->SetState(kButtonDown);
|
||||
}
|
||||
|
||||
TGHorizontalFrame *hframe1 = new TGHorizontalFrame(group1,200,30);
|
||||
group1->AddFrame(hframe1 );
|
||||
|
||||
///================= Create canvas widget
|
||||
{///================= sigle Channel group
|
||||
TGGroupFrame * group1 = new TGGroupFrame(hframe, "Single Channel", kHorizontalFrame); hframe->AddFrame(group1 );
|
||||
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(group1,200,30); group1->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||
|
||||
TGLayoutHints * haha = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 10, 0); ///left, right, top, bottom
|
||||
|
||||
|
||||
TGLabel * lb0 = new TGLabel(hfg1, "Board"); hfg1->AddFrame(lb0, haha);
|
||||
TGNumberEntry * boardIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfg1->AddFrame(boardIDEntry, haha);
|
||||
boardIDEntry->SetWidth(50);
|
||||
//boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard-1);
|
||||
|
||||
TGLabel * lb1 = new TGLabel(hfg1, "Channel"); hfg1->AddFrame(lb1, haha);
|
||||
TGNumberEntry* chIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); hfg1->AddFrame(chIDEntry, haha);
|
||||
chIDEntry->SetWidth(50);
|
||||
|
||||
TGLabel * lbMode = new TGLabel(hfg1, "Mode"); hfg1->AddFrame(lbMode, haha);
|
||||
TGComboBox* cbMode = new TGComboBox(hfg1); hfg1->AddFrame(cbMode, haha);
|
||||
cbMode->AddEntry("Energy Hist", 0);
|
||||
cbMode->AddEntry("Ocs.", 1);
|
||||
cbMode->Select(1, false);
|
||||
cbMode->Resize(80, 20);
|
||||
}
|
||||
|
||||
///================= canvas widget
|
||||
fEcanvas = new TRootEmbeddedCanvas("Ecanvas",fMain,900,400);
|
||||
fMain->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
|
||||
///================= Log massage
|
||||
|
@ -141,9 +161,9 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
|
||||
LogMsg("Please \"Open Digitizers\" to start.");
|
||||
|
||||
HandleMenu(M_DIGITIZER_OPEN);
|
||||
//HandleMenu(M_DIGITIZER_OPEN);
|
||||
|
||||
HandleMenu(M_BOARD_SETTINGS);
|
||||
//HandleMenu(M_BOARD_SETTINGS);
|
||||
//HandleMenu(M_CH_SETTING_PHA);
|
||||
//HandleMenu(M_CH_SETTING_PSD);
|
||||
|
||||
|
@ -259,6 +279,7 @@ void MainWindow::HandleMenu(Int_t id){
|
|||
void MainWindow::OpenDigitizers(){
|
||||
|
||||
LogMsg("============= detect digitizers");
|
||||
vector<int> DPPType;
|
||||
DPPType.clear();
|
||||
portID.clear();
|
||||
boardID.clear();
|
||||
|
@ -276,8 +297,6 @@ void MainWindow::OpenDigitizers(){
|
|||
boardID.push_back(board);
|
||||
serialNum.push_back(dig->GetSerialNumber());
|
||||
dig->CloseDigitizer();
|
||||
if( dig->GetDPPType() == V1730_DPP_PHA_CODE ) nPHA ++;
|
||||
if( dig->GetDPPType() == V1730_DPP_PSD_CODE ) nPSD ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,9 +305,6 @@ void MainWindow::OpenDigitizers(){
|
|||
for( int i = 0 ; i < nDigi ; i++){
|
||||
LogMsg(Form("port: %d, board: %d, DPP Type : %d", portID[i], boardID[i], DPPType[i]));
|
||||
}
|
||||
LogMsg(Form("Number of PHA : %d", nPHA));
|
||||
LogMsg(Form("Number of PSD : %d", nPSD));
|
||||
|
||||
|
||||
if( nDigi > 0 ) {
|
||||
LogMsg(Form("============= Connect %d digitizer(s)...", nDigi));
|
||||
|
@ -339,6 +355,22 @@ void MainWindow::GoodBye(){
|
|||
|
||||
}
|
||||
|
||||
void MainWindow::StartRun(){
|
||||
LogMsg(Form("%s",__func__));
|
||||
if( digi == NULL) return;
|
||||
|
||||
digi[0]->StartACQ();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::StopRun(){
|
||||
LogMsg(Form("%s",__func__));
|
||||
if( digi == NULL) return;
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::OpenChannelSetting(Int_t boardID){
|
||||
|
||||
printf("#### %s \n", __func__);
|
||||
|
@ -406,7 +438,7 @@ void MainWindow::PlotTrace(){
|
|||
printf("0----------%d \n", traceLength);
|
||||
|
||||
if( traceLength == 0 ) {
|
||||
LogMsg("no trace");
|
||||
LogMsg((char *)"no trace");
|
||||
}else{
|
||||
for( int i = 0; i < traceLength ; i++) {
|
||||
//printf("%d, ", (data->Waveform1[0][0])[i]);
|
||||
|
|
11
FSUDAQ.h
11
FSUDAQ.h
|
@ -48,14 +48,10 @@ private:
|
|||
TGTextButton *bOpenDigitizers;
|
||||
|
||||
unsigned short nDigi;
|
||||
vector<int> DPPType;
|
||||
vector<int> portID;
|
||||
vector<int> boardID;
|
||||
vector<int> serialNum;
|
||||
static Digitizer ** digi;
|
||||
unsigned short nPHA, nPSD;
|
||||
static DigitizerPHA ** pha;
|
||||
static DigitizerPSD ** psd;
|
||||
|
||||
BoardSetting * boardSetting;
|
||||
ChannelSettingPHA * channelSettingPHA;
|
||||
|
@ -68,15 +64,12 @@ private:
|
|||
//TThread * fillHistThread;
|
||||
//static TH1F * hEnergy[MAXMOD][MAXCH];
|
||||
//static TH1F * hChannel[MAXMOD];
|
||||
//static bool isEnergyHistFilled;
|
||||
|
||||
TGraph * gAnaTrace1; /// analogy trace 1
|
||||
TGraph * gAnaTrace2; /// analogy trace 2
|
||||
TGraph * gDigiTrace1; /// digital trace 1
|
||||
TGraph * gDigiTrace2; /// digital trace 1
|
||||
//TGTextEditor * configEditor;
|
||||
|
||||
|
||||
public:
|
||||
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
|
||||
virtual ~MainWindow();
|
||||
|
@ -89,9 +82,9 @@ public:
|
|||
//void GetBaseLine();
|
||||
//void Scope();
|
||||
//void FitTrace();
|
||||
//void StartRun();
|
||||
void StartRun();
|
||||
//static void * SaveData(void* ptr ); /// thread
|
||||
//void StopRun();
|
||||
void StopRun();
|
||||
//void OpenScalar();
|
||||
//static void * FillHistogram(void * ptr); /// thread
|
||||
//void ChangeMod();
|
||||
|
|
|
@ -46,12 +46,12 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
|
|||
NChannel = 16 ;// digi[0]->GetNChannel();
|
||||
|
||||
TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber);
|
||||
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber); hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||
chIDEntry->SetWidth(50);
|
||||
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, NChannel-1);
|
||||
chIDEntry->SetNumber(0, false);
|
||||
chIDEntry->Connect("Modified()", "ChannelSettingPHA", this, "ChangeCh()");
|
||||
hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
||||
|
||||
|
||||
TGTextButton* bSetAllChannels = new TGTextButton(hframe0, "Set All Channels", 1); hframe0->AddFrame(bSetAllChannels, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
||||
bSetAllChannels->SetState(kButtonUp);
|
||||
|
|
Loading…
Reference in New Issue
Block a user