add Real time and live time in scalar
This commit is contained in:
parent
436c7b7d5a
commit
ca63063e62
|
@ -398,6 +398,12 @@ void Pixie16::StopRun(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pixie16::CheckExternalFIFOWords(unsigned short modID){
|
||||||
|
if( Pixie16CheckRunStatus(modID) == 1){
|
||||||
|
retval = Pixie16CheckExternalFIFOStatus (&nFIFOWords, modID);
|
||||||
|
if( CheckError("Pixie16CheckExternalFIFOStatus") < 0 ) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Pixie16::ReadData(unsigned short modID){
|
void Pixie16::ReadData(unsigned short modID){
|
||||||
|
|
||||||
|
@ -418,9 +424,9 @@ void Pixie16::ReadData(unsigned short modID){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pixie16::ProcessSingleData(){
|
int Pixie16::ProcessSingleData(){
|
||||||
|
|
||||||
bool breakProcessLoopFlag = false;
|
int breakProcessLoopFlag = 0;
|
||||||
|
|
||||||
if( nextWord < nFIFOWords ){
|
if( nextWord < nFIFOWords ){
|
||||||
data->ch = ExtFIFO_Data[nextWord] & 0xF ;
|
data->ch = ExtFIFO_Data[nextWord] & 0xF ;
|
||||||
|
@ -455,8 +461,8 @@ bool Pixie16::ProcessSingleData(){
|
||||||
|
|
||||||
nextWord += data->eventLength ;
|
nextWord += data->eventLength ;
|
||||||
|
|
||||||
if( nextWord == nFIFOWords ) {nextWord = 0; breakProcessLoopFlag = true;}
|
if( nextWord == nFIFOWords ) {nextWord = 0; breakProcessLoopFlag = 1;}
|
||||||
if( nextWord > nFIFOWords ) {nextWord = nextWord - nFIFOWords; breakProcessLoopFlag = true;}
|
if( nextWord > nFIFOWords ) {nextWord = nextWord - nFIFOWords; breakProcessLoopFlag = 2;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,14 +194,14 @@ public:
|
||||||
double GetRealTime(unsigned short modID);
|
double GetRealTime(unsigned short modID);
|
||||||
void PrintStatistics(unsigned short modID);
|
void PrintStatistics(unsigned short modID);
|
||||||
|
|
||||||
|
void CheckExternalFIFOWords(unsigned short modID);
|
||||||
void ReadData(unsigned short modID);
|
void ReadData(unsigned short modID);
|
||||||
|
|
||||||
unsigned int GetTotalNumWords() {return totNumFIFOWords;}
|
unsigned int GetTotalNumWords() {return totNumFIFOWords;}
|
||||||
unsigned int GetnFIFOWords() {return nFIFOWords;}
|
unsigned int GetnFIFOWords() {return nFIFOWords;}
|
||||||
unsigned int GetNextWord() {return nextWord;}
|
unsigned int GetNextWord() {return nextWord;}
|
||||||
DataBlock * GetData() {return data;}
|
DataBlock * GetData() {return data;}
|
||||||
bool ProcessSingleData();
|
int ProcessSingleData();
|
||||||
|
|
||||||
void PrintExtFIFOWords() {
|
void PrintExtFIFOWords() {
|
||||||
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
||||||
|
|
18
pixieDAQ.cpp
18
pixieDAQ.cpp
|
@ -11,7 +11,7 @@
|
||||||
#include <TGraph.h>
|
#include <TGraph.h>
|
||||||
#include <TGTextEditor.h>
|
#include <TGTextEditor.h>
|
||||||
#include <TAxis.h>
|
#include <TAxis.h>
|
||||||
#include <TBenchmark.h>
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -275,6 +275,7 @@ void MainWindow::GetADCTrace() {
|
||||||
gTrace->SetPoint(i, i*dt, haha[i]);
|
gTrace->SetPoint(i, i*dt, haha[i]);
|
||||||
}
|
}
|
||||||
gTrace->GetXaxis()->SetTitle("time [us]");
|
gTrace->GetXaxis()->SetTitle("time [us]");
|
||||||
|
gTrace->GetXaxis()->SetRangeUser(0, pixie->GetADCTraceLength()*dt);
|
||||||
gTrace->Draw("APL");
|
gTrace->Draw("APL");
|
||||||
|
|
||||||
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
TCanvas *fCanvas = fEcanvas->GetCanvas();
|
||||||
|
@ -325,10 +326,12 @@ void MainWindow::Scope(){
|
||||||
|
|
||||||
DataBlock * data = pixie->GetData();
|
DataBlock * data = pixie->GetData();
|
||||||
|
|
||||||
LogMsg("[Scope] Take data for 200 msec.");
|
int runDuration = 200; ///msec
|
||||||
|
|
||||||
|
LogMsg(Form("[Scope] Take data for %d msec.", runDuration));
|
||||||
pixie->StartRun(1);
|
pixie->StartRun(1);
|
||||||
|
|
||||||
usleep(200*1000);
|
usleep(runDuration*1000);
|
||||||
pixie->ReadData(0);
|
pixie->ReadData(0);
|
||||||
pixie->StopRun();
|
pixie->StopRun();
|
||||||
|
|
||||||
|
@ -337,9 +340,7 @@ void MainWindow::Scope(){
|
||||||
///printf(" next word : %u\n", pixie->GetNextWord());
|
///printf(" next word : %u\n", pixie->GetNextWord());
|
||||||
///printf("number of word received : %u\n", pixie->GetnFIFOWords());
|
///printf("number of word received : %u\n", pixie->GetnFIFOWords());
|
||||||
|
|
||||||
//TODO add statistics, like trigger rate
|
while( pixie->ProcessSingleData() <= 1 ){ /// full set of dataBlack
|
||||||
|
|
||||||
while(!pixie->ProcessSingleData()){
|
|
||||||
|
|
||||||
if( pixie->GetNextWord() >= pixie->GetnFIFOWords() ) break;
|
if( pixie->GetNextWord() >= pixie->GetnFIFOWords() ) break;
|
||||||
if( data->slot < 2 ) break;
|
if( data->slot < 2 ) break;
|
||||||
|
@ -353,6 +354,7 @@ void MainWindow::Scope(){
|
||||||
gTrace->SetPoint(i, i*dt, (data->trace)[i]);
|
gTrace->SetPoint(i, i*dt, (data->trace)[i]);
|
||||||
}
|
}
|
||||||
gTrace->GetXaxis()->SetTitle("time [us]");
|
gTrace->GetXaxis()->SetTitle("time [us]");
|
||||||
|
gTrace->GetXaxis()->SetRangeUser(0, data->trace_length * dt);
|
||||||
gTrace->SetTitle(Form("mod-%d, ch-%02d\n", modID, ch));
|
gTrace->SetTitle(Form("mod-%d, ch-%02d\n", modID, ch));
|
||||||
gTrace->Draw("APL");
|
gTrace->Draw("APL");
|
||||||
|
|
||||||
|
@ -402,11 +404,9 @@ void MainWindow::StopRun(){
|
||||||
pixie->SaveData();
|
pixie->SaveData();
|
||||||
|
|
||||||
LogMsg("Stop Run");
|
LogMsg("Stop Run");
|
||||||
|
|
||||||
LogMsg(Form("File Size : %.2f MB", pixie->GetFileSize()/1024./1024.));
|
LogMsg(Form("File Size : %.2f MB", pixie->GetFileSize()/1024./1024.));
|
||||||
|
|
||||||
pixie->CloseFile();
|
pixie->CloseFile();
|
||||||
|
|
||||||
pixie->PrintStatistics(0);
|
pixie->PrintStatistics(0);
|
||||||
bStartRun->SetEnabled(true);
|
bStartRun->SetEnabled(true);
|
||||||
bStopRun->SetEnabled(false);
|
bStopRun->SetEnabled(false);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <TGTextEdit.h>
|
#include <TGTextEdit.h>
|
||||||
#include <TThread.h>
|
#include <TThread.h>
|
||||||
#include <TH1F.h>
|
#include <TH1F.h>
|
||||||
|
#include <TBenchmark.h>
|
||||||
|
|
||||||
#include "Pixie16Class.h"
|
#include "Pixie16Class.h"
|
||||||
#include "settingsSummary.h"
|
#include "settingsSummary.h"
|
||||||
|
@ -48,7 +49,7 @@ private:
|
||||||
TThread * fillHistThread;
|
TThread * fillHistThread;
|
||||||
|
|
||||||
static TH1F * h1[13][16];
|
static TH1F * h1[13][16];
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
|
MainWindow(const TGWindow *p, UInt_t w, UInt_t h);
|
||||||
|
|
|
@ -16,6 +16,9 @@ Pixie16 * ScalarPanel::pixie = NULL;
|
||||||
bool ScalarPanel::updateFlag = true;
|
bool ScalarPanel::updateFlag = true;
|
||||||
int ScalarPanel::nMod = 0;
|
int ScalarPanel::nMod = 0;
|
||||||
TGTextEntry * ScalarPanel::teRate[][MAXCH] = {NULL};
|
TGTextEntry * ScalarPanel::teRate[][MAXCH] = {NULL};
|
||||||
|
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, UInt_t w, UInt_t h, Pixie16 * pixie){
|
||||||
|
|
||||||
|
@ -24,7 +27,7 @@ ScalarPanel::ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie)
|
||||||
nMod = pixie->GetNumModule();
|
nMod = pixie->GetNumModule();
|
||||||
|
|
||||||
fMain = new TGMainFrame(p,w,h);
|
fMain = new TGMainFrame(p,w,h);
|
||||||
fMain->SetWindowName("Scalar Panel");
|
fMain->SetWindowName("Pixie16 Scalar Panel");
|
||||||
fMain->Connect("CloseWindow()", "ScalarPanel", this, "CloseWindow()");
|
fMain->Connect("CloseWindow()", "ScalarPanel", this, "CloseWindow()");
|
||||||
|
|
||||||
///Module choose
|
///Module choose
|
||||||
|
@ -36,6 +39,10 @@ ScalarPanel::ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie)
|
||||||
///------ Channel labels
|
///------ Channel labels
|
||||||
TGVerticalFrame * hChannelLabels = new TGVerticalFrame(hframe);
|
TGVerticalFrame * hChannelLabels = new TGVerticalFrame(hframe);
|
||||||
hframe->AddFrame(hChannelLabels, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
hframe->AddFrame(hChannelLabels, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
TGLabel * labelRealTime = new TGLabel(hChannelLabels, "Read Time");
|
||||||
|
labelRealTime->SetWidth(width);
|
||||||
|
labelRealTime->Resize(width, 50);
|
||||||
|
hChannelLabels->AddFrame(labelRealTime, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,5));
|
||||||
|
|
||||||
TGLabel * labelCh[MAXCH];
|
TGLabel * labelCh[MAXCH];
|
||||||
for( int ch = 0; ch < MAXCH; ch ++){
|
for( int ch = 0; ch < MAXCH; ch ++){
|
||||||
|
@ -45,22 +52,28 @@ ScalarPanel::ScalarPanel(const TGWindow *p, UInt_t w, UInt_t h, Pixie16 * pixie)
|
||||||
hChannelLabels->AddFrame(labelCh[ch], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,5));
|
hChannelLabels->AddFrame(labelCh[ch], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,5,5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///------- Rate
|
||||||
TGVerticalFrame * hScalarMod[nMod];
|
TGVerticalFrame * hScalarMod[nMod];
|
||||||
|
|
||||||
for ( int mod = 0 ; mod < nMod ; mod ++){
|
for ( int mod = 0 ; mod < nMod ; mod ++){
|
||||||
hScalarMod[mod] = new TGVerticalFrame(hframe);
|
hScalarMod[mod] = new TGVerticalFrame(hframe);
|
||||||
hframe->AddFrame(hScalarMod[mod], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
hframe->AddFrame(hScalarMod[mod], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
|
||||||
|
teRealTime[mod] = new TGTextEntry(hScalarMod[mod], new TGTextBuffer(10));
|
||||||
|
teRealTime[mod]->SetEnabled(false);
|
||||||
|
teRealTime[mod]->SetAlignment(kTextRight);
|
||||||
|
hScalarMod[mod]->AddFrame(teRealTime[mod], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
|
|
||||||
for( int ch = 0 ; ch < MAXCH ; ch ++){
|
for( int ch = 0 ; ch < MAXCH ; ch ++){
|
||||||
teRate[mod][ch] = new TGTextEntry(hScalarMod[mod], new TGTextBuffer(10));
|
teRate[mod][ch] = new TGTextEntry(hScalarMod[mod], new TGTextBuffer(10));
|
||||||
teRate[mod][ch]->SetEnabled(false);
|
teRate[mod][ch]->SetEnabled(false);
|
||||||
teRate[mod][ch]->SetAlignment(kTextRight);
|
teRate[mod][ch]->SetAlignment(kTextRight);
|
||||||
hScalarMod[mod]->AddFrame(teRate[mod][ch], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
hScalarMod[mod]->AddFrame(teRate[mod][ch], new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2,2,2,2));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TGLabel * labelFootNote = new TGLabel(fMain, Form("Update every %d msec.", updateTime));
|
||||||
|
fMain->AddFrame(labelFootNote, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2,2,5,5));
|
||||||
|
|
||||||
fMain->MapSubwindows();
|
fMain->MapSubwindows();
|
||||||
fMain->Resize(fMain->GetDefaultSize());
|
fMain->Resize(fMain->GetDefaultSize());
|
||||||
|
@ -82,6 +95,8 @@ ScalarPanel::~ScalarPanel(){
|
||||||
for( int j = 0; j < MAXCH; j++ ){
|
for( int j = 0; j < MAXCH; j++ ){
|
||||||
delete teRate[i][j];
|
delete teRate[i][j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete teRealTime[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// fMain must be delete last;
|
/// fMain must be delete last;
|
||||||
|
@ -100,17 +115,22 @@ void * ScalarPanel::UpdateScalar(void * ptr){
|
||||||
for( int mod = 0; mod < nMod; mod++){
|
for( int mod = 0; mod < nMod; mod++){
|
||||||
|
|
||||||
Pixie16ReadStatisticsFromModule (statistics, mod);
|
Pixie16ReadStatisticsFromModule (statistics, mod);
|
||||||
|
|
||||||
|
double realTime = Pixie16ComputeRealTime (statistics, mod);
|
||||||
|
|
||||||
|
teRealTime[mod]->SetText(Form("%.2f", realTime));
|
||||||
|
|
||||||
for( int ch = 0; ch < MAXCH ; ch ++){
|
for( int ch = 0; ch < MAXCH ; ch ++){
|
||||||
|
|
||||||
double ICR = Pixie16ComputeInputCountRate (statistics, mod, ch);
|
double ICR = Pixie16ComputeInputCountRate (statistics, mod, ch);
|
||||||
double OCR = Pixie16ComputeOutputCountRate (statistics, mod, ch);
|
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]", ICR, OCR));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gSystem->Sleep(500); ///0.5 sec
|
gSystem->Sleep(updateTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ private:
|
||||||
|
|
||||||
static bool updateFlag;
|
static bool updateFlag;
|
||||||
|
|
||||||
|
static TGTextEntry * teRate[MAXMOD][MAXCH];
|
||||||
|
static TGTextEntry * teRealTime[MAXMOD];
|
||||||
|
|
||||||
TThread * thread;
|
TThread * thread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +39,7 @@ public:
|
||||||
|
|
||||||
bool isOpened;
|
bool isOpened;
|
||||||
|
|
||||||
static TGTextEntry * teRate[MAXMOD][MAXCH];
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user