added setting saving file, added LogMsg, finsihed hald of channelSetting, not tested

This commit is contained in:
carina@hades 2022-09-22 16:26:33 -04:00
parent aac24ef5ef
commit 671b3ba0b8
8 changed files with 611 additions and 331 deletions

View File

@ -343,10 +343,10 @@ void Digitizer::WriteRegister(uint32_t address, uint32_t value, int ch ){
///printf("0x%x, 0x%x=%u, ch:%d\n", address, value, value, ch);
if( ch < 0 ) {
ret = CAEN_DGTZ_WriteRegister(handle, address + 0x7000, value);
for( int i = 0; i < NChannel; i++) EditByte(value, address + (i << 8));
for( int i = 0; i < NChannel; i++) SaveSettingEditByte(value, address + (i << 8));
}else{
ret = CAEN_DGTZ_WriteRegister(handle, address + (ch<<8), value);
EditByte( value, address + (ch<<8) );
SaveSettingEditByte( value, address + (ch<<8) );
}
}else{
ret = CAEN_DGTZ_WriteRegister(handle, address, value);
@ -375,7 +375,7 @@ void Digitizer::SetChannelMask(uint32_t mask){
if( !isConnected ) return;
channelMask = mask;
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
EditByteByRegister(Register::DPP::ChannelEnableMask);
SaveSettingEditByteByRegister(Register::DPP::ChannelEnableMask);
ErrorMsg("SetChannelMask");
}
@ -609,53 +609,53 @@ void Digitizer::CreateAndSaveSettingBinary(string fileName){
settingFileExist = true;
///Save board setting
EditByteByRegister(Register::DPP::BoardConfiguration); /// 0x8000
EditByteByRegister(Register::DPP::AggregateOrganization); /// 0x800C
EditByteByRegister(Register::DPP::GlobalTriggerMask); /// 0x810C
EditByteByRegister(Register::DPP::ChannelEnableMask); /// 0x8120
EditByteByRegister(Register::DPP::ROM_BoardVersion); /// 0xF030
EditByteByRegister(Register::DPP::ROM_BoardFromFactor); /// 0xF034
EditByteByRegister(Register::DPP::ROM_BoardIDByte1); /// 0xF038
EditByteByRegister(Register::DPP::ROM_BoardIDByte0); /// 0xF03C
EditByteByRegister(Register::DPP::ROM_BoardSerialNumByte1); /// 0xF080
EditByteByRegister(Register::DPP::ROM_BoardSerialNumByte0); /// 0xF084
EditByteByRegister(Register::DPP::FrontPanelTRGOUTEnableMask); /// 0x8110
EditByteByRegister(Register::DPP::FrontPanelIOControl); /// 0x811C
EditByteByRegister(Register::DPP::ROCFPGAFirmwareRevision); /// 0x8124
EditByteByRegister(Register::DPP::BoardInfo); /// 0x8140
EditByteByRegister(Register::DPP::DisableExternalTrigger); /// 0x817C
EditByteByRegister(Register::DPP::TriggerValidationMask); /// 0x8180
EditByteByRegister(Register::DPP::MaxAggregatePerBlockTransfer); /// 0xEF1C
SaveSettingEditByteByRegister(Register::DPP::BoardConfiguration); /// 0x8000
SaveSettingEditByteByRegister(Register::DPP::AggregateOrganization); /// 0x800C
SaveSettingEditByteByRegister(Register::DPP::GlobalTriggerMask); /// 0x810C
SaveSettingEditByteByRegister(Register::DPP::ChannelEnableMask); /// 0x8120
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardVersion); /// 0xF030
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardFromFactor); /// 0xF034
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardIDByte1); /// 0xF038
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardIDByte0); /// 0xF03C
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardSerialNumByte1); /// 0xF080
SaveSettingEditByteByRegister(Register::DPP::ROM_BoardSerialNumByte0); /// 0xF084
SaveSettingEditByteByRegister(Register::DPP::FrontPanelTRGOUTEnableMask); /// 0x8110
SaveSettingEditByteByRegister(Register::DPP::FrontPanelIOControl); /// 0x811C
SaveSettingEditByteByRegister(Register::DPP::ROCFPGAFirmwareRevision); /// 0x8124
SaveSettingEditByteByRegister(Register::DPP::BoardInfo); /// 0x8140
SaveSettingEditByteByRegister(Register::DPP::DisableExternalTrigger); /// 0x817C
SaveSettingEditByteByRegister(Register::DPP::TriggerValidationMask); /// 0x8180
SaveSettingEditByteByRegister(Register::DPP::MaxAggregatePerBlockTransfer); /// 0xEF1C
///================ channel settings
for( int ch = 0; ch < NChannel ; ch++){
EditByteByRegister(Register::DPP::RecordLength_G, ch);
EditByteByRegister(Register::DPP::InputDynamicRange, ch);
EditByteByRegister(Register::DPP::PreTrigger, ch);
EditByteByRegister(Register::DPP::ChannelDCOffset, ch);
EditByteByRegister(Register::DPP::NumberEventsPerAggregate_G, ch);
EditByteByRegister(Register::DPP::DPPAlgorithmControl, ch);
EditByteByRegister(Register::DPP::AMCFirmwareRevision, ch);
EditByteByRegister(Register::DPP::VetoWidth, ch);
SaveSettingEditByteByRegister(Register::DPP::RecordLength_G, ch);
SaveSettingEditByteByRegister(Register::DPP::InputDynamicRange, ch);
SaveSettingEditByteByRegister(Register::DPP::PreTrigger, ch);
SaveSettingEditByteByRegister(Register::DPP::ChannelDCOffset, ch);
SaveSettingEditByteByRegister(Register::DPP::NumberEventsPerAggregate_G, ch);
SaveSettingEditByteByRegister(Register::DPP::DPPAlgorithmControl, ch);
SaveSettingEditByteByRegister(Register::DPP::AMCFirmwareRevision, ch);
SaveSettingEditByteByRegister(Register::DPP::VetoWidth, ch);
if( DPPType == 0x8B ) { /// DPP-PHA
EditByteByRegister(Register::DPP::PHA::TriggerThreshold, ch);
EditByteByRegister(Register::DPP::PHA::RCCR2SmoothingFactor, ch);
EditByteByRegister(Register::DPP::PHA::RiseTimeValidationWindow, ch);
EditByteByRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch);
EditByteByRegister(Register::DPP::PHA::InputRiseTime, ch);
EditByteByRegister(Register::DPP::PHA::ShapedTriggerWidth, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::TriggerThreshold, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::RCCR2SmoothingFactor, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::RiseTimeValidationWindow, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::InputRiseTime, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::ShapedTriggerWidth, ch);
EditByteByRegister(Register::DPP::PHA::TrapezoidRiseTime, ch);
EditByteByRegister(Register::DPP::PHA::TrapezoidFlatTop, ch);
EditByteByRegister(Register::DPP::PHA::DecayTime, ch);
EditByteByRegister(Register::DPP::PHA::PeakingTime, ch);
EditByteByRegister(Register::DPP::PHA::PeakHoldOff, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::TrapezoidRiseTime, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::TrapezoidFlatTop, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::DecayTime, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::PeakingTime, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::PeakHoldOff, ch);
EditByteByRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, ch);
EditByteByRegister(Register::DPP::PHA::FineGain, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, ch);
SaveSettingEditByteByRegister(Register::DPP::PHA::FineGain, ch);
}
}
@ -684,7 +684,7 @@ unsigned long Digitizer::ReadSettingBinary(uint32_t filePos, int ch){
return lala[0];
}
void Digitizer::EditByte(unsigned int value, uint32_t filePos){
void Digitizer::SaveSettingEditByte(unsigned int value, uint32_t filePos){
if ( !settingFileExist ) return ;
if( filePos >= 0x8000 ) filePos = filePos & 0x0FFF;
@ -697,6 +697,6 @@ void Digitizer::EditByte(unsigned int value, uint32_t filePos){
fclose (settingFile);
}
void Digitizer::EditByteByRegister(uint32_t registerAddress, int ch){
EditByte( ReadRegister(registerAddress, ch), registerAddress);
void Digitizer::SaveSettingEditByteByRegister(uint32_t registerAddress, int ch){
SaveSettingEditByte( ReadRegister(registerAddress, ch), registerAddress);
}

View File

@ -110,8 +110,8 @@ class Digitizer{
void OpenSettingBinary(string fileName);
//TODO void LoadSettingBinary(string fileName);
void CreateAndSaveSettingBinary(string fileName);
void EditByte(unsigned int value, uint32_t filePos);
void EditByteByRegister(uint32_t registerAddress, int ch = -1);
void SaveSettingEditByte(unsigned int value, uint32_t filePos);
void SaveSettingEditByteByRegister(uint32_t registerAddress, int ch = -1);
unsigned long ReadSettingBinary(uint32_t filePos, int ch = -1); /// read from setting binary

View File

@ -200,11 +200,12 @@ void MainWindow::HandleMenu(Int_t id){
digi[i] = new Digitizer(boardID[i], portID[i]);
printf("Open as Ordinary Digitizer\n");
}
digi[i]->CreateAndSaveSettingBinary("setting_" + to_string(digi[i]->GetSerialNumber()) + ".bin");
}
//fMenuDigitizers->EnableEntry( M_TRIGGER_SUMMARY);
fMenuDigitizers->EnableEntry( M_BOARD_SETTINGS);
fMenuDigitizers->EnableEntry( M_CH_SETTING);
//fMenuDigitizers->EnableEntry( M_BOARD_SETTINGS);
//fMenuDigitizers->EnableEntry( M_CH_SETTING);
}
@ -227,15 +228,19 @@ void MainWindow::HandleMenu(Int_t id){
///========================= Channel setting
case M_CH_SETTING:
channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
channelSetting->Connect("LogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
break;
///========================= Board setting
case M_BOARD_SETTINGS:{
if( boardSetting == NULL ) {
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
boardSetting->Connect("LogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
}else{
if ( boardSetting->IsOpen() == false ){
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
boardSetting->Connect("LogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
}
}
}break;

View File

@ -68,6 +68,7 @@ private:
//TGraph * gTrace;
//
//TGTextEditor * configEditor;
public:
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~MainWindow();
@ -87,6 +88,7 @@ public:
//static void * FillHistogram(void * ptr); /// thread
//void ChangeMod();
//void ChangeChannel();
void LogMsg(TString msg);
void GoodBye();
};

View File

@ -286,10 +286,8 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbAP1->AddEntry("RC-CR2 (2st derivative)", 2);
cbAP1->AddEntry("Trapezoid", 3);
cbAP1->Resize(150, 20);
cbAP1->Select(0);
cbAP1->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()");
TGLabel * lbAP2 = new TGLabel(vBdCfg_Probe_Label, "Ana. Prb. 2"); vBdCfg_Probe_Label->AddFrame(lbAP2, kaka);
cbAP2 = new TGComboBox(vBdCfg_Probe_CBox, "Ana. Pb. 2", 1); vBdCfg_Probe_CBox->AddFrame(cbAP2);
cbAP2->EnableTextInput(false);
@ -298,7 +296,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbAP2->AddEntry("Trapezoid - Baseline", 2);
cbAP2->AddEntry("Baseline", 3);
cbAP2->Resize(150, 20);
cbAP2->Select(0);
cbAP2->SetEnabled(false);
cbAP2->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()");
@ -319,7 +316,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbDP1->AddEntry("Ext. TRG", 11);
cbDP1->AddEntry("Memory full", 12);
cbDP1->Resize(150, 20);
cbDP1->Select(0);
cbDP1->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()");
TGLabel * lbDP2 = new TGLabel(vBdCfg_Probe_Label, "Digi. Prb. 2"); vBdCfg_Probe_Label->AddFrame(lbDP2, kaka);
@ -339,7 +335,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbDP2->AddEntry("Ext. TRG", 11);
cbDP2->AddEntry("Memory full", 12);
cbDP2->Resize(150, 20);
cbDP2->Select(0);
cbDP2->SetEnabled(false);
cbDP2->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()");
@ -349,7 +344,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
TGVerticalFrame * vBdCfga_label = new TGVerticalFrame(hframeBdCfg3); hframeBdCfg3->AddFrame(vBdCfga_label, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) );
TGVerticalFrame * vBdCfga_CBox = new TGVerticalFrame(hframeBdCfg3); hframeBdCfg3->AddFrame(vBdCfga_CBox, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) );
TGLabel * lbAggOrg = new TGLabel(vBdCfga_label, "Aggregate Organization"); vBdCfga_label->AddFrame(lbAggOrg, kaka);
cbAggOrg = new TGComboBox(vBdCfga_CBox, "Aggregate Organization", 1); vBdCfga_CBox->AddFrame(cbAggOrg);
cbAggOrg->EnableTextInput(false);
@ -364,7 +358,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbAggOrg->AddEntry("512", 9);
cbAggOrg->AddEntry("1024", 10);
cbAggOrg->Resize(100, 20);
cbAggOrg->Select(0);
cbAggOrg->Connect("Changed()", "BoardSetting", this, "SetAggregateOrganization()");
TGLabel * lbAggBLT = new TGLabel(vBdCfga_label, "MAx. Aggregate pre Readout"); vBdCfga_label->AddFrame(lbAggBLT, kaka);
@ -379,7 +372,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbFanCtrl->EnableTextInput(false);
cbFanCtrl->AddEntry("Slow/Auto",0x30);
cbFanCtrl->AddEntry("Fast", 0x38);
cbFanCtrl->Select(0x30);
cbFanCtrl->Resize(100, 20);
cbFanCtrl->Connect("Changed()", "BoardSetting", this, "SetFanSpeedControl()");
@ -405,7 +397,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbAcqMode->AddEntry("S-IN / GPI", 1);
cbAcqMode->AddEntry("1st Trig. Ctrl.", 2);
cbAcqMode->AddEntry("LVSD Ctrl.", 3);
cbAcqMode->Select(0);
cbAcqMode->Resize(100, 20);
cbAcqMode->Connect("Changed()", "BoardSetting", this, "SetACQControl()");
@ -414,7 +405,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbPLLref->EnableTextInput(false);
cbPLLref->AddEntry("internal", 0);
cbPLLref->AddEntry("external", 1);
cbPLLref->Select(0);
cbPLLref->Resize(100, 20);
cbPLLref->Connect("Changed()", "BoardSetting", this, "SetACQControl()");
@ -424,12 +414,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
numRunStartStopDelay->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x0FF);
numRunStartStopDelay->Connect("Modified()", "BoardSetting", this, "SetRunStartStopDelay()");
bAcqArm = new TGCheckButton(vAcqCtrl_CBox, "ACQ Start/Arm", 1); vAcqCtrl_CBox->AddFrame(bAcqArm, kaka);
bAcqArm->SetState(kButtonUp);
bAcqArm->Connect("Clicked()", "BoardSetting", this, "SetACQControl()");
TGHorizontalFrame * hAcqCtrl_b = new TGHorizontalFrame(vAcqCtrl1); vAcqCtrl1->AddFrame(hAcqCtrl_b, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 10, 0));
bSWTrigger = new TGTextButton(hAcqCtrl_b, "Send Software Trigger Signal"); hAcqCtrl_b->AddFrame(bSWTrigger, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
bSWTrigger->Connect("Clicked()", "BoardSetting", this, "SendSoftwareTriggerSignal()");
@ -509,7 +497,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbTRGMODE->AddEntry("AND", 1);
cbTRGMODE->AddEntry("Majority", 2);
cbTRGMODE->Resize(70, 20);
cbTRGMODE->Select(0);
cbTRGMODE->Connect("Changed()", "BoardSetting", this, "SetTriggerValidMask()");
cbTRGOUTMODE = new TGComboBox(vTRGMsk2, "TRG-OUT MODE",1); vTRGMsk2->AddFrame(cbTRGOUTMODE);
@ -518,7 +505,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbTRGOUTMODE->AddEntry("AND", 1);
cbTRGOUTMODE->AddEntry("Majority", 2);
cbTRGOUTMODE->Resize(70, 20);
cbTRGOUTMODE->Select(0);
cbTRGOUTMODE->Connect("Changed()", "BoardSetting", this, "SetTRGOUTMask()");
TGVerticalFrame * vTRGMsk3 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk3, haha);
@ -598,7 +584,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbLEMOIO->EnableTextInput(false);
cbLEMOIO->AddEntry("NIM", 0);
cbLEMOIO->AddEntry("TTL", 1);
cbLEMOIO->Select(0);
cbLEMOIO->Resize(50, 20);
cbLEMOIO->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()");
@ -616,7 +601,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbTRGOUTmode->AddEntry("Sync Clock", 0x50000);
cbTRGOUTmode->AddEntry("Clock Phase", 0x90000);
cbTRGOUTmode->AddEntry("BUSY/UNLOCK", 0xD0000);
cbTRGOUTmode->Select(1);
cbTRGOUTmode->Resize(160, 20);
cbTRGOUTmode->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()");
@ -625,7 +609,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
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);
cbTRGINCtrl->Select(0);
cbTRGINCtrl->Resize(250, 20);
cbTRGINCtrl->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()");
@ -634,7 +617,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
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);
cbTRGINMezzanines->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()");
@ -649,10 +631,9 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbAnaMonitor->AddEntry("Test", 1);
cbAnaMonitor->AddEntry("Buffer Occupancy", 3);
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
//cbAnaMonitor->Connect("Changed()", "ChannelSetting", this, "ChangePolarity()"); //Example to call other class
///"Buffer Occupancy Gain
TGLabel * lbBufferOccpGain = new TGLabel(vFrontIOCtrl_label, "Buffer Occupancy Gain"); vFrontIOCtrl_label->AddFrame(lbBufferOccpGain, haha);
@ -682,12 +663,9 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
cbVMEInterrupLevel->AddEntry("5", 5);
cbVMEInterrupLevel->AddEntry("6", 6);
cbVMEInterrupLevel->AddEntry("7", 7);
cbVMEInterrupLevel->Select(0);
cbVMEInterrupLevel->Resize(80, 20);
cbVMEInterrupLevel->Connect("Changed()", "BoardSetting", this, "SetReadOutControl()");
bOpticalLinkInterrupt = new TGCheckButton(vReadoutCtrl, "Optical Link Interrupt", 1); vReadoutCtrl->AddFrame(bOpticalLinkInterrupt);
bOpticalLinkInterrupt->SetState(kButtonUp);
bOpticalLinkInterrupt->Connect("Clicked()", "BoardSetting", this, "SetReadOutControl()");
@ -764,41 +742,41 @@ void * BoardSetting::ReadStatus(void * ptr){
/// ACQ Status
uint32_t temp = pha->ReadRegister(Register::DPP::AcquisitionStatus);
txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running"); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue);
txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events"); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue);
txtACQEventFull ->SetText( ((temp >> 4) & 0x1) == 0 ? "no channel FULL" : "a channel FULL"); txtACQEventFull->SetTextColor( ((temp >> 4) & 0x1) == 0 ? 1 : red);
txtACQClockSource->SetText( ((temp >> 5) & 0x1) == 0 ? "Internal Clock" : "External Clock"); txtACQClockSource->SetTextColor( ((temp >> 5) & 0x1) == 0 ? 1 : blue);
txtACQPLLLock ->SetText( ((temp >> 7) & 0x1) == 0 ? "PLL no lock" : "PLL locked"); txtACQPLLLock->SetTextColor( ((temp >> 7) & 0x1) == 0 ? 1 : blue);
txtACQBoardReady ->SetText( ((temp >> 8) & 0x1) == 0 ? "Board NOT Ready (PLL & ADCs are NOT sync)" : "Board Ready (PLL & ADCs are sync)");
txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue);
txtACQEventReady ->SetText( ((temp >> 3) & 0x1) == 0 ? "no Event" : "Has Events", false); txtACQEventReady->SetTextColor( ((temp >> 3) & 0x1) == 0 ? 1 : blue);
txtACQEventFull ->SetText( ((temp >> 4) & 0x1) == 0 ? "no channel FULL" : "a channel FULL", false); txtACQEventFull->SetTextColor( ((temp >> 4) & 0x1) == 0 ? 1 : red);
txtACQClockSource->SetText( ((temp >> 5) & 0x1) == 0 ? "Internal Clock" : "External Clock", false); txtACQClockSource->SetTextColor( ((temp >> 5) & 0x1) == 0 ? 1 : blue);
txtACQPLLLock ->SetText( ((temp >> 7) & 0x1) == 0 ? "PLL no lock" : "PLL locked", false); txtACQPLLLock->SetTextColor( ((temp >> 7) & 0x1) == 0 ? 1 : blue);
txtACQBoardReady ->SetText( ((temp >> 8) & 0x1) == 0 ? "Board NOT Ready (PLL & ADCs are NOT sync)" : "Board Ready (PLL & ADCs are sync)", false);
txtACQBoardReady->SetTextColor( ((temp >> 8) & 0x1) == 0 ? red : 1);
txtACQChDown ->SetText( ((temp >> 19) & 0x1) == 0 ? "Channels are ON" : "Channels ShutDown");
txtACQChDown ->SetText( ((temp >> 19) & 0x1) == 0 ? "Channels are ON" : "Channels ShutDown", false);
txtACQChDown->SetTextColor( ((temp >> 19) & 0x1) == 0 ? 1 : red);
txtACQSIN ->SetText( ((temp >> 15) & 0x1) == 0 ? "S-IN = 0" : "S-IN = 1"); txtACQSIN->SetTextColor( ((temp >> 15) & 0x1) == 0 ? 1 : blue);
txtACQTRIGIN ->SetText( ((temp >> 16) & 0x1) == 0 ? "TRG-IN = 0" : "TRG-IN = 1"); txtACQTRIGIN->SetTextColor( ((temp >> 16) & 0x1) == 0 ? 1 : blue);
txtACQSIN ->SetText( ((temp >> 15) & 0x1) == 0 ? "S-IN = 0" : "S-IN = 1", false); txtACQSIN->SetTextColor( ((temp >> 15) & 0x1) == 0 ? 1 : blue);
txtACQTRIGIN ->SetText( ((temp >> 16) & 0x1) == 0 ? "TRG-IN = 0" : "TRG-IN = 1", false); txtACQTRIGIN->SetTextColor( ((temp >> 16) & 0x1) == 0 ? 1 : blue);
txtACQTemp0->SetText( ((temp >> 20) & 0x1) == 0 ? "< 70" : "> 70"); txtACQTemp0->SetTextColor( ((temp >> 20) & 0x1) == 0 ? 1 : red);
txtACQTemp1->SetText( ((temp >> 21) & 0x1) == 0 ? "< 70" : "> 70"); txtACQTemp1->SetTextColor( ((temp >> 21) & 0x1) == 0 ? 1 : red);
txtACQTemp2->SetText( ((temp >> 22) & 0x1) == 0 ? "< 70" : "> 70"); txtACQTemp2->SetTextColor( ((temp >> 22) & 0x1) == 0 ? 1 : red);
txtACQTemp3->SetText( ((temp >> 23) & 0x1) == 0 ? "< 70" : "> 70"); txtACQTemp3->SetTextColor( ((temp >> 23) & 0x1) == 0 ? 1 : red);
txtACQTemp0->SetText( ((temp >> 20) & 0x1) == 0 ? "< 70" : "> 70", false); txtACQTemp0->SetTextColor( ((temp >> 20) & 0x1) == 0 ? 1 : red);
txtACQTemp1->SetText( ((temp >> 21) & 0x1) == 0 ? "< 70" : "> 70", false); txtACQTemp1->SetTextColor( ((temp >> 21) & 0x1) == 0 ? 1 : red);
txtACQTemp2->SetText( ((temp >> 22) & 0x1) == 0 ? "< 70" : "> 70", false); txtACQTemp2->SetTextColor( ((temp >> 22) & 0x1) == 0 ? 1 : red);
txtACQTemp3->SetText( ((temp >> 23) & 0x1) == 0 ? "< 70" : "> 70", false); txtACQTemp3->SetTextColor( ((temp >> 23) & 0x1) == 0 ? 1 : red);
/// Redaout Status
temp = pha->ReadRegister(Register::DPP::ReadoutStatus);
if( (temp & 0x1) == 1 ){
txtEventReady->SetText( "Event Ready" ); txtEventReady->SetTextColor(blue);
txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue);
}else{
txtEventReady->SetText( "No Data Ready" ); txtEventReady->SetTextColor(red);
txtEventReady->SetText( "No Data Ready" , false); txtEventReady->SetTextColor(red);
}
if( (( temp >> 2 ) & 0x1 ) == 0 ){
txtBusError->SetText( "no Bus Error" ); txtBusError->SetTextColor(blue);
txtBusError->SetText( "no Bus Error", false ); txtBusError->SetTextColor(blue);
}else{
txtBusError->SetText( "Bus Error" ); txtBusError->SetTextColor(red);
txtBusError->SetText( "Bus Error", false ); txtBusError->SetTextColor(red);
}
if( (( temp >> 3 ) & 0x1 ) == 0 ){
txtVMEFIFO->SetText( "VME FIFO NOT EMPTY" ); txtVMEFIFO->SetTextColor(red);
txtVMEFIFO->SetText( "VME FIFO NOT EMPTY", false ); txtVMEFIFO->SetTextColor(red);
}else{
txtVMEFIFO->SetText( "VME FIFO EMPTY" ); txtVMEFIFO->SetTextColor(red);
txtVMEFIFO->SetText( "VME FIFO EMPTY", false ); txtVMEFIFO->SetTextColor(red);
}
usleep(pauseTime*1000);
@ -824,27 +802,27 @@ void BoardSetting::ChangeBoard(){
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;
case V1724_DPP_PHA_CODE: entry[i]->SetText("DPP-PHA", false); break;
case V1720_DPP_CI_CODE : entry[i]->SetText("DPP-CI ", false); break;
case V1720_DPP_PSD_CODE: entry[i]->SetText("DPP-PSD", false); break;
case V1751_DPP_PSD_CODE: entry[i]->SetText("DPP-PSD", false); break;
case V1751_DPP_ZLE_CODE: entry[i]->SetText("DPP-ZLE", false); break;
case V1743_DPP_CI_CODE: entry[i]->SetText("DPP-PSD", false); break;
case V1740_DPP_QDC_CODE: entry[i]->SetText("DPP-QDC", false); break;
case V1730_DPP_PSD_CODE: entry[i]->SetText("DPP-PSD", false); break;
case V1730_DPP_PHA_CODE: entry[i]->SetText("DPP-PHA", false); break;
case V1730_DPP_ZLE_CODE: entry[i]->SetText("DPP-ZLE", false); break;
case V1730_DPP_DAW_CODE: entry[i]->SetText("DPP-DAW", false); 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;
case 2 : entry[i]->SetText( Form("%s", digi[boardID]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link"), false ); break;
case 3 : entry[i]->SetText( Form("%d", digi[boardID]->GetSerialNumber() ), false ); break;
case 4 : entry[i]->SetText( Form("%d", digi[boardID]->GetNChannel() ), false ); break;
case 5 : entry[i]->SetText( Form("%0.f MHz = %.1f ns", 1000/digi[boardID]->GetCh2ns(), digi[boardID]->GetCh2ns()), false ); break;
case 6 : entry[i]->SetText( Form("%d", digi[boardID]->GetADCBits() ), false ); break;
case 7 : entry[i]->SetText( Form("%s", (digi[boardID]->GetROCVersion()).c_str() ), false ); break;
case 8 : entry[i]->SetText( Form("%s", (digi[boardID]->GetAMCVersion()).c_str() ), false ); break;
}
}
@ -856,107 +834,107 @@ void BoardSetting::ChangeBoard(){
unsigned int temp = pha->ReadRegister(Register::BoardFailureStatus);
if( (temp & 0x10) == 0 ) {
enPLLStatus->SetText( "OK" ); enPLLStatus->SetTextColor(1);
enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1);
}else{
enPLLStatus->SetText( "Lost Lock" ); enPLLStatus->SetTextColor(red);
enPLLStatus->SetText( "Lost Lock" , false); enPLLStatus->SetTextColor(red);
}
if( (temp & 0x20) == 0 ) {
enTempStatus->SetText( "OK (<70)" ); enTempStatus->SetTextColor(1);
enTempStatus->SetText( "OK (<70)" , false); enTempStatus->SetTextColor(1);
}else{
enTempStatus->SetText( "Failure" ); enTempStatus->SetTextColor(red);
enTempStatus->SetText( "Failure" , false); enTempStatus->SetTextColor(red);
}
if( (temp & 0x40) == 0 ) {
enADCPwrStatus->SetText( "OK" ); enADCPwrStatus->SetTextColor(1);
enADCPwrStatus->SetText( "OK", false); enADCPwrStatus->SetTextColor(1);
}else{
enADCPwrStatus->SetText( "Failure" ); enADCPwrStatus->SetTextColor(red);
enADCPwrStatus->SetText( "Failure", false); enADCPwrStatus->SetTextColor(red);
}
//pha->PrintBoardConfiguration();
temp = pha->ReadRegister(Register::DPP::BoardConfiguration);
bAutoDataFlush->SetState( (temp & 0x1) ? kButtonDown : kButtonUp );
bDecimateWF->SetState( ((temp >> 1) & 0x1) ? kButtonDown : kButtonUp );
bWFRecord->SetState( ((temp >> 16) & 0x1) ? kButtonDown : kButtonUp );
bTrigPropa->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp );
bExtrac2->SetState( ((temp >> 17) & 0x1) ? kButtonDown : kButtonUp);
bDualTrace->SetState( ((temp >> 11) & 0x1) ? kButtonDown : kButtonUp);
cbAP1->Select( ((temp >> 12) & 0x3) );
cbAP2->Select( ((temp >> 14) & 0x3) );
cbDP1->Select( ((temp >> 20) & 0x7) );
bAutoDataFlush->SetState( (temp & 0x1) ? kButtonDown : kButtonUp, false);
bDecimateWF->SetState( ((temp >> 1) & 0x1) ? kButtonDown : kButtonUp, false );
bWFRecord->SetState( ((temp >> 16) & 0x1) ? kButtonDown : kButtonUp, false );
bTrigPropa->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp, false );
bExtrac2->SetState( ((temp >> 17) & 0x1) ? kButtonDown : kButtonUp, false );
bDualTrace->SetState( ((temp >> 11) & 0x1) ? kButtonDown : kButtonUp, false );
cbAP1->Select( ((temp >> 12) & 0x3) , false);
cbAP2->Select( ((temp >> 14) & 0x3) , false);
cbDP1->Select( ((temp >> 20) & 0x7) , false);
cbAggOrg->Select( pha->ReadRegister(Register::DPP::AggregateOrganization) );
numAggBLT->SetNumber( pha->ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer) );
cbAggOrg->Select( pha->ReadRegister(Register::DPP::AggregateOrganization) , false);
numAggBLT->SetNumber( pha->ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer) , false);
cbFanCtrl->Select( pha->ReadRegister(Register::DPP::FanSpeedControl) );
cbFanCtrl->Select( pha->ReadRegister(Register::DPP::FanSpeedControl) , false);
//pha->PrintACQControl();
temp = pha->ReadRegister(Register::DPP::AcquisitionControl);
cbAcqMode->Select( temp & 0x3 );
bAcqArm->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp);
cbPLLref->Select( ((temp >> 6) & 0x1));
cbAcqMode->Select( temp & 0x3 , false);
bAcqArm->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp, false);
cbPLLref->Select( ((temp >> 6) & 0x1), false);
numRunStartStopDelay->SetNumber( pha->ReadRegister(Register::DPP::RunStartStopDelay));
numRunStartStopDelay->SetNumber( pha->ReadRegister(Register::DPP::RunStartStopDelay), false);
/// Global Trigger Mask
temp = pha->ReadRegister(Register::DPP::GlobalTriggerMask);
for( int i = 0; i < 8; i++){
cbGbTRGMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown );
cbGbTRGMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false);
}
numMajorCoinWin->SetNumber( (temp >> 20 ) & 0x7 );
GlbMajorLevel->SetNumber( ( temp >> 24) & 0x7 );
bGLBExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown);
bGLBSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown);
numMajorCoinWin->SetNumber( (temp >> 20 ) & 0x7 , false);
GlbMajorLevel->SetNumber( ( temp >> 24) & 0x7 , false);
bGLBExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false);
bGLBSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false);
/// Trigger Validation Mask
temp = pha->ReadRegister(Register::DPP::TriggerValidationMask);
for( int i = 0; i < 8; i++){
cbTRGValMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown );
cbTRGValMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false);
}
cbTRGMODE->Select( ( temp >> 8 ) & 0x3) ;
TRGMajorLevel->SetNumber( ( temp >> 10 ) & 0x3);
bTRGExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown);
bTRGSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown);
cbTRGMODE->Select( ( temp >> 8 ) & 0x3, false) ;
TRGMajorLevel->SetNumber( ( temp >> 10 ) & 0x3, false);
bTRGExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false);
bTRGSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false);
/// Front Panel TRG-OUT Enable Mask
temp = pha->ReadRegister(Register::DPP::FrontPanelTRGOUTEnableMask);
for( int i = 0; i < 8; i++){
cbTRGOUTMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown );
cbTRGOUTMskCh[i]->SetState( ((temp >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown, false );
}
cbTRGOUTMODE->Select( ( temp >> 8 ) & 0x3) ;
TRGOUTMajorLevel->SetNumber( ( temp >> 10 ) & 0x7);
bTRGOUTExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown);
bTRGOUTSoftwareTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown);
cbTRGOUTMODE->Select( ( temp >> 8 ) & 0x3, false) ;
TRGOUTMajorLevel->SetNumber( ( temp >> 10 ) & 0x7, false);
bTRGOUTExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false);
bTRGOUTSoftwareTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false);
bEnableExtTRG->SetState( (pha->ReadRegister(Register::DPP::DisableExternalTrigger) & 0x1) ? kButtonDown : kButtonUp);
bEnableExtTRG->SetState( (pha->ReadRegister(Register::DPP::DisableExternalTrigger) & 0x1) ? kButtonDown : kButtonUp, false);
numExtendVetoDelay->SetNumber( pha->ReadRegister(Register::DPP::ExtendedVetoDelay) );
numExtendVetoDelay->SetNumber( pha->ReadRegister(Register::DPP::ExtendedVetoDelay) , false);
/// Front Panel I/O Control
temp = pha->ReadRegister(Register::DPP::FrontPanelIOControl);
cbLEMOIO->Select( temp & 0x1 );
cbLEMOIO->Select( temp & 0x1 , false);
if( ((temp >> 1) & 0x1 ) == 0 ) {
cbTRGOUTmode->Select( 1 );
cbTRGOUTmode->Select( 1 , false);
}else{
cbTRGOUTmode->Select( (temp >> 14) & 0x3F );
cbTRGOUTmode->Select( (temp >> 14) & 0x3F , false);
}
cbTRGINCtrl->Select( (temp >> 10) & 0x1 );
cbTRGINMezzanines->Select( (temp >> 11) & 0x1 );
cbTRGINCtrl->Select( (temp >> 10) & 0x1 , false);
cbTRGINMezzanines->Select( (temp >> 11) & 0x1 , false);
cbAnaMonitor->Select( pha->ReadRegister(Register::DPP::AnalogMonitorMode) & 0x7 );
numBufferOccpGain->SetNumber( pha->ReadRegister(Register::DPP::BufferOccupancyGain) & 0xf);
cbAnaMonitor->Select( pha->ReadRegister(Register::DPP::AnalogMonitorMode) & 0x7 , false);
numBufferOccpGain->SetNumber( pha->ReadRegister(Register::DPP::BufferOccupancyGain) & 0xf, false);
/// Readout Control
temp = pha->ReadRegister(Register::DPP::ReadoutControl);
cbVMEInterrupLevel->Select( temp & 0x3 );
bOpticalLinkInterrupt->SetState( (( temp >> 3 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ;
bEventAligned->SetState( (( temp >> 4 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ;
bVMEAlogn64Mode->SetState( (( temp >> 5 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ;
bInteruptReleaseMode->SetState( (( temp >> 7 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ;
bEnableExtendedBlockTransfer->SetState( (( temp >> 8 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ;
cbVMEInterrupLevel->Select( temp & 0x3 , false);
bOpticalLinkInterrupt->SetState( (( temp >> 3 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ;
bEventAligned->SetState( (( temp >> 4 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ;
bVMEAlogn64Mode->SetState( (( temp >> 5 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ;
bInteruptReleaseMode->SetState( (( temp >> 7 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ;
bEnableExtendedBlockTransfer->SetState( (( temp >> 8 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false) ;
pha = NULL; ///unlink the pointer
}else if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ) {

View File

@ -1,6 +1,8 @@
#ifndef BOARD_SETTING_H
#define BOARD_SETTING_H
#include <TQObject.h>
#include <RQ_OBJECT.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include <TGComboBox.h>
@ -16,6 +18,7 @@ class TGWindow;
class TGMainFrame;
class BoardSetting{
RQ_OBJECT("BoardSetting")
private:
TGMainFrame * fMain;
@ -124,21 +127,16 @@ class BoardSetting{
TThread * readStatusThread;
static bool isOpened;
static void * ReadStatus(void * ptr); /// thread.
public:
BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard);
virtual ~BoardSetting();
bool IsOpen() {return isOpened;}
void CloseWindow() {
delete this;
}
void CloseWindow() { delete this;}
void ChangeBoard();
static void * ReadStatus(void * ptr); /// thread.
///=== Button
void ResetSettingToDefault();
void ClearBuffer();
@ -172,7 +170,7 @@ class BoardSetting{
///==== Readout Control
void SetReadOutControl();
void LogMsg(TString msg); // *SIGNAL*
};
#endif

View File

@ -41,18 +41,22 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
NChannel = 16 ;// digi[0]->GetNChannel();
TGLabel * lb1 = new TGLabel(hframe0, "Channel :"); hframe0->AddFrame(lb1, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber);
chIDEntry->SetWidth(50);
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, NChannel-1);
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, NChannel-1);
chIDEntry->SetNumber(0, false);
chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()");
hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
TGTextButton* bSetAllChannels = new TGTextButton(hframe0, "Set All Channels", 1); hframe0->AddFrame(bSetAllChannels, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
bSetAllChannels->SetState(kButtonUp);
bSetAllChannels->Connect("Clicked()", "ChannelSetting", this, "SetAllChannels()");
///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 = 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();
@ -74,9 +78,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
cbOnOff->AddEntry("ON", 1);
cbOnOff->AddEntry("off", 0);
cbOnOff->Resize(width, 20);
//pixie->GetChannelOnOff(boardID, ch) ? cbOnOff->Select(1) : cbOnOff->Select(0);
cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "ChangeOnOff()");
cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetChannelMask()");
///----------- Polarity
TGLabel * lbPol = new TGLabel(vfInput1, "Polarity");vfInput1->AddFrame(lbPol, layoutHintsR);
@ -84,32 +86,37 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
cbPolarity->AddEntry("Positive +", 1);
cbPolarity->AddEntry("Negative -", 0);
cbPolarity->Resize(width, 20);
//pixie->GetChannelPolarity(boardID, ch) ? cbPolarity->Select(1) : cbPolarity->Select(0);
cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "ChangeOnOff()");
cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetDPPAlgorithm1()");
///---------- Input Dynamic Range
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);
cbInputDynamicRange->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetInputDynamicRange()");
///---------- 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 = new TGNumberEntry(vfInput2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numRecordLength, layoutHints);
numRecordLength->Resize(width, 20);
numRecordLength->Connect("Modified()", "ChannelSetting", this, "SetRecordLength()");
///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 = new TGNumberEntry(vfInput2, 2000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numPreTrigger, layoutHints);
numPreTrigger->Resize(width, 20);
numPreTrigger->Connect("Modified()", "ChannelSetting", this, "SetPreTrigger()");
///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 = new TGNumberEntry(vfInput2, 512, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numEventAgg, layoutHints);
numEventAgg->Resize(width, 20);
numEventAgg->Connect("Modified()", "ChannelSetting", this, "SetEventAggregate()");
///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure
///const uint32_t VetoWidth = 0x10D4; /// R/W
///const uint32_t FineGain = 0x10C4; /// R/W OK
}
{///================== Trigger Settings
@ -121,22 +128,25 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
///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 = new TGNumberEntry(vfTrigger2, 100, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerThreshold, layoutHints);
numTriggerThreshold->Resize(width, 20);
numTriggerThreshold->Connect("Modified()", "ChannelSetting", this, "SetTriggerThreshold()");
///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 = new TGNumberEntry(vfTrigger2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerHoldOff, layoutHints);
numTriggerHoldOff->Resize(width, 20);
numTriggerHoldOff->Connect("Modified()", "ChannelSetting", this, "SetTriggerHoldOff()");
///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 = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numDCOffset, layoutHints);
numDCOffset->Resize(width, 20);
numDCOffset->Connect("Modified()", "ChannelSetting", this, "SetDCOffset()");
///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 = new TGComboBox(vfTrigger2); vfTrigger2->AddFrame(cbTriggerSmoothing, layoutHints);
cbTriggerSmoothing->AddEntry("disable", 0);
cbTriggerSmoothing->AddEntry("2 samples", 1);
cbTriggerSmoothing->AddEntry("4 samples", 2);
@ -145,32 +155,29 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
cbTriggerSmoothing->AddEntry("32 samples", 16);
cbTriggerSmoothing->AddEntry("64 samples", 32);
cbTriggerSmoothing->AddEntry("128 samples", 0x3F);
cbTriggerSmoothing->Select(16);
cbTriggerSmoothing->Resize(width, 20);
cbTriggerSmoothing->Connect("Changed()", "ChannelSetting", this, "SetTriggerSmoothing()");
///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 = new TGNumberEntry(vfTrigger2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numInputRiseTime, layoutHints);
numInputRiseTime->Resize(width, 20);
numInputRiseTime->Connect("Modified()", "ChannelSetting", this, "SetInputRiseTime()");
///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 = 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
numRiseTimeValidWin->Connect("Modified()", "ChannelSetting", this, "SetRiseTimeValidWin()");
/// DPP1 bit[19:18]
TGLabel * lbTriggerMode = new TGLabel(vfTrigger1, "Trig. Mode"); vfTrigger1->AddFrame(lbTriggerMode, layoutHintsR);
TGComboBox * cbTriggerMode = new TGComboBox(vfTrigger2); vfTrigger2->AddFrame(cbTriggerMode, layoutHints);
TGLabel * lbTriggerMode = new TGLabel(vfTrigger1, "Trig. Mode"); vfTrigger1->AddFrame(lbTriggerMode, layoutHintsR);
cbTriggerMode = new TGComboBox(vfTrigger2); vfTrigger2->AddFrame(cbTriggerMode, layoutHints);
cbTriggerMode->AddEntry("Normal", 0);
cbTriggerMode->AddEntry("Coin.", 1);
cbTriggerMode->AddEntry("Anti-Coin.", 3);
cbTriggerMode->Resize(width, 20);
cbTriggerMode->Select(0);
cbTriggerMode->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
}
{///================== Trapezoid Settings
@ -180,45 +187,49 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
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 = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapRiseTime, layoutHints);
numTrapRiseTime->Resize(width, 20);
numTrapRiseTime->Connect("Modified()", "ChannelSetting", this, "SetTrapRiseTime()");
///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 = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapFlatTop, layoutHints);
numTrapFlatTop->Resize(width, 20);
numTrapFlatTop->Connect("Modified()", "ChannelSetting", this, "SetTrapFlatTop()");
///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 = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numDecay, layoutHints);
numDecay->Resize(width, 20);
numDecay->Connect("Modified()", "ChannelSetting", this, "SetDecay()");
///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 = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeaking, layoutHints);
numPeaking->Resize(width, 20);
numPeaking->Connect("Modified()", "ChannelSetting", this, "SetPeaking()");
///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 = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeakHoldOff, layoutHints);
numPeakHoldOff->Resize(width, 20);
numPeakHoldOff->Connect("Modified()", "ChannelSetting", this, "SetPeakHoldOff()");
/// DPP1 bit[13:12]
TGLabel * lbPeakMean = new TGLabel(vfTrap1, "Peak Mean"); vfTrap1->AddFrame(lbPeakMean, layoutHintsR);
TGComboBox * cbPeakMean = new TGComboBox(vfTrap2); vfTrap2->AddFrame(cbPeakMean, layoutHints);
TGLabel * lbPeakMean = new TGLabel(vfTrap1, "Peak Mean"); vfTrap1->AddFrame(lbPeakMean, layoutHintsR);
cbPeakMean = new TGComboBox(vfTrap2); vfTrap2->AddFrame(cbPeakMean, layoutHints);
cbPeakMean->AddEntry("1 sample", 0);
cbPeakMean->AddEntry("4 samples", 1);
cbPeakMean->AddEntry("16 samples", 2);
cbPeakMean->AddEntry("64 samples", 3);
cbPeakMean->Resize(width, 20);
cbPeakMean->Select(0);
cbPeakMean->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
/// DPP1 bit[22:20]
TGLabel * lbBaseLineAvg = new TGLabel(vfTrap1, "Baseline avg."); vfTrap1->AddFrame(lbBaseLineAvg, layoutHintsR);
TGComboBox * cbBaseLineAvg = new TGComboBox(vfTrap2); vfTrap2->AddFrame(cbBaseLineAvg, layoutHints);
TGLabel * lbBaseLineAvg = new TGLabel(vfTrap1, "Baseline avg."); vfTrap1->AddFrame(lbBaseLineAvg, layoutHintsR);
cbBaseLineAvg = new TGComboBox(vfTrap2); vfTrap2->AddFrame(cbBaseLineAvg, layoutHints);
cbBaseLineAvg->AddEntry("no baseline", 0);
cbBaseLineAvg->AddEntry("16 sp.", 1);
cbBaseLineAvg->AddEntry("64 sp.", 2);
@ -227,7 +238,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
cbBaseLineAvg->AddEntry("4096 sp.", 5);
cbBaseLineAvg->AddEntry("16384 sp.", 6);
cbBaseLineAvg->Resize(width, 20);
cbBaseLineAvg->Select(0);
cbBaseLineAvg->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
}
@ -236,115 +247,109 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
TGVerticalFrame * vfDPPCtrl = new TGVerticalFrame(gfDPPCtrl); gfDPPCtrl->AddFrame(vfDPPCtrl, new TGLayoutHints(kLHintsExpandX));
TGHorizontalFrame * hfDPPCtrl1 = new TGHorizontalFrame(vfDPPCtrl); vfDPPCtrl->AddFrame(hfDPPCtrl1, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 0));
TGVerticalFrame * vfDPPCtrl11 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl11, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
TGVerticalFrame * vfDPPCtrl12 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl12);
TGLayoutHints * haha = new TGLayoutHints(kLHintsRight, 5, 5, 3, 2);
TGLabel * lbTrapScale = new TGLabel(vfDPPCtrl11, "Trap. Scaling [bit] :"); vfDPPCtrl11->AddFrame(lbTrapScale, haha);
TGLabel * lbDecimation = new TGLabel(vfDPPCtrl11, "Decimation :"); vfDPPCtrl11->AddFrame(lbDecimation, haha);
TGLabel * lbDecimationGain = new TGLabel(vfDPPCtrl11, "Decimation Gain :"); vfDPPCtrl11->AddFrame(lbDecimationGain, haha);
TGLabel * lbRollOver = new TGLabel(vfDPPCtrl11, "Roll-Over Flag :"); vfDPPCtrl11->AddFrame(lbRollOver, haha);
TGLabel * lbPileUp = new TGLabel(vfDPPCtrl11, "Pile-Up Flag :"); vfDPPCtrl11->AddFrame(lbPileUp, haha);
TGVerticalFrame * vfDPPCtrl12 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl12);
TGNumberEntry * numTrapScale = new TGNumberEntry(vfDPPCtrl12, 14, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative );
vfDPPCtrl12->AddFrame(numTrapScale);
TGLabel * lbTrapScale = new TGLabel(vfDPPCtrl11, "Trap. Scaling [bit] :"); vfDPPCtrl11->AddFrame(lbTrapScale, haha);
numTrapScale = new TGNumberEntry(vfDPPCtrl12, 14, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative ); vfDPPCtrl12->AddFrame(numTrapScale);
numTrapScale->Resize(width, 20);
TGComboBox * cbDecimation = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDecimation);
TGLabel * lbDecimation = new TGLabel(vfDPPCtrl11, "Decimation :"); vfDPPCtrl11->AddFrame(lbDecimation, haha);
cbDecimation = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDecimation);
cbDecimation->AddEntry("Disable", 0);
cbDecimation->AddEntry("2 samples", 1);
cbDecimation->AddEntry("4 samples", 2);
cbDecimation->AddEntry("8 samples", 3);
cbDecimation->Resize(width, 20);
cbDecimation->Select(0);
cbDecimation->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
TGComboBox * cbDecimationGain = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDecimationGain);
TGLabel * lbDecimationGain = new TGLabel(vfDPPCtrl11, "Decimation Gain :"); vfDPPCtrl11->AddFrame(lbDecimationGain, haha);
cbDecimationGain = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDecimationGain);
cbDecimationGain->AddEntry("x 1", 0);
cbDecimationGain->AddEntry("x 2", 1);
cbDecimationGain->AddEntry("x 4", 2);
cbDecimationGain->AddEntry("x 8", 3);
cbDecimationGain->Resize(width, 20);
cbDecimationGain->Select(0);
cbDecimationGain->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
TGComboBox * cbRollOver = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbRollOver);
TGLabel * lbRollOver = new TGLabel(vfDPPCtrl11, "Roll-Over Flag :"); vfDPPCtrl11->AddFrame(lbRollOver, haha);
cbRollOver = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbRollOver);
cbRollOver->AddEntry("Disabled", 0);
cbRollOver->AddEntry("Enabled", 1);
cbRollOver->Resize(width, 20);
cbRollOver->Select(0);
cbRollOver->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
TGComboBox * cbPileUp = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbPileUp);
TGLabel * lbPileUp = new TGLabel(vfDPPCtrl11, "Pile-Up Flag :"); vfDPPCtrl11->AddFrame(lbPileUp, haha);
cbPileUp = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbPileUp);
cbPileUp->AddEntry("Disabled", 0);
cbPileUp->AddEntry("Enabled", 1);
cbPileUp->Resize(width, 20);
cbPileUp->Select(0);
cbPileUp->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
TGLabel * lbBaselineOptimize = new TGLabel(vfDPPCtrl11, "Baseline Optimaization :"); vfDPPCtrl11->AddFrame(lbBaselineOptimize, haha);
TGComboBox * cbLocalShapedTrigger = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbLocalShapedTrigger);
TGVerticalFrame * vfDPPCtrl21 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl21, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
TGVerticalFrame * vfDPPCtrl22 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl22, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
TGLabel * lbLocalShapedTrigger = new TGLabel(vfDPPCtrl21, "Local Shaped Trigger :"); vfDPPCtrl21->AddFrame(lbLocalShapedTrigger, haha);
cbLocalShapedTrigger = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbLocalShapedTrigger);
cbLocalShapedTrigger->AddEntry("Disabled", -1);
cbLocalShapedTrigger->AddEntry("AND", 0);
cbLocalShapedTrigger->AddEntry("Even Channel", 1);
cbLocalShapedTrigger->AddEntry("Odd Channel", 2);
cbLocalShapedTrigger->AddEntry("OR", 3);
cbLocalShapedTrigger->Resize(width, 20);
cbLocalShapedTrigger->Select(0);
cbLocalShapedTrigger->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGVerticalFrame * vfDPPCtrl21 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl21, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
TGLabel * lbLocalShapedTrigger = new TGLabel(vfDPPCtrl21, "Local Shaped Trigger :"); vfDPPCtrl21->AddFrame(lbLocalShapedTrigger, haha);
TGLabel * lbLocalTriggerValid = new TGLabel(vfDPPCtrl21, "Local Trigger Valid. :"); vfDPPCtrl21->AddFrame(lbLocalTriggerValid, haha);
TGLabel * lbVetoSource = new TGLabel(vfDPPCtrl21, "Veto Source :"); vfDPPCtrl21->AddFrame(lbVetoSource, haha);
TGLabel * lbTriggerCounterRate = new TGLabel(vfDPPCtrl21, "Trigger Counter Rate :"); vfDPPCtrl21->AddFrame(lbTriggerCounterRate, haha);
TGLabel * lbBaselineCal = new TGLabel(vfDPPCtrl21, "Active Baseline Cal. :"); vfDPPCtrl21->AddFrame(lbBaselineCal, haha);
TGLabel * lbTagCorrelatedEvent = new TGLabel(vfDPPCtrl21, "Tag correlated events :"); vfDPPCtrl21->AddFrame(lbTagCorrelatedEvent, haha);
TGVerticalFrame * vfDPPCtrl22 = new TGVerticalFrame(hfDPPCtrl1); hfDPPCtrl1->AddFrame(vfDPPCtrl22, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
TGComboBox * cbLocalTriggerValid = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbLocalTriggerValid);
cbLocalTriggerValid = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbLocalTriggerValid);
cbLocalTriggerValid->AddEntry("Disabled", -1);
cbLocalTriggerValid->AddEntry("crossed", 0);
cbLocalTriggerValid->AddEntry("val0 = val1 from mother-board mask", 1);
cbLocalTriggerValid->AddEntry("AND", 3);
cbLocalTriggerValid->AddEntry("OR", 4);
cbLocalTriggerValid->Resize(width, 20);
cbLocalTriggerValid->Select(0);
cbLocalTriggerValid->Resize(100, 20);
cbLocalTriggerValid->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGComboBox * cbVetoSource = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbVetoSource);
TGLabel * lbVetoSource = new TGLabel(vfDPPCtrl21, "Veto Source :"); vfDPPCtrl21->AddFrame(lbVetoSource, haha);
cbVetoSource = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbVetoSource);
cbVetoSource->AddEntry("Disabled", 0);
cbVetoSource->AddEntry("common to all channels", 1);
cbVetoSource->AddEntry("individually set for paired channel", 2);
cbVetoSource->AddEntry("negative saturation", 3);
cbVetoSource->Resize(width, 20);
cbVetoSource->Select(0);
cbVetoSource->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGComboBox * cbTriggerCounterRate = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbTriggerCounterRate);
TGLabel * lbTriggerCounterRate = new TGLabel(vfDPPCtrl21, "Trigger Counter Rate :"); vfDPPCtrl21->AddFrame(lbTriggerCounterRate, haha);
cbTriggerCounterRate = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbTriggerCounterRate);
cbTriggerCounterRate->AddEntry("1024", 0);
cbTriggerCounterRate->AddEntry(" 128", 1);
cbTriggerCounterRate->AddEntry("8192", 2);
cbTriggerCounterRate->Resize(width, 20);
cbTriggerCounterRate->Select(0);
cbTriggerCounterRate->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGComboBox * cbBaselineCal = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbBaselineCal);
TGLabel * lbBaselineCal = new TGLabel(vfDPPCtrl21, "Active Baseline Cal. :"); vfDPPCtrl21->AddFrame(lbBaselineCal, haha);
cbBaselineCal = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbBaselineCal);
cbBaselineCal->AddEntry("Enabled", 0);
cbBaselineCal->AddEntry("Disabled", 1);
cbBaselineCal->Resize(width, 20);
cbBaselineCal->Select(0);
cbBaselineCal->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGComboBox * cbTagCorrelatedEvent = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbTagCorrelatedEvent);
TGLabel * lbTagCorrelatedEvent = new TGLabel(vfDPPCtrl21, "Tag correlated events :"); vfDPPCtrl21->AddFrame(lbTagCorrelatedEvent, haha);
cbTagCorrelatedEvent = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbTagCorrelatedEvent);
cbTagCorrelatedEvent->AddEntry("Disabled", 0);
cbTagCorrelatedEvent->AddEntry("Enabled", 1);
cbTagCorrelatedEvent->Resize(width, 20);
cbTagCorrelatedEvent->Select(0);
cbTagCorrelatedEvent->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGComboBox * cbBaselineOptimize = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbBaselineOptimize);
TGLabel * lbBaselineOptimize = new TGLabel(vfDPPCtrl11, "Baseline Optimaization :"); vfDPPCtrl11->AddFrame(lbBaselineOptimize, haha);
cbBaselineOptimize = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbBaselineOptimize);
cbBaselineOptimize->AddEntry("Disabled", 0);
cbBaselineOptimize->AddEntry("Enabled", 1);
cbBaselineOptimize->Resize(width, 20);
cbBaselineOptimize->Select(0);
cbBaselineOptimize->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
TGHorizontalFrame * hfDPPCtrl2 = new TGHorizontalFrame(vfDPPCtrl); vfDPPCtrl->AddFrame(hfDPPCtrl2, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 0));
@ -354,58 +359,23 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
TGLabel * lbDisableSelfTrigger = new TGLabel(vfDPPCtrl_a, "Self Trigger :"); vfDPPCtrl_a->AddFrame(lbDisableSelfTrigger, haha);
TGComboBox * cbDisableSelfTrigger = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbDisableSelfTrigger);
cbDisableSelfTrigger = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbDisableSelfTrigger);
cbDisableSelfTrigger->AddEntry("used to acquire and propagate to trigger logic", 0);
cbDisableSelfTrigger->AddEntry("only propagate to trigger logic", 1);
cbDisableSelfTrigger->Resize(300, 20);
cbDisableSelfTrigger->Select(0);
cbLocalShapedTrigger->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm1()");
TGLabel * lbExtra2WordOption = new TGLabel(vfDPPCtrl_a, "Extras 2 Word Option :"); vfDPPCtrl_a->AddFrame(lbExtra2WordOption, haha);
TGComboBox * cbExtra2WordOption = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbExtra2WordOption);
cbExtra2WordOption = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbExtra2WordOption);
cbExtra2WordOption->AddEntry("[31:16] Extended Time Stamp [15:0] Baseline * 4", 0);
cbExtra2WordOption->AddEntry("[31:16] Extended Time Stamp [15:0] Fine Time Stamp", 2);
cbExtra2WordOption->AddEntry("[31:16] Lost Trigger Counter [15:0] Total Trigger Counter", 4);
cbExtra2WordOption->AddEntry("[31:16] Event Before Zero Crossing [15:0] Event After Zero Crossing", 5);
cbExtra2WordOption->Resize(400, 20);
cbExtra2WordOption->Select(0);
cbLocalShapedTrigger->Connect("Changed()", "ChannelSetting", this, "SetDPPAlgorithm2()");
}
/*
///----- all other
TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING];
TGLabel * lb[NUM_CHANNEL_SETTING];
for( int i = 0 ; i < NUM_CHANNEL_SETTING; i++){
hframe[i] = new TGHorizontalFrame(vframe, 50, 50 );
vframe->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2));
double temp = 0; // pixie->GetChannelSetting(settingName[i][0].Data(), boardID, ch, false);
TGNumberFormat::EStyle digi = TGNumberFormat::kNESInteger;
if( settingName[i][1] == "0" ) digi = TGNumberFormat::kNESInteger;
if( settingName[i][1] == "1" ) digi = TGNumberFormat::kNESRealOne;
if( settingName[i][1] == "2" ) digi = TGNumberFormat::kNESRealTwo;
if( settingName[i][1] == "3" ) digi = TGNumberFormat::kNESRealThree;
entry[i] = new TGNumberEntry(hframe[i], temp, 0, 0, digi, TGNumberFormat::kNEANonNegative);
entry[i]->Resize(width, 20);
if( i >= NUM_CHANNEL_SETTING - 3 ) {
entry[i]->SetState(false);
}else{
entry[i]->Connect("Modified()", "ChannelSetting", this, Form("ChangeID(=%d)", i));
}
hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4));
lb[i] = new TGLabel(hframe[i], settingName[i][0] + (settingName[i][2] != "" ? " [" + settingName[i][2] + "]" : ""));
hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4));
}
*/
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
@ -414,6 +384,8 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
}
ChannelSetting::~ChannelSetting(){
printf("close ChannelSetting window\n");
isOpened = false;
delete boardIDEntry;
@ -427,41 +399,297 @@ ChannelSetting::~ChannelSetting(){
delete fMain;
}
void ChannelSetting::LogMsg(TString msg){
Emit("LogMsg(TString)", msg);
}
void ChannelSetting::ChangeBoard(){
ChangeCh();
}
void ChannelSetting::ChangeCh(){
LogMsg(Form("Change to Channel %d",chIDEntry->GetNumber()) );
if ( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
int ch = chIDEntry->GetNumber();
//pixie->GetChannelOnOff(boardID, ch) ? cbOnOff->Select(1) : cbOnOff->Select(0);
//pixie->GetChannelPolarity(boardID, ch) ? cbPolarity->Select(1) : cbPolarity->Select(0);
//pixie->GetChannelTraceOnOff(boardID, ch) ? cbTraceOnOff->Select(1) : cbTraceOnOff->Select(0);
if( ch < 0 ) {
printf("All channels mode.\n");
return;
}
float ch2ns = digi[boardID]->GetCh2ns();
//TODO SetNumber need to change bit to unit
cbOnOff->Select( (digi[boardID]->GetChannelMask() >> ch) & 0x1, false); /// don't emit signal
cbInputDynamicRange->Select( digi[boardID]->ReadRegister(Register::DPP::InputDynamicRange, ch), false);
numRecordLength->SetNumber( digi[boardID]->ReadRegister(Register::DPP::RecordLength_G, ch) * 8 * ch2ns, false);
numPreTrigger->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PreTrigger, ch) * 4 * ch2ns, false);
numEventAgg->SetNumber( digi[boardID]->ReadRegister(Register::DPP::NumberEventsPerAggregate_G, ch), false);
uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::ChannelDCOffset, ch);
numDCOffset->SetNumber( 1.0 - temp * 1.0/0xFFFF , false);
eTemp->SetText(Form("%d C", digi[boardID]->ReadRegister(Register::DPP::ChannelADCTemperature, ch)), false);
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){
numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false);
numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false);
cbTriggerSmoothing ->Select( digi[boardID]->ReadRegister(Register::DPP::PHA::RCCR2SmoothingFactor, ch), false);
numInputRiseTime ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::InputRiseTime, ch) * 4 * ch2ns, false);
numRiseTimeValidWin->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::RiseTimeValidationWindow, ch) * ch2ns, false);
numTrapRiseTime->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, ch) * 4 * ch2ns, false);
numTrapFlatTop->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, ch) * 4 * ch2ns, false);
numDecay->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::DecayTime, ch) * 4 * ch2ns, false);
numPeaking->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::PeakingTime, ch) * 4 * ch2ns, false);
numPeakHoldOff->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::PeakHoldOff, ch) * 4 * ch2ns, false);
temp = digi[boardID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch);
numTrapScale->SetNumber( temp & 0x3F, false );
cbDecimation->Select( ( (temp >> 8) & 0x3), false);
cbDecimationGain->Select( ( (temp >> 10) & 0x3), false);
cbPeakMean->Select( ( (temp >> 12) & 0x3), false);
cbPolarity->Select( ( (temp >> 16) & 0x1), false);
cbTriggerMode->Select( ( (temp >> 18) & 0x3), false);
cbBaseLineAvg->Select( ( (temp >> 20) & 0x7), false);
cbDisableSelfTrigger->Select( ( (temp >> 24) & 0x1), false);
cbRollOver->Select( ( (temp >> 26) & 0x1), false);
cbPileUp->Select( ( (temp >> 27) & 0x1), false);
temp = digi[boardID]->ReadRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, ch);
if( (((temp >> 2)) & 0x1 ) == 1 ){
cbLocalShapedTrigger->Select( ( (temp >> 0) & 0x3), false);
}else{
cbLocalShapedTrigger->Select( -1, false);
}
if( (((temp >> 6)) & 0x1 ) == 1 ){
cbLocalTriggerValid->Select( ( (temp >> 4) & 0x3), false);
}else{
cbLocalTriggerValid->Select( -1, false);
}
cbVetoSource->Select( ( (temp >> 14) & 0x3), false);
cbTriggerCounterRate->Select( ( (temp >> 16) & 0x3), false);
cbBaselineCal->Select( ( (temp >> 18) & 0x1), false);
cbTagCorrelatedEvent->Select( ( (temp >> 19) & 0x1), false);
cbBaselineOptimize->Select( ( (temp >> 29) & 0x1), false);
cbExtra2WordOption->Select( ( (temp >> 8) & 0x7), false);
}
}
void ChannelSetting::ChangeOnOff(){
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
int val = cbOnOff->GetSelected();
//pixie->SetChannelOnOff(val, boardID, ch);
//pixie->SaveSettings(pixie->GetSettingFile(boardIDEntry->GetNumber()));
}
void ChannelSetting::ChangePolarity(){
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
int val = cbPolarity->GetSelected();
printf("------------- testing from BoardSetting\n");
void ChannelSetting::SetAllChannels(){
printf("=================== SetAllChannels()\n");
//pixie->SetChannelPositivePolarity(val, boardID, ch);
//pixie->SaveSettings(pixie->GetSettingFile(boardIDEntry->GetNumber()));
}
if ( digi == NULL ) return;
void ChannelSetting::ChangeID(int id){
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
//pixie->SetChannelSetting(settingName[id][0].Data(), val, boardID, ch, 1);
//pixie->SaveSettings(pixie->GetSettingFile(boardIDEntry->GetNumber()));
uint32_t bit = 0;
bit += numTrapScale->GetNumber();
bit += ((cbDecimation->GetSelected() << 8) & 0x3);
bit += ((cbDecimationGain->GetSelected() << 10) & 0x3);
bit += ((cbPeakMean->GetSelected() << 12) & 0x3);
bit += ((cbPolarity->GetSelected() << 16) & 0x3);
bit += ((cbTriggerMode->GetSelected() << 18) & 0x3);
bit += ((cbBaseLineAvg->GetSelected() << 20) & 0x7);
bit += ((cbDisableSelfTrigger->GetSelected() << 24) & 0x1);
bit += ((cbRollOver->GetSelected() << 26) & 0x1);
bit += ((cbPileUp->GetSelected() << 27) & 0x1);
printf(" DPP1 bit: 0x%x\n", bit);
digi[boardID]->WriteRegister(Register::DPP::DPPAlgorithmControl, bit, -1);
if( cbLocalShapedTrigger->GetSelected() >= 0 ){
bit += cbLocalShapedTrigger->GetSelected();
bit += ( 1 << 2);
}
if( cbLocalTriggerValid->GetSelected() >= 0 ){
bit += ((cbLocalTriggerValid->GetSelected() << 4) & 0x3);
bit += ( 1 << 6);
}
bit += ((cbExtra2WordOption->GetSelected() << 8 ) & 0x7);
bit += ((cbVetoSource->GetSelected() << 14 ) & 0x3);
bit += ((cbTriggerCounterRate->GetSelected() << 16 ) & 0x3);
bit += ((cbBaselineCal->GetSelected() << 18 ) & 0x1);
bit += ((cbTagCorrelatedEvent->GetSelected() << 19 ) & 0x1);
bit += ((cbBaselineOptimize->GetSelected() << 29 ) & 0x1);
printf(" DPP2 bit: 0x%x\n", bit);
digi[boardID]->WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, -1);
}
void ChannelSetting::SetChannelMask(){
printf("=================== SetChannelMask()\n");
if ( digi == NULL ) return;
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
unsigned short val = cbOnOff->GetSelected();
uint32_t chMask = ((digi[boardID]->GetChannelMask()) & ( val << ch) );
printf("mask : 0x%x \n", chMask);
digi[boardID]->SetChannelMask(chMask);
}
void ChannelSetting::SetDPPAlgorithm1(){
printf("=================== SetDPPAlgorithm1()\n");
if ( digi == NULL ) return;
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
unsigned short ch2ns = digi[boardID]->GetCh2ns();
digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), -1);
unsigned short temp = ((unsigned short)(numRecordLength->GetNumber())) / 8 / ch2ns;
digi[boardID]->WriteRegister(Register::DPP::RecordLength_G, temp , ch);
uint32_t bit = 0;
bit += numTrapScale->GetNumber();
bit += ((cbDecimation->GetSelected() << 8) & 0x3);
bit += ((cbDecimationGain->GetSelected() << 10) & 0x3);
bit += ((cbPeakMean->GetSelected() << 12) & 0x3);
bit += ((cbPolarity->GetSelected() << 16) & 0x3);
bit += ((cbTriggerMode->GetSelected() << 18) & 0x3);
bit += ((cbBaseLineAvg->GetSelected() << 20) & 0x7);
bit += ((cbDisableSelfTrigger->GetSelected() << 24) & 0x1);
bit += ((cbRollOver->GetSelected() << 26) & 0x1);
bit += ((cbPileUp->GetSelected() << 27) & 0x1);
printf(" DPP1 bit: 0x%x\n", bit);
digi[boardID]->WriteRegister(Register::DPP::DPPAlgorithmControl, bit, ch);
}
void ChannelSetting::SetDPPAlgorithm2(){
printf("=================== SetDPPAlgorithm2()\n");
if ( digi == NULL ) return;
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
uint32_t bit = 0;
if( cbLocalShapedTrigger->GetSelected() >= 0 ){
bit += cbLocalShapedTrigger->GetSelected();
bit += ( 1 << 2);
}
if( cbLocalTriggerValid->GetSelected() >= 0 ){
bit += ((cbLocalTriggerValid->GetSelected() << 4) & 0x3);
bit += ( 1 << 6);
}
bit += ((cbExtra2WordOption->GetSelected() << 8 ) & 0x7);
bit += ((cbVetoSource->GetSelected() << 14 ) & 0x3);
bit += ((cbTriggerCounterRate->GetSelected() << 16 ) & 0x3);
bit += ((cbBaselineCal->GetSelected() << 18 ) & 0x1);
bit += ((cbTagCorrelatedEvent->GetSelected() << 19 ) & 0x1);
bit += ((cbBaselineOptimize->GetSelected() << 29 ) & 0x1);
printf(" DPP2 bit: 0x%x\n", bit);
digi[boardID]->WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, ch);
}
void ChannelSetting::SetInputDynamicRange(){
printf("=================== SetInputDynamicRange()\n");
if ( digi == NULL ) return;
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), ch);
}
void ChannelSetting::SetRecordLength(){
printf("=================== SetRecordLength()\n");
if ( digi == NULL ) return;
short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber();
unsigned short ch2ns = digi[boardID]->GetCh2ns();
unsigned short temp = ((unsigned short)(numRecordLength->GetNumber())) / 8 / ch2ns;
numRecordLength->SetNumber(temp * 8 * ch2ns, false);
digi[boardID]->WriteRegister(Register::DPP::RecordLength_G, temp , ch);
}
void ChannelSetting::SetPreTrigger(){
printf("=================== SetPreTrigger()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetEventAggregate(){
printf("=================== SetEventAggregate()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetTriggerThreshold(){
printf("=================== SetTriggerThreshold()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetTriggerHoldOff(){
printf("=================== SetTriggerHoldOff()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetDCOffset(){
printf("=================== SetDCOffset()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetTriggerSmoothing(){
printf("=================== SetTriggerSmoothing()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetInputRiseTime(){
printf("=================== SetInputRiseTime()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetRiseTimeValidWin(){
printf("=================== SetRiseTimeValidWin()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetTrapRiseTime(){
printf("=================== SetTrapRiseTime()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetTrapFlatTop(){
printf("=================== SetTrapFlatTop()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetDecay(){
printf("=================== SetDecay()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetPeaking(){
printf("=================== SetPeaking()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetPeakHoldOff(){
printf("=================== SetPeakHoldOff()\n");
if ( digi == NULL ) return;
}

View File

@ -2,6 +2,7 @@
#define CHANNEL_SETTING_H
#include <TQObject.h>
#include <RQ_OBJECT.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include <TGComboBox.h>
@ -13,28 +14,96 @@ class TGWindow;
class TGMainFrame;
class ChannelSetting{
RQ_OBJECT("ChannelSetting")
private:
TGMainFrame * fMain;
TGNumberEntry * boardIDEntry, * chIDEntry;
TGTextEntry * eTemp ;
TGComboBox * cbOnOff;
TGComboBox * cbPolarity;
TGComboBox * cbInputDynamicRange;
TGNumberEntry * numRecordLength;
TGNumberEntry * numPreTrigger;
TGNumberEntry * numEventAgg;
TGNumberEntry * numTriggerThreshold;
TGNumberEntry * numTriggerHoldOff;
TGNumberEntry * numDCOffset;
TGComboBox * cbTriggerSmoothing;
TGNumberEntry * numInputRiseTime;
TGNumberEntry * numRiseTimeValidWin;
TGComboBox * cbTriggerMode;
TGNumberEntry * numTrapRiseTime;
TGNumberEntry * numTrapFlatTop;
TGNumberEntry * numDecay;
TGNumberEntry * numPeaking;
TGNumberEntry * numPeakHoldOff;
TGComboBox * cbPeakMean;
TGComboBox * cbBaseLineAvg;
TGNumberEntry * numTrapScale;
TGComboBox * cbDecimation;
TGComboBox * cbDecimationGain;
TGComboBox * cbRollOver;
TGComboBox * cbPileUp;
TGComboBox * cbLocalShapedTrigger;
TGComboBox * cbLocalTriggerValid;
TGComboBox * cbVetoSource;
TGComboBox * cbTriggerCounterRate;
TGComboBox * cbBaselineCal;
TGComboBox * cbTagCorrelatedEvent;
TGComboBox * cbBaselineOptimize;
TGComboBox * cbDisableSelfTrigger;
TGComboBox * cbExtra2WordOption;
Digitizer ** digi;
int NChannel;
bool isOpened;
public:
ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi);
virtual ~ChannelSetting();
void CloseWindow() { printf("close ChannelSetting window\n"); delete this; }
void CloseWindow() { delete this; }
bool IsOpen() {return isOpened;}
void ChangeBoard();
void ChangeCh();
void ChangeOnOff();
void ChangePolarity();
void ChangeID(int id);
bool isOpened;
void ChangeCh(); /// also get all settings
void SetAllChannels();
void SetChannelMask();
void SetDPPAlgorithm1();
void SetDPPAlgorithm2();
void SetInputDynamicRange();
void SetRecordLength();
void SetPreTrigger();
void SetEventAggregate();
void SetTriggerThreshold();
void SetTriggerHoldOff();
void SetDCOffset();
void SetTriggerSmoothing();
void SetInputRiseTime();
void SetRiseTimeValidWin();
void SetTrapRiseTime();
void SetTrapFlatTop();
void SetDecay();
void SetPeaking();
void SetPeakHoldOff();
void LogMsg(TString); // *SIGNAL*
};
#endif