728 lines
38 KiB
C++
728 lines
38 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 "channelSettingPSD.h"
|
|
|
|
ChannelSettingPSD::ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID){
|
|
|
|
this->digi = digi;
|
|
this->nDigi = nDigi;
|
|
|
|
Pixel_t red, green;
|
|
gClient->GetColorByName("red", red);
|
|
gClient->GetColorByName("green", green);
|
|
|
|
fMain = new TGMainFrame(p,w,h);
|
|
fMain->SetWindowName("Channel Settings PSD");
|
|
fMain->Connect("CloseWindow()", "ChannelSettingPSD", this, "CloseWindow()");
|
|
|
|
TGLayoutHints * layoutHintsR = new TGLayoutHints(kLHintsRight, 5,5,3,2); /// left, right, top, bottom
|
|
TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,0,0); /// 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, boardID, 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()", "ChannelSettingPSD", this, "ChangeBoard()");
|
|
if( nDigi <= 1 ) boardIDEntry->SetState(false);
|
|
|
|
this->presentBoardID = boardID;
|
|
|
|
NChannel = 16 ;
|
|
if( digi != NULL ) NChannel = digi[boardID]->GetNChannel();
|
|
|
|
TGLabel * lba = new TGLabel(hframe0, Form("Serial : %03d", digi == NULL ? -1 : digi[boardID]->GetSerialNumber())); hframe0->AddFrame(lba, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5, 5, 3, 4));
|
|
|
|
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::kNEAAnyNumber);
|
|
chIDEntry->SetWidth(50);
|
|
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, -1, NChannel-1);
|
|
chIDEntry->SetNumber(0, false);
|
|
chIDEntry->Connect("Modified()", "ChannelSettingPSD", 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()", "ChannelSettingPSD", 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));
|
|
eTemp = new TGTextEntry(hframe0, new TGTextBuffer(1)); hframe0->AddFrame(eTemp, new TGLayoutHints(kLHintsRight, 5,5,3,4));
|
|
eTemp->SetEnabled(false);
|
|
eTemp->Resize(50,20);
|
|
|
|
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);
|
|
cbOnOff->Connect("Selected(Int_t, Int_t)", "ChannelSettingPSD", this, "SetChannelMask()");
|
|
|
|
///----------- 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);
|
|
cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSettingPSD", 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->Connect("Selected(Int_t, Int_t)", "ChannelSettingPSD", this, "SetInputDynamicRange()");
|
|
|
|
///---------- Record Length
|
|
TGLabel * lbRecordLength = new TGLabel(vfInput1, "Record Length [ns]"); vfInput1->AddFrame(lbRecordLength, layoutHintsR);
|
|
numRecordLength = new TGNumberEntry(vfInput2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numRecordLength, layoutHints);
|
|
numRecordLength->Resize(width, 20);
|
|
numRecordLength->Connect("Modified()", "ChannelSettingPSD", this, "SetRecordLength()");
|
|
|
|
///const uint32_t PreTrigger = 0x1038; /// R/W
|
|
TGLabel * lbPreTrigger = new TGLabel(vfInput1, "Pre trigger [ns]"); vfInput1->AddFrame(lbPreTrigger, layoutHintsR);
|
|
numPreTrigger = new TGNumberEntry(vfInput2, 2000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numPreTrigger, layoutHints);
|
|
numPreTrigger->Resize(width, 20);
|
|
numPreTrigger->Connect("Modified()", "ChannelSettingPSD", this, "SetPreTrigger()");
|
|
|
|
///const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W,
|
|
TGLabel * lbEventAgg = new TGLabel(vfInput1, "Events / Aggregate"); vfInput1->AddFrame(lbEventAgg, layoutHintsR);
|
|
numEventAgg = new TGNumberEntry(vfInput2, 512, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numEventAgg, layoutHints);
|
|
numEventAgg->Resize(width, 20);
|
|
numEventAgg->Connect("Modified()", "ChannelSettingPSD", 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
|
|
|
|
|
|
///const uint32_t ChannelDCOffset = 0x1098; /// R/W
|
|
TGLabel * lbDCOffset = new TGLabel(vfInput1, "DC offset [%]"); vfInput1->AddFrame(lbDCOffset, layoutHintsR);
|
|
numDCOffset = new TGNumberEntry(vfInput2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numDCOffset, layoutHints);
|
|
numDCOffset->Resize(width, 20);
|
|
numDCOffset->Connect("Modified()", "ChannelSettingPSD", this, "SetDCOffset()");
|
|
|
|
|
|
}
|
|
|
|
{///================== Trigger Settings
|
|
TGGroupFrame * gfTrigger = new TGGroupFrame(hframe1, "Trigger / Threshold", 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 = 0x1060; /// R/W
|
|
TGLabel * lbTriggerThreshold = new TGLabel(vfTrigger1, "Trigger Threshold [LSB]"); vfTrigger1->AddFrame(lbTriggerThreshold, layoutHintsR);
|
|
numTriggerThreshold = new TGNumberEntry(vfTrigger2, 100, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerThreshold, layoutHints);
|
|
numTriggerThreshold->Resize(width, 20);
|
|
numTriggerThreshold->Connect("Modified()", "ChannelSettingPSD", this, "SetTriggerThreshold()");
|
|
|
|
///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
|
|
TGLabel * lbTriggerHoldOff = new TGLabel(vfTrigger1, "Trigger Holdoff [ns]"); vfTrigger1->AddFrame(lbTriggerHoldOff, layoutHintsR);
|
|
numTriggerHoldOff = new TGNumberEntry(vfTrigger2, 20000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTriggerHoldOff, layoutHints);
|
|
numTriggerHoldOff->Resize(width, 20);
|
|
numTriggerHoldOff->Connect("Modified()", "ChannelSettingPSD", this, "SetTriggerHoldOff()");
|
|
|
|
///const uint32_t ChargeZeroSuppressionThreshold = 0x1044; /// R/W
|
|
TGLabel * lbChargeZeroSupThreshold = new TGLabel(vfTrigger1, "Charge Zero Suppress Th. [LSB]"); vfTrigger1->AddFrame(lbChargeZeroSupThreshold, layoutHintsR);
|
|
numlbChargeZeroSupThreshold = new TGNumberEntry(vfTrigger2, 100, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numlbChargeZeroSupThreshold, layoutHints);
|
|
numlbChargeZeroSupThreshold->Resize(width, 20);
|
|
//numlbChargeZeroSupThreshold->Connect("Modified()", "ChannelSettingPSD", this, "SetTriggerHoldOff()");
|
|
|
|
///const uint32_t TriggerLatency = 0x106C; /// R/W
|
|
TGLabel * lbTrigLatency = new TGLabel(vfTrigger1, "Trigger Latency [ns]"); vfTrigger1->AddFrame(lbTrigLatency, layoutHintsR);
|
|
numTrigLatency = new TGNumberEntry(vfTrigger2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numTrigLatency, layoutHints);
|
|
numTrigLatency->Resize(width, 20);
|
|
//numTrigLatency->Connect("Modified()", "ChannelSettingPSD", this, "SetDCOffset()");
|
|
|
|
///const uint32_t ThresholdForPSDCut = 0x1078; /// R/W
|
|
TGLabel * lbThresholdPSDCut = new TGLabel(vfTrigger1, "PSD Cut Threshold [%]"); vfTrigger1->AddFrame(lbThresholdPSDCut, layoutHintsR);
|
|
numThresholdPSDCut = new TGNumberEntry(vfTrigger2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numThresholdPSDCut, layoutHints);
|
|
numThresholdPSDCut->Resize(width, 20);
|
|
//numThresholdPSDCut->Connect("Modified()", "ChannelSettingPSD", this, "SetDCOffset()");
|
|
|
|
///const uint32_t PurGapThreshold = 0x107C; /// R/W
|
|
TGLabel * lbPURGAPThreshold = new TGLabel(vfTrigger1, "PUR-GAP Threshold [LSB]"); vfTrigger1->AddFrame(lbPURGAPThreshold, layoutHintsR);
|
|
numPURGAPThreshold = new TGNumberEntry(vfTrigger2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrigger2->AddFrame(numPURGAPThreshold, layoutHints);
|
|
numPURGAPThreshold->Resize(width, 20);
|
|
|
|
/// DPP1 bit[19:18]
|
|
TGLabel * lbTriggerMode = new TGLabel(vfTrigger1, "Trigger 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->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
}
|
|
|
|
{///================== PSD Settings
|
|
TGGroupFrame * gfTrap = new TGGroupFrame(hframe1, "PSD Settings", 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 CFDSetting = 0x103C; /// R/W
|
|
TGLabel * lbCFDDelay = new TGLabel(vfTrap1, "CFD Delay [ns]"); vfTrap1->AddFrame(lbCFDDelay, layoutHintsR);
|
|
numCFDDelay = new TGNumberEntry(vfTrap2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numCFDDelay, layoutHints);
|
|
numCFDDelay->Resize(width, 20);
|
|
|
|
TGLabel * lbCFDFraction = new TGLabel(vfTrap1, "CFD Fraction"); vfTrap1->AddFrame(lbCFDFraction, layoutHintsR);
|
|
cbCFDFraction = new TGComboBox(vfTrap2); vfTrap2->AddFrame(cbCFDFraction, layoutHints);
|
|
cbCFDFraction->AddEntry("25%", 0);
|
|
cbCFDFraction->AddEntry("50%", 1);
|
|
cbCFDFraction->AddEntry("75%", 2);
|
|
cbCFDFraction->AddEntry("100%", 3);
|
|
cbCFDFraction->Resize(width, 20);
|
|
|
|
TGLabel * lbCFDInterPt = new TGLabel(vfTrap1, "CFD Interpolation Pt."); vfTrap1->AddFrame(lbCFDInterPt, layoutHintsR);
|
|
cbCFDInterPt = new TGComboBox(vfTrap2); vfTrap2->AddFrame(cbCFDInterPt, layoutHints);
|
|
cbCFDInterPt->AddEntry("same", 0);
|
|
cbCFDInterPt->AddEntry("2nd", 1);
|
|
cbCFDInterPt->AddEntry("3rd", 2);
|
|
cbCFDInterPt->AddEntry("4th", 3);
|
|
cbCFDInterPt->Resize(width, 20);
|
|
|
|
///const uint32_t ShortGateWidth = 0x1054; /// R/W
|
|
TGLabel * lbShortGateWidth = new TGLabel(vfTrap1, "Short Gate Width [ns]"); vfTrap1->AddFrame(lbShortGateWidth, layoutHintsR);
|
|
numShortGateWidth = new TGNumberEntry(vfTrap2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numShortGateWidth, layoutHints);
|
|
numShortGateWidth->Resize(width, 20);
|
|
|
|
///const uint32_t LongGateWidth = 0x1058; /// R/W
|
|
TGLabel * lbLongGateWidth = new TGLabel(vfTrap1, "Long Gate Width [ns]"); vfTrap1->AddFrame(lbLongGateWidth, layoutHintsR);
|
|
numLongGateWidth = new TGNumberEntry(vfTrap2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numLongGateWidth, layoutHints);
|
|
numLongGateWidth->Resize(width, 20);
|
|
|
|
///const uint32_t GateOffset = 0x105C; /// R/W
|
|
TGLabel * lbGateOffset = new TGLabel(vfTrap1, "Gate Offset [ns]"); vfTrap1->AddFrame(lbGateOffset, layoutHintsR);
|
|
numGateOffset = new TGNumberEntry(vfTrap2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numGateOffset, layoutHints);
|
|
numGateOffset->Resize(width, 20);
|
|
|
|
///const uint32_t FixedBaseline = 0x1064; /// R/W
|
|
TGLabel * lbFixBaseline = new TGLabel(vfTrap1, "Fix Baseline [LSB]"); vfTrap1->AddFrame(lbFixBaseline, layoutHintsR);
|
|
numFixBaseline = new TGNumberEntry(vfTrap2, 16, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numFixBaseline, layoutHints);
|
|
numFixBaseline->Resize(width, 20);
|
|
|
|
}
|
|
|
|
{///================== const uint32_t DPPAlgorithmControl = 0x1080; /// R/W
|
|
TGGroupFrame * gfDPPCtrl = new TGGroupFrame(vframe, "DPP Algorithm Control 1 & 2", kHorizontalFrame); vframe->AddFrame(gfDPPCtrl, new TGLayoutHints(kLHintsExpandX));
|
|
|
|
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);
|
|
|
|
/// DPP [2:0]
|
|
TGLabel * lbChargeSensitivity = new TGLabel(vfDPPCtrl11, "Charge Sensitivity :"); vfDPPCtrl11->AddFrame(lbChargeSensitivity, haha);
|
|
cbChargeSensitivity = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbChargeSensitivity);
|
|
cbChargeSensitivity->AddEntry("5 fC", 0);
|
|
cbChargeSensitivity->AddEntry("20 fC", 1);
|
|
cbChargeSensitivity->AddEntry("80 fC", 2);
|
|
cbChargeSensitivity->AddEntry("320 fC", 3);
|
|
cbChargeSensitivity->AddEntry("1.28 pC", 4);
|
|
cbChargeSensitivity->AddEntry("5.12 pC", 5);
|
|
cbChargeSensitivity->Resize(width, 20);
|
|
cbChargeSensitivity->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbChargePedestal = new TGLabel(vfDPPCtrl11, "Charge Pedestal :"); vfDPPCtrl11->AddFrame(lbChargePedestal, haha);
|
|
cbChargePedestal = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbChargePedestal);
|
|
cbChargePedestal->AddEntry("Disable", 0);
|
|
cbChargePedestal->AddEntry("added 1024", 1);
|
|
cbChargePedestal->Resize(width, 20);
|
|
cbChargePedestal->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbTriggerCount = new TGLabel(vfDPPCtrl11, "Trigger Count :"); vfDPPCtrl11->AddFrame(lbTriggerCount, haha);
|
|
cbTriggerCount = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbTriggerCount);
|
|
cbTriggerCount->AddEntry("only saved to memory", 0);
|
|
cbTriggerCount->AddEntry("included rejected events", 1);
|
|
cbTriggerCount->Resize(width, 20);
|
|
cbTriggerCount->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbDiscrimationMode = new TGLabel(vfDPPCtrl11, "Discri. Mode :"); vfDPPCtrl11->AddFrame(lbDiscrimationMode, haha);
|
|
cbDiscrimationMode = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDiscrimationMode);
|
|
cbDiscrimationMode->AddEntry("Leading edge", 0);
|
|
cbDiscrimationMode->AddEntry("Digitial CFD", 1);
|
|
cbDiscrimationMode->Resize(width, 20);
|
|
cbDiscrimationMode->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbPileUpGate = new TGLabel(vfDPPCtrl11, "Pile-Up within gate :"); vfDPPCtrl11->AddFrame(lbPileUpGate, haha);
|
|
cbPileUpGate = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbPileUpGate);
|
|
cbPileUpGate->AddEntry("Disabled", 0);
|
|
cbPileUpGate->AddEntry("Enabled", 1);
|
|
cbPileUpGate->Resize(width, 20);
|
|
cbPileUpGate->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbPileUp = new TGLabel(vfDPPCtrl11, "Pile-Up Rejection :"); vfDPPCtrl11->AddFrame(lbPileUp, haha);
|
|
cbPileUp = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbPileUp);
|
|
cbPileUp->AddEntry("Disabled", 0);
|
|
cbPileUp->AddEntry("Enabled", 1);
|
|
cbPileUp->Resize(width, 20);
|
|
cbPileUp->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbTestPulseRate = new TGLabel(vfDPPCtrl11, "Test Pulse Rate :"); vfDPPCtrl11->AddFrame(lbTestPulseRate, haha);
|
|
cbTestPulseRate = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbTestPulseRate);
|
|
cbTestPulseRate->AddEntry("1 kHz", 0);
|
|
cbTestPulseRate->AddEntry("10 kHz", 1);
|
|
cbTestPulseRate->AddEntry("100 kHz", 2);
|
|
cbTestPulseRate->AddEntry("1 MHz", 3);
|
|
cbTestPulseRate->Resize(width, 20);
|
|
cbTestPulseRate->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbBaselineLongGate = new TGLabel(vfDPPCtrl11, "Baseline Cal. after Long Gate :"); vfDPPCtrl11->AddFrame(lbBaselineLongGate, haha);
|
|
cbBaselineLongGate = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbBaselineLongGate);
|
|
cbBaselineLongGate->AddEntry("Disabled", 0);
|
|
cbBaselineLongGate->AddEntry("Enabled", 1);
|
|
cbBaselineLongGate->Resize(width, 20);
|
|
cbBaselineLongGate->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
/// DPP1 bit[22:20]
|
|
TGLabel * lbBaseLineAvg = new TGLabel(vfDPPCtrl11, "Baseline avg. :"); vfDPPCtrl11->AddFrame(lbBaseLineAvg, haha);
|
|
cbBaseLineAvg = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbBaseLineAvg);
|
|
cbBaseLineAvg->AddEntry("no baseline", 0);
|
|
cbBaseLineAvg->AddEntry("16 sp.", 1);
|
|
cbBaseLineAvg->AddEntry("64 sp.", 2);
|
|
cbBaseLineAvg->AddEntry("256 sp.", 3);
|
|
cbBaseLineAvg->AddEntry("1024 sp.", 4);
|
|
cbBaseLineAvg->AddEntry("4096 sp.", 5);
|
|
cbBaseLineAvg->AddEntry("16384 sp.", 6);
|
|
cbBaseLineAvg->Resize(width, 20);
|
|
cbBaseLineAvg->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbDiscardQlongQthr = new TGLabel(vfDPPCtrl11, "Q(Long) < Q(thr.) :"); vfDPPCtrl11->AddFrame(lbDiscardQlongQthr, haha);
|
|
cbDiscardQlongQthr = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbDiscardQlongQthr);
|
|
cbDiscardQlongQthr->AddEntry("Accept", 0);
|
|
cbDiscardQlongQthr->AddEntry("Discard", 1);
|
|
cbDiscardQlongQthr->Resize(width, 20);
|
|
cbDiscardQlongQthr->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbOverRange = new TGLabel(vfDPPCtrl11, "ADC Over/under range :"); vfDPPCtrl11->AddFrame(lbOverRange, haha);
|
|
cbOverRange = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbOverRange);
|
|
cbOverRange->AddEntry("Accept", 0);
|
|
cbOverRange->AddEntry("Reject.", 1);
|
|
cbOverRange->Resize(width, 20);
|
|
cbOverRange->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbTrigHysteresis = new TGLabel(vfDPPCtrl11, "Trigger Hysteresis :"); vfDPPCtrl11->AddFrame(lbTrigHysteresis, haha);
|
|
cbTrigHysteresis = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbTrigHysteresis);
|
|
cbTrigHysteresis->AddEntry("Enabled", 0);
|
|
cbTrigHysteresis->AddEntry("Disabled", 1);
|
|
cbTrigHysteresis->Resize(width, 20);
|
|
cbTrigHysteresis->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
TGLabel * lbInhibitOppostieParity = new TGLabel(vfDPPCtrl11, "Inhibit Opposite Parity Zero-Crossing :"); vfDPPCtrl11->AddFrame(lbInhibitOppostieParity, haha);
|
|
cbInhibitOppostieParity = new TGComboBox(vfDPPCtrl12); vfDPPCtrl12->AddFrame(cbInhibitOppostieParity);
|
|
cbInhibitOppostieParity->AddEntry("Enabled", 0);
|
|
cbInhibitOppostieParity->AddEntry("Disabled", 1);
|
|
cbInhibitOppostieParity->Resize(width, 20);
|
|
cbInhibitOppostieParity->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
|
|
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(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbLocalShapedTrigger);
|
|
cbLocalShapedTrigger->AddEntry("Disabled", -3);
|
|
cbLocalShapedTrigger->AddEntry("AND", 0);
|
|
cbLocalShapedTrigger->AddEntry("Even Channel", 1);
|
|
cbLocalShapedTrigger->AddEntry("Odd Channel", 2);
|
|
cbLocalShapedTrigger->AddEntry("OR", 3);
|
|
cbLocalShapedTrigger->Resize(100, 20);
|
|
cbLocalShapedTrigger->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbLocalTriggerValid = new TGLabel(vfDPPCtrl21, "Local Trigger Valid. :"); vfDPPCtrl21->AddFrame(lbLocalTriggerValid, haha);
|
|
cbLocalTriggerValid = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbLocalTriggerValid);
|
|
cbLocalTriggerValid->AddEntry("Disabled", -3);
|
|
cbLocalTriggerValid->AddEntry("Enable Add.", 0);
|
|
cbLocalTriggerValid->AddEntry("val0 = val1 from mother-board mask", 1);
|
|
cbLocalTriggerValid->AddEntry("AND", 3);
|
|
cbLocalTriggerValid->AddEntry("OR", 4);
|
|
cbLocalTriggerValid->Resize(200, 20);
|
|
cbLocalTriggerValid->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbAddLocalTriggerValid = new TGLabel(vfDPPCtrl21, "Add. Local Trigger Valid. :"); vfDPPCtrl21->AddFrame(lbAddLocalTriggerValid, haha);
|
|
cbAddLocalTriggerValid = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbAddLocalTriggerValid);
|
|
cbAddLocalTriggerValid->AddEntry("Disabled", 0);
|
|
cbAddLocalTriggerValid->AddEntry("valid from paired Ch. AND mother board", 1);
|
|
cbAddLocalTriggerValid->AddEntry("valid from paired Ch. OR mother board", 2);
|
|
cbAddLocalTriggerValid->Resize(200, 20);
|
|
cbAddLocalTriggerValid->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
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(150, 20);
|
|
cbVetoSource->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbInputSmoothingFactor = new TGLabel(vfDPPCtrl21, "Input Smoothing :"); vfDPPCtrl21->AddFrame(lbInputSmoothingFactor, haha);
|
|
cbInputSmoothinFactor = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbInputSmoothinFactor);
|
|
cbInputSmoothinFactor->AddEntry("Disabled", 0);
|
|
cbInputSmoothinFactor->AddEntry("2 samples", 1);
|
|
cbInputSmoothinFactor->AddEntry("4 samples", 2);
|
|
cbInputSmoothinFactor->AddEntry("8 samples", 3);
|
|
cbInputSmoothinFactor->AddEntry("16 samples", 4);
|
|
cbInputSmoothinFactor->Resize(width, 20);
|
|
cbInputSmoothinFactor->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbTriggerCounterRate = new TGLabel(vfDPPCtrl21, "Trigger Counter Rate (N) :"); 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->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbMarkSaturatedPulse = new TGLabel(vfDPPCtrl21, "Mark Saturated Pulse :"); vfDPPCtrl21->AddFrame(lbMarkSaturatedPulse, haha);
|
|
cbMarkSaturatedPulse = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbMarkSaturatedPulse);
|
|
cbMarkSaturatedPulse->AddEntry("Enabled", 0);
|
|
cbMarkSaturatedPulse->AddEntry("Disabled", 1);
|
|
cbMarkSaturatedPulse->Resize(width, 20);
|
|
cbMarkSaturatedPulse->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbResetTimeStamp = new TGLabel(vfDPPCtrl21, "Reset Timestamp from external Veto :"); vfDPPCtrl21->AddFrame(lbResetTimeStamp, haha);
|
|
cbResetTimeStamp = new TGComboBox(vfDPPCtrl22); vfDPPCtrl22->AddFrame(cbResetTimeStamp);
|
|
cbResetTimeStamp->AddEntry("Disbaled", 0);
|
|
cbResetTimeStamp->AddEntry("Enabled", 1);
|
|
cbResetTimeStamp->Resize(width, 20);
|
|
cbResetTimeStamp->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
|
|
TGHorizontalFrame * hfDPPCtrl2 = new TGHorizontalFrame(vfDPPCtrl); vfDPPCtrl->AddFrame(hfDPPCtrl2, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 0));
|
|
|
|
TGVerticalFrame * vfDPPCtrl_a = new TGVerticalFrame(hfDPPCtrl2); hfDPPCtrl2->AddFrame(vfDPPCtrl_a);
|
|
TGVerticalFrame * vfDPPCtrl_b = new TGVerticalFrame(hfDPPCtrl2); hfDPPCtrl2->AddFrame(vfDPPCtrl_b, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
|
|
|
|
TGLabel * lbVetoSignalMode = new TGLabel(vfDPPCtrl_a, "Veto Mode :"); vfDPPCtrl_a->AddFrame(lbVetoSignalMode, haha);
|
|
cbVetoMode = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbVetoMode);
|
|
cbVetoMode->AddEntry("is used after charge integration", 0);
|
|
cbVetoMode->AddEntry("to inhibit self-trigger", 1);
|
|
cbVetoMode->Resize(300, 20);
|
|
cbVetoMode->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
|
|
TGLabel * lbDisableSelfTrigger = new TGLabel(vfDPPCtrl_a, "Self Trigger :"); vfDPPCtrl_a->AddFrame(lbDisableSelfTrigger, haha);
|
|
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);
|
|
cbLocalShapedTrigger->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm1()");
|
|
|
|
|
|
TGLabel * lbExtraWordOption = new TGLabel(vfDPPCtrl_a, "Extras Word Option :"); vfDPPCtrl_a->AddFrame(lbExtraWordOption, haha);
|
|
cbExtraWordOption = new TGComboBox(vfDPPCtrl_b); vfDPPCtrl_b->AddFrame(cbExtraWordOption);
|
|
cbExtraWordOption->AddEntry("[31:16] Extended Time Stamp [15:0] Baseline * 4", 0);
|
|
cbExtraWordOption->AddEntry("[31:16] Extended Time Stamp [15] Flags", 1);
|
|
cbExtraWordOption->AddEntry("[31:16] Extended Time Stamp [15] Flags [9:0] Fine Tiem Stamp", 2);
|
|
cbExtraWordOption->AddEntry("[31:16] Lost Trigger Counter [15:10] Total Trigger COunter", 4);
|
|
cbExtraWordOption->AddEntry("[31:16] Positive Zero Crossing [15:0] Negative Zero Crossing", 5);
|
|
cbExtraWordOption->AddEntry("0x12345678", 7);
|
|
cbExtraWordOption->Resize(400, 20);
|
|
cbExtraWordOption->Connect("Changed()", "ChannelSettingPSD", this, "SetDPPAlgorithm2()");
|
|
|
|
TGLabel * lbExtraWordOptionFlag = new TGLabel(vfDPPCtrl_b, "Flags = [15] Triggr lost [14] Over-range [13] 1024 trigger counted [12] N lost trigger count"); vfDPPCtrl_b->AddFrame(lbExtraWordOptionFlag);
|
|
|
|
}
|
|
|
|
fMain->MapSubwindows();
|
|
fMain->Resize(fMain->GetDefaultSize());
|
|
fMain->MapWindow();
|
|
|
|
ch2ns = 4;
|
|
|
|
isOpened = true;
|
|
}
|
|
ChannelSettingPSD::~ChannelSettingPSD(){
|
|
|
|
printf("close ChannelSettingPSD window\n");
|
|
|
|
isOpened = false;
|
|
|
|
delete boardIDEntry;
|
|
|
|
delete cbOnOff;
|
|
delete cbInputDynamicRange;
|
|
delete cbPolarity;
|
|
|
|
/// fMain must be delete last;
|
|
fMain->Cleanup();
|
|
delete fMain;
|
|
|
|
}
|
|
|
|
void ChannelSettingPSD::LogMsg(TString msg){
|
|
Emit("LogMsg(char*)", msg.Data());
|
|
}
|
|
|
|
void ChannelSettingPSD::ChangeBoard(){
|
|
if ( digi == NULL ) return;
|
|
|
|
int boardID = boardIDEntry->GetNumber();
|
|
|
|
if( digi[boardID]->GetDPPType() != V1730_DPP_PHA_CODE){
|
|
|
|
if( boardID > presentBoardID ) {
|
|
|
|
for( int i = boardID +1 ; i < nDigi; i++){
|
|
if( digi[i]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
|
boardID = i;
|
|
boardIDEntry->SetNumber(i, false);
|
|
break;
|
|
}
|
|
if( i = nDigi -1 ) return;
|
|
}
|
|
|
|
}else{
|
|
|
|
for( int i = boardID - 1 ; i >= 0; i--){
|
|
if( digi[i]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
|
boardID = i;
|
|
boardIDEntry->SetNumber(i, false);
|
|
break;
|
|
}
|
|
if( i = nDigi -1 ) return;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
ch2ns = (unsigned short) digi[boardID]->GetCh2ns();
|
|
ChangeCh();
|
|
|
|
}
|
|
|
|
void ChannelSettingPSD::ChangeCh(){
|
|
|
|
LogMsg(Form("========== Change to Channel %d", (int)chIDEntry->GetNumber()));
|
|
|
|
if ( digi == NULL ) return;
|
|
|
|
int boardID = boardIDEntry->GetNumber();
|
|
int ch = chIDEntry->GetNumber();
|
|
|
|
if( ch < 0 ) {
|
|
printf("All channels mode.\n");
|
|
return;
|
|
}
|
|
|
|
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_R, ch)), false);
|
|
|
|
numTriggerThreshold->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch), false);
|
|
numTriggerHoldOff ->SetNumber( digi[boardID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch) * 4 * ch2ns, false);
|
|
|
|
temp = digi[boardID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch);
|
|
cbPolarity->Select( ( (temp >> 16) & 0x1), false);
|
|
cbTriggerMode->Select( ( (temp >> 18) & 0x3), false);
|
|
cbBaseLineAvg->Select( ( (temp >> 20) & 0x7), false);
|
|
cbDisableSelfTrigger->Select( ( (temp >> 24) & 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( -3, false);
|
|
}
|
|
if( (((temp >> 6)) & 0x1 ) == 1 ){
|
|
cbLocalTriggerValid->Select( ( (temp >> 4) & 0x3), false);
|
|
}else{
|
|
cbLocalTriggerValid->Select( -3, false);
|
|
}
|
|
cbVetoSource->Select( ( (temp >> 14) & 0x3), false);
|
|
cbTriggerCounterRate->Select( ( (temp >> 16) & 0x3), false);
|
|
cbExtraWordOption->Select( ( (temp >> 8) & 0x7), false);
|
|
|
|
|
|
}
|
|
|
|
void ChannelSettingPSD::SetAllChannels(){
|
|
printf("=== %s\n", __func__);
|
|
|
|
if ( digi == NULL ) return;
|
|
|
|
short boardID = boardIDEntry->GetNumber();
|
|
short ch = chIDEntry->GetNumber();
|
|
|
|
uint32_t bit = 0;
|
|
bit += ((cbPolarity->GetSelected() << 16) & 0x3);
|
|
bit += ((cbTriggerMode->GetSelected() << 18) & 0x3);
|
|
bit += ((cbBaseLineAvg->GetSelected() << 20) & 0x7);
|
|
bit += ((cbDisableSelfTrigger->GetSelected() << 24) & 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 += ((cbExtraWordOption->GetSelected() << 8 ) & 0x7);
|
|
bit += ((cbVetoSource->GetSelected() << 14 ) & 0x3);
|
|
bit += ((cbTriggerCounterRate->GetSelected() << 16 ) & 0x3);
|
|
|
|
printf(" DPP2 bit: 0x%x\n", bit);
|
|
digi[boardID]->WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, -1);
|
|
|
|
}
|
|
|
|
void ChannelSettingPSD::SetChannelMask(){
|
|
printf("=== %s\n", __func__);
|
|
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 ChannelSettingPSD::SetDPPAlgorithm1(){
|
|
printf("=== %s\n", __func__);
|
|
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 += ((cbPolarity->GetSelected() << 16) & 0x3);
|
|
bit += ((cbTriggerMode->GetSelected() << 18) & 0x3);
|
|
bit += ((cbBaseLineAvg->GetSelected() << 20) & 0x7);
|
|
bit += ((cbDisableSelfTrigger->GetSelected() << 24) & 0x1);
|
|
bit += ((cbPileUp->GetSelected() << 27) & 0x1);
|
|
|
|
printf(" DPP1 bit: 0x%x\n", bit);
|
|
digi[boardID]->WriteRegister(Register::DPP::DPPAlgorithmControl, bit, ch);
|
|
|
|
}
|
|
|
|
void ChannelSettingPSD::SetDPPAlgorithm2(){
|
|
printf("=== %s\n", __func__);
|
|
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 += ((cbExtraWordOption->GetSelected() << 8 ) & 0x7);
|
|
bit += ((cbVetoSource->GetSelected() << 14 ) & 0x3);
|
|
bit += ((cbTriggerCounterRate->GetSelected() << 16 ) & 0x3);
|
|
|
|
printf(" DPP2 bit: 0x%x\n", bit);
|
|
digi[boardID]->WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, ch);
|
|
|
|
}
|
|
|
|
void ChannelSettingPSD::SetInputDynamicRange(){
|
|
printf("=== %s\n", __func__);
|
|
if ( digi == NULL ) return;
|
|
|
|
short boardID = boardIDEntry->GetNumber();
|
|
short ch = chIDEntry->GetNumber();
|
|
digi[boardID]->WriteRegister(Register::DPP::InputDynamicRange, cbInputDynamicRange->GetSelected(), ch);
|
|
}
|
|
|
|
|
|
void ChannelSettingPSD::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();
|
|
|
|
if( digi != NULL ) digi[boardID]->WriteRegister(address, temp / stepSize / ch2ns , ch);
|
|
}
|
|
|
|
void ChannelSettingPSD::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); }
|
|
void ChannelSettingPSD::SetPreTrigger() {printf("=== %s\n", __func__); ChangeAStep(numPreTrigger, 4, Register::DPP::PreTrigger);}
|
|
void ChannelSettingPSD::SetEventAggregate() {printf("=== %s\n", __func__); ChangeAStep(numEventAgg, 1, Register::DPP::NumberEventsPerAggregate_G);}
|
|
void ChannelSettingPSD::SetTriggerThreshold(){printf("=== %s\n", __func__); ChangeAStep(numTriggerThreshold, 1, Register::DPP::PSD::TriggerThreshold); }
|
|
void ChannelSettingPSD::SetTriggerHoldOff() {printf("=== %s\n", __func__); ChangeAStep(numTriggerHoldOff, 4, Register::DPP::PSD::TriggerHoldOffWidth);}
|
|
|
|
void ChannelSettingPSD::SetDCOffset(){
|
|
printf("=== %s\n", __func__);
|
|
if ( digi == NULL ) return;
|
|
short boardID = boardIDEntry->GetNumber();
|
|
short ch = chIDEntry->GetNumber();
|
|
double temp = numDCOffset->GetNumber();
|
|
uint32_t bit = uint32_t((1.0 - temp) * 0xFFFF);
|
|
printf("%.2f = 0x%x \n", temp, bit);
|
|
if( digi != NULL ) digi[boardID]->WriteRegister(Register::DPP::ChannelDCOffset, bit , ch);
|
|
}
|
|
|
|
|
|
|