restructure folder

This commit is contained in:
carina@hades 2022-10-31 15:00:04 -04:00
parent c7858024a7
commit 68c55663ba
30 changed files with 133 additions and 73 deletions

2
.gitignore vendored
View File

@ -12,4 +12,4 @@ FSUDAQ
test_indep
EventBuilder
FSUDAQ.sh
expDir

View File

@ -97,7 +97,7 @@ class Data{
//==========================================
inline Data::Data(){
printf("----- %s \n", __func__);
ch2ns = 2.0;
boardSN = 0;
DPPType = V1730_DPP_PHA_CODE;
@ -112,6 +112,7 @@ inline Data::Data(){
}
inline Data::~Data(){
printf("----- %s \n", __func__);
delete buffer;
}

View File

@ -1,6 +1,7 @@
#include "ClassDigitizer.h"
Digitizer::Digitizer(){
printf("----- %s \n", __func__);
Initalization();
}
@ -10,6 +11,7 @@ Digitizer::Digitizer(int boardID, int portID, bool program, bool verbose){
}
Digitizer::~Digitizer(){
printf("----- %s \n", __func__);
delete data;
delete settingFile;
CloseDigitizer();
@ -378,14 +380,14 @@ unsigned int Digitizer::CalByteForBuffer(){
}
}
printf(" agg. orgainzation (bit) : 0x%X \n", aggOrgan);
printf(" Channel Mask : %04X \n", chMask);
printf("Max number of Agg per Readout : %u \n", numAggBLT);
printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) );
printf(" is Record wave : %u \n", ((boardCfg >> 16) & 0x1) );
for( int pCh = 0; pCh < NChannel/2; pCh++){
printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]);
}
///printf(" agg. orgainzation (bit) : 0x%X \n", aggOrgan);
///printf(" Channel Mask : %04X \n", chMask);
///printf("Max number of Agg per Readout : %u \n", numAggBLT);
///printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) );
///printf(" is Record wave : %u \n", ((boardCfg >> 16) & 0x1) );
///for( int pCh = 0; pCh < NChannel/2; pCh++){
/// printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]);
///}
unsigned int bufferSize = 0;
for( int pCh = 0; pCh < NChannel/2 ; pCh++){
@ -395,7 +397,7 @@ unsigned int Digitizer::CalByteForBuffer(){
bufferSize += 4; /// Bd. Agg Header
bufferSize = bufferSize * numAggBLT * 4; /// 1 words = 4 byte
printf("=============== Buffer Size : %8d Byte \n", bufferSize );
///printf("=============== Buffer Size : %8d Byte \n", bufferSize );
return bufferSize ;
}

View File

@ -96,6 +96,8 @@ enum ModeIdentifiers{
MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
printf("----- %s \n", __func__);
nDigi = 0;
gClient->GetColorByName("red", red);
@ -263,7 +265,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
//HandleMenu(M_PROGRAM_SETTINGS);
gDummy = new TGraph();
gDummy->SetPoint(0, 0, -1000); /// the lower left corner
gDummy->SetPoint(0, 0, 0); /// the lower left corner
gDummy->GetXaxis()->SetTitle("[ns]");
gAnaTrace1 = new TGraph();
@ -281,9 +283,39 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
gStyle->SetOptStat("neiou");
DrawDummyGraph();
}
void MainWindow::GoodBye(){
for( int i = 0; i < nDigi; i++) digi[i]->CloseDigitizer();
for( int i = 0; i < nDigi; i++) delete digi[i];
for( int i = 0; i < MaxNBoards; i++){
delete hChannel[i];
for( int j = 0; j < MaxNChannels; j++){
delete hEnergy[i][j];
}
}
delete gDummy;
delete gAnaTrace1 ;
delete gAnaTrace2 ;
delete gDigiTrace1;
delete gDigiTrace2;
printf("----- bye bye ---- \n");
gApplication->Terminate(0);
}
MainWindow::~MainWindow() {
/// The destrcutor is overrided by GoodBye();
printf("----- %s \n", __func__);
delete fMenuBar;
delete fMenuFile;
@ -313,11 +345,8 @@ MainWindow::~MainWindow() {
delete registerSetting;
delete triggerSummary;
delete programSetting;
delete fillHistThread;
/// Clean up used widgets: frames, buttons, layout hints
fMain->Cleanup();
delete fMain;
}
@ -326,12 +355,7 @@ void MainWindow::HandleMenu(Int_t id){
///========================= Scan digitizers
case M_DIGITIZER_OPEN:{
OpenDigitizers();
//fMenuDigitizers->EnableEntry( M_BOARD_SETTINGS);
//fMenuDigitizers->EnableEntry( M_CH_SETTING);
}break;
///========================= File Open
@ -486,14 +510,12 @@ void MainWindow::LoadSettingFromFile(){
"Text files", "*.[tT][xX][tT]",
0, 0 };
static TString dir(".");
TGFileInfo fi;
fi.fFileTypes = filetypes;
fi.SetIniDir(dir);
fi.SetIniDir(".");
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( fi.fFilename == NULL) return;
@ -510,10 +532,6 @@ void MainWindow::LoadSettingFromFile(){
loadStatus = digi[0]->LoadSettingBinary( fi.fFilename ); /// still dummy digitizer
}
//if( boardSetting != NULL ) boardSetting->CloseWindow();
//if( channelSettingPHA != NULL ) channelSettingPHA->CloseWindow();
//if( channelSettingPSD != NULL ) channelSettingPSD->CloseWindow();
HandleMenu(M_BOARD_SETTINGS);
OpenChannelSetting(0);
@ -525,15 +543,6 @@ void MainWindow::ChangeBoard(){
ChangePlot();
}
void MainWindow::GoodBye(){
for( int i = 0; i < nDigi; i++) digi[i]->CloseDigitizer();
printf("----- bye bye ---- \n");
gApplication->Terminate(0);
}
void MainWindow::UpdateExpName(){
dataPrefix->SetText(ProgramSetting::ExpName.c_str());
runIDEntry->SetNumber(lastRunID);
@ -648,6 +657,23 @@ void MainWindow::LogMsg(char * msg){
}
void MainWindow::DrawDummyGraph(){
int boardID = boardIDEntry->GetNumber();
int chID = chIDEntry->GetNumber();
int ch2ns = (int) digi[boardID]->GetCh2ns();
fEcanvas->GetCanvas()->cd();
uint32_t rl = digi[boardID]->GetSettingFromMemory(Register::DPP::RecordLength_G, chID);
gDummy->SetPoint(1, 8.*rl*ch2ns, 0);
gDummy->SetLineColor(15);
gDummy->Draw("AL");
gDummy->GetXaxis()->SetRangeUser(0, 8*rl*ch2ns);
gDummy->GetYaxis()->SetRangeUser(-1000, 0x3FFF);
}
void MainWindow::PlotSingleTrace(){
printf("=== %s\n", __func__);
@ -668,14 +694,7 @@ void MainWindow::PlotSingleTrace(){
Data * data = digi[boardID]->GetData();
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);
DrawDummyGraph();
digi[boardID]->StartACQ();
@ -780,10 +799,13 @@ void MainWindow::ChangePlot(){
if( cbMode->GetSelected() == Mode_EnergyHist ) hEnergy[boardID][ch]->Draw("hist");
if( cbMode->GetSelected() == Mode_Oscilloscope ){
DrawDummyGraph();
uint32_t bdConfig = digi[boardID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
bool isDualTrace = ( bdConfig >> 11 ) & 0x1;
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
gAnaTrace1->Draw("APL");
gAnaTrace1->Draw("L");
if( isDualTrace ) gAnaTrace2->Draw("L");
gDigiTrace1->Draw("L");
}
@ -807,7 +829,7 @@ void * MainWindow::RunThread(void * ptr){
uint32_t CurrentTime = 0;
uint32_t ElapsedTime = 0;
TString dataFileName = ProgramSetting::DataSavingPath + dataPrefix->GetText();
TString dataFileName = ProgramSetting::DataSavingPath + "/" + dataPrefix->GetText();
dataFileName += Form("_run%03d", (int) runIDEntry->GetNumber());
printf("|%s|\n", dataFileName.Data());
@ -818,6 +840,8 @@ void * MainWindow::RunThread(void * ptr){
Data * data = digi[boardID]->GetData();
DrawDummyGraph();
while(digi[boardID]->IsRunning()){
usleep(100*1000); /// wait 100 msec
@ -847,18 +871,6 @@ void * MainWindow::RunThread(void * ptr){
data->DecodeBuffer(false, 0);
}
}
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){

View File

@ -91,6 +91,6 @@ public:
void UpdateChannelSetting();
void LogMsg(char * );
void GoodBye();
static void DrawDummyGraph();
};

View File

@ -27,7 +27,8 @@ extern unsigned short nDigi;
extern Digitizer ** digi;
BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h){
printf("----- %s \n", __func__);
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Board Settings & Status");
fMain->Connect("CloseWindow()", "BoardSetting", this, "CloseWindow()");
@ -623,7 +624,7 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h){
bReadData->Connect("Clicked()", "BoardSetting", this, "ReadData()");
TGTextButton * bCaliADC = new TGTextButton(vfButton, "Calibrate ADC"); vfButton->AddFrame(bCaliADC, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0));
bCaliADC->Connect("Clicked()", "ChannelSettingPHA", this, "CaliADC()");
bCaliADC->Connect("Clicked()", "BoardSetting", this, "CaliADC()");
}
@ -770,7 +771,7 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h){
}
BoardSetting::~BoardSetting(){
printf("----- %s \n", __func__);
isOpened = false;
printf("close BoardSetting window\n");
@ -1477,19 +1478,14 @@ void BoardSetting::ProgramDefaultBoard(){
void BoardSetting::ProgramBoardFromFile(){
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);
fi.SetIniDir(".");
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( fi.fFilename == NULL) return;
@ -1517,14 +1513,12 @@ void BoardSetting::SaveSettingFile(){
"Text File", "*.txt",
0, 0};
static TString dir(".");
TGFileInfo fi;
fi.fFileTypes = filetypes;
fi.SetIniDir(dir);
fi.SetIniDir(".");
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), fMain, kFDSave, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
dir = fi.fIniDir;
if( fi.fFilename == NULL) return;

View File

@ -18,6 +18,8 @@ extern Digitizer ** digi;
ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, int boardID){
printf("----- %s \n", __func__);
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Channel Settings PHA");
fMain->Connect("CloseWindow()", "ChannelSettingPHA", this, "CloseWindow()");
@ -459,6 +461,8 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, int
}
ChannelSettingPHA::~ChannelSettingPHA(){
printf("----- %s \n", __func__);
printf("close ChannelSettingPHA window\n");
isOpened = false;

View File

@ -16,6 +16,8 @@ extern Digitizer ** digi;
ChannelSettingPSD::ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, int boardID){
printf("----- %s \n", __func__);
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Channel Settings PSD");
fMain->Connect("CloseWindow()", "ChannelSettingPSD", this, "CloseWindow()");
@ -467,6 +469,8 @@ ChannelSettingPSD::ChannelSettingPSD(const TGWindow *p, UInt_t w, UInt_t h, int
}
ChannelSettingPSD::~ChannelSettingPSD(){
printf("----- %s \n", __func__);
printf("close ChannelSettingPSD window\n");
isOpened = false;

View File

@ -14,7 +14,7 @@
std::string ProgramSetting::databaseIP = "http://fsunuc.physics.fsu.edu/influx/";
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";
@ -24,6 +24,9 @@ const std::string ProgramSetting::settingFileName = "FSUDAQ.sh";
extern unsigned short lastRunID;
ProgramSetting::ProgramSetting(const TGWindow *p){
printf("----- %s \n", __func__);
fMain = new TGMainFrame(p, 600, 400);
fMain->SetWindowName("Program Setting");
fMain->Connect("CloseWindow()", "ProgramSetting", this, "CloseWindow()");
@ -40,6 +43,7 @@ ProgramSetting::ProgramSetting(const TGWindow *p){
TGVerticalFrame * vfLabel = new TGVerticalFrame(hfData, 200); hfData->AddFrame(vfLabel );
TGVerticalFrame * vfTxt = new TGVerticalFrame(hfData); hfData->AddFrame(vfTxt);
TGVerticalFrame * vfAux = new TGVerticalFrame(hfData); hfData->AddFrame(vfAux);
TGLabel * lbExpName = new TGLabel(vfLabel, "ExpName :"); vfLabel->AddFrame(lbExpName, haha);
TGLabel * lbDataPath = new TGLabel(vfLabel, "Data Absolute Path :"); vfLabel->AddFrame(lbDataPath, haha);
@ -52,6 +56,12 @@ ProgramSetting::ProgramSetting(const TGWindow *p){
txtDataPath->Connect("ReturnPressed()", "ProgramSetting", this, "SetSetting()");
txtDataPath->Resize(300, 20);
TGLabel * lbdummy0 = new TGLabel(vfAux, ""); vfAux->AddFrame(lbdummy0, haha);
TGTextButton * bSetFolder = new TGTextButton(vfAux, "Set Folder"); vfAux->AddFrame(bSetFolder, kaka);
bSetFolder->Connect("Clicked()", "ProgramSetting", this, "SetFolder()");
}
{///============== Database & Elog
@ -91,6 +101,8 @@ ProgramSetting::ProgramSetting(const TGWindow *p){
ProgramSetting::~ProgramSetting(){
printf("----- %s \n", __func__);
delete txtIP;
delete txtDBName;
delete txtDataPath;
@ -119,6 +131,25 @@ void ProgramSetting::SetSetting(){
}
void ProgramSetting::SetFolder(){
const char *filetypes[] = { "All Files", "*.*", 0, 0 };
TGFileInfo fi;
fi.fFileTypes = filetypes;
fi.SetIniDir(".");
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), fMain, kDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
if( fi.fFilename == NULL) return;
txtDataPath->SetText(fi.fFilename);
SetSetting();
}
void ProgramSetting::PrintSettings(){
printf("Data Saving Path : %s\n", DataSavingPath.c_str());

View File

@ -46,6 +46,8 @@ class ProgramSetting{
static void LoadProgramSetting();
static void SaveProgramSetting();
void SetFolder();
};
#endif

View File

@ -13,7 +13,9 @@ extern unsigned short nDigi;
extern Digitizer ** digi;
RegisterSetting::RegisterSetting(const TGWindow *p, UInt_t w, UInt_t h, uint32_t address){
printf("----- %s \n", __func__);
for( int i = 0; i < MaxNChannels; i++) value[i] = 0;
fMain = new TGMainFrame(p,w,h);

View File

@ -22,6 +22,8 @@ unsigned short TriggerSummary::value[MaxNBoards][MaxNChannels] = {0};
TriggerSummary::TriggerSummary(const TGWindow *p, UInt_t w, UInt_t h){
printf("----- %s \n", __func__);
fMain = new TGMainFrame(p,w,h);
fMain->SetWindowName("Scalar Panel");
fMain->Connect("CloseWindow()", "TriggerSummary", this, "CloseWindow()");

6
FSUDAQ.sh Executable file
View File

@ -0,0 +1,6 @@
ExpName = ZZZZZ
DataPath = /home/catrina/FSUDAQ/expDir
DatabaseIP = http://fsunuc.physics.fsu.edu/influx/
DatabaseName = testing
ElogIP = 128.186.111.127
lastRunID = 10