basic settings are done. next, focus on data ACQ for multiple board
This commit is contained in:
parent
bf824f76a7
commit
408740f854
|
@ -55,6 +55,7 @@ class Data{
|
|||
void ClearTriggerRate();
|
||||
|
||||
void SaveBuffer(const char * fileName);
|
||||
unsigned int GetPresentFileSize() {return presentFileSizeByte;}
|
||||
|
||||
void PrintBuffer(); //Incorrect
|
||||
void DecodeBuffer(bool fastDecode, int verbose = 0);
|
||||
|
@ -78,6 +79,7 @@ class Data{
|
|||
int DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
||||
int DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
|
||||
|
||||
unsigned int presentFileSizeByte;
|
||||
unsigned short saveFileIndex;
|
||||
|
||||
};
|
||||
|
@ -158,6 +160,8 @@ inline void Data::SaveBuffer(const char * fileName){
|
|||
|
||||
fwrite(buffer, nByte, 1, haha);
|
||||
|
||||
presentFileSizeByte = ftell(haha);
|
||||
|
||||
fclose(haha);
|
||||
}
|
||||
|
||||
|
|
18
FSUDAQ.cpp
18
FSUDAQ.cpp
|
@ -212,7 +212,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
|
||||
/// setup thread
|
||||
//saveDataThread = new TThread("hahaha", SaveData, (void *) 1);
|
||||
fillHistThread = new TThread("kakaka", FillHistogram, (void *) 1);
|
||||
fillHistThread = new TThread("kakaka", RunThread, (void *) 1);
|
||||
|
||||
boardSetting = NULL;
|
||||
channelSettingPHA = NULL;
|
||||
|
@ -571,6 +571,14 @@ void MainWindow::OpenChannelSetting(Int_t boardID){
|
|||
}
|
||||
}
|
||||
|
||||
//TODO, should merge into LogMsg.
|
||||
void MainWindow::UpdateChannelSetting(){
|
||||
if( digi == NULL ) return;
|
||||
|
||||
if( channelSettingPHA != NULL ) channelSettingPHA->ChangeCh();
|
||||
if( channelSettingPSD != NULL ) channelSettingPSD->ChangeCh();
|
||||
}
|
||||
|
||||
void MainWindow::LogMsg(char * msg){
|
||||
|
||||
time_t now = time(0);
|
||||
|
@ -708,7 +716,7 @@ void MainWindow::FitTrace(){
|
|||
}
|
||||
|
||||
//TODO use the ptr to tell which board, and each digitizer has an indivual thread for savign data and filling hists.
|
||||
void * MainWindow::FillHistogram(void * ptr){
|
||||
void * MainWindow::RunThread(void * ptr){
|
||||
printf("=== %s\n", __func__);
|
||||
|
||||
if( digi == NULL ) return 0;
|
||||
|
@ -722,13 +730,14 @@ void * MainWindow::FillHistogram(void * ptr){
|
|||
uint32_t CurrentTime = 0;
|
||||
uint32_t ElapsedTime = 0;
|
||||
|
||||
TString dataFileName = dataPrefix->GetText();
|
||||
TString dataFileName = ProgramSetting::DataSavingPath + dataPrefix->GetText();
|
||||
dataFileName += Form("_run%03d_%03d", (int) runIDEntry->GetNumber(), (int) digi[boardID]->GetSerialNumber());
|
||||
|
||||
printf("|%s|\n", dataFileName.Data());
|
||||
|
||||
Data * data = digi[boardID]->GetData();
|
||||
data->AllocateMemory();
|
||||
unsigned int bufferSize = digi[boardID]->CalByteForBuffer();
|
||||
data->AllocateMemory(bufferSize);
|
||||
|
||||
while(digi[boardID]->IsRunning()){
|
||||
|
||||
|
@ -746,6 +755,7 @@ void * MainWindow::FillHistogram(void * ptr){
|
|||
if( cbMode->GetSelected() == Mode_DataRun ){
|
||||
// Rate graph?
|
||||
data->SaveBuffer(dataFileName.Data());
|
||||
LogMsg((char *) Form("File Size : %.2f MB", data->GetPresentFileSize() / 1024./1024. );
|
||||
|
||||
}else{
|
||||
|
||||
|
|
3
FSUDAQ.h
3
FSUDAQ.h
|
@ -88,7 +88,7 @@ public:
|
|||
void StartRun();
|
||||
void StopRun();
|
||||
|
||||
static void * FillHistogram(void * ptr); /// thread
|
||||
static void * RunThread(void * ptr); /// thread
|
||||
|
||||
void PlotSingleTrace();
|
||||
void FitTrace();
|
||||
|
@ -96,6 +96,7 @@ public:
|
|||
void Oscilloscope();
|
||||
|
||||
void OpenChannelSetting(Int_t);
|
||||
void UpdateChannelSetting();
|
||||
void LogMsg(char * );
|
||||
void GoodBye();
|
||||
|
||||
|
|
|
@ -360,6 +360,13 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d
|
|||
cbFanCtrl->Resize(100, 20);
|
||||
cbFanCtrl->Connect("Changed()", "BoardSetting", this, "SetFanSpeedControl()");
|
||||
|
||||
TGVerticalFrame * vBdCfga_haha = new TGVerticalFrame(hframeBdCfg3); hframeBdCfg3->AddFrame(vBdCfga_haha, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) );
|
||||
|
||||
TGLabel * lbBufferSize = new TGLabel(vBdCfga_haha, "Buffer Size [MByte]", kHorizontalFrame); vBdCfga_haha->AddFrame(lbBufferSize, kaka);
|
||||
txtBufferSize = new TGTextEntry(vBdCfga_haha, ""); vBdCfga_haha->AddFrame(txtBufferSize);
|
||||
txtBufferSize->SetEnabled(false);
|
||||
txtBufferSize->Resize(100, 20);
|
||||
|
||||
}
|
||||
|
||||
{///========== ACQ control
|
||||
|
@ -905,6 +912,8 @@ void BoardSetting::ChangeBoard(){
|
|||
cbAggOrg->Select( digi[boardID]->GetSettingFromMemory(Register::DPP::AggregateOrganization) , false);
|
||||
numAggBLT->SetNumber( digi[boardID]->GetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer) , false);
|
||||
|
||||
FillBufferSizeTextBox();
|
||||
|
||||
if( digi[boardID]->GetNChannel() == 8 ){
|
||||
///FAN Speed control only for desktop version
|
||||
cbFanCtrl->SetEnabled(true);
|
||||
|
@ -1139,6 +1148,10 @@ void BoardSetting::Haha(Int_t boardID){ /// this is for sending signal to mainwi
|
|||
Emit("Haha(Int_t)", boardID);
|
||||
}
|
||||
|
||||
void BoardSetting::TellChannelSettingtoUpdate(){
|
||||
Emit("TellChannelSettingtoUpdate()");
|
||||
}
|
||||
|
||||
void BoardSetting::ResetSettingToDefault(){ /// same for PHA and PSD
|
||||
printf("=== %s\n", __func__);
|
||||
|
||||
|
@ -1218,6 +1231,7 @@ void BoardSetting::SetAggregateOrganization(){ /// same for PHA and PSD
|
|||
int boardID = boardIDEntry->GetNumber();
|
||||
digi[boardID]->WriteRegister(Register::DPP::AggregateOrganization, cbAggOrg->GetSelected());
|
||||
|
||||
FillBufferSizeTextBox();
|
||||
}
|
||||
|
||||
void BoardSetting::SetReadOutAggregate(){ /// same for PHA and PSD
|
||||
|
@ -1227,6 +1241,8 @@ void BoardSetting::SetReadOutAggregate(){ /// same for PHA and PSD
|
|||
int boardID = boardIDEntry->GetNumber();
|
||||
digi[boardID]->WriteRegister(Register::DPP::MaxAggregatePerBlockTransfer, (unsigned int) numAggBLT->GetNumber());
|
||||
|
||||
FillBufferSizeTextBox();
|
||||
|
||||
}
|
||||
|
||||
void BoardSetting::SetFanSpeedControl(){ /// same for PHA and PSD
|
||||
|
@ -1504,10 +1520,15 @@ void BoardSetting::SaveSettingFile(){
|
|||
if( digi == NULL ) {
|
||||
|
||||
}else{
|
||||
|
||||
int boardID = boardIDEntry->GetNumber();
|
||||
digi[boardID]->OpenSettingBinary( fi.fFilename );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BoardSetting::FillBufferSizeTextBox(){
|
||||
if( digi == NULL ) return;
|
||||
int boardID = boardIDEntry->GetNumber();
|
||||
uint32_t buffer = digi[boardID]->CalByteForBuffer();
|
||||
txtBufferSize->SetText(Form("%.2f", buffer/1024./1024.));
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ class BoardSetting{
|
|||
TGNumberEntry * numAggBLT; /// number of Agg pre Block transfer
|
||||
TGComboBox * cbFanCtrl;
|
||||
|
||||
TGTextEntry * txtBufferSize;
|
||||
|
||||
/// ACQ control
|
||||
TGComboBox * cbAcqMode;
|
||||
TGCheckButton * bAcqArm;
|
||||
|
@ -177,11 +179,17 @@ class BoardSetting{
|
|||
|
||||
///==== Others
|
||||
void LogMsg(TString msg); // *SIGNAL*
|
||||
/// Haha is for sending signal to mainwindow to open channel setting for the board
|
||||
void Haha(Int_t boardID); // *SIGNAL*
|
||||
/// this send signal to MainWindows, and tell channel setting to update
|
||||
//TODO to merge to LogMsg
|
||||
void TellChannelSettingtoUpdate(); // *SIGNAL*
|
||||
|
||||
void ReadData();
|
||||
void ProgramDefaultBoard();
|
||||
void ProgramBoardFromFile();
|
||||
void SaveSettingFile();
|
||||
|
||||
void FillBufferSizeTextBox();
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
|
|||
fMain->SetWindowName("Channel Settings PHA");
|
||||
fMain->Connect("CloseWindow()", "ChannelSettingPHA", this, "CloseWindow()");
|
||||
|
||||
TGLayoutHints * layoutHintsR = new TGLayoutHints(kLHintsRight, 5,5,3,2); /// left, right, top, bottom
|
||||
TGLayoutHints * layoutHintsR = new TGLayoutHints(kLHintsRight, 5,5,3,3); /// left, right, top, bottom
|
||||
TGLayoutHints * layoutHints = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 5,5,0,0); /// left, right, top, bottom
|
||||
|
||||
TGVerticalFrame * vframe = new TGVerticalFrame(fMain);
|
||||
|
@ -118,6 +118,11 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
|
|||
numEventAgg->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 511);
|
||||
numEventAgg->Connect("Modified()", "ChannelSettingPHA", this, "SetEventAggregate()");
|
||||
|
||||
TGLabel * lbBuffer = new TGLabel(vfInput1, "Buffer Size [MByte]"); vfInput1->AddFrame(lbBuffer, layoutHintsR);
|
||||
eBuffer = new TGTextEntry(vfInput2,""); vfInput2->AddFrame(eBuffer, layoutHints);
|
||||
eBuffer->Resize(width, 20);
|
||||
eBuffer->SetEnabled(false);
|
||||
|
||||
///const uint32_t ChannelDCOffset = 0x1098; /// R/W
|
||||
TGLabel * lbDCOffset = new TGLabel(vfInput1, "DC offset [%]"); vfInput1->AddFrame(lbDCOffset, layoutHintsR);
|
||||
numDCOffset = new TGNumberEntry(vfInput2, 20, 0, 0, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative); vfInput2->AddFrame(numDCOffset, layoutHints);
|
||||
|
@ -680,6 +685,10 @@ void ChannelSettingPHA::SetEventAggregate() {
|
|||
short ch = chIDEntry->GetNumber();
|
||||
unsigned int temp = numEventAgg->GetNumber();
|
||||
if( digi != NULL ) digi[boardID]->WriteRegister(Register::DPP::NumberEventsPerAggregate_G, temp , ch);
|
||||
|
||||
uint32_t buffer = digi[boardID]->CalByteForBuffer();
|
||||
eBuffer->SetText(Form("%.2f", buffer/1024./1024.));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class ChannelSettingPHA{
|
|||
TGNumberEntry * numRecordLength;
|
||||
TGNumberEntry * numPreTrigger;
|
||||
TGNumberEntry * numEventAgg;
|
||||
|
||||
TGTextEntry * eBuffer ;
|
||||
|
||||
TGNumberEntry * numTriggerThreshold;
|
||||
TGNumberEntry * numTriggerHoldOff;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
std::string ProgramSetting::IP = "http://fsunuc.physics.fsu.edu/influx/";
|
||||
std::string ProgramSetting::databaseName = "testing";
|
||||
std::string ProgramSetting::DataSavingPath = "/home/catrina/FSUDAQ/";
|
||||
|
||||
ProgramSetting::ProgramSetting(const TGWindow *p){
|
||||
fMain = new TGMainFrame(p, 600, 400);
|
||||
|
@ -20,7 +21,7 @@ ProgramSetting::ProgramSetting(const TGWindow *p){
|
|||
TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe);
|
||||
|
||||
{///============== Database
|
||||
TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database Setting", kHorizontalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandY, 5, 5, 5, 5));
|
||||
TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database Setting", kHorizontalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandY | kLHintsExpandX , 5, 5, 5, 5));
|
||||
|
||||
TGVerticalFrame * vfDB = new TGVerticalFrame(gfDatabase); gfDatabase->AddFrame(vfDB);
|
||||
|
||||
|
@ -37,6 +38,18 @@ ProgramSetting::ProgramSetting(const TGWindow *p){
|
|||
|
||||
}
|
||||
|
||||
{///============== Data Saving Path
|
||||
TGGroupFrame * gfData = new TGGroupFrame(vframe, "Data Storage", kHorizontalFrame); vframe->AddFrame(gfData, new TGLayoutHints(kLHintsExpandY | kLHintsExpandY , 5, 5, 5, 5));
|
||||
|
||||
TGVerticalFrame * vfData = new TGVerticalFrame(gfData); gfData->AddFrame(vfData);
|
||||
|
||||
TGHorizontalFrame * hfData = new TGHorizontalFrame(vfData); vfData->AddFrame(hfData);
|
||||
TGLabel * lbDataPath = new TGLabel(hfData, "Data Absolute Path :"); hfData->AddFrame(lbDataPath, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
||||
txtDataPath = new TGTextEntry(hfData, DataSavingPath.c_str()); hfData->AddFrame(txtDataPath, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
||||
txtDataPath->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataPath()");
|
||||
txtDataPath->Resize(300, 20);
|
||||
}
|
||||
|
||||
{///============== Read Time event building
|
||||
|
||||
|
||||
|
@ -65,3 +78,11 @@ void ProgramSetting::SetDataBase(){
|
|||
printf("Name: %s\n", databaseName.c_str());
|
||||
|
||||
}
|
||||
|
||||
void ProgramSetting::SetDataPath(){
|
||||
|
||||
DataSavingPath = txtDataPath->GetText();
|
||||
|
||||
printf("DataSavingPath : %s\n", DataSavingPath.c_str());
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ class ProgramSetting{
|
|||
|
||||
TGTextEntry * txtIP;
|
||||
TGTextEntry * txtDBName;
|
||||
TGTextEntry * txtDataPath;
|
||||
|
||||
public:
|
||||
ProgramSetting(const TGWindow *p);
|
||||
|
@ -31,8 +32,10 @@ class ProgramSetting{
|
|||
|
||||
static std::string IP;
|
||||
static std::string databaseName;
|
||||
static std::string DataSavingPath;
|
||||
|
||||
void SetDataBase();
|
||||
void SetDataPath();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user