can change Sych_wait InSych, and Slow Filter Range in Module setting

This commit is contained in:
Ryan Tang 2022-04-01 15:14:11 -04:00
parent f761936958
commit 114a24d076
9 changed files with 209 additions and 69 deletions

View File

@ -406,7 +406,7 @@ void Pixie16::ReadData(unsigned short modID){
if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return; if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return;
///if(nFIFOWords *1.0 / EXTERNAL_FIFO_LENGTH > 0.2) { ///if(nFIFOWords *1.0 / EXTERNAL_FIFO_LENGTH > 0.2) {
if(nFIFOWords > 0) { if(nFIFOWords > 0) {
//printf("\033[1;31m####### READ DATA \033[m: number of word in module-%d FIFO : %d \n", modID, nFIFOWords); ///printf("\033[1;31m####### READ DATA \033[m: number of word in module-%d FIFO : %d (%.2f kB)\n", modID, nFIFOWords, nFIFOWords*4./1024.);
if( ExtFIFO_Data != NULL ) delete ExtFIFO_Data; if( ExtFIFO_Data != NULL ) delete ExtFIFO_Data;
ExtFIFO_Data = new unsigned int [nFIFOWords]; ExtFIFO_Data = new unsigned int [nFIFOWords];
retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID); retval = Pixie16ReadDataFromExternalFIFO(ExtFIFO_Data, nFIFOWords, modID);

View File

@ -116,7 +116,6 @@ public:
void CaptureADCTrace(unsigned short modID, unsigned short ch); void CaptureADCTrace(unsigned short modID, unsigned short ch);
int GetADCTraceLength() {return 8192;} int GetADCTraceLength() {return 8192;}
unsigned short * GetADCTrace() {return ADCTrace;} unsigned short * GetADCTrace() {return ADCTrace;}
///========================= Setting ///========================= Setting
unsigned int GetNumModule() {return NumModules;} unsigned int GetNumModule() {return NumModules;}
@ -124,6 +123,7 @@ public:
unsigned short GetDigitizerRev(unsigned short modID) { return ModRev[modID];} unsigned short GetDigitizerRev(unsigned short modID) { return ModRev[modID];}
unsigned short GetDigitizerADCBits(unsigned short modID) { return ModADCBits[modID];} unsigned short GetDigitizerADCBits(unsigned short modID) { return ModADCBits[modID];}
unsigned short GetDigitizerNumChannel(unsigned short modID) { return numChannels[modID];} unsigned short GetDigitizerNumChannel(unsigned short modID) { return numChannels[modID];}
unsigned short GetDigitizerSamplingRate(unsigned short modID) { return ModADCMSPS[modID];}
std::string GetSettingFile(unsigned modID) {return DSPParFile[modID];} std::string GetSettingFile(unsigned modID) {return DSPParFile[modID];}
unsigned int GetDigitizerSetting(std::string parName, unsigned short modID, bool verbose = false); unsigned int GetDigitizerSetting(std::string parName, unsigned short modID, bool verbose = false);
@ -133,6 +133,7 @@ public:
void SetDigitizerSetting(std::string parName, unsigned int val, unsigned short modID, bool verbose = false); void SetDigitizerSetting(std::string parName, unsigned int val, unsigned short modID, bool verbose = false);
void SetDigitizerSynchWait(unsigned int val, unsigned short modID) { SetDigitizerSetting("SYNCH_WAIT", val, modID, 1);} void SetDigitizerSynchWait(unsigned int val, unsigned short modID) { SetDigitizerSetting("SYNCH_WAIT", val, modID, 1);}
void SetDigitizerInSynch(unsigned int val, unsigned short modID) { SetDigitizerSetting("IN_SYNCH", val, modID, 1);} void SetDigitizerInSynch(unsigned int val, unsigned short modID) { SetDigitizerSetting("IN_SYNCH", val, modID, 1);}
void SetDigitizerSlowFilterRange(unsigned int val, unsigned short modID) { SetDigitizerSetting("SLOW_FILTER_RANGE", val, modID, 1);}
void SetDigitizerPresetRunTime(double val_in_sec, unsigned short modID) { SetDigitizerSetting("HOST_RT_PRESET", Decimal2IEEEFloating(val_in_sec), modID, 1);} void SetDigitizerPresetRunTime(double val_in_sec, unsigned short modID) { SetDigitizerSetting("HOST_RT_PRESET", Decimal2IEEEFloating(val_in_sec), modID, 1);}
double GetChannelSetting(std::string parName, unsigned short modID, unsigned short ch, bool verbose = false); double GetChannelSetting(std::string parName, unsigned short modID, unsigned short ch, bool verbose = false);

View File

@ -11,6 +11,33 @@
#include "channelSetting.h" #include "channelSetting.h"
TString settingName[NUM_CHANNEL_SETTING] = { "TRIGGER_RISETIME",
"TRIGGER_FLATTOP",
"TRIGGER_THRESHOLD",
"ENERGY_RISETIME",
"ENERGY_FLATTOP",
"TAU",
"TRACE_LENGTH",
"TRACE_DELAY",
"VOFFSET",
"XDT",
"BASELINE_PERCENT",
"BASELINE_AVERAGE",
"BLCUT",
"EMIN",
"QDCLen0",
"QDCLen1",
"QDCLen2",
"QDCLen3",
"QDCLen4",
"QDCLen5",
"QDCLen6",
"QDCLen7",
"MultiplicityMaskL",
"MultiplicityMaskH",
"CHANNEL_CSRA"};
ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
this->pixie = pixie; this->pixie = pixie;
@ -41,41 +68,13 @@ ChannelSetting::ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 *
chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); chIDEntry = new TGNumberEntry(hframe0, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
chIDEntry->SetWidth(50); chIDEntry->SetWidth(50);
chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, MAXCH); chIDEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, MAXCH-1);
chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()"); chIDEntry->Connect("Modified()", "ChannelSetting", this, "ChangeCh()");
hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); hframe0->AddFrame(chIDEntry, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4));
int modID = modIDEntry->GetNumber(); int modID = modIDEntry->GetNumber();
int ch = chIDEntry->GetNumber(); int ch = chIDEntry->GetNumber();
TString settingName[NUM_CHANNEL_SETTING] = {
"TRIGGER_RISETIME",
"TRIGGER_FLATTOP",
"TRIGGER_THRESHOLD",
"ENERGY_RISETIME",
"ENERGY_FLATTOP",
"TAU",
"TRACE_LENGTH",
"TRACE_DELAY",
"VOFFSET",
"XDT",
"BASELINE_PERCENT",
"BASELINE_AVERAGE",
"BLCUT",
"EMIN",
"QDCLen0",
"QDCLen1",
"QDCLen2",
"QDCLen3",
"QDCLen4",
"QDCLen5",
"QDCLen6",
"QDCLen7",
"MultiplicityMaskL",
"MultiplicityMaskH",
"CHANNEL_CSRA",
};
TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING]; TGHorizontalFrame *hframe[NUM_CHANNEL_SETTING];
TGLabel * lb[NUM_CHANNEL_SETTING]; TGLabel * lb[NUM_CHANNEL_SETTING];
@ -125,13 +124,17 @@ ChannelSetting::~ChannelSetting(){
void ChannelSetting::ChangeMod(){ void ChannelSetting::ChangeMod(){
ChangeCh();
} }
void ChannelSetting::ChangeCh(){ void ChannelSetting::ChangeCh(){
int modID = modIDEntry->GetNumber();
int ch = chIDEntry->GetNumber();
for( int i = 0 ; i < NUM_CHANNEL_SETTING; i++){
double temp = pixie->GetChannelSetting(settingName[i].Data(), modID, ch, false);
entry[i]->SetText( Form("%f", temp) );
}
} }

View File

@ -28,7 +28,7 @@ public:
ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie); ChannelSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
virtual ~ChannelSetting(); virtual ~ChannelSetting();
void CloseWindow() { printf("close window\n"); delete this; } void CloseWindow() { printf("close ChannelSetting window\n"); delete this; }
void ChangeMod(); void ChangeMod();
void ChangeCh(); void ChangeCh();

View File

@ -10,6 +10,20 @@
#include "moduleSetting.h" #include "moduleSetting.h"
TString modSettingName[NUM_MOD_SETTING] = { "CrateID",
"SlotID",
"SYNCH_WAIT",
"IN_SYNCH",
"SLOW_FILTER_RANGE",
"FAST_FILTER_RANGE",
"FastTrigBackplaneEna",
"TrigConfig0",
"TrigConfig1",
"TrigConfig2",
"TrigConfig3",
"HOST_RT_PRESET",
"MODULE_CSRB"};
ModuleSetting::ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){ ModuleSetting::ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
@ -38,21 +52,8 @@ ModuleSetting::ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pi
int modID = modIDEntry->GetNumber(); int modID = modIDEntry->GetNumber();
TString settingName[NUM_MOD_SETTING] = { int comboBoxWidth = 135;
"CrateID", int comboBoxHeigth = 30;
"SlotID",
"SYNCH_WAIT",
"IN_SYNCH",
"SLOW_FILTER_RANGE",
"FAST_FILTER_RANGE",
"FastTrigBackplaneEna",
"TrigConfig0",
"TrigConfig1",
"TrigConfig2",
"TrigConfig3",
"HOST_RT_PRESET",
"MODULE_CSRB",
};
TGHorizontalFrame *hframe[NUM_MOD_SETTING]; TGHorizontalFrame *hframe[NUM_MOD_SETTING];
TGLabel * lb[NUM_MOD_SETTING]; TGLabel * lb[NUM_MOD_SETTING];
@ -61,16 +62,75 @@ ModuleSetting::ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pi
hframe[i] = new TGHorizontalFrame(vframe, 50, 50 ); hframe[i] = new TGHorizontalFrame(vframe, 50, 50 );
vframe->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2)); vframe->AddFrame(hframe[i], new TGLayoutHints(kLHintsRight, 2,2,2,2));
int temp = pixie->GetDigitizerSetting(settingName[i].Data(), modID, false); int temp = pixie->GetDigitizerSetting(modSettingName[i].Data(), modID, false);
entry[i] = new TGTextEntry(hframe[i], new TGTextBuffer(1));
//if( i < 2 || i == NUM_MOD_SETTING -1 ) entry[i]->SetEnabled(false);
entry[i]->SetEnabled(false);
entry[i]->SetText( Form("%d", temp) ); if( i < 2 || i > 4){
entry[i] = new TGTextEntry(hframe[i], new TGTextBuffer(1));
entry[i]->SetEnabled(false);
entry[i]->SetText( Form("%d", temp) );
hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4)); if( i == 5 ) entry[i]->SetText( Form("%d (only 0 supported)", temp) );
lb[i] = new TGLabel(hframe[i], settingName[i]); hframe[i]->AddFrame(entry[i], new TGLayoutHints(kLHintsRight, 5,5,3,4));
}
if( i == 2 ){
cbSyncWait = new TGComboBox(hframe[i]);
cbSyncWait->SetWidth(comboBoxWidth);
cbSyncWait->SetHeight(comboBoxHeigth);
cbSyncWait->AddEntry("Sync", 1);
cbSyncWait->AddEntry("not Sync", 0);
cbSyncWait->Select(temp);
cbSyncWait->Connect("Selected(Int_t, Int_t)", "ModuleSetting", this, "ChangeSyncWait()");
hframe[i]->AddFrame(cbSyncWait, new TGLayoutHints(kLHintsRight, 5,5,3,4));
}
if( i == 3 ){
cbInSych = new TGComboBox(hframe[i]);
cbInSych->SetWidth(comboBoxWidth);
cbInSych->SetHeight(comboBoxHeigth);
cbInSych->AddEntry("Clock clear", 0);
cbInSych->AddEntry("Common Clock", 1);
cbInSych->Select(temp);
cbInSych->Connect("Selected(Int_t, Int_t)", "ModuleSetting", this, "ChangeInSync()");
hframe[i]->AddFrame(cbInSych, new TGLayoutHints(kLHintsRight, 5,5,3,4));
}
if( i == 4 ){
cbSlowFilterRange = new TGComboBox(hframe[i]);
cbSlowFilterRange->SetWidth(comboBoxWidth);
cbSlowFilterRange->SetHeight(comboBoxHeigth);
unsigned short sampleRate = pixie->GetDigitizerSamplingRate(modID);
if( sampleRate == 100 || sampleRate == 500 ){
cbSlowFilterRange->AddEntry("off", 0);
cbSlowFilterRange->AddEntry("0.02 us", 1);
cbSlowFilterRange->AddEntry("0.04 us", 2);
cbSlowFilterRange->AddEntry("0.08 us", 3);
cbSlowFilterRange->AddEntry("0.16 us", 4);
cbSlowFilterRange->AddEntry("0.32 us", 5);
cbSlowFilterRange->AddEntry("0.64 us", 6);
}else{
cbSlowFilterRange->AddEntry("off", 0);
cbSlowFilterRange->AddEntry("0.016 us", 1);
cbSlowFilterRange->AddEntry("0.032 us", 2);
cbSlowFilterRange->AddEntry("0.064 us", 3);
cbSlowFilterRange->AddEntry("0.128 us", 4);
cbSlowFilterRange->AddEntry("0.256 us", 5);
cbSlowFilterRange->AddEntry("0.512 us", 6);
}
cbSlowFilterRange->Select(temp);
cbSlowFilterRange->Connect("Selected(Int_t, Int_t)", "ModuleSetting", this, "ChangeSlowFilterRange()");
hframe[i]->AddFrame(cbSlowFilterRange, new TGLayoutHints(kLHintsRight, 5,5,3,4));
}
lb[i] = new TGLabel(hframe[i], modSettingName[i]);
hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4)); hframe[i]->AddFrame(lb[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 3, 4));
} }
@ -91,9 +151,12 @@ ModuleSetting::~ModuleSetting(){
delete modIDEntry; delete modIDEntry;
for ( int i = 0; i < NUM_MOD_SETTING; i++){ for ( int i = 0; i < NUM_MOD_SETTING; i++){
delete entry[i]; if( i < 2 || i > 5 ) delete entry[i];
} }
delete cbSyncWait;
delete cbInSych;
delete cbSlowFilterRange;
/// fMain must be delete last; /// fMain must be delete last;
fMain->Cleanup(); fMain->Cleanup();
@ -103,7 +166,59 @@ ModuleSetting::~ModuleSetting(){
void ModuleSetting::ChangeMod(){ void ModuleSetting::ChangeMod(){
int modID = modIDEntry->GetNumber();
for( int i = 0 ; i < NUM_MOD_SETTING; i++){
int temp = pixie->GetDigitizerSetting(modSettingName[i].Data(), modID, false);
if( i < 2 || i > 4){
entry[i]->SetText( Form("%d", temp) );
}
if( i == 2 ) cbSyncWait->Select(temp);
if( i == 3 ) cbInSych->Select(temp);
if( i == 4 ) {
cbSlowFilterRange->RemoveAll();
unsigned short sampleRate = pixie->GetDigitizerSamplingRate(modID);
if( sampleRate == 100 || sampleRate == 500 ){
cbSlowFilterRange->AddEntry("off", 0);
cbSlowFilterRange->AddEntry("0.02 us", 1);
cbSlowFilterRange->AddEntry("0.04 us", 2);
cbSlowFilterRange->AddEntry("0.08 us", 3);
cbSlowFilterRange->AddEntry("0.16 us", 4);
cbSlowFilterRange->AddEntry("0.32 us", 5);
cbSlowFilterRange->AddEntry("0.64 us", 6);
}else{
cbSlowFilterRange->AddEntry("off", 0);
cbSlowFilterRange->AddEntry("0.016 us", 1);
cbSlowFilterRange->AddEntry("0.032 us", 2);
cbSlowFilterRange->AddEntry("0.064 us", 3);
cbSlowFilterRange->AddEntry("0.128 us", 4);
cbSlowFilterRange->AddEntry("0.256 us", 5);
cbSlowFilterRange->AddEntry("0.512 us", 6);
}
cbSlowFilterRange->Select(temp);
}
}
} }
void ModuleSetting::ChangeSyncWait(){
pixie->SetDigitizerSynchWait(cbSyncWait->GetSelected(), modIDEntry->GetNumber());
///printf("%s \n", pixie->GetSettingFile(modIDEntry->GetNumber()).c_str());
pixie->SaveSettings(pixie->GetSettingFile(modIDEntry->GetNumber()));
}
void ModuleSetting::ChangeInSync(){
pixie->SetDigitizerInSynch(cbInSych->GetSelected(), modIDEntry->GetNumber());
pixie->SaveSettings(pixie->GetSettingFile(modIDEntry->GetNumber()));
}
void ModuleSetting::ChangeSlowFilterRange(){
pixie->SetDigitizerSlowFilterRange(cbInSych->GetSelected(), modIDEntry->GetNumber());
pixie->SaveSettings(pixie->GetSettingFile(modIDEntry->GetNumber()));
}

View File

@ -22,16 +22,27 @@ private:
TGTextEntry * entry[NUM_MOD_SETTING]; TGTextEntry * entry[NUM_MOD_SETTING];
TGComboBox * cbSyncWait;
TGComboBox * cbInSych;
TGComboBox * cbSlowFilterRange;
TGComboBox * cbFastFilterRange;
Pixie16 * pixie; Pixie16 * pixie;
public: public:
ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie); ModuleSetting(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
virtual ~ModuleSetting(); virtual ~ModuleSetting();
void CloseWindow() { printf("close window\n"); delete this; } void CloseWindow() { printf("close ModuleSetting window\n"); delete this; }
void ChangeMod(); void ChangeMod();
void ChangeSyncWait();
void ChangeInSync();
void ChangeSlowFilterRange();
bool isOpened; bool isOpened;
}; };

View File

@ -174,10 +174,13 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
/// Initialize the layout algorithm /// Initialize the layout algorithm
fMain->Resize(fMain->GetDefaultSize()); fMain->Resize(fMain->GetDefaultSize());
fMain->SetWMPosition(200, 200); //does not work??
/// Map main frame /// Map main frame
fMain->MapWindow(); fMain->MapWindow();
/// setup thread /// setup thread
thread = new TThread("hahaha", SaveData, (void *) 1); thread = new TThread("hahaha", SaveData, (void *) 1);
fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1); fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1);
@ -449,15 +452,21 @@ void * MainWindow::SaveData(void* ptr){
localClock.Reset(); localClock.Reset();
localClock.Start("timer"); localClock.Start("timer");
int pauseTime = 500 ; ///msec
while( pixie->IsRunning() ){ while( pixie->IsRunning() ){
usleep(500*1000); /// 500 msec if( pauseTime > 10 ) usleep(pauseTime*1000);
if( !pixie->IsRunning() ) break; if( !pixie->IsRunning() ) break;
pixie->ReadData(0); pixie->ReadData(0);
pixie->SaveData(); pixie->SaveData();
double MByteRead = pixie->GetnFIFOWords()*4./1024./1024.;
if( MByteRead > 70 && pauseTime > 10) pauseTime = pauseTime - 20;
//TODO Fill HISTORGRAM; //TODO Fill HISTORGRAM;
time_t now = time(0); time_t now = time(0);
tm * ltm = localtime(&now); tm * ltm = localtime(&now);
@ -478,7 +487,8 @@ void * MainWindow::SaveData(void* ptr){
oldFileSize = newFileSize; oldFileSize = newFileSize;
oldTime = newTime; oldTime = newTime;
teLog->AddLine(Form("[%4d-%02d-%02d %02d:%02d:%02d] File Size : %.2f MB [%.2f MB/s]", year, month, day, hour, minute, secound, newFileSize, rate)); teLog->AddLine(Form("[%4d-%02d-%02d %02d:%02d:%02d] File Size : %.2f MB [%.2f MB/s], %.2f MB readed",
year, month, day, hour, minute, secound, newFileSize, rate, MByteRead));
teLog->LineDown(); teLog->LineDown();

View File

@ -54,7 +54,7 @@ public:
virtual ~SettingsSummary(); virtual ~SettingsSummary();
void CloseWindow() { printf("close window\n"); delete this; } void CloseWindow() { printf("close SettingsSummary window\n"); delete this; }
void ChangeOnOff(unsigned short ch); void ChangeOnOff(unsigned short ch);
void ChangeGain(unsigned short ch); void ChangeGain(unsigned short ch);

View File

@ -1016,7 +1016,7 @@
"ChanNum": 0, "ChanNum": 0,
"CoincPattern": 0, "CoincPattern": 0,
"CoincWait": 0, "CoincWait": 0,
"ControlTask": 5, "ControlTask": 23,
"CrateID": 0, "CrateID": 0,
"FIFOLength": 8188, "FIFOLength": 8188,
"FastFilterRange": 0, "FastFilterRange": 0,
@ -1040,7 +1040,7 @@
0 0
], ],
"HostRunTimePreset": 1092616192, "HostRunTimePreset": 1092616192,
"InSynch": 1, "InSynch": 0,
"MaxEvents": 0, "MaxEvents": 0,
"ModCSRA": 0, "ModCSRA": 0,
"ModCSRB": 1, "ModCSRB": 1,