added FIFOEnergies, FIFOEnergies, FIFOChannles, FIFOTimestamps, ScanNumDataBlockInExtFIFO() will fill them
This commit is contained in:
parent
b4c48497a2
commit
66e2b9d8f6
|
@ -54,6 +54,11 @@ Pixie16::Pixie16(){
|
||||||
ExtFIFO_Data = NULL;
|
ExtFIFO_Data = NULL;
|
||||||
Statistics = NULL;
|
Statistics = NULL;
|
||||||
|
|
||||||
|
FIFOEnergies = new unsigned short[MAXFIFODATABLOCK];
|
||||||
|
FIFOChannels = new unsigned short[MAXFIFODATABLOCK];
|
||||||
|
FIFOTimestamps = new unsigned long long[MAXFIFODATABLOCK];
|
||||||
|
FIFONumDataBlock = 0;
|
||||||
|
|
||||||
data = new DataBlock();
|
data = new DataBlock();
|
||||||
nextWord = 0;
|
nextWord = 0;
|
||||||
|
|
||||||
|
@ -65,6 +70,10 @@ Pixie16::~Pixie16(){
|
||||||
|
|
||||||
CloseDigitizers();
|
CloseDigitizers();
|
||||||
|
|
||||||
|
delete FIFOEnergies;
|
||||||
|
delete FIFOChannels;
|
||||||
|
delete FIFOTimestamps;
|
||||||
|
|
||||||
delete PXISlotMap;
|
delete PXISlotMap;
|
||||||
delete ch2ns;
|
delete ch2ns;
|
||||||
delete ComFPGAConfigFile;
|
delete ComFPGAConfigFile;
|
||||||
|
@ -426,15 +435,26 @@ void Pixie16::ReadData(unsigned short modID){
|
||||||
|
|
||||||
unsigned int Pixie16::ScanNumDataBlockInExtFIFO(){
|
unsigned int Pixie16::ScanNumDataBlockInExtFIFO(){
|
||||||
|
|
||||||
unsigned int numDataBlock = 0;
|
unsigned int FIFONumDataBlock = 0;
|
||||||
unsigned int nextWordtemp = nextWord;
|
unsigned int nextWordtemp = nextWord;
|
||||||
|
|
||||||
|
///if( nextWordtemp < nFIFOWords ) printf("============= FIFOWord : %u \n", nFIFOWords);
|
||||||
while( nextWordtemp < nFIFOWords ){
|
while( nextWordtemp < nFIFOWords ){
|
||||||
nextWordtemp += (ExtFIFO_Data[nextWordtemp] >> 17) & 0x3FFF;
|
|
||||||
numDataBlock ++;
|
unsigned short eventLen = (ExtFIFO_Data[nextWordtemp] >> 17) & 0x3FFF;
|
||||||
|
|
||||||
|
FIFOEnergies[FIFONumDataBlock] = (ExtFIFO_Data[nextWordtemp + 3] & 0xFFFF );
|
||||||
|
FIFOChannels[FIFONumDataBlock] = (ExtFIFO_Data[nextWordtemp] & 0xF );
|
||||||
|
FIFOTimestamps[FIFONumDataBlock] = ((unsigned long long)(ExtFIFO_Data[nextWordtemp+2] & 0xFFFF) << 32) + ExtFIFO_Data[nextWordtemp+1];
|
||||||
|
|
||||||
|
nextWordtemp += eventLen;
|
||||||
|
///printf("%u | nextWordtemp %u, nextWord %u, ch %u, energy %u \n", FIFONumDataBlock, nextWordtemp, nextWord, FIFOChannels[FIFONumDataBlock], FIFOEnergies[FIFONumDataBlock]);
|
||||||
|
FIFONumDataBlock ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextWord = nextWordtemp - nFIFOWords ;
|
||||||
|
|
||||||
return numDataBlock;
|
return FIFONumDataBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Pixie16::ProcessSingleData(){
|
int Pixie16::ProcessSingleData(){
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "pixie16/pixie16.h"
|
#include "pixie16/pixie16.h"
|
||||||
#include "DataBlock.h"
|
#include "DataBlock.h"
|
||||||
|
|
||||||
|
#define MAXFIFODATABLOCK 1000 ///max FIFO Datablack for one read
|
||||||
|
|
||||||
enum CSRA_BIT{
|
enum CSRA_BIT{
|
||||||
FAST_TRIGGER = 0x00000001,
|
FAST_TRIGGER = 0x00000001,
|
||||||
M_VALIDATION = 0x00000002,
|
M_VALIDATION = 0x00000002,
|
||||||
|
@ -77,7 +79,10 @@ private:
|
||||||
unsigned int * Statistics;
|
unsigned int * Statistics;
|
||||||
unsigned int totNumFIFOWords;
|
unsigned int totNumFIFOWords;
|
||||||
|
|
||||||
|
unsigned short * FIFOChannels;
|
||||||
|
unsigned short * FIFOEnergies;
|
||||||
|
unsigned long long * FIFOTimestamps;
|
||||||
|
unsigned int FIFONumDataBlock;
|
||||||
|
|
||||||
double Baselines[3640], TimeStamps[3640]; ///for baseline
|
double Baselines[3640], TimeStamps[3640]; ///for baseline
|
||||||
unsigned short ADCTrace[8192];
|
unsigned short ADCTrace[8192];
|
||||||
|
@ -196,15 +201,20 @@ public:
|
||||||
|
|
||||||
void CheckExternalFIFOWords(unsigned short modID);
|
void CheckExternalFIFOWords(unsigned short modID);
|
||||||
void ReadData(unsigned short modID);
|
void ReadData(unsigned short modID);
|
||||||
unsigned int ScanNumDataBlockInExtFIFO();
|
|
||||||
|
|
||||||
|
|
||||||
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;}
|
||||||
|
|
||||||
int ProcessSingleData();
|
int ProcessSingleData();
|
||||||
|
unsigned int ScanNumDataBlockInExtFIFO(); /// also fill the FIFOEnergies, FIFOChannels, FIFOTimestamps, output FIFONumDataBlock
|
||||||
|
unsigned int GetFIFONumDataBlock() {return FIFONumDataBlock;}
|
||||||
|
unsigned short * GetFIFOEnergies() {return FIFOEnergies;}
|
||||||
|
unsigned short * GetFIFOChannels() {return FIFOChannels;}
|
||||||
|
unsigned long long * GetFIFOTimestamps() {return FIFOTimestamps;}
|
||||||
|
|
||||||
|
|
||||||
void PrintExtFIFOWords() {
|
void PrintExtFIFOWords() {
|
||||||
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
unsigned int nWords = (ExtFIFO_Data[nextWord] >> 17) & 0x3FFF;
|
||||||
printf("------------------- print dataBlock, nWords = %d\n", nWords);
|
printf("------------------- print dataBlock, nWords = %d\n", nWords);
|
||||||
|
|
10
pixieDAQ.cpp
10
pixieDAQ.cpp
|
@ -442,21 +442,13 @@ void MainWindow::FitTrace(){
|
||||||
if( y < yMin) yMin = y;
|
if( y < yMin) yMin = y;
|
||||||
if( y > yMax) yMax = y;
|
if( y > yMax) yMax = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
///printf("%f %f %f %f\n", xMin, xMax, yMin, yMax);
|
|
||||||
|
|
||||||
double baseline = yMin;
|
double baseline = yMin;
|
||||||
double amp = yMax-yMin;
|
double amp = yMax-yMin;
|
||||||
|
|
||||||
double riseTime = 200;
|
double riseTime = 200;
|
||||||
double decayTime = 40000;
|
double decayTime = 40000;
|
||||||
|
|
||||||
///printf(" t0 : %f ns\n", t0);
|
|
||||||
///printf(" r : %f ns\n", riseTime);
|
|
||||||
///printf(" d : %f ns\n", decayTime);
|
|
||||||
///printf(" amp : %f ns\n", amp);
|
|
||||||
///printf(" bl : %f ns\n", baseline);
|
|
||||||
|
|
||||||
TF1 * traceFunc = new TF1("fit", standardPulse, xMin + t0*0.1, xMax - t0*0.1, 5);
|
TF1 * traceFunc = new TF1("fit", standardPulse, xMin + t0*0.1, xMax - t0*0.1, 5);
|
||||||
|
|
||||||
traceFunc->SetNpx(1000);
|
traceFunc->SetNpx(1000);
|
||||||
|
|
|
@ -185,7 +185,7 @@ int main(int argc, char *argv[]){
|
||||||
pixie->PrintDigitizerSettings(0);
|
pixie->PrintDigitizerSettings(0);
|
||||||
|
|
||||||
int ch = 6;
|
int ch = 6;
|
||||||
double time = 4.0; ///sec
|
double time = 1.0; ///sec
|
||||||
|
|
||||||
pixie->PrintChannelAllSettings(0, ch);
|
pixie->PrintChannelAllSettings(0, ch);
|
||||||
|
|
||||||
|
@ -200,23 +200,41 @@ int main(int argc, char *argv[]){
|
||||||
|
|
||||||
pixie->StartRun(1);
|
pixie->StartRun(1);
|
||||||
|
|
||||||
std::thread kakakaka(ProcessData);
|
///std::thread kakakaka(ProcessData);
|
||||||
|
|
||||||
while( CurrentTime - StartTime < time * 1000 ){
|
while( CurrentTime - StartTime < time * 1000 ){
|
||||||
|
|
||||||
pixie->ReadData(0);
|
pixie->ReadData(0);
|
||||||
if( pixie->GetnFIFOWords() > 0 ) pixie->SaveData();
|
if( pixie->GetnFIFOWords() > 0 ) pixie->SaveData();
|
||||||
|
|
||||||
if( pixie->GetnFIFOWords() > 0 ) {/// msec
|
//if( pixie->GetnFIFOWords() > 0 ) {/// msec
|
||||||
printf("number of dataBlack read : %u\n", pixie->ScanNumDataBlockInExtFIFO());
|
// printf("number of dataBlack read : %u\n", pixie->ScanNumDataBlockInExtFIFO());
|
||||||
|
//}
|
||||||
|
|
||||||
|
//TODO a quick way to read and fill histogram; the most time consumping part is filling trace
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int nData = pixie->ScanNumDataBlockInExtFIFO();
|
||||||
|
unsigned short * energies = pixie->GetFIFOEnergies();
|
||||||
|
unsigned short * channels = pixie->GetFIFOChannels();
|
||||||
|
//unsigned long long * timestamps = pixie->GetFIFOTimestamps();
|
||||||
|
|
||||||
|
for( unsigned int h = 0; h < nData; h++) {
|
||||||
|
//printf(" %3u| %8u, %8u , %20llu\n", h, channels[h], energies[h], timestamps[h]);
|
||||||
|
hch->Fill(channels[h] );
|
||||||
|
hE->Fill( energies[h] );
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO a quick way to read and fill histogram; the most time consumping part is filling trace
|
if( ElapsedTime > 500 ) {
|
||||||
|
|
||||||
if( ElapsedTime > 1000 ) {
|
|
||||||
pixie->PrintStatistics(0);
|
pixie->PrintStatistics(0);
|
||||||
PresenTime = CurrentTime;
|
PresenTime = CurrentTime;
|
||||||
ElapsedTime = 0;
|
ElapsedTime = 0;
|
||||||
|
|
||||||
|
canvas->cd(1); hch->Draw();
|
||||||
|
canvas->cd(2); hE->Draw();
|
||||||
|
canvas->Modified();
|
||||||
|
canvas->Update();
|
||||||
|
gSystem->ProcessEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentTime = get_time();
|
CurrentTime = get_time();
|
||||||
|
@ -228,6 +246,20 @@ int main(int argc, char *argv[]){
|
||||||
pixie->StopRun();
|
pixie->StopRun();
|
||||||
pixie->CloseFile();
|
pixie->CloseFile();
|
||||||
|
|
||||||
|
unsigned int nData = pixie->ScanNumDataBlockInExtFIFO();
|
||||||
|
unsigned short * energies = pixie->GetFIFOEnergies();
|
||||||
|
unsigned short * channels = pixie->GetFIFOChannels();
|
||||||
|
for( unsigned int h = 0; h < nData; h++) {
|
||||||
|
//printf(" %3u| %8u, %8u , %20llu\n", h, channels[h], energies[h], timestamps[h]);
|
||||||
|
hch->Fill(channels[h] );
|
||||||
|
hE->Fill( energies[h] );
|
||||||
|
}
|
||||||
|
canvas->cd(1); hch->Draw();
|
||||||
|
canvas->cd(2); hE->Draw();
|
||||||
|
canvas->Modified();
|
||||||
|
canvas->Update();
|
||||||
|
gSystem->ProcessEvents();
|
||||||
|
|
||||||
printf("===================================\n");
|
printf("===================================\n");
|
||||||
pixie->PrintStatistics(0);
|
pixie->PrintStatistics(0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user