added database and elog functions
This commit is contained in:
parent
fb5ba0150f
commit
d63a53c3a6
|
@ -314,7 +314,9 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
|
|||
if( NumEventsDecoded[ch] > 0 ) IsNotRollOverFakeAgg = true;
|
||||
unsigned long long dTime = Timestamp[ch][NumEvents[ch]-1] - Timestamp[ch][NumEvents[ch] - NumEventsDecoded[ch]];
|
||||
double sec = dTime * ch2ns / 1e9;
|
||||
TriggerRate[ch] = NumEventsDecoded[ch]/sec;
|
||||
if( sec != 0 ){
|
||||
TriggerRate[ch] = NumEventsDecoded[ch]/sec;
|
||||
}
|
||||
|
||||
firstTimestamp[ch] = Timestamp[ch][0];
|
||||
lastTimestamp[ch] = Timestamp[ch][NumEvents[ch]-1];
|
||||
|
|
|
@ -194,6 +194,9 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
|
||||
cbDataRun = new TGCheckButton(hfg1, "Data Run", 1); hfg1->AddFrame(cbDataRun, hahaLayoutHints);
|
||||
cbDataRun->SetState(kButtonUp);
|
||||
|
||||
TGHorizontalFrame *hfg2 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg2 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||
|
||||
}
|
||||
|
||||
{///================= single Channel group
|
||||
|
@ -258,6 +261,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
LogMsg((char*)"The LogMsg is not complete for all actions. [update later]");
|
||||
LogMsg((char*)"Please \"Program Setting\" to set data folder");
|
||||
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
||||
LogMsg((char*)"OR. \"Load Setting (Offline)\" for inspecting setting file.");
|
||||
|
||||
//HandleMenu(M_DIGITIZER_OPEN);
|
||||
//HandleMenu(M_BOARD_SETTINGS);
|
||||
|
@ -552,6 +556,15 @@ void MainWindow::UpdateExpName(){
|
|||
runIDEntry->SetNumber(lastRunID);
|
||||
}
|
||||
|
||||
void MainWindow::MakeElogEntry(bool start){
|
||||
|
||||
if( ProgramSetting::EnableElog == false ) return;
|
||||
|
||||
TString cmd = Form("%s/DAQ/elogEntry.sh %d", ProgramSetting::programPath.c_str(), start);
|
||||
int temp = system(cmd.Data());
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::StartRun(){
|
||||
LogMsg(Form("%s",__func__));
|
||||
if( digi == NULL) return;
|
||||
|
@ -572,9 +585,11 @@ void MainWindow::StartRun(){
|
|||
|
||||
if( cbDataRun->GetState() == kButtonDown ) {
|
||||
cbMode->SetEnabled(false);
|
||||
HandleMenu(M_TRIGGER_SUMMARY);
|
||||
MakeElogEntry(true);
|
||||
}
|
||||
|
||||
HandleMenu(M_TRIGGER_SUMMARY);
|
||||
|
||||
bool threadFlag = false;
|
||||
for( int i = 0 ; i < nDigi; i++) {
|
||||
digi[i]->StartACQ();
|
||||
|
@ -611,9 +626,9 @@ void MainWindow::StopRun(){
|
|||
///if( cbMode->GetSelected() == Mode_DataRun ){
|
||||
if( cbDataRun->GetState() == kButtonDown ) {
|
||||
int runID = runIDEntry->GetNumber();
|
||||
lastRunID = runID;
|
||||
lastRunID = runID + 1;
|
||||
runIDEntry->SetNumber(runID +1);
|
||||
|
||||
MakeElogEntry(false);
|
||||
ProgramSetting::SaveProgramSetting();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
#include "macro.h"
|
||||
#include "ClassDigitizer.h"
|
||||
|
||||
#include "programSetting.h"
|
||||
#include "boardSetting.h"
|
||||
#include "channelSettingPHA.h"
|
||||
#include "channelSettingPSD.h"
|
||||
#include "registerSetting.h"
|
||||
#include "triggerSummary.h"
|
||||
#include "programSetting.h"
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
@ -94,4 +94,6 @@ public:
|
|||
void GoodBye();
|
||||
static void DrawDummyGraph();
|
||||
|
||||
static void MakeElogEntry(bool start); /// call elogEntry.sh bash script
|
||||
|
||||
};
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../FSUDAQ.sh
|
|
@ -25,19 +25,20 @@ ClassDigitizer.o : ClassDigitizer.cpp ClassDigitizer.h RegisterAddress.h macro.h
|
|||
|
||||
test : test.cpp ClassDigitizer.o
|
||||
@echo "--------- making test"
|
||||
$(CC) $(COPTS) -o test test.cpp ClassDigitizer.o $(CAENLIBS) $(ROOTLIBS)
|
||||
$(CC) $(COPTS) -o ../test test.cpp ClassDigitizer.o $(CAENLIBS) $(ROOTLIBS)
|
||||
|
||||
EventBuilder : EventBuilder.cpp ClassData.h
|
||||
@echo "--------- making EventBuilder"
|
||||
$(CC) $(COPTS) -o EventBuilder EventBuilder.cpp $(ROOTLIBS)
|
||||
$(CC) $(COPTS) -o ../Analysis/EventBuilder EventBuilder.cpp $(ROOTLIBS)
|
||||
|
||||
test_indep : test_indep.cpp RegisterAddress.h macro.h
|
||||
@echo "--------- making test_indep"
|
||||
$(CC) $(COPTS) -o test_indep test_indep.cpp $(CAENLIBS)
|
||||
$(CC) $(COPTS) -o ../test_indep test_indep.cpp $(CAENLIBS)
|
||||
|
||||
FSUDAQ : FSUDAQDict.cxx $(OBJS) ClassData.h
|
||||
@echo "----------- creating FSUDAQ"
|
||||
$(CC) $(COPTS) FSUDAQDict.cxx $(OBJS) -o FSUDAQ $(CAENLIBS) $(ROOTLIBS)
|
||||
$(CC) $(COPTS) FSUDAQDict.cxx $(OBJS) -o ../FSUDAQ $(CAENLIBS) $(ROOTLIBS)
|
||||
@ln -s -f DAQ/FSUDAQDict_rdict.pcm ../.
|
||||
|
||||
FSUDAQDict.cxx : FSUDAQ.h FSUDAQLinkDef.h
|
||||
@echo "----------- creating pcm and cxx for root"
|
||||
|
|
15
DAQ/elogEntry.sh
Executable file
15
DAQ/elogEntry.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash -l
|
||||
|
||||
source ~/FSUDAQ/FSUDAQ.sh
|
||||
|
||||
echo $ElogIP
|
||||
|
||||
elogFileName="elogText.txt"
|
||||
|
||||
#make text file for elog text
|
||||
echo "**************************************" > ${elogFileName}
|
||||
echo "Run-${lastRunID} start at $(date)" >> ${elogFileName}
|
||||
|
||||
|
||||
#push to elog
|
||||
elog -h ${ElogIP} -l ${ExpName} -u GeneralFox fsuphysics888 -a Author="GeneralFox" -a Category="Run" -a RunNo=${lastRunID} -a Subject="Start Run" -n 2 -m elogText.txt
|
|
@ -17,16 +17,18 @@
|
|||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
|
||||
std::string ProgramSetting::databaseIP = "http://fsunuc.physics.fsu.edu/influx/";
|
||||
std::string ProgramSetting::databaseIP = "https://fsunuc.physics.fsu.edu/influx/";
|
||||
std::string ProgramSetting::databaseName = "testing";
|
||||
std::string ProgramSetting::DataSavingPath = "/home/catrina/FSUDAQ";
|
||||
std::string ProgramSetting::ExpName = "Test";
|
||||
std::string ProgramSetting::ElogIP = "128.186.111.127";
|
||||
|
||||
bool ProgramSetting::EnableElog = false;
|
||||
bool ProgramSetting::EnableDatabase = false;
|
||||
bool ProgramSetting::EnableElog = true;
|
||||
bool ProgramSetting::EnableDatabase = true;
|
||||
|
||||
/// fixed program things
|
||||
const std::string ProgramSetting::settingFileName = "FSUDAQ.sh";
|
||||
const std::string ProgramSetting::programPath = "~/FSUDAQ/";
|
||||
|
||||
///this is declared at FSUDAQ.cpp
|
||||
extern unsigned short lastRunID;
|
||||
|
@ -102,11 +104,19 @@ ProgramSetting::ProgramSetting(const TGWindow *p){
|
|||
TGLabel * lbdummy0 = new TGLabel(vfOnOff, ""); vfOnOff->AddFrame(lbdummy0, haha);
|
||||
|
||||
cbDatabase = new TGCheckButton(vfOnOff, "Enable Database", 1); vfOnOff->AddFrame(cbDatabase, kaka);
|
||||
cbDatabase->SetState(kButtonUp);
|
||||
if( ProgramSetting::EnableDatabase ){
|
||||
cbDatabase->SetState(kButtonDown);
|
||||
}else{
|
||||
cbDatabase->SetState(kButtonUp);
|
||||
}
|
||||
cbDatabase->Connect("Clicked()", "ProgramSetting", this, "SetDataBaseElogOnOff()");
|
||||
|
||||
cbElog = new TGCheckButton(vfOnOff, "Enable Elog", 1); vfOnOff->AddFrame(cbElog, kaka);
|
||||
cbElog->SetState(kButtonUp);
|
||||
if( ProgramSetting::EnableElog ){
|
||||
cbElog->SetState(kButtonDown);
|
||||
}else{
|
||||
cbElog->SetState(kButtonUp);
|
||||
}
|
||||
cbElog->Connect("Clicked()", "ProgramSetting", this, "SetDataBaseElogOnOff()");
|
||||
|
||||
}
|
||||
|
@ -208,7 +218,7 @@ void ProgramSetting::LoadProgramSetting(){
|
|||
lineNum ++;
|
||||
pos = line.find("=");
|
||||
if( pos > 1 ){
|
||||
pos += 2;
|
||||
pos += 1;
|
||||
///printf("%d | %s , %d \n", lineNum, line.c_str(), pos);
|
||||
switch ( lineNum ){
|
||||
case 1: ProgramSetting::ExpName = line.substr(pos); break;
|
||||
|
@ -235,22 +245,24 @@ void ProgramSetting::SaveProgramSetting(){
|
|||
|
||||
printf("+++++++ %s \n", __func__);
|
||||
|
||||
FILE * fileOut = fopen(ProgramSetting::settingFileName.c_str(), "w");
|
||||
std::string filePath = ProgramSetting::settingFileName;
|
||||
|
||||
FILE * fileOut = fopen(filePath.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);
|
||||
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);
|
||||
|
||||
gSystem->CopyFile(ProgramSetting::settingFileName.c_str(), (ProgramSetting::DataSavingPath + "/FSUDAQ.sh").c_str(), true); /// overwrite
|
||||
|
||||
}else{
|
||||
printf("%s | Cannot open file : %s.\n", __func__, ProgramSetting::settingFileName.c_str());
|
||||
printf("%s | Cannot open file : %s.\n", __func__, filePath.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ class ProgramSetting{
|
|||
static bool EnableDatabase;
|
||||
|
||||
const static std::string settingFileName; // fixed as FSUDAQ.sh
|
||||
const static std::string programPath;
|
||||
|
||||
void SetSetting(); // *SIGNAL*
|
||||
|
||||
|
|
|
@ -7,11 +7,17 @@
|
|||
#include <TGTableContainer.h>
|
||||
#include <TGFileDialog.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "programSetting.h"
|
||||
#include "triggerSummary.h"
|
||||
|
||||
extern unsigned short nDigi;
|
||||
extern Digitizer ** digi;
|
||||
|
||||
//extern bool ProgramSetting::EnableDatabase;
|
||||
|
||||
bool TriggerSummary::updateFlag = true;
|
||||
TGTextEntry * TriggerSummary::txtTrigger[MaxNBoards][MaxNChannels] = {NULL};
|
||||
TGTextEntry * TriggerSummary::txtThresholdValue[MaxNBoards][MaxNChannels] = {NULL};
|
||||
|
@ -83,7 +89,7 @@ TriggerSummary::TriggerSummary(const TGWindow *p, UInt_t w, UInt_t h){
|
|||
TGLabel * lbUpDateTime = new TGLabel(hframeSetting, "Update Period [msec]:");
|
||||
hframeSetting->AddFrame(lbUpDateTime, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
||||
|
||||
numUpdateTime = new TGNumberEntry(hframeSetting, 500, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||
numUpdateTime = new TGNumberEntry(hframeSetting, 3000, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||
hframeSetting->AddFrame(numUpdateTime, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
||||
numUpdateTime->Resize(50, 20);
|
||||
|
||||
|
@ -125,16 +131,33 @@ TriggerSummary::~TriggerSummary(){
|
|||
|
||||
void * TriggerSummary::UpdateTriggerRate(void * ptr){
|
||||
|
||||
std::string cmd = "curl -XPOST " + ProgramSetting::databaseIP + "/write?db=" + ProgramSetting::databaseName + " --data-binary @tempDB.txt";
|
||||
|
||||
std::ofstream myfile;
|
||||
|
||||
while( updateFlag){
|
||||
///printf("==================== %s\n", __func__);
|
||||
|
||||
|
||||
if( ProgramSetting::EnableDatabase ) myfile.open( "tempDB.txt");
|
||||
|
||||
for( int bd = 0; bd < nDigi; bd++){
|
||||
for( int ch = 0; ch < digi[bd]->GetNChannel(); ch++){
|
||||
txtTrigger[bd][ch]->SetText(Form("%.2f", digi[bd]->GetData()->TriggerRate[ch]));
|
||||
value[bd][ch] = digi[bd]->GetSettingFromMemory(Register::DPP::PHA::TriggerThreshold, ch);
|
||||
txtThresholdValue[bd][ch]->SetText(Form("%d", value[bd][ch]), false);
|
||||
|
||||
if( ProgramSetting::EnableDatabase ) {
|
||||
myfile << "Rate,Bd=" << bd << ",Ch=" << ch << " value=" << digi[bd]->GetData()->TriggerRate[ch] << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ProgramSetting::EnableDatabase ){
|
||||
myfile.close();
|
||||
int temp = system(cmd.c_str());
|
||||
}
|
||||
|
||||
usleep(numUpdateTime->GetNumber() * 1000);
|
||||
}
|
||||
|
||||
|
|
12
FSUDAQ.sh
12
FSUDAQ.sh
|
@ -1,6 +1,6 @@
|
|||
ExpName = ZZZZZ
|
||||
DataPath = /home/catrina/FSUDAQ/expDir
|
||||
DatabaseIP = http://fsunuc.physics.fsu.edu/influx/
|
||||
DatabaseName = testing
|
||||
ElogIP = 128.186.111.127
|
||||
lastRunID = 0
|
||||
ExpName=ZZZZZ
|
||||
DataPath=/home/catrina/FSUDAQ/expDir
|
||||
DatabaseIP=https://fsunuc.physics.fsu.edu/influx/
|
||||
DatabaseName=testing
|
||||
ElogIP=elog.physics.fsu.edu
|
||||
lastRunID=8
|
||||
|
|
Loading…
Reference in New Issue
Block a user