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

@ -30,17 +30,16 @@ class evtReader{
private: private:
FILE * inFile; FILE * inFile;
long int inFileSize; long int inFileSize;
long int inFilePos; long int inFilePos;
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();
long int GetFilePos() {return inFilePos;} bool IsOpen() {return isOpened;}
long int GetFileSize() {return inFileSize;} long int GetFilePos() {return inFilePos;}
long int GetFileSize() {return inFileSize;}
Long64_t GetBlockID() {return blockID;}
Long64_t GetNumberOfBlock() {return nBlock;}
Long64_t GetBlockID() { return blockID;}
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);
}; };
@ -73,17 +72,16 @@ class evtReader{
//========================== implementation //========================== implementation
evtReader::evtReader(){ evtReader::evtReader(){
inFile = 0; inFile = 0;
data = new DataBlock(); data = new DataBlock();
inFileSize = 0; inFileSize = 0;
inFilePos = 0; inFilePos = 0;
blockID = -1;
endOfFile = false;
isOpened = false;
nBlock = 0; nBlock = 0;
blockID = -1;
endOfFile = false;
isOpened = false;
} }
@ -95,17 +93,17 @@ evtReader::~evtReader(){
evtReader::evtReader(TString inFileName){ evtReader::evtReader(TString inFileName){
inFile = 0; inFile = 0;
data = new DataBlock(); data = new DataBlock();
inFileSize = 0; inFileSize = 0;
inFilePos = 0; inFilePos = 0;
blockID = -1; nBlock = 0;
endOfFile = false; blockID = -1;
isOpened = false; endOfFile = 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);