small modifications
This commit is contained in:
parent
0b8b4cb388
commit
495d65a112
|
@ -14,6 +14,8 @@ class FSUReader{
|
|||
|
||||
Data * GetData() const{return data;}
|
||||
|
||||
int GetDPPType() const{return DPPType;}
|
||||
|
||||
private:
|
||||
|
||||
FILE * inFile;
|
||||
|
@ -109,6 +111,7 @@ inline int FSUReader::ReadNextBlock(bool fast, int verbose){
|
|||
}
|
||||
|
||||
data->DecodeBuffer(buffer, aggSize, fast, verbose); // data will own the buffer
|
||||
data->ClearTriggerRate();
|
||||
data->ClearBuffer(); // this will clear the buffer.
|
||||
|
||||
}else if( (header & 0xF ) == 0x8 ) { /// dual channel header
|
||||
|
@ -120,6 +123,7 @@ inline int FSUReader::ReadNextBlock(bool fast, int verbose){
|
|||
|
||||
data->buffer = buffer;
|
||||
data->DecodeDualBlock(buffer, dualSize, DPPType, chMask, false, verbose);
|
||||
data->ClearTriggerRate();
|
||||
data->ClearBuffer();
|
||||
|
||||
|
||||
|
|
90
Aux/script.C
Normal file
90
Aux/script.C
Normal file
|
@ -0,0 +1,90 @@
|
|||
#include "fsuReader.h"
|
||||
#include "../MultiBuilder.cpp"
|
||||
|
||||
void script(){
|
||||
|
||||
FSUReader * reader = new FSUReader("/data1/20230816_Encore/data_raw/temp_006_334_PHA_000.fsu", 16);
|
||||
Data * data = reader->GetData();
|
||||
data->tick2ns = 4;
|
||||
|
||||
reader->ScanNumBlock();
|
||||
|
||||
// for( int i = 0; i < 500 ; i++ ) reader->ReadNextBlock(0, 0);
|
||||
|
||||
// int ch = 5;
|
||||
// std::vector<unsigned long long > tList;
|
||||
// int nEvent = 0;
|
||||
// for( int i = 0; i < data->TotNumNonPileUpEvents[ch]; i++){
|
||||
// tList.push_back(data->Timestamp[ch][i]);
|
||||
// printf("%3d | %d %llu \n", i, data->Energy[ch][i], data->Timestamp[ch][i]);
|
||||
// nEvent ++;
|
||||
// }
|
||||
|
||||
// std::sort(tList.begin(), tList.end());
|
||||
|
||||
// unsigned long long dTime = tList.back() - tList.front();
|
||||
// double sec = dTime * data->tick2ns / 1e9;
|
||||
|
||||
// printf("=========== %llu, %llu = %llu | %f sec | %f Hz\n", tList.back(), tList.front(), dTime, sec, nEvent/sec );
|
||||
|
||||
//data->PrintStat(0);
|
||||
|
||||
|
||||
data->ClearData();
|
||||
data->ClearTriggerRate();
|
||||
|
||||
|
||||
MultiBuilder * mb = new MultiBuilder(data, reader->GetDPPType(), 334);
|
||||
mb->SetTimeWindow(10000);
|
||||
|
||||
unsigned long totNumBlock = reader->GetTotNumBlock();
|
||||
|
||||
int lastDataIndex = 0;
|
||||
int lastLoopIndex = 0;
|
||||
|
||||
for( unsigned long i = 0; i < 2; i++){
|
||||
|
||||
reader->ReadNextBlock();
|
||||
|
||||
// int maxDataIndex = 0;
|
||||
// int maxLoopIndex = 0;
|
||||
|
||||
// for( int ch = 0; ch < 16 ; ch++){
|
||||
// if( data->DataIndex[ch] > maxDataIndex ) maxDataIndex = data->DataIndex[ch];
|
||||
// if( data->LoopIndex[ch] > maxLoopIndex ) maxLoopIndex = data->LoopIndex[ch];
|
||||
// }
|
||||
|
||||
// if( (maxLoopIndex * MaxNData + maxDataIndex) - (lastLoopIndex * MaxNData + lastDataIndex) > MaxNData * 0.05){
|
||||
|
||||
// printf("Agg ID : %lu \n", i );
|
||||
|
||||
// data->PrintStat();
|
||||
// data->PrintAllData();
|
||||
|
||||
// mb->BuildEvents();
|
||||
// mb->PrintAllEvent();
|
||||
// mb->PrintStat();
|
||||
|
||||
// lastDataIndex = maxDataIndex;
|
||||
// lastLoopIndex = maxLoopIndex;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
data->PrintStat();
|
||||
data->PrintAllData();
|
||||
|
||||
|
||||
//mb->BuildEvents(true);
|
||||
|
||||
mb->BuildEventsBackWard(300);
|
||||
|
||||
mb->PrintAllEvent();
|
||||
mb->PrintStat();
|
||||
|
||||
|
||||
delete mb;
|
||||
delete reader;
|
||||
|
||||
}
|
|
@ -303,7 +303,8 @@ inline void Data::PrintStat(bool skipEmpty) {
|
|||
printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "Accept", "Tot. Evt.", "index", "loop");
|
||||
printf("---+--------+-----------+-----------+----------\n");
|
||||
for(int ch = 0; ch < numInputCh; ch++){
|
||||
if( skipEmpty && TriggerRate[ch] == 0 ) continue;
|
||||
//if( skipEmpty && TriggerRate[ch] == 0 ) continue;
|
||||
if( skipEmpty && DataIndex[ch] < 0 ) continue;
|
||||
printf("%2d | %6d | %9.2f | %9.2f | %6lu | %6d(%2d)\n", ch, NumEventsDecoded[ch], TriggerRate[ch], NonPileUpRate[ch], TotNumNonPileUpEvents[ch], DataIndex[ch], LoopIndex[ch]);
|
||||
}
|
||||
printf("---+--------+-----------+-----------+----------\n");
|
||||
|
@ -783,8 +784,8 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
|
|||
|
||||
//if( DataIndex[channel] > MaxNData ) ClearData(); // if any channel has more data then MaxNData, clear all stored data
|
||||
|
||||
if( verbose >= 1 ) printf("evt %4d | ch : %2d, PileUp : %d , energy : %5d, rollOver: %d, timestamp : %10llu, triggerAt : %d, nSample : %d, %f sec\n",
|
||||
DataIndex[channel], channel, pileUp, energy, rollOver, timeStamp, triggerAtSample, nSample , timeStamp * 4. / 1e9);
|
||||
if( verbose >= 1 ) printf("evt %4d(%2d) | ch : %2d, PileUp : %d , energy : %5d, rollOver: %d, timestamp : %10llu, triggerAt : %d, nSample : %d, %f sec\n",
|
||||
DataIndex[channel], LoopIndex[channel], channel, pileUp, energy, rollOver, timeStamp, triggerAtSample, nSample , timeStamp * 4. / 1e9);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user