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
case M_CH_SETTING:
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;
@ -236,11 +236,11 @@ void MainWindow::HandleMenu(Int_t id){
case M_BOARD_SETTINGS:{
if( boardSetting == NULL ) {
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{
if ( boardSetting->IsOpen() == false ){
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;

View File

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

View File

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

View File

@ -170,7 +170,7 @@ class BoardSetting{
///==== Readout Control
void SetReadOutControl();
void LogMsg(TString msg); // *SIGNAL*
void BdLogMsg(TString); // *SIGNAL*
};
#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->AddEntry("2.0 Vpp", 0);
cbInputDynamicRange->AddEntry("0.5 Vpp", 1);
cbInputDynamicRange->Resize(width, 20);
cbInputDynamicRange->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "SetInputDynamicRange()");
///---------- Record Length
@ -380,6 +381,8 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
ch2ns = 4;
isOpened = true;
}
ChannelSetting::~ChannelSetting(){
@ -400,18 +403,22 @@ ChannelSetting::~ChannelSetting(){
}
void ChannelSetting::LogMsg(TString msg){
Emit("LogMsg(TString)", msg);
void ChannelSetting::ChLogMsg(TString msg){
Emit("ChLogMsg(TString)", msg);
}
void ChannelSetting::ChangeBoard(){
if ( digi == NULL ) return;
int boardID = boardIDEntry->GetNumber();
ch2ns = (unsigned short) digi[boardID]->GetCh2ns();
ChangeCh();
}
void ChannelSetting::ChangeCh(){
LogMsg(Form("Change to Channel %d",chIDEntry->GetNumber()) );
ChLogMsg("dsadasdsa");
if ( digi == NULL ) return;
@ -423,9 +430,6 @@ void ChannelSetting::ChangeCh(){
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);
@ -613,25 +617,27 @@ void ChannelSetting::SetInputDynamicRange(){
digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), ch);
}
void ChannelSetting::SetRecordLength(){
printf("=================== SetRecordLength()\n");
if ( digi == NULL ) return;
void ChannelSetting::ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address){
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 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;
numRecordLength->SetNumber(temp * 8 * ch2ns, false);
digi[boardID]->WriteRegister(Register::DPP::RecordLength_G, temp , ch);
void ChannelSetting::SetRecordLength(){
printf("=================== SetRecordLength()\n");
ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G);
}
void ChannelSetting::SetPreTrigger(){
printf("=================== SetPreTrigger()\n");
if ( digi == NULL ) return;
ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger);
}
void ChannelSetting::SetEventAggregate(){
@ -641,12 +647,12 @@ void ChannelSetting::SetEventAggregate(){
void ChannelSetting::SetTriggerThreshold(){
printf("=================== SetTriggerThreshold()\n");
if ( digi == NULL ) return;
}
void ChannelSetting::SetTriggerHoldOff(){
printf("=================== SetTriggerHoldOff()\n");
if ( digi == NULL ) return;
ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PHA::TriggerHoldOffWidth);
}
void ChannelSetting::SetDCOffset(){
@ -661,35 +667,35 @@ void ChannelSetting::SetTriggerSmoothing(){
void ChannelSetting::SetInputRiseTime(){
printf("=================== SetInputRiseTime()\n");
if ( digi == NULL ) return;
ChangeAStep(numInputRiseTime, 4, Register::DPP::PHA::InputRiseTime);
}
void ChannelSetting::SetRiseTimeValidWin(){
printf("=================== SetRiseTimeValidWin()\n");
if ( digi == NULL ) return;
ChangeAStep(numRiseTimeValidWin, 1, Register::DPP::PHA::RiseTimeValidationWindow);
}
void ChannelSetting::SetTrapRiseTime(){
printf("=================== SetTrapRiseTime()\n");
if ( digi == NULL ) return;
ChangeAStep(numTrapRiseTime, 4, Register::DPP::PHA::TrapezoidRiseTime);
}
void ChannelSetting::SetTrapFlatTop(){
printf("=================== SetTrapFlatTop()\n");
if ( digi == NULL ) return;
ChangeAStep(numTrapFlatTop, 4, Register::DPP::PHA::TrapezoidFlatTop);
}
void ChannelSetting::SetDecay(){
printf("=================== SetDecay()\n");
if ( digi == NULL ) return;
ChangeAStep(numDecay, 4, Register::DPP::PHA::DecayTime);
}
void ChannelSetting::SetPeaking(){
printf("=================== SetPeaking()\n");
if ( digi == NULL ) return;
ChangeAStep(numPeaking, 4, Register::DPP::PHA::PeakingTime);
}
void ChannelSetting::SetPeakHoldOff(){
printf("=================== SetPeakHoldOff()\n");
if ( digi == NULL ) return;
ChangeAStep(numPeakHoldOff, 4, Register::DPP::PHA::PeakHoldOff);
}

View File

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