clean up evtReader.h

This commit is contained in:
Ryan Tang 2022-02-14 16:14:26 -05:00
parent 4e569c1f9e
commit 15a825e68a

View File

@ -35,12 +35,11 @@ class evtReader{
bool endOfFile; bool endOfFile;
bool isOpened; bool isOpened;
Long64_t blockID; Long64_t blockID;
long int nBlock;
unsigned int extraHeader[14]; unsigned int extraHeader[14];
unsigned int traceBlock[4000]; unsigned int traceBlock[4000];
long int nBlock;
TBenchmark gClock; TBenchmark gClock;
///============================================ Methods ///============================================ Methods
@ -53,18 +52,18 @@ class evtReader{
void OpenFile(TString inFileName); void OpenFile(TString inFileName);
void UpdateFileSize(); void UpdateFileSize();
bool IsOpen() { return isOpened;}
bool IsEndOfFile(); bool IsEndOfFile();
bool IsOpen() {return isOpened;}
long int GetFilePos() {return inFilePos;} long int GetFilePos() {return inFilePos;}
long int GetFileSize() {return inFileSize;} long int GetFileSize() {return inFileSize;}
Long64_t GetBlockID() {return blockID;} Long64_t GetBlockID() {return blockID;}
Long64_t GetNumberOfBlock() {return nBlock;}
int ReadBlock(int opt = 0); /// 0 = default, fill data int ReadBlock(int opt = 0); /// 0 = default, fill data
/// 1 = no fill data /// 1 = no fill data
void ScanNumberOfBlock(); void ScanNumberOfBlock();
Long64_t GetNumberOfBlock() {return nBlock;}
void PrintStatus(int mod); void PrintStatus(int mod);
}; };
@ -79,11 +78,10 @@ evtReader::evtReader(){
inFileSize = 0; inFileSize = 0;
inFilePos = 0; inFilePos = 0;
nBlock = 0;
blockID = -1; blockID = -1;
endOfFile = false; endOfFile = false;
isOpened = false; isOpened = false;
nBlock = 0;
} }
@ -101,11 +99,11 @@ evtReader::evtReader(TString inFileName){
inFileSize = 0; inFileSize = 0;
inFilePos = 0; inFilePos = 0;
nBlock = 0;
blockID = -1; blockID = -1;
endOfFile = false; endOfFile = false;
isOpened = false; isOpened = false;
nBlock = 0;
OpenFile(inFileName); OpenFile(inFileName);
} }
@ -116,22 +114,15 @@ void evtReader::OpenFile(TString inFileName){
}else{ }else{
fseek(inFile, 0L, SEEK_END); fseek(inFile, 0L, SEEK_END);
inFileSize = ftell(inFile); inFileSize = ftell(inFile);
inFilePos = 0;
rewind(inFile); ///back to the File begining rewind(inFile); ///back to the File begining
data->Clear(); data->Clear();
blockID = -1;
endOfFile = false;
isOpened = true;
gClock.Reset(); gClock.Reset();
gClock.Start("timer"); gClock.Start("timer");
} }
}; };
void evtReader::UpdateFileSize(){ void evtReader::UpdateFileSize(){
if( inFile == NULL ) return; if( inFile == NULL ) return;
fseek(inFile, 0L, SEEK_END); fseek(inFile, 0L, SEEK_END);