ran various test, bugs fixed. approching to finsihed single PHA digitizer
This commit is contained in:
parent
12f965f788
commit
03b6a03557
57
ClassData.h
57
ClassData.h
|
@ -23,10 +23,9 @@ class Data{
|
||||||
unsigned short boardSN;
|
unsigned short boardSN;
|
||||||
float ch2ns;
|
float ch2ns;
|
||||||
|
|
||||||
unsigned int nByte; /// number of byte
|
unsigned int nByte; /// number of byte from read buffer
|
||||||
char *buffer; /// readout buffer
|
char *buffer; /// readout buffer
|
||||||
uint32_t AllocatedSize;
|
uint32_t AllocatedSize;
|
||||||
uint32_t BufferSize;
|
|
||||||
|
|
||||||
double TriggerRate[MaxNChannels]; /// Hz
|
double TriggerRate[MaxNChannels]; /// Hz
|
||||||
unsigned long TotNumEvents[MaxNChannels];
|
unsigned long TotNumEvents[MaxNChannels];
|
||||||
|
@ -52,7 +51,7 @@ class Data{
|
||||||
Data();
|
Data();
|
||||||
~Data();
|
~Data();
|
||||||
|
|
||||||
void Allocate10MBMemory();
|
void Allocate80MBMemory();
|
||||||
void AllocateMemory(uint32_t size);
|
void AllocateMemory(uint32_t size);
|
||||||
|
|
||||||
void SetSaveWaveToMemory(bool OnOff) { this->SaveWaveToMemory = OnOff; }
|
void SetSaveWaveToMemory(bool OnOff) { this->SaveWaveToMemory = OnOff; }
|
||||||
|
@ -61,6 +60,8 @@ class Data{
|
||||||
void ClearTriggerRate();
|
void ClearTriggerRate();
|
||||||
void ClearBuffer();
|
void ClearBuffer();
|
||||||
|
|
||||||
|
void CopyBuffer( const char * buffer, const unsigned int size);
|
||||||
|
|
||||||
void SaveBuffer(const char * fileName);
|
void SaveBuffer(const char * fileName);
|
||||||
unsigned int GetPresentFileSize() {return presentFileSizeByte;}
|
unsigned int GetPresentFileSize() {return presentFileSizeByte;}
|
||||||
|
|
||||||
|
@ -115,15 +116,14 @@ inline Data::~Data(){
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::AllocateMemory(uint32_t size){
|
inline void Data::AllocateMemory(uint32_t size){
|
||||||
delete buffer;
|
ClearBuffer();
|
||||||
printf("===== size : %u \n", size);
|
AllocatedSize = size;
|
||||||
BufferSize = size;
|
buffer = (char *) malloc( AllocatedSize);
|
||||||
buffer = (char *) malloc( BufferSize);
|
printf("Allocated %u byte for buffer = %u words\n", AllocatedSize, AllocatedSize / 4);
|
||||||
printf("Allocated %u byte for buffer = %u words\n", BufferSize, BufferSize / 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::Allocate10MBMemory(){
|
inline void Data::Allocate80MBMemory(){
|
||||||
AllocateMemory( 10 * 1024 * 1024 ); /// 10 M Byte
|
AllocateMemory( 80 * 1024 * 1024 ); /// 80 M Byte
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::ClearTriggerRate(){
|
inline void Data::ClearTriggerRate(){
|
||||||
|
@ -136,7 +136,6 @@ inline void Data::ClearTriggerRate(){
|
||||||
inline void Data::ClearData(){
|
inline void Data::ClearData(){
|
||||||
nByte = 0;
|
nByte = 0;
|
||||||
AllocatedSize = 0;
|
AllocatedSize = 0;
|
||||||
BufferSize = 0;
|
|
||||||
IsNotRollOverFakeAgg = true;
|
IsNotRollOverFakeAgg = true;
|
||||||
for( int i = 0 ; i < MaxNChannels; i++){
|
for( int i = 0 ; i < MaxNChannels; i++){
|
||||||
NumEvents[i] = 0;
|
NumEvents[i] = 0;
|
||||||
|
@ -162,10 +161,14 @@ inline void Data::ClearData(){
|
||||||
|
|
||||||
inline void Data::ClearBuffer(){
|
inline void Data::ClearBuffer(){
|
||||||
delete buffer;
|
delete buffer;
|
||||||
BufferSize = 0;
|
AllocatedSize = 0;
|
||||||
nByte = 0;
|
nByte = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Data::CopyBuffer(const char * buffer, const unsigned int size){
|
||||||
|
std::memcpy(this->buffer, buffer, size);
|
||||||
|
}
|
||||||
|
|
||||||
inline void Data::SaveBuffer(const char * fileName){
|
inline void Data::SaveBuffer(const char * fileName){
|
||||||
|
|
||||||
char saveFileName[100];
|
char saveFileName[100];
|
||||||
|
@ -186,6 +189,7 @@ inline void Data::SaveBuffer(const char * fileName){
|
||||||
fwrite(buffer, nByte, 1, haha);
|
fwrite(buffer, nByte, 1, haha);
|
||||||
|
|
||||||
presentFileSizeByte = ftell(haha);
|
presentFileSizeByte = ftell(haha);
|
||||||
|
printf("=========== file Size : %u Byte = %.2f MB\n", presentFileSizeByte, presentFileSizeByte/1024./1024.);
|
||||||
|
|
||||||
fclose(haha);
|
fclose(haha);
|
||||||
}
|
}
|
||||||
|
@ -259,7 +263,7 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
|
||||||
unsigned int word = ReadBuffer(nw, verbose);
|
unsigned int word = ReadBuffer(nw, verbose);
|
||||||
if( ( (word >> 28) & 0xF ) == 0xA ) { /// start of Board Agg
|
if( ( (word >> 28) & 0xF ) == 0xA ) { /// start of Board Agg
|
||||||
unsigned int nWord = word & 0x0FFFFFFF ;
|
unsigned int nWord = word & 0x0FFFFFFF ;
|
||||||
if( verbose >= 1 ) printf("Number of words in this Agg : %u \n", nWord);
|
if( verbose >= 1 ) printf("Number of words in this Agg : %u = %u Byte\n", nWord, nWord * 4);
|
||||||
|
|
||||||
nw = nw + 1; word = ReadBuffer(nw, verbose);
|
nw = nw + 1; word = ReadBuffer(nw, verbose);
|
||||||
unsigned int BoardID = ((word >> 27) & 0x1F);
|
unsigned int BoardID = ((word >> 27) & 0x1F);
|
||||||
|
@ -330,7 +334,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
nSample = ( word & 0xFFFF ) * 8;
|
nSample = ( word & 0xFFFF ) * 8;
|
||||||
extra2Option = ( (word >> 24 ) & 0x7 );
|
extra2Option = ( (word >> 24 ) & 0x7 );
|
||||||
hasExtra2 = ( (word >> 28 ) & 0x1 );
|
hasExtra2 = ( (word >> 28 ) & 0x1 );
|
||||||
if( !fastDecode) {
|
if( !fastDecode || verbose >= 2){
|
||||||
unsigned int digitalProbe = ( (word >> 16 ) & 0xF );
|
unsigned int digitalProbe = ( (word >> 16 ) & 0xF );
|
||||||
unsigned int analogProbe2 = ( (word >> 20 ) & 0x3 );
|
unsigned int analogProbe2 = ( (word >> 20 ) & 0x3 );
|
||||||
unsigned int analogProbe1 = ( (word >> 22 ) & 0x3 );
|
unsigned int analogProbe1 = ( (word >> 22 ) & 0x3 );
|
||||||
|
@ -389,7 +393,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nEvents = aggSize / (nSample/2 + 2 + hasExtra2 );
|
nEvents = (aggSize - 2) / (nSample/2 + 2 + hasExtra2 );
|
||||||
if( verbose >= 2 ) printf("-------------------nEvents : %d \n", nEvents);
|
if( verbose >= 2 ) printf("-------------------nEvents : %d \n", nEvents);
|
||||||
}else{
|
}else{
|
||||||
if( verbose >= 2 ) printf("does not has format info. unable to read buffer.\n");
|
if( verbose >= 2 ) printf("does not has format info. unable to read buffer.\n");
|
||||||
|
@ -419,32 +423,39 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
}else{
|
}else{
|
||||||
for( int wi = 0; wi < nSample/2; wi++){
|
for( int wi = 0; wi < nSample/2; wi++){
|
||||||
nw = nw +1 ; word = ReadBuffer(nw, verbose-2);
|
nw = nw +1 ; word = ReadBuffer(nw, verbose-2);
|
||||||
|
///The CAEN manual is wrong, the bit [31:16] is anaprobe 1
|
||||||
bool isTrigger1 = (( word >> 31 ) & 0x1 );
|
bool isTrigger1 = (( word >> 31 ) & 0x1 );
|
||||||
bool dp1 = (( word >> 30 ) & 0x1 );
|
bool dp1 = (( word >> 30 ) & 0x1 );
|
||||||
unsigned short wave1 = (( word >> 16) & 0x3FFF);
|
unsigned short wave1 = (( word >> 16) & 0x3FFF);
|
||||||
|
///The CAEN manual is wrong, the bit [31:16] is anaprobe 2
|
||||||
bool isTrigger0 = (( word >> 15 ) & 0x1 );
|
bool isTrigger0 = (( word >> 15 ) & 0x1 );
|
||||||
bool dp0 = (( word >> 14 ) & 0x1 );
|
bool dp0 = (( word >> 14 ) & 0x1 );
|
||||||
unsigned short wave0 = ( word & 0x3FFF);
|
unsigned short wave0 = ( word & 0x3FFF);
|
||||||
|
if( wave0 >= 0x3FF0 ) wave0 = 0;
|
||||||
|
|
||||||
if( SaveWaveToMemory){
|
if( SaveWaveToMemory){
|
||||||
if( hasDualTrace ){
|
if( hasDualTrace ){
|
||||||
tempWaveform1.push_back(wave0);
|
|
||||||
tempWaveform2.push_back(wave1);
|
|
||||||
}else{
|
|
||||||
tempWaveform1.push_back(wave0);
|
|
||||||
tempWaveform1.push_back(wave1);
|
tempWaveform1.push_back(wave1);
|
||||||
}
|
tempWaveform2.push_back(wave0);
|
||||||
|
tempDigiWaveform1.push_back(dp0);
|
||||||
|
}else{
|
||||||
|
tempWaveform1.push_back(wave1);
|
||||||
|
tempWaveform1.push_back(wave0);
|
||||||
tempDigiWaveform1.push_back(dp0);
|
tempDigiWaveform1.push_back(dp0);
|
||||||
tempDigiWaveform1.push_back(dp1);
|
tempDigiWaveform1.push_back(dp1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( isTrigger0 == 1 ) triggerAtSample = 2*wi ;
|
if( isTrigger0 == 1 ) triggerAtSample = 2*wi ;
|
||||||
if( isTrigger1 == 1 ) triggerAtSample = 2*wi + 1;
|
if( isTrigger1 == 1 ) triggerAtSample = 2*wi + 1;
|
||||||
|
|
||||||
if( verbose >= 4 && ev == 0 ){
|
if( verbose >= 4 && ev == 0 ){
|
||||||
|
if( !hasDualTrace ){
|
||||||
printf("%4d| %5d, %d, %d \n", 2*wi, wave0, dp0, isTrigger0);
|
printf("%4d| %5d, %d, %d \n", 2*wi, wave0, dp0, isTrigger0);
|
||||||
printf("%4d| %5d, %d, %d \n", 2*wi+1, wave1, dp1, isTrigger1);
|
printf("%4d| %5d, %d, %d \n", 2*wi+1, wave1, dp1, isTrigger1);
|
||||||
|
}else{
|
||||||
|
printf("%4d| %5d, %5d | %d, %d | %d %d\n", wi, wave0, wave1, dp0, dp1, isTrigger0, isTrigger1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +480,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
unsigned long long timeStamp = (extTimeStamp << 31) ;
|
unsigned long long timeStamp = (extTimeStamp << 31) ;
|
||||||
timeStamp = timeStamp + timeStamp0;
|
timeStamp = timeStamp + timeStamp0;
|
||||||
|
|
||||||
if( verbose >= 2) printf("extra2 : 0x%0X, TimeStamp : %llu\n", extra2, timeStamp);
|
if( verbose >= 2 && hasExtra2 ) printf("extra2 : 0x%0X, TimeStamp : %llu\n", extra2, timeStamp);
|
||||||
nw = nw +1 ; word = ReadBuffer(nw, verbose);
|
nw = nw +1 ; word = ReadBuffer(nw, verbose);
|
||||||
unsigned int extra = (( word >> 16) & 0x3FF);
|
unsigned int extra = (( word >> 16) & 0x3FF);
|
||||||
unsigned int energy = (word & 0x7FFF);
|
unsigned int energy = (word & 0x7FFF);
|
||||||
|
@ -589,7 +600,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nEvents = aggSize / (nSample/2 + 2 + hasExtra );
|
nEvents = (aggSize -2) / (nSample/2 + 2 + hasExtra );
|
||||||
if( verbose >= 2 ) printf("----------------- nEvents : %d \n", nEvents);
|
if( verbose >= 2 ) printf("----------------- nEvents : %d \n", nEvents);
|
||||||
|
|
||||||
///========= Decode an event
|
///========= Decode an event
|
||||||
|
|
|
@ -306,9 +306,9 @@ int Digitizer::ProgramPHABoard(){
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::PreTrigger) + 0x7000 , 124 );
|
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::PreTrigger) + 0x7000 , 124 );
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::InputDynamicRange) + 0x7000 , 0x0 );
|
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::InputDynamicRange) + 0x7000 , 0x0 );
|
||||||
|
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::NumberEventsPerAggregate_G) + 0x7000, 10);
|
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::NumberEventsPerAggregate_G) + 0x7000, 511);
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::AggregateOrganization), 0);
|
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::AggregateOrganization), 0);
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::MaxAggregatePerBlockTransfer), 200);
|
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::MaxAggregatePerBlockTransfer), 4);
|
||||||
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::DPPAlgorithmControl) + 0x7000, 0xe30200f);
|
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::DPPAlgorithmControl) + 0x7000, 0xe30200f);
|
||||||
|
|
||||||
if( ret != 0 ) { printf("==== set channels error.\n"); return 0;}
|
if( ret != 0 ) { printf("==== set channels error.\n"); return 0;}
|
||||||
|
@ -325,7 +325,13 @@ int Digitizer::ProgramPHABoard(){
|
||||||
void Digitizer::StartACQ(){
|
void Digitizer::StartACQ(){
|
||||||
if ( AcqRun ) return;
|
if ( AcqRun ) return;
|
||||||
|
|
||||||
data->AllocateMemory(CalByteForBuffer());
|
unsigned int bufferSize = CalByteForBuffer();
|
||||||
|
if( bufferSize > 80 * 1024 * 1024 ){
|
||||||
|
printf("============= buffer size bigger than 80 MB");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->AllocateMemory(bufferSize);
|
||||||
ret = CAEN_DGTZ_SWStartAcquisition(handle);
|
ret = CAEN_DGTZ_SWStartAcquisition(handle);
|
||||||
|
|
||||||
if( ret != 0 ) {
|
if( ret != 0 ) {
|
||||||
|
@ -352,11 +358,13 @@ unsigned int Digitizer::CalByteForBuffer(){
|
||||||
unsigned int boardCfg ;
|
unsigned int boardCfg ;
|
||||||
unsigned int eventAgg[NChannel/2];
|
unsigned int eventAgg[NChannel/2];
|
||||||
unsigned int recordLength[NChannel/2];
|
unsigned int recordLength[NChannel/2];
|
||||||
|
unsigned int aggOrgan;
|
||||||
|
|
||||||
if( isConnected ){
|
if( isConnected ){
|
||||||
numAggBLT = ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer, 0, false);
|
numAggBLT = ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer, 0, false);
|
||||||
chMask = ReadRegister(Register::DPP::ChannelEnableMask, 0, false);
|
chMask = ReadRegister(Register::DPP::ChannelEnableMask, 0, false);
|
||||||
boardCfg = ReadRegister(Register::DPP::BoardConfiguration, 0, false);
|
boardCfg = ReadRegister(Register::DPP::BoardConfiguration, 0, false);
|
||||||
|
aggOrgan = ReadRegister(Register::DPP::AggregateOrganization, 0, false);
|
||||||
|
|
||||||
for( int pCh = 0; pCh < NChannel/2; pCh++){
|
for( int pCh = 0; pCh < NChannel/2; pCh++){
|
||||||
eventAgg[pCh] = ReadRegister(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 , false);
|
eventAgg[pCh] = ReadRegister(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 , false);
|
||||||
|
@ -366,15 +374,18 @@ unsigned int Digitizer::CalByteForBuffer(){
|
||||||
numAggBLT = GetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer);
|
numAggBLT = GetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer);
|
||||||
chMask = GetSettingFromMemory(Register::DPP::ChannelEnableMask);
|
chMask = GetSettingFromMemory(Register::DPP::ChannelEnableMask);
|
||||||
boardCfg = GetSettingFromMemory(Register::DPP::BoardConfiguration);
|
boardCfg = GetSettingFromMemory(Register::DPP::BoardConfiguration);
|
||||||
|
aggOrgan = GetSettingFromMemory(Register::DPP::AggregateOrganization);
|
||||||
for( int pCh = 0; pCh < NChannel/2; pCh++){
|
for( int pCh = 0; pCh < NChannel/2; pCh++){
|
||||||
eventAgg[pCh] = GetSettingFromMemory(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 );
|
eventAgg[pCh] = GetSettingFromMemory(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 );
|
||||||
recordLength[pCh] = GetSettingFromMemory(Register::DPP::RecordLength_G, pCh * 2);
|
recordLength[pCh] = GetSettingFromMemory(Register::DPP::RecordLength_G, pCh * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf(" agg. orgainzation (bit) : 0x%X \n", aggOrgan);
|
||||||
printf(" Channel Mask : %04X \n", chMask);
|
printf(" Channel Mask : %04X \n", chMask);
|
||||||
printf("Max number of Agg per Readout : %u \n", numAggBLT);
|
printf("Max number of Agg per Readout : %u \n", numAggBLT);
|
||||||
printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) );
|
printf(" is Extra2 enabed : %u \n", ((boardCfg >> 17) & 0x1) );
|
||||||
|
printf(" is Record wave : %u \n", ((boardCfg >> 16) & 0x1) );
|
||||||
for( int pCh = 0; pCh < NChannel/2; pCh++){
|
for( int pCh = 0; pCh < NChannel/2; pCh++){
|
||||||
printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]);
|
printf("Paired Ch : %d, RecordLength (bit value): %u, Event per Agg. : %u \n", pCh, recordLength[pCh], eventAgg[pCh]);
|
||||||
}
|
}
|
||||||
|
@ -382,17 +393,18 @@ unsigned int Digitizer::CalByteForBuffer(){
|
||||||
unsigned int bufferSize = 0;
|
unsigned int bufferSize = 0;
|
||||||
for( int pCh = 0; pCh < NChannel/2 ; pCh++){
|
for( int pCh = 0; pCh < NChannel/2 ; pCh++){
|
||||||
if( (chMask & ( 3 << (2 * pCh) )) == 0 ) continue;
|
if( (chMask & ( 3 << (2 * pCh) )) == 0 ) continue;
|
||||||
bufferSize += 2 + ( 2 + ((boardCfg >> 17) & 0x1) + recordLength[pCh]*4 ) * eventAgg[pCh] ;
|
bufferSize += 2 + ( 2 + ((boardCfg >> 17) & 0x1) + ((boardCfg >> 16) & 0x1)*recordLength[pCh]*4 ) * eventAgg[pCh] ;
|
||||||
}
|
}
|
||||||
bufferSize += 4; /// Bd. Agg Header
|
bufferSize += 4; /// Bd. Agg Header
|
||||||
bufferSize = bufferSize * numAggBLT * 4; /// 1 words = 4 byte
|
bufferSize = bufferSize * numAggBLT * 4; /// 1 words = 4 byte
|
||||||
|
|
||||||
printf("================ Buffer Size : %d Byte \n", bufferSize );
|
printf("=============== Buffer Size : %8d Byte \n", bufferSize );
|
||||||
return bufferSize ;
|
return bufferSize ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Digitizer::ReadData(){
|
void Digitizer::ReadData(){
|
||||||
if( !isConnected ) return;
|
if( !isConnected ) return;
|
||||||
|
if( !AcqRun) return;
|
||||||
if( data->buffer == NULL ) {
|
if( data->buffer == NULL ) {
|
||||||
printf("need allocate memory for readout buffer\n");
|
printf("need allocate memory for readout buffer\n");
|
||||||
return;
|
return;
|
||||||
|
|
82
FSUDAQ.cpp
82
FSUDAQ.cpp
|
@ -149,6 +149,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
cbMode->AddEntry("Data Run", Mode_DataRun);
|
cbMode->AddEntry("Data Run", Mode_DataRun);
|
||||||
cbMode->Select(1, false);
|
cbMode->Select(1, false);
|
||||||
cbMode->Resize(80, 20);
|
cbMode->Resize(80, 20);
|
||||||
|
cbMode->Connect("Changed()", "MainWindow", this, "ChangePlot()");
|
||||||
|
|
||||||
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
TGHorizontalFrame *hfg1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hfg1 ,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
|
||||||
|
|
||||||
|
@ -224,17 +225,17 @@ 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*)"The LogMsg is not complete for all actions. [update later]");
|
||||||
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
||||||
|
|
||||||
//HandleMenu(M_DIGITIZER_OPEN);
|
HandleMenu(M_DIGITIZER_OPEN);
|
||||||
//HandleMenu(M_BOARD_SETTINGS);
|
HandleMenu(M_BOARD_SETTINGS);
|
||||||
//HandleMenu(M_CH_SETTING_PHA);
|
HandleMenu(M_CH_SETTING_PHA);
|
||||||
//HandleMenu(M_CH_SETTING_PSD);
|
//HandleMenu(M_CH_SETTING_PSD);
|
||||||
//HandleMenu(M_REGISTER_SETTING);
|
//HandleMenu(M_REGISTER_SETTING);
|
||||||
//HandleMenu(M_TRIGGER_SUMMARY);
|
//HandleMenu(M_TRIGGER_SUMMARY);
|
||||||
|
|
||||||
gAnaTrace1 = new TGraph();
|
gAnaTrace1 = new TGraph(); gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
|
||||||
gAnaTrace2 = new TGraph();
|
gAnaTrace2 = new TGraph(); gAnaTrace2->SetLineColor(2);
|
||||||
gDigiTrace1 = new TGraph();
|
gDigiTrace1 = new TGraph(); gDigiTrace1->SetLineColor(4);
|
||||||
gDigiTrace2 = new TGraph();
|
gDigiTrace2 = new TGraph(); gDigiTrace2->SetLineColor(6);
|
||||||
|
|
||||||
gStyle->SetOptStat("neiou");
|
gStyle->SetOptStat("neiou");
|
||||||
|
|
||||||
|
@ -438,7 +439,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
hChannel[i] = new TH1F(Form("hBd%02d", i),Form("hBd%02d; ch; count", i), digi[i]->GetNChannel(), 0, digi[i]->GetNChannel());
|
hChannel[i] = new TH1F(Form("hBd%02d", i),Form("hBd%02d; ch; count", i), digi[i]->GetNChannel(), 0, digi[i]->GetNChannel());
|
||||||
for( int j = 0; j < MaxNChannels; j++) hEnergy[i][j] = new TH1F(Form("hE%02dch%02d", i, j),Form("hE bd-%02d ch-%02d; Energy[ch]; count", i, j), 400, 0, 20000);
|
for( int j = 0; j < MaxNChannels; j++) hEnergy[i][j] = new TH1F(Form("hE%02dch%02d", i, j),Form("hE bd-%02d ch-%02d; Energy[ch]; count", i, j), 400, 0, 30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -597,7 +598,7 @@ void MainWindow::LogMsg(char * msg){
|
||||||
|
|
||||||
teLog->AddLine(outMsg);
|
teLog->AddLine(outMsg);
|
||||||
printf("%s\n", outMsg.Data());
|
printf("%s\n", outMsg.Data());
|
||||||
teLog->LineDown();
|
//teLog->LineDown();
|
||||||
teLog->ShowBottom();
|
teLog->ShowBottom();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -610,38 +611,44 @@ void MainWindow::PlotSingleTrace(){
|
||||||
int boardID = boardIDEntry->GetNumber();
|
int boardID = boardIDEntry->GetNumber();
|
||||||
int chID = chIDEntry->GetNumber();
|
int chID = chIDEntry->GetNumber();
|
||||||
|
|
||||||
|
uint32_t bdConfig = digi[boardID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
|
||||||
|
bool isDualTrace = ( bdConfig >> 11 ) & 0x1;
|
||||||
|
bool isRecordWave = ( bdConfig >> 16 ) & 0x1;
|
||||||
|
|
||||||
|
if( !isRecordWave ) {
|
||||||
|
LogMsg((char *) "Please enable trace recording.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Data * data = digi[boardID]->GetData();
|
Data * data = digi[boardID]->GetData();
|
||||||
int ch2ns = (int) digi[boardID]->GetCh2ns();
|
int ch2ns = (int) digi[boardID]->GetCh2ns();
|
||||||
|
|
||||||
digi[boardID]->StartACQ();
|
digi[boardID]->StartACQ();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while(count < 10){
|
while(count < 10){
|
||||||
usleep(100*1000); /// wait half sec
|
usleep(100*1000); /// wait half sec
|
||||||
digi[boardID]->ReadData();
|
digi[boardID]->ReadData();
|
||||||
|
|
||||||
if( data->nByte > 0 ){
|
if( data->nByte > 0 ){
|
||||||
data->DecodeBuffer(0);
|
data->DecodeBuffer(false, 2);
|
||||||
data->PrintStat();
|
data->PrintStat();
|
||||||
|
|
||||||
gDigiTrace1->SetLineColor(4);
|
|
||||||
|
|
||||||
int traceLength = (data->Waveform1[chID][0]).size();
|
int traceLength = (data->Waveform1[chID][0]).size();
|
||||||
|
|
||||||
printf("0----------%d \n", traceLength);
|
|
||||||
|
|
||||||
if( traceLength == 0 ) {
|
if( traceLength == 0 ) {
|
||||||
LogMsg((char *)"no trace");
|
LogMsg((char *)"no trace");
|
||||||
bFitTrace->SetEnabled(false);
|
bFitTrace->SetEnabled(false);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
for( int i = 0; i < traceLength ; i++) {
|
for( int i = 0; i < traceLength ; i++) {
|
||||||
gAnaTrace1->SetPoint(i, i*ch2ns, (data->Waveform1[chID][0])[i]);
|
gAnaTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform1[chID][0])[i]);
|
||||||
|
if( isDualTrace) gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform2[chID][0])[i]);
|
||||||
}
|
}
|
||||||
if( traceLength <= gAnaTrace1->GetN() ){
|
if( traceLength <= gAnaTrace1->GetN() ){
|
||||||
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
||||||
gAnaTrace1->RemovePoint(i);
|
gAnaTrace1->RemovePoint(i);
|
||||||
|
if( isDualTrace) gAnaTrace2->RemovePoint(i);
|
||||||
gDigiTrace1->RemovePoint(i);
|
gDigiTrace1->RemovePoint(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,13 +656,16 @@ void MainWindow::PlotSingleTrace(){
|
||||||
double xmin, xmax, ymin, ymax;
|
double xmin, xmax, ymin, ymax;
|
||||||
gAnaTrace1->ComputeRange(xmin, ymin, xmax, ymax);
|
gAnaTrace1->ComputeRange(xmin, ymin, xmax, ymax);
|
||||||
for( int i = 0; i < traceLength ; i++) {
|
for( int i = 0; i < traceLength ; i++) {
|
||||||
gDigiTrace1->SetPoint(i, i*ch2ns, (ymax-ymin)*(data->DigiWaveform1[chID][0])[i] + ymin);
|
gDigiTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (ymax-ymin)*(data->DigiWaveform1[chID][0])[i] + ymin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->ClearData();
|
data->ClearData();
|
||||||
|
|
||||||
fEcanvas->GetCanvas()->cd();
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
|
||||||
|
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
|
||||||
gAnaTrace1->Draw("APL");
|
gAnaTrace1->Draw("APL");
|
||||||
|
gAnaTrace2->Draw("L");
|
||||||
gDigiTrace1->Draw("L");
|
gDigiTrace1->Draw("L");
|
||||||
fEcanvas->GetCanvas()->Update();
|
fEcanvas->GetCanvas()->Update();
|
||||||
break;
|
break;
|
||||||
|
@ -716,6 +726,28 @@ void MainWindow::FitTrace(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ChangePlot(){
|
||||||
|
int boardID = boardIDEntry->GetNumber();
|
||||||
|
int ch = chIDEntry->GetNumber();
|
||||||
|
|
||||||
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
if( cbMode->GetSelected() == Mode_CountHist ) hChannel[boardID]->Draw("hist");
|
||||||
|
|
||||||
|
if( cbMode->GetSelected() == Mode_EnergyHist ) hEnergy[boardID][ch]->Draw("hist");
|
||||||
|
|
||||||
|
if( cbMode->GetSelected() == Mode_Oscilloscope ){
|
||||||
|
uint32_t bdConfig = digi[boardID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
|
||||||
|
bool isDualTrace = ( bdConfig >> 11 ) & 0x1;
|
||||||
|
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
|
||||||
|
gAnaTrace1->Draw("APL");
|
||||||
|
if( isDualTrace ) gAnaTrace2->Draw("L");
|
||||||
|
gDigiTrace1->Draw("L");
|
||||||
|
}
|
||||||
|
|
||||||
|
fEcanvas->GetCanvas()->Update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//TODO use the ptr to tell which board, and each digitizer has an indivual thread for savign data and filling hists.
|
//TODO use the ptr to tell which board, and each digitizer has an indivual thread for savign data and filling hists.
|
||||||
void * MainWindow::RunThread(void * ptr){
|
void * MainWindow::RunThread(void * ptr){
|
||||||
printf("=== %s\n", __func__);
|
printf("=== %s\n", __func__);
|
||||||
|
@ -732,11 +764,13 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
uint32_t ElapsedTime = 0;
|
uint32_t ElapsedTime = 0;
|
||||||
|
|
||||||
TString dataFileName = ProgramSetting::DataSavingPath + dataPrefix->GetText();
|
TString dataFileName = ProgramSetting::DataSavingPath + dataPrefix->GetText();
|
||||||
//dataFileName += Form("_run%03d_%03d_%3s", (int) runIDEntry->GetNumber(), (int) digi[boardID]->GetSerialNumber(), digi[boardID]->GetDPPStringShort().c_str());
|
|
||||||
dataFileName += Form("_run%03d", (int) runIDEntry->GetNumber());
|
dataFileName += Form("_run%03d", (int) runIDEntry->GetNumber());
|
||||||
|
|
||||||
printf("|%s|\n", dataFileName.Data());
|
printf("|%s|\n", dataFileName.Data());
|
||||||
|
|
||||||
|
uint32_t bdConfig = digi[boardID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
|
||||||
|
bool isDualTrace = ( bdConfig >> 11 ) & 0x1;
|
||||||
|
|
||||||
Data * data = digi[boardID]->GetData();
|
Data * data = digi[boardID]->GetData();
|
||||||
|
|
||||||
while(digi[boardID]->IsRunning()){
|
while(digi[boardID]->IsRunning()){
|
||||||
|
@ -748,13 +782,13 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
ch2ns = (int) digi[boardID]->GetCh2ns();
|
ch2ns = (int) digi[boardID]->GetCh2ns();
|
||||||
ch = chIDEntry->GetNumber();
|
ch = chIDEntry->GetNumber();
|
||||||
|
|
||||||
|
|
||||||
if( data->nByte > 0 ){
|
if( data->nByte > 0 ){
|
||||||
//data->PrintStat();
|
//data->PrintStat();
|
||||||
|
|
||||||
if( cbMode->GetSelected() == Mode_DataRun ){
|
if( cbMode->GetSelected() == Mode_DataRun ){
|
||||||
// Rate graph?
|
// Rate graph?
|
||||||
data->SaveBuffer(dataFileName.Data());
|
data->SaveBuffer(dataFileName.Data());
|
||||||
|
data->DecodeBuffer(true, 0);
|
||||||
std::string msg = Form("File Size : %.2f MB", data->GetPresentFileSize() / 1024./1024. );
|
std::string msg = Form("File Size : %.2f MB", data->GetPresentFileSize() / 1024./1024. );
|
||||||
teLog->AddLine(msg.c_str());
|
teLog->AddLine(msg.c_str());
|
||||||
teLog->LineDown();
|
teLog->LineDown();
|
||||||
|
@ -762,7 +796,7 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
data->DecodeBuffer(0);
|
data->DecodeBuffer(false, 0);
|
||||||
|
|
||||||
fEcanvas->GetCanvas()->cd();
|
fEcanvas->GetCanvas()->cd();
|
||||||
|
|
||||||
|
@ -773,15 +807,19 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
traceLength = (data->Waveform1[ch][nData-1]).size();
|
traceLength = (data->Waveform1[ch][nData-1]).size();
|
||||||
if( traceLength > 0 ){
|
if( traceLength > 0 ){
|
||||||
for( int i = 0; i < traceLength; i++) {
|
for( int i = 0; i < traceLength; i++) {
|
||||||
gAnaTrace1->SetPoint(i, i*ch2ns, (data->Waveform1[ch][nData-1])[i]);
|
gAnaTrace1->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform1[ch][nData-1])[i]);
|
||||||
|
if( isDualTrace) gAnaTrace2->SetPoint(i, i*ch2ns*(1+isDualTrace), (data->Waveform2[ch][nData-1])[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( traceLength <= gAnaTrace1->GetN() ){
|
if( traceLength <= gAnaTrace1->GetN() ){
|
||||||
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
for( int i = gAnaTrace1->GetN() -1 ; i >= traceLength ; i--){
|
||||||
gAnaTrace1->RemovePoint(i);
|
gAnaTrace1->RemovePoint(i);
|
||||||
|
if( isDualTrace) gAnaTrace2->RemovePoint(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gAnaTrace1->GetYaxis()->SetRangeUser(0, 0x3FFF);
|
||||||
gAnaTrace1->Draw("APL");
|
gAnaTrace1->Draw("APL");
|
||||||
|
gAnaTrace2->Draw("L");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,11 +837,9 @@ void * MainWindow::RunThread(void * ptr){
|
||||||
}
|
}
|
||||||
|
|
||||||
///Fill Energy histogram
|
///Fill Energy histogram
|
||||||
//for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
|
|
||||||
for( int i = 0; i < data->NumEvents[ch]; i++){
|
for( int i = 0; i < data->NumEvents[ch]; i++){
|
||||||
hEnergy[boardID][ch]->Fill( data->Energy[ch][i]);
|
hEnergy[boardID][ch]->Fill( data->Energy[ch][i]);
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
if( cbMode->GetSelected() == Mode_EnergyHist ) hEnergy[boardID][ch]->Draw("hist");
|
if( cbMode->GetSelected() == Mode_EnergyHist ) hEnergy[boardID][ch]->Draw("hist");
|
||||||
if( cbMode->GetSelected() == Mode_CountHist ) hChannel[boardID]->Draw("hist");
|
if( cbMode->GetSelected() == Mode_CountHist ) hChannel[boardID]->Draw("hist");
|
||||||
|
|
2
FSUDAQ.h
2
FSUDAQ.h
|
@ -93,7 +93,7 @@ public:
|
||||||
void PlotSingleTrace();
|
void PlotSingleTrace();
|
||||||
void FitTrace();
|
void FitTrace();
|
||||||
|
|
||||||
void Oscilloscope();
|
void ChangePlot();
|
||||||
|
|
||||||
void OpenChannelSetting(Int_t);
|
void OpenChannelSetting(Int_t);
|
||||||
void UpdateChannelSetting();
|
void UpdateChannelSetting();
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -35,7 +35,7 @@ test_indep : test_indep.cpp RegisterAddress.h macro.h
|
||||||
@echo "--------- making test_indep"
|
@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)
|
FSUDAQ : FSUDAQDict.cxx $(OBJS) ClassData.h
|
||||||
@echo "----------- creating FSUDAQ"
|
@echo "----------- creating FSUDAQ"
|
||||||
$(CC) $(COPTS) FSUDAQDict.cxx $(OBJS) -o FSUDAQ $(CAENLIBS) $(ROOTLIBS)
|
$(CC) $(COPTS) FSUDAQDict.cxx $(OBJS) -o FSUDAQ $(CAENLIBS) $(ROOTLIBS)
|
||||||
|
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ void BoardSetting::ReadData(){
|
||||||
}
|
}
|
||||||
|
|
||||||
Data * data = digi[boardID]->GetData();
|
Data * data = digi[boardID]->GetData();
|
||||||
data->AllocateMemory();
|
data->Allocate80MBMemory();
|
||||||
data->DPPType = digi[boardID]->GetDPPType();
|
data->DPPType = digi[boardID]->GetDPPType();
|
||||||
|
|
||||||
digi[boardID]->ReadData();
|
digi[boardID]->ReadData();
|
||||||
|
|
|
@ -86,8 +86,8 @@ ChannelSettingPHA::ChannelSettingPHA(const TGWindow *p, UInt_t w, UInt_t h, Digi
|
||||||
///----------- Polarity
|
///----------- Polarity
|
||||||
TGLabel * lbPol = new TGLabel(vfInput1, "Polarity");vfInput1->AddFrame(lbPol, layoutHintsR);
|
TGLabel * lbPol = new TGLabel(vfInput1, "Polarity");vfInput1->AddFrame(lbPol, layoutHintsR);
|
||||||
cbPolarity = new TGComboBox(vfInput2); vfInput2->AddFrame(cbPolarity, layoutHints);
|
cbPolarity = new TGComboBox(vfInput2); vfInput2->AddFrame(cbPolarity, layoutHints);
|
||||||
cbPolarity->AddEntry("Positive +", 1);
|
cbPolarity->AddEntry("Positive +", 0);
|
||||||
cbPolarity->AddEntry("Negative -", 0);
|
cbPolarity->AddEntry("Negative -", 1);
|
||||||
cbPolarity->Resize(width, 20);
|
cbPolarity->Resize(width, 20);
|
||||||
cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSettingPHA", this, "SetDPPAlgorithm1()");
|
cbPolarity->Connect("Selected(Int_t, Int_t)", "ChannelSettingPHA", this, "SetDPPAlgorithm1()");
|
||||||
|
|
||||||
|
|
63
test.cpp
63
test.cpp
|
@ -92,31 +92,47 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
//dig->PrintSettingFromMemory();
|
//dig->PrintSettingFromMemory();
|
||||||
|
|
||||||
//dig->WriteRegister(Register::DPP::SoftwareClear_W, 1);
|
dig->WriteRegister(Register::DPP::SoftwareClear_W, 1);
|
||||||
|
|
||||||
///dig->SaveSettingAsText("haha.txt");
|
///dig->SaveSettingAsText("haha.txt");
|
||||||
|
|
||||||
/****
|
std::remove("Test_323_139_000.fsu");
|
||||||
{///============ Checking the buffer size calculation
|
|
||||||
unsigned short B = 1; /// BLT
|
|
||||||
unsigned short Eg = 10; /// Event / dual channel
|
|
||||||
unsigned short E2 = 1; /// extra 2;
|
|
||||||
unsigned short RL = 250; /// record Length
|
|
||||||
|
|
||||||
//for( int i = 0; i < dig->GetNChannel(); i++){
|
{///============ Checking the buffer size calculation
|
||||||
// dig->WriteRegister(Register::DPP::NumberEventsPerAggregate_G, Eg, i);
|
unsigned short B = 10; /// BLT
|
||||||
// dig->WriteRegister(Register::DPP::RecordLength_G, RL, i);
|
unsigned short Eg = 511; /// Event / dual channel
|
||||||
//}
|
bool DT = 1; /// dual trace
|
||||||
//dig->WriteRegister(Register::DPP::MaxAggregatePerBlockTransfer, B, 0);
|
bool E2 = 1; /// extra 2;
|
||||||
//dig->WriteRegister(Register::DPP::BoardConfiguration, 0x0F8115); /// has Extra2
|
bool Wr = 1; /// wave record;
|
||||||
//dig->WriteRegister(Register::DPP::BoardConfiguration, 0x0D8115); /// no Extra2
|
unsigned short AP2 = 0; /// 00 = input, 01 = Threshold, 10 = Trapezoid - Baseline, 11 = baseline
|
||||||
|
unsigned short AP1 = 1; /// 00 = input, 01 = RC-CR, 10 = RC-CR2, 11 = Trapezoid
|
||||||
|
unsigned short DP1 = 0x0000; /// peaking,
|
||||||
|
unsigned short RL = 100; /// record Length
|
||||||
|
unsigned short AO = 0x0;
|
||||||
|
|
||||||
|
for( int i = 0; i < dig->GetNChannel(); i++){
|
||||||
|
dig->WriteRegister(Register::DPP::NumberEventsPerAggregate_G, Eg, i);
|
||||||
|
dig->WriteRegister(Register::DPP::RecordLength_G, RL, i);
|
||||||
|
}
|
||||||
|
dig->WriteRegister(Register::DPP::MaxAggregatePerBlockTransfer, B);
|
||||||
|
dig->WriteRegister(Register::DPP::AggregateOrganization, AO);
|
||||||
|
|
||||||
|
uint32_t bit = 0x0C0115;
|
||||||
|
bit += (DT << 11);
|
||||||
|
bit += (AP1 << 12);
|
||||||
|
bit += (AP2 << 14);
|
||||||
|
bit += (Wr << 16);
|
||||||
|
bit += (E2 << 17);
|
||||||
|
bit += (DP1 << 20);
|
||||||
|
|
||||||
|
printf("---- Bd Config : 0x%08X \n", bit);
|
||||||
|
|
||||||
|
dig->WriteRegister(Register::DPP::BoardConfiguration, bit);
|
||||||
|
|
||||||
unsigned int bSize = dig->CalByteForBuffer();
|
unsigned int bSize = dig->CalByteForBuffer();
|
||||||
|
|
||||||
int bbbb = (((2 + E2 + RL*4) * Eg + 2)*8 + 4)*B *4;
|
int bbbb = (((2 + E2 + Wr*RL*4) * Eg + 2)*8 + 2)*B *4 *2 + 4 * 4;
|
||||||
int bbb2 = (((2 + E2 + RL*4) * Eg + 2)*3 + 4)*B *4;
|
printf("=========== exp Buffer size : %8u byte \n", bbbb);
|
||||||
printf("============== exp Buffer size : %8u byte \n", bbbb);
|
|
||||||
printf("============== exp 3 ch size : %8u byte = %u words\n", bbb2, bbb2/4);
|
|
||||||
|
|
||||||
usleep(1e6);
|
usleep(1e6);
|
||||||
|
|
||||||
|
@ -126,22 +142,25 @@ int main(int argc, char* argv[]){
|
||||||
CAEN_DGTZ_MallocReadoutBuffer(dig->GetHandle(), (char **)& buffer, &size);
|
CAEN_DGTZ_MallocReadoutBuffer(dig->GetHandle(), (char **)& buffer, &size);
|
||||||
|
|
||||||
printf("CAEN calculated Buffer Size : %8u byte = %.2f MB \n", size, size/1024./1024.);
|
printf("CAEN calculated Buffer Size : %8u byte = %.2f MB \n", size, size/1024./1024.);
|
||||||
printf(" diff : %8u byte \n", size > bSize ? size - bSize : bSize - size);
|
printf(" diff : %8u byte \n", size > 2*bSize ? size - 2*bSize : 2*bSize - size);
|
||||||
|
|
||||||
delete buffer;
|
delete buffer;
|
||||||
}*/
|
}/**/
|
||||||
|
|
||||||
|
dig->GetData()->SetSaveWaveToMemory(true);
|
||||||
|
|
||||||
dig->StartACQ();
|
dig->StartACQ();
|
||||||
|
|
||||||
for( int i = 0; i < 5; i++){
|
for( int i = 0; i < 2; i++){
|
||||||
usleep(1000000);
|
usleep(1000000);
|
||||||
dig->ReadData();
|
dig->ReadData();
|
||||||
printf("------------------- %d\n", i);
|
printf("------------------- %d\n", i);
|
||||||
unsigned long time1 = get_time();
|
unsigned long time1 = get_time();
|
||||||
dig->GetData()->DecodeBuffer(true,0);
|
dig->GetData()->DecodeBuffer(false,4);
|
||||||
unsigned long time2 = get_time();
|
unsigned long time2 = get_time();
|
||||||
printf("********************* decode time : %lu usec\n", time2-time1);
|
printf("********************* decode time : %lu usec\n", time2-time1);
|
||||||
dig->GetData()->PrintStat();
|
dig->GetData()->PrintStat();
|
||||||
|
//dig->GetData()->SaveBuffer("Test");
|
||||||
}
|
}
|
||||||
|
|
||||||
dig->StopACQ();
|
dig->StopACQ();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user