303 lines
16 KiB
C++
303 lines
16 KiB
C++
#include <TApplication.h>
|
|
#include <TGClient.h>
|
|
#include <TCanvas.h>
|
|
#include <TF1.h>
|
|
#include <TRandom.h>
|
|
#include <TGButton.h>
|
|
#include <TRootEmbeddedCanvas.h>
|
|
#include <TGTableContainer.h>
|
|
#include <TGFileDialog.h>
|
|
|
|
#include "channelSetting.h"
|
|
|
|
ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi){
|
|
|
|
this->digi = digi;
|
|
|
|
Pixel_t red, green;
|
|
gClient->GetColorByName("red", red);
|
|
gClient->GetColorByName("green", green);
|
|
|
|
fMain = new TGMainFrame(p,w,h);
|
|
fMain->SetWindowName("Channel Settings ");
|
|
fMain->Connect("CloseWindow()", "ChannelSetting", this, "CloseWindow()");
|
|
|
|
TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,3,3); /// left, right, top, bottom
|
|
TGLayoutHints * layoutHintsR = new TGLayoutHints(kLHintsRight, 5,5,6,5); /// left, right, top, bottom
|
|
|
|
TGVerticalFrame * vframe = new TGVerticalFrame(fMain);
|
|
fMain->AddFrame(vframe, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
|
|
|
|
TGHorizontalFrame *hframe0 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe0, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
|
|
|
|
///==========Board choose
|
|
TGLabel * lb0 = new TGLabel(hframe0, "Module ID :"); hframe0->AddFrame(lb0, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
|
boardIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe0->AddFrame(boardIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
|
boardIDEntry->SetWidth(50);
|
|
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi);
|
|
boardIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeBoard()");
|
|
if( nDigi <= 1 ) boardIDEntry->SetState(false);
|
|
|
|
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->SetWidth(50);
|
|
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, NChannel-1);
|
|
chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()");
|
|
hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
|
|
|
|
|
|
///const uint32_t ChannelADCTemperature = 0x10A8; /// R
|
|
TGLabel * lbTemp = new TGLabel(hframe0, "Temperature [C] :"); hframe0->AddFrame(lbTemp, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
|
TGTextEntry * eTemp = new TGTextEntry(hframe0, new TGTextBuffer(1)); hframe0->AddFrame(eTemp, new TGLayoutHints(kLHintsRight, 5,5,3,4));
|
|
eTemp->SetEnabled(false);
|
|
eTemp->SetText( "0" );
|
|
eTemp->Resize(50,20);
|
|
|
|
int boardID = boardIDEntry->GetNumber();
|
|
int ch = chIDEntry->GetNumber();
|
|
int width = 80;
|
|
|
|
|
|
TGHorizontalFrame *hframe1 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe1, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
|
|
|
|
///================== Input Setting
|
|
TGGroupFrame * gfInput = new TGGroupFrame(hframe1, "Input / Misc.", kHorizontalFrame); hframe1->AddFrame(gfInput, new TGLayoutHints(kLHintsExpandY));
|
|
TGHorizontalFrame * hfInput = new TGHorizontalFrame(gfInput); gfInput->AddFrame(hfInput);
|
|
|
|
TGVerticalFrame * vfInput1 = new TGVerticalFrame(hfInput); hfInput->AddFrame(vfInput1);
|
|
TGVerticalFrame * vfInput2 = new TGVerticalFrame(hfInput); hfInput->AddFrame(vfInput2);
|
|
|
|
///----------- on/off
|
|
TGLabel * lbOnOff = new TGLabel(vfInput1, "On/Off"); vfInput1->AddFrame(lbOnOff, layoutHintsR);
|
|
cbOnOff = new TGComboBox(vfInput2); vfInput2->AddFrame(cbOnOff, layoutHints);
|
|
cbOnOff->AddEntry("ON", 1);
|
|
cbOnOff->AddEntry("off", 0);
|
|
cbOnOff->Resize(width, 20);
|
|
//pixie->GetChannelOnOff(boardID, ch) ? cbOnOff->Select(1) : cbOnOff->Select(0);
|
|
cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "ChangeOnOff()");
|
|
|
|
|
|
///----------- Polarity
|
|
TGLabel * lbPol = new TGLabel(vfInput1, "Polarity");vfInput1->AddFrame(lbPol, layoutHintsR);
|
|
cbPolarity = new TGComboBox(vfInput2); vfInput2->AddFrame(cbPolarity, layoutHints);
|
|
cbPolarity->AddEntry("Positive +", 1);
|
|
cbPolarity->AddEntry("Negative -", 0);
|
|
cbPolarity->Resize(width, 20);
|
|
//pixie->GetChannelPolarity(boardID, ch) ? cbPolarity->Select(1) : cbPolarity->Select(0);
|
|
cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSetting", this, "ChangeOnOff()");
|
|
|
|
|
|
///---------- 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);
|
|
|
|
///---------- Record Length
|
|
TGLabel * lbRecordLength = new TGLabel(vfInput1, "Record Length [ns]"); vfInput1->AddFrame(lbRecordLength, layoutHintsR);
|
|
TGNumberEntry* numRecordLength = new TGNumberEntry(vfInput2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numRecordLength, layoutHints);
|
|
numRecordLength->Resize(width, 20);
|
|
|
|
///const uint32_t PreTrigger = 0x1038; /// R/W
|
|
TGLabel * lbPreTrigger = new TGLabel(vfInput1, "Pre trigger [ns]"); vfInput1->AddFrame(lbPreTrigger, layoutHintsR);
|
|
TGNumberEntry* numPreTrigger = new TGNumberEntry(vfInput2, 2000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numPreTrigger, layoutHints);
|
|
numPreTrigger->Resize(width, 20);
|
|
|
|
///const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W,
|
|
TGLabel * lbEventAgg = new TGLabel(vfInput1, "Events / Aggregate"); vfInput1->AddFrame(lbEventAgg, layoutHintsR);
|
|
TGNumberEntry* numEventAgg = new TGNumberEntry(vfInput2, 512, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numEventAgg, layoutHints);
|
|
numEventAgg->Resize(width, 20);
|
|
|
|
///================== Trigger Settings
|
|
TGGroupFrame * gfTrigger = new TGGroupFrame(hframe1, "Trigger", kHorizontalFrame); hframe1->AddFrame(gfTrigger, new TGLayoutHints(kLHintsExpandY));
|
|
TGHorizontalFrame * hfTrigger = new TGHorizontalFrame(gfTrigger); gfTrigger->AddFrame(hfTrigger);
|
|
|
|
TGVerticalFrame * vfTrigger1 = new TGVerticalFrame(hfTrigger); hfTrigger->AddFrame(vfTrigger1);
|
|
TGVerticalFrame * vfTrigger2 = new TGVerticalFrame(hfTrigger); hfTrigger->AddFrame(vfTrigger2);
|
|
|
|
///const uint32_t TriggerThreshold = 0x106C; /// R/W
|
|
TGLabel * lbTriggerThreshold = new TGLabel(vfTrigger1, "Trigger Threshold [LSB]"); vfTrigger1->AddFrame(lbTriggerThreshold, layoutHintsR);
|
|
TGNumberEntry* numTriggerThreshold = new TGNumberEntry(vfTrigger2, 100, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerThreshold, layoutHints);
|
|
numTriggerThreshold->Resize(width, 20);
|
|
|
|
///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
|
|
TGLabel * lbTriggerHoldOff = new TGLabel(vfTrigger1, "Trigger Holdoff [ns]"); vfTrigger1->AddFrame(lbTriggerHoldOff, layoutHintsR);
|
|
TGNumberEntry* numTriggerHoldOff = new TGNumberEntry(vfTrigger2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerHoldOff, layoutHints);
|
|
numTriggerHoldOff->Resize(width, 20);
|
|
|
|
///const uint32_t ChannelDCOffset = 0x1098; /// R/W
|
|
TGLabel * lbDCOffset = new TGLabel(vfTrigger1, "DC offset [%]"); vfTrigger1->AddFrame(lbDCOffset, layoutHintsR);
|
|
TGNumberEntry* numDCOffset = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numDCOffset, layoutHints);
|
|
numDCOffset->Resize(width, 20);
|
|
|
|
///const uint32_t RCCR2SmoothingFactor = 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor
|
|
TGLabel * lbTriggerSmoothing = new TGLabel(vfTrigger1, "Trigger Smoothing"); vfTrigger1->AddFrame(lbTriggerSmoothing, layoutHintsR);
|
|
TGComboBox* cbTriggerSmoothing = new TGComboBox(vfTrigger2); vfTrigger2->AddFrame(cbTriggerSmoothing, layoutHints);
|
|
cbTriggerSmoothing->AddEntry("disable", 0);
|
|
cbTriggerSmoothing->AddEntry("2 samples", 1);
|
|
cbTriggerSmoothing->AddEntry("4 samples", 2);
|
|
cbTriggerSmoothing->AddEntry("8 samples", 4);
|
|
cbTriggerSmoothing->AddEntry("16 samples", 8);
|
|
cbTriggerSmoothing->AddEntry("32 samples", 16);
|
|
cbTriggerSmoothing->AddEntry("64 samples", 32);
|
|
cbTriggerSmoothing->AddEntry("128 samples", 0x3F);
|
|
cbTriggerSmoothing->Select(16);
|
|
cbTriggerSmoothing->Resize(width, 20);
|
|
|
|
///const uint32_t InputRiseTime = 0x1058; /// R/W OK
|
|
TGLabel * lbInputRiseTime = new TGLabel(vfTrigger1, "Input rise time [ns]"); vfTrigger1->AddFrame(lbInputRiseTime, layoutHintsR);
|
|
TGNumberEntry* numInputRiseTime = new TGNumberEntry(vfTrigger2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numInputRiseTime, layoutHints);
|
|
numInputRiseTime->Resize(width, 20);
|
|
|
|
///const uint32_t RiseTimeValidationWindow = 0x1070; /// R/W OK
|
|
TGLabel * lbRiseTimeValidWin = new TGLabel(vfTrigger1, "Rise Time Val. Win. [ns]"); vfTrigger1->AddFrame(lbRiseTimeValidWin, layoutHintsR);
|
|
TGNumberEntry* numRiseTimeValidWin = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numRiseTimeValidWin, layoutHints);
|
|
numRiseTimeValidWin->Resize(width, 20);
|
|
|
|
///const uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure
|
|
///const uint32_t VetoWidth = 0x10D4; /// R/W
|
|
///const uint32_t FineGain = 0x10C4; /// R/W OK
|
|
|
|
|
|
///================== Trapezoid Settings
|
|
TGGroupFrame * gfTrap = new TGGroupFrame(hframe1, "Trapazoid", kHorizontalFrame); hframe1->AddFrame(gfTrap, new TGLayoutHints(kLHintsExpandY));
|
|
TGHorizontalFrame * hfTrap = new TGHorizontalFrame(gfTrap); gfTrap->AddFrame(hfTrap);
|
|
|
|
TGVerticalFrame * vfTrap1 = new TGVerticalFrame(hfTrap); hfTrap->AddFrame(vfTrap1);
|
|
TGVerticalFrame * vfTrap2 = new TGVerticalFrame(hfTrap); hfTrap->AddFrame(vfTrap2);
|
|
|
|
|
|
///const uint32_t TrapezoidRiseTime = 0x105C; /// R/W OK
|
|
TGLabel * lbTrapRiseTime = new TGLabel(vfTrap1, "Rise time [ns]"); vfTrap1->AddFrame(lbTrapRiseTime, layoutHintsR);
|
|
TGNumberEntry* numTrapRiseTime = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapRiseTime, layoutHints);
|
|
numTrapRiseTime->Resize(width, 20);
|
|
|
|
///const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK
|
|
TGLabel * lbTrapFlatTop = new TGLabel(vfTrap1, "Flat Top [ns]"); vfTrap1->AddFrame(lbTrapFlatTop, layoutHintsR);
|
|
TGNumberEntry* numTrapFlatTop = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapFlatTop, layoutHints);
|
|
numTrapFlatTop->Resize(width, 20);
|
|
|
|
///const uint32_t DecayTime = 0x1068; /// R/W OK
|
|
TGLabel * lbDecay = new TGLabel(vfTrap1, "Decay [ns]"); vfTrap1->AddFrame(lbDecay, layoutHintsR);
|
|
TGNumberEntry* numDecay = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numDecay, layoutHints);
|
|
numDecay->Resize(width, 20);
|
|
|
|
///const uint32_t PeakingTime = 0x1064; /// R/W OK
|
|
TGLabel * lbPeaking = new TGLabel(vfTrap1, "Peaking [ns]"); vfTrap1->AddFrame(lbPeaking, layoutHintsR);
|
|
TGNumberEntry* numPeaking = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeaking, layoutHints);
|
|
numPeaking->Resize(width, 20);
|
|
|
|
///const uint32_t PeakHoldOff = 0x1078; /// R/W OK
|
|
TGLabel * lbPeakHoldOff = new TGLabel(vfTrap1, "Peaking Holdoff [ns]"); vfTrap1->AddFrame(lbPeakHoldOff, layoutHintsR);
|
|
TGNumberEntry* numPeakHoldOff = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeakHoldOff, layoutHints);
|
|
numPeakHoldOff->Resize(width, 20);
|
|
|
|
///================== const uint32_t DPPAlgorithmControl = 0x1080; /// R/W
|
|
TGGroupFrame * gfDPPCtrl = new TGGroupFrame(vframe, "DPP Algorithm Control", kHorizontalFrame); vframe->AddFrame(gfDPPCtrl, new TGLayoutHints(kLHintsExpandX));
|
|
TGVerticalFrame * vfDPPCtrl = new TGVerticalFrame(gfDPPCtrl); gfDPPCtrl->AddFrame(vfDPPCtrl);
|
|
TGHorizontalFrame * hfDPPCtrl1 = new TGHorizontalFrame(vfDPPCtrl); vfDPPCtrl->AddFrame(hfDPPCtrl1, layoutHints);
|
|
|
|
|
|
|
|
///================== const uint32_t DPPAlgorithmControl2_G = 0x10A0; /// R/W OK
|
|
TGGroupFrame * gfDPPCtrl2 = new TGGroupFrame(vframe, "DPP Algorithm Control 2", kHorizontalFrame); vframe->AddFrame(gfDPPCtrl2, new TGLayoutHints(kLHintsExpandX));
|
|
TGVerticalFrame * vfDPPCtrl2 = new TGVerticalFrame(gfDPPCtrl2); gfDPPCtrl2->AddFrame(vfDPPCtrl2);
|
|
TGHorizontalFrame * hfDPPCtrl21 = new TGHorizontalFrame(vfDPPCtrl2); vfDPPCtrl2->AddFrame(hfDPPCtrl21, layoutHints);
|
|
|
|
/*
|
|
///----- all other
|
|
TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING];
|
|
TGLabel * lb[NUM_CHANNEL_SETTING];
|
|
|
|
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();
|
|
|
|
isOpened = true;
|
|
}
|
|
ChannelSetting::~ChannelSetting(){
|
|
|
|
isOpened = false;
|
|
|
|
delete boardIDEntry;
|
|
|
|
delete cbOnOff;
|
|
delete cbInputDynamicRange;
|
|
delete cbPolarity;
|
|
|
|
/// fMain must be delete last;
|
|
fMain->Cleanup();
|
|
delete fMain;
|
|
|
|
}
|
|
void ChannelSetting::ChangeBoard(){
|
|
ChangeCh();
|
|
}
|
|
void ChannelSetting::ChangeCh(){
|
|
|
|
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);
|
|
|
|
}
|
|
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");
|
|
|
|
//pixie->SetChannelPositivePolarity(val, boardID, ch);
|
|
//pixie->SaveSettings(pixie->GetSettingFile(boardIDEntry->GetNumber()));
|
|
}
|
|
|
|
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()));
|
|
}
|