testing with digitizers
This commit is contained in:
parent
995b19a262
commit
f8ddccdac8
|
@ -1,6 +1,20 @@
|
|||
#include "ClassDigitizer.h"
|
||||
|
||||
Digitizer::Digitizer(){
|
||||
Initalization();
|
||||
}
|
||||
|
||||
Digitizer::Digitizer(int boardID, int portID, bool program, bool verbose){
|
||||
Initalization();
|
||||
OpenDigitizer(boardID, portID, program, verbose);
|
||||
}
|
||||
|
||||
Digitizer::~Digitizer(){
|
||||
delete data;
|
||||
CloseDigitizer();
|
||||
}
|
||||
|
||||
void Digitizer::Initalization(){
|
||||
|
||||
portID = -1;
|
||||
boardID = -1;
|
||||
|
@ -8,6 +22,7 @@ Digitizer::Digitizer(){
|
|||
NChannel = 0;
|
||||
ADCbits = 1;
|
||||
DPPType = 0;
|
||||
DPPTypeStr = "";
|
||||
ADCFullSize = 0;
|
||||
ch2ns = 0;
|
||||
BoardInfo = {};
|
||||
|
@ -31,17 +46,6 @@ Digitizer::Digitizer(){
|
|||
|
||||
}
|
||||
|
||||
Digitizer::Digitizer(int boardID, int portID, bool verbose){
|
||||
Digitizer();
|
||||
OpenDigitizer(boardID, portID, true, verbose);
|
||||
}
|
||||
|
||||
Digitizer::~Digitizer(){
|
||||
CloseDigitizer();
|
||||
|
||||
delete data;
|
||||
}
|
||||
|
||||
void Digitizer::Reset(){
|
||||
ret = CAEN_DGTZ_Reset(handle);
|
||||
if( ret != 0 ) ErrorMsg("Reset");
|
||||
|
@ -106,23 +110,22 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
|
|||
|
||||
///====================== Check DPP firmware revision
|
||||
sscanf(BoardInfo.AMC_FirmwareRel, "%d", &DPPType);
|
||||
switch (DPPType){
|
||||
case V1724_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x724"; break;
|
||||
case V1720_DPP_CI_CODE : DPPTypeStr = "DPP-CI x720"; break;
|
||||
case V1720_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x720"; break;
|
||||
case V1751_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x751"; break;
|
||||
case V1751_DPP_ZLE_CODE: DPPTypeStr = "DPP-ZLE x751"; break;
|
||||
case V1743_DPP_CI_CODE: DPPTypeStr = "DPP-PSD x743"; break;
|
||||
case V1740_DPP_QDC_CODE: DPPTypeStr = "DPP-QDC x740"; break;
|
||||
case V1730_DPP_PSD_CODE: DPPTypeStr = "DPP-PSD x730"; break;
|
||||
case V1730_DPP_PHA_CODE: DPPTypeStr = "DPP-PHA x730"; break;
|
||||
case V1730_DPP_ZLE_CODE: DPPTypeStr = "DPP-ZLE x730"; break;
|
||||
case V1730_DPP_DAW_CODE: DPPTypeStr = "DPP-DAW x730"; break;
|
||||
}
|
||||
if (DPPType >= 0x80 && verbose) {
|
||||
printf("\t==== This digitizer has a DPP firmware!\n");
|
||||
printf("\e[32m");
|
||||
switch (DPPType){
|
||||
case V1724_DPP_PHA_CODE: printf("\tDPP-PHA for x724 boards \n"); break;
|
||||
case V1720_DPP_CI_CODE : printf("\tDPP-CI for x720 boards \n"); break;
|
||||
case V1720_DPP_PSD_CODE: printf("\tDPP-PSD for x720 boards \n"); break;
|
||||
case V1751_DPP_PSD_CODE: printf("\tDPP-PSD for x751 boards \n"); break;
|
||||
case V1751_DPP_ZLE_CODE: printf("\tDPP-ZLE for x751 boards \n"); break;
|
||||
case V1743_DPP_CI_CODE: printf("\tDPP-PSD for x743 boards \n"); break;
|
||||
case V1740_DPP_QDC_CODE: printf("\tDPP-QDC for x740 boards \n"); break;
|
||||
case V1730_DPP_PSD_CODE: printf("\tDPP-PSD for x730 boards \n"); break;
|
||||
case V1730_DPP_PHA_CODE: printf("\tDPP-PHA for x730 boards \n"); break;
|
||||
case V1730_DPP_ZLE_CODE: printf("\tDPP-ZLE for x730 boards \n"); break;
|
||||
case V1730_DPP_DAW_CODE: printf("\tDPP-DAW for x730 boards \n"); break;
|
||||
}
|
||||
printf("\e[0m");
|
||||
printf("\e[32m\t %s \e[0m", DPPTypeStr.c_str());
|
||||
}
|
||||
|
||||
///======================= Check virtual probe
|
||||
|
@ -187,8 +190,6 @@ int Digitizer::CloseDigitizer(){
|
|||
ret = CAEN_DGTZ_SWStopAcquisition(handle);
|
||||
ret |= CAEN_DGTZ_CloseDigitizer(handle);
|
||||
|
||||
//data->FreeMemory();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -356,19 +357,19 @@ void Digitizer::WriteRegister(uint32_t address, uint32_t value, int ch ){
|
|||
|
||||
uint32_t Digitizer::ReadRegister(uint32_t address, int ch, string str ){
|
||||
if( !isConnected ) return 0;
|
||||
uint32_t * Data = new uint32_t[NChannel];
|
||||
uint32_t * data = new uint32_t[NChannel];
|
||||
if( address < 0x8000) {
|
||||
if( ch < 0 ) {
|
||||
ret = CAEN_DGTZ_ReadRegister(handle, address + 0x7000, Data);
|
||||
ret = CAEN_DGTZ_ReadRegister(handle, address + 0x7000, data);
|
||||
}else{
|
||||
ret = CAEN_DGTZ_ReadRegister(handle, address + (ch << 8), Data);
|
||||
ret = CAEN_DGTZ_ReadRegister(handle, address + (ch << 8), data);
|
||||
}
|
||||
}else{
|
||||
ret = CAEN_DGTZ_ReadRegister(handle, address, Data);
|
||||
ret = CAEN_DGTZ_ReadRegister(handle, address, data);
|
||||
}
|
||||
ErrorMsg("ReadRegister:" + std::to_string(address));
|
||||
if( str != "" ) printf("%s : 0x%x \n", str.c_str(), Data[0]);
|
||||
return Data[0];
|
||||
if( str != "" ) printf("%s : 0x%08x \n", str.c_str(), data[0]);
|
||||
return data[0];
|
||||
}
|
||||
|
||||
void Digitizer::SetChannelMask(uint32_t mask){
|
||||
|
@ -534,7 +535,7 @@ uint32_t Digitizer::PrintRegister(uint32_t address, std::string msg){
|
|||
printf("----------------------------------------------------\e[0m\n");
|
||||
|
||||
uint32_t * value = new uint32_t[1];
|
||||
CAEN_DGTZ_ReadRegister(handle, (uint32_t) Register::BoardConfiguration, value);
|
||||
CAEN_DGTZ_ReadRegister(handle, address, value);
|
||||
printf(" %*s 32 28 24 20 16 12 8 4 0\n", (int) msg.length(), "");
|
||||
printf(" %*s | | | | | | | | |\n", (int) msg.length(), "");
|
||||
printf(" %*s", (int) msg.length(), "");
|
||||
|
@ -640,7 +641,7 @@ void Digitizer::CreateAndSaveSettingBinary(string fileName){
|
|||
SaveSettingEditByteByRegister(Register::DPP::AMCFirmwareRevision, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::VetoWidth, ch);
|
||||
|
||||
if( DPPType == 0x8B ) { /// DPP-PHA
|
||||
if( DPPType == V1730_DPP_PHA_CODE ) { /// DPP-PHA
|
||||
SaveSettingEditByteByRegister(Register::DPP::PHA::TriggerThreshold, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PHA::RCCR2SmoothingFactor, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PHA::RiseTimeValidationWindow, ch);
|
||||
|
@ -657,6 +658,24 @@ void Digitizer::CreateAndSaveSettingBinary(string fileName){
|
|||
SaveSettingEditByteByRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PHA::FineGain, ch);
|
||||
}
|
||||
|
||||
if( DPPType == V1730_DPP_PSD_CODE ) { /// DPP-PSD
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::CFDSetting, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::ForcedDataFlush, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::ChargeZeroSuppressionThreshold, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::ShortGateWidth, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::LongGateWidth, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::GateOffset, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::TriggerThreshold, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::FixedBaseline, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::TriggerLatency, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::ShapedTriggerWidth, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::TriggerHoldOffWidth, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::ThresholdForPSDCut, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::PurGapThreshold, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::DPPAlgorithmControl2_G, ch);
|
||||
SaveSettingEditByteByRegister(Register::DPP::PSD::EarlyBaselineFreeze, ch);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ class Digitizer{
|
|||
|
||||
public:
|
||||
Digitizer();
|
||||
Digitizer(int boardID, int portID = 0, bool verbose = false);
|
||||
Digitizer(int boardID, int portID = 0, bool program = false, bool verbose = false);
|
||||
~Digitizer();
|
||||
|
||||
|
||||
void Initalization();
|
||||
void Reset();
|
||||
int OpenDigitizer(int boardID, int portID = 0, bool program = false, bool verbose = false);/// portID is for optical link for using PCIe card, from 0, 1, 2, 3
|
||||
int CloseDigitizer();
|
||||
|
@ -70,6 +70,7 @@ class Digitizer{
|
|||
int GetHandle() {return handle;}
|
||||
bool GetConnectionStatus() {return isConnected;}
|
||||
int GetDPPType() {return DPPType;}
|
||||
std::string GetDPPTypeString() {return DPPTypeStr;}
|
||||
CAEN_DGTZ_ConnectionType GetLinkType() {return LinkType;}
|
||||
int GetADCBits() {return BoardInfo.ADC_NBits;}
|
||||
std::string GetROCVersion() {return BoardInfo.ROC_FirmwareRel;}
|
||||
|
@ -126,6 +127,7 @@ class Digitizer{
|
|||
int NChannel; /// number of channel
|
||||
int ADCbits; /// ADC bit
|
||||
int DPPType; /// DPP verion
|
||||
std::string DPPTypeStr; /// DPP type in string
|
||||
unsigned int ADCFullSize; /// pow(2, ADCbits) - 1
|
||||
float ch2ns; /// channel to ns
|
||||
CAEN_DGTZ_BoardInfo_t BoardInfo;
|
||||
|
|
|
@ -5,6 +5,8 @@ DigitizerPHA::DigitizerPHA(){
|
|||
}
|
||||
|
||||
DigitizerPHA::DigitizerPHA(int boardID, int portID, bool verbose){
|
||||
Initalization();
|
||||
DPPType = V1730_DPP_PHA_CODE;
|
||||
OpenDigitizer(boardID, portID, true, verbose);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ DigitizerPSD::DigitizerPSD(){
|
|||
}
|
||||
|
||||
DigitizerPSD::DigitizerPSD(int boardID, int portID){
|
||||
OpenDigitizer(boardID, portID);
|
||||
Initalization();
|
||||
DPPType = V1730_DPP_PSD_CODE;
|
||||
OpenDigitizer(boardID, portID, true, false);
|
||||
}
|
||||
|
||||
DigitizerPSD::~DigitizerPSD(){
|
||||
|
|
47
FSUDAQ.cpp
47
FSUDAQ.cpp
|
@ -88,7 +88,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
|
||||
|
||||
///================= Open digitizers
|
||||
TGTextButton *bOpenDigitizers = new TGTextButton(hframe,"Open Digitizers");
|
||||
bOpenDigitizers = new TGTextButton(hframe,"Open Digitizers");
|
||||
bOpenDigitizers->Connect("Clicked()","MainWindow",this,"OpenDigitizers()");
|
||||
hframe->AddFrame(bOpenDigitizers, uniLayoutHints);
|
||||
|
||||
|
@ -140,7 +140,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
//
|
||||
//HandleMenu(M_BOARD_SETTINGS);
|
||||
//HandleMenu(M_CH_SETTING_PHA);
|
||||
HandleMenu(M_CH_SETTING_PSD);
|
||||
//HandleMenu(M_CH_SETTING_PSD);
|
||||
|
||||
}
|
||||
MainWindow::~MainWindow() {
|
||||
|
@ -214,16 +214,9 @@ void MainWindow::HandleMenu(Int_t id){
|
|||
|
||||
///========================= Board setting
|
||||
case M_BOARD_SETTINGS:{
|
||||
if( boardSetting == NULL ) {
|
||||
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
|
||||
boardSetting->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
|
||||
boardSetting->Connect("Haha(Int_t)", "MainWindow", this, "OpenChannelSetting(Int_t)");
|
||||
}else{
|
||||
if ( boardSetting->IsOpen() == false ){
|
||||
boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi);
|
||||
//boardSetting->Connect("BdLogMsg(TString)", "MainWindow", this, "LogMsg(TString)");
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
///========================= Program setting
|
||||
|
@ -287,27 +280,19 @@ void MainWindow::OpenDigitizers(){
|
|||
|
||||
digi = new Digitizer * [nDigi];
|
||||
|
||||
//pha = new DigitizerPHA * [nPHA];
|
||||
//psd = new DigitizerPHA * [nPSD];
|
||||
//
|
||||
//iPHA = 0;
|
||||
//iPSD = 0;
|
||||
|
||||
for( int i = 0; i < nDigi; i++){
|
||||
printf("------------ %d \n", i);
|
||||
if( DPPType[i] == V1730_DPP_PSD_CODE ) {
|
||||
digi[i] = new DigitizerPSD(boardID[i], portID[i]);
|
||||
printf("Open as PSD\n");
|
||||
}else if( DPPType[i] == V1730_DPP_PHA_CODE ){
|
||||
digi[i] = new DigitizerPHA(boardID[i], portID[i]);
|
||||
printf("Open as PHA\n");
|
||||
}else{
|
||||
digi[i] = new Digitizer(boardID[i], portID[i]);
|
||||
printf("Open as Ordinary Digitizer\n");
|
||||
}
|
||||
digi[i] = new Digitizer(boardID[i], portID[i], false, false); // TODO basic board program
|
||||
LogMsg(Form("%2d, Serial number : %3d opened (%s, %s)", i, digi[i]->GetSerialNumber(),
|
||||
digi[i]->GetDPPTypeString().c_str(),
|
||||
digi[i]->GetModelName().c_str()));
|
||||
|
||||
digi[i]->CreateAndSaveSettingBinary("setting_" + to_string(digi[i]->GetSerialNumber()) + ".bin");
|
||||
}
|
||||
|
||||
fMenuDigitizers->DisableEntry( M_DIGITIZER_OPEN);
|
||||
bOpenDigitizers->SetEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -341,15 +326,15 @@ void MainWindow::OpenChannelSetting(Int_t boardID){
|
|||
|
||||
printf("#### %s \n", __func__);
|
||||
|
||||
//if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||
// channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
|
||||
// channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
|
||||
//}
|
||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||
channelSettingPHA = new ChannelSettingPHA(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
|
||||
channelSettingPHA->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
|
||||
}
|
||||
|
||||
//if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ){
|
||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ){
|
||||
channelSettingPSD = new ChannelSettingPSD(gClient->GetRoot(), 600, 600, digi, nDigi, boardID);
|
||||
channelSettingPSD->Connect("LogMsg(char*)", "MainWindow", this, "LogMsg(char*)");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::LogMsg(char * msg){
|
||||
|
|
2
FSUDAQ.h
2
FSUDAQ.h
|
@ -45,6 +45,8 @@ private:
|
|||
//TGTextButton *bStopRun;
|
||||
//TGTextButton *bFitTrace;
|
||||
|
||||
TGTextButton *bOpenDigitizers;
|
||||
|
||||
unsigned short nDigi;
|
||||
vector<int> DPPType;
|
||||
vector<int> portID;
|
||||
|
|
103
boardSetting.cpp
103
boardSetting.cpp
|
@ -20,31 +20,6 @@ TString boardSettingName[NUM_BOARD_INFO] = { "Model",
|
|||
"AMC version"
|
||||
};
|
||||
|
||||
Pixel_t BoardSetting::red = 0;
|
||||
Pixel_t BoardSetting::blue = 0;
|
||||
|
||||
TGNumberEntry * BoardSetting::boardIDEntry = NULL;
|
||||
Digitizer ** BoardSetting::digi = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQStatus = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQEventReady = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQEventFull = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQClockSource = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQPLLLock = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQChDown = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQSIN = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQTRIGIN = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQBoardReady = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQTemp0 = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQTemp1 = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQTemp2 = NULL;
|
||||
TGTextEntry * BoardSetting::txtACQTemp3 = NULL;
|
||||
|
||||
TGTextEntry * BoardSetting::txtEventReady = NULL;
|
||||
TGTextEntry * BoardSetting::txtBusError = NULL;
|
||||
TGTextEntry * BoardSetting::txtVMEFIFO = NULL;
|
||||
|
||||
bool BoardSetting::isOpened = false;
|
||||
|
||||
BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){
|
||||
|
||||
this->nDigi = nBoard;
|
||||
|
@ -235,6 +210,11 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
|
|||
bOpenChannelSetting->SetHeight(40);
|
||||
bOpenChannelSetting->Connect("Clicked()", "BoardSetting", this, "OpenChannelSetting()");
|
||||
|
||||
TGTextButton * bUpdateStatus = new TGTextButton(hRow0, "Update Status"); hRow0->AddFrame(bUpdateStatus, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
|
||||
bUpdateStatus->SetHeight(40);
|
||||
bUpdateStatus->Connect("Clicked()", "BoardSetting", this, "ReadStatus()");
|
||||
|
||||
|
||||
TGHorizontalFrame * hRow1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow1, new TGLayoutHints( kLHintsExpandX));
|
||||
|
||||
{///========= Board Configure
|
||||
|
@ -420,8 +400,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
|
|||
bSWClockSync->Connect("Clicked()", "BoardSetting", this, "SendSoftwareClockSyncSignal()");
|
||||
bSWClockSync->Resize(250, 20);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
{///========= Trigger Configure
|
||||
|
@ -694,10 +672,8 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
|
|||
isOpened = true;
|
||||
|
||||
///Setup thread
|
||||
readStatusThread = new TThread("readStatus", ReadStatus, (void *) 1);
|
||||
if( digi != NULL ) readStatusThread->Run();
|
||||
|
||||
isOpened = true;
|
||||
///readStatusThread = new TThread("readStatus", ReadStatus, (void *) 1);
|
||||
///if( digi != NULL ) readStatusThread->Run();
|
||||
}
|
||||
|
||||
BoardSetting::~BoardSetting(){
|
||||
|
@ -706,10 +682,10 @@ BoardSetting::~BoardSetting(){
|
|||
|
||||
printf("close BoardSetting window\n");
|
||||
|
||||
for( int i = 0; i < nDigi; i++) digi[i] = 0;
|
||||
|
||||
//for( int i = 0; i < nDigi; i++) digi[i] = 0;
|
||||
//pha = 0;
|
||||
//psd = 0;
|
||||
//delete readStatusThread;
|
||||
|
||||
fMain->Cleanup();
|
||||
delete fMain;
|
||||
|
@ -720,21 +696,13 @@ void BoardSetting::LogMsg(TString msg){
|
|||
Emit("LogMsg(char*)", msg.Data());
|
||||
}
|
||||
|
||||
void * BoardSetting::ReadStatus(void * ptr){
|
||||
if( digi == NULL ) return 0;
|
||||
void BoardSetting::ReadStatus(){
|
||||
if( digi == NULL ) return;
|
||||
|
||||
int pauseTime = 1000; /// msec
|
||||
int boardID = boardIDEntry->GetNumber();
|
||||
|
||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) {
|
||||
|
||||
//pha = dynamic_cast<DigitizerPHA*> (digi[boardID]);
|
||||
|
||||
//while( digi[boardID]->isACQRunning() == false ){
|
||||
while( isOpened ){
|
||||
|
||||
printf("=========== %s for PHA\n", __func__);
|
||||
/// ACQ Status
|
||||
digi[boardID]->PrintRegister(Register::DPP::AcquisitionStatus, "ACQ Status");
|
||||
uint32_t temp = digi[boardID]->ReadRegister(Register::DPP::AcquisitionStatus);
|
||||
|
||||
txtACQStatus ->SetText( ((temp >> 2) & 0x1) == 0 ? "ACQ is stopped" : "ACQ is Running", false); txtACQStatus->SetTextColor( ((temp >> 2) & 0x1) == 0 ? 1 : blue);
|
||||
|
@ -755,6 +723,7 @@ void * BoardSetting::ReadStatus(void * ptr){
|
|||
txtACQTemp3->SetText( ((temp >> 23) & 0x1) == 0 ? "< 70" : "> 70", false); txtACQTemp3->SetTextColor( ((temp >> 23) & 0x1) == 0 ? 1 : red);
|
||||
|
||||
/// Redaout Status
|
||||
digi[boardID]->PrintRegister(Register::DPP::ReadoutStatus, "Readout Status");
|
||||
temp = digi[boardID]->ReadRegister(Register::DPP::ReadoutStatus);
|
||||
if( (temp & 0x1) == 1 ){
|
||||
txtEventReady->SetText( "Event Ready" , false); txtEventReady->SetTextColor(blue);
|
||||
|
@ -774,10 +743,27 @@ void * BoardSetting::ReadStatus(void * ptr){
|
|||
txtVMEFIFO->SetText( "VME FIFO EMPTY", false ); txtVMEFIFO->SetTextColor(red);
|
||||
}
|
||||
|
||||
usleep(pauseTime*1000);
|
||||
///================ Board Failure Status
|
||||
digi[boardID]->PrintRegister(Register::DPP::BoardFailureStatus, "Board Fail");
|
||||
temp = digi[boardID]->ReadRegister(Register::DPP::BoardFailureStatus, -1, "Board Fail");
|
||||
if( ((temp >> 4) & 0x1) == 0 ) {
|
||||
enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1);
|
||||
}else{
|
||||
enPLLStatus->SetText( "Lost Lock" , false); enPLLStatus->SetTextColor(red);
|
||||
}
|
||||
|
||||
if( ((temp >> 5) & 0x1) == 0 ) {
|
||||
enTempStatus->SetText( "OK" , false); enTempStatus->SetTextColor(1);
|
||||
}else{
|
||||
enTempStatus->SetText( "Failure" , false); enTempStatus->SetTextColor(red);
|
||||
}
|
||||
|
||||
if( ((temp >> 6) & 0x1) == 0 ) {
|
||||
enADCPwrStatus->SetText( "OK", false); enADCPwrStatus->SetTextColor(1);
|
||||
}else{
|
||||
enADCPwrStatus->SetText( "Failure", false); enADCPwrStatus->SetTextColor(red);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BoardSetting::ChangeBoard(){
|
||||
|
@ -789,7 +775,6 @@ void BoardSetting::ChangeBoard(){
|
|||
}
|
||||
|
||||
int boardID = boardIDEntry->GetNumber();
|
||||
digi[boardID]->PrintBoard();
|
||||
|
||||
for( int i = 0; i < NUM_BOARD_INFO; i++){
|
||||
switch (i) {
|
||||
|
@ -821,28 +806,6 @@ void BoardSetting::ChangeBoard(){
|
|||
}
|
||||
}
|
||||
|
||||
///================ Board Failure Status
|
||||
unsigned int tempBits;
|
||||
|
||||
tempBits = digi[boardID]->ReadRegister(Register::BoardFailureStatus);
|
||||
if( (tempBits & 0x10) == 0 ) {
|
||||
enPLLStatus->SetText( "OK" , false); enPLLStatus->SetTextColor(1);
|
||||
}else{
|
||||
enPLLStatus->SetText( "Lost Lock" , false); enPLLStatus->SetTextColor(red);
|
||||
}
|
||||
|
||||
if( (tempBits & 0x20) == 0 ) {
|
||||
enTempStatus->SetText( "OK (<70)" , false); enTempStatus->SetTextColor(1);
|
||||
}else{
|
||||
enTempStatus->SetText( "Failure" , false); enTempStatus->SetTextColor(red);
|
||||
}
|
||||
|
||||
if( (tempBits & 0x40) == 0 ) {
|
||||
enADCPwrStatus->SetText( "OK", false); enADCPwrStatus->SetTextColor(1);
|
||||
}else{
|
||||
enADCPwrStatus->SetText( "Failure", false); enADCPwrStatus->SetTextColor(red);
|
||||
}
|
||||
|
||||
cbAggOrg->Select( digi[boardID]->ReadRegister(Register::DPP::AggregateOrganization) , false);
|
||||
numAggBLT->SetNumber( digi[boardID]->ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer) , false);
|
||||
cbFanCtrl->Select( digi[boardID]->ReadRegister(Register::DPP::FanSpeedControl) , false);
|
||||
|
@ -853,9 +816,11 @@ void BoardSetting::ChangeBoard(){
|
|||
cbAnaMonitor->Select( digi[boardID]->ReadRegister(Register::DPP::AnalogMonitorMode) & 0x7 , false);
|
||||
numBufferOccpGain->SetNumber( digi[boardID]->ReadRegister(Register::DPP::BufferOccupancyGain) & 0xf, false);
|
||||
|
||||
ReadStatus();
|
||||
|
||||
/// ACQ Control
|
||||
//digi[boardID]->PrintRegister(Register::DPP::AcquisitionControl, "AcquisitionControl");
|
||||
tempBits = digi[boardID]->ReadRegister(Register::DPP::AcquisitionControl);
|
||||
uint32_t tempBits = digi[boardID]->ReadRegister(Register::DPP::AcquisitionControl);
|
||||
cbAcqMode->Select( tempBits & 0x3 , false);
|
||||
bAcqArm->SetState( ((tempBits >> 2) & 0x1) ? kButtonDown : kButtonUp, false);
|
||||
cbPLLref->Select( ((tempBits >> 6) & 0x1), false);
|
||||
|
|
|
@ -22,14 +22,14 @@ class BoardSetting{
|
|||
private:
|
||||
TGMainFrame * fMain;
|
||||
|
||||
static Pixel_t red, blue;
|
||||
Pixel_t red, blue;
|
||||
|
||||
static TGNumberEntry * boardIDEntry;
|
||||
TGNumberEntry * boardIDEntry;
|
||||
|
||||
TGTextEntry * entry[NUM_BOARD_INFO];
|
||||
|
||||
int nDigi;
|
||||
static Digitizer ** digi;
|
||||
Digitizer ** digi;
|
||||
|
||||
/// board failure status
|
||||
TGTextEntry * enPLLStatus;
|
||||
|
@ -61,19 +61,19 @@ class BoardSetting{
|
|||
TGNumberEntry * numRunStartStopDelay;
|
||||
|
||||
/// ACQ Status
|
||||
static TGTextEntry * txtACQStatus;
|
||||
static TGTextEntry * txtACQEventReady;
|
||||
static TGTextEntry * txtACQEventFull;
|
||||
static TGTextEntry * txtACQClockSource;
|
||||
static TGTextEntry * txtACQPLLLock;
|
||||
static TGTextEntry * txtACQChDown;
|
||||
static TGTextEntry * txtACQSIN;
|
||||
static TGTextEntry * txtACQTRIGIN;
|
||||
static TGTextEntry * txtACQBoardReady;
|
||||
static TGTextEntry * txtACQTemp0;
|
||||
static TGTextEntry * txtACQTemp1;
|
||||
static TGTextEntry * txtACQTemp2;
|
||||
static TGTextEntry * txtACQTemp3;
|
||||
TGTextEntry * txtACQStatus;
|
||||
TGTextEntry * txtACQEventReady;
|
||||
TGTextEntry * txtACQEventFull;
|
||||
TGTextEntry * txtACQClockSource;
|
||||
TGTextEntry * txtACQPLLLock;
|
||||
TGTextEntry * txtACQChDown;
|
||||
TGTextEntry * txtACQSIN;
|
||||
TGTextEntry * txtACQTRIGIN;
|
||||
TGTextEntry * txtACQBoardReady;
|
||||
TGTextEntry * txtACQTemp0;
|
||||
TGTextEntry * txtACQTemp1;
|
||||
TGTextEntry * txtACQTemp2;
|
||||
TGTextEntry * txtACQTemp3;
|
||||
|
||||
/// Trigger control
|
||||
TGCheckButton * cbGbTRGMskCh[8];
|
||||
|
@ -118,13 +118,12 @@ class BoardSetting{
|
|||
TGCheckButton * bEnableExtendedBlockTransfer;
|
||||
|
||||
/// Redaout Status
|
||||
static TGTextEntry * txtEventReady;
|
||||
static TGTextEntry * txtBusError;
|
||||
static TGTextEntry * txtVMEFIFO;
|
||||
TGTextEntry * txtEventReady;
|
||||
TGTextEntry * txtBusError;
|
||||
TGTextEntry * txtVMEFIFO;
|
||||
|
||||
bool isOpened;
|
||||
|
||||
TThread * readStatusThread;
|
||||
static bool isOpened;
|
||||
static void * ReadStatus(void * ptr); /// thread.
|
||||
|
||||
public:
|
||||
BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard);
|
||||
|
@ -134,12 +133,14 @@ class BoardSetting{
|
|||
void CloseWindow() { delete this;}
|
||||
void ChangeBoard();
|
||||
|
||||
|
||||
void ReadStatus();
|
||||
|
||||
///=== Button
|
||||
void ResetSettingToDefault();
|
||||
void ClearBuffer();
|
||||
void OpenChannelSetting();
|
||||
|
||||
|
||||
///=== Board Configure
|
||||
void SetBoardConfiguration();
|
||||
|
||||
|
|
8
test.cpp
8
test.cpp
|
@ -5,18 +5,22 @@
|
|||
|
||||
int main(int argc, char* argv[]){
|
||||
|
||||
|
||||
|
||||
/**************/
|
||||
const int nBoard = 1;
|
||||
|
||||
const int nBoard = 3;
|
||||
Digitizer **dig = new Digitizer *[nBoard];
|
||||
|
||||
for( int i = 0 ; i < nBoard; i++){
|
||||
int board = i % 3;
|
||||
int port = i/3;
|
||||
dig[i] = new DigitizerPHA(board, port, true);
|
||||
dig[i] = new Digitizer(board, port, false, true);
|
||||
dig[i]->CreateAndSaveSettingBinary("setting_" + to_string(dig[i]->GetSerialNumber()) + ".bin");
|
||||
//dig[i].OpenSettingBinary("setting_" + to_string(dig[i].GetSerialNumber()) + ".bin");
|
||||
}
|
||||
|
||||
/*
|
||||
DigitizerPHA * pha = dynamic_cast<DigitizerPHA*> (dig[0]);
|
||||
pha->ProgramBoard();
|
||||
pha->PrintBoardConfiguration();
|
||||
|
|
Loading…
Reference in New Issue
Block a user