stage the change in test branch

This commit is contained in:
carina@hades 2022-09-22 17:53:29 -04:00
parent 671b3ba0b8
commit ece4b26d97
6 changed files with 47 additions and 33 deletions

View File

@ -228,7 +228,7 @@ void MainWindow::HandleMenu(Int_t id){
///========================= Channel setting ///========================= Channel setting
case M_CH_SETTING: case M_CH_SETTING:
channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, digi, nDigi); channelSetting = new ChannelSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
channelSetting->Connect("LogMsg(TString)", "MainWindow", this, "LogMsg(TString)"); channelSetting->Connect("ChLogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
break; break;
@ -236,11 +236,11 @@ void MainWindow::HandleMenu(Int_t id){
case M_BOARD_SETTINGS:{ case M_BOARD_SETTINGS:{
if( boardSetting == NULL ) { if( boardSetting == NULL ) {
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
boardSetting->Connect("LogMsg(TString)", "MainWindow", this, "LogMsg(TString)"); boardSetting->Connect("BdLogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
}else{ }else{
if ( boardSetting->IsOpen() == false ){ if ( boardSetting->IsOpen() == false ){
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
boardSetting->Connect("LogMsg(TString)", "MainWindow", this, "LogMsg(TString)"); boardSetting->Connect("BdLogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
} }
} }
}break; }break;

View File

@ -89,6 +89,6 @@ public:
//void ChangeMod(); //void ChangeMod();
//void ChangeChannel(); //void ChangeChannel();
void LogMsg(TString msg); void LogMsg(TString);
void GoodBye(); void GoodBye();
}; };

View File

@ -724,6 +724,10 @@ BoardSetting::~BoardSetting(){
} }
void BoardSetting::BdLogMsg(TString msg){
Emit("BdLogMsg(TString)", msg);
}
void * BoardSetting::ReadStatus(void * ptr){ void * BoardSetting::ReadStatus(void * ptr){
if( digi == NULL ) return 0; if( digi == NULL ) return 0;

View File

@ -170,7 +170,7 @@ class BoardSetting{
///==== Readout Control ///==== Readout Control
void SetReadOutControl(); void SetReadOutControl();
void LogMsg(TString msg); // *SIGNAL* void BdLogMsg(TString); // *SIGNAL*
}; };
#endif #endif

View File

@ -93,6 +93,7 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
cbInputDynamicRange = new TGComboBox(vfInput2); vfInput2->AddFrame(cbInputDynamicRange, layoutHints); cbInputDynamicRange = new TGComboBox(vfInput2); vfInput2->AddFrame(cbInputDynamicRange, layoutHints);
cbInputDynamicRange->AddEntry("2.0 Vpp", 0); cbInputDynamicRange->AddEntry("2.0 Vpp", 0);
cbInputDynamicRange->AddEntry("0.5 Vpp", 1); cbInputDynamicRange->AddEntry("0.5 Vpp", 1);
cbInputDynamicRange->Resize(width, 20);
cbInputDynamicRange->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetInputDynamicRange()"); cbInputDynamicRange->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetInputDynamicRange()");
///---------- Record Length ///---------- Record Length
@ -380,6 +381,8 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
fMain->Resize(fMain->GetDefaultSize()); fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow(); fMain->MapWindow();
ch2ns = 4;
isOpened = true; isOpened = true;
} }
ChannelSetting::~ChannelSetting(){ ChannelSetting::~ChannelSetting(){
@ -400,18 +403,22 @@ ChannelSetting::~ChannelSetting(){
} }
void ChannelSetting::ChLogMsg(TString msg){
void ChannelSetting::LogMsg(TString msg){ Emit("ChLogMsg(TString)", msg);
Emit("LogMsg(TString)", msg);
} }
void ChannelSetting::ChangeBoard(){ void ChannelSetting::ChangeBoard(){
if ( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
ch2ns = (unsigned short) digi[boardID]->GetCh2ns();
ChangeCh(); ChangeCh();
} }
void ChannelSetting::ChangeCh(){ void ChannelSetting::ChangeCh(){
LogMsg(Form("Change to Channel %d",chIDEntry->GetNumber()) ); ChLogMsg("dsadasdsa");
if ( digi == NULL ) return; if ( digi == NULL ) return;
@ -422,10 +429,7 @@ void ChannelSetting::ChangeCh(){
printf("All channels mode.\n"); printf("All channels mode.\n");
return; 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 cbOnOff->Select( (digi[boardID]->GetChannelMask() >> ch) & 0x1, false); /// don't emit signal
cbInputDynamicRange->Select( digi[boardID]->ReadRegister(Register::DPP::InputDynamicRange, ch), false); cbInputDynamicRange->Select( digi[boardID]->ReadRegister(Register::DPP::InputDynamicRange, ch), false);
numRecordLength->SetNumber( digi[boardID]->ReadRegister(Register::DPP::RecordLength_G, ch) * 8 * ch2ns, false); numRecordLength->SetNumber( digi[boardID]->ReadRegister(Register::DPP::RecordLength_G, ch) * 8 * ch2ns, false);
@ -613,25 +617,27 @@ void ChannelSetting::SetInputDynamicRange(){
digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), ch); digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), ch);
} }
void ChannelSetting::SetRecordLength(){ void ChannelSetting::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address){
printf("=================== SetRecordLength()\n");
if ( digi == NULL ) return; unsigned int temp = numEntry->GetNumber();
unsigned int res = temp % (stepSize * ch2ns);
temp = temp - res + ( ( res < (stepSize * ch2ns/2) ) ? (stepSize * ch2ns ) : 0 );
numEntry->SetNumber(temp, false);
short boardID = boardIDEntry->GetNumber(); short boardID = boardIDEntry->GetNumber();
short ch = chIDEntry->GetNumber(); short ch = chIDEntry->GetNumber();
unsigned short ch2ns = digi[boardID]->GetCh2ns(); if( digi != NULL ) digi[boardID]->WriteRegister(address, temp / stepSize / ch2ns , ch);
}
unsigned short temp = ((unsigned short)(numRecordLength->GetNumber())) / 8 / ch2ns;
void ChannelSetting::SetRecordLength(){
numRecordLength->SetNumber(temp * 8 * ch2ns, false); printf("=================== SetRecordLength()\n");
ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G);
digi[boardID]->WriteRegister(Register::DPP::RecordLength_G, temp , ch);
} }
void ChannelSetting::SetPreTrigger(){ void ChannelSetting::SetPreTrigger(){
printf("=================== SetPreTrigger()\n"); printf("=================== SetPreTrigger()\n");
if ( digi == NULL ) return; ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger);
} }
void ChannelSetting::SetEventAggregate(){ void ChannelSetting::SetEventAggregate(){
@ -641,12 +647,12 @@ void ChannelSetting::SetEventAggregate(){
void ChannelSetting::SetTriggerThreshold(){ void ChannelSetting::SetTriggerThreshold(){
printf("=================== SetTriggerThreshold()\n"); printf("=================== SetTriggerThreshold()\n");
if ( digi == NULL ) return;
} }
void ChannelSetting::SetTriggerHoldOff(){ void ChannelSetting::SetTriggerHoldOff(){
printf("=================== SetTriggerHoldOff()\n"); printf("=================== SetTriggerHoldOff()\n");
if ( digi == NULL ) return; ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PHA::TriggerHoldOffWidth);
} }
void ChannelSetting::SetDCOffset(){ void ChannelSetting::SetDCOffset(){
@ -661,35 +667,35 @@ void ChannelSetting::SetTriggerSmoothing(){
void ChannelSetting::SetInputRiseTime(){ void ChannelSetting::SetInputRiseTime(){
printf("=================== SetInputRiseTime()\n"); printf("=================== SetInputRiseTime()\n");
if ( digi == NULL ) return; ChangeAStep(numInputRiseTime, 4, Register::DPP::PHA::InputRiseTime);
} }
void ChannelSetting::SetRiseTimeValidWin(){ void ChannelSetting::SetRiseTimeValidWin(){
printf("=================== SetRiseTimeValidWin()\n"); printf("=================== SetRiseTimeValidWin()\n");
if ( digi == NULL ) return; ChangeAStep(numRiseTimeValidWin, 1, Register::DPP::PHA::RiseTimeValidationWindow);
} }
void ChannelSetting::SetTrapRiseTime(){ void ChannelSetting::SetTrapRiseTime(){
printf("=================== SetTrapRiseTime()\n"); printf("=================== SetTrapRiseTime()\n");
if ( digi == NULL ) return; ChangeAStep(numTrapRiseTime, 4, Register::DPP::PHA::TrapezoidRiseTime);
} }
void ChannelSetting::SetTrapFlatTop(){ void ChannelSetting::SetTrapFlatTop(){
printf("=================== SetTrapFlatTop()\n"); printf("=================== SetTrapFlatTop()\n");
if ( digi == NULL ) return; ChangeAStep(numTrapFlatTop, 4, Register::DPP::PHA::TrapezoidFlatTop);
} }
void ChannelSetting::SetDecay(){ void ChannelSetting::SetDecay(){
printf("=================== SetDecay()\n"); printf("=================== SetDecay()\n");
if ( digi == NULL ) return; ChangeAStep(numDecay, 4, Register::DPP::PHA::DecayTime);
} }
void ChannelSetting::SetPeaking(){ void ChannelSetting::SetPeaking(){
printf("=================== SetPeaking()\n"); printf("=================== SetPeaking()\n");
if ( digi == NULL ) return; ChangeAStep(numPeaking, 4, Register::DPP::PHA::PeakingTime);
} }
void ChannelSetting::SetPeakHoldOff(){ void ChannelSetting::SetPeakHoldOff(){
printf("=================== SetPeakHoldOff()\n"); printf("=================== SetPeakHoldOff()\n");
if ( digi == NULL ) return; ChangeAStep(numPeakHoldOff, 4, Register::DPP::PHA::PeakHoldOff);
} }

View File

@ -66,6 +66,10 @@ class ChannelSetting{
Digitizer ** digi; Digitizer ** digi;
int NChannel; int NChannel;
bool isOpened; bool isOpened;
unsigned short ch2ns;
void ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address);
public: public:
ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi); ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi);
@ -103,7 +107,7 @@ class ChannelSetting{
void SetPeaking(); void SetPeaking();
void SetPeakHoldOff(); void SetPeakHoldOff();
void LogMsg(TString); // *SIGNAL* void ChLogMsg(TString); // *SIGNAL*
}; };
#endif #endif