various fixes and change for testClover
This commit is contained in:
parent
0e614db437
commit
34a90be3d3
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,3 +12,5 @@ read-set
|
|||
*.cxx
|
||||
*.pcm
|
||||
pixieDAQ
|
||||
|
||||
data
|
||||
|
|
6
Makefile
6
Makefile
|
@ -29,7 +29,7 @@ APIBASE = /usr/opt/xia/PixieSDK/lib/
|
|||
LIBS = $(APIBASE)libPixie16Api.so $(APIBASE)libPixieSDK.a $(PLXBASE)PlxApi.a
|
||||
|
||||
|
||||
OBJS = pixieDAQ.o Pixie16Class.o settingsSummary.o scalarPanel.o moduleSetting.o channelSetting.o
|
||||
OBJS = startStopDialog.o pixieDAQ.o Pixie16Class.o settingsSummary.o scalarPanel.o moduleSetting.o channelSetting.o
|
||||
|
||||
|
||||
all: testing/test testing/example pixieDAQ
|
||||
|
@ -68,6 +68,10 @@ channelSetting.o : channelSetting.cpp channelSetting.h global_macro.h
|
|||
@echo "--------- creating channelSetting.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) channelSetting.cpp $(ROOT_FLAG)
|
||||
|
||||
startStopDialog.o : startStopDialog.cpp startStopDialog.h
|
||||
@echo "--------- creating startStopDialog.o"
|
||||
$(CC) $(CFLAGS) $(PIXIE_LIB_PATH) startStopDialog.cpp $(ROOT_FLAG)
|
||||
|
||||
|
||||
|
||||
#--------------------------
|
||||
|
|
|
@ -502,7 +502,7 @@ int Pixie16::ProcessSingleData(short ch){
|
|||
|
||||
if( nextWord == nFIFOWords ) {nextWord = 0; breakProcessLoopFlag = 1;}
|
||||
if( nextWord > nFIFOWords ) {nextWord = nextWord - nFIFOWords; breakProcessLoopFlag = 2;}
|
||||
if( data->ch == ch ) breakProcessLoopFlag = 1;
|
||||
if( data->ch == ch ) {nextWord = 0; breakProcessLoopFlag = 3;}
|
||||
}
|
||||
|
||||
return breakProcessLoopFlag ;
|
||||
|
|
79
elogEntry.sh
Executable file
79
elogEntry.sh
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash -l
|
||||
|
||||
ExpName="testClover"
|
||||
ElogIP="elog.physics.fsu.edu"
|
||||
DataPath="/home/tandem/XIAEventBuilder/data"
|
||||
elogIDFile="/home/tandem/XIAEventBuilder/data/elogID.txt"
|
||||
|
||||
echo "======================================= making elog Entry"
|
||||
|
||||
elogIDFile=${DataPath}"/elogID.txt"
|
||||
if [ -f ${elogIDFile} ]; then
|
||||
source ${elogIDFile}
|
||||
else
|
||||
touch ${elogIDFile}
|
||||
fi
|
||||
isStart=$1
|
||||
lastRunID=$2
|
||||
Comment=$3
|
||||
elogFileName=${DataPath}"/elogText.txt"
|
||||
|
||||
#Get file size
|
||||
RUN=${lastRunID}
|
||||
runLen=${#lastRunID}
|
||||
if [ ${runLen} -eq 1 ]; then
|
||||
RUN="00"${RUN}
|
||||
elif [ ${runLen} -eq 2 ]; then
|
||||
RUN="0"${RUN}
|
||||
fi;
|
||||
|
||||
|
||||
if [ ${isStart} == "1" ]; then
|
||||
|
||||
#make text file for elog text
|
||||
echo "************************************************************************** <br />" > ${elogFileName}
|
||||
echo "Run-${RUN} start at $(date) <br />" >> ${elogFileName}
|
||||
echo "Start Run Comment : "${Comment}" <br />">> ${elogFileName}
|
||||
echo "-------------------------------------------------------------------------- <br />" >> ${elogFileName}
|
||||
|
||||
#push to elog
|
||||
IDStr=$(elog -h ${ElogIP} -l ${ExpName} -u GeneralFox fsuphysics888 -a Author="GeneralFox" -a Category="Run" -a RunNo=${lastRunID} -a Subject="Run Log" -n 2 -m ${elogFileName})
|
||||
|
||||
echo ${IDStr}
|
||||
|
||||
IDStr=$(echo ${IDStr} | tail -1 | awk '{print $4}')
|
||||
|
||||
if [ ${IDStr:0:3} == "ID=" ] && [[ ${IDStr:3} =~ ${re} ]]; then
|
||||
elogIDStr="Elog"${IDStr}
|
||||
echo "Elog is succefully pushed at ${elogIDStr}"
|
||||
echo ${elogIDStr} >> ${elogIDFile}
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
elogFileName2=${DataPath}"/elogText2.txt"
|
||||
|
||||
#download elog entry
|
||||
echo "====== getting elog entry"
|
||||
elog -h ${ElogIP} -l elog/${ExpName} -u GeneralFox fsuphysics888 -w ${ElogID} > ${elogFileName2}
|
||||
|
||||
cutLineNum=$(grep -n "==============" ${elogFileName2} | cut -d: -f1)
|
||||
#check encoding
|
||||
encoding=$(grep "Encoding" ${elogFileName2} | awk '{print $2}')
|
||||
if [ $encoding = "plain" ]; then encodingID=1 ; fi
|
||||
if [ $encoding = "HTML" ]; then encodingID=2 ; fi
|
||||
if [ $encoding = "ELcode" ]; then encodingID=0 ; fi
|
||||
#remove all header
|
||||
sed -i "1,${cutLineNum}d" ${elogFileName2}
|
||||
|
||||
echo "Run Stop at $(date) <br />" >> ${elogFileName2}
|
||||
echo "End Run Comment : "${Comment}" <br />" >> ${elogFileName2}
|
||||
totalFileSize=$(du -hc ${DataPath}"/"testRun_${RUN}* | tail -1| awk {'print $1'})
|
||||
echo "File Size : "${totalFileSize}" <br />">> ${elogFileName2}
|
||||
echo "************************************************************************** <br />" >> ${elogFileName2}
|
||||
|
||||
cat ${elogFileName2}
|
||||
|
||||
elog -h ${ElogIP} -p 8080 -l ${ExpName} -u GeneralFox fsuphysics888 -e ${ElogID} -n ${encodingID} -m ${elogFileName2}
|
||||
|
||||
fi
|
34
pixieDAQ.cpp
34
pixieDAQ.cpp
|
@ -159,7 +159,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
|||
|
||||
tePath = new TGTextEntry(hframe2, new TGTextBuffer(30));
|
||||
tePath->SetWidth(50);
|
||||
tePath->SetText("testRun");
|
||||
tePath->SetText("data/testRun");
|
||||
hframe2->AddFrame(tePath, uniLayoutHints);
|
||||
|
||||
runIDEntry = new TGNumberEntry(hframe2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
|
||||
|
@ -258,6 +258,7 @@ MainWindow::~MainWindow() {
|
|||
delete moduleSetting;
|
||||
delete channelSetting;
|
||||
delete scalarPanel;
|
||||
delete startStopDialog;
|
||||
|
||||
delete saveDataThread;
|
||||
delete fillHistThread;
|
||||
|
@ -432,7 +433,7 @@ void MainWindow::Scope(){
|
|||
///printf(" next word : %u\n", pixie->GetNextWord());
|
||||
///printf("number of word received : %u\n", pixie->GetnFIFOWords());
|
||||
|
||||
while( pixie->ProcessSingleData() < 1 ){ /// full set of dataBlack
|
||||
while( pixie->ProcessSingleData() <= 1 ){ /// full set of dataBlack
|
||||
|
||||
if( pixie->GetNextWord() >= pixie->GetnFIFOWords() ) break;
|
||||
if( data->slot < 2 ) break;
|
||||
|
@ -554,6 +555,10 @@ void MainWindow::GoodBye(){
|
|||
|
||||
void MainWindow::StartRun(){
|
||||
|
||||
startStopDialog = new StartStopDialog(gClient->GetRoot(), fMain, 400, 200, true);
|
||||
|
||||
if( StartStopDialog::isOK){
|
||||
|
||||
TString saveFileName = Form("%s_%03lu.evt", tePath->GetText(), runIDEntry->GetIntNumber());
|
||||
|
||||
pixie->OpenFile(saveFileName.Data(), false);
|
||||
|
@ -568,18 +573,30 @@ void MainWindow::StartRun(){
|
|||
}
|
||||
}
|
||||
|
||||
TString cmd = Form("/home/tandem/PixieDAQ/elogEntry.sh %d %d \"%s\"", 1, (int) runIDEntry->GetIntNumber(), StartStopDialog::Comment.Data() );
|
||||
int temp = system(cmd.Data());
|
||||
|
||||
pixie->StartRun(1);
|
||||
if( pixie->IsRunning() ) saveDataThread->Run(); /// call SaveData()
|
||||
//if( pixie->IsRunning() ) fillHistThread->Run(); /// call SaveData()
|
||||
|
||||
bStartRun->SetEnabled(false);
|
||||
bStopRun->SetEnabled(true);
|
||||
bFitTrace->SetEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::StopRun(){
|
||||
|
||||
startStopDialog = new StartStopDialog(gClient->GetRoot(), fMain, 400, 200, true);
|
||||
|
||||
if( StartStopDialog::isOK){
|
||||
|
||||
pixie->StopRun();
|
||||
saveDataThread->Join();
|
||||
usleep(200*1000);
|
||||
pixie->ReadData(0);
|
||||
pixie->SaveData();
|
||||
|
||||
|
@ -590,18 +607,22 @@ void MainWindow::StopRun(){
|
|||
pixie->PrintStatistics(0);
|
||||
bStartRun->SetEnabled(true);
|
||||
bStopRun->SetEnabled(false);
|
||||
bFitTrace->SetEnabled(true);
|
||||
|
||||
TString cmd = Form("/home/tandem/PixieDAQ/elogEntry.sh %d %d \"%s\"", 0, (int)runIDEntry->GetIntNumber(), StartStopDialog::Comment.Data() );
|
||||
int temp = system(cmd.Data());
|
||||
|
||||
runIDEntry->SetIntNumber(runIDEntry->GetIntNumber()+1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::OpenScalar(){
|
||||
|
||||
if( scalarPanel == NULL ) {
|
||||
scalarPanel = new ScalarPanel(gClient->GetRoot(), 600, 600, pixie);
|
||||
scalarPanel = new ScalarPanel(gClient->GetRoot(), fMain, 600, 600, pixie);
|
||||
}else{
|
||||
if( !scalarPanel->isOpened ) scalarPanel = new ScalarPanel(gClient->GetRoot(), 600, 600, pixie);
|
||||
if( !scalarPanel->isOpened ) scalarPanel = new ScalarPanel(gClient->GetRoot(), fMain, 600, 600, pixie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,7 +687,7 @@ void * MainWindow::SaveData(void* ptr){
|
|||
if( pixie->GetnFIFOWords() > 0 ) {
|
||||
pixie->SaveData();
|
||||
///ScanNumDataBlockInExtFIFO() should be here after ReadData(). becasue not a whlole dataBlock is in FIFO.
|
||||
//pixie->ScanNumDataBlockInExtFIFO(); //TODO need to check the time comsumtion
|
||||
pixie->ScanNumDataBlockInExtFIFO(); //TODO need to check the time comsumtion
|
||||
pixie->SetFIFOisUsed(false);
|
||||
|
||||
localClock.Stop("timer");
|
||||
|
@ -702,7 +723,6 @@ void * MainWindow::SaveData(void* ptr){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pixie->ReadData(0);
|
||||
pixie->SaveData();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "scalarPanel.h"
|
||||
#include "moduleSetting.h"
|
||||
#include "channelSetting.h"
|
||||
#include "startStopDialog.h"
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
@ -51,6 +52,7 @@ private:
|
|||
ModuleSetting * moduleSetting;
|
||||
ChannelSetting * channelSetting;
|
||||
ScalarPanel * scalarPanel;
|
||||
StartStopDialog * startStopDialog;
|
||||
|
||||
TThread * saveDataThread;
|
||||
TThread * fillHistThread;
|
||||
|
|
|
@ -20,15 +20,16 @@ TGTextEntry * ScalarPanel::teRealTime[MAXMOD] = {NULL};
|
|||
|
||||
int updateTime = 500; // msec
|
||||
|
||||
ScalarPanel::ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie){
|
||||
ScalarPanel::ScalarPanel(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, Pixie16 * pixie){
|
||||
|
||||
this->pixie = pixie;
|
||||
|
||||
nMod = pixie->GetNumModule();
|
||||
|
||||
fMain = new TGMainFrame(p,w,h);
|
||||
fMain = new TGTransientFrame(p,main,w,h);
|
||||
fMain->SetWindowName("Pixie16 Scalar Panel");
|
||||
fMain->Connect("CloseWindow()", "ScalarPanel", this, "CloseWindow()");
|
||||
fMain->SetMWMHints(1,4, 0);
|
||||
|
||||
///Module choose
|
||||
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, w, 50 );
|
||||
|
@ -120,7 +121,7 @@ void * ScalarPanel::UpdateScalar(void * ptr){
|
|||
Pixie16ReadStatisticsFromModule (statistics, mod);
|
||||
|
||||
double realTime = Pixie16ComputeRealTime (statistics, mod);
|
||||
teRealTime[mod]->SetText(Form("%.2f", realTime));
|
||||
teRealTime[mod]->SetText(Form("%.0f", realTime));
|
||||
|
||||
for( int ch = 0; ch < MAXCH ; ch ++){
|
||||
|
||||
|
@ -128,7 +129,7 @@ void * ScalarPanel::UpdateScalar(void * ptr){
|
|||
double OCR = Pixie16ComputeOutputCountRate (statistics, mod, ch);
|
||||
double liveTime = Pixie16ComputeLiveTime (statistics, mod, ch);
|
||||
|
||||
teRate[mod][ch]->SetText(Form("%.2f[%.2f] %.2f", ICR, OCR, liveTime));
|
||||
teRate[mod][ch]->SetText(Form("%.2f[%.2f] %.0f", ICR, OCR, liveTime));
|
||||
}
|
||||
gSystem->Sleep(updateTime);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class TGMainFrame;
|
|||
|
||||
class ScalarPanel{
|
||||
private:
|
||||
TGMainFrame * fMain;
|
||||
TGTransientFrame * fMain;
|
||||
|
||||
static int nMod;
|
||||
static Pixie16 * pixie;
|
||||
|
@ -28,7 +28,7 @@ private:
|
|||
TThread * thread;
|
||||
|
||||
public:
|
||||
ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie);
|
||||
ScalarPanel(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, Pixie16 * pixie);
|
||||
virtual ~ScalarPanel();
|
||||
|
||||
static void * UpdateScalar(void * ptr);
|
||||
|
|
|
@ -20,6 +20,7 @@ SettingsSummary::SettingsSummary(const TGWindow *p, UInt_t w, UInt_t h, Pixie16
|
|||
fMain = new TGMainFrame(p,w,h);
|
||||
fMain->SetWindowName("Pixie16 Settings Summary");
|
||||
fMain->Connect("CloseWindow()", "SettingsSummary", this, "CloseWindow()");
|
||||
fMain->SetMWMHints(1,4, 0);
|
||||
|
||||
gClient->GetColorByName("red", red);
|
||||
gClient->GetColorByName("black", black);
|
||||
|
|
70
startStopDialog.cpp
Normal file
70
startStopDialog.cpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include "startStopDialog.h"
|
||||
|
||||
|
||||
TString StartStopDialog::Comment = "";
|
||||
bool StartStopDialog::isOK = false;
|
||||
|
||||
StartStopDialog::StartStopDialog(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, bool isStart){
|
||||
|
||||
this->isStart = isStart;
|
||||
this->isOK = false;
|
||||
Comment = "";
|
||||
|
||||
fMain = new TGTransientFrame(p, main, w, h, kVerticalFrame);
|
||||
fMain->DontCallClose(); /// to avoid double deletions.
|
||||
//fMain->SetCleanup(kDeepCleanup); /// use hierarchical cleaning
|
||||
fMain->Connect("CloseWindow()", "StartStopDialog", this, "CloseWindow()");
|
||||
|
||||
TGHorizontalFrame * fFrame1 = new TGHorizontalFrame(fMain); fMain->AddFrame(fFrame1, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
|
||||
txtComment = new TGTextEntry(fFrame1, ""); fFrame1->AddFrame(txtComment);
|
||||
txtComment->Resize(300, 20);
|
||||
txtComment->Connect("ReturnPressed()", "StartStopDialog", this, "DoOK()");
|
||||
|
||||
TGHorizontalFrame * fFrame2 = new TGHorizontalFrame(fMain); fMain->AddFrame(fFrame2,new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
|
||||
TGTextButton * bOK = new TGTextButton(fFrame2, "OK"); fFrame2->AddFrame(bOK, new TGLayoutHints(kLHintsCenterX));
|
||||
bOK->Connect("Clicked()", "StartStopDialog", this, "DoOK()");
|
||||
TGTextButton * bCancel = new TGTextButton(fFrame2, "Cancel"); fFrame2->AddFrame(bCancel, new TGLayoutHints(kLHintsCenterX));
|
||||
bCancel->Connect("Clicked()", "StartStopDialog", this, "DoClose()");
|
||||
|
||||
TGHorizontalFrame * fFrame3 = new TGHorizontalFrame(fMain); fMain->AddFrame(fFrame3,new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 5, 5, 5, 5));
|
||||
|
||||
if( isStart ){
|
||||
TGLabel * lbInfo = new TGLabel(fFrame3, "* Cancel or Close this dialog box will cancel START run.\n Only OK or press Enter will process."); fFrame3->AddFrame(lbInfo);
|
||||
}else{
|
||||
TGLabel * lbInfo = new TGLabel(fFrame3, "* Cancel or Close this dialog box will cancel STOP run.\n* Only OK or press Enter will process."); fFrame3->AddFrame(lbInfo);
|
||||
}
|
||||
|
||||
fMain->MapSubwindows();
|
||||
fMain->Resize();
|
||||
|
||||
fMain->CenterOnParent(); /// position relative to the parent's window
|
||||
if( isStart) {
|
||||
fMain->SetWindowName("Start Comment");
|
||||
}else{
|
||||
fMain->SetWindowName("Stop Comment");
|
||||
}
|
||||
fMain->MapWindow();
|
||||
|
||||
gClient->WaitFor(fMain); /// make everything wait for it
|
||||
|
||||
}
|
||||
|
||||
|
||||
StartStopDialog::~StartStopDialog(){
|
||||
printf("-------- %s |%s| %d\n", __func__, Comment.Data(), isOK);
|
||||
delete txtComment;
|
||||
fMain->DeleteWindow(); /// deletes fMain
|
||||
}
|
||||
|
||||
void StartStopDialog::DoClose(){
|
||||
isOK = false;
|
||||
///Wait for 500 msec
|
||||
TTimer::SingleShot(500, "StartStopDialog", this, "CloseWindow()");
|
||||
}
|
||||
|
||||
void StartStopDialog::DoOK(){
|
||||
Comment = "";
|
||||
Comment = txtComment->GetText();
|
||||
isOK = true;
|
||||
TTimer::SingleShot(500, "StartStopDialog", this, "CloseWindow()");
|
||||
}
|
37
startStopDialog.h
Normal file
37
startStopDialog.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef START_STOP_DIALOG_H
|
||||
#define START_STOP_DIALOG_H
|
||||
|
||||
#include <TQObject.h>
|
||||
#include <RQ_OBJECT.h>
|
||||
#include <TGButton.h>
|
||||
#include <TGLabel.h>
|
||||
#include <TTimer.h>
|
||||
#include <TGTextEntry.h>
|
||||
|
||||
class TGWindow;
|
||||
class TGMainFrame;
|
||||
|
||||
class StartStopDialog{
|
||||
RQ_OBJECT("StartStopDialog")
|
||||
private:
|
||||
|
||||
TGTextEntry * txtComment;
|
||||
bool isStart;
|
||||
|
||||
public:
|
||||
StartStopDialog(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, bool isStart);
|
||||
virtual ~StartStopDialog();
|
||||
|
||||
TGTransientFrame * fMain;
|
||||
|
||||
void DoClose();
|
||||
void DoOK();
|
||||
|
||||
void CloseWindow() { delete this;}
|
||||
|
||||
static TString Comment;
|
||||
static bool isOK;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -7,12 +7,12 @@
|
|||
1,
|
||||
1,
|
||||
31,
|
||||
5,
|
||||
69,
|
||||
120,
|
||||
43,
|
||||
8,
|
||||
32,
|
||||
6,
|
||||
2,
|
||||
306,
|
||||
0,
|
||||
1,
|
||||
107,
|
||||
|
@ -25,7 +25,7 @@
|
|||
10,
|
||||
2,
|
||||
10,
|
||||
10,
|
||||
3,
|
||||
10,
|
||||
10,
|
||||
10,
|
||||
|
@ -97,12 +97,12 @@
|
|||
16544,
|
||||
16544,
|
||||
16544,
|
||||
16548,
|
||||
16548,
|
||||
132,
|
||||
132,
|
||||
16544,
|
||||
16544,
|
||||
16548,
|
||||
16548,
|
||||
16544,
|
||||
132,
|
||||
16544,
|
||||
16544,
|
||||
16544,
|
||||
|
@ -259,12 +259,12 @@
|
|||
65535,
|
||||
65535,
|
||||
65535,
|
||||
4000,
|
||||
4000,
|
||||
40000,
|
||||
40000,
|
||||
4000,
|
||||
65535,
|
||||
4000,
|
||||
4000,
|
||||
40000,
|
||||
65535,
|
||||
65535,
|
||||
4000,
|
||||
|
@ -421,12 +421,12 @@
|
|||
32768,
|
||||
32768,
|
||||
32768,
|
||||
21845,
|
||||
21845,
|
||||
48059,
|
||||
48059,
|
||||
21845,
|
||||
32768,
|
||||
21845,
|
||||
21845,
|
||||
50244,
|
||||
32768,
|
||||
32768,
|
||||
21845,
|
||||
|
@ -529,8 +529,8 @@
|
|||
1100456650,
|
||||
1100456650,
|
||||
1100456650,
|
||||
1112014848,
|
||||
1112014848,
|
||||
1095552204,
|
||||
1095552204,
|
||||
1112012226,
|
||||
1100456650,
|
||||
1112014848,
|
||||
|
|
Loading…
Reference in New Issue
Block a user