From db7814b193591e63a8c7f505024caa45fd3e6ea2 Mon Sep 17 00:00:00 2001 From: "carina@hades" Date: Fri, 16 Sep 2022 17:53:57 -0400 Subject: [PATCH] tested boardSetting GUI, now need to read all setting from Digitizer --- ClassData.h | 48 ++++-- ClassDigitizer.cpp | 29 ++-- ClassDigitizer.h | 10 +- DigitizerPHA.cpp | 52 +++--- FSUDAQ.cpp | 39 ++++- FSUDAQ.h | 5 +- RegisterAddress.h | 2 + boardSetting.cpp | 401 +++++++++++++++++++++++++++++++-------------- boardSetting.h | 70 +++++++- channelSetting.cpp | 231 ++++++++++++++++---------- channelSetting.h | 4 - test.cpp | 1 + 12 files changed, 622 insertions(+), 270 deletions(-) diff --git a/ClassData.h b/ClassData.h index 44e588c..e5e1d67 100644 --- a/ClassData.h +++ b/ClassData.h @@ -26,6 +26,7 @@ class Data{ uint32_t BufferSize; unsigned short NumEvents[MaxNChannels]; + unsigned long TotNumEvents[MaxNChannels]; unsigned long long Timestamp[MaxNChannels][MaxNData]; unsigned short Energy[MaxNChannels][MaxNData]; unsigned short Energy2[MaxNChannels][MaxNData]; /// in PSD, Energy = Qshort, Energy2 = Qlong @@ -52,8 +53,9 @@ class Data{ void SaveBuffer(const char * fileName); void DecodeBuffer(int verbose = 0); - void DecodeBuffer(char * buffer, int verbose = 0); + void DecodeBuffer(char * buffer, int verbose = 0); // for outside data + void PrintStat(); protected: @@ -78,6 +80,7 @@ class Data{ inline Data::Data(){ buffer = NULL; + for ( int i = 0; i < MaxNChannels; i++) TotNumEvents[i] = 0; ClearData(); SaveWaveformToMemory = false; nw = 0; @@ -104,7 +107,7 @@ inline void Data::AllocateMemory(){ inline void Data::FreeMemory(){ printf("======= Free memory\n"); - if( buffer != NULL ) delete buffer; + //if( buffer != NULL ) delete buffer; } inline void Data::ClearData(){ @@ -148,6 +151,14 @@ inline void Data::SaveBuffer(const char * fileName){ fclose(haha); } +inline void Data::PrintStat(){ + + for(int i = 0; i < MaxNChannels; i++){ + printf("%2d | %6d | %6lu\n", i, NumEvents[i], TotNumEvents[i]); + } + +} + inline void Data::DecodeBuffer(char * buffer, int verbose){ this->buffer = buffer; DecodeBuffer(verbose); @@ -160,7 +171,11 @@ inline void Data::DecodeBuffer(int verbose){ if( verbose >= 1 ) printf(" buffer is empty \n"); return; } - + + if( nByte == 0 ) { + return; + } + nw = 0; do{ @@ -180,7 +195,7 @@ inline void Data::DecodeBuffer(int verbose){ unsigned int AggCounter = ReadBuffer(nw, verbose); if( verbose >= 2 ) printf("Agg Counter : %d \n", AggCounter); - for( int chMask = 0; chMask < 8 ; chMask ++ ){ + for( int chMask = 0; chMask < MaxNChannels/2 ; chMask ++ ){ if( ((ChannelMask >> chMask) & 0x1 ) == 0 ) continue; if( verbose >= 2 ) printf("---------------------- Dual Channel Block : %d, nw : %d\n", chMask *2, nw); @@ -289,8 +304,6 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, int verbose int channel = ChannelMask*2 + channelTag; if( verbose >= 2 ) printf("ch : %d, timeStamp0 %u \n", channel, timeStamp0); - NumEvents[channel] ++; - //TODO Skip ///===== read waveform if( SaveWaveformToMemory ) { @@ -346,7 +359,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, int verbose unsigned long long extTimeStamp = 0; if( extra2Option == 0 || extra2Option == 2 ) extTimeStamp = (extra2 >> 15); - unsigned long long timeStamp = (extTimeStamp << 32) ; + unsigned long long timeStamp = (extTimeStamp << 30) ; timeStamp = timeStamp + timeStamp0; nw = nw +1 ; word = ReadBuffer(nw, verbose); @@ -360,7 +373,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, int verbose printf("PileUp : %d , extra : 0x%03x, energy : %d \n", pileUp, extra, energy); printf(" lost event : %d \n", ((extra >> 0) & 0x1) ); - printf(" roll-over : %d \n", ((extra >> 1) & 0x1) ); + printf(" roll-over : %d (fake event)\n", ((extra >> 1) & 0x1) ); printf(" fake-event : %d \n", ((extra >> 3) & 0x1) ); printf(" input sat. : %d \n", ((extra >> 4) & 0x1) ); printf(" lost trg : %d \n", ((extra >> 5) & 0x1) ); @@ -372,8 +385,13 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, int verbose } - if( verbose >= 1 ) printf("%4d | ch : %2d, PileUp : %d , energy : %d, roll-Over: %d, timestamp : %llu, triggerAt : %d, nSample : %d\n", - NumEvents[channel], channel, pileUp, energy, rollOver, timeStamp, triggerAtSample, nSample ); + if( rollOver == 0 ) { + NumEvents[channel] ++; + TotNumEvents[channel] ++; + } + + if( verbose >= 1 ) printf("%4d | ch : %2d, PileUp : %d , energy : %d, roll-Over: %d, timestamp : %llu, triggerAt : %d, nSample : %d, %f\n", + NumEvents[channel], channel, pileUp, energy, rollOver, timeStamp, triggerAtSample, nSample , timeStamp * 4. / 1e9); Energy[channel][NumEvents[channel]] = energy; Timestamp[channel][NumEvents[channel]] = timeStamp; @@ -477,9 +495,6 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, int verbose int channel = ChannelMask*2 + channelTag; if( verbose >= 2 ) printf("ch : %d, timeStamp %u \n", channel, timeStamp0); - - NumEvents[channel] ++; - ///===== read waveform if( SaveWaveformToMemory ) { tempWaveform1.clear(); @@ -534,7 +549,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, int verbose unsigned long long extTimeStamp = 0; if( extraOption == 0 || extraOption == 2 ) extTimeStamp = (extra >> 15); - unsigned long long timeStamp = (extTimeStamp << 32) ; + unsigned long long timeStamp = (extTimeStamp << 30) ; timeStamp = timeStamp + timeStamp0; nw = nw +1 ; word = ReadBuffer(nw, verbose); @@ -542,6 +557,11 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, int verbose unsigned int Qshort = (word & 0x7FFF); bool isEnergyCorrect = ((word >> 15) & 0x1); + if( isEnergyCorrect == 1 ) { + NumEvents[channel] ++; + TotNumEvents[channel] ++; + } + if( verbose >= 2 ) printf("extra : 0x%08x, Qshort : %d, Qlong : %d \n", extra, Qshort, Qlong); if( verbose >= 1 ) printf("ch : %2d, Qshort : %d, Qlong : %d, timestamp : %llu\n", diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index e4e2e3c..848fbc7 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -33,7 +33,7 @@ Digitizer::Digitizer(){ Digitizer::Digitizer(int boardID, int portID, bool verbose){ Digitizer(); - OpenDigitizer(boardID, portID, verbose); + OpenDigitizer(boardID, portID, true, verbose); } Digitizer::~Digitizer(){ @@ -47,7 +47,17 @@ void Digitizer::Reset(){ if( ret != 0 ) ErrorMsg("Reset"); } -int Digitizer::OpenDigitizer(int boardID, int portID, bool verbose){ +void Digitizer::PrintBoard(){ + printf("Connected to Model %s with handle %d using %s\n", BoardInfo.ModelName, handle, LinkType == CAEN_DGTZ_USB ? "USB" : "Optical Link"); + printf("Sampling rate : %.0f MHz = %.1f ns \n", 1000/ch2ns, ch2ns); + printf("Number of Channels : %d = 0x%X\n", NChannel, channelMask); + printf("SerialNumber :\e[1m\e[33m %d\e[0m\n", BoardInfo.SerialNumber); + printf("ADC bit is \e[33m%d\e[0m, %d = 0x%x\n", ADCbits, ADCFullSize, ADCFullSize); + printf("ROC FPGA Release is %s\n", BoardInfo.ROC_FirmwareRel); + printf("AMC FPGA Release is %s\n", BoardInfo.AMC_FirmwareRel); +} + +int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose){ this->boardID = boardID; this->portID = portID; @@ -172,7 +182,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool verbose){ ErrorMsg("end of OpenDigitizer"); - if( isConnected ) { + if( isConnected && program) { ProgramBoard(); } @@ -188,7 +198,7 @@ int Digitizer::CloseDigitizer(){ ret = CAEN_DGTZ_SWStopAcquisition(handle); ret |= CAEN_DGTZ_CloseDigitizer(handle); - data->FreeMemory(); + //data->FreeMemory(); return ret; } @@ -327,7 +337,9 @@ void Digitizer::ReadData(){ } ret = CAEN_DGTZ_ReadData(handle, CAEN_DGTZ_SLAVE_TERMINATED_READOUT_MBLT, data->buffer, &(data->nByte)); - printf("Read Buffer size %d byte \n", data->nByte); + uint32_t EventSize = ReadRegister(Register::DPP::EventSize); // Is it as same as data->nByte? + printf("Read Buffer size %d byte, Event Size : %d byte \n", data->nByte, EventSize); + if (ret || data->nByte == 0) { ErrorMsg("ReadData"); return; @@ -493,13 +505,10 @@ void Digitizer::SetDPPAlgorithmControl(uint32_t bit, int ch){ } unsigned int Digitizer::ReadBits(uint32_t address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ){ - uint32_t bit ; - uint32_t bitmask = (uint(pow(2, bitLength)-1) << bitSmallestPos); int tempCh = ch; if (ch < 0 && address < 0x8000 ) tempCh = 0; /// take ch-0 - bit = ReadRegister(address, tempCh); - ///printf("bit : 0x%x, bitmask : 0x%x \n", bit, bitmask); - bit = (bit & ~bitmask); + uint32_t bit = ReadRegister(address, tempCh); + bit = (bit >> bitSmallestPos ) & uint(pow(2, bitLength)-1); return bit; } diff --git a/ClassDigitizer.h b/ClassDigitizer.h index 6c20acb..7a80a90 100644 --- a/ClassDigitizer.h +++ b/ClassDigitizer.h @@ -28,7 +28,7 @@ class Digitizer{ void Reset(); - int OpenDigitizer(int boardID, int portID = 0, bool verbose = false);/// portID is for optical link for using PCIe card, from 0, 1, 2, 3 + int OpenDigitizer(int boardID, int portID = 0, bool program = false, bool verbose = false);/// portID is for optical link for using PCIe card, from 0, 1, 2, 3 int CloseDigitizer(); ///=================Settings @@ -61,6 +61,7 @@ class Digitizer{ //void SetBoardID(unsigned int ID) {WriteRegister(Register::DPP::BoardID, ID)); ///================ Get Settings + std::string GetModelName() {return BoardInfo.ModelName;} int GetSerialNumber() {return BoardInfo.SerialNumber;} int GetChannelMask() {return channelMask;} bool GetChannelOnOff(unsigned ch) {return (channelMask & ( 1 << ch) );} @@ -69,7 +70,11 @@ class Digitizer{ int GetHandle() {return handle;} bool GetConnectionStatus() {return isConnected;} int GetDPPType() {return DPPType;} - + CAEN_DGTZ_ConnectionType GetLinkType() {return LinkType;} + int GetADCBits() {return BoardInfo.ADC_NBits;} + std::string GetROCVersion() {return BoardInfo.ROC_FirmwareRel;} + std::string GetAMCVersion() {return BoardInfo.AMC_FirmwareRel;} + int GetChTemperature(int ch) ; unsigned int GetRecordLengthSample(int ch) {return ReadRegister(Register::DPP::RecordLength_G, ch) * 8;} @@ -85,6 +90,7 @@ class Digitizer{ unsigned int ReadBits(uint32_t address, unsigned int bitLength, unsigned int bitSmallestPos, int ch = -1 ); unsigned int GetDPPAlgorithmControl(int ch = -1) {return ReadRegister(Register::DPP::DPPAlgorithmControl, ch);} + void PrintBoard(); void PrintACQStatue(); ///================ ACQ control diff --git a/DigitizerPHA.cpp b/DigitizerPHA.cpp index 303e53d..2a22400 100644 --- a/DigitizerPHA.cpp +++ b/DigitizerPHA.cpp @@ -5,7 +5,7 @@ DigitizerPHA::DigitizerPHA(){ } DigitizerPHA::DigitizerPHA(int boardID, int portID, bool verbose){ - OpenDigitizer(boardID, portID, verbose); + OpenDigitizer(boardID, portID, true, verbose); } DigitizerPHA::~DigitizerPHA(){ @@ -15,7 +15,7 @@ DigitizerPHA::~DigitizerPHA(){ int DigitizerPHA::ProgramBoard(){ ret = CAEN_DGTZ_Reset(handle); - printf("======== program board\n"); + printf("======== program board PHA\n"); ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 625); ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x4E8115); @@ -32,7 +32,7 @@ int DigitizerPHA::ProgramBoard(){ ret = CAEN_DGTZ_SetRunSynchronizationMode(handle, CAEN_DGTZ_RUN_SYNC_Disabled); if( ret != 0 ) { printf("==== set board error.\n"); return 0;} - printf("======== program Channels\n"); + printf("======== program Channels PHA\n"); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::PHA::DecayTime + 0x7000 , 5000 ); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::PHA::TrapezoidFlatTop + 0x7000 , 0x62 ); @@ -48,9 +48,9 @@ int DigitizerPHA::ProgramBoard(){ ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::ChannelDCOffset + 0x7000 , 0xEEEE ); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::PreTrigger + 0x7000 , 124 ); - ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::InputDynamicRange + 0x7000 , 0x1 ); + ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::InputDynamicRange + 0x7000 , 0x0 ); - ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::NumberEventsPerAggregate_G + 0x7000, 1000); + ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::NumberEventsPerAggregate_G + 0x7000, 100); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::AggregateOrganization, 0); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::MaxAggregatePerBlockTransfer, 40); ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::DPPAlgorithmControl + 0x7000, 0xe30200f); @@ -163,14 +163,16 @@ double DigitizerPHA::GetSetting(Setting::PHA settingName, int ch){ switch(settingName){ /// board setting - case Setting::PHA::AutoDataFlush_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 0); value = temp; break; - case Setting::PHA::DualTrace_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 11); value = temp; break; - case Setting::PHA::AnalogProbe1_board_2bit: temp = ReadBits(Register::DPP::BoardConfiguration, 2, 12); value = temp; break; - case Setting::PHA::AnalogProbe2_board_2bit: temp = ReadBits(Register::DPP::BoardConfiguration, 2, 14); value = temp; break; - case Setting::PHA::WavefromRecording_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 16); value = temp; break; - case Setting::PHA::EnableExtra2Word_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 17); value = temp; break; - case Setting::PHA::EnergyRecording_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 19); value = temp; break; - case Setting::PHA::VirtualProbe_board_4bit: temp = ReadBits(Register::DPP::BoardConfiguration, 4, 20); value = temp; break; + case Setting::PHA::AutoDataFlush_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 0); value = temp; break; + case Setting::PHA::DecimateWaveForm_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 1); value = temp; break; + case Setting::PHA::TriggerPropapation_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 2); value = temp; break; + case Setting::PHA::DualTrace_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 11); value = temp; break; + case Setting::PHA::AnalogProbe1_board_2bit: temp = ReadBits(Register::DPP::BoardConfiguration, 2, 12); value = temp; break; + case Setting::PHA::AnalogProbe2_board_2bit: temp = ReadBits(Register::DPP::BoardConfiguration, 2, 14); value = temp; break; + case Setting::PHA::WavefromRecording_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 16); value = temp; break; + case Setting::PHA::EnableExtra2Word_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 17); value = temp; break; + case Setting::PHA::EnergyRecording_board_bool: temp = ReadBits(Register::DPP::BoardConfiguration, 1, 19); value = temp; break; + case Setting::PHA::VirtualProbe_board_4bit: temp = ReadBits(Register::DPP::BoardConfiguration, 4, 20); value = temp; break; /// DPP Algorithm Control 1 case Setting::PHA::TrapazoidRescaling_5bit: temp = ReadBits(Register::DPP::DPPAlgorithmControl, 5, 0, ch); value = temp; break; @@ -311,18 +313,18 @@ void DigitizerPHA::PrintBoardConfiguration(){ printf(" Bit[20:23] = %d = Digital Virtual probe 1 : ", ((value[0] >> 20) & 0x7 )); switch (((value[0] >> 20) & 0xF )) { case 0: printf("Peaking, shows where the energy is calculated; \n"); break; - case 1: printf("”Armed”, digital input showing where the RC‐CR2 crosses the Threshold\n"); - case 2: printf("”Peak Run”, starts with the trigger and last for the whole event\n"); - case 3: printf("”Pile‐up”, shows where a pile‐up event occurred\n"); - case 4: printf("”Peaking”, shows where the energy is calculated\n"); - case 5: printf("”TRG Validation Win”, digital input showing the trigger validation acceptance window TVAW\n"); - case 6: printf("”Baseline freeze”, shows where the algorithm stops calculating the baseline and its value is frozen\n"); - case 7: printf("”TRG Holdoff”, shows the trigger hold‐off parameter\n"); - case 8: printf("”TRG Validation”, shows the trigger validation signal TRG_VAL \n"); - case 9: printf("”Acq Busy”, this is 1 when the board is busy (saturated input signal or full memory board) or there is a veto\n"); - case 10: printf("”Zero Cross. Win.”, shows the RT Discrimination Width\n"); - case 11: printf("”Ext TRG”, shows the external trigger, when available\n"); - case 12: printf("”Busy”, shows when the memory board is full.\n"); + case 1: printf("”Armed”, digital input showing where the RC‐CR2 crosses the Threshold\n"); break; + case 2: printf("”Peak Run”, starts with the trigger and last for the whole event\n");break; + case 3: printf("”Pile‐up”, shows where a pile‐up event occurred\n");break; + case 4: printf("”Peaking”, shows where the energy is calculated\n");break; + case 5: printf("”TRG Validation Win”, digital input showing the trigger validation acceptance window TVAW\n");break; + case 6: printf("”Baseline freeze”, shows where the algorithm stops calculating the baseline and its value is frozen\n");break; + case 7: printf("”TRG Holdoff”, shows the trigger hold‐off parameter\n");break; + case 8: printf("”TRG Validation”, shows the trigger validation signal TRG_VAL \n");break; + case 9: printf("”Acq Busy”, this is 1 when the board is busy (saturated input signal or full memory board) or there is a veto\n");break; + case 10: printf("”Zero Cross. Win.”, shows the RT Discrimination Width\n");break; + case 11: printf("”Ext TRG”, shows the external trigger, when available\n");break; + case 12: printf("”Busy”, shows when the memory board is full.\n");break; } printf(" Bit[26:28] = %d = Digital Virtual probe 2 : ", ((value[0] >> 26) & 0x7 )); if( ((value[0] >> 26) & 0x7 ) == 0 ) { diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index f5411ff..3b76d01 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -33,12 +33,16 @@ 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); @@ -81,6 +85,12 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { TGTextButton *bOpenDigitizers = new TGTextButton(hframe,"Open Digitizers"); bOpenDigitizers->Connect("Clicked()","MainWindow",this,"DetectDigitizer()"); 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); ///================= signal Channel group TGGroupFrame * group1 = new TGGroupFrame(hframe, "Single Channel", kHorizontalFrame); @@ -120,8 +130,10 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { LogMsg("Ready to run."); + HandleMenu(M_DIGITIZER_SCAN); + HandleMenu(M_BOARD_SETTINGS); - HandleMenu(M_CH_SETTING); + //HandleMenu(M_CH_SETTING); } MainWindow::~MainWindow() { @@ -159,20 +171,34 @@ void MainWindow::HandleMenu(Int_t id){ case M_DIGITIZER_SCAN:{ printf("============= detect digitizers \n"); - //DetectDigitizer(); + DetectDigitizer(); printf("============= Connect %d digitizers...\n", nDigi); + if( nDigi > 0 ) { - digi = new Digitizer *[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"); } } } + }break; ///========================= File Open @@ -251,6 +277,8 @@ void MainWindow::DetectDigitizer(){ 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 ++; } } } @@ -259,6 +287,8 @@ void MainWindow::DetectDigitizer(){ for( int i = 0 ; i < nDigi ; i++){ printf("port: %d, board: %d, DPP Type : %d \n", portID[i], boardID[i], DPPType[i]); } + printf("Number of PHA : %d \n", nPHA); + printf("Number of PSD : %d \n", nPSD); } @@ -281,9 +311,6 @@ Double_t standardPulse(Double_t *x, Double_t * par){ void MainWindow::GoodBye(){ - if( nDigi > 0 && digi != NULL) { - for(int i = 0; i < nDigi ; i++) digi[0]->CloseDigitizer(); - } printf("----- bye bye ---- \n"); gApplication->Terminate(0); diff --git a/FSUDAQ.h b/FSUDAQ.h index 1c1f8a6..a29f6cf 100644 --- a/FSUDAQ.h +++ b/FSUDAQ.h @@ -44,12 +44,15 @@ private: //TGTextButton *bStopRun; //TGTextButton *bFitTrace; - int nDigi; + unsigned short nDigi; vector DPPType; vector portID; vector boardID; vector serialNum; static Digitizer ** digi; + unsigned short nPHA, nPSD; + static DigitizerPHA ** pha; + static DigitizerPSD ** psd; BoardSetting * boardSetting; ChannelSetting * channelSetting; diff --git a/RegisterAddress.h b/RegisterAddress.h index e10c7da..fb7a461 100644 --- a/RegisterAddress.h +++ b/RegisterAddress.h @@ -192,6 +192,8 @@ namespace Setting{ enum PHA{ /// board setting AutoDataFlush_board_bool, + DecimateWaveForm_board_bool, + TriggerPropapation_board_bool, DualTrace_board_bool, AnalogProbe1_board_2bit, AnalogProbe2_board_2bit, diff --git a/boardSetting.cpp b/boardSetting.cpp index 70d412e..0aecfa6 100644 --- a/boardSetting.cpp +++ b/boardSetting.cpp @@ -10,43 +10,63 @@ #include "boardSetting.h" TString boardSettingName[NUM_BOARD_INFO] = { "Model", - "Board Info", - "Link Type", - "Serial Number", - "Number of channels", - "Sampling rate", - "ADC bit", - "ROC version", - "AMC version" - }; + "DPP Type", + "Link Type", + "Serial Number", + "Number of channels", + "Sampling rate", + "ADC bit", + "ROC version", + "AMC version" + }; BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){ + this->nDigi = nBoard; this->digi = digi; + gClient->GetColorByName("red", red); + gClient->GetColorByName("blue", blue); + fMain = new TGMainFrame(p,w,h); fMain->SetWindowName("Board Settings "); fMain->Connect("CloseWindow()", "BoardSetting", this, "CloseWindow()"); TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,3,3); /// left, right, top, bottom - TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe, layoutHints); - ///==========Module choose TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe0, layoutHints); TGLabel * lb0 = new TGLabel(hframe0, "Board ID :"); hframe0->AddFrame(lb0, layoutHints); - 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, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); boardIDEntry->SetWidth(50); - boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard); + boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard-1); boardIDEntry->Connect("Modified()", "BoardSetting", this, "ChangeBoard()"); if( nBoard <= 1 ) boardIDEntry->SetState(false); int boardID = boardIDEntry->GetNumber(); + ///- Board Failure status + TGLabel * lbPLLStatus = new TGLabel(hframe0, "PLL status :"); hframe0->AddFrame(lbPLLStatus, layoutHints); + enPLLStatus = new TGTextEntry(hframe0, ""); hframe0->AddFrame(enPLLStatus, layoutHints); + enPLLStatus->SetEnabled(false); + enPLLStatus->Resize(50, 20); + + TGLabel * lbTempStatus = new TGLabel(hframe0, "Temp status :"); hframe0->AddFrame(lbTempStatus, layoutHints); + enTempStatus = new TGTextEntry(hframe0, ""); hframe0->AddFrame(enTempStatus, layoutHints); + enTempStatus->SetEnabled(false); + enTempStatus->Resize(50, 20); + + TGLabel * lbADCPwrStatus = new TGLabel(hframe0, "ADC Power :"); hframe0->AddFrame(lbADCPwrStatus, layoutHints); + enADCPwrStatus = new TGTextEntry(hframe0, ""); hframe0->AddFrame(enADCPwrStatus, layoutHints); + enADCPwrStatus->SetEnabled(false); + enADCPwrStatus->Resize(50, 20); + + TGTextButton * bSoftwareReset = new TGTextButton(hframe0, "Reset default Settings"); hframe0->AddFrame(bSoftwareReset, layoutHints); + TGTextButton * bSoftwareClear = new TGTextButton(hframe0, "Clear Buffer"); hframe0->AddFrame(bSoftwareClear, layoutHints); + ///============ fixed info TGHorizontalFrame * hframeInfo = new TGHorizontalFrame(vframe); vframe->AddFrame(hframeInfo, new TGLayoutHints(kLHintsExpandX)); @@ -66,8 +86,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d entry[i] = new TGTextEntry(hframe[i], new TGTextBuffer(1)); hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4)); entry[i]->SetEnabled(false); - entry[i]->SetText( Form("0x%x", 0) ); - } ///========= Board Configure @@ -75,24 +93,24 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGVerticalFrame * vBdCfg = new TGVerticalFrame(gBdCfg); gBdCfg->AddFrame(vBdCfg); TGHorizontalFrame * hframeBdCfg1 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg1, layoutHints); - TGCheckButton * bAutoDataFlush = new TGCheckButton(hframeBdCfg1, "Auto Data Flush", 1); hframeBdCfg1->AddFrame(bAutoDataFlush, layoutHints); - bAutoDataFlush->SetState(kButtonDown); + bAutoDataFlush = new TGCheckButton(hframeBdCfg1, "Auto Data Flush", 1); hframeBdCfg1->AddFrame(bAutoDataFlush, layoutHints); + bAutoDataFlush->SetState(kButtonUp); bAutoDataFlush->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); - TGCheckButton * bDecimateWF = new TGCheckButton(hframeBdCfg1, "Decimate WaveForm", 1); hframeBdCfg1->AddFrame(bDecimateWF, layoutHints); + bDecimateWF = new TGCheckButton(hframeBdCfg1, "Decimate WaveForm", 1); hframeBdCfg1->AddFrame(bDecimateWF, layoutHints); bDecimateWF->SetState(kButtonUp); bDecimateWF->Connect("Clicked()", "BoardSetting", this, "SetDecimateWF()"); - TGCheckButton * bWFRecord = new TGCheckButton(hframeBdCfg1, "Record WaveFrom", 1); hframeBdCfg1->AddFrame(bWFRecord, layoutHints); - bWFRecord->SetState(kButtonDown); + bWFRecord = new TGCheckButton(hframeBdCfg1, "Record WaveFrom", 1); hframeBdCfg1->AddFrame(bWFRecord, layoutHints); + bWFRecord->SetState(kButtonUp); bWFRecord->Connect("Clicked()", "BoardSetting", this, "SetWaveFormRecord()"); - TGCheckButton * bTrigPropa = new TGCheckButton(hframeBdCfg1, "Trigger Propagation (coincidence) ", 1); hframeBdCfg1->AddFrame(bTrigPropa, layoutHints); + bTrigPropa = new TGCheckButton(hframeBdCfg1, "Trigger Propagation (coincidence) ", 1); hframeBdCfg1->AddFrame(bTrigPropa, layoutHints); bTrigPropa->SetState(kButtonUp); bTrigPropa->Connect("Clicked()", "BoardSetting", this, "SetTriggerPropagation()"); - TGCheckButton * bExtrac2 = new TGCheckButton(hframeBdCfg1, "Enable Extra2 word", 1); hframeBdCfg1->AddFrame(bExtrac2, layoutHints); - bExtrac2->SetState(kButtonDown); + bExtrac2 = new TGCheckButton(hframeBdCfg1, "Enable Extra2 word", 1); hframeBdCfg1->AddFrame(bExtrac2, layoutHints); + bExtrac2->SetState(kButtonUp); bExtrac2->Connect("Clicked()", "BoardSetting", this, "SetEnableExtra2()"); TGHorizontalFrame * hframeBdCfg2 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg2, layoutHints); @@ -170,7 +188,7 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d ///"FanSpeed Control", TGLabel * lbFanCtrl = new TGLabel(hframeBdCfg3, "Fan Speed Control", kHorizontalFrame); hframeBdCfg3->AddFrame(lbFanCtrl, layoutHints ); - TGComboBox * cbFanCtrl = new TGComboBox(hframeBdCfg3, "",1); hframeBdCfg3->AddFrame(cbFanCtrl, layoutHints); + cbFanCtrl = new TGComboBox(hframeBdCfg3, "",1); hframeBdCfg3->AddFrame(cbFanCtrl, layoutHints); cbFanCtrl->EnableTextInput(false); cbFanCtrl->AddEntry("Slow/Auto",0x30); cbFanCtrl->AddEntry("Fast", 0x38); @@ -180,10 +198,11 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d ///========== ACQ control TGGroupFrame * gAcqCtrl = new TGGroupFrame(vframe, "ACQ Control", kHorizontalFrame); vframe->AddFrame(gAcqCtrl , new TGLayoutHints(kLHintsExpandX)); TGVerticalFrame * vAcqCtrl = new TGVerticalFrame(gAcqCtrl); gAcqCtrl->AddFrame(vAcqCtrl); + TGHorizontalFrame * hfAcqCtrl = new TGHorizontalFrame(vAcqCtrl); vAcqCtrl->AddFrame(hfAcqCtrl, layoutHints); TGLabel * lbAcqMode = new TGLabel(hfAcqCtrl, "ACQ Mode"); hfAcqCtrl->AddFrame(lbAcqMode, layoutHints); - TGComboBox * cbAcqMode = new TGComboBox(hfAcqCtrl, "ACQ Mode", 1); hfAcqCtrl->AddFrame(cbAcqMode, layoutHints); + cbAcqMode = new TGComboBox(hfAcqCtrl, "ACQ Mode", 1); hfAcqCtrl->AddFrame(cbAcqMode, layoutHints); cbAcqMode->EnableTextInput(false); cbAcqMode->AddEntry("Software", 0); cbAcqMode->AddEntry("S-IN / GPI", 1); @@ -192,24 +211,36 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d cbAcqMode->Select(0); cbAcqMode->Resize(100, 20); - TGCheckButton * bAcqArm = new TGCheckButton(hfAcqCtrl, "ACQ Start/Arm", 1); hfAcqCtrl->AddFrame(bAcqArm, layoutHints); + bAcqArm = new TGCheckButton(hfAcqCtrl, "ACQ Start/Arm", 1); hfAcqCtrl->AddFrame(bAcqArm, layoutHints); bAcqArm->SetState(kButtonUp); //bAcqArm->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); TGLabel * lbPLLref = new TGLabel(hfAcqCtrl, "PLL Ref."); hfAcqCtrl->AddFrame(lbPLLref, layoutHints); - TGComboBox * cbPLLref = new TGComboBox(hfAcqCtrl, "PLL Ref.", 1); hfAcqCtrl->AddFrame(cbPLLref, layoutHints); + cbPLLref = new TGComboBox(hfAcqCtrl, "PLL Ref.", 1); hfAcqCtrl->AddFrame(cbPLLref, layoutHints); cbPLLref->EnableTextInput(false); cbPLLref->AddEntry("internal", 0); cbPLLref->AddEntry("external", 1); cbPLLref->Select(0); cbPLLref->Resize(100, 20); + TGHorizontalFrame * hfAcqCtrl2 = new TGHorizontalFrame(vAcqCtrl); vAcqCtrl->AddFrame(hfAcqCtrl2, layoutHints); + + TGCheckButton * bSWTrigger = new TGCheckButton(hfAcqCtrl2, "Software Trigger", 1); hfAcqCtrl2->AddFrame(bSWTrigger, layoutHints); + bSWTrigger->SetState(kButtonUp); + + TGCheckButton * bSWClockSync = new TGCheckButton(hfAcqCtrl2, "Software Clock Sync", 1); hfAcqCtrl2->AddFrame(bSWClockSync, layoutHints); + bSWClockSync->SetState(kButtonUp); + + TGLabel * lbRunStartStopDelay = new TGLabel(hfAcqCtrl2, "Run/Start/Stop Delay [ns]"); hfAcqCtrl2->AddFrame(lbRunStartStopDelay, layoutHints); + TGNumberEntry * numRunStartStopDelay = new TGNumberEntry(hfAcqCtrl2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfAcqCtrl2->AddFrame(numRunStartStopDelay, layoutHints); + numRunStartStopDelay->SetWidth(60); + numRunStartStopDelay->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x0FF); + ///========= Trigger Configure TGGroupFrame * gTRGCfg = new TGGroupFrame(vframe, "Trigger Configure", kHorizontalFrame); vframe->AddFrame(gTRGCfg, new TGLayoutHints(kLHintsExpandX)); TGVerticalFrame * vTRGCfg = new TGVerticalFrame(gTRGCfg); gTRGCfg->AddFrame(vTRGCfg, new TGLayoutHints(kLHintsExpandX)); - - ///--- varioustype of triggers + ///--- various type of triggers TGHorizontalFrame * hframeTRGCfg = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeTRGCfg, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); TGVerticalFrame * vTRGType = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGType, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); @@ -228,21 +259,18 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d ///"Global Trigger Mask", TGLabel * lbGbTRGMsk = new TGLabel(vTRGType, "Global Trigger Mask"); vTRGType->AddFrame(lbGbTRGMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - TGCheckButton * cbGbTRGMskCh[8]; for( int i = 0; i < 8; i++){ cbGbTRGMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbGbTRGMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); } ///"Trigger Validation Mask", TGLabel * lbTRGValMsk = new TGLabel(vTRGType, "Trigger Validation Mask"); vTRGType->AddFrame(lbTRGValMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - TGCheckButton * cbTRGValMskCh[8]; for( int i = 0; i < 8; i++){ cbTRGValMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGValMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); } ///"Front Panel TRG-OUT Enable Mask", TGLabel * lbTRGOUTMsk = new TGLabel(vTRGType, "TRG-OUT Mask"); vTRGType->AddFrame(lbTRGOUTMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - TGCheckButton * cbTRGOUTMskCh[8]; for( int i = 0; i < 8; i++){ cbTRGOUTMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGOUTMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); } @@ -261,14 +289,14 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d numMajorCoinWin = new TGNumberEntry(vTRGMsk2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk2->AddFrame(numMajorCoinWin); numMajorCoinWin->Resize(70, 20); - TGComboBox * cbTRGMODE = new TGComboBox(vTRGMsk2, "TRG MODE",1); vTRGMsk2->AddFrame(cbTRGMODE); + cbTRGMODE = new TGComboBox(vTRGMsk2, "TRG MODE",1); vTRGMsk2->AddFrame(cbTRGMODE); cbTRGMODE->EnableTextInput(false); cbTRGMODE->AddEntry("OR", 0); cbTRGMODE->AddEntry("AND", 1); cbTRGMODE->AddEntry("Majority", 2); cbTRGMODE->Resize(70, 20); cbTRGMODE->Select(0); - TGComboBox * cbTRGOUTMODE = new TGComboBox(vTRGMsk2, "TRG MODE",1); vTRGMsk2->AddFrame(cbTRGOUTMODE); + cbTRGOUTMODE = new TGComboBox(vTRGMsk2, "TRG MODE",1); vTRGMsk2->AddFrame(cbTRGOUTMODE); cbTRGOUTMODE->EnableTextInput(false); cbTRGOUTMODE->AddEntry("OR", 0); cbTRGOUTMODE->AddEntry("AND", 1); @@ -291,11 +319,11 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGLabel * lbLVDSTrigger = new TGLabel(vTRGMsk4, "LVDS"); vTRGMsk4->AddFrame(lbLVDSTrigger, layoutHints); TGLabel * lbdummy1 = new TGLabel(vTRGMsk4, "Trg."); vTRGMsk4->AddFrame(lbdummy1, layoutHints); - TGCheckButton * bGLBLVDSTrigger = new TGCheckButton(vTRGMsk4, "", 1); vTRGMsk4->AddFrame(bGLBLVDSTrigger, layoutHints); + bGLBLVDSTrigger = new TGCheckButton(vTRGMsk4, "", 1); vTRGMsk4->AddFrame(bGLBLVDSTrigger, layoutHints); bGLBLVDSTrigger->SetState(kButtonUp); vTRGMsk4->AddFrame(lbdummy0, layoutHints); - TGCheckButton * bTRGOUTLVDSTrigger = new TGCheckButton(vTRGMsk4, "", 1); vTRGMsk4->AddFrame(bTRGOUTLVDSTrigger, layoutHints); + bTRGOUTLVDSTrigger = new TGCheckButton(vTRGMsk4, "", 1); vTRGMsk4->AddFrame(bTRGOUTLVDSTrigger, layoutHints); bTRGOUTLVDSTrigger->SetState(kButtonUp); @@ -303,11 +331,11 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGLabel * lbExtTrigger = new TGLabel(vTRGMsk5, "Ext."); vTRGMsk5->AddFrame(lbExtTrigger, layoutHints); TGLabel * lbdummy2 = new TGLabel(vTRGMsk5, "Trg."); vTRGMsk5->AddFrame(lbdummy2, layoutHints); - TGCheckButton * bGLBExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bGLBExtTrigger, layoutHints); + bGLBExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bGLBExtTrigger, layoutHints); bGLBExtTrigger->SetState(kButtonUp); - TGCheckButton * bTRGExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGExtTrigger, layoutHints); + bTRGExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGExtTrigger, layoutHints); bTRGExtTrigger->SetState(kButtonUp); - TGCheckButton * bTRGOUTExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGOUTExtTrigger, layoutHints); + bTRGOUTExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGOUTExtTrigger, layoutHints); bTRGExtTrigger->SetState(kButtonUp); @@ -315,23 +343,23 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGLabel * lbSWTrigger = new TGLabel(vTRGMsk6, "Software"); vTRGMsk6->AddFrame(lbSWTrigger, layoutHints); TGLabel * lbdummy3 = new TGLabel(vTRGMsk6, "Trg."); vTRGMsk6->AddFrame(lbdummy3, layoutHints); - TGCheckButton * bGLBSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bGLBSoftwareTrigger, layoutHints); + bGLBSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bGLBSoftwareTrigger, layoutHints); bGLBSoftwareTrigger->SetState(kButtonDown); - TGCheckButton * bTRGSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGSoftwareTrigger, layoutHints); + bTRGSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGSoftwareTrigger, layoutHints); bTRGSoftwareTrigger->SetState(kButtonDown); - TGCheckButton * bTRGOUTSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGOUTSoftwareTrigger, layoutHints); + bTRGOUTSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGOUTSoftwareTrigger, layoutHints); bTRGOUTSoftwareTrigger->SetState(kButtonDown); TGHorizontalFrame * hframeTRGCfg2 = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeTRGCfg2, new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,2)); - TGCheckButton * bTRGValMskLVSDGLB = new TGCheckButton(hframeTRGCfg2, "LVSD Global Trg. Valid", 1); hframeTRGCfg2->AddFrame(bTRGValMskLVSDGLB, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - TGCheckButton * bTRGValMskLVSDLCL = new TGCheckButton(hframeTRGCfg2, "LVSD Local Trg. Valid", 1); hframeTRGCfg2->AddFrame(bTRGValMskLVSDLCL, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + bTRGValMskLVSDGLB = new TGCheckButton(hframeTRGCfg2, "LVSD Global Trg. Valid", 1); hframeTRGCfg2->AddFrame(bTRGValMskLVSDGLB, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + bTRGValMskLVSDLCL = new TGCheckButton(hframeTRGCfg2, "LVSD Local Trg. Valid", 1); hframeTRGCfg2->AddFrame(bTRGValMskLVSDLCL, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); ///"Disable External Trigger", - TGCheckButton * bEnableExtTRG = new TGCheckButton(hframeTRGCfg2, "Enable Ext. Trigger", 1); hframeTRGCfg2->AddFrame(bEnableExtTRG, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + bEnableExtTRG = new TGCheckButton(hframeTRGCfg2, "Enable Ext. Trigger", 1); hframeTRGCfg2->AddFrame(bEnableExtTRG, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); ///"Extended Veto Delay", TGLabel * lbExtendVetoDelay = new TGLabel(hframeTRGCfg2, "Extended Veto Delay"); hframeTRGCfg2->AddFrame(lbExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - TGNumberEntry * numExtendVetoDelay = new TGNumberEntry(hframeTRGCfg2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeTRGCfg2->AddFrame(numExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + numExtendVetoDelay = new TGNumberEntry(hframeTRGCfg2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeTRGCfg2->AddFrame(numExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); numExtendVetoDelay->Resize(70, 17); @@ -343,19 +371,35 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGHorizontalFrame * hframeFrontIOCtrl = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); TGLabel * lbLEMOIO = new TGLabel(hframeFrontIOCtrl, "LEMO I/O"); hframeFrontIOCtrl->AddFrame(lbLEMOIO, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - TGComboBox * cbLEMOIO = new TGComboBox(hframeFrontIOCtrl, "",1); hframeFrontIOCtrl->AddFrame(cbLEMOIO, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + cbLEMOIO = new TGComboBox(hframeFrontIOCtrl, "",1); hframeFrontIOCtrl->AddFrame(cbLEMOIO, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); cbLEMOIO->EnableTextInput(false); cbLEMOIO->AddEntry("NIM", 0); cbLEMOIO->AddEntry("TTL", 1); cbLEMOIO->Select(0); cbLEMOIO->Resize(50, 20); - TGCheckButton * bTRGOUTImp= new TGCheckButton(hframeFrontIOCtrl, "TRG-OUT high impe.", 1); hframeFrontIOCtrl->AddFrame(bTRGOUTImp, layoutHints); + ///use 0x811C, bit:[14:19], 6bits + TGLabel * lbTRGOUTMODE2 = new TGLabel(hframeFrontIOCtrl, "TRG-OUT Mode"); hframeFrontIOCtrl->AddFrame(lbTRGOUTMODE2, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); + cbTRGOUTmode = new TGComboBox(hframeFrontIOCtrl, "",1); hframeFrontIOCtrl->AddFrame(cbTRGOUTmode, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + cbTRGOUTmode->EnableTextInput(false); + cbTRGOUTmode->AddEntry("force TRG-OUT is 0", 0x08000); + cbTRGOUTmode->AddEntry("force TRG-OUT is 1", 0x0C000); + cbTRGOUTmode->AddEntry("Trigger", 0x00000); + cbTRGOUTmode->AddEntry("Channel Probe", 0x20000); + cbTRGOUTmode->AddEntry("S-IN", 0x30000); + cbTRGOUTmode->AddEntry("RUN", 0x10000); + cbTRGOUTmode->AddEntry("Sync Clock", 0x50000); + cbTRGOUTmode->AddEntry("Clock Phase", 0x90000); + cbTRGOUTmode->AddEntry("BUSY/UNLOCK", 0xD0000); + cbTRGOUTmode->Select(0); + cbTRGOUTmode->Resize(160, 20); + + bTRGOUTImp = new TGCheckButton(hframeFrontIOCtrl, "TRG-OUT high impe.", 1); hframeFrontIOCtrl->AddFrame(bTRGOUTImp, layoutHints); bTRGOUTImp->SetState(kButtonUp); TGHorizontalFrame * hframeFrontIOCtrl1 = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl1, new TGLayoutHints(kLHintsCenterY , 5,5,3,4)); TGLabel * lbTRGINCtrl = new TGLabel(hframeFrontIOCtrl1, "TRG-IN control"); hframeFrontIOCtrl1->AddFrame(lbTRGINCtrl, new TGLayoutHints(kLHintsCenterY | kLHintsLeft , 5, 5, 3, 4)); - TGComboBox * cbTRGINCtrl = new TGComboBox(hframeFrontIOCtrl1, "",1); hframeFrontIOCtrl1->AddFrame(cbTRGINCtrl, new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 5, 5, 3, 4)); + cbTRGINCtrl = new TGComboBox(hframeFrontIOCtrl1, "",1); hframeFrontIOCtrl1->AddFrame(cbTRGINCtrl, new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 5, 5, 3, 4)); cbTRGINCtrl->EnableTextInput(false); cbTRGINCtrl->AddEntry("trigger sync with the edge of the TRIG-IN", 0); cbTRGINCtrl->AddEntry("trigger sync with the whole TRIG-IN", 1); @@ -363,57 +407,20 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d cbTRGINCtrl->Resize(250, 20); TGLabel * lbTRGINMezzanines = new TGLabel(hframeFrontIOCtrl1, "TRG-IN to Mezzanines"); hframeFrontIOCtrl1->AddFrame(lbTRGINMezzanines, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); - TGComboBox * cbTRGINMezzanines = new TGComboBox(hframeFrontIOCtrl1, "",1); hframeFrontIOCtrl1->AddFrame(cbTRGINMezzanines, new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 5, 5, 3, 4)); + cbTRGINMezzanines = new TGComboBox(hframeFrontIOCtrl1, "",1); hframeFrontIOCtrl1->AddFrame(cbTRGINMezzanines, new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 5, 5, 3, 4)); cbTRGINMezzanines->EnableTextInput(false); cbTRGINMezzanines->AddEntry("Trigger local is sync with TRG-IN", 0); cbTRGINMezzanines->AddEntry("TRG-IN send to mezzanines (no delay)", 1); cbTRGINMezzanines->Select(0); cbTRGINMezzanines->Resize(200, 20); - - //TODO Combine them into 1 - TGHorizontalFrame * hframeFrontIOCtrl3 = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl3, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); - TGLabel * lbTRGOUTMODE2 = new TGLabel(hframeFrontIOCtrl3, "TRG-OUT Mode"); hframeFrontIOCtrl3->AddFrame(lbTRGOUTMODE2, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); - TGComboBox * cbTRGOUTmode = new TGComboBox(hframeFrontIOCtrl3, "",1); hframeFrontIOCtrl3->AddFrame(cbTRGOUTmode, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbTRGOUTmode->EnableTextInput(false); - cbTRGOUTmode->AddEntry("TRG-OUT is mode-select", 0); - cbTRGOUTmode->AddEntry("TRG-OUT is forced", 1); - cbTRGOUTmode->Select(0); - cbTRGOUTmode->Resize(160, 20); - - TGComboBox * cbForceTRGOUT = new TGComboBox(hframeFrontIOCtrl3, "",1); hframeFrontIOCtrl3->AddFrame(cbForceTRGOUT, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbForceTRGOUT->EnableTextInput(false); - cbForceTRGOUT->AddEntry("force TRG-OUT is 0", 0); - cbForceTRGOUT->AddEntry("force TRG-OUT is 1", 1); - cbForceTRGOUT->Select(0); - cbForceTRGOUT->Resize(150, 20); - - TGComboBox * cbTRGOUTmodeSelec = new TGComboBox(hframeFrontIOCtrl3, "",1); hframeFrontIOCtrl3->AddFrame(cbTRGOUTmodeSelec, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbTRGOUTmodeSelec->EnableTextInput(false); - cbTRGOUTmodeSelec->AddEntry("Trigger", 0); - cbTRGOUTmodeSelec->AddEntry("Motherboard Probe", 1); - cbTRGOUTmodeSelec->AddEntry("Channel Probe", 2); - cbTRGOUTmodeSelec->AddEntry("S-IN", 3); - cbTRGOUTmodeSelec->Select(0); - cbTRGOUTmodeSelec->Resize(150, 20); - - TGComboBox * cbTRGOUTMotherProbe = new TGComboBox(hframeFrontIOCtrl3, "",1); hframeFrontIOCtrl3->AddFrame(cbTRGOUTMotherProbe, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbTRGOUTMotherProbe->EnableTextInput(false); - cbTRGOUTMotherProbe->AddEntry("RUN", 0); - cbTRGOUTMotherProbe->AddEntry("Sync Clock", 1); - cbTRGOUTMotherProbe->AddEntry("Clock Phase", 2); - cbTRGOUTMotherProbe->AddEntry("BUSY/UNLOCK", 3); - cbTRGOUTMotherProbe->Select(0); - cbTRGOUTMotherProbe->Resize(100, 20); - - ///"Front Panel LVDS IO New Features", ///"LVDS IO Data", ///"Analog Monitor Mode - TGHorizontalFrame * hframeFrontIOCtrl4 = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl4, new TGLayoutHints(kLHintsCenterY, 5,5,3,2)); - TGLabel * lbAnaMonitor = new TGLabel(hframeFrontIOCtrl4, "Analog Monitor Mode (MON/Sigma)"); hframeFrontIOCtrl4->AddFrame(lbAnaMonitor, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); - TGComboBox * cbAnaMonitor = new TGComboBox(hframeFrontIOCtrl4, "",1); hframeFrontIOCtrl4->AddFrame(cbAnaMonitor, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 2)); + TGHorizontalFrame * hframeFrontIOCtrl2 = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl2, new TGLayoutHints(kLHintsCenterY, 5,5,3,2)); + TGLabel * lbAnaMonitor = new TGLabel(hframeFrontIOCtrl2, "Analog Monitor Mode (MON/Sigma)"); hframeFrontIOCtrl2->AddFrame(lbAnaMonitor, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); + cbAnaMonitor = new TGComboBox(hframeFrontIOCtrl2, "",1); hframeFrontIOCtrl2->AddFrame(cbAnaMonitor, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 2)); cbAnaMonitor->EnableTextInput(false); cbAnaMonitor->AddEntry("Trigger Majority", 0); cbAnaMonitor->AddEntry("Test", 1); @@ -421,16 +428,20 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d cbAnaMonitor->AddEntry("Voltage Level", 4); cbAnaMonitor->Select(0); cbAnaMonitor->Resize(150, 20); + cbAnaMonitor->Connect("Changed()", "BoardSetting", this, "SetAnalogMonitorMode()"); + cbAnaMonitor->Connect("Changed()", "ChannelSetting", this, "ChangePolarity()"); //Example to call other class ///"Buffer Occupancy Gain - TGLabel * lbBufferOccpGain = new TGLabel(hframeFrontIOCtrl4, "Buffer Occupancy Gain"); hframeFrontIOCtrl4->AddFrame(lbBufferOccpGain, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); - TGNumberEntry * numBufferOccpGain = new TGNumberEntry(hframeFrontIOCtrl4, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeFrontIOCtrl4->AddFrame(numBufferOccpGain, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 2)); + TGLabel * lbBufferOccpGain = new TGLabel(hframeFrontIOCtrl2, "Buffer Occupancy Gain"); hframeFrontIOCtrl2->AddFrame(lbBufferOccpGain, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); + numBufferOccpGain = new TGNumberEntry(hframeFrontIOCtrl2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeFrontIOCtrl2->AddFrame(numBufferOccpGain, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 2)); + numBufferOccpGain->SetState(false); numBufferOccpGain->Resize(70, 17); - /** + //TODO check is VME model ///"Readout Control", - TGGroupFrame * gReadoutCtrl = new TGGroupFrame(vframe, "ReadOut Control", kHorizontalFrame); vframe->AddFrame(gReadoutCtrl ); - TGVerticalFrame * vReadoutCtrl = new TGVerticalFrame(gReadoutCtrl); gReadoutCtrl->AddFrame(vReadoutCtrl, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + TGGroupFrame * gReadoutCtrl = new TGGroupFrame(vframe, "ReadOut Control", kHorizontalFrame); vframe->AddFrame(gReadoutCtrl, new TGLayoutHints(kLHintsExpandX) ); + TGVerticalFrame * vReadoutCtrl = new TGVerticalFrame(gReadoutCtrl); gReadoutCtrl->AddFrame(vReadoutCtrl); + TGHorizontalFrame * hReadoutCtrl = new TGHorizontalFrame(vReadoutCtrl); vReadoutCtrl->AddFrame(hReadoutCtrl, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); TGLabel * lbVMEInterruptLevel = new TGLabel(hReadoutCtrl, "VME Interrupt Level"); hReadoutCtrl->AddFrame(lbVMEInterruptLevel, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); @@ -447,39 +458,46 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d TGCheckButton * bVMEAlogn64Mode= new TGCheckButton(hReadoutCtrl, "64-bit aligned", 1); hReadoutCtrl->AddFrame(bVMEAlogn64Mode, layoutHints); bVMEAlogn64Mode->SetState(kButtonUp); - TGCheckButton * bVMEBaseAddRelocation= new TGCheckButton(hReadoutCtrl, "VME baase addr. relocation", 1); hReadoutCtrl->AddFrame(bVMEBaseAddRelocation, layoutHints); - bVMEBaseAddRelocation->SetState(kButtonUp); - */ + + TGHorizontalFrame * hReadoutCtrl2 = new TGHorizontalFrame(vReadoutCtrl); vReadoutCtrl->AddFrame(hReadoutCtrl2, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); - ///"Readout Status" + //TGCheckButton * bVMEBaseAddRelocation= new TGCheckButton(hReadoutCtrl, "VME baase addr. relocation", 1); hReadoutCtrl->AddFrame(bVMEBaseAddRelocation, layoutHints); + //bVMEBaseAddRelocation->SetState(kButtonUp); + //Need Relocation address + + TGCheckButton * bInteruptReleaseMode= new TGCheckButton(hReadoutCtrl2, "Interrupt Release on Acknowldge", 1); hReadoutCtrl2->AddFrame(bInteruptReleaseMode, layoutHints); + bInteruptReleaseMode->SetState(kButtonUp); + + TGCheckButton * bEnableExtendedBlockTransfer= new TGCheckButton(hReadoutCtrl2, "Enable Extended Block Transfer", 1); hReadoutCtrl2->AddFrame(bEnableExtendedBlockTransfer, layoutHints); + bEnableExtendedBlockTransfer->SetState(kButtonUp); + + ///==========="Readout Status" TGGroupFrame * gReadoutStatus = new TGGroupFrame(hRow, "Readout Status", kHorizontalFrame); hRow->AddFrame(gReadoutStatus, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5) ); TGVerticalFrame * vReadoutStatus = new TGVerticalFrame(gReadoutStatus); gReadoutStatus->AddFrame(vReadoutStatus, new TGLayoutHints(kLHintsExpandY , 5, 5, 3, 2)); - TGTextEntry * txtEventReady = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtEventReady, new TGLayoutHints(kLHintsRight, 5,5,3,3)); + TGTextEntry * txtEventReady = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtEventReady, new TGLayoutHints(kLHintsRight, 5,5,6,6)); txtEventReady->SetEnabled(false); txtEventReady->SetText( "Event Ready" ); - txtEventReady->SetTextColor(kGreen); + txtEventReady->SetTextColor(blue); - TGTextEntry * txtBusError = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtBusError, new TGLayoutHints(kLHintsRight, 5,5,3,3)); + TGTextEntry * txtBusError = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtBusError, new TGLayoutHints(kLHintsRight, 5,5,6,6)); txtBusError->SetEnabled(false); txtBusError->SetText( "no Bus Error" ); - txtBusError->SetTextColor(kGreen); + txtBusError->SetTextColor(blue); - TGTextEntry * txtVMEFIFO = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtVMEFIFO, new TGLayoutHints(kLHintsRight, 5,5,3,3)); + TGTextEntry * txtVMEFIFO = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtVMEFIFO, new TGLayoutHints(kLHintsRight, 5,5,6,6)); txtVMEFIFO->SetEnabled(false); txtVMEFIFO->SetText( "VME FIFO EMPTY" ); - txtVMEFIFO->SetTextColor(kGreen); + txtVMEFIFO->SetTextColor(blue); ///===== LVSD TGHorizontalFrame * hframeLVSD = new TGHorizontalFrame(vframe); vframe->AddFrame(hframeLVSD, new TGLayoutHints(kLHintsCenterY , 5,5,3,4)); TGLabel * lbLVSD = new TGLabel(hframeLVSD, "LVSD Control is not impletmented."); hframeLVSD->AddFrame(lbLVSD, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); - - - ///==================== Read digitizer Setting - ReadDigitizerSetting(); + ///==================== Read digitizer Setting + ChangeBoard(); fMain->MapSubwindows(); fMain->Resize(fMain->GetDefaultSize()); @@ -490,28 +508,158 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d BoardSetting::~BoardSetting(){ isOpened = false; - - delete boardIDEntry; - - //delete [] entry; - + + //delete boardIDEntry; + //for( int i = 0; i < NUM_BOARD_INFO; i++) delete entry[i]; + // + //for( int i = 0; i < nDigi; i++) digi[i] = NULL; + + /* + delete enPLLStatus; + delete enTempStatus; + delete enADCPwrStatus; + + /// board settings + delete bAutoDataFlush; + delete bDecimateWF; + delete bWFRecord; + delete bTrigPropa; + delete bExtrac2; delete bDualTrace; delete cbAP1; - delete cbAP2; + delete cbAP2; /// for ComboBox for analog probe 2 delete cbDP; + delete cbAggOrg; + delete numAggBLT; /// number of Agg pre Block transfer + delete cbFanCtrl; + + /// ACQ control + delete cbAcqMode; + delete bAcqArm; + delete cbPLLref; + + /// Trigger control + delete cbGbTRGMskCh[8]; + delete cbTRGValMskCh[8]; + delete cbTRGOUTMskCh[8]; + + delete numMajorCoinWin; + delete cbTRGMODE; + delete cbTRGOUTMODE; + + delete GlbMajorLevel; + delete TRGMajorLevel; + delete TRGOUTMajorLevel; + + delete bGLBLVDSTrigger; + delete bTRGOUTLVDSTrigger; + + delete bGLBExtTrigger; + delete bTRGExtTrigger; + delete bTRGOUTExtTrigger; + + delete bGLBSoftwareTrigger; + delete bTRGSoftwareTrigger; + delete bTRGOUTSoftwareTrigger; + + delete bTRGValMskLVSDGLB; + delete bTRGValMskLVSDLCL; + delete bEnableExtTRG; + delete numExtendVetoDelay; + + /// Front Panel IO Control + delete cbLEMOIO; + delete cbTRGOUTmode; + delete bTRGOUTImp; + + delete cbTRGINCtrl; + delete cbTRGINMezzanines; + + delete cbAnaMonitor; + delete numBufferOccpGain; + */ /// fMain must be delete last; fMain->Cleanup(); delete fMain; - -} -void BoardSetting::ReadDigitizerSetting(){ - } void BoardSetting::ChangeBoard(){ int boardID = boardIDEntry->GetNumber(); + + if( digi == NULL ) { + printf("no didgitizers\n"); + }else{ + digi[boardID]->PrintBoard(); + } + + for( int i = 0; i < NUM_BOARD_INFO; i++){ + switch (i) { + case 0 : entry[i]->SetText( Form("%s", (digi[boardID]->GetModelName()).c_str()) ); break; + case 1 : + + switch (digi[boardID]->GetDPPType()){ + case V1724_DPP_PHA_CODE: entry[i]->SetText("DPP-PHA "); break; + case V1720_DPP_CI_CODE : entry[i]->SetText("DPP-CI"); break; + case V1720_DPP_PSD_CODE: entry[i]->SetText("DPP-PSD "); break; + case V1751_DPP_PSD_CODE: entry[i]->SetText("DPP-PSD "); break; + case V1751_DPP_ZLE_CODE: entry[i]->SetText("DPP-ZLE "); break; + case V1743_DPP_CI_CODE: entry[i]->SetText("DPP-PSD "); break; + case V1740_DPP_QDC_CODE: entry[i]->SetText("DPP-QDC "); break; + case V1730_DPP_PSD_CODE: entry[i]->SetText("DPP-PSD "); break; + case V1730_DPP_PHA_CODE: entry[i]->SetText("DPP-PHA "); break; + case V1730_DPP_ZLE_CODE: entry[i]->SetText("DPP-ZLE "); break; + case V1730_DPP_DAW_CODE: entry[i]->SetText("DPP-DAW "); break; + } + + break; + case 2 : entry[i]->SetText( Form("%s", digi[boardID]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link") ); break; + case 3 : entry[i]->SetText( Form("%d", digi[boardID]->GetSerialNumber() ) ); break; + case 4 : entry[i]->SetText( Form("%d", digi[boardID]->GetNChannel() ) ); break; + case 5 : entry[i]->SetText( Form("%0.f MHz = %.1f ns", 1000/digi[boardID]->GetCh2ns(), digi[boardID]->GetCh2ns()) ); break; + case 6 : entry[i]->SetText( Form("%d", digi[boardID]->GetADCBits() ) ); break; + case 7 : entry[i]->SetText( Form("%s", (digi[boardID]->GetROCVersion()).c_str() ) ); break; + case 8 : entry[i]->SetText( Form("%s", (digi[boardID]->GetAMCVersion()).c_str() ) ); break; + } + } + + ///================ Board Failure Status + if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) { + + pha = dynamic_cast (digi[boardID]); + + unsigned int temp = pha->ReadRegister(Register::BoardFailureStatus); + + if( (temp & 0x10) == 0 ) { + enPLLStatus->SetText( "OK" ); enPLLStatus->SetTextColor(1); + }else{ + enPLLStatus->SetText( "Lost Lock" ); enPLLStatus->SetTextColor(red); + } + + if( (temp & 0x20) == 0 ) { + enTempStatus->SetText( "OK" ); enTempStatus->SetTextColor(1); + }else{ + enTempStatus->SetText( "Failure" ); enTempStatus->SetTextColor(red); + } + + if( (temp & 0x40) == 0 ) { + enADCPwrStatus->SetText( "OK" ); enADCPwrStatus->SetTextColor(1); + }else{ + enADCPwrStatus->SetText( "Failure" ); enADCPwrStatus->SetTextColor(red); + } + + pha->PrintBoardConfiguration(); + + bAutoDataFlush->SetState( pha->GetSetting(Setting::PHA::AutoDataFlush_board_bool) == 1.0 ? kButtonDown : kButtonUp ); + bDecimateWF->SetState( pha->GetSetting(Setting::PHA::DecimateWaveForm_board_bool) == 1.0 ? kButtonDown : kButtonUp ); + bWFRecord->SetState( pha->GetSetting(Setting::PHA::WavefromRecording_board_bool) == 1.0? kButtonDown : kButtonUp ); + bTrigPropa->SetState( pha->GetSetting(Setting::PHA::TriggerPropapation_board_bool) == 1.0? kButtonDown : kButtonUp ); + bExtrac2->SetState( pha->GetSetting(Setting::PHA::EnableExtra2Word_board_bool) == 1.0? kButtonDown : kButtonUp); + bDualTrace->SetState( pha->GetSetting(Setting::PHA::DualTrace_board_bool) == 1.0? kButtonDown : kButtonUp); + + } + return; } @@ -561,3 +709,16 @@ void BoardSetting::SetAggregateOrganization(){ void BoardSetting::SetReadOutAggregate(){ printf("========== SetReadOutAggregate, %d \n", (int) numAggBLT->GetNumber()); } + +void BoardSetting::SetAnalogMonitorMode(){ + printf("========== SetAnalogMonitorMode, %d \n", cbAnaMonitor->GetSelected()); + if( cbAnaMonitor->GetSelected() == 3) { + numBufferOccpGain->SetState(true); + }else{ + numBufferOccpGain->SetState(false); + } +} + +void BoardSetting::SoftwareReset(){ + +} diff --git a/boardSetting.h b/boardSetting.h index ab7df46..2df68a7 100644 --- a/boardSetting.h +++ b/boardSetting.h @@ -18,30 +18,89 @@ class BoardSetting{ private: TGMainFrame * fMain; + Pixel_t red, blue; + TGNumberEntry * boardIDEntry; TGTextEntry * entry[NUM_BOARD_INFO]; + int nDigi; Digitizer ** digi; - + DigitizerPHA * pha; + + /// board failure status + TGTextEntry * enPLLStatus; + TGTextEntry * enTempStatus; + TGTextEntry * enADCPwrStatus; + + /// board settings + TGCheckButton * bAutoDataFlush; + TGCheckButton * bDecimateWF; + TGCheckButton * bWFRecord; + TGCheckButton * bTrigPropa; + TGCheckButton * bExtrac2; TGCheckButton * bDualTrace; TGComboBox * cbAP1; TGComboBox * cbAP2; /// for ComboBox for analog probe 2 TGComboBox * cbDP; - TGComboBox * cbAggOrg; TGNumberEntry * numAggBLT; /// number of Agg pre Block transfer + TGComboBox * cbFanCtrl; + /// ACQ control + TGComboBox * cbAcqMode; + TGCheckButton * bAcqArm; + TGComboBox * cbPLLref; + + /// Trigger control + TGCheckButton * cbGbTRGMskCh[8]; + TGCheckButton * cbTRGValMskCh[8]; + TGCheckButton * cbTRGOUTMskCh[8]; + TGNumberEntry * numMajorCoinWin; + TGComboBox * cbTRGMODE; + TGComboBox * cbTRGOUTMODE; + TGNumberEntry * GlbMajorLevel; TGNumberEntry * TRGMajorLevel; TGNumberEntry * TRGOUTMajorLevel; + TGCheckButton * bGLBLVDSTrigger; + TGCheckButton * bTRGOUTLVDSTrigger; + + TGCheckButton * bGLBExtTrigger; + TGCheckButton * bTRGExtTrigger; + TGCheckButton * bTRGOUTExtTrigger; + + TGCheckButton * bGLBSoftwareTrigger; + TGCheckButton * bTRGSoftwareTrigger; + TGCheckButton * bTRGOUTSoftwareTrigger; + + TGCheckButton * bTRGValMskLVSDGLB; + TGCheckButton * bTRGValMskLVSDLCL; + TGCheckButton * bEnableExtTRG; + TGNumberEntry * numExtendVetoDelay; + + /// Front Panel IO Control + TGComboBox * cbLEMOIO; + TGComboBox * cbTRGOUTmode; + TGCheckButton * bTRGOUTImp; + + TGComboBox * cbTRGINCtrl; + TGComboBox * cbTRGINMezzanines; + + TGComboBox * cbAnaMonitor; + TGNumberEntry * numBufferOccpGain; + public: BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard); virtual ~BoardSetting(); - void CloseWindow() { printf("close BoardSetting window\n"); delete this; } + void CloseWindow() { + printf("close BoardSetting window\n"); + for( int i = 0; i < nDigi; i++) digi[i] = NULL; + delete this; + } void ChangeBoard(); ///=== Board Configure @@ -54,11 +113,12 @@ class BoardSetting{ void SetAnalogProbe1(); void SetAnalogProbe2(); void SetDigitalProbe(); + void SoftwareReset(); void SetAggregateOrganization(); void SetReadOutAggregate(); - - void ReadDigitizerSetting(); + + void SetAnalogMonitorMode(); bool isOpened; diff --git a/channelSetting.cpp b/channelSetting.cpp index 5df55f4..fe8455f 100644 --- a/channelSetting.cpp +++ b/channelSetting.cpp @@ -9,76 +9,30 @@ #include #include "channelSetting.h" - -//TODO set MAX -///------------------------------------------------ NAME, DIGI, unit ... MAX -TString settingName[NUM_CHANNEL_SETTING][3] = {{"Record Length", "3", "us"}, - {"Events / Aggregate", "4", ""}, - {"Pre-Trigger Length", "3", "us"}, - {"Trigger Threshold", "5", "LSD"}, - {"Trigger Holdoff Width", "3", "us"}, - {"DPP Algorithm Control", "8", ""}, - {"Channel DC offset", "2", "%"}, - {"Temperature", "2", "C"}, - {"Veto Width", "3", "us"}, - {"Trigger Filter Smoothing", "3", "smp"}, - {"Input Rising Time", "3", "ns"}, - {"Trapezoid Rise Time", "4", "ns"}, - {"Trapezoid Flat Top", "4", "ns"}, - {"Peaking Time", "4", "ns"}, - {"Decay Time", "4", "us"}, - {"Rise Time Valid. Win.", "4", "us"}, - {"Peak Holdoff", "4", "ns"}, - {"Shaped Trigger Width", "4", "us"}, - {"DPP Algorithm Control 2", "8", ""}, - {"Fine Gain", "3", ""} - }; - -///const uint32_t RecordLength_G = 0x1020; /// R/W -///const uint32_t InputDynamicRange = 0x1028; /// R/W -///const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W -///const uint32_t PreTrigger = 0x1038; /// R/W -///const uint32_t TriggerThreshold = 0x106C; /// R/W -///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W -///const uint32_t DPPAlgorithmControl = 0x1080; /// R/W -///const uint32_t ChannelDCOffset = 0x1098; /// R/W -///const uint32_t ChannelADCTemperature = 0x10A8; /// R -///const uint32_t VetoWidth = 0x10D4; /// R/W - - -/// const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor -/// const uint32_t InputRiseTime = 0x1058; /// R/W OK -/// const uint32_t TrapezoidRiseTime = 0x105C; /// R/W OK -/// const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK -/// const uint32_t PeakingTime = 0x1064; /// R/W OK -/// const uint32_t DecayTime = 0x1068; /// R/W OK -/// const uint32_t RiseTimeValidationWindow = 0x1070; /// R/W OK -/// const uint32_t PeakHoldOff = 0x1078; /// R/W OK -/// const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure -/// const uint32_t DPPAlgorithmControl2_G = 0x10A0; /// R/W OK -/// const uint32_t FineGain = 0x10C4; /// R/W OK - + ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi){ this->digi = digi; + 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()"); TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,3,3); /// left, right, top, bottom + TGLayoutHints * layoutHintsR = new TGLayoutHints(kLHintsRight, 5,5,6,5); /// left, right, top, bottom TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); ///==========Board choose - TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); - vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); - - 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); + 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->SetWidth(50); boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi); boardIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeBoard()"); @@ -86,26 +40,38 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer NChannel = 16 ;// digi[0]->GetNChannel(); - hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); - hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); + 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::kNEANonNegative); chIDEntry->SetWidth(50); chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, NChannel-1); chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()"); hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + ///const uint32_t ChannelADCTemperature = 0x10A8; /// R + TGLabel * lbTemp = new TGLabel(hframe0, "Temperature [C] :"); hframe0->AddFrame(lbTemp, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); + TGTextEntry * eTemp = new TGTextEntry(hframe0, new TGTextBuffer(1)); hframe0->AddFrame(eTemp, new TGLayoutHints(kLHintsRight, 5,5,3,4)); + eTemp->SetEnabled(false); + eTemp->SetText( "0" ); + eTemp->Resize(50,20); + int boardID = boardIDEntry->GetNumber(); int ch = chIDEntry->GetNumber(); int width = 80; - TGGroupFrame * gfInput = new TGGroupFrame(vframe, "Input / Trigger", kHorizontalFrame); vframe->AddFrame(gfInput, new TGLayoutHints(kLHintsExpandX)); - TGVerticalFrame * vfInput = new TGVerticalFrame(gfInput); gfInput->AddFrame(vfInput); - TGHorizontalFrame * hfInput1 = new TGHorizontalFrame(vfInput); vfInput->AddFrame(hfInput1, layoutHints); + + TGHorizontalFrame *hframe1 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe1, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + + ///================== Input Setting + TGGroupFrame * gfInput = new TGGroupFrame(hframe1, "Input / Misc.", kHorizontalFrame); hframe1->AddFrame(gfInput, new TGLayoutHints(kLHintsExpandY)); + TGHorizontalFrame * hfInput = new TGHorizontalFrame(gfInput); gfInput->AddFrame(hfInput); + + TGVerticalFrame * vfInput1 = new TGVerticalFrame(hfInput); hfInput->AddFrame(vfInput1); + TGVerticalFrame * vfInput2 = new TGVerticalFrame(hfInput); hfInput->AddFrame(vfInput2); ///----------- on/off - TGLabel * lbOnOff = new TGLabel(hfInput1, "On/Off"); hfInput1->AddFrame(lbOnOff, new TGLayoutHints( kLHintsCenterY, 5, 5, 3, 4)); - cbOnOff = new TGComboBox(hfInput1); hfInput1->AddFrame(cbOnOff, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); + TGLabel * lbOnOff = new TGLabel(vfInput1, "On/Off"); vfInput1->AddFrame(lbOnOff, layoutHintsR); + cbOnOff = new TGComboBox(vfInput2); vfInput2->AddFrame(cbOnOff, layoutHints); cbOnOff->AddEntry("ON", 1); cbOnOff->AddEntry("off", 0); cbOnOff->Resize(width, 20); @@ -114,8 +80,8 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ///----------- Polarity - TGLabel * lbPol = new TGLabel(hfInput1, "Polarity");hfInput1->AddFrame(lbPol, new TGLayoutHints( kLHintsCenterY, 5, 5, 3, 4)); - cbPolarity = new TGComboBox(hfInput1); hfInput1->AddFrame(cbPolarity, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); + TGLabel * lbPol = new TGLabel(vfInput1, "Polarity");vfInput1->AddFrame(lbPol, layoutHintsR); + cbPolarity = new TGComboBox(vfInput2); vfInput2->AddFrame(cbPolarity, layoutHints); cbPolarity->AddEntry("Positive +", 1); cbPolarity->AddEntry("Negative -", 0); cbPolarity->Resize(width, 20); @@ -124,18 +90,125 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ///---------- Input Dynamic Range - TGLabel * lbInputDynamicRange = new TGLabel(hfInput1, "Input Range");hfInput1->AddFrame(lbInputDynamicRange, new TGLayoutHints( kLHintsCenterY, 5, 5, 3, 4)); - cbInputDynamicRange = new TGComboBox(hfInput1); hfInput1->AddFrame(cbInputDynamicRange, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); + TGLabel * lbInputDynamicRange = new TGLabel(vfInput1, "Input Range");vfInput1->AddFrame(lbInputDynamicRange, layoutHintsR); + cbInputDynamicRange = new TGComboBox(vfInput2); vfInput2->AddFrame(cbInputDynamicRange, layoutHints); cbInputDynamicRange->AddEntry("2.0 Vpp", 0); cbInputDynamicRange->AddEntry("0.5 Vpp", 1); cbInputDynamicRange->Resize(width, 20); cbInputDynamicRange->Select(0); - - ///---------- Record Length - TGLabel * lbRecordLength = new TGLabel(hfInput1, "Record Length");hfInput1->AddFrame(lbRecordLength, new TGLayoutHints( kLHintsCenterY, 5, 5, 3, 4)); - //TGNumberEntry* entry = new TGNumberEntry(hfInput1, temp, 0, 0, digi, TGNumberFormat::kNEANonNegative); - // entry[i]->Resize(width, 20); + ///---------- Record Length + TGLabel * lbRecordLength = new TGLabel(vfInput1, "Record Length [ns]"); vfInput1->AddFrame(lbRecordLength, layoutHintsR); + TGNumberEntry* numRecordLength = new TGNumberEntry(vfInput2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numRecordLength, layoutHints); + numRecordLength->Resize(width, 20); + + ///const uint32_t PreTrigger = 0x1038; /// R/W + TGLabel * lbPreTrigger = new TGLabel(vfInput1, "Pre trigger [ns]"); vfInput1->AddFrame(lbPreTrigger, layoutHintsR); + TGNumberEntry* numPreTrigger = new TGNumberEntry(vfInput2, 2000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numPreTrigger, layoutHints); + numPreTrigger->Resize(width, 20); + + ///const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W, + TGLabel * lbEventAgg = new TGLabel(vfInput1, "Events / Aggregate"); vfInput1->AddFrame(lbEventAgg, layoutHintsR); + TGNumberEntry* numEventAgg = new TGNumberEntry(vfInput2, 512, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numEventAgg, layoutHints); + numEventAgg->Resize(width, 20); + + ///================== Trigger Settings + TGGroupFrame * gfTrigger = new TGGroupFrame(hframe1, "Trigger", kHorizontalFrame); hframe1->AddFrame(gfTrigger, new TGLayoutHints(kLHintsExpandY)); + TGHorizontalFrame * hfTrigger = new TGHorizontalFrame(gfTrigger); gfTrigger->AddFrame(hfTrigger); + + TGVerticalFrame * vfTrigger1 = new TGVerticalFrame(hfTrigger); hfTrigger->AddFrame(vfTrigger1); + TGVerticalFrame * vfTrigger2 = new TGVerticalFrame(hfTrigger); hfTrigger->AddFrame(vfTrigger2); + + ///const uint32_t TriggerThreshold = 0x106C; /// R/W + TGLabel * lbTriggerThreshold = new TGLabel(vfTrigger1, "Trigger Threshold [LSB]"); vfTrigger1->AddFrame(lbTriggerThreshold, layoutHintsR); + TGNumberEntry* numTriggerThreshold = new TGNumberEntry(vfTrigger2, 100, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerThreshold, layoutHints); + numTriggerThreshold->Resize(width, 20); + + ///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W + TGLabel * lbTriggerHoldOff = new TGLabel(vfTrigger1, "Trigger Holdoff [ns]"); vfTrigger1->AddFrame(lbTriggerHoldOff, layoutHintsR); + TGNumberEntry* numTriggerHoldOff = new TGNumberEntry(vfTrigger2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerHoldOff, layoutHints); + numTriggerHoldOff->Resize(width, 20); + + ///const uint32_t ChannelDCOffset = 0x1098; /// R/W + TGLabel * lbDCOffset = new TGLabel(vfTrigger1, "DC offset [%]"); vfTrigger1->AddFrame(lbDCOffset, layoutHintsR); + TGNumberEntry* numDCOffset = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numDCOffset, layoutHints); + numDCOffset->Resize(width, 20); + + ///const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor + TGLabel * lbTriggerSmoothing = new TGLabel(vfTrigger1, "Trigger Smoothing"); vfTrigger1->AddFrame(lbTriggerSmoothing, layoutHintsR); + TGComboBox* cbTriggerSmoothing = new TGComboBox(vfTrigger2); vfTrigger2->AddFrame(cbTriggerSmoothing, layoutHints); + cbTriggerSmoothing->AddEntry("disable", 0); + cbTriggerSmoothing->AddEntry("2 samples", 1); + cbTriggerSmoothing->AddEntry("4 samples", 2); + cbTriggerSmoothing->AddEntry("8 samples", 4); + cbTriggerSmoothing->AddEntry("16 samples", 8); + cbTriggerSmoothing->AddEntry("32 samples", 16); + cbTriggerSmoothing->AddEntry("64 samples", 32); + cbTriggerSmoothing->AddEntry("128 samples", 0x3F); + cbTriggerSmoothing->Select(16); + cbTriggerSmoothing->Resize(width, 20); + + ///const uint32_t InputRiseTime = 0x1058; /// R/W OK + TGLabel * lbInputRiseTime = new TGLabel(vfTrigger1, "Input rise time [ns]"); vfTrigger1->AddFrame(lbInputRiseTime, layoutHintsR); + TGNumberEntry* numInputRiseTime = new TGNumberEntry(vfTrigger2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numInputRiseTime, layoutHints); + numInputRiseTime->Resize(width, 20); + + ///const uint32_t RiseTimeValidationWindow = 0x1070; /// R/W OK + TGLabel * lbRiseTimeValidWin = new TGLabel(vfTrigger1, "Rise Time Val. Win. [ns]"); vfTrigger1->AddFrame(lbRiseTimeValidWin, layoutHintsR); + TGNumberEntry* numRiseTimeValidWin = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numRiseTimeValidWin, layoutHints); + numRiseTimeValidWin->Resize(width, 20); + + ///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure + ///const uint32_t VetoWidth = 0x10D4; /// R/W + ///const uint32_t FineGain = 0x10C4; /// R/W OK + + + ///================== Trapezoid Settings + TGGroupFrame * gfTrap = new TGGroupFrame(hframe1, "Trapazoid", kHorizontalFrame); hframe1->AddFrame(gfTrap, new TGLayoutHints(kLHintsExpandY)); + TGHorizontalFrame * hfTrap = new TGHorizontalFrame(gfTrap); gfTrap->AddFrame(hfTrap); + + TGVerticalFrame * vfTrap1 = new TGVerticalFrame(hfTrap); hfTrap->AddFrame(vfTrap1); + TGVerticalFrame * vfTrap2 = new TGVerticalFrame(hfTrap); hfTrap->AddFrame(vfTrap2); + + + ///const uint32_t TrapezoidRiseTime = 0x105C; /// R/W OK + TGLabel * lbTrapRiseTime = new TGLabel(vfTrap1, "Rise time [ns]"); vfTrap1->AddFrame(lbTrapRiseTime, layoutHintsR); + TGNumberEntry* numTrapRiseTime = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapRiseTime, layoutHints); + numTrapRiseTime->Resize(width, 20); + + ///const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK + TGLabel * lbTrapFlatTop = new TGLabel(vfTrap1, "Flat Top [ns]"); vfTrap1->AddFrame(lbTrapFlatTop, layoutHintsR); + TGNumberEntry* numTrapFlatTop = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapFlatTop, layoutHints); + numTrapFlatTop->Resize(width, 20); + + ///const uint32_t DecayTime = 0x1068; /// R/W OK + TGLabel * lbDecay = new TGLabel(vfTrap1, "Decay [ns]"); vfTrap1->AddFrame(lbDecay, layoutHintsR); + TGNumberEntry* numDecay = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numDecay, layoutHints); + numDecay->Resize(width, 20); + + ///const uint32_t PeakingTime = 0x1064; /// R/W OK + TGLabel * lbPeaking = new TGLabel(vfTrap1, "Peaking [ns]"); vfTrap1->AddFrame(lbPeaking, layoutHintsR); + TGNumberEntry* numPeaking = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeaking, layoutHints); + numPeaking->Resize(width, 20); + + ///const uint32_t PeakHoldOff = 0x1078; /// R/W OK + TGLabel * lbPeakHoldOff = new TGLabel(vfTrap1, "Peaking Holdoff [ns]"); vfTrap1->AddFrame(lbPeakHoldOff, layoutHintsR); + TGNumberEntry* numPeakHoldOff = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeakHoldOff, layoutHints); + numPeakHoldOff->Resize(width, 20); + + ///================== const uint32_t DPPAlgorithmControl = 0x1080; /// R/W + TGGroupFrame * gfDPPCtrl = new TGGroupFrame(vframe, "DPP Algorithm Control", kHorizontalFrame); vframe->AddFrame(gfDPPCtrl, new TGLayoutHints(kLHintsExpandX)); + TGVerticalFrame * vfDPPCtrl = new TGVerticalFrame(gfDPPCtrl); gfDPPCtrl->AddFrame(vfDPPCtrl); + TGHorizontalFrame * hfDPPCtrl1 = new TGHorizontalFrame(vfDPPCtrl); vfDPPCtrl->AddFrame(hfDPPCtrl1, layoutHints); + + + + ///================== const uint32_t DPPAlgorithmControl2_G = 0x10A0; /// R/W OK + TGGroupFrame * gfDPPCtrl2 = new TGGroupFrame(vframe, "DPP Algorithm Control 2", kHorizontalFrame); vframe->AddFrame(gfDPPCtrl2, new TGLayoutHints(kLHintsExpandX)); + TGVerticalFrame * vfDPPCtrl2 = new TGVerticalFrame(gfDPPCtrl2); gfDPPCtrl2->AddFrame(vfDPPCtrl2); + TGHorizontalFrame * hfDPPCtrl21 = new TGHorizontalFrame(vfDPPCtrl2); vfDPPCtrl2->AddFrame(hfDPPCtrl21, layoutHints); + + /* ///----- all other TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING]; TGLabel * lb[NUM_CHANNEL_SETTING]; @@ -166,7 +239,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4)); } - + */ fMain->MapSubwindows(); fMain->Resize(fMain->GetDefaultSize()); @@ -183,10 +256,6 @@ ChannelSetting::~ChannelSetting(){ delete cbOnOff; delete cbInputDynamicRange; delete cbPolarity; - - for ( int i = 0; i < NUM_CHANNEL_SETTING; i++){ - delete entry[i]; - } /// fMain must be delete last; fMain->Cleanup(); @@ -205,11 +274,6 @@ void ChannelSetting::ChangeCh(){ //pixie->GetChannelPolarity(boardID, ch) ? cbPolarity->Select(1) : cbPolarity->Select(0); //pixie->GetChannelTraceOnOff(boardID, ch) ? cbTraceOnOff->Select(1) : cbTraceOnOff->Select(0); - for( int i = 0 ; i < NUM_CHANNEL_SETTING; i++){ - double temp = 0 ;//pixie->GetChannelSetting(settingName[i][0].Data(), boardID, ch, false); - entry[i]->SetNumber(temp ); - } - } void ChannelSetting::ChangeOnOff(){ short boardID = boardIDEntry->GetNumber(); @@ -223,6 +287,8 @@ void ChannelSetting::ChangePolarity(){ short ch = chIDEntry->GetNumber(); int val = cbPolarity->GetSelected(); + printf("------------- testing from BoardSetting\n"); + //pixie->SetChannelPositivePolarity(val, boardID, ch); //pixie->SaveSettings(pixie->GetSettingFile(boardIDEntry->GetNumber())); } @@ -230,7 +296,6 @@ void ChannelSetting::ChangePolarity(){ void ChannelSetting::ChangeID(int id){ short boardID = boardIDEntry->GetNumber(); short ch = chIDEntry->GetNumber(); - double val = entry[id]->GetNumber(); //pixie->SetChannelSetting(settingName[id][0].Data(), val, boardID, ch, 1); //pixie->SaveSettings(pixie->GetSettingFile(boardIDEntry->GetNumber())); diff --git a/channelSetting.h b/channelSetting.h index 6288f96..ac5ac04 100644 --- a/channelSetting.h +++ b/channelSetting.h @@ -9,8 +9,6 @@ #include "ClassDigitizer.h" #include "macro.h" -#define NUM_CHANNEL_SETTING 20 - class TGWindow; class TGMainFrame; @@ -24,8 +22,6 @@ class ChannelSetting{ TGComboBox * cbPolarity; TGComboBox * cbInputDynamicRange; - TGNumberEntry * entry[NUM_CHANNEL_SETTING]; - Digitizer ** digi; int NChannel; diff --git a/test.cpp b/test.cpp index 9be8d6e..9e3302d 100644 --- a/test.cpp +++ b/test.cpp @@ -37,6 +37,7 @@ int main(int argc, char* argv[]){ pha->ReadData(); data->SaveBuffer("test.bin"); data->DecodeBuffer(1); + data->PrintStat(); data->ClearData(); }