change digi to be global variable, change TGraph in FSUDAQ to be global

This commit is contained in:
carina@hades 2022-10-26 13:23:21 -04:00
parent 02ea0c98f1
commit b1b3402227
14 changed files with 226 additions and 133 deletions

View File

@ -17,6 +17,8 @@ Digitizer::~Digitizer(){
void Digitizer::Initalization(){
data = new Data();
portID = -1;
boardID = -1;
handle = -1;
@ -27,19 +29,12 @@ void Digitizer::Initalization(){
ch2ns = 0;
BoardInfo = {};
isDummy = true;
channelMask = 0xFFFF;
VMEBaseAddress = 0;
LinkType = CAEN_DGTZ_USB; /// default USB
IOlev = CAEN_DGTZ_IOLevel_NIM; ///default NIM
AcqMode = CAEN_DGTZ_DPP_ACQ_MODE_List; ///default list mode
channelMask = 0xFFFF;
data = new Data();
isSettingFilledinMemeory = false;
settingFileName = "";
settingFileExist = false;
settingFile = NULL;
@ -47,7 +42,7 @@ void Digitizer::Initalization(){
ret = -1;
isConnected = false;
AcqRun = false;
isDummy = true;
}
void Digitizer::Reset(){
@ -242,6 +237,8 @@ int Digitizer::ProgramBoard(){
/// Set the digitizer acquisition mode (CAEN_DGTZ_SW_CONTROLLED or CAEN_DGTZ_S_IN_CONTROLLED)
ret |= CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command
CAEN_DGTZ_DPP_AcqMode_t AcqMode = CAEN_DGTZ_DPP_ACQ_MODE_List;
ret |= CAEN_DGTZ_SetDPPAcquisitionMode(handle, AcqMode, CAEN_DGTZ_DPP_SAVE_PARAM_EnergyAndTime);
/** Set the digitizer's behaviour when an external trigger arrives:

View File

@ -39,7 +39,6 @@ class Digitizer{
uint32_t VMEBaseAddress; /// For direct USB or Optical-link connection, VMEBaseAddress must be 0
CAEN_DGTZ_ConnectionType LinkType; /// USB or Optic
CAEN_DGTZ_IOLevel_t IOlev; /// TTL signal (1 = 1.5 to 5V, 0 = 0 to 0.7V ) or NIM signal (1 = -1 to -0.8V, 0 = 0V)
CAEN_DGTZ_DPP_AcqMode_t AcqMode;
///------- other parameters
int ret; /// return value, refer to CAEN_DGTZ_ErrorCode

View File

@ -52,8 +52,21 @@ long get_time(){
return time_ms;
}
///make static members
Digitizer ** MainWindow::digi = NULL;
///============= Global variable
TH1F * hEnergy[MaxNBoards][MaxNChannels] = {NULL};
TH1F * hChannel[MaxNBoards] = {NULL};
TGraph * gAnaTrace1 = NULL ;
TGraph * gAnaTrace2 = NULL ;
TGraph * gDigiTrace1 = NULL ;
TGraph * gDigiTrace2 = NULL ;
Pixel_t red, blue, green;
unsigned short nDigi;
Digitizer ** digi = NULL;
///============ static members
TGTextEdit * MainWindow::teLog = NULL;
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
TGNumberEntry * MainWindow::boardIDEntry = NULL;
@ -64,18 +77,15 @@ TGNumberEntry * MainWindow::runIDEntry = NULL;
BoardSetting * MainWindow::boardSetting = NULL;
TH1F * MainWindow::hEnergy[MaxNBoards][MaxNChannels] = {NULL};
TH1F * MainWindow::hChannel[MaxNBoards] = {NULL};
TGraph * MainWindow::gAnaTrace1 = NULL ;
TGraph * MainWindow::gAnaTrace2 = NULL ;
TGraph * MainWindow::gDigiTrace1 = NULL ;
TGraph * MainWindow::gDigiTrace2 = NULL ;
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
nDigi = 0;
gClient->GetColorByName("red", red);
gClient->GetColorByName("blue", blue);
gClient->GetColorByName("green", green);
/// Create a main frame
fMain = new TGMainFrame(p,w,h);
///fMain->SetWMPosition(500, 500); //does not work
@ -147,7 +157,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
cbMode->AddEntry("Count Hist.", Mode_CountHist);
cbMode->AddEntry("Ocsilloscope.", Mode_Oscilloscope);
cbMode->AddEntry("Data Run", Mode_DataRun);
cbMode->Select(1, false);
cbMode->Select(Mode_Oscilloscope, false);
cbMode->Resize(80, 20);
cbMode->Connect("Changed()", "MainWindow", this, "ChangePlot()");
@ -226,17 +236,25 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
LogMsg((char*)"The LogMsg is not complete for all actions. [update later]");
LogMsg((char*)"Please \"Open Digitizers\" to start.");
HandleMenu(M_DIGITIZER_OPEN);
//HandleMenu(M_DIGITIZER_OPEN);
//HandleMenu(M_BOARD_SETTINGS);
//HandleMenu(M_CH_SETTING_PHA);
//HandleMenu(M_CH_SETTING_PSD);
//HandleMenu(M_REGISTER_SETTING);
//HandleMenu(M_TRIGGER_SUMMARY);
gAnaTrace1 = new TGraph(); gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
gAnaTrace2 = new TGraph(); gAnaTrace2->SetLineColor(2);
gDigiTrace1 = new TGraph(); gDigiTrace1->SetLineColor(4);
gDigiTrace2 = new TGraph(); gDigiTrace2->SetLineColor(6);
gAnaTrace1 = new TGraph();
gAnaTrace1->SetName("Analog Trace 1");
gAnaTrace1->GetXaxis()->SetTitle("[ns]");
gAnaTrace2 = new TGraph();
gAnaTrace2->SetName("Analog Trace 2");
gAnaTrace2->SetLineColor(2);
gDigiTrace1 = new TGraph();
gDigiTrace1->SetName("Digital Trace 1");
gDigiTrace1->SetLineColor(4);
gDigiTrace2 = new TGraph();
gDigiTrace2->SetName("Digital Trace 2");
gDigiTrace2->SetLineColor(6);
gStyle->SetOptStat("neiou");
@ -265,8 +283,6 @@ MainWindow::~MainWindow() {
delete bPlotSingleTrace;
delete bFitTrace;
delete [] digi;
delete boardSetting;
delete channelSettingPHA;
delete channelSettingPSD;
@ -276,16 +292,6 @@ MainWindow::~MainWindow() {
delete fillHistThread;
delete gAnaTrace1;
delete gAnaTrace2;
delete gDigiTrace1;
delete gDigiTrace2;
for( int i = 0; i < MaxNBoards; i++){
delete hChannel[i];
for( int j = 0; j < MaxNChannels; j++) delete hEnergy[i][j];
}
/// Clean up used widgets: frames, buttons, layout hints
fMain->Cleanup();
delete fMain;
@ -314,7 +320,7 @@ void MainWindow::HandleMenu(Int_t id){
///========================= Trigger summary
case M_TRIGGER_SUMMARY: {
triggerSummary = new TriggerSummary(gClient->GetRoot(), 600, 600, digi, nDigi);
triggerSummary = new TriggerSummary(gClient->GetRoot(), 600, 600);
}break;
case M_LOAD_SETTINGS:{
@ -323,27 +329,27 @@ void MainWindow::HandleMenu(Int_t id){
///========================= Channel setting
case M_CH_SETTING_PHA:
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, 0);
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, 0);
channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
channelSettingPHA->Connect("SendPlotTraceCmd()", "MainWindow", this, "PlotSingleTrace()");
break;
case M_CH_SETTING_PSD:
channelSettingPSD = new ChannelSettingPSD(gClient->GetRoot(), 600, 600, digi, nDigi, 0);
channelSettingPSD = new ChannelSettingPSD(gClient->GetRoot(), 600, 600, 0);
channelSettingPSD->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
//channelSettingPSD->Connect("SendPlotTraceCmd()", "MainWindow", this, "PlotSingleTrace()");
break;
///========================= Board setting
case M_BOARD_SETTINGS:{
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600);
boardSetting->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
boardSetting->Connect("Haha(Int_t)", "MainWindow", this, "OpenChannelSetting(Int_t)");
}break;
///========================= Setting Summary
case M_REGISTER_SETTING:{
registerSetting = new RegisterSetting(gClient->GetRoot(), 600, 600, digi, nDigi, Register::DPP::RecordLength_G);
registerSetting = new RegisterSetting(gClient->GetRoot(), 600, 600, Register::DPP::RecordLength_G);
///registerSetting->Connect("SendChangeSignal()", "ChannelSettingPHA", this, "ChangeCh()");
///registerSetting->Connect("SendChangeSignal()", "ChannelSettingPSD", this, "ChangeCh()");
}break;
@ -544,7 +550,11 @@ void MainWindow::StopRun(){
for( int i = 0; i < nDigi; i++){
digi[i]->StopACQ();
//Save last bit of buffer
}
fillHistThread->Join();
for( int i = 0; i < nDigi; i++){
///===== clear data;
digi[i]->GetData()->ClearTriggerRate();
}
@ -569,13 +579,13 @@ void MainWindow::OpenChannelSetting(Int_t boardID){
if( digi == NULL ) return;
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, boardID);
channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
channelSettingPHA->Connect("SendPlotTraceCmd()", "MainWindow", this, "PlotSingleTrace()");
}
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ){
channelSettingPSD = new ChannelSettingPSD(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
channelSettingPSD = new ChannelSettingPSD(gClient->GetRoot(), 600, 600, boardID);
channelSettingPSD->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
//channelSettingPSD->Connect("SendPlotTraceCmd()", "MainWindow", this, "PlotSingleTrace()");
}
@ -775,6 +785,7 @@ void * MainWindow::RunThread(void * ptr){
uint32_t bdConfig = digi[boardID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
bool isDualTrace = ( bdConfig >> 11 ) & 0x1;
bool hasTrace = (bdConfig >> 16 ) & 0x1;
Data * data = digi[boardID]->GetData();
@ -813,7 +824,7 @@ void * MainWindow::RunThread(void * ptr){
fEcanvas->GetCanvas()->cd();
///Fill trace
if( cbMode->GetSelected() == Mode_Oscilloscope){
if( cbMode->GetSelected() == Mode_Oscilloscope && hasTrace){
unsigned short nData = data->NumEvents[ch];
traceLength = (data->Waveform1[ch][nData-1]).size();
@ -829,9 +840,10 @@ void * MainWindow::RunThread(void * ptr){
if( isDualTrace) gAnaTrace2->RemovePoint(i);
}
}
gAnaTrace1->Draw("AL");
///this causes warning
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
gAnaTrace1->Draw("APL");
gAnaTrace2->Draw("L");
gAnaTrace2->Draw("same L");
}
}
@ -858,7 +870,6 @@ void * MainWindow::RunThread(void * ptr){
}
fEcanvas->GetCanvas()->Update();
gSystem->ProcessEvents();
}
data->ClearData();
@ -874,5 +885,16 @@ int main(int argc, char **argv) {
TApplication theApp("App",&argc,argv);
new MainWindow(gClient->GetRoot(),800,800);
theApp.Run();
delete gAnaTrace1;
delete gAnaTrace2;
delete gDigiTrace1;
delete gDigiTrace2;
for( int i = 0; i < MaxNBoards; i++){
delete hChannel[i];
for( int j = 0; j < MaxNChannels; j++) delete hEnergy[i][j];
}
return 0;
}

View File

@ -52,11 +52,9 @@ private:
TGTextButton *bPlotSingleTrace;
TGTextButton *bFitTrace;
unsigned short nDigi;
std::vector<int> portID;
std::vector<int> boardID;
std::vector<int> serialNum;
static Digitizer ** digi;
static BoardSetting * boardSetting;
ChannelSettingPHA * channelSettingPHA;
@ -67,14 +65,6 @@ private:
TThread * fillHistThread;
static TH1F * hEnergy [MaxNBoards][MaxNChannels];
static TH1F * hChannel[MaxNBoards];
static TGraph * gAnaTrace1; /// analogy trace 1
static TGraph * gAnaTrace2; /// analogy trace 2
static TGraph * gDigiTrace1; /// digital trace 1
static TGraph * gDigiTrace2; /// digital trace 1
public:
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~MainWindow();

View File

@ -9,6 +9,7 @@
#include "boardSetting.h"
TString boardSettingName[NUM_BOARD_INFO] = { "Model",
"DPP Type",
"Link Type",
@ -20,13 +21,12 @@ TString boardSettingName[NUM_BOARD_INFO] = { "Model",
"AMC version"
};
BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){
///======== declared at FSUDAQ.cpp
extern Pixel_t red, blue, green;
extern unsigned short nDigi;
extern Digitizer ** digi;
this->nDigi = nBoard;
this->digi = digi;
gClient->GetColorByName("red", red);
gClient->GetColorByName("blue", blue);
BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h){
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Board Settings & Status");
@ -42,9 +42,9 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
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, nBoard-1);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi-1);
boardIDEntry->Connect("Modified()", "BoardSetting", this, "ChangeBoard()");
if( nBoard <= 1 ) boardIDEntry->SetState(false);
if( nDigi <= 1 ) boardIDEntry->SetState(false);
int boardID = boardIDEntry->GetNumber();
@ -621,6 +621,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
TGTextButton * bReadData = new TGTextButton(vfButton, "Read Data"); vfButton->AddFrame(bReadData, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
bReadData->Connect("Clicked()", "BoardSetting", this, "ReadData()");
TGTextButton * bCaliADC = new TGTextButton(vfButton, "Calibrate ADC"); vfButton->AddFrame(bCaliADC, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
bCaliADC->Connect("Clicked()", "ChannelSettingPHA", this, "CaliADC()");
}
TGHorizontalFrame * hRow2 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow2, new TGLayoutHints(kLHintsExpandX));
@ -1435,7 +1439,7 @@ void BoardSetting::ReadData(){
digi[boardID]->ReadData();
//data->PrintBuffer();
data->DecodeBuffer(2);
data->DecodeBuffer(false, 3);
data->PrintStat();
@ -1542,3 +1546,9 @@ void BoardSetting::FillBufferSizeTextBox(){
uint32_t buffer = digi[boardID]->CalByteForBuffer();
txtBufferSize->SetText(Form("%.2f", buffer/1024./1024.));
}
void BoardSetting::CaliADC(){
if ( digi == NULL ) return;
short boardID = boardIDEntry->GetNumber();
if( digi != NULL ) digi[boardID]->WriteRegister(Register::DPP::ADCCalibration_W, 1);
}

View File

@ -21,17 +21,12 @@ class BoardSetting{
private:
TGMainFrame * fMain;
Pixel_t red, blue;
TGNumberEntry * boardIDEntry;
TGTextEntry * entry[NUM_BOARD_INFO];
TGTextEntry * txtSettingFile;
int nDigi;
Digitizer ** digi;
/// board failure status
TGTextEntry * enPLLStatus;
TGTextEntry * enTempStatus;
@ -131,7 +126,7 @@ class BoardSetting{
public:
BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard);
BoardSetting(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~BoardSetting();
bool IsOpen() {return isOpened;}
@ -189,6 +184,7 @@ class BoardSetting{
void ProgramDefaultBoard();
void ProgramBoardFromFile();
void SaveSettingFile();
void CaliADC();
void FillBufferSizeTextBox();
};

View File

@ -10,14 +10,13 @@
#include "channelSettingPHA.h"
ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID){
///========= declared at FSUDAQ.cpp
extern Pixel_t red, blue, green;
this->digi = digi;
this->nDigi = nDigi;
extern unsigned short nDigi;
extern Digitizer ** digi;
Pixel_t red, green;
gClient->GetColorByName("red", red);
gClient->GetColorByName("green", green);
ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, int boardID){
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Channel Settings PHA");
@ -66,6 +65,27 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
int ch = chIDEntry->GetNumber();
int width = 80;
TGHorizontalFrame *hframeStatus = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframeStatus, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
{///================== Channel Status
txtSPIBus = new TGTextEntry(hframeStatus, new TGTextBuffer(1)); hframeStatus->AddFrame(txtSPIBus, new TGLayoutHints(kLHintsLeft, 5,5,0,0));
txtSPIBus->SetEnabled(false);
txtSPIBus->Resize(200, 20);
txtSPIBus->SetText( "SPI bus not busy" );
txtADCCaliStatus = new TGTextEntry(hframeStatus, new TGTextBuffer(1)); hframeStatus->AddFrame(txtADCCaliStatus, new TGLayoutHints(kLHintsLeft, 5,5,0,0));
txtADCCaliStatus->SetEnabled(false);
txtADCCaliStatus->Resize(200, 20);
txtADCCaliStatus->SetText( "ADC Calibration None" );
txtADCPowerStatus = new TGTextEntry(hframeStatus, new TGTextBuffer(1)); hframeStatus->AddFrame(txtADCPowerStatus, new TGLayoutHints(kLHintsLeft, 5,5,0,0));
txtADCPowerStatus->SetEnabled(false);
txtADCPowerStatus->Resize(300, 20);
txtADCPowerStatus->SetText( "ADC Power OK." );
}
TGHorizontalFrame *hframe1 = new TGHorizontalFrame(vframe, w, 50 ); vframe->AddFrame(hframe1, new TGLayoutHints(kLHintsCenterX, 2,2,2,2));
{///================== Input Setting
@ -391,7 +411,7 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
}
{///================== Commands Buttons
TGGroupFrame * gfCmd = new TGGroupFrame(hframe2, "Commands", kHorizontalFrame); hframe2->AddFrame(gfCmd);
TGGroupFrame * gfCmd = new TGGroupFrame(hframe2, "Commands", kHorizontalFrame); hframe2->AddFrame(gfCmd, new TGLayoutHints(kLHintsExpandY));
TGVerticalFrame * vfCmd = new TGVerticalFrame(gfCmd); gfCmd->AddFrame(vfCmd, new TGLayoutHints(kLHintsExpandX));
TGTextButton * bReadSetting = new TGTextButton(vfCmd, "Read Settings"); vfCmd->AddFrame(bReadSetting, new TGLayoutHints(kLHintsExpandX, 5,5,3,4));
@ -432,10 +452,55 @@ ChannelSettingPHA::~ChannelSettingPHA(){
isOpened = false;
delete boardIDEntry;
delete chIDEntry;
delete eTemp ;
delete txtSPIBus;
delete txtADCCaliStatus;
delete txtADCPowerStatus;
delete cbOnOff;
delete cbInputDynamicRange;
delete cbPolarity;
delete cbInputDynamicRange;
delete numRecordLength;
delete numPreTrigger;
delete numEventAgg;
delete eBuffer ;
delete numTriggerThreshold;
delete numTriggerHoldOff;
delete numDCOffset;
delete cbTriggerSmoothing;
delete numInputRiseTime;
delete numRiseTimeValidWin;
delete cbTriggerMode;
delete numTrapRiseTime;
delete numTrapFlatTop;
delete numDecay;
delete numPeaking;
delete numPeakHoldOff;
delete cbPeakMean;
delete cbBaseLineAvg;
delete numTrapScale;
delete cbDecimation;
delete cbDecimationGain;
delete cbRollOver;
delete cbPileUp;
delete cbLocalShapedTrigger;
delete cbLocalTriggerValid;
delete cbVetoSource;
delete cbTriggerCounterRate;
delete cbBaselineCal;
delete cbTagCorrelatedEvent;
delete cbBaselineOptimize;
delete cbDisableSelfTrigger;
delete cbExtra2WordOption;
/// fMain must be delete last;
fMain->Cleanup();
@ -498,13 +563,36 @@ void ChannelSettingPHA::ChangeCh(){
LogMsg(Form("Read Channel %d Setting", (int)chIDEntry->GetNumber()));
uint32_t temp = 0;
if( digi[boardID]->IsDummy() ) {
txtADCCaliStatus->SetText("No Digitizer is opened!!!", false); txtADCCaliStatus->SetTextColor(red);
}else{
temp = digi[boardID]->GetSettingFromMemory(Register::DPP::ChannelStatus_R, ch);
if( (( temp >> 2 ) & 0x1 ) == 0 ){
txtSPIBus->SetText("SPI bus is not busy.", false); txtSPIBus->SetTextColor(blue);
}else{
txtSPIBus->SetText("SPI bus is BUSY.", false); txtSPIBus->SetTextColor(red);
}
if( (( temp >> 3 ) & 0x1 ) == 0 ){
txtADCCaliStatus->SetText("ADC has not been calibrated.", false); txtADCCaliStatus->SetTextColor(red);
}else{
txtADCCaliStatus->SetText("ADC has been calibrated.", false); txtADCCaliStatus->SetTextColor(blue);
}
if( (( temp >> 8 ) & 0x1 ) == 0 ){
txtADCPowerStatus->SetText("ADC OK.", false); txtADCPowerStatus->SetTextColor(blue);
}else{
txtADCPowerStatus->SetText("ADC Power down due to over-heat.", false); txtADCPowerStatus->SetTextColor(red);
}
}
cbOnOff->Select( (digi[boardID]->GetChannelMask() >> ch) & 0x1, false); /// don't emit signal
cbInputDynamicRange->Select( digi[boardID]->GetSettingFromMemory(Register::DPP::InputDynamicRange, ch), false);
numRecordLength->SetNumber( digi[boardID]->GetSettingFromMemory(Register::DPP::RecordLength_G, ch) * 8 * ch2ns, false);
numPreTrigger->SetNumber( digi[boardID]->GetSettingFromMemory(Register::DPP::PreTrigger, ch) * 4 * ch2ns, false);
numEventAgg->SetNumber( digi[boardID]->GetSettingFromMemory(Register::DPP::NumberEventsPerAggregate_G, ch), false);
uint32_t temp = digi[boardID]->GetSettingFromMemory(Register::DPP::ChannelDCOffset, ch);
temp = digi[boardID]->GetSettingFromMemory(Register::DPP::ChannelDCOffset, ch);
numDCOffset->SetNumber( 100.0 - temp * 100.0/0xFFFF , false);
eTemp->SetText(Form("%d C", digi[boardID]->GetSettingFromMemory(Register::DPP::ChannelADCTemperature_R, ch)), false);
@ -551,6 +639,9 @@ void ChannelSettingPHA::ChangeCh(){
cbBaselineOptimize->Select( ( (temp >> 29) & 0x1), false);
cbExtra2WordOption->Select( ( (temp >> 8) & 0x7), false);
uint32_t buffer = digi[boardID]->CalByteForBuffer();
eBuffer->SetText(Form("%.2f", buffer/1024./1024.));
}
void ChannelSettingPHA::SetAllChannels(){

View File

@ -22,6 +22,10 @@ class ChannelSettingPHA{
TGTextEntry * eTemp ;
TGTextEntry * txtSPIBus;
TGTextEntry * txtADCCaliStatus;
TGTextEntry * txtADCPowerStatus;
TGComboBox * cbOnOff;
TGComboBox * cbPolarity;
TGComboBox * cbInputDynamicRange;
@ -63,8 +67,6 @@ class ChannelSettingPHA{
TGComboBox * cbDisableSelfTrigger;
TGComboBox * cbExtra2WordOption;
Digitizer ** digi;
int nDigi;
int NChannel; // hard coded = 16
bool isOpened;
@ -75,7 +77,7 @@ class ChannelSettingPHA{
void ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address);
public:
ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID);
ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, int boardID);
virtual ~ChannelSettingPHA();
void CloseWindow() { delete this; }

View File

@ -10,14 +10,11 @@
#include "channelSettingPSD.h"
ChannelSettingPSD::ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID){
extern Pixel_t red, blue, green;
extern unsigned short nDigi;
extern Digitizer ** digi;
this->digi = digi;
this->nDigi = nDigi;
Pixel_t red, green;
gClient->GetColorByName("red", red);
gClient->GetColorByName("green", green);
ChannelSettingPSD::ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, int boardID){
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Channel Settings PSD");

View File

@ -75,8 +75,6 @@ class ChannelSettingPSD{
TGComboBox * cbDisableSelfTrigger;
TGComboBox * cbExtraWordOption;
Digitizer ** digi;
int nDigi;
int NChannel; // hard coded = 16
bool isOpened;
@ -87,7 +85,7 @@ class ChannelSettingPSD{
void ChangeAStep(TGNumberEntry * numEntry, unsigned short stepSize, uint32_t address);
public:
ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nDigi, int boardID);
ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, int boardID);
virtual ~ChannelSettingPSD();
void CloseWindow() { delete this; }

View File

@ -9,10 +9,10 @@
#include "registerSetting.h"
RegisterSetting::RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address){
extern unsigned short nDigi;
extern Digitizer ** digi;
this->nDigi = nBoard;
this->digi = digi;
RegisterSetting::RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, uint32_t address){
for( int i = 0; i < MaxNChannels; i++) value[i] = 0;
@ -40,9 +40,9 @@ RegisterSetting::RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitize
boardIDEntry = new TGNumberEntry(hframe11, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframe11->AddFrame(boardIDEntry, kaka);
boardIDEntry->SetWidth(50);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nBoard-1);
boardIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, nDigi-1);
boardIDEntry->Connect("Modified()", "RegisterSetting", this, "ChangeBoard()");
if( nBoard <= 1 ) boardIDEntry->SetState(false);
if( nDigi <= 1 ) boardIDEntry->SetState(false);
boardID = boardIDEntry->GetNumber();
TGLabel * lb1 = new TGLabel(hframe11, Form("Serial Number : %03d", digi == NULL ? -1 : digi[boardID]->GetSerialNumber())); hframe11->AddFrame(lb1, new TGLayoutHints(kLHintsCenterY, 5,5,3,3));
@ -142,8 +142,6 @@ RegisterSetting::~RegisterSetting(){
delete txtValueUnit[i];
}
for( int i = 0; i < nDigi; i++ ) digi[i] = 0;
fMain->Cleanup();
delete fMain;

View File

@ -37,8 +37,6 @@ class RegisterSetting{
int textID;
int nDigi;
Digitizer ** digi;
int DPPType;
unsigned int ConvertHexToDec(const char * text);
@ -49,7 +47,7 @@ class RegisterSetting{
///static bool updateFlag;
public:
RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard, uint32_t address);
RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, uint32_t address);
virtual ~RegisterSetting();

View File

@ -9,8 +9,9 @@
#include "triggerSummary.h"
Digitizer ** TriggerSummary::digi = NULL;
int TriggerSummary::nDigi = 0;
extern unsigned short nDigi;
extern Digitizer ** digi;
bool TriggerSummary::updateFlag = true;
TGTextEntry * TriggerSummary::txtTrigger[MaxNBoards][MaxNChannels] = {NULL};
TGTextEntry * TriggerSummary::txtThresholdValue[MaxNBoards][MaxNChannels] = {NULL};
@ -19,10 +20,7 @@ TGNumberEntry * TriggerSummary::numUpdateTime = NULL;
unsigned short TriggerSummary::value[MaxNBoards][MaxNChannels] = {0};
TriggerSummary::TriggerSummary(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){
this->nDigi = nBoard;
this->digi = digi;
TriggerSummary::TriggerSummary(const TGWindow *p, UInt_t w, UInt_t h){
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Scalar Panel");

View File

@ -19,9 +19,6 @@ class TriggerSummary{
private:
TGMainFrame * fMain;
static int nDigi;
static Digitizer ** digi;
static TGTextEntry * txtTrigger[MaxNBoards][MaxNChannels];
static TGTextEntry * txtThresholdValue[MaxNBoards][MaxNChannels];
static TGTextEntry * txtThreshold[MaxNBoards][MaxNChannels];
@ -33,7 +30,7 @@ class TriggerSummary{
static unsigned short value[MaxNBoards][MaxNChannels];
public:
TriggerSummary(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard);
TriggerSummary(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~TriggerSummary();
void CloseWindow() { delete this;}