add MAX_TRACE_LENGTH 16000 in DataBlock

This commit is contained in:
Ryan Tang 2022-03-04 16:47:26 -05:00
parent b92673ee7a
commit f198afabf5
3 changed files with 13 additions and 11 deletions

View File

@ -14,6 +14,8 @@
#include "TTree.h" #include "TTree.h"
#include "TString.h" #include "TString.h"
#define MAX_TRACE_LENGHT 16000
class DataBlock{ class DataBlock{
public: public:
@ -37,7 +39,7 @@ public:
ULong64_t eventID; ULong64_t eventID;
UShort_t trace[1024]; UShort_t trace[MAX_TRACE_LENGHT];
DataBlock(){ DataBlock(){
Clear(); Clear();
@ -71,7 +73,7 @@ public:
} }
void ClearTrace(){ void ClearTrace(){
for( int i = 0; i < 1024; i++) trace[i] = 0; for( int i = 0 ; i < MAX_TRACE_LENGHT; i++) trace[i] = 0;
} }

View File

@ -81,20 +81,18 @@ int main(int argn, char **argv) {
TBenchmark clock2; TBenchmark clock2;
clock2.Reset(); clock2.Reset();
clock2.Start("timer"); clock2.Start("timer");
evt->ScanNumberOfBlock();
//=============== Read File //=============== Read File
while( evt->IsEndOfFile() == false ){ while( evt->IsEndOfFile() == false ){
evt->ReadBlock(); evt->ReadBlock();
evt->PrintStatus(10000); //evt->PrintStatus(10000);
int id = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch; int id = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
detID = mapping[id]; detID = mapping[id];
printf("--------- a\n");
outFile->
//cern fill tree //cern fill tree
outFile->cd(); outFile->cd();
tree->Fill(); tree->Fill();

View File

@ -37,7 +37,7 @@ class evtReader{
long int nBlock; long int nBlock;
unsigned int extraHeader[14]; unsigned int extraHeader[14];
unsigned int traceBlock[4000]; unsigned int traceBlock[MAX_TRACE_LENGHT/2];
TBenchmark gClock; TBenchmark gClock;
@ -167,6 +167,7 @@ int evtReader::ReadBlock(int opt){
data->trace_out_of_range = header[3] >> 31; data->trace_out_of_range = header[3] >> 31;
data->ClearQDC(); data->ClearQDC();
data->ClearTrace();
///======== read QDCsum ///======== read QDCsum
if( data->headerLength >= 4 ){ if( data->headerLength >= 4 ){
@ -192,15 +193,16 @@ int evtReader::ReadBlock(int opt){
data->baseline = 0; data->baseline = 0;
} }
///====== read trace ///====== read trace
if( data->eventLength > data->headerLength ){ if( data->eventLength > data->headerLength ){
fread(traceBlock, sizeof(unsigned int) * ( data->trace_length / 2 ), 1, inFile); fread(traceBlock, sizeof(unsigned int) * ( data->trace_length / 2 ), 1, inFile);
for( int i = 0; i < data->trace_length/2 ; i++){ for( int i = 0; i < data->trace_length/2 ; i++){
data->trace[2*i+0] = traceBlock[i] & 0xFFFF ; data->trace[2*i+0] = traceBlock[i] & 0xFFFF ;
data->trace[2*i+1] = (traceBlock[i] >> 16 ) & 0xFFFF ; data->trace[2*i+1] = (traceBlock[i] >> 16 ) & 0xFFFF ;
} }
///make QDC by trace ///make QDC by trace
/**
if( data->headerLength == 4 || data->headerLength == 8 ) { if( data->headerLength == 4 || data->headerLength == 8 ) {
for( int i = 0; i < 8; i++){ data->QDCsum[i] = 0;} for( int i = 0; i < 8; i++){ data->QDCsum[i] = 0;}
for( int i = 0; i < data->trace_length; i++){ for( int i = 0; i < data->trace_length; i++){
@ -213,7 +215,7 @@ int evtReader::ReadBlock(int opt){
if( 160 <= i && i < 175 ) data->QDCsum[6] += data->trace[i]; if( 160 <= i && i < 175 ) data->QDCsum[6] += data->trace[i];
if( 175 <= i && i < 200 ) data->QDCsum[7] += data->trace[i]; if( 175 <= i && i < 200 ) data->QDCsum[7] += data->trace[i];
} }
} }*/
} }
} }