added FSUDAQ.sh for saving program settings. use gDummy for TGraph Draw range.
This commit is contained in:
parent
f713efbc41
commit
c7858024a7
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,3 +11,5 @@ test
|
||||||
FSUDAQ
|
FSUDAQ
|
||||||
test_indep
|
test_indep
|
||||||
EventBuilder
|
EventBuilder
|
||||||
|
|
||||||
|
FSUDAQ.sh
|
||||||
|
|
|
@ -437,7 +437,6 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
bool isTrigger0 = (( word >> 15 ) & 0x1 );
|
bool isTrigger0 = (( word >> 15 ) & 0x1 );
|
||||||
bool dp0 = (( word >> 14 ) & 0x1 );
|
bool dp0 = (( word >> 14 ) & 0x1 );
|
||||||
unsigned short wave0 = ( word & 0x3FFF);
|
unsigned short wave0 = ( word & 0x3FFF);
|
||||||
if( wave0 >= 0x3FF0 ) wave0 = 0;
|
|
||||||
|
|
||||||
if( SaveWaveToMemory){
|
if( SaveWaveToMemory){
|
||||||
if( hasDualTrace ){
|
if( hasDualTrace ){
|
||||||
|
|
128
FSUDAQ.cpp
128
FSUDAQ.cpp
|
@ -46,6 +46,7 @@ Double_t traceFunc(Double_t *x, Double_t *par){
|
||||||
TH1F * hEnergy[MaxNBoards][MaxNChannels] = {NULL};
|
TH1F * hEnergy[MaxNBoards][MaxNChannels] = {NULL};
|
||||||
TH1F * hChannel[MaxNBoards] = {NULL};
|
TH1F * hChannel[MaxNBoards] = {NULL};
|
||||||
|
|
||||||
|
TGraph * gDummy = NULL; /// this is a dummy TGraph to set the plot range
|
||||||
TGraph * gAnaTrace1 = NULL ;
|
TGraph * gAnaTrace1 = NULL ;
|
||||||
TGraph * gAnaTrace2 = NULL ;
|
TGraph * gAnaTrace2 = NULL ;
|
||||||
TGraph * gDigiTrace1 = NULL ;
|
TGraph * gDigiTrace1 = NULL ;
|
||||||
|
@ -56,6 +57,8 @@ Pixel_t red, blue, green;
|
||||||
unsigned short nDigi;
|
unsigned short nDigi;
|
||||||
Digitizer ** digi = NULL;
|
Digitizer ** digi = NULL;
|
||||||
|
|
||||||
|
unsigned short lastRunID;
|
||||||
|
|
||||||
///============ static members
|
///============ static members
|
||||||
TGTextEdit * MainWindow::teLog = NULL;
|
TGTextEdit * MainWindow::teLog = NULL;
|
||||||
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
|
TRootEmbeddedCanvas * MainWindow::fEcanvas = NULL;
|
||||||
|
@ -177,11 +180,13 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||||
|
|
||||||
TGLabel * lbDataPath = new TGLabel(hfg1, "Save Data Prefix"); hfg1->AddFrame(lbDataPath, uniLayoutHints);
|
TGLabel * lbDataPath = new TGLabel(hfg1, "Save Data Prefix"); hfg1->AddFrame(lbDataPath, uniLayoutHints);
|
||||||
dataPrefix = new TGTextEntry(hfg1, "ExpName"); hfg1->AddFrame(dataPrefix,uniLayoutHints);
|
dataPrefix = new TGTextEntry(hfg1, ProgramSetting::ExpName.c_str()); hfg1->AddFrame(dataPrefix,uniLayoutHints);
|
||||||
|
dataPrefix->SetEnabled(false);
|
||||||
dataPrefix->Resize(100, 20);
|
dataPrefix->Resize(100, 20);
|
||||||
|
|
||||||
TGLabel * lbRunNum = new TGLabel(hfg1, "Run"); hfg1->AddFrame(lbRunNum, uniLayoutHints);
|
TGLabel * lbRunNum = new TGLabel(hfg1, "Run"); hfg1->AddFrame(lbRunNum, uniLayoutHints);
|
||||||
runIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfg1->AddFrame(runIDEntry, uniLayoutHints);
|
runIDEntry = new TGNumberEntry(hfg1, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfg1->AddFrame(runIDEntry, uniLayoutHints);
|
||||||
|
runIDEntry->SetNumber(lastRunID, false);
|
||||||
runIDEntry->SetWidth(50);
|
runIDEntry->SetWidth(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,6 +260,11 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
//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);
|
||||||
|
//HandleMenu(M_PROGRAM_SETTINGS);
|
||||||
|
|
||||||
|
gDummy = new TGraph();
|
||||||
|
gDummy->SetPoint(0, 0, -1000); /// the lower left corner
|
||||||
|
gDummy->GetXaxis()->SetTitle("[ns]");
|
||||||
|
|
||||||
gAnaTrace1 = new TGraph();
|
gAnaTrace1 = new TGraph();
|
||||||
gAnaTrace1->SetName("Analog Trace 1");
|
gAnaTrace1->SetName("Analog Trace 1");
|
||||||
|
@ -306,6 +316,7 @@ MainWindow::~MainWindow() {
|
||||||
|
|
||||||
delete fillHistThread;
|
delete fillHistThread;
|
||||||
|
|
||||||
|
|
||||||
/// Clean up used widgets: frames, buttons, layout hints
|
/// Clean up used widgets: frames, buttons, layout hints
|
||||||
fMain->Cleanup();
|
fMain->Cleanup();
|
||||||
delete fMain;
|
delete fMain;
|
||||||
|
@ -371,8 +382,8 @@ void MainWindow::HandleMenu(Int_t id){
|
||||||
///========================= Program setting
|
///========================= Program setting
|
||||||
case M_PROGRAM_SETTINGS:{
|
case M_PROGRAM_SETTINGS:{
|
||||||
programSetting = new ProgramSetting(gClient->GetRoot());
|
programSetting = new ProgramSetting(gClient->GetRoot());
|
||||||
|
programSetting->Connect("SetSetting()", "MainWindow", this, "UpdateExpName()");
|
||||||
LogMsg((char*) Form("database : %s, name : %s ", ProgramSetting::IP.c_str(), ProgramSetting::databaseName.c_str() ));
|
///LogMsg((char*) Form("database : %s, name : %s ", ProgramSetting::databaseIP.c_str(), ProgramSetting::databaseName.c_str() ));
|
||||||
|
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
@ -523,6 +534,11 @@ void MainWindow::GoodBye(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::UpdateExpName(){
|
||||||
|
dataPrefix->SetText(ProgramSetting::ExpName.c_str());
|
||||||
|
runIDEntry->SetNumber(lastRunID);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::StartRun(){
|
void MainWindow::StartRun(){
|
||||||
LogMsg(Form("%s",__func__));
|
LogMsg(Form("%s",__func__));
|
||||||
if( digi == NULL) return;
|
if( digi == NULL) return;
|
||||||
|
@ -562,16 +578,12 @@ void MainWindow::StopRun(){
|
||||||
LogMsg(Form("%s",__func__));
|
LogMsg(Form("%s",__func__));
|
||||||
if( digi == NULL) return;
|
if( digi == NULL) return;
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++) digi[i]->StopACQ();
|
||||||
digi[i]->StopACQ();
|
|
||||||
}
|
|
||||||
|
|
||||||
fillHistThread->Join();
|
fillHistThread->Join();
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
///===== clear data;
|
||||||
///===== clear data;
|
for( int i = 0; i < nDigi; i++) digi[i]->GetData()->ClearTriggerRate();
|
||||||
digi[i]->GetData()->ClearTriggerRate();
|
|
||||||
}
|
|
||||||
|
|
||||||
bStartRun->SetEnabled(true);
|
bStartRun->SetEnabled(true);
|
||||||
bStopRun->SetEnabled(false);
|
bStopRun->SetEnabled(false);
|
||||||
|
@ -585,8 +597,12 @@ void MainWindow::StopRun(){
|
||||||
|
|
||||||
if( cbMode->GetSelected() == Mode_DataRun ){
|
if( cbMode->GetSelected() == Mode_DataRun ){
|
||||||
int runID = runIDEntry->GetNumber();
|
int runID = runIDEntry->GetNumber();
|
||||||
|
lastRunID = runID;
|
||||||
runIDEntry->SetNumber(runID +1);
|
runIDEntry->SetNumber(runID +1);
|
||||||
|
|
||||||
|
ProgramSetting::SaveProgramSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenChannelSetting(Int_t boardID){
|
void MainWindow::OpenChannelSetting(Int_t boardID){
|
||||||
|
@ -652,6 +668,15 @@ void MainWindow::PlotSingleTrace(){
|
||||||
Data * data = digi[boardID]->GetData();
|
Data * data = digi[boardID]->GetData();
|
||||||
int ch2ns = (int) digi[boardID]->GetCh2ns();
|
int ch2ns = (int) digi[boardID]->GetCh2ns();
|
||||||
|
|
||||||
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
uint32_t rl = digi[boardID]->GetSettingFromMemory(Register::DPP::RecordLength_G, chID);
|
||||||
|
printf("Record Length = %u \n", rl);
|
||||||
|
gDummy->SetPoint(1, 0, 0x3FFF);
|
||||||
|
gDummy->SetPoint(2, 8.*rl*ch2ns, 0x3FFF);
|
||||||
|
gDummy->Draw("AL");
|
||||||
|
gDummy->GetXaxis()->SetRangeUser(0, 8*rl*ch2ns);
|
||||||
|
gDummy->GetYaxis()->SetRangeUser(-1000, 0x3FFF);
|
||||||
|
|
||||||
digi[boardID]->StartACQ();
|
digi[boardID]->StartACQ();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -672,7 +697,7 @@ void MainWindow::PlotSingleTrace(){
|
||||||
|
|
||||||
for( int i = 0; i < traceLength ; i++) {
|
for( int i = 0; i < traceLength ; i++) {
|
||||||
gAnaTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform1[chID][0])[i]);
|
gAnaTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform1[chID][0])[i]);
|
||||||
if( isDualTrace) gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform2[chID][0])[i]);
|
|
||||||
}
|
}
|
||||||
if( traceLength <= gAnaTrace1->GetN() ){
|
if( traceLength <= gAnaTrace1->GetN() ){
|
||||||
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
||||||
|
@ -686,16 +711,21 @@ void MainWindow::PlotSingleTrace(){
|
||||||
gAnaTrace1->ComputeRange(xmin, ymin, xmax, ymax);
|
gAnaTrace1->ComputeRange(xmin, ymin, xmax, ymax);
|
||||||
for( int i = 0; i < traceLength ; i++) {
|
for( int i = 0; i < traceLength ; i++) {
|
||||||
gDigiTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (ymax-ymin)*(data->DigiWaveform1[chID][0])[i] + ymin);
|
gDigiTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (ymax-ymin)*(data->DigiWaveform1[chID][0])[i] + ymin);
|
||||||
|
if( isDualTrace) {
|
||||||
|
short haha = (data->Waveform2[chID][0])[i];
|
||||||
|
if( haha > 0x1FFF ) haha -= 0x3FFF;
|
||||||
|
gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), haha);
|
||||||
|
//gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform2[chID][0])[i] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->ClearData();
|
data->ClearData();
|
||||||
|
|
||||||
fEcanvas->GetCanvas()->cd();
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
|
||||||
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
|
gAnaTrace1->Draw("same L");
|
||||||
gAnaTrace1->Draw("APL");
|
gAnaTrace2->Draw("same L");
|
||||||
gAnaTrace2->Draw("L");
|
gDigiTrace1->Draw("same L");
|
||||||
gDigiTrace1->Draw("L");
|
|
||||||
fEcanvas->GetCanvas()->Update();
|
fEcanvas->GetCanvas()->Update();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -818,39 +848,55 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( CurrentTime == 0 ){
|
||||||
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
|
||||||
|
uint32_t rl = digi[boardID]->GetSettingFromMemory(Register::DPP::RecordLength_G, ch);
|
||||||
|
printf("Record Length = %u \n", rl);
|
||||||
|
gDummy->SetPoint(1, 0, 0x3FFF);
|
||||||
|
gDummy->SetPoint(2, 8.*rl*ch2ns, 0x3FFF);
|
||||||
|
gDummy->Draw("AL");
|
||||||
|
gDummy->GetXaxis()->SetRangeUser(0, 8*rl*ch2ns);
|
||||||
|
gDummy->GetYaxis()->SetRangeUser(-1000, 0x3FFF);
|
||||||
|
}
|
||||||
|
|
||||||
if( cbMode->GetSelected() != Mode_DataRun){
|
if( cbMode->GetSelected() != Mode_DataRun){
|
||||||
|
|
||||||
fEcanvas->GetCanvas()->cd();
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
|
||||||
|
/// use the last trace
|
||||||
|
if( cbMode->GetSelected() == Mode_Oscilloscope && hasTrace){
|
||||||
|
|
||||||
|
unsigned short nData = data->NumEvents[ch];
|
||||||
|
traceLength = (data->Waveform1[ch][nData-1]).size();
|
||||||
|
if( traceLength > 0 ){
|
||||||
|
for( int i = 0; i < traceLength; i++) {
|
||||||
|
gAnaTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform1[ch][nData-1])[i]);
|
||||||
|
if( isDualTrace) {
|
||||||
|
short haha = (data->Waveform2[ch][nData-1])[i];
|
||||||
|
if( haha > 0x1FFF ) haha -= 0x3FFF;
|
||||||
|
gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), haha );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( traceLength <= gAnaTrace1->GetN() ){
|
||||||
|
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
||||||
|
gAnaTrace1->RemovePoint(i);
|
||||||
|
if( isDualTrace) gAnaTrace2->RemovePoint(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gAnaTrace1->Draw("same L");
|
||||||
|
///this causes warning
|
||||||
|
///gAnaTrace1->GetYaxis();//->SetRangeUser(0, 0x3FFF);
|
||||||
|
gAnaTrace2->Draw("same L");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CurrentTime = get_time();
|
CurrentTime = get_time();
|
||||||
ElapsedTime = CurrentTime - PreviousTime; /// milliseconds
|
ElapsedTime = CurrentTime - PreviousTime; /// milliseconds
|
||||||
|
|
||||||
if( ElapsedTime > 500 ){
|
|
||||||
|
|
||||||
/// use the last trace
|
|
||||||
if( cbMode->GetSelected() == Mode_Oscilloscope && hasTrace){
|
|
||||||
|
|
||||||
unsigned short nData = data->NumEvents[ch];
|
|
||||||
traceLength = (data->Waveform1[ch][nData-1]).size();
|
|
||||||
if( traceLength > 0 ){
|
|
||||||
for( int i = 0; i < traceLength; i++) {
|
|
||||||
gAnaTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform1[ch][nData-1])[i]);
|
|
||||||
if( isDualTrace) gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform2[ch][nData-1])[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( traceLength <= gAnaTrace1->GetN() ){
|
|
||||||
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
|
||||||
gAnaTrace1->RemovePoint(i);
|
|
||||||
if( isDualTrace) gAnaTrace2->RemovePoint(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gAnaTrace1->Draw("AL");
|
|
||||||
///this causes warning
|
|
||||||
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
|
|
||||||
gAnaTrace2->Draw("same L");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if( ElapsedTime > 200 ){
|
||||||
|
|
||||||
///Fill Channel Count
|
///Fill Channel Count
|
||||||
for( int i = 0 ; i < digi[boardID]->GetNChannel(); i++){
|
for( int i = 0 ; i < digi[boardID]->GetNChannel(); i++){
|
||||||
|
@ -882,6 +928,8 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
printf(" Welcome to FSU DQ \n");
|
printf(" Welcome to FSU DQ \n");
|
||||||
|
|
||||||
|
ProgramSetting::LoadProgramSetting();
|
||||||
|
|
||||||
TApplication theApp("App",&argc,argv);
|
TApplication theApp("App",&argc,argv);
|
||||||
new MainWindow(gClient->GetRoot(),800,800);
|
new MainWindow(gClient->GetRoot(),800,800);
|
||||||
theApp.Run();
|
theApp.Run();
|
||||||
|
|
3
FSUDAQ.h
3
FSUDAQ.h
|
@ -75,6 +75,8 @@ public:
|
||||||
void ChangeBoard();
|
void ChangeBoard();
|
||||||
void LoadSettingFromFile();
|
void LoadSettingFromFile();
|
||||||
|
|
||||||
|
void UpdateExpName();
|
||||||
|
|
||||||
void StartRun();
|
void StartRun();
|
||||||
void StopRun();
|
void StopRun();
|
||||||
|
|
||||||
|
@ -90,4 +92,5 @@ public:
|
||||||
void LogMsg(char * );
|
void LogMsg(char * );
|
||||||
void GoodBye();
|
void GoodBye();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -229,30 +229,35 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, int
|
||||||
TGLabel * lbTrapRiseTime = new TGLabel(vfTrap1, "Rise time [ns]"); vfTrap1->AddFrame(lbTrapRiseTime, layoutHintsR);
|
TGLabel * lbTrapRiseTime = new TGLabel(vfTrap1, "Rise time [ns]"); vfTrap1->AddFrame(lbTrapRiseTime, layoutHintsR);
|
||||||
numTrapRiseTime = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapRiseTime, layoutHints);
|
numTrapRiseTime = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapRiseTime, layoutHints);
|
||||||
numTrapRiseTime->Resize(width, 20);
|
numTrapRiseTime->Resize(width, 20);
|
||||||
|
numTrapRiseTime->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0xFFF * 4 * ch2ns);
|
||||||
numTrapRiseTime->Connect("Modified()", "ChannelSettingPHA", this, "SetTrapRiseTime()");
|
numTrapRiseTime->Connect("Modified()", "ChannelSettingPHA", this, "SetTrapRiseTime()");
|
||||||
|
|
||||||
///const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK
|
///const uint32_t TrapezoidFlatTop = 0x1060; /// R/W OK
|
||||||
TGLabel * lbTrapFlatTop = new TGLabel(vfTrap1, "Flat Top [ns]"); vfTrap1->AddFrame(lbTrapFlatTop, layoutHintsR);
|
TGLabel * lbTrapFlatTop = new TGLabel(vfTrap1, "Flat Top [ns]"); vfTrap1->AddFrame(lbTrapFlatTop, layoutHintsR);
|
||||||
numTrapFlatTop = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapFlatTop, layoutHints);
|
numTrapFlatTop = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numTrapFlatTop, layoutHints);
|
||||||
numTrapFlatTop->Resize(width, 20);
|
numTrapFlatTop->Resize(width, 20);
|
||||||
|
numTrapFlatTop->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0xFFF * 4 * ch2ns);
|
||||||
numTrapFlatTop->Connect("Modified()", "ChannelSettingPHA", this, "SetTrapFlatTop()");
|
numTrapFlatTop->Connect("Modified()", "ChannelSettingPHA", this, "SetTrapFlatTop()");
|
||||||
|
|
||||||
///const uint32_t DecayTime = 0x1068; /// R/W OK
|
///const uint32_t DecayTime = 0x1068; /// R/W OK
|
||||||
TGLabel * lbDecay = new TGLabel(vfTrap1, "Decay [ns]"); vfTrap1->AddFrame(lbDecay, layoutHintsR);
|
TGLabel * lbDecay = new TGLabel(vfTrap1, "Decay [ns]"); vfTrap1->AddFrame(lbDecay, layoutHintsR);
|
||||||
numDecay = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numDecay, layoutHints);
|
numDecay = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numDecay, layoutHints);
|
||||||
numDecay->Resize(width, 20);
|
numDecay->Resize(width, 20);
|
||||||
|
numDecay->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0xFFFF * 4 * ch2ns);
|
||||||
numDecay->Connect("Modified()", "ChannelSettingPHA", this, "SetDecay()");
|
numDecay->Connect("Modified()", "ChannelSettingPHA", this, "SetDecay()");
|
||||||
|
|
||||||
///const uint32_t PeakingTime = 0x1064; /// R/W OK
|
///const uint32_t PeakingTime = 0x1064; /// R/W OK
|
||||||
TGLabel * lbPeaking = new TGLabel(vfTrap1, "Peaking [ns]"); vfTrap1->AddFrame(lbPeaking, layoutHintsR);
|
TGLabel * lbPeaking = new TGLabel(vfTrap1, "Peaking [ns]"); vfTrap1->AddFrame(lbPeaking, layoutHintsR);
|
||||||
numPeaking = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeaking, layoutHints);
|
numPeaking = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeaking, layoutHints);
|
||||||
numPeaking->Resize(width, 20);
|
numPeaking->Resize(width, 20);
|
||||||
|
numPeaking->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0xFFF * 4 * ch2ns);
|
||||||
numPeaking->Connect("Modified()", "ChannelSettingPHA", this, "SetPeaking()");
|
numPeaking->Connect("Modified()", "ChannelSettingPHA", this, "SetPeaking()");
|
||||||
|
|
||||||
///const uint32_t PeakHoldOff = 0x1078; /// R/W OK
|
///const uint32_t PeakHoldOff = 0x1078; /// R/W OK
|
||||||
TGLabel * lbPeakHoldOff = new TGLabel(vfTrap1, "Peaking Holdoff [ns]"); vfTrap1->AddFrame(lbPeakHoldOff, layoutHintsR);
|
TGLabel * lbPeakHoldOff = new TGLabel(vfTrap1, "Peaking Holdoff [ns]"); vfTrap1->AddFrame(lbPeakHoldOff, layoutHintsR);
|
||||||
numPeakHoldOff = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeakHoldOff, layoutHints);
|
numPeakHoldOff = new TGNumberEntry(vfTrap2, 96, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vfTrap2->AddFrame(numPeakHoldOff, layoutHints);
|
||||||
numPeakHoldOff->Resize(width, 20);
|
numPeakHoldOff->Resize(width, 20);
|
||||||
|
numPeakHoldOff->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x3FF * 4 * ch2ns);
|
||||||
numPeakHoldOff->Connect("Modified()", "ChannelSettingPHA", this, "SetPeakHoldOff()");
|
numPeakHoldOff->Connect("Modified()", "ChannelSettingPHA", this, "SetPeakHoldOff()");
|
||||||
|
|
||||||
/// DPP1 bit[13:12]
|
/// DPP1 bit[13:12]
|
||||||
|
|
|
@ -7,47 +7,76 @@
|
||||||
#include <TGTableContainer.h>
|
#include <TGTableContainer.h>
|
||||||
#include <TGFileDialog.h>
|
#include <TGFileDialog.h>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "programSetting.h"
|
#include "programSetting.h"
|
||||||
|
|
||||||
std::string ProgramSetting::IP = "http://fsunuc.physics.fsu.edu/influx/";
|
std::string ProgramSetting::databaseIP = "http://fsunuc.physics.fsu.edu/influx/";
|
||||||
std::string ProgramSetting::databaseName = "testing";
|
std::string ProgramSetting::databaseName = "testing";
|
||||||
std::string ProgramSetting::DataSavingPath = "/home/catrina/FSUDAQ/";
|
std::string ProgramSetting::DataSavingPath = "/home/catrina/FSUDAQ/";
|
||||||
|
std::string ProgramSetting::ExpName = "Test";
|
||||||
|
std::string ProgramSetting::ElogIP = "128.186.111.127";
|
||||||
|
|
||||||
|
const std::string ProgramSetting::settingFileName = "FSUDAQ.sh";
|
||||||
|
|
||||||
|
///this is declared at FSUDAQ.cpp
|
||||||
|
extern unsigned short lastRunID;
|
||||||
|
|
||||||
ProgramSetting::ProgramSetting(const TGWindow *p){
|
ProgramSetting::ProgramSetting(const TGWindow *p){
|
||||||
fMain = new TGMainFrame(p, 600, 400);
|
fMain = new TGMainFrame(p, 600, 400);
|
||||||
fMain->SetWindowName("Program Setting");
|
fMain->SetWindowName("Program Setting");
|
||||||
fMain->Connect("CloseWindow()", "ProgramSetting", this, "CloseWindow()");
|
fMain->Connect("CloseWindow()", "ProgramSetting", this, "CloseWindow()");
|
||||||
|
|
||||||
|
TGLayoutHints * haha = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5,5,5,2);
|
||||||
|
TGLayoutHints * kaka = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,0,0);
|
||||||
|
|
||||||
TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe);
|
TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe);
|
||||||
|
|
||||||
{///============== Database
|
{///============== Data Saving Path
|
||||||
TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database Setting", kHorizontalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandY | kLHintsExpandX , 5, 5, 5, 5));
|
TGGroupFrame * gfData = new TGGroupFrame(vframe, "Data Storage", kHorizontalFrame); vframe->AddFrame(gfData, new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5));
|
||||||
|
|
||||||
TGVerticalFrame * vfDB = new TGVerticalFrame(gfDatabase); gfDatabase->AddFrame(vfDB);
|
TGHorizontalFrame * hfData = new TGHorizontalFrame(gfData); gfData->AddFrame(hfData, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
|
||||||
|
|
||||||
TGHorizontalFrame * hfDB1 = new TGHorizontalFrame(vfDB); vfDB->AddFrame(hfDB1);
|
TGVerticalFrame * vfLabel = new TGVerticalFrame(hfData, 200); hfData->AddFrame(vfLabel );
|
||||||
TGLabel * lbIP = new TGLabel(hfDB1, "IP :"); hfDB1->AddFrame(lbIP, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
TGVerticalFrame * vfTxt = new TGVerticalFrame(hfData); hfData->AddFrame(vfTxt);
|
||||||
txtIP = new TGTextEntry(hfDB1, IP.c_str()); hfDB1->AddFrame(txtIP, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
||||||
txtIP->Resize(300, 20);
|
|
||||||
txtIP->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataBase()");
|
|
||||||
|
|
||||||
TGHorizontalFrame * hfDB2 = new TGHorizontalFrame(vfDB); vfDB->AddFrame(hfDB2);
|
TGLabel * lbExpName = new TGLabel(vfLabel, "ExpName :"); vfLabel->AddFrame(lbExpName, haha);
|
||||||
TGLabel * lbDBName = new TGLabel(hfDB2, "DB Name :"); hfDB2->AddFrame(lbDBName, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
TGLabel * lbDataPath = new TGLabel(vfLabel, "Data Absolute Path :"); vfLabel->AddFrame(lbDataPath, haha);
|
||||||
txtDBName = new TGTextEntry(hfDB2, databaseName.c_str()); hfDB2->AddFrame(txtDBName, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
||||||
txtDBName->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataBase()");
|
txtExpName = new TGTextEntry(vfTxt, ExpName.c_str()); vfTxt->AddFrame(txtExpName, kaka);
|
||||||
|
txtExpName->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
||||||
|
txtExpName->Resize(300, 20);
|
||||||
|
|
||||||
|
txtDataPath = new TGTextEntry(vfTxt, DataSavingPath.c_str()); vfTxt->AddFrame(txtDataPath, kaka);
|
||||||
|
txtDataPath->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
||||||
|
txtDataPath->Resize(300, 20);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{///============== Data Saving Path
|
{///============== Database & Elog
|
||||||
TGGroupFrame * gfData = new TGGroupFrame(vframe, "Data Storage", kHorizontalFrame); vframe->AddFrame(gfData, new TGLayoutHints(kLHintsExpandY | kLHintsExpandY , 5, 5, 5, 5));
|
TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database & Elog Setting", kHorizontalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
|
||||||
|
|
||||||
TGVerticalFrame * vfData = new TGVerticalFrame(gfData); gfData->AddFrame(vfData);
|
TGHorizontalFrame * hfDB1 = new TGHorizontalFrame(gfDatabase); gfDatabase->AddFrame(hfDB1, new TGLayoutHints(kLHintsNormal, 0, 0, 5, 0));
|
||||||
|
|
||||||
TGHorizontalFrame * hfData = new TGHorizontalFrame(vfData); vfData->AddFrame(hfData);
|
TGVerticalFrame * vfLabel = new TGVerticalFrame(hfDB1, 200); hfDB1->AddFrame(vfLabel);
|
||||||
TGLabel * lbDataPath = new TGLabel(hfData, "Data Absolute Path :"); hfData->AddFrame(lbDataPath, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
TGVerticalFrame * vfTxt = new TGVerticalFrame(hfDB1); hfDB1->AddFrame(vfTxt);
|
||||||
txtDataPath = new TGTextEntry(hfData, DataSavingPath.c_str()); hfData->AddFrame(txtDataPath, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
||||||
txtDataPath->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataPath()");
|
TGLabel * lbIP = new TGLabel(vfLabel, "IP :"); vfLabel->AddFrame(lbIP, haha);
|
||||||
txtDataPath->Resize(300, 20);
|
TGLabel * lbDBName = new TGLabel(vfLabel, "DB Name :"); vfLabel->AddFrame(lbDBName, haha);
|
||||||
|
TGLabel * lbElogIP = new TGLabel(vfLabel, "Elog IP :"); vfLabel->AddFrame(lbElogIP, haha);
|
||||||
|
|
||||||
|
txtIP = new TGTextEntry(vfTxt, databaseIP.c_str()); vfTxt->AddFrame(txtIP, kaka);
|
||||||
|
txtIP->Resize(300, 20);
|
||||||
|
txtIP->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
||||||
|
|
||||||
|
txtDBName = new TGTextEntry(vfTxt, databaseName.c_str()); vfTxt->AddFrame(txtDBName, kaka);
|
||||||
|
txtDBName->Resize(300, 20);
|
||||||
|
txtDBName->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
||||||
|
|
||||||
|
txtElogIP = new TGTextEntry(vfTxt, ElogIP.c_str()); vfTxt->AddFrame(txtElogIP, kaka);
|
||||||
|
txtElogIP->Resize(300, 20);
|
||||||
|
txtElogIP->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
|
||||||
}
|
}
|
||||||
|
|
||||||
{///============== Read Time event building
|
{///============== Read Time event building
|
||||||
|
@ -65,25 +94,96 @@ ProgramSetting::~ProgramSetting(){
|
||||||
delete txtIP;
|
delete txtIP;
|
||||||
delete txtDBName;
|
delete txtDBName;
|
||||||
delete txtDataPath;
|
delete txtDataPath;
|
||||||
|
delete txtExpName;
|
||||||
|
delete txtElogIP;
|
||||||
|
|
||||||
fMain->Cleanup();
|
fMain->Cleanup();
|
||||||
delete fMain;
|
delete fMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgramSetting::SetDataBase(){
|
void ProgramSetting::SetSetting(){
|
||||||
|
|
||||||
IP = txtIP->GetText();
|
|
||||||
databaseName = txtDBName->GetText();
|
|
||||||
|
|
||||||
printf("IP: %s\n", IP.c_str());
|
|
||||||
printf("Name: %s\n", databaseName.c_str());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProgramSetting::SetDataPath(){
|
|
||||||
|
|
||||||
DataSavingPath = txtDataPath->GetText();
|
DataSavingPath = txtDataPath->GetText();
|
||||||
|
ExpName = txtExpName->GetText();
|
||||||
|
|
||||||
printf("DataSavingPath : %s\n", DataSavingPath.c_str());
|
databaseIP = txtIP->GetText();
|
||||||
|
databaseName = txtDBName->GetText();
|
||||||
|
|
||||||
|
ElogIP = txtElogIP->GetText();
|
||||||
|
|
||||||
|
PrintSettings();
|
||||||
|
|
||||||
|
SaveProgramSetting();
|
||||||
|
|
||||||
|
Emit("SetSetting()");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgramSetting::PrintSettings(){
|
||||||
|
|
||||||
|
printf("Data Saving Path : %s\n", DataSavingPath.c_str());
|
||||||
|
printf(" ExpName : %s\n", ExpName.c_str());
|
||||||
|
printf(" IP : %s\n", databaseIP.c_str());
|
||||||
|
printf(" Name : %s\n", databaseName.c_str());
|
||||||
|
printf(" Elog IP : %s\n", ElogIP.c_str());
|
||||||
|
printf(" last run ID : %d\n", lastRunID);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgramSetting::LoadProgramSetting(){
|
||||||
|
|
||||||
|
std::ifstream fileIn;
|
||||||
|
fileIn.open(ProgramSetting::settingFileName.c_str(), std::ios::in);
|
||||||
|
|
||||||
|
if( fileIn ){
|
||||||
|
std::string line;
|
||||||
|
int lineNum = 0;
|
||||||
|
size_t pos = 0;
|
||||||
|
while (fileIn.good() ){
|
||||||
|
std::getline(fileIn, line);
|
||||||
|
lineNum ++;
|
||||||
|
pos = line.find("=");
|
||||||
|
if( pos > 1 ){
|
||||||
|
pos += 2;
|
||||||
|
///printf("%d | %s , %d \n", lineNum, line.c_str(), pos);
|
||||||
|
switch ( lineNum ){
|
||||||
|
case 1: ProgramSetting::ExpName = line.substr(pos); break;
|
||||||
|
case 2: ProgramSetting::DataSavingPath = line.substr(pos); break;
|
||||||
|
case 3: ProgramSetting::databaseIP = line.substr(pos); break;
|
||||||
|
case 4: ProgramSetting::databaseName = line.substr(pos); break;
|
||||||
|
case 5: ProgramSetting::ElogIP = line.substr(pos); break;
|
||||||
|
case 6: lastRunID = std::atoi(line.substr(pos).c_str()); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileIn.close();
|
||||||
|
}else{
|
||||||
|
printf("%s | Cannot open file : %s.\n", __func__, ProgramSetting::settingFileName.c_str());
|
||||||
|
printf("Creating One with default setting");
|
||||||
|
SaveProgramSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgramSetting::SaveProgramSetting(){
|
||||||
|
|
||||||
|
printf("+++++++ %s \n", __func__);
|
||||||
|
|
||||||
|
FILE * fileOut = fopen(ProgramSetting::settingFileName.c_str(), "w");
|
||||||
|
if( fileOut != NULL ){
|
||||||
|
|
||||||
|
fputs( ("ExpName = " + ProgramSetting::ExpName + "\n").c_str(), fileOut);
|
||||||
|
fputs( ("DataPath = " + ProgramSetting::DataSavingPath + "\n").c_str(), fileOut);
|
||||||
|
fputs( ("DatabaseIP = " + ProgramSetting::databaseIP + "\n").c_str(), fileOut);
|
||||||
|
fputs( ("DatabaseName = " + ProgramSetting::databaseName + "\n").c_str(), fileOut);
|
||||||
|
fputs( ("ElogIP = " + ProgramSetting::ElogIP + "\n").c_str(), fileOut);
|
||||||
|
fputs( ("lastRunID = " + std::to_string(lastRunID) + "\n").c_str(), fileOut);
|
||||||
|
|
||||||
|
fclose(fileOut);
|
||||||
|
}else{
|
||||||
|
printf("%s | Cannot open file : %s.\n", __func__, ProgramSetting::settingFileName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ class ProgramSetting{
|
||||||
TGTextEntry * txtIP;
|
TGTextEntry * txtIP;
|
||||||
TGTextEntry * txtDBName;
|
TGTextEntry * txtDBName;
|
||||||
TGTextEntry * txtDataPath;
|
TGTextEntry * txtDataPath;
|
||||||
|
TGTextEntry * txtExpName;
|
||||||
|
TGTextEntry * txtElogIP;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ProgramSetting(const TGWindow *p);
|
ProgramSetting(const TGWindow *p);
|
||||||
|
@ -30,12 +32,20 @@ class ProgramSetting{
|
||||||
|
|
||||||
void CloseWindow() { delete this;}
|
void CloseWindow() { delete this;}
|
||||||
|
|
||||||
static std::string IP;
|
static std::string databaseIP;
|
||||||
static std::string databaseName;
|
static std::string databaseName;
|
||||||
static std::string DataSavingPath;
|
static std::string DataSavingPath;
|
||||||
|
static std::string ExpName;
|
||||||
|
static std::string ElogIP;
|
||||||
|
|
||||||
|
const static std::string settingFileName; // fixed as FSUDAQ.sh
|
||||||
|
|
||||||
|
void SetSetting(); // *SIGNAL*
|
||||||
|
|
||||||
|
static void PrintSettings();
|
||||||
|
static void LoadProgramSetting();
|
||||||
|
static void SaveProgramSetting();
|
||||||
|
|
||||||
void SetDataBase();
|
|
||||||
void SetDataPath();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user