diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 39b35fb..cf1586e 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -24,7 +24,8 @@ enum MenuIdentifiers{ M_FILE_OPEN, M_EXIT, M_TRIGGER_SUMMARY, - M_CH_SETTING, + M_CH_SETTING_PHA, + M_CH_SETTING_PSD, M_BOARD_SETTINGS, M_PROGRAM_SETTINGS, M_FINDPEAKS, @@ -63,7 +64,8 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { fMenuDigitizers->AddEntry("&Trigger Summary", M_TRIGGER_SUMMARY); fMenuDigitizers->AddSeparator(); fMenuDigitizers->AddEntry("Digitizer &Settings", M_BOARD_SETTINGS); - fMenuDigitizers->AddEntry("&Channel Settings", M_CH_SETTING); + 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)"); @@ -129,15 +131,15 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { ///settingsSummary = NULL; boardSetting = NULL; - channelSetting = NULL; + channelSettingPHA = NULL; ///scalarPanel = NULL; LogMsg("Ready to run."); //HandleMenu(M_DIGITIZER_SCAN); // - //HandleMenu(M_BOARD_SETTINGS); - HandleMenu(M_CH_SETTING); + HandleMenu(M_BOARD_SETTINGS); + //HandleMenu(M_CH_SETTING_PHA); } MainWindow::~MainWindow() { @@ -154,7 +156,7 @@ MainWindow::~MainWindow() { if( digi != NULL ) delete [] digi; delete boardSetting; - delete channelSetting; + delete channelSettingPHA; //delete settingsSummary; //delete scalarPanel; @@ -226,9 +228,9 @@ void MainWindow::HandleMenu(Int_t id){ }break; ///========================= Channel setting - case M_CH_SETTING: - channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, digi, nDigi); - channelSetting->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)"); + case M_CH_SETTING_PHA: + channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, 0); + channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)"); break; @@ -237,6 +239,7 @@ void MainWindow::HandleMenu(Int_t id){ if( boardSetting == NULL ) { boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); boardSetting->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)"); + boardSetting->Connect("Haha(Int_t)", "MainWindow", this, "OpenChannelSetting(Int_t)"); }else{ if ( boardSetting->IsOpen() == false ){ boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); @@ -326,6 +329,16 @@ void MainWindow::GoodBye(){ } +void MainWindow::OpenChannelSetting(Int_t boardID){ + + printf("#### %s \n", __func__); + + //if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){ + channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, boardID); + channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)"); + //} +} + void MainWindow::LogMsg(char * msg){ time_t now = time(0); diff --git a/FSUDAQ.h b/FSUDAQ.h index c158d37..49e71ac 100644 --- a/FSUDAQ.h +++ b/FSUDAQ.h @@ -17,7 +17,7 @@ #include "DigitizerPSD.h" #include "boardSetting.h" -#include "channelSetting.h" +#include "channelSettingPHA.h" ///#include "settingsSummary.h" ///#include "scalarPanel.h" @@ -55,7 +55,7 @@ private: static DigitizerPSD ** psd; BoardSetting * boardSetting; - ChannelSetting * channelSetting; + ChannelSettingPHA * channelSettingPHA; //SettingsSummary * settingsSummary; //ScalarPanel * scalarPanel; @@ -69,6 +69,7 @@ private: // //TGTextEditor * configEditor; + public: MainWindow(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MainWindow(); @@ -88,7 +89,8 @@ public: //static void * FillHistogram(void * ptr); /// thread //void ChangeMod(); //void ChangeChannel(); - + + void OpenChannelSetting(Int_t); void LogMsg(char * ); void GoodBye(); }; diff --git a/Makefile b/Makefile index 95c46f8..f9f7301 100755 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ CAENLIBS = -lCAENDigitizer ROOTLIBS = `root-config --cflags --glibs` -OBJS = channelSetting.o boardSetting.o ClassDigitizer.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o +OBJS = channelSettingPHA.o boardSetting.o ClassDigitizer.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o ######################################################################### @@ -55,9 +55,9 @@ boardSetting.o : boardSetting.h boardSetting.cpp @echo "----------- creating boardSetting.o" $(CC) $(COPTS) -c boardSetting.cpp $(ROOTLIBS) -channelSetting.o : channelSetting.h channelSetting.cpp - @echo "----------- creating channelSetting.o" - $(CC) $(COPTS) -c channelSetting.cpp $(ROOTLIBS) +channelSettingPHA.o : channelSettingPHA.h channelSettingPHA.cpp + @echo "----------- creating channelSettingPHA.o" + $(CC) $(COPTS) -c channelSettingPHA.cpp $(ROOTLIBS) #CutsCreator: $(OBJS3) src/CutsCreator.c diff --git a/boardSetting.cpp b/boardSetting.cpp index 55a4bc4..4fcae3f 100644 --- a/boardSetting.cpp +++ b/boardSetting.cpp @@ -22,11 +22,9 @@ TString boardSettingName[NUM_BOARD_INFO] = { "Model", Pixel_t BoardSetting::red = 0; Pixel_t BoardSetting::blue = 0; + TGNumberEntry * BoardSetting::boardIDEntry = NULL; Digitizer ** BoardSetting::digi = NULL; -//DigitizerPHA * BoardSetting::pha = NULL; -//DigitizerPSD * BoardSetting::psd = NULL; - TGTextEntry * BoardSetting::txtACQStatus = NULL; TGTextEntry * BoardSetting::txtACQEventReady = NULL; TGTextEntry * BoardSetting::txtACQEventFull = NULL; @@ -117,10 +115,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d } } - TGHorizontalFrame * hRow3 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow3, new TGLayoutHints(kLHintsExpandX)); + TGHorizontalFrame * hRow3 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow3, new TGLayoutHints(kLHintsExpandX)); {///========= ACD Status - TGGroupFrame * gAcqStatus = new TGGroupFrame(hRow3, "ACQ Status", kHorizontalFrame); hRow3->AddFrame(gAcqStatus, new TGLayoutHints(kLHintsExpandX)); + TGGroupFrame * gAcqStatus = new TGGroupFrame(hRow3, "ACQ Status", kHorizontalFrame); hRow3->AddFrame(gAcqStatus, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0)); TGHorizontalFrame * hfAcqStatus = new TGHorizontalFrame(gAcqStatus); gAcqStatus->AddFrame(hfAcqStatus, new TGLayoutHints(kLHintsExpandX)); TGVerticalFrame * vAcqStatus1 = new TGVerticalFrame(hfAcqStatus); hfAcqStatus->AddFrame(vAcqStatus1); @@ -209,7 +207,7 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d } {///==========="Readout Status" - TGGroupFrame * gReadoutStatus = new TGGroupFrame(hRow3, "Readout Status", kHorizontalFrame); hRow3->AddFrame(gReadoutStatus, new TGLayoutHints( kLHintsExpandY, 5, 5, 0, 0) ); + TGGroupFrame * gReadoutStatus = new TGGroupFrame(hRow3, "Readout Status", kHorizontalFrame); hRow3->AddFrame(gReadoutStatus, new TGLayoutHints( kLHintsExpandY, 0, 0, 0, 0) ); TGVerticalFrame * vReadoutStatus = new TGVerticalFrame(gReadoutStatus); gReadoutStatus->AddFrame(vReadoutStatus, new TGLayoutHints(kLHintsCenterY | kLHintsExpandY, 5, 5, 10, 0)); @@ -229,6 +227,14 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d txtVMEFIFO->SetTextColor(blue); } + TGHorizontalFrame * hRow0 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow0, new TGLayoutHints( kLHintsExpandX)); + //hRow0->ChangeOptions((hRow0->GetOptions() | kFixedHeight)); + //hRow0-> + + TGTextButton * bOpenChannelSetting = new TGTextButton(hRow0, "Open Channel Setting"); hRow0->AddFrame(bOpenChannelSetting, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); + bOpenChannelSetting->SetHeight(40); + bOpenChannelSetting->Connect("Clicked()", "BoardSetting", this, "OpenChannelSetting()"); + TGHorizontalFrame * hRow1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow1, new TGLayoutHints( kLHintsExpandX)); {///========= Board Configure @@ -619,7 +625,7 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d cbAnaMonitor->AddEntry("Voltage Level", 4); cbAnaMonitor->Resize(150, 20); cbAnaMonitor->Connect("Changed()", "BoardSetting", this, "SetAnalogMonitorMode()"); - //cbAnaMonitor->Connect("Changed()", "ChannelSetting", this, "ChangePolarity()"); //Example to call other class + //cbAnaMonitor->Connect("Changed()", "ChannelSettingPHA", this, "ChangePolarity()"); //Example to call other class ///"Buffer Occupancy Gain TGLabel * lbBufferOccpGain = new TGLabel(vFrontIOCtrl_label, "Buffer Occupancy Gain"); vFrontIOCtrl_label->AddFrame(lbBufferOccpGain, haha); @@ -1034,6 +1040,18 @@ void BoardSetting::ChangeBoard(){ //################################################ Change Settings +void BoardSetting::OpenChannelSetting(){ + printf("=== %s\n", __func__); + + Int_t boardID = boardIDEntry->GetNumber(); + Haha(boardID); +} + +void BoardSetting::Haha(Int_t boardID){ /// this is for sending signal to mainwindow to open channel setting for the board + printf("=== %s\n", __func__); + Emit("Haha(Int_t)", boardID); +} + void BoardSetting::ResetSettingToDefault(){ /// same for PHA and PSD printf("=== %s\n", __func__); diff --git a/boardSetting.h b/boardSetting.h index 40f729e..cf1b553 100644 --- a/boardSetting.h +++ b/boardSetting.h @@ -30,8 +30,6 @@ class BoardSetting{ int nDigi; static Digitizer ** digi; - //static DigitizerPHA * pha; - //static DigitizerPSD * psd; /// board failure status TGTextEntry * enPLLStatus; @@ -139,6 +137,8 @@ class BoardSetting{ ///=== Button void ResetSettingToDefault(); void ClearBuffer(); + void OpenChannelSetting(); + ///=== Board Configure void SetBoardConfiguration(); @@ -169,7 +169,8 @@ class BoardSetting{ ///==== Readout Control void SetReadOutControl(); + ///==== Others void LogMsg(TString msg); // *SIGNAL* - + void Haha(Int_t boardID); // *SIGNAL* }; #endif diff --git a/channelSetting.cpp b/channelSettingPHA.cpp similarity index 74% rename from channelSetting.cpp rename to channelSettingPHA.cpp index 362d0ee..7602d58 100644 --- a/channelSetting.cpp +++ b/channelSettingPHA.cpp @@ -8,19 +8,20 @@ #include #include -#include "channelSetting.h" +#include "channelSettingPHA.h" -ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi){ +ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID){ this->digi = digi; + this->nDigi = nDigi; Pixel_t red, green; gClient->GetColorByName("red", red); gClient->GetColorByName("green", green); fMain = new TGMainFrame(p,w,h); - fMain->SetWindowName("Channel Settings "); - fMain->Connect("CloseWindow()", "ChannelSetting", this, "CloseWindow()"); + fMain->SetWindowName("Channel Settings PHA"); + fMain->Connect("CloseWindow()", "ChannelSettingPHA", this, "CloseWindow()"); TGLayoutHints * layoutHintsR = new TGLayoutHints(kLHintsRight, 5,5,3,2); /// left, right, top, bottom TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,0,0); /// left, right, top, bottom @@ -32,12 +33,14 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ///==========Board choose TGLabel * lb0 = new TGLabel(hframe0, "Module ID :"); hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); - boardIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + boardIDEntry = new TGNumberEntry(hframe0, boardID, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); boardIDEntry->SetWidth(50); boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi); - boardIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeBoard()"); + boardIDEntry->Connect("Modified()", "ChannelSettingPHA", this, "ChangeBoard()"); if( nDigi <= 1 ) boardIDEntry->SetState(false); + this->presentBoardID = boardID; + NChannel = 16 ;// digi[0]->GetNChannel(); TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); @@ -45,13 +48,12 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer chIDEntry->SetWidth(50); chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, NChannel-1); chIDEntry->SetNumber(0, false); - chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()"); + 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); - bSetAllChannels->Connect("Clicked()", "ChannelSetting", this, "SetAllChannels()"); + bSetAllChannels->Connect("Clicked()", "ChannelSettingPHA", this, "SetAllChannels()"); ///const uint32_t ChannelADCTemperature = 0x10A8; /// R TGLabel * lbTemp = new TGLabel(hframe0, "Temperature [C] :"); hframe0->AddFrame(lbTemp, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); @@ -59,7 +61,6 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer eTemp->SetEnabled(false); eTemp->Resize(50,20); - int boardID = boardIDEntry->GetNumber(); int ch = chIDEntry->GetNumber(); int width = 80; @@ -78,7 +79,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbOnOff->AddEntry("ON", 1); cbOnOff->AddEntry("off", 0); cbOnOff->Resize(width, 20); - cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetChannelMask()"); + cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSettingPHA", this, "SetChannelMask()"); ///----------- Polarity TGLabel * lbPol = new TGLabel(vfInput1, "Polarity");vfInput1->AddFrame(lbPol, layoutHintsR); @@ -86,7 +87,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbPolarity->AddEntry("Positive +", 1); cbPolarity->AddEntry("Negative -", 0); cbPolarity->Resize(width, 20); - cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); ///---------- Input Dynamic Range TGLabel * lbInputDynamicRange = new TGLabel(vfInput1, "Input Range");vfInput1->AddFrame(lbInputDynamicRange, layoutHintsR); @@ -94,25 +95,25 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbInputDynamicRange->AddEntry("2.0 Vpp", 0); cbInputDynamicRange->AddEntry("0.5 Vpp", 1); cbInputDynamicRange->Resize(width, 20); - cbInputDynamicRange->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetInputDynamicRange()"); + cbInputDynamicRange->Connect("Selected(Int_t, Int_t)", "ChannelSettingPHA", this, "SetInputDynamicRange()"); ///---------- Record Length TGLabel * lbRecordLength = new TGLabel(vfInput1, "Record Length [ns]"); vfInput1->AddFrame(lbRecordLength, layoutHintsR); numRecordLength = new TGNumberEntry(vfInput2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numRecordLength, layoutHints); numRecordLength->Resize(width, 20); - numRecordLength->Connect("Modified()", "ChannelSetting", this, "SetRecordLength()"); + numRecordLength->Connect("Modified()", "ChannelSettingPHA", this, "SetRecordLength()"); ///const uint32_t PreTrigger = 0x1038; /// R/W TGLabel * lbPreTrigger = new TGLabel(vfInput1, "Pre trigger [ns]"); vfInput1->AddFrame(lbPreTrigger, layoutHintsR); numPreTrigger = new TGNumberEntry(vfInput2, 2000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numPreTrigger, layoutHints); numPreTrigger->Resize(width, 20); - numPreTrigger->Connect("Modified()", "ChannelSetting", this, "SetPreTrigger()"); + numPreTrigger->Connect("Modified()", "ChannelSettingPHA", this, "SetPreTrigger()"); ///const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W, TGLabel * lbEventAgg = new TGLabel(vfInput1, "Events / Aggregate"); vfInput1->AddFrame(lbEventAgg, layoutHintsR); numEventAgg = new TGNumberEntry(vfInput2, 512, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numEventAgg, layoutHints); numEventAgg->Resize(width, 20); - numEventAgg->Connect("Modified()", "ChannelSetting", this, "SetEventAggregate()"); + numEventAgg->Connect("Modified()", "ChannelSettingPHA", this, "SetEventAggregate()"); ///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure ///const uint32_t VetoWidth = 0x10D4; /// R/W @@ -131,19 +132,19 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer TGLabel * lbTriggerThreshold = new TGLabel(vfTrigger1, "Trigger Threshold [LSB]"); vfTrigger1->AddFrame(lbTriggerThreshold, layoutHintsR); numTriggerThreshold = new TGNumberEntry(vfTrigger2, 100, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerThreshold, layoutHints); numTriggerThreshold->Resize(width, 20); - numTriggerThreshold->Connect("Modified()", "ChannelSetting", this, "SetTriggerThreshold()"); + numTriggerThreshold->Connect("Modified()", "ChannelSettingPHA", this, "SetTriggerThreshold()"); ///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W TGLabel * lbTriggerHoldOff = new TGLabel(vfTrigger1, "Trigger Holdoff [ns]"); vfTrigger1->AddFrame(lbTriggerHoldOff, layoutHintsR); numTriggerHoldOff = new TGNumberEntry(vfTrigger2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerHoldOff, layoutHints); numTriggerHoldOff->Resize(width, 20); - numTriggerHoldOff->Connect("Modified()", "ChannelSetting", this, "SetTriggerHoldOff()"); + numTriggerHoldOff->Connect("Modified()", "ChannelSettingPHA", this, "SetTriggerHoldOff()"); ///const uint32_t ChannelDCOffset = 0x1098; /// R/W TGLabel * lbDCOffset = new TGLabel(vfTrigger1, "DC offset [%]"); vfTrigger1->AddFrame(lbDCOffset, layoutHintsR); numDCOffset = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numDCOffset, layoutHints); numDCOffset->Resize(width, 20); - numDCOffset->Connect("Modified()", "ChannelSetting", this, "SetDCOffset()"); + numDCOffset->Connect("Modified()", "ChannelSettingPHA", this, "SetDCOffset()"); ///const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor TGLabel * lbTriggerSmoothing = new TGLabel(vfTrigger1, "Trigger Smoothing"); vfTrigger1->AddFrame(lbTriggerSmoothing, layoutHintsR); @@ -157,19 +158,19 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbTriggerSmoothing->AddEntry("64 samples", 32); cbTriggerSmoothing->AddEntry("128 samples", 0x3F); cbTriggerSmoothing->Resize(width, 20); - cbTriggerSmoothing->Connect("Changed()", "ChannelSetting", this, "SetTriggerSmoothing()"); + cbTriggerSmoothing->Connect("Changed()", "ChannelSettingPHA", this, "SetTriggerSmoothing()"); ///const uint32_t InputRiseTime = 0x1058; /// R/W OK TGLabel * lbInputRiseTime = new TGLabel(vfTrigger1, "Input rise time [ns]"); vfTrigger1->AddFrame(lbInputRiseTime, layoutHintsR); numInputRiseTime = new TGNumberEntry(vfTrigger2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numInputRiseTime, layoutHints); numInputRiseTime->Resize(width, 20); - numInputRiseTime->Connect("Modified()", "ChannelSetting", this, "SetInputRiseTime()"); + numInputRiseTime->Connect("Modified()", "ChannelSettingPHA", this, "SetInputRiseTime()"); ///const uint32_t RiseTimeValidationWindow = 0x1070; /// R/W OK TGLabel * lbRiseTimeValidWin = new TGLabel(vfTrigger1, "Rise Time Val. Win. [ns]"); vfTrigger1->AddFrame(lbRiseTimeValidWin, layoutHintsR); numRiseTimeValidWin = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numRiseTimeValidWin, layoutHints); numRiseTimeValidWin->Resize(width, 20); - numRiseTimeValidWin->Connect("Modified()", "ChannelSetting", this, "SetRiseTimeValidWin()"); + numRiseTimeValidWin->Connect("Modified()", "ChannelSettingPHA", this, "SetRiseTimeValidWin()"); /// DPP1 bit[19:18] TGLabel * lbTriggerMode = new TGLabel(vfTrigger1, "Trig. Mode"); vfTrigger1->AddFrame(lbTriggerMode, layoutHintsR); @@ -178,7 +179,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbTriggerMode->AddEntry("Coin.", 1); cbTriggerMode->AddEntry("Anti-Coin.", 3); cbTriggerMode->Resize(width, 20); - cbTriggerMode->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbTriggerMode->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); } {///================== Trapezoid Settings @@ -192,31 +193,31 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer TGLabel * lbTrapRiseTime = new TGLabel(vfTrap1, "Rise time [ns]"); vfTrap1->AddFrame(lbTrapRiseTime, layoutHintsR); numTrapRiseTime = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapRiseTime, layoutHints); numTrapRiseTime->Resize(width, 20); - numTrapRiseTime->Connect("Modified()", "ChannelSetting", this, "SetTrapRiseTime()"); + numTrapRiseTime->Connect("Modified()", "ChannelSettingPHA", this, "SetTrapRiseTime()"); ///const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK TGLabel * lbTrapFlatTop = new TGLabel(vfTrap1, "Flat Top [ns]"); vfTrap1->AddFrame(lbTrapFlatTop, layoutHintsR); numTrapFlatTop = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapFlatTop, layoutHints); numTrapFlatTop->Resize(width, 20); - numTrapFlatTop->Connect("Modified()", "ChannelSetting", this, "SetTrapFlatTop()"); + numTrapFlatTop->Connect("Modified()", "ChannelSettingPHA", this, "SetTrapFlatTop()"); ///const uint32_t DecayTime = 0x1068; /// R/W OK TGLabel * lbDecay = new TGLabel(vfTrap1, "Decay [ns]"); vfTrap1->AddFrame(lbDecay, layoutHintsR); numDecay = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numDecay, layoutHints); numDecay->Resize(width, 20); - numDecay->Connect("Modified()", "ChannelSetting", this, "SetDecay()"); + numDecay->Connect("Modified()", "ChannelSettingPHA", this, "SetDecay()"); ///const uint32_t PeakingTime = 0x1064; /// R/W OK TGLabel * lbPeaking = new TGLabel(vfTrap1, "Peaking [ns]"); vfTrap1->AddFrame(lbPeaking, layoutHintsR); numPeaking = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeaking, layoutHints); numPeaking->Resize(width, 20); - numPeaking->Connect("Modified()", "ChannelSetting", this, "SetPeaking()"); + numPeaking->Connect("Modified()", "ChannelSettingPHA", this, "SetPeaking()"); ///const uint32_t PeakHoldOff = 0x1078; /// R/W OK TGLabel * lbPeakHoldOff = new TGLabel(vfTrap1, "Peaking Holdoff [ns]"); vfTrap1->AddFrame(lbPeakHoldOff, layoutHintsR); numPeakHoldOff = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeakHoldOff, layoutHints); numPeakHoldOff->Resize(width, 20); - numPeakHoldOff->Connect("Modified()", "ChannelSetting", this, "SetPeakHoldOff()"); + numPeakHoldOff->Connect("Modified()", "ChannelSettingPHA", this, "SetPeakHoldOff()"); /// DPP1 bit[13:12] TGLabel * lbPeakMean = new TGLabel(vfTrap1, "Peak Mean"); vfTrap1->AddFrame(lbPeakMean, layoutHintsR); @@ -226,7 +227,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbPeakMean->AddEntry("16 samples", 2); cbPeakMean->AddEntry("64 samples", 3); cbPeakMean->Resize(width, 20); - cbPeakMean->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbPeakMean->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); /// DPP1 bit[22:20] TGLabel * lbBaseLineAvg = new TGLabel(vfTrap1, "Baseline avg."); vfTrap1->AddFrame(lbBaseLineAvg, layoutHintsR); @@ -239,7 +240,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbBaseLineAvg->AddEntry("4096 sp.", 5); cbBaseLineAvg->AddEntry("16384 sp.", 6); cbBaseLineAvg->Resize(width, 20); - cbBaseLineAvg->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbBaseLineAvg->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); } @@ -266,7 +267,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbDecimation->AddEntry("4 samples", 2); cbDecimation->AddEntry("8 samples", 3); cbDecimation->Resize(width, 20); - cbDecimation->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbDecimation->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); TGLabel * lbDecimationGain = new TGLabel(vfDPPCtrl11, "Decimation Gain :"); vfDPPCtrl11->AddFrame(lbDecimationGain, haha); cbDecimationGain = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDecimationGain); @@ -275,21 +276,21 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbDecimationGain->AddEntry("x 4", 2); cbDecimationGain->AddEntry("x 8", 3); cbDecimationGain->Resize(width, 20); - cbDecimationGain->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbDecimationGain->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); TGLabel * lbRollOver = new TGLabel(vfDPPCtrl11, "Roll-Over Flag :"); vfDPPCtrl11->AddFrame(lbRollOver, haha); cbRollOver = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbRollOver); cbRollOver->AddEntry("Disabled", 0); cbRollOver->AddEntry("Enabled", 1); cbRollOver->Resize(width, 20); - cbRollOver->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbRollOver->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); TGLabel * lbPileUp = new TGLabel(vfDPPCtrl11, "Pile-Up Flag :"); vfDPPCtrl11->AddFrame(lbPileUp, haha); cbPileUp = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbPileUp); cbPileUp->AddEntry("Disabled", 0); cbPileUp->AddEntry("Enabled", 1); cbPileUp->Resize(width, 20); - cbPileUp->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbPileUp->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); TGVerticalFrame * vfDPPCtrl21 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl21, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0)); TGVerticalFrame * vfDPPCtrl22 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl22, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0)); @@ -302,7 +303,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbLocalShapedTrigger->AddEntry("Odd Channel", 2); cbLocalShapedTrigger->AddEntry("OR", 3); cbLocalShapedTrigger->Resize(width, 20); - cbLocalShapedTrigger->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbLocalShapedTrigger->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGLabel * lbLocalTriggerValid = new TGLabel(vfDPPCtrl21, "Local Trigger Valid. :"); vfDPPCtrl21->AddFrame(lbLocalTriggerValid, haha); cbLocalTriggerValid = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbLocalTriggerValid); @@ -312,7 +313,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbLocalTriggerValid->AddEntry("AND", 3); cbLocalTriggerValid->AddEntry("OR", 4); cbLocalTriggerValid->Resize(100, 20); - cbLocalTriggerValid->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbLocalTriggerValid->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGLabel * lbVetoSource = new TGLabel(vfDPPCtrl21, "Veto Source :"); vfDPPCtrl21->AddFrame(lbVetoSource, haha); cbVetoSource = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbVetoSource); @@ -321,7 +322,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbVetoSource->AddEntry("individually set for paired channel", 2); cbVetoSource->AddEntry("negative saturation", 3); cbVetoSource->Resize(width, 20); - cbVetoSource->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbVetoSource->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGLabel * lbTriggerCounterRate = new TGLabel(vfDPPCtrl21, "Trigger Counter Rate :"); vfDPPCtrl21->AddFrame(lbTriggerCounterRate, haha); cbTriggerCounterRate = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbTriggerCounterRate); @@ -329,28 +330,28 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbTriggerCounterRate->AddEntry(" 128", 1); cbTriggerCounterRate->AddEntry("8192", 2); cbTriggerCounterRate->Resize(width, 20); - cbTriggerCounterRate->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbTriggerCounterRate->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGLabel * lbBaselineCal = new TGLabel(vfDPPCtrl21, "Active Baseline Cal. :"); vfDPPCtrl21->AddFrame(lbBaselineCal, haha); cbBaselineCal = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbBaselineCal); cbBaselineCal->AddEntry("Enabled", 0); cbBaselineCal->AddEntry("Disabled", 1); cbBaselineCal->Resize(width, 20); - cbBaselineCal->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbBaselineCal->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGLabel * lbTagCorrelatedEvent = new TGLabel(vfDPPCtrl21, "Tag correlated events :"); vfDPPCtrl21->AddFrame(lbTagCorrelatedEvent, haha); cbTagCorrelatedEvent = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbTagCorrelatedEvent); cbTagCorrelatedEvent->AddEntry("Disabled", 0); cbTagCorrelatedEvent->AddEntry("Enabled", 1); cbTagCorrelatedEvent->Resize(width, 20); - cbTagCorrelatedEvent->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbTagCorrelatedEvent->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGLabel * lbBaselineOptimize = new TGLabel(vfDPPCtrl11, "Baseline Optimaization :"); vfDPPCtrl11->AddFrame(lbBaselineOptimize, haha); cbBaselineOptimize = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbBaselineOptimize); cbBaselineOptimize->AddEntry("Disabled", 0); cbBaselineOptimize->AddEntry("Enabled", 1); cbBaselineOptimize->Resize(width, 20); - cbBaselineOptimize->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbBaselineOptimize->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); TGHorizontalFrame * hfDPPCtrl2 = new TGHorizontalFrame(vfDPPCtrl); vfDPPCtrl->AddFrame(hfDPPCtrl2, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 0)); @@ -364,7 +365,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbDisableSelfTrigger->AddEntry("used to acquire and propagate to trigger logic", 0); cbDisableSelfTrigger->AddEntry("only propagate to trigger logic", 1); cbDisableSelfTrigger->Resize(300, 20); - cbLocalShapedTrigger->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()"); + cbLocalShapedTrigger->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm1()"); TGLabel * lbExtra2WordOption = new TGLabel(vfDPPCtrl_a, "Extras 2 Word Option :"); vfDPPCtrl_a->AddFrame(lbExtra2WordOption, haha); cbExtra2WordOption = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbExtra2WordOption); @@ -373,7 +374,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer cbExtra2WordOption->AddEntry("[31:16] Lost Trigger Counter [15:0] Total Trigger Counter", 4); cbExtra2WordOption->AddEntry("[31:16] Event Before Zero Crossing [15:0] Event After Zero Crossing", 5); cbExtra2WordOption->Resize(400, 20); - cbLocalShapedTrigger->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()"); + cbLocalShapedTrigger->Connect("Changed()", "ChannelSettingPHA", this, "SetDPPAlgorithm2()"); } @@ -385,9 +386,9 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer isOpened = true; } -ChannelSetting::~ChannelSetting(){ +ChannelSettingPHA::~ChannelSettingPHA(){ - printf("close ChannelSetting window\n"); + printf("close ChannelSettingPHA window\n"); isOpened = false; @@ -403,20 +404,48 @@ ChannelSetting::~ChannelSetting(){ } -void ChannelSetting::LogMsg(TString msg){ +void ChannelSettingPHA::LogMsg(TString msg){ Emit("LogMsg(char*)", msg.Data()); } -void ChannelSetting::ChangeBoard(){ +void ChannelSettingPHA::ChangeBoard(){ if ( digi == NULL ) return; int boardID = boardIDEntry->GetNumber(); - ch2ns = (unsigned short) digi[boardID]->GetCh2ns(); + if( digi[boardID]->GetDPPType() != V1730_DPP_PHA_CODE){ + + if( boardID > presentBoardID ) { + + for( int i = boardID +1 ; i < nDigi; i++){ + if( digi[i]->GetDPPType() == V1730_DPP_PHA_CODE ){ + boardID = i; + boardIDEntry->SetNumber(i, false); + break; + } + if( i = nDigi -1 ) return; + } + + }else{ + + for( int i = boardID - 1 ; i >= 0; i--){ + if( digi[i]->GetDPPType() == V1730_DPP_PHA_CODE ){ + boardID = i; + boardIDEntry->SetNumber(i, false); + break; + } + if( i = nDigi -1 ) return; + } + + } + } + + ch2ns = (unsigned short) digi[boardID]->GetCh2ns(); ChangeCh(); + } -void ChannelSetting::ChangeCh(){ +void ChannelSettingPHA::ChangeCh(){ LogMsg(Form("========== Change to Channel %d", (int)chIDEntry->GetNumber())); @@ -441,56 +470,53 @@ void ChannelSetting::ChangeCh(){ eTemp->SetText(Form("%d C", digi[boardID]->ReadRegister(Register::DPP::ChannelADCTemperature, ch)), false); - if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){ - - numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false); - numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false); - cbTriggerSmoothing ->Select( digi[boardID]->ReadRegister(Register::DPP::PHA::RCCR2SmoothingFactor, ch), false); - numInputRiseTime ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::InputRiseTime, ch) * 4 * ch2ns, false); - numRiseTimeValidWin->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::RiseTimeValidationWindow, ch) * ch2ns, false); - - numTrapRiseTime->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, ch) * 4 * ch2ns, false); - numTrapFlatTop->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, ch) * 4 * ch2ns, false); - numDecay->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::DecayTime, ch) * 4 * ch2ns, false); - numPeaking->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::PeakingTime, ch) * 4 * ch2ns, false); - numPeakHoldOff->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::PeakHoldOff, ch) * 4 * ch2ns, false); - - temp = digi[boardID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch); - numTrapScale->SetNumber( temp & 0x3F, false ); - cbDecimation->Select( ( (temp >> 8) & 0x3), false); - cbDecimationGain->Select( ( (temp >> 10) & 0x3), false); - cbPeakMean->Select( ( (temp >> 12) & 0x3), false); - cbPolarity->Select( ( (temp >> 16) & 0x1), false); - cbTriggerMode->Select( ( (temp >> 18) & 0x3), false); - cbBaseLineAvg->Select( ( (temp >> 20) & 0x7), false); - cbDisableSelfTrigger->Select( ( (temp >> 24) & 0x1), false); - cbRollOver->Select( ( (temp >> 26) & 0x1), false); - cbPileUp->Select( ( (temp >> 27) & 0x1), false); - - temp = digi[boardID]->ReadRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, ch); - - if( (((temp >> 2)) & 0x1 ) == 1 ){ - cbLocalShapedTrigger->Select( ( (temp >> 0) & 0x3), false); - }else{ - cbLocalShapedTrigger->Select( -1, false); - } - if( (((temp >> 6)) & 0x1 ) == 1 ){ - cbLocalTriggerValid->Select( ( (temp >> 4) & 0x3), false); - }else{ - cbLocalTriggerValid->Select( -1, false); - } - cbVetoSource->Select( ( (temp >> 14) & 0x3), false); - cbTriggerCounterRate->Select( ( (temp >> 16) & 0x3), false); - cbBaselineCal->Select( ( (temp >> 18) & 0x1), false); - cbTagCorrelatedEvent->Select( ( (temp >> 19) & 0x1), false); - cbBaselineOptimize->Select( ( (temp >> 29) & 0x1), false); - cbExtra2WordOption->Select( ( (temp >> 8) & 0x7), false); + numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false); + numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false); + cbTriggerSmoothing ->Select( digi[boardID]->ReadRegister(Register::DPP::PHA::RCCR2SmoothingFactor, ch), false); + numInputRiseTime ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::InputRiseTime, ch) * 4 * ch2ns, false); + numRiseTimeValidWin->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::RiseTimeValidationWindow, ch) * ch2ns, false); + numTrapRiseTime->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, ch) * 4 * ch2ns, false); + numTrapFlatTop->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, ch) * 4 * ch2ns, false); + numDecay->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::DecayTime, ch) * 4 * ch2ns, false); + numPeaking->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::PeakingTime, ch) * 4 * ch2ns, false); + numPeakHoldOff->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::PeakHoldOff, ch) * 4 * ch2ns, false); + + temp = digi[boardID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch); + numTrapScale->SetNumber( temp & 0x3F, false ); + cbDecimation->Select( ( (temp >> 8) & 0x3), false); + cbDecimationGain->Select( ( (temp >> 10) & 0x3), false); + cbPeakMean->Select( ( (temp >> 12) & 0x3), false); + cbPolarity->Select( ( (temp >> 16) & 0x1), false); + cbTriggerMode->Select( ( (temp >> 18) & 0x3), false); + cbBaseLineAvg->Select( ( (temp >> 20) & 0x7), false); + cbDisableSelfTrigger->Select( ( (temp >> 24) & 0x1), false); + cbRollOver->Select( ( (temp >> 26) & 0x1), false); + cbPileUp->Select( ( (temp >> 27) & 0x1), false); + + temp = digi[boardID]->ReadRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, ch); + + if( (((temp >> 2)) & 0x1 ) == 1 ){ + cbLocalShapedTrigger->Select( ( (temp >> 0) & 0x3), false); + }else{ + cbLocalShapedTrigger->Select( -1, false); } + if( (((temp >> 6)) & 0x1 ) == 1 ){ + cbLocalTriggerValid->Select( ( (temp >> 4) & 0x3), false); + }else{ + cbLocalTriggerValid->Select( -1, false); + } + cbVetoSource->Select( ( (temp >> 14) & 0x3), false); + cbTriggerCounterRate->Select( ( (temp >> 16) & 0x3), false); + cbBaselineCal->Select( ( (temp >> 18) & 0x1), false); + cbTagCorrelatedEvent->Select( ( (temp >> 19) & 0x1), false); + cbBaselineOptimize->Select( ( (temp >> 29) & 0x1), false); + cbExtra2WordOption->Select( ( (temp >> 8) & 0x7), false); + } -void ChannelSetting::SetAllChannels(){ +void ChannelSettingPHA::SetAllChannels(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; @@ -533,7 +559,7 @@ void ChannelSetting::SetAllChannels(){ } -void ChannelSetting::SetChannelMask(){ +void ChannelSettingPHA::SetChannelMask(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; @@ -548,7 +574,7 @@ void ChannelSetting::SetChannelMask(){ } -void ChannelSetting::SetDPPAlgorithm1(){ +void ChannelSettingPHA::SetDPPAlgorithm1(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; @@ -579,7 +605,7 @@ void ChannelSetting::SetDPPAlgorithm1(){ } -void ChannelSetting::SetDPPAlgorithm2(){ +void ChannelSettingPHA::SetDPPAlgorithm2(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; @@ -608,7 +634,7 @@ void ChannelSetting::SetDPPAlgorithm2(){ } -void ChannelSetting::SetInputDynamicRange(){ +void ChannelSettingPHA::SetInputDynamicRange(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; @@ -618,7 +644,7 @@ void ChannelSetting::SetInputDynamicRange(){ } -void ChannelSetting::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address){ +void ChannelSettingPHA::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address){ unsigned int temp = numEntry->GetNumber(); unsigned int res = temp % (stepSize * ch2ns); @@ -631,20 +657,20 @@ void ChannelSetting::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSi if( digi != NULL ) digi[boardID]->WriteRegister(address, temp / stepSize / ch2ns , ch); } -void ChannelSetting::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); } -void ChannelSetting::SetPreTrigger() {printf("=== %s\n", __func__); ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger);} -void ChannelSetting::SetEventAggregate() {printf("=== %s\n", __func__); ChangeAStep(numEventAgg, 1, Register::DPP::NumberEventsPerAggregate_G);} -void ChannelSetting::SetTriggerThreshold(){printf("=== %s\n", __func__); ChangeAStep(numTriggerThreshold, 1, Register::DPP::PHA::TriggerThreshold); } -void ChannelSetting::SetTriggerHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PHA::TriggerHoldOffWidth);} -void ChannelSetting::SetInputRiseTime() {printf("=== %s\n", __func__); ChangeAStep(numInputRiseTime, 4, Register::DPP::PHA::InputRiseTime);} -void ChannelSetting::SetRiseTimeValidWin(){printf("=== %s\n", __func__); ChangeAStep(numRiseTimeValidWin, 1, Register::DPP::PHA::RiseTimeValidationWindow);} -void ChannelSetting::SetTrapRiseTime() {printf("=== %s\n", __func__); ChangeAStep(numTrapRiseTime, 4, Register::DPP::PHA::TrapezoidRiseTime);} -void ChannelSetting::SetTrapFlatTop() {printf("=== %s\n", __func__); ChangeAStep(numTrapFlatTop, 4, Register::DPP::PHA::TrapezoidFlatTop);} -void ChannelSetting::SetDecay() {printf("=== %s\n", __func__); ChangeAStep(numDecay, 4, Register::DPP::PHA::DecayTime);} -void ChannelSetting::SetPeaking() {printf("=== %s\n", __func__); ChangeAStep(numPeaking, 4, Register::DPP::PHA::PeakingTime);} -void ChannelSetting::SetPeakHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numPeakHoldOff, 4, Register::DPP::PHA::PeakHoldOff);} +void ChannelSettingPHA::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); } +void ChannelSettingPHA::SetPreTrigger() {printf("=== %s\n", __func__); ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger);} +void ChannelSettingPHA::SetEventAggregate() {printf("=== %s\n", __func__); ChangeAStep(numEventAgg, 1, Register::DPP::NumberEventsPerAggregate_G);} +void ChannelSettingPHA::SetTriggerThreshold(){printf("=== %s\n", __func__); ChangeAStep(numTriggerThreshold, 1, Register::DPP::PHA::TriggerThreshold); } +void ChannelSettingPHA::SetTriggerHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PHA::TriggerHoldOffWidth);} +void ChannelSettingPHA::SetInputRiseTime() {printf("=== %s\n", __func__); ChangeAStep(numInputRiseTime, 4, Register::DPP::PHA::InputRiseTime);} +void ChannelSettingPHA::SetRiseTimeValidWin(){printf("=== %s\n", __func__); ChangeAStep(numRiseTimeValidWin, 1, Register::DPP::PHA::RiseTimeValidationWindow);} +void ChannelSettingPHA::SetTrapRiseTime() {printf("=== %s\n", __func__); ChangeAStep(numTrapRiseTime, 4, Register::DPP::PHA::TrapezoidRiseTime);} +void ChannelSettingPHA::SetTrapFlatTop() {printf("=== %s\n", __func__); ChangeAStep(numTrapFlatTop, 4, Register::DPP::PHA::TrapezoidFlatTop);} +void ChannelSettingPHA::SetDecay() {printf("=== %s\n", __func__); ChangeAStep(numDecay, 4, Register::DPP::PHA::DecayTime);} +void ChannelSettingPHA::SetPeaking() {printf("=== %s\n", __func__); ChangeAStep(numPeaking, 4, Register::DPP::PHA::PeakingTime);} +void ChannelSettingPHA::SetPeakHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numPeakHoldOff, 4, Register::DPP::PHA::PeakHoldOff);} -void ChannelSetting::SetDCOffset(){ +void ChannelSettingPHA::SetDCOffset(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; short boardID = boardIDEntry->GetNumber(); @@ -655,7 +681,7 @@ void ChannelSetting::SetDCOffset(){ if( digi != NULL ) digi[boardID]->WriteRegister(Register::DPP::ChannelDCOffset, bit , ch); } -void ChannelSetting::SetTriggerSmoothing(){ +void ChannelSettingPHA::SetTriggerSmoothing(){ printf("=== %s\n", __func__); if ( digi == NULL ) return; short boardID = boardIDEntry->GetNumber(); diff --git a/channelSetting.h b/channelSettingPHA.h similarity index 88% rename from channelSetting.h rename to channelSettingPHA.h index 2fb316f..0e65195 100644 --- a/channelSetting.h +++ b/channelSettingPHA.h @@ -1,5 +1,5 @@ -#ifndef CHANNEL_SETTING_H -#define CHANNEL_SETTING_H +#ifndef CHANNEL_SETTING_PHA_H +#define CHANNEL_SETTING_PHA_H #include #include @@ -13,8 +13,8 @@ class TGWindow; class TGMainFrame; -class ChannelSetting{ - RQ_OBJECT("ChannelSetting") +class ChannelSettingPHA{ + RQ_OBJECT("ChannelSettingPHA") private: TGMainFrame * fMain; @@ -64,16 +64,19 @@ class ChannelSetting{ TGComboBox * cbExtra2WordOption; Digitizer ** digi; - int NChannel; + int nDigi; + int NChannel; // hard coded = 16 bool isOpened; + int presentBoardID; + unsigned short ch2ns; void ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address); public: - ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi); - virtual ~ChannelSetting(); + ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID); + virtual ~ChannelSettingPHA(); void CloseWindow() { delete this; }