diff --git a/ClassData.h b/ClassData.h index e52cef6..416d638 100644 --- a/ClassData.h +++ b/ClassData.h @@ -34,6 +34,7 @@ class Data{ void SaveBuffer(char * fileName); void DecodeBuffer(int verbose = 0); + void DecodeBuffer(char * buffer, int verbose = 0); protected: unsigned int ReadBuffer(unsigned int nWord, int verbose = 0); @@ -95,6 +96,11 @@ inline void Data::SaveBuffer(char * fileName){ fclose(haha); } +inline void Data::DecodeBuffer(char * buffer, int verbose){ + this->buffer = buffer; + DecodeBuffer(verbose); +} + inline void Data::DecodeBuffer(int verbose){ /// verbose : 0 = off, 1 = only energy + timestamp, 2 = show header, 3 = wave diff --git a/boardSetting.cpp b/boardSetting.cpp index 48f4a30..710d69d 100644 --- a/boardSetting.cpp +++ b/boardSetting.cpp @@ -3,14 +3,13 @@ #include #include #include -#include #include #include #include + #include "boardSetting.h" -TString boardSettingName[NUM_BOARD_SETTING] = { - "Model", +TString boardSettingName[NUM_BOARD_INFO] = { "Model", "Board Info", "Link Type", "Serial Number", @@ -18,28 +17,33 @@ TString boardSettingName[NUM_BOARD_SETTING] = { "Sampling rate", "ADC bit", "ROC version", - "AMC version", + "AMC version" + }; + +///"Acquisition Status", + - "Channel Enable Mask", - "Board Config", - "Aggregate Organization", - "Max Num. Of Aggregate Per Block Transfer", - "Acquisition Control", - "Acquisition Status", - "Global Trigger Mask", - "Disable External Trigger", - "Trigger Validation Mask", - "Extended Veto Delay", - "Front Panel TRG-OUT Enable Mask", - "Front Panel IO Control", - "Front Panel LVDS IO New Features", - "LVDS IO Data", - "AnalogMonitor Mode", - "FanSpeed Control", - "Readout Control", - "Readout Status" - }; - +///"Channel Enable Mask", ( at channalSetting) +///"Board Config", OK +///"Aggregate Organization", OK +///"Max Num. Of Aggregate Per Block Transfer", OK + +///"Acquisition Control", + +///"Global Trigger Mask", +///"Trigger Validation Mask", +///"Front Panel TRG-OUT Enable Mask", +///"Disable External Trigger", +///"Extended Veto Delay", + + +///"Front Panel IO Control", +///"Front Panel LVDS IO New Features", +///"LVDS IO Data", +///"AnalogMonitor Mode", +///"FanSpeed Control", +///"Readout Control", +///"Readout Status" BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){ @@ -49,35 +53,38 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d fMain->SetWindowName("Board Settings "); fMain->Connect("CloseWindow()", "BoardSetting", this, "CloseWindow()"); - TGVerticalFrame * vframe = new TGVerticalFrame(fMain); - fMain->AddFrame(vframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); ///==========Module choose - TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); - vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2)); + + TGLabel * lb0 = new TGLabel(hframe0, "Board ID :"); hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); + boardIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); + hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - TGLabel * lb0 = new TGLabel(hframe0, "Board ID :"); - hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4)); - boardIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); boardIDEntry->SetWidth(50); boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard); boardIDEntry->Connect("Modified()", "BoardSetting", this, "ChangeBoard()"); if( nBoard <= 1 ) boardIDEntry->SetState(false); + + int boardID = boardIDEntry->GetNumber(); - hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - int modID = boardIDEntry->GetNumber(); - int comboBoxWidth = 135; - int comboBoxHeigth = 30; - - TGHorizontalFrame *hframe[NUM_BOARD_SETTING]; - TGLabel * lb[NUM_BOARD_SETTING]; - - for( int i = 0 ; i < NUM_BOARD_SETTING; i++){ - hframe[i] = new TGHorizontalFrame(vframe, 50, 50 ); - vframe->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2)); + ///============ fixed info + TGHorizontalFrame * hframeInfo = new TGHorizontalFrame(vframe); vframe->AddFrame(hframeInfo); + int numCol = 3; + TGVerticalFrame * vframeInfo[numCol]; + for( int i = 0; i < numCol ; i++) { + vframeInfo[i] = new TGVerticalFrame(hframeInfo); hframeInfo->AddFrame(vframeInfo[i]); + } + + TGHorizontalFrame *hframe[NUM_BOARD_INFO]; + TGLabel * lb[NUM_BOARD_INFO]; + for( int i = 0 ; i < NUM_BOARD_INFO; i++){ + hframe[i] = new TGHorizontalFrame(vframeInfo[i%3], 50, 50 ); vframeInfo[i%3]->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2)); + //int temp = digi[0]->GetSerialNumber(); int temp = 0; @@ -88,9 +95,244 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d entry[i]->SetEnabled(false); entry[i]->SetText( Form("0x%x", temp) ); hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4)); - } + ///========= Board Configure + + TGGroupFrame * gBdCfg = new TGGroupFrame(vframe, "Board Configure", kHorizontalFrame); vframe->AddFrame(gBdCfg ); + TGVerticalFrame * vBdCfg = new TGVerticalFrame(gBdCfg); gBdCfg->AddFrame(vBdCfg); + + TGHorizontalFrame * hframeBdCfg1 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg1, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TGHorizontalFrame * hframeBdCfg2 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg2, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + + TGCheckButton * bAutoDataFlush = new TGCheckButton(hframeBdCfg1, "Auto Data Flush", 1); hframeBdCfg1->AddFrame(bAutoDataFlush); + bAutoDataFlush->SetState(kButtonDown); + bAutoDataFlush->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); + + TGCheckButton * bDecimateWF = new TGCheckButton(hframeBdCfg1, "Decimate WaveForm", 1); hframeBdCfg1->AddFrame(bDecimateWF); + bDecimateWF->SetState(kButtonUp); + bDecimateWF->Connect("Clicked()", "BoardSetting", this, "SetDecimateWF()"); + + TGCheckButton * bWFRecord = new TGCheckButton(hframeBdCfg1, "Record WaveFrom", 1); hframeBdCfg1->AddFrame(bWFRecord); + bWFRecord->SetState(kButtonDown); + bWFRecord->Connect("Clicked()", "BoardSetting", this, "SetWaveFormRecord()"); + + TGCheckButton * bTrigPropa = new TGCheckButton(hframeBdCfg1, "Trigger Propagation (coincidence) ", 1); hframeBdCfg1->AddFrame(bTrigPropa); + bTrigPropa->SetState(kButtonUp); + bTrigPropa->Connect("Clicked()", "BoardSetting", this, "SetTriggerPropagation()"); + + TGCheckButton * bExtrac2 = new TGCheckButton(hframeBdCfg1, "Enable Extra2 word", 1); hframeBdCfg1->AddFrame(bExtrac2); + bExtrac2->SetState(kButtonDown); + bExtrac2->Connect("Clicked()", "BoardSetting", this, "SetEnableExtra2()"); + + bDualTrace = new TGCheckButton(hframeBdCfg2, "Dual Trace", 1); hframeBdCfg2->AddFrame(bDualTrace); + bDualTrace->SetState(kButtonUp); + bDualTrace->Connect("Clicked()", "BoardSetting", this, "SetDualTrace()"); + + TGLabel * lbAP1 = new TGLabel(hframeBdCfg2, "Ana. Prb. 1"); hframeBdCfg2->AddFrame(lbAP1, new TGLayoutHints(kLHintsLeft , 5, 5, 3, 4)); + cbAP1 = new TGComboBox(hframeBdCfg2, "Ana. Pb. 1", 1); hframeBdCfg2->AddFrame(cbAP1); + cbAP1->EnableTextInput(false); + cbAP1->AddEntry("Input", 0); + cbAP1->AddEntry("RC-CR (1st derivative)", 1); + cbAP1->AddEntry("RC-CR2 (2st derivative)", 2); + cbAP1->AddEntry("Trapezoid", 3); + cbAP1->Resize(150, 20); + cbAP1->Select(0); + cbAP1->Connect("Changed()", "BoardSetting", this, "SetAnalogProbe1()"); + + + TGLabel * lbAP2 = new TGLabel(hframeBdCfg2, "Ana. Prb. 2"); hframeBdCfg2->AddFrame(lbAP2, new TGLayoutHints(kLHintsLeft , 5, 5, 3, 4)); + cbAP2 = new TGComboBox(hframeBdCfg2, "Ana. Pb. 2", 1); hframeBdCfg2->AddFrame(cbAP2); + cbAP2->EnableTextInput(false); + cbAP2->AddEntry("Input", 0); + cbAP2->AddEntry("Threshold", 1); + cbAP2->AddEntry("Trapezoid - Baseline", 2); + cbAP2->AddEntry("Baseline", 3); + cbAP2->Resize(150, 20); + cbAP2->Select(0); + cbAP2->SetEnabled(false); + cbAP2->Connect("Changed()", "BoardSetting", this, "SetAnalogProbe2()"); + + TGLabel * lbDP = new TGLabel(hframeBdCfg2, "Digi. Prb. "); hframeBdCfg2->AddFrame(lbDP, new TGLayoutHints(kLHintsLeft , 5, 5, 3, 4)); + cbDP = new TGComboBox(hframeBdCfg2, "Digital. Pb.", 1); hframeBdCfg2->AddFrame(cbDP); + cbDP->EnableTextInput(false); + cbDP->AddEntry("Peaking", 0); + cbDP->AddEntry("Armed (Triggered)", 1); + cbDP->AddEntry("Peak Run", 2); + cbDP->AddEntry("Pile-Up", 3); + cbDP->AddEntry("Peaking", 4); + cbDP->AddEntry("TRG Validation Win.", 5); + cbDP->AddEntry("Baseline freeze", 6); + cbDP->AddEntry("TRG holdoff", 7); + cbDP->AddEntry("TRG Validation", 8); + cbDP->AddEntry("ACQ busy", 9); + cbDP->AddEntry("Zero Cross", 10); + cbDP->AddEntry("Ext. TRG", 11); + cbDP->AddEntry("Memory full", 12); + cbDP->Resize(150, 20); + cbDP->Select(0); + cbDP->Connect("Changed()", "BoardSetting", this, "SetDigitalProbe()"); + + TGHorizontalFrame * hframeBdCfg3 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg3, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TGLabel * lbAggOrg = new TGLabel(hframeBdCfg3, "Aggregate Organization"); hframeBdCfg3->AddFrame(lbAggOrg, new TGLayoutHints(kLHintsLeft , 5, 5, 3, 4)); + cbAggOrg = new TGComboBox(hframeBdCfg3, "Aggregate Organization", 1); hframeBdCfg3->AddFrame(cbAggOrg); + cbAggOrg->EnableTextInput(false); + cbAggOrg->AddEntry("Not used", 0); + cbAggOrg->AddEntry("4", 2); + cbAggOrg->AddEntry("8", 3); + cbAggOrg->AddEntry("16", 4); + cbAggOrg->AddEntry("32", 5); + cbAggOrg->AddEntry("64", 6); + cbAggOrg->AddEntry("128", 7); + cbAggOrg->AddEntry("256", 8); + cbAggOrg->AddEntry("512", 9); + cbAggOrg->AddEntry("1024", 10); + cbAggOrg->Resize(150, 20); + cbAggOrg->Select(0); + cbAggOrg->Connect("Changed()", "BoardSetting", this, "SetAggregateOrganization()"); + + TGLabel * lbAggBLT = new TGLabel(hframeBdCfg3, "Aggregate pre Readout"); hframeBdCfg3->AddFrame(lbAggBLT, new TGLayoutHints(kLHintsLeft , 5, 5, 3, 4)); + numAggBLT = new TGNumberEntry(hframeBdCfg3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeBdCfg3->AddFrame(numAggBLT); + numAggBLT->SetWidth(60); + numAggBLT->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x3FF); + numAggBLT->Connect("Modified()", "BoardSetting", this, "SetReadOutAggregate()"); + + ///========= Trigger Configure + TGGroupFrame * gTRGCfg = new TGGroupFrame(vframe, "Trigger Configure", kHorizontalFrame); vframe->AddFrame(gTRGCfg ); + TGVerticalFrame * vTRGCfg = new TGVerticalFrame(gTRGCfg); gTRGCfg->AddFrame(vTRGCfg); + + + ///"Global Trigger Mask", + TGHorizontalFrame * hframeGbTRGMsk = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeGbTRGMsk, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TGVerticalFrame * vGbTRGMskCh0 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh0, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + TGLabel * lbdummy0 = new TGLabel(vGbTRGMskCh0, ""); + vGbTRGMskCh0->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + vGbTRGMskCh0->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbGbTRGMsk = new TGLabel(vGbTRGMskCh0, "Global Trigger Mask"); vGbTRGMskCh0->AddFrame(lbGbTRGMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + + TGVerticalFrame * vGbTRGMskCh[8]; + TGLabel * lbGbTRGMskCh0[8]; + TGLabel * lbGbTRGMskCh1[8]; + TGCheckButton * cbGbTRGMskCh[8]; + + for( int i = 0; i < 8; i++){ + vGbTRGMskCh[i] = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + lbGbTRGMskCh0[i] = new TGLabel(vGbTRGMskCh[i], Form("%d", 2*i)); vGbTRGMskCh[i]->AddFrame(lbGbTRGMskCh0[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + lbGbTRGMskCh1[i] = new TGLabel(vGbTRGMskCh[i], Form("%d", 2*i+1)); vGbTRGMskCh[i]->AddFrame(lbGbTRGMskCh1[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + cbGbTRGMskCh[i] = new TGCheckButton(vGbTRGMskCh[i], ""); vGbTRGMskCh[i]->AddFrame(cbGbTRGMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + } + + ///"Trigger Validation Mask", + TGLabel * lbTRGValMsk = new TGLabel(vGbTRGMskCh0, "Trigger Validation Mask"); vGbTRGMskCh0->AddFrame(lbTRGValMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + TGCheckButton * cbTRGValMskCh[8]; + for( int i = 0; i < 8; i++){ + cbTRGValMskCh[i] = new TGCheckButton(vGbTRGMskCh[i], ""); vGbTRGMskCh[i]->AddFrame(cbTRGValMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + } + + ///"Front Panel TRG-OUT Enable Mask", + TGLabel * lbTRGOUTMsk = new TGLabel(vGbTRGMskCh0, "TRG-OUT Mask"); vGbTRGMskCh0->AddFrame(lbTRGOUTMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + TGCheckButton * cbTRGOUTMskCh[8]; + for( int i = 0; i < 8; i++){ + cbTRGOUTMskCh[i] = new TGCheckButton(vGbTRGMskCh[i], ""); vGbTRGMskCh[i]->AddFrame(cbTRGOUTMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + } + + TGVerticalFrame * vGbTRGMskCh1 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh1, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + vGbTRGMskCh1->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + vGbTRGMskCh1->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbMajorCoinWin = new TGLabel(vGbTRGMskCh1, "Maj. Coin. Win."); vGbTRGMskCh1->AddFrame(lbMajorCoinWin, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbTRGMODE = new TGLabel(vGbTRGMskCh1, "TRG MODE"); vGbTRGMskCh1->AddFrame(lbTRGMODE, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbTRGOUTMODE = new TGLabel(vGbTRGMskCh1, "TRG-OUT MODE"); vGbTRGMskCh1->AddFrame(lbTRGOUTMODE, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + + TGVerticalFrame * vGbTRGMskCh2 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh2, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + vGbTRGMskCh2->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + vGbTRGMskCh2->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + + numMajorCoinWin = new TGNumberEntry(vGbTRGMskCh2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vGbTRGMskCh2->AddFrame(numMajorCoinWin); + numMajorCoinWin->Resize(70, 20); + + TGComboBox * cbTRGMODE = new TGComboBox(vGbTRGMskCh2, "TRG MODE",1); vGbTRGMskCh2->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(vGbTRGMskCh2, "TRG MODE",1); vGbTRGMskCh2->AddFrame(cbTRGOUTMODE); + cbTRGOUTMODE->EnableTextInput(false); + cbTRGOUTMODE->AddEntry("OR", 0); + cbTRGOUTMODE->AddEntry("AND", 1); + cbTRGOUTMODE->AddEntry("Majority", 2); + cbTRGOUTMODE->Resize(70, 20); + cbTRGOUTMODE->Select(0); + + TGVerticalFrame * vGbTRGMskCh3 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh3, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + vGbTRGMskCh3->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbMajorLevel = new TGLabel(vGbTRGMskCh3, "Majority Level"); vGbTRGMskCh3->AddFrame(lbMajorLevel, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + GlbMajorLevel = new TGNumberEntry(vGbTRGMskCh3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vGbTRGMskCh3->AddFrame(GlbMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + GlbMajorLevel->Resize(70, 17); + TRGMajorLevel = new TGNumberEntry(vGbTRGMskCh3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vGbTRGMskCh3->AddFrame(TRGMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TRGMajorLevel->Resize(70, 17); + TRGOUTMajorLevel = new TGNumberEntry(vGbTRGMskCh3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vGbTRGMskCh3->AddFrame(TRGOUTMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TRGOUTMajorLevel->Resize(70, 17); + + + TGVerticalFrame * vGbTRGMskCh4 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh4, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + TGLabel * lbLVDSTrigger = new TGLabel(vGbTRGMskCh4, "LVDS"); vGbTRGMskCh4->AddFrame(lbLVDSTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbdummy1 = new TGLabel(vGbTRGMskCh4, "Trg."); vGbTRGMskCh4->AddFrame(lbdummy1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + + TGCheckButton * bGLBLVDSTrigger = new TGCheckButton(vGbTRGMskCh4, "", 1); vGbTRGMskCh4->AddFrame(bGLBLVDSTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bGLBLVDSTrigger->SetState(kButtonUp); + vGbTRGMskCh4->AddFrame(lbdummy0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + + TGCheckButton * bTRGOUTLVDSTrigger = new TGCheckButton(vGbTRGMskCh4, "", 1); vGbTRGMskCh4->AddFrame(bTRGOUTLVDSTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bTRGOUTLVDSTrigger->SetState(kButtonUp); + + + TGVerticalFrame * vGbTRGMskCh5 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh5, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + TGLabel * lbExtTrigger = new TGLabel(vGbTRGMskCh5, "Ext."); vGbTRGMskCh5->AddFrame(lbExtTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbdummy2 = new TGLabel(vGbTRGMskCh5, "Trg."); vGbTRGMskCh5->AddFrame(lbdummy2, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + + TGCheckButton * bGLBExtTrigger = new TGCheckButton(vGbTRGMskCh5, "", 1); vGbTRGMskCh5->AddFrame(bGLBExtTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bGLBExtTrigger->SetState(kButtonUp); + TGCheckButton * bTRGExtTrigger = new TGCheckButton(vGbTRGMskCh5, "", 1); vGbTRGMskCh5->AddFrame(bTRGExtTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bTRGExtTrigger->SetState(kButtonUp); + TGCheckButton * bTRGOUTExtTrigger = new TGCheckButton(vGbTRGMskCh5, "", 1); vGbTRGMskCh5->AddFrame(bTRGOUTExtTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bTRGExtTrigger->SetState(kButtonUp); + + + TGVerticalFrame * vGbTRGMskCh6 = new TGVerticalFrame(hframeGbTRGMsk); hframeGbTRGMsk->AddFrame(vGbTRGMskCh6, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + TGLabel * lbSWTrigger = new TGLabel(vGbTRGMskCh6, "Software"); vGbTRGMskCh6->AddFrame(lbSWTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbdummy3 = new TGLabel(vGbTRGMskCh6, "Trg."); vGbTRGMskCh6->AddFrame(lbdummy3, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + + TGCheckButton * bGLBSoftwareTrigger = new TGCheckButton(vGbTRGMskCh6, "", 1); vGbTRGMskCh6->AddFrame(bGLBSoftwareTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bGLBSoftwareTrigger->SetState(kButtonDown); + TGCheckButton * bTRGSoftwareTrigger = new TGCheckButton(vGbTRGMskCh6, "", 1); vGbTRGMskCh6->AddFrame(bTRGSoftwareTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bTRGSoftwareTrigger->SetState(kButtonDown); + TGCheckButton * bTRGOUTSoftwareTrigger = new TGCheckButton(vGbTRGMskCh6, "", 1); vGbTRGMskCh6->AddFrame(bTRGOUTSoftwareTrigger, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 5, 5, 3, 4)); + bTRGOUTSoftwareTrigger->SetState(kButtonDown); + + TGHorizontalFrame * hframeGbTRGMsk2 = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeGbTRGMsk2, new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,2)); + TGCheckButton * bTRGValMskLVSDGLB = new TGCheckButton(hframeGbTRGMsk2, "LVSD Global Trg. Valid", 1); hframeGbTRGMsk2->AddFrame(bTRGValMskLVSDGLB); + TGCheckButton * bTRGValMskLVSDLCL = new TGCheckButton(hframeGbTRGMsk2, "LVSD Local Trg. Valid", 1); hframeGbTRGMsk2->AddFrame(bTRGValMskLVSDLCL); + + ///"Disable External Trigger", + TGCheckButton * bEnableExtTRG = new TGCheckButton(hframeGbTRGMsk2, "Enable Ext. Trigger", 1); hframeGbTRGMsk2->AddFrame(bEnableExtTRG); + + ///"Extended Veto Delay", + + + ///=================="Front Panel IO Control", + TGGroupFrame * gFrontIOCtrl = new TGGroupFrame(vframe, "Front Panel IO Control", kHorizontalFrame); vframe->AddFrame(gFrontIOCtrl ); + + ///"Front Panel LVDS IO New Features", + ///"LVDS IO Data", + ///"AnalogMonitor Mode", + ///"FanSpeed Control", + ///"Readout Control", + ///"Readout Status" + fMain->MapSubwindows(); fMain->Resize(fMain->GetDefaultSize()); fMain->MapWindow(); @@ -103,7 +345,12 @@ BoardSetting::~BoardSetting(){ delete boardIDEntry; - //delete entry; + //delete [] entry; + + delete bDualTrace; + delete cbAP1; + delete cbAP2; + delete cbDP; /// fMain must be delete last; fMain->Cleanup(); @@ -115,3 +362,49 @@ void BoardSetting::ChangeBoard(){ return; } + +void BoardSetting::SetAutoDataFlush(){ + printf("========== Auto Data Flush \n"); +} + +void BoardSetting::SetDecimateWF(){ + printf("========== Decimate WF \n"); +} + +void BoardSetting::SetWaveFormRecord(){ + printf("========== WF Record \n"); +} + +void BoardSetting::SetDualTrace(){ + printf("========== Dual trace \n"); + cbAP2->SetEnabled(bDualTrace->IsDown()); +} + +void BoardSetting::SetTriggerPropagation(){ + printf("========== Trigger Propagation \n"); +} + +void BoardSetting::SetEnableExtra2(){ + printf("========== SetEnableExtra2 \n"); +} + +void BoardSetting::SetAnalogProbe1(){ + printf("========== SetAnalogProbe1, %d \n", cbAP1->GetSelected()); + +} + +void BoardSetting::SetAnalogProbe2(){ + printf("========== SetAnalogProbe2, %d \n", cbAP2->GetSelected()); +} + +void BoardSetting::SetDigitalProbe(){ + printf("========== SetDigitalProbe, %d \n", cbDP->GetSelected()); +} + +void BoardSetting::SetAggregateOrganization(){ + printf("========== SetAggregateOrganization, %d \n", cbAggOrg->GetSelected()); +} + +void BoardSetting::SetReadOutAggregate(){ + printf("========== SetReadOutAggregate, %d \n", (int) numAggBLT->GetNumber()); +} diff --git a/boardSetting.h b/boardSetting.h index 0dda740..bfc7b22 100644 --- a/boardSetting.h +++ b/boardSetting.h @@ -2,13 +2,14 @@ #define BOARD_SETTING_H #include #include +#include #include #include #include "DigitizerPHA.h" #include "DigitizerPSD.h" #include "macro.h" -#define NUM_BOARD_SETTING 27 +#define NUM_BOARD_INFO 9 class TGWindow; class TGMainFrame; @@ -19,10 +20,23 @@ class BoardSetting{ TGNumberEntry * boardIDEntry; - TGTextEntry * entry[NUM_BOARD_SETTING]; + TGTextEntry * entry[NUM_BOARD_INFO]; Digitizer ** digi; - + + TGCheckButton * bDualTrace; + TGComboBox * cbAP1; + TGComboBox * cbAP2; /// for ComboBox for analog probe 2 + TGComboBox * cbDP; + + TGComboBox * cbAggOrg; + TGNumberEntry * numAggBLT; /// number of Agg pre Block transfer + + TGNumberEntry * numMajorCoinWin; + TGNumberEntry * GlbMajorLevel; + TGNumberEntry * TRGMajorLevel; + TGNumberEntry * TRGOUTMajorLevel; + public: BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard); virtual ~BoardSetting(); @@ -30,6 +44,20 @@ class BoardSetting{ void CloseWindow() { printf("close BoardSetting window\n"); delete this; } void ChangeBoard(); + ///=== Board Configure + void SetAutoDataFlush(); + void SetDecimateWF(); + void SetWaveFormRecord(); + void SetDualTrace(); + void SetTriggerPropagation(); + void SetEnableExtra2(); + void SetAnalogProbe1(); + void SetAnalogProbe2(); + void SetDigitalProbe(); + + void SetAggregateOrganization(); + void SetReadOutAggregate(); + bool isOpened; }; diff --git a/test.cpp b/test.cpp index da40188..671c58c 100644 --- a/test.cpp +++ b/test.cpp @@ -51,16 +51,33 @@ int main(int argc, char* argv[]){ printf("file size : %d Byte\n", (int) inFileSize); fclose(haha); - haha = fopen("output.bin", "r"); - char * buffer = new char[(int)inFileSize]; - size_t dump = fread(buffer, inFileSize, 1, haha); - fclose(haha); - Data * data = new Data(); data->DPPType = V1730_DPP_PHA_CODE; - data->buffer = buffer; - data->DecodeBuffer(14); + haha = fopen("output.bin", "r"); + printf("pos : %d \n", (int) ftell(haha)); + + do{ + unsigned int word[1]; /// 4 bytes + size_t dump = fread(word, 4, 1, haha); + fseek(haha, -4, SEEK_CUR); + unsigned int aggSize = (word[0] & 0x0FFFFFFF) * 4; ///byte + short header = ((word[0] >> 28 ) & 0xF); + if( header != 10 ) break; + + printf("-------- %d word = %d bytes\n", aggSize/4, aggSize); + char * buffer = new char[aggSize]; + dump = fread(buffer, aggSize, 1, haha); + + data->DecodeBuffer(buffer, 1); + + if( ftell(haha) >= inFileSize ) break; + + }while(!feof(haha) ); + + + + fclose(haha); /*********************/