From 7005979ec957c6efffa04bf1bb108a772fb0ac4c Mon Sep 17 00:00:00 2001 From: "Ryan@Debain10" Date: Wed, 16 Mar 2022 18:46:14 -0400 Subject: [PATCH] mainSetting plannel is done. --- Makefile | 5 +- Pixie16Class.cpp | 7 ++ Pixie16Class.h | 1 + mainSettings.cpp | 232 +++++++++++++++++++++++++++++++++++++--------- mainSettings.h | 49 +++++++++- pixieDAQ.cpp | 2 +- pixieDAQLinkDef.h | 1 + test_ryan.set | 64 ++++++------- 8 files changed, 279 insertions(+), 82 deletions(-) diff --git a/Makefile b/Makefile index 12c091f..99d3cbf 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ Pixie16Class.o : Pixie16Class.h Pixie16Class.cpp DataBlock.h pixieDict.cxx : pixieDAQ.h pixieDAQLinkDef.h @echo "--------- creating pcm and cxx " @rootcling -f pixieDict.cxx -c pixieDAQ.h -p $(PIXIE_LIB_PATH) pixieDAQLinkDef.h +# @rootcling -f pixieDict.cxx -c pixieDAQ.h mainSettings.h -p $(PIXIE_LIB_PATH) pixieDAQLinkDef.h pixieDAQ.o : pixieDict.cxx pixieDAQ.cpp pixieDAQ.h @echo "--------- creating pixieDAQ.o" @@ -51,7 +52,9 @@ pixieDAQ.o : pixieDict.cxx pixieDAQ.cpp pixieDAQ.h mainSettings.o : mainSettings.cpp mainSettings.h @echo "--------- creating mainSettings.o" - $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) Pixie16Class.o mainSettings.cpp $(ROOT_FLAG) + $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) mainSettings.cpp $(ROOT_FLAG) +# $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) Pixie16Class.o mainSettings.cpp $(ROOT_FLAG) +# $(CC) $(CFLAGS) $(PIXIE_LIB_PATH) Pixie16Class.o mainSettings.cpp pixieDict.cxx $(ROOT_FLAG) #-------------------------- diff --git a/Pixie16Class.cpp b/Pixie16Class.cpp index 4bc0eca..33dcfd5 100644 --- a/Pixie16Class.cpp +++ b/Pixie16Class.cpp @@ -72,6 +72,13 @@ Pixie16::~Pixie16(){ delete DSPCodeFile; delete DSPParFile; delete DSPVarFile; + + delete ModRev; + delete ModSerNum; + delete ModADCBits; + delete ModADCMSPS; + delete numChannels; + delete ch2ns; delete ExtFIFO_Data; delete Statistics; diff --git a/Pixie16Class.h b/Pixie16Class.h index fbbc290..8979a54 100644 --- a/Pixie16Class.h +++ b/Pixie16Class.h @@ -122,6 +122,7 @@ public: unsigned short GetDigitizerRev(unsigned short modID) { return ModRev[modID];} unsigned short GetDigitizerADCBits(unsigned short modID) { return ModADCBits[modID];} unsigned short GetDigitizerNumChannel(unsigned short modID) { return numChannels[modID];} + std::string GetSettingFile(unsigned modID) {return DSPParFile[modID];} unsigned int GetDigitizerSetting(std::string parName, unsigned short modID, bool verbose = false); diff --git a/mainSettings.cpp b/mainSettings.cpp index b0f4d67..1136dbe 100644 --- a/mainSettings.cpp +++ b/mainSettings.cpp @@ -6,10 +6,8 @@ #include #include #include -#include -#include -#include #include +#include #include "mainSettings.h" @@ -18,31 +16,43 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi this->pixie = pixie; + settingFileName = pixie->GetSettingFile(0); + fMain = new TGMainFrame(p,w,h); fMain->SetWindowName("Pixie16 Channel Settings "); fMain->Connect("CloseWindow()", "MainSettings", this, "CloseWindow()"); - ///Module choose TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 ); fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); - TGLabel * lb1 = new TGLabel(hframe, "Module ID : "); + TGLabel * lb1 = new TGLabel(hframe, "Module ID :"); hframe->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); - TGNumberEntry * modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); + modIDEntry = new TGNumberEntry(hframe, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); modIDEntry->SetWidth(50); modIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, pixie->GetNumModule()-1); + //modIDEntry->Connect("Modified()", "MainSettings", this, "ChangeMod()"); hframe->AddFrame(modIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + TGLabel * lb2 = new TGLabel(hframe, "Setting File :"); + hframe->AddFrame(lb2, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); + + teFileName = new TGTextEntry(hframe, new TGTextBuffer(50)); + teFileName->SetEnabled(false); + teFileName->SetText( settingFileName ); + hframe->AddFrame(teFileName, new TGLayoutHints(kLHintsCenterX, 5,5,3,4)); + + TGTextButton * bOpen = new TGTextButton(hframe,"&Open"); + bOpen->Connect("Clicked()","MainSettings",this, "OpenFile()"); + hframe->AddFrame(bOpen, new TGLayoutHints(kLHintsCenterX, 5,5,3,4)); + TGTextButton * bSave = new TGTextButton(hframe,"&Save"); - bSave->Connect("Clicked()","MainSettings",this, "kaka()"); + bSave->Connect("Clicked()","MainSettings",this, "SaveSetting()"); hframe->AddFrame(bSave, new TGLayoutHints(kLHintsCenterX, 5,5,3,4)); /// Setting - int modID = modIDEntry->GetNumber(); - int maxCh = pixie->GetDigitizerNumChannel(modID); int numItems = 14; TString labelText[numItems] = {"CH", "ON/off", "Gain", "Trig L", "Trig G", "Threshold", "Polarity", "Energy L", "Energy G", "Tau", "Trace Len", "Trace delay", "V offset", "BaseLine"}; @@ -63,23 +73,12 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi hframeLabel->AddFrame(labelItems[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); } - TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [maxCh]; - TGLabel ** lbCh = new TGLabel * [maxCh]; - TGComboBox ** cbOnOff = new TGComboBox * [maxCh]; - TGComboBox ** cbGain = new TGComboBox * [maxCh]; - TGNumberEntry ** neTrigL = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neTrigG = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neThreshold = new TGNumberEntry * [maxCh]; - TGComboBox ** cbPol = new TGComboBox * [maxCh]; - TGNumberEntry ** neEngL = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neEngG = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neTau = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neTraceLength = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neTraceDelay = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neVoff = new TGNumberEntry * [maxCh]; - TGNumberEntry ** neBL = new TGNumberEntry * [maxCh]; + TGHorizontalFrame ** hframeCh = new TGHorizontalFrame * [MAXCH]; + TGLabel ** lbCh = new TGLabel * [MAXCH]; - for( int i = 0; i < maxCh ; i ++){ + for( int i = 0; i < MAXCH ; i ++){ + + //printf("-----------------------%d\n", i); hframeCh[i] = new TGHorizontalFrame(hframeSettings, w, 600 ); hframeSettings->AddFrame(hframeCh[i], new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); @@ -91,61 +90,70 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi col++; cbOnOff[i] = new TGComboBox(hframeCh[i], i); cbOnOff[i]->AddEntry("ON", 1); - cbOnOff[i]->AddEntry("off", 2); + cbOnOff[i]->AddEntry("off", 0); cbOnOff[i]->Resize(width[col], 20); - pixie->GetChannelOnOff(modID, i) ? cbOnOff[i]->Select(1) : cbOnOff[i]->Select(2); + pixie->GetChannelOnOff(modID, i) ? cbOnOff[i]->Select(1) : cbOnOff[i]->Select(0); + cbOnOff[i]->Connect("Selected(Int_t, Int_t)", "MainSettings", this, Form("ChangeOnOff(=%d)", i)); hframeCh[i]->AddFrame(cbOnOff[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); col++; cbGain[i] = new TGComboBox(hframeCh[i], i); cbGain[i]->AddEntry("x1", 1); - cbGain[i]->AddEntry("x1/4", 2); + cbGain[i]->AddEntry("x1/4", 0); cbGain[i]->Resize(width[col], 20); - pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(2); + pixie->GetChannelGain(modID, i) ? cbGain[i]->Select(1) : cbGain[i]->Select(0); + cbGain[i]->Connect("Selected(Int_t, Int_t)", "MainSettings", this, Form("ChangeGain(=%d)", i)); hframeCh[i]->AddFrame(cbGain[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); col++; neTrigL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); neTrigL[i]->SetWidth(width[col]); neTrigL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0); + neTrigL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTrigL(=%d)", i)); hframeCh[i]->AddFrame(neTrigL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - + col++; neTrigG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); neTrigG[i]->SetWidth(width[col]); neTrigG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 2.0); + neTrigG[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTrigG(=%d)", i)); hframeCh[i]->AddFrame(neTrigG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; - neThreshold[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerThreshold(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); + neThreshold[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelTriggerThreshold(modID, i), 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); neThreshold[i]->SetWidth(width[col]); neThreshold[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 4000); + neThreshold[i]->Connect("Modified()", "MainSettings", this, Form("ChangeThreshold(=%d)", i)); hframeCh[i]->AddFrame(neThreshold[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; cbPol[i] = new TGComboBox(hframeCh[i], i); cbPol[i]->AddEntry("Pos +", 1); - cbPol[i]->AddEntry("Neg -", 2); + cbPol[i]->AddEntry("Neg -", 0); cbPol[i]->Resize(width[col], 20); - pixie->GetChannelPolarity(modID, i) ? cbPol[i]->Select(1) : cbPol[i]->Select(2); + pixie->GetChannelPolarity(modID, i) ? cbPol[i]->Select(1) : cbPol[i]->Select(0); + cbPol[i]->Connect("Selected(Int_t, Int_t)", "MainSettings", this, Form("ChangePol(=%d)", i)); hframeCh[i]->AddFrame(cbPol[i], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); col++; - neEngL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); + neEngL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyRiseTime(modID, i), 0, 0, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEANonNegative); neEngL[i]->SetWidth(width[col]); neEngL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0); + neEngL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeEngL(=%d)", i)); hframeCh[i]->AddFrame(neEngL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; - neEngG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); + neEngG[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyFlatTop(modID, i), 0, 0, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEANonNegative); neEngG[i]->SetWidth(width[col]); neEngG[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 10.0); + neEngG[i]->Connect("Modified()", "MainSettings", this, Form("ChangeEngG(=%d)", i)); hframeCh[i]->AddFrame(neEngG[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; neTau[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelEnergyTau(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); neTau[i]->SetWidth(width[col]); neTau[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 300.0); + neTau[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTau(=%d)", i)); hframeCh[i]->AddFrame(neTau[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; @@ -154,6 +162,7 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi neTraceLength[i] = new TGNumberEntry(hframeCh[i], tracelen, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber); neTraceLength[i]->SetWidth(width[col]); neTraceLength[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, 20.0); + neTraceLength[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceLenght(=%d)", i)); hframeCh[i]->AddFrame(neTraceLength[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; @@ -162,26 +171,24 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi neTraceDelay[i] = new TGNumberEntry(hframeCh[i], tracedel, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber); neTraceDelay[i]->SetWidth(width[col]); neTraceDelay[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, 20.0); + neTraceDelay[i]->Connect("Modified()", "MainSettings", this, Form("ChangeTraceDelay(=%d)", i)); hframeCh[i]->AddFrame(neTraceDelay[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; neVoff[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelVOffset(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEAAnyNumber); neVoff[i]->SetWidth(width[col]); neVoff[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, -2, 2); + neVoff[i]->Connect("Modified()", "MainSettings", this, Form("ChangeVoff(=%d)", i)); hframeCh[i]->AddFrame(neVoff[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); col++; - neBL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelBaseLinePrecent(modID, i), 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); + neBL[i] = new TGNumberEntry(hframeCh[i], pixie->GetChannelBaseLinePrecent(modID, i), 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); neBL[i]->SetWidth(width[col]); - neBL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 100.0); - //neBL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeBL(==%d, =%d)",modID, i)); - //neBL[i]->Connect("Modified()", "MainSettings", this, "ChangeBL(0,1)"); - //neBL[i]->Connect("Modified()", "MainSettings", this, "kaka()"); + neBL[i]->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 100); + neBL[i]->Connect("Modified()", "MainSettings", this, Form("ChangeBL(=%d)", i)); hframeCh[i]->AddFrame(neBL[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - } - fMain->MapSubwindows(); fMain->Resize(fMain->GetDefaultSize()); fMain->MapWindow(); @@ -190,17 +197,150 @@ MainSettings::MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixi MainSettings::~MainSettings(){ + for (int i = 0; i< MAXCH; i++) { + delete cbOnOff[i] ; + delete cbGain[i] ; + delete cbPol[i] ; + delete neTrigL[i] ; + delete neTrigG[i] ; + delete neThreshold[i] ; + delete neEngL[i] ; + delete neEngG[i] ; + delete neTau[i] ; + delete neTraceLength[i] ; + delete neTraceDelay[i] ; + delete neVoff[i] ; + delete neBL[i]; + } + + delete modIDEntry; + delete teFileName; + + /// fMain must be delete last; fMain->Cleanup(); delete fMain; } -void MainSettings::ChangeBL(unsigned short mod, unsigned short ch){ - printf("mod : %d , ch : %d\n", mod, ch); + +void MainSettings::ChangeOnOff(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + int val = cbOnOff[ch]->GetSelected(); + pixie->SetChannelOnOff(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} +void MainSettings::ChangeGain(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + int val = cbGain[ch]->GetSelected(); + pixie->SetChannelGain(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangePol(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + int val = cbPol[ch]->GetSelected(); + pixie->SetChannelPositivePolarity(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeTrigL(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neTrigL[ch]->GetNumber(); + pixie->SetChannelTriggerRiseTime(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeTrigG(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neTrigG[ch]->GetNumber(); + pixie->SetChannelTriggerFlatTop(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} +void MainSettings::ChangeThreshold(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neThreshold[ch]->GetNumber(); + pixie->SetChannelTriggerThreshold(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeEngL(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neEngL[ch]->GetNumber(); + pixie->SetChannelEnergyRiseTime(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeEngG(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neEngG[ch]->GetNumber(); + pixie->SetChannelEnergyFlatTop(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeTau(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neTau[ch]->GetNumber(); + pixie->SetChannelEnergyTau(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeTraceLenght(unsigned short ch){ + //TODO need to set On Off + short modID = modIDEntry->GetNumber(); + double val = neTraceLength[ch]->GetNumber(); + pixie->SetChannelTraceLenght(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeTraceDelay(unsigned short ch){ + //TODO need to set On Off + short modID = modIDEntry->GetNumber(); + double val = neTraceDelay[ch]->GetNumber(); + pixie->SetChannelTraceDelay(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeVoff(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neVoff[ch]->GetNumber(); + pixie->SetChannelVOffset(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); +} + +void MainSettings::ChangeBL(unsigned short ch){ + short modID = modIDEntry->GetNumber(); + double val = neBL[ch]->GetNumber(); + pixie->SetChannelBaseLinePrecent(val, modID, ch); + teFileName->SetText(settingFileName + " (not saved)"); } -void MainSettings::kaka(){ +void MainSettings::ChangeMod(){ + short modID = modIDEntry->GetNumber(); + settingFileName = pixie->GetSettingFile(modID); + teFileName->SetText(settingFileName); +} + +void MainSettings::OpenFile(){ - printf("save button is pressed.\n"); + static TString dir("."); + TGFileInfo fi; + const char *filetypes[] = { "Setting file", "*.set",}; + fi.fFileTypes = filetypes; + fi.SetIniDir(dir); + printf("fIniDir = %s\n", fi.fIniDir); + new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi); + printf("Open file: |%s| (dir: %s)\n", fi.fFilename, fi.fIniDir); + if( fi.fFilename != NULL ) { + settingFileName = fi.fFilename; + teFileName->SetText(settingFileName + " (not saved)"); + } + dir = fi.fIniDir; +} + +void MainSettings::SaveSetting(){ + printf("save button is pressed.\n"); + pixie->SaveSettings(settingFileName.Data()); + + teFileName->SetText(settingFileName + " (saved)"); } diff --git a/mainSettings.h b/mainSettings.h index 1afc649..0052d5d 100644 --- a/mainSettings.h +++ b/mainSettings.h @@ -2,27 +2,72 @@ #define MAIN_SETTING_H #include +///#include + +#include +#include #include "Pixie16Class.h" class TGWindow; class TGMainFrame; +#define MAXCH 16 + class MainSettings{ +/// RQ_OBJECT("MainSettings") private: TGMainFrame * fMain; + TGNumberEntry * modIDEntry; + + TGTextEntry * teFileName; + + TString settingFileName; + + TGComboBox * cbOnOff[MAXCH] ; + TGComboBox * cbGain[MAXCH] ; + TGComboBox * cbPol[MAXCH] ; + + TGNumberEntry * neTrigL[MAXCH] ; + TGNumberEntry * neTrigG[MAXCH] ; + TGNumberEntry * neThreshold[MAXCH] ; + TGNumberEntry * neEngL[MAXCH] ; + TGNumberEntry * neEngG[MAXCH] ; + TGNumberEntry * neTau[MAXCH] ; + TGNumberEntry * neTraceLength[MAXCH] ; + TGNumberEntry * neTraceDelay[MAXCH] ; + TGNumberEntry * neVoff[MAXCH] ; + TGNumberEntry * neBL[MAXCH]; + Pixie16 * pixie; + + int maxCh; public: MainSettings(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie); virtual ~MainSettings(); + void CloseWindow() { printf("close window\n"); delete this; } - void ChangeBL(unsigned short mod, unsigned short ch); + void ChangeOnOff(unsigned short ch); + void ChangeGain(unsigned short ch); + void ChangePol(unsigned short ch); + void ChangeTrigL(unsigned short ch); + void ChangeTrigG(unsigned short ch); + void ChangeThreshold(unsigned short ch); + void ChangeEngL(unsigned short ch); + void ChangeEngG(unsigned short ch); + void ChangeTau(unsigned short ch); + void ChangeTraceLenght(unsigned short ch); + void ChangeTraceDelay(unsigned short ch); + void ChangeVoff(unsigned short ch); + void ChangeBL(unsigned short ch); - void kaka(); + void ChangeMod(); + void OpenFile(); + void SaveSetting(); }; diff --git a/pixieDAQ.cpp b/pixieDAQ.cpp index c366367..41ade23 100644 --- a/pixieDAQ.cpp +++ b/pixieDAQ.cpp @@ -102,7 +102,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { fMain->MapWindow(); - HandleMenu(M_MAIN_CH_SETTINGS); + //HandleMenu(M_MAIN_CH_SETTINGS); ///================ pixie ///printf("Removing Pixie16Msg.log \n"); diff --git a/pixieDAQLinkDef.h b/pixieDAQLinkDef.h index d171419..30cabd0 100644 --- a/pixieDAQLinkDef.h +++ b/pixieDAQLinkDef.h @@ -1 +1,2 @@ #pragma link C++ class MainWindow; +//#pragma link C++ class MainSettings; diff --git a/test_ryan.set b/test_ryan.set index e855dda..7eab454 100644 --- a/test_ryan.set +++ b/test_ryan.set @@ -3,17 +3,17 @@ "channel": { "input": { "BLcut": [ - 32, + 1, 1, 1, 31, 31, 1, - 32, + 8, 32, 1, 1, - 1, + 0, 1, 1, 1, @@ -21,9 +21,9 @@ 2 ], "BaselinePercent": [ + 7, 10, - 10, - 10, + 2, 10, 10, 10, @@ -93,7 +93,7 @@ 120 ], "ChanCSRa": [ - 18592, + 2212, 16544, 16544, 16544, @@ -219,7 +219,7 @@ 20 ], "FastGap": [ - 10, + 14, 10, 10, 10, @@ -237,7 +237,7 @@ 10 ], "FastLength": [ - 10, + 14, 10, 10, 10, @@ -261,7 +261,7 @@ 65535, 65535, 65535, - 6000, + 4000, 65535, 65535, 65535, @@ -435,17 +435,17 @@ 32768 ], "PAFlength": [ + 1096, 1768, 1768, 1768, 1768, 1768, - 1768, - 642, - 1768, + 666, 1768, 1768, 1768, + 1792, 1768, 1768, 1768, @@ -489,17 +489,17 @@ 0 ], "PeakSample": [ + 106, 95, 95, 95, 95, 95, - 95, - 48, - 95, + 51, 95, 95, 95, + 98, 95, 95, 95, @@ -507,17 +507,17 @@ 95 ], "PeakSep": [ + 108, 97, 97, 97, 97, 97, - 97, - 50, - 97, + 53, 97, 97, 97, + 100, 97, 97, 97, @@ -531,11 +531,11 @@ 1100456650, 1100456650, 1100456650, - 1112014848, - 1100456650, + 1112012226, 1100456650, 1100456650, 1100456650, + 1100428083, 1100456650, 1100456650, 1100456650, @@ -705,6 +705,7 @@ 0 ], "SlowGap": [ + 25, 19, 19, 19, @@ -714,8 +715,7 @@ 19, 19, 19, - 19, - 19, + 22, 19, 19, 19, @@ -723,13 +723,13 @@ 19 ], "SlowLength": [ + 83, 78, 78, 78, 78, 78, - 78, - 31, + 34, 78, 78, 78, @@ -759,13 +759,13 @@ 0 ], "TraceLength": [ + 2484, 5000, 5000, 5000, 5000, 5000, - 5000, - 2500, + 2504, 5000, 5000, 5000, @@ -795,17 +795,17 @@ 0 ], "TriggerDelay": [ + 856, 768, 768, 768, 768, 768, - 768, - 392, - 768, + 416, 768, 768, 768, + 792, 768, 768, 768, @@ -977,9 +977,9 @@ }, "fifo": { "buffers": 100, - "hold": 50000, + "hold": 10000, "idle-wait": 150000, - "run-wait": 2000 + "run-wait": 5000 }, "fippi": { "adc_bits": 16, @@ -1016,7 +1016,7 @@ "ChanNum": 0, "CoincPattern": 0, "CoincWait": 0, - "ControlTask": 0, + "ControlTask": 23, "CrateID": 0, "FIFOLength": 8188, "FastFilterRange": 0,