tested in test.cpp for loading setting file and program digitizer
This commit is contained in:
parent
44527bba49
commit
fcd3463c70
|
@ -357,29 +357,36 @@ void Digitizer::ReadData(){
|
||||||
//===========================================================
|
//===========================================================
|
||||||
void Digitizer::WriteRegister(uint32_t registerAddress, uint32_t value, int ch ){
|
void Digitizer::WriteRegister(uint32_t registerAddress, uint32_t value, int ch ){
|
||||||
if( !isConnected ) return;
|
if( !isConnected ) return;
|
||||||
///printf("0x%X, 0x%X=%u, ch:%d\n", registerAddress, value, value, ch);
|
//printf("0x%X, ch:%02d, 0x%X=%u\n", registerAddress, ch, value, value);
|
||||||
|
|
||||||
if( registerAddress == 0x8180){
|
if( registerAddress == 0x8180){
|
||||||
if( ch < 0 ){
|
if( ch < 0 ){
|
||||||
for( int i = 0; i < NChannel/2; i++){
|
for( int i = 0; i < NChannel/2; i++){
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + 4*i, value);
|
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + 4*i, value);
|
||||||
ReadRegister(registerAddress, i);
|
if( ret == 0 ) SetSettingToMemory(registerAddress, value, i);
|
||||||
|
///ReadRegister(registerAddress, i);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + 4*(ch/2), value);
|
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + 4*(ch/2), value);
|
||||||
ReadRegister(registerAddress, ch);
|
if( ret == 0 ) SetSettingToMemory(registerAddress, value, ch);
|
||||||
|
///ReadRegister(registerAddress, ch);
|
||||||
}
|
}
|
||||||
}else if( registerAddress < 0x8000){
|
}else if( registerAddress < 0x8000){
|
||||||
if( ch < 0 ) {
|
if( ch < 0 ) {
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + 0x7000, value);
|
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + 0x7000, value);
|
||||||
for( int i = 0; i < NChannel; i++) ReadRegister(registerAddress, i);
|
if( ret == 0 ){
|
||||||
|
for( int i = 0; i < NChannel; i++) SetSettingToMemory(registerAddress, value, i);
|
||||||
|
///for( int i = 0; i < NChannel; i++) ReadRegister(registerAddress, i);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + (ch<<8), value);
|
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress + (ch<<8), value);
|
||||||
ReadRegister(registerAddress, ch);
|
if( ret == 0 ) SetSettingToMemory(registerAddress, value, ch);
|
||||||
|
///ReadRegister(registerAddress, ch);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress, value);
|
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress, value);
|
||||||
ReadRegister(registerAddress);
|
if( ret == 0 ) SetSettingToMemory(registerAddress, value);
|
||||||
|
//ReadRegister(registerAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// for grouped address
|
/// for grouped address
|
||||||
|
@ -389,7 +396,8 @@ void Digitizer::WriteRegister(uint32_t registerAddress, uint32_t value, int ch )
|
||||||
registerAddress == Register::DPP::PSD::DPPAlgorithmControl2_G ||
|
registerAddress == Register::DPP::PSD::DPPAlgorithmControl2_G ||
|
||||||
registerAddress == Register::DPP::TriggerValidationMask_G
|
registerAddress == Register::DPP::TriggerValidationMask_G
|
||||||
){
|
){
|
||||||
ReadRegister(registerAddress, ch + (ch%2 == 1 ? -1 : +1));
|
//ReadRegister(registerAddress, ch + (ch%2 == 1 ? -1 : +1));
|
||||||
|
if( ret == 0 ) SetSettingToMemory(registerAddress, value, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorMsg("WriteRegister:" + std::to_string(registerAddress));
|
ErrorMsg("WriteRegister:" + std::to_string(registerAddress));
|
||||||
|
@ -708,6 +716,10 @@ unsigned int Digitizer::GetSettingFromMemory(uint32_t registerAddress, int ch ){
|
||||||
return setting[index] ;
|
return setting[index] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Digitizer::SetSettingFromMemory(uint32_t registerAddress, int ch){
|
||||||
|
WriteRegister(registerAddress, GetSettingFromMemory(registerAddress, ch), ch);
|
||||||
|
}
|
||||||
|
|
||||||
void Digitizer::FillAllSettings(){
|
void Digitizer::FillAllSettings(){
|
||||||
|
|
||||||
/// for 1 digitizer, 16 channels, needs 0x10XX to 0x1FXX
|
/// for 1 digitizer, 16 channels, needs 0x10XX to 0x1FXX
|
||||||
|
@ -742,6 +754,8 @@ void Digitizer::FillAllSettings(){
|
||||||
FillSetting(Register::DPP::ChannelADCTemperature_R , ch); /// 0x10A8; /// R
|
FillSetting(Register::DPP::ChannelADCTemperature_R , ch); /// 0x10A8; /// R
|
||||||
FillSetting(Register::DPP::VetoWidth , ch); /// 0x10D4; /// R/W
|
FillSetting(Register::DPP::VetoWidth , ch); /// 0x10D4; /// R/W
|
||||||
|
|
||||||
|
FillSetting(Register::DPP::TriggerValidationMask_G , ch); /// 0x8180; /// R/W, 0x8180 + 4n
|
||||||
|
|
||||||
if( DPPType == V1730_DPP_PHA_CODE ){
|
if( DPPType == V1730_DPP_PHA_CODE ){
|
||||||
FillSetting(Register::DPP::PHA::ChannelStopAcquisition , ch); /// 0x1040; /// R/W not sure
|
FillSetting(Register::DPP::PHA::ChannelStopAcquisition , ch); /// 0x1040; /// R/W not sure
|
||||||
FillSetting(Register::DPP::PHA::RCCR2SmoothingFactor , ch); /// 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor
|
FillSetting(Register::DPP::PHA::RCCR2SmoothingFactor , ch); /// 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor
|
||||||
|
@ -776,7 +790,6 @@ void Digitizer::FillAllSettings(){
|
||||||
FillSetting(Register::DPP::PSD::EarlyBaselineFreeze , ch); /// 0x10D8; /// R/W
|
FillSetting(Register::DPP::PSD::EarlyBaselineFreeze , ch); /// 0x10D8; /// R/W
|
||||||
}
|
}
|
||||||
|
|
||||||
FillSetting(Register::DPP::TriggerValidationMask_G, ch); /// 0x8180; /// R/W, 0x8180 + 4n
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FillSetting(Register::DPP::BoardConfiguration ); /// 0x8000; /// R/W
|
FillSetting(Register::DPP::BoardConfiguration ); /// 0x8000; /// R/W
|
||||||
|
@ -864,6 +877,80 @@ void Digitizer::LoadSettingBinary(string fileName){
|
||||||
}else{
|
}else{
|
||||||
settingFileExist = true;
|
settingFileExist = true;
|
||||||
size_t dummy = fread( setting, SETTINGSIZE * sizeof(unsigned int), 1, settingFile);
|
size_t dummy = fread( setting, SETTINGSIZE * sizeof(unsigned int), 1, settingFile);
|
||||||
|
|
||||||
|
if( isConnected ) {
|
||||||
|
for( int ch = 0; ch < NChannel; ch ++){
|
||||||
|
|
||||||
|
SetSettingFromMemory(Register::DPP::RecordLength_G , ch); /// 0x1020; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::InputDynamicRange , ch); /// 0x1028; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::NumberEventsPerAggregate_G , ch); /// 0x1034; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PreTrigger , ch); /// 0x1038; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::DPPAlgorithmControl , ch); /// 0x1080; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::ChannelDCOffset , ch); /// 0x1098; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::VetoWidth , ch); /// 0x10D4; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::TriggerValidationMask_G , ch); /// 0x8180; /// R/W, 0x8180 + 4n
|
||||||
|
|
||||||
|
if( DPPType == V1730_DPP_PHA_CODE ){
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::ChannelStopAcquisition , ch); /// 0x1040; /// R/W not sure
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::RCCR2SmoothingFactor , ch); /// 0x1054; /// R/W Trigger Filter smoothing, triggerSmoothingFactor
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::InputRiseTime , ch); /// 0x1058; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::TrapezoidRiseTime , ch); /// 0x105C; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::TrapezoidFlatTop , ch); /// 0x1060; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::PeakingTime , ch); /// 0x1064; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::DecayTime , ch); /// 0x1068; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::TriggerThreshold , ch); /// 0x106C; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::RiseTimeValidationWindow, ch); /// 0x1070; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::TriggerHoldOffWidth , ch); /// 0x1074; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::PeakHoldOff , ch); /// 0x1078; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::ShapedTriggerWidth , ch); /// 0x1084; /// R/W not sure
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G , ch); /// 0x10A0; /// R/W OK
|
||||||
|
SetSettingFromMemory(Register::DPP::PHA::FineGain , ch); /// 0x10C4; /// R/W OK
|
||||||
|
}
|
||||||
|
|
||||||
|
if( DPPType == V1730_DPP_PSD_CODE ){
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::CFDSetting , ch); /// 0x103C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::ChargeZeroSuppressionThreshold, ch); /// 0x1044; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::ShortGateWidth , ch); /// 0x1054; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::LongGateWidth , ch); /// 0x1058; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::GateOffset , ch); /// 0x105C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::TriggerThreshold , ch); /// 0x1060; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::FixedBaseline , ch); /// 0x1064; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::TriggerLatency , ch); /// 0x106C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::ShapedTriggerWidth , ch); /// 0x1070; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::TriggerHoldOffWidth , ch); /// 0x1074; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::ThresholdForPSDCut , ch); /// 0x1078; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::PurGapThreshold , ch); /// 0x107C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::DPPAlgorithmControl2_G , ch); /// 0x1084; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::PSD::EarlyBaselineFreeze , ch); /// 0x10D8; /// R/W
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSettingFromMemory(Register::DPP::BoardConfiguration ); /// 0x8000; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::AggregateOrganization ); /// 0x800C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::AcquisitionControl ); /// 0x8100; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::GlobalTriggerMask ); /// 0x810C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::FrontPanelTRGOUTEnableMask ); /// 0x8110; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::LVDSIOData ); /// 0x8118; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::FrontPanelIOControl ); /// 0x811C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::ChannelEnableMask ); /// 0x8120; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::VoltageLevelModeConfig ); /// 0x8138; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::AnalogMonitorMode ); /// 0x8144; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::FanSpeedControl ); /// 0x8168; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::RunStartStopDelay ); /// 0x8170; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::DisableExternalTrigger ); /// 0x817C; /// R/W
|
||||||
|
|
||||||
|
SetSettingFromMemory(Register::DPP::FrontPanelLVDSIONewFeatures ); /// 0x81A0; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::BufferOccupancyGain ); /// 0x81B4; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::ExtendedVetoDelay ); /// 0x81C4; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::ReadoutControl ); /// 0xEF00; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::BoardID ); /// 0xEF08; /// R/W /// Geo address on VME crate
|
||||||
|
SetSettingFromMemory(Register::DPP::MCSTBaseAddressAndControl ); /// 0xEF0C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::RelocationAddress ); /// 0xEF10; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::InterruptStatusID ); /// 0xEF14; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::InterruptEventNumber ); /// 0xEF18; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer); /// 0xEF1C; /// R/W
|
||||||
|
SetSettingFromMemory(Register::DPP::Scratch ); /// 0xEF20; /// R/W
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,8 @@ class Digitizer{
|
||||||
void FillAllSettings ();
|
void FillAllSettings ();
|
||||||
void PrintSettingFromMemory ();
|
void PrintSettingFromMemory ();
|
||||||
|
|
||||||
|
void SetSettingFromMemory (uint32_t registerAddress, int ch = -1);
|
||||||
|
|
||||||
void OpenSettingBinary (string fileName);
|
void OpenSettingBinary (string fileName);
|
||||||
void LoadSettingBinary (string fileName); /// load settign file to memory
|
void LoadSettingBinary (string fileName); /// load settign file to memory
|
||||||
void CreateAndSaveSettingToFile (string fileName);
|
void CreateAndSaveSettingToFile (string fileName);
|
||||||
|
|
48
FSUDAQ.cpp
48
FSUDAQ.cpp
|
@ -12,6 +12,7 @@
|
||||||
#include <TGNumberEntry.h>
|
#include <TGNumberEntry.h>
|
||||||
#include <TGraph.h>
|
#include <TGraph.h>
|
||||||
#include <TAxis.h>
|
#include <TAxis.h>
|
||||||
|
#include <TGFileDialog.h>
|
||||||
#include <TF1.h>
|
#include <TF1.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -218,11 +219,11 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
|
|
||||||
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
||||||
|
|
||||||
HandleMenu(M_DIGITIZER_OPEN);
|
//HandleMenu(M_DIGITIZER_OPEN);
|
||||||
//HandleMenu(M_BOARD_SETTINGS);
|
//HandleMenu(M_BOARD_SETTINGS);
|
||||||
//HandleMenu(M_CH_SETTING_PHA);
|
//HandleMenu(M_CH_SETTING_PHA);
|
||||||
//HandleMenu(M_CH_SETTING_PSD);
|
//HandleMenu(M_CH_SETTING_PSD);
|
||||||
HandleMenu(M_REGISTER_SETTING);
|
//HandleMenu(M_REGISTER_SETTING);
|
||||||
//HandleMenu(M_TRIGGER_SUMMARY);
|
//HandleMenu(M_TRIGGER_SUMMARY);
|
||||||
|
|
||||||
gAnaTrace1 = new TGraph();
|
gAnaTrace1 = new TGraph();
|
||||||
|
@ -263,7 +264,6 @@ MainWindow::~MainWindow() {
|
||||||
delete registerSetting;
|
delete registerSetting;
|
||||||
delete triggerSummary;
|
delete triggerSummary;
|
||||||
|
|
||||||
//delete saveDataThread;
|
|
||||||
delete fillHistThread;
|
delete fillHistThread;
|
||||||
|
|
||||||
delete gAnaTrace1;
|
delete gAnaTrace1;
|
||||||
|
@ -304,7 +304,11 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
|
|
||||||
///========================= Trigger summary
|
///========================= Trigger summary
|
||||||
case M_TRIGGER_SUMMARY: {
|
case M_TRIGGER_SUMMARY: {
|
||||||
triggerSummary = new TriggerSummary(gClient->GetRoot(), 600, 600, digi, nDigi);
|
triggerSummary = new TriggerSummary(gClient->GetRoot(), 600, 600, digi, nDigi);
|
||||||
|
}break;
|
||||||
|
|
||||||
|
case M_LOAD_SETTINGS:{
|
||||||
|
LoadSettingFromFile();
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
///========================= Channel setting
|
///========================= Channel setting
|
||||||
|
@ -357,6 +361,9 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
|
|
||||||
void MainWindow::OpenDigitizers(){
|
void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
|
/// if dig exist, say, from loading setting file without digitizer
|
||||||
|
for( int i = 0 ; i < nDigi; i++ ) delete digi[i];
|
||||||
|
|
||||||
LogMsg((char*)"============= detect digitizers");
|
LogMsg((char*)"============= detect digitizers");
|
||||||
vector<int> DPPType;
|
vector<int> DPPType;
|
||||||
DPPType.clear();
|
DPPType.clear();
|
||||||
|
@ -379,6 +386,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete dig;
|
||||||
|
|
||||||
LogMsg(Form("========== found %d digitizer(s)", nDigi));
|
LogMsg(Form("========== found %d digitizer(s)", nDigi));
|
||||||
for( int i = 0 ; i < nDigi ; i++){
|
for( int i = 0 ; i < nDigi ; i++){
|
||||||
|
@ -392,7 +400,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
printf("------------ %d \n", i);
|
printf("------------ %d \n", i);
|
||||||
digi[i] = new Digitizer(boardID[i], portID[i], false, false); // TODO basic board program
|
digi[i] = new Digitizer(boardID[i], portID[i], false, false);
|
||||||
LogMsg(Form("%2d, Serial number : %3d opened (%s, %s)", i, digi[i]->GetSerialNumber(),
|
LogMsg(Form("%2d, Serial number : %3d opened (%s, %s)", i, digi[i]->GetSerialNumber(),
|
||||||
digi[i]->GetDPPTypeString().c_str(),
|
digi[i]->GetDPPTypeString().c_str(),
|
||||||
digi[i]->GetModelName().c_str()));
|
digi[i]->GetModelName().c_str()));
|
||||||
|
@ -427,6 +435,36 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::LoadSettingFromFile(){
|
||||||
|
|
||||||
|
const char *filetypes[] = { "Setting File", "*.bin",
|
||||||
|
"ROOT files", "*.root",
|
||||||
|
"ROOT macros", "*.C",
|
||||||
|
"Text files", "*.[tT][xX][tT]",
|
||||||
|
0, 0 };
|
||||||
|
|
||||||
|
static TString dir(".");
|
||||||
|
TGFileInfo fi;
|
||||||
|
fi.fFileTypes = filetypes;
|
||||||
|
fi.SetIniDir(dir);
|
||||||
|
printf("fIniDir = %s\n", fi.fIniDir);
|
||||||
|
new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi);
|
||||||
|
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||||
|
dir = fi.fIniDir;
|
||||||
|
|
||||||
|
/// if no digitize open
|
||||||
|
if( digi == NULL ) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::ChangeBoard(){
|
void MainWindow::ChangeBoard(){
|
||||||
int boardID = boardIDEntry->GetNumber();
|
int boardID = boardIDEntry->GetNumber();
|
||||||
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, digi[boardID]->GetNChannel() -1 );
|
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, digi[boardID]->GetNChannel() -1 );
|
||||||
|
|
4
FSUDAQ.h
4
FSUDAQ.h
|
@ -63,7 +63,6 @@ private:
|
||||||
RegisterSetting * registerSetting;
|
RegisterSetting * registerSetting;
|
||||||
TriggerSummary * triggerSummary;
|
TriggerSummary * triggerSummary;
|
||||||
|
|
||||||
//TThread * saveDataThread;
|
|
||||||
TThread * fillHistThread;
|
TThread * fillHistThread;
|
||||||
|
|
||||||
static TH1F * hEnergy [MaxNBoards][MaxNChannels];
|
static TH1F * hEnergy [MaxNBoards][MaxNChannels];
|
||||||
|
@ -82,12 +81,11 @@ public:
|
||||||
|
|
||||||
void OpenDigitizers();
|
void OpenDigitizers();
|
||||||
void ChangeBoard();
|
void ChangeBoard();
|
||||||
|
void LoadSettingFromFile();
|
||||||
|
|
||||||
void StartRun();
|
void StartRun();
|
||||||
void StopRun();
|
void StopRun();
|
||||||
//static void * SaveData(void* ptr ); /// thread
|
|
||||||
|
|
||||||
//void OpenScalar();
|
|
||||||
static void * FillHistogram(void * ptr); /// thread
|
static void * FillHistogram(void * ptr); /// thread
|
||||||
|
|
||||||
void PlotSingleTrace();
|
void PlotSingleTrace();
|
||||||
|
|
|
@ -210,7 +210,9 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
|
||||||
//hRow0->
|
//hRow0->
|
||||||
|
|
||||||
TGTextButton * bProgramDefaultBoard = new TGTextButton(hRow0, "Program Default Board"); hRow0->AddFrame(bProgramDefaultBoard, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
|
TGTextButton * bProgramDefaultBoard = new TGTextButton(hRow0, "Program Default Board"); hRow0->AddFrame(bProgramDefaultBoard, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
|
||||||
bProgramDefaultBoard->Connect("Clicked()", "BoardSetting", this, "ProgramBoard()");
|
bProgramDefaultBoard->Connect("Clicked()", "BoardSetting", this, "ProgramDefaultBoard()");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TGTextButton * bUpdateStatus = new TGTextButton(hRow0, "Update Status and Settings"); hRow0->AddFrame(bUpdateStatus, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
|
TGTextButton * bUpdateStatus = new TGTextButton(hRow0, "Update Status and Settings"); hRow0->AddFrame(bUpdateStatus, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
|
||||||
bUpdateStatus->Connect("Clicked()", "BoardSetting", this, "ChangeBoard()");
|
bUpdateStatus->Connect("Clicked()", "BoardSetting", this, "ChangeBoard()");
|
||||||
|
@ -1352,7 +1354,7 @@ void BoardSetting::ReadData(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoardSetting::ProgramBoard(){
|
void BoardSetting::ProgramDefaultBoard(){
|
||||||
printf("=== %s\n", __func__);
|
printf("=== %s\n", __func__);
|
||||||
if( digi == NULL ) return;
|
if( digi == NULL ) return;
|
||||||
int boardID = boardIDEntry->GetNumber();
|
int boardID = boardIDEntry->GetNumber();
|
||||||
|
|
|
@ -174,6 +174,6 @@ class BoardSetting{
|
||||||
void Haha(Int_t boardID); // *SIGNAL*
|
void Haha(Int_t boardID); // *SIGNAL*
|
||||||
|
|
||||||
void ReadData();
|
void ReadData();
|
||||||
void ProgramBoard();
|
void ProgramDefaultBoard();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -555,8 +555,13 @@ void ChannelSettingPHA::SetAllChannels(){
|
||||||
short boardID = boardIDEntry->GetNumber();
|
short boardID = boardIDEntry->GetNumber();
|
||||||
short ch = chIDEntry->GetNumber();
|
short ch = chIDEntry->GetNumber();
|
||||||
|
|
||||||
//TODO other register
|
///use memory from this channel and set to all other channal
|
||||||
|
|
||||||
|
//digi[boardID]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
uint32_t bit = 0;
|
uint32_t bit = 0;
|
||||||
bit += numTrapScale->GetNumber();
|
bit += numTrapScale->GetNumber();
|
||||||
bit += ((cbDecimation->GetSelected() & 0x3) << 8) ;
|
bit += ((cbDecimation->GetSelected() & 0x3) << 8) ;
|
||||||
|
@ -590,7 +595,7 @@ void ChannelSettingPHA::SetAllChannels(){
|
||||||
|
|
||||||
printf(" DPP2 bit: 0x%x\n", bit);
|
printf(" DPP2 bit: 0x%x\n", bit);
|
||||||
digi[boardID]->WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, -1);
|
digi[boardID]->WriteRegister(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, -1);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelSettingPHA::SetChannelMask(){
|
void ChannelSettingPHA::SetChannelMask(){
|
||||||
|
|
|
@ -109,6 +109,14 @@ RegisterSetting::RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitize
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
{///================= Register Info
|
||||||
|
TGGroupFrame * groupInfo = new TGGroupFrame(fMain, "Register Info", kHorizontalFrame); fMain->AddFrame(groupInfo, new TGLayoutHints(kLHintsExpandX, 10,10,10,10) );
|
||||||
|
txtInfo = new TGLabel(groupInfo); groupInfo->AddFrame(txtInfo, new TGLayoutHints(kLHintsLeft, 2,2,10,0) );
|
||||||
|
//txtInfo->SetText("dsjakldjsla\nsdjakldjsajkdlsa\n");
|
||||||
|
}*/
|
||||||
|
|
||||||
fMain->MapSubwindows();
|
fMain->MapSubwindows();
|
||||||
fMain->Resize(fMain->GetDefaultSize());
|
fMain->Resize(fMain->GetDefaultSize());
|
||||||
fMain->MapWindow();
|
fMain->MapWindow();
|
||||||
|
@ -124,7 +132,9 @@ RegisterSetting::~RegisterSetting(){
|
||||||
delete txtAddress;
|
delete txtAddress;
|
||||||
delete cbName;
|
delete cbName;
|
||||||
|
|
||||||
|
delete bSetALLChannel;
|
||||||
delete lbValueUnit;
|
delete lbValueUnit;
|
||||||
|
delete txtInfo;
|
||||||
|
|
||||||
for(int i = 0; i < MaxNChannels; i++) {
|
for(int i = 0; i < MaxNChannels; i++) {
|
||||||
delete txtValueHex[i];
|
delete txtValueHex[i];
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <TGComboBox.h>
|
#include <TGComboBox.h>
|
||||||
#include <TThread.h>
|
#include <TThread.h>
|
||||||
#include <TGLabel.h>
|
#include <TGLabel.h>
|
||||||
|
#include <TGTextEdit.h>
|
||||||
#include "ClassDigitizer.h"
|
#include "ClassDigitizer.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
|
||||||
|
@ -32,6 +33,8 @@ class RegisterSetting{
|
||||||
|
|
||||||
TGLabel * lbValueUnit;
|
TGLabel * lbValueUnit;
|
||||||
|
|
||||||
|
TGLabel * txtInfo;
|
||||||
|
|
||||||
unsigned int value[MaxNChannels];
|
unsigned int value[MaxNChannels];
|
||||||
|
|
||||||
int textID;
|
int textID;
|
||||||
|
|
37
test.cpp
37
test.cpp
|
@ -81,7 +81,7 @@ long get_time(){
|
||||||
|
|
||||||
int main(int argc, char* argv[]){
|
int main(int argc, char* argv[]){
|
||||||
|
|
||||||
const int nBoard = 1;
|
const int nBoard = 2;
|
||||||
Digitizer **dig = new Digitizer *[nBoard];
|
Digitizer **dig = new Digitizer *[nBoard];
|
||||||
|
|
||||||
for( int i = 0 ; i < nBoard; i++){
|
for( int i = 0 ; i < nBoard; i++){
|
||||||
|
@ -92,13 +92,17 @@ int main(int argc, char* argv[]){
|
||||||
//dig[i]->OpenSettingBinary("setting_" + to_string(dig[i]->GetSerialNumber()) + ".bin");
|
//dig[i]->OpenSettingBinary("setting_" + to_string(dig[i]->GetSerialNumber()) + ".bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
dig[0]->Reset();
|
dig[0]->LoadSettingBinary("setting_" + to_string(dig[0]->GetSerialNumber()) + ".bin");
|
||||||
dig[0]->ProgramPHABoard();
|
|
||||||
dig[0]->WriteRegister(Register::DPP::BoardConfiguration, 0x84F8115); /// enable wave form, pileup
|
//dig[0]->Reset();
|
||||||
|
//dig[0]->ProgramPHABoard();
|
||||||
|
//dig[0]->WriteRegister(Register::DPP::BoardConfiguration, 0x84F8115); /// enable wave form, pileup
|
||||||
|
|
||||||
unsigned int waveFormLength = 2000;
|
unsigned int waveFormLength = 2000;
|
||||||
unsigned int ch2ns = (unsigned int) dig[0]->GetCh2ns();
|
unsigned int ch2ns = (unsigned int) dig[0]->GetCh2ns();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//dig[0]->WriteRegister(Register::DPP::RecordLength_G, waveFormLength/ch2ns, 0);
|
//dig[0]->WriteRegister(Register::DPP::RecordLength_G, waveFormLength/ch2ns, 0);
|
||||||
//dig[0]->WriteRegister(Register::DPP::RecordLength_G, waveFormLength/ch2ns + 10, 3);
|
//dig[0]->WriteRegister(Register::DPP::RecordLength_G, waveFormLength/ch2ns + 10, 3);
|
||||||
//dig[0]->WriteRegister(Register::DPP::DPPAlgorithmControl, 0xe30200e);
|
//dig[0]->WriteRegister(Register::DPP::DPPAlgorithmControl, 0xe30200e);
|
||||||
|
@ -106,7 +110,11 @@ int main(int argc, char* argv[]){
|
||||||
//dig[0]->WriteRegister(Register::DPP::TriggerValidationMask_G, 0x600, 3);
|
//dig[0]->WriteRegister(Register::DPP::TriggerValidationMask_G, 0x600, 3);
|
||||||
//dig[0]->WriteRegister(Register::DPP::Scratch, 0x12345678);
|
//dig[0]->WriteRegister(Register::DPP::Scratch, 0x12345678);
|
||||||
|
|
||||||
dig[0]->ReadRegister(Register::DPP::PHA::TriggerThreshold, 0, "A0");
|
for( int i = 0; i < 16; i++) printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::PHA::TriggerThreshold, i));
|
||||||
|
|
||||||
|
|
||||||
|
for( int i = 0; i < 16; i++) dig[0]->ReadRegister(Register::DPP::PHA::TriggerThreshold, i, "A0");
|
||||||
|
|
||||||
//dig[0]->ReadRegister(Register::DPP::RecordLength_G, 0, "A0");
|
//dig[0]->ReadRegister(Register::DPP::RecordLength_G, 0, "A0");
|
||||||
//dig[0]->ReadRegister(Register::DPP::RecordLength_G, 3, "A0");
|
//dig[0]->ReadRegister(Register::DPP::RecordLength_G, 3, "A0");
|
||||||
//dig[0]->ReadRegister(Register::DPP::DPPAlgorithmControl, 0, "A1");
|
//dig[0]->ReadRegister(Register::DPP::DPPAlgorithmControl, 0, "A1");
|
||||||
|
@ -115,7 +123,6 @@ int main(int argc, char* argv[]){
|
||||||
//dig[0]->ReadRegister(Register::DPP::TriggerValidationMask_G, 3, "A3");
|
//dig[0]->ReadRegister(Register::DPP::TriggerValidationMask_G, 3, "A3");
|
||||||
//dig[0]->ReadRegister(Register::DPP::Scratch);
|
//dig[0]->ReadRegister(Register::DPP::Scratch);
|
||||||
|
|
||||||
printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::PHA::TriggerThreshold, 0));
|
|
||||||
//printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::RecordLength_G, 0));
|
//printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::RecordLength_G, 0));
|
||||||
//printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::RecordLength_G, 3));
|
//printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::RecordLength_G, 3));
|
||||||
//printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, 0));
|
//printf(" ======== %u \n", dig[0]->GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, 0));
|
||||||
|
@ -134,16 +141,20 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
//dig[0]->PrintSettingFromMemory();
|
//dig[0]->PrintSettingFromMemory();
|
||||||
|
|
||||||
|
printf("============================== other dig\n");
|
||||||
|
dig[1]->LoadSettingBinary("setting_323.bin");
|
||||||
|
|
||||||
//dig[1]->LoadSettingBinary("setting_323.bin");
|
printf(" ======== %u \n", dig[1]->GetSettingFromMemory(Register::DPP::PHA::TriggerThreshold, 0));
|
||||||
//
|
printf(" ======== %u \n", dig[1]->GetSettingFromMemory(Register::DPP::RecordLength_G, 0));
|
||||||
//printf(" ======== %u \n", dig[1]->GetSettingFromMemory(Register::DPP::RecordLength_G, 0));
|
printf(" ======== %u \n", dig[1]->GetSettingFromMemory(Register::DPP::RecordLength_G, 3));
|
||||||
//printf(" ======== %u \n", dig[1]->GetSettingFromMemory(Register::DPP::RecordLength_G, 3));
|
|
||||||
//
|
|
||||||
//printf("////// %u \n", dig[1]->ReadSettingFromFile(Register::DPP::RecordLength_G, 0));
|
|
||||||
//printf("////// %u \n", dig[1]->ReadSettingFromFile(Register::DPP::RecordLength_G, 3));
|
|
||||||
|
|
||||||
|
printf("////// %u \n", dig[1]->ReadSettingFromFile(Register::DPP::PHA::TriggerThreshold, 0));
|
||||||
|
printf("////// %u \n", dig[1]->ReadSettingFromFile(Register::DPP::RecordLength_G, 0));
|
||||||
|
printf("////// %u \n", dig[1]->ReadSettingFromFile(Register::DPP::RecordLength_G, 3));
|
||||||
|
|
||||||
|
for( int i = 0; i < 16 ; i++){
|
||||||
|
dig[1]->SaveSettingToFile(Register::DPP::PHA::TriggerThreshold, 1000*i + 123, i);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
///============================ Get Data
|
///============================ Get Data
|
||||||
TApplication * app = new TApplication("app", &argc, argv);
|
TApplication * app = new TApplication("app", &argc, argv);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user