clean up Aux folder

This commit is contained in:
Ryan Tang 2024-03-12 17:11:04 -04:00
parent 2dd4f3fd78
commit 2be2b21923
10 changed files with 17 additions and 98 deletions

View File

@ -1,5 +1,4 @@
#include "fsuReader.h" #include "fsuReader.h"
#include "fsutsReader.h"
#include "TROOT.h" #include "TROOT.h"
#include "TSystem.h" #include "TSystem.h"
@ -9,9 +8,8 @@
#include "TTree.h" #include "TTree.h"
#include "TMacro.h" #include "TMacro.h"
//#include "CustomStruct.h"
#define MAX_MULTI 1000 #define MAX_MULTI 2000
struct FileInfo{ struct FileInfo{

View File

@ -14,7 +14,7 @@ ROOTLIBS = `root-config --cflags --glibs`
OBJS = ClassDigitizer.o MultiBuilder.o ClassInfluxDB.o OBJS = ClassDigitizer.o MultiBuilder.o ClassInfluxDB.o
ALL = test test_indep EventBuilder EventBuilderNoTrace DataReader DumpFSU2ROOT SettingsExplorer ALL = test EventBuilder DataReader DumpFSU2ROOT SettingsExplorer
######################################################################### #########################################################################
@ -36,9 +36,9 @@ test : test.cpp ../ClassDigitizer.o ../MultiBuilder.o ../ClassInfluxDB.o
@echo "--------- making test" @echo "--------- making test"
$(CC) $(COPTS) -o test test.cpp ../ClassDigitizer.o ../MultiBuilder.o ../ClassInfluxDB.o $(CAENLIBS) $(ROOTLIBS) -lcurl $(CC) $(COPTS) -o test test.cpp ../ClassDigitizer.o ../MultiBuilder.o ../ClassInfluxDB.o $(CAENLIBS) $(ROOTLIBS) -lcurl
test_indep : test_indep.cpp ../RegisterAddress.h ../macro.h # 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)
DataReader : DataReaderScript.cpp ../ClassData.h MultiBuilder.o DataReader : DataReaderScript.cpp ../ClassData.h MultiBuilder.o
@echo "--------- making DataReader" @echo "--------- making DataReader"
@ -48,13 +48,13 @@ DataReader : DataReaderScript.cpp ../ClassData.h MultiBuilder.o
# @echo "--------- making EventBuilder" # @echo "--------- making EventBuilder"
# $(CC) $(COPTS) -o EventBuilder_old EventBuilder_old.cpp MultiBuilder.o $(ROOTLIBS) # $(CC) $(COPTS) -o EventBuilder_old EventBuilder_old.cpp MultiBuilder.o $(ROOTLIBS)
EventBuilder : EventBuilder.cpp ../ClassData.h fsuReader.h fsutsReader.h ../Hit.h CustomStruct.h EventBuilder : EventBuilder.cpp ../ClassData.h fsuReader.h ../Hit.h
@echo "--------- making EventBuilder" @echo "--------- making EventBuilder"
$(CC) $(COPTS) -o EventBuilder EventBuilder.cpp $(ROOTLIBS) $(CC) $(COPTS) -o EventBuilder EventBuilder.cpp $(ROOTLIBS)
EventBuilderNoTrace : EventBuilderNoTrace.cpp ../ClassData.h fsuReader.h ../Hit.h CustomStruct.h # EventBuilderNoTrace : EventBuilderNoTrace.cpp ../ClassData.h fsuReader.h ../Hit.h
@echo "--------- making EventBuilderNoTrace" # @echo "--------- making EventBuilderNoTrace"
$(CC) $(COPTS) -o EventBuilderNoTrace EventBuilderNoTrace.cpp $(ROOTLIBS) # $(CC) $(COPTS) -o EventBuilderNoTrace EventBuilderNoTrace.cpp $(ROOTLIBS)
DumpFSU2ROOT : DumpFSU2ROOT.cpp ../ClassData.h MultiBuilder.o DumpFSU2ROOT : DumpFSU2ROOT.cpp ../ClassData.h MultiBuilder.o
@echo "--------- making DumpFSU2ROOT" @echo "--------- making DumpFSU2ROOT"

View File

@ -3,7 +3,7 @@
#include <algorithm> #include <algorithm>
#include <filesystem> #include <filesystem>
#include "AggSeparator.h" // #include "AggSeparator.h"
class FSUReader{ class FSUReader{
@ -65,12 +65,10 @@ class FSUReader{
std::vector<Hit> ReadBatch(unsigned int batchSize = 1000000, bool verbose = false); // output the sorted Hit std::vector<Hit> ReadBatch(unsigned int batchSize = 1000000, bool verbose = false); // output the sorted Hit
void SortAndSaveTS(unsigned int batchSize = 1000000, bool verbose = false); // std::string SaveHit(std::vector<Hit> hitList, bool isAppend = false);
std::string SaveHit(std::vector<Hit> hitList, bool isAppend = false);
// std::string SaveHit2NewFile(std::string saveFolder = "./", std::string indexStr = ""); // std::string SaveHit2NewFile(std::string saveFolder = "./", std::string indexStr = "");
off_t GetTSFileSize() const {return tsFileSize;} // void SortAndSaveTS(unsigned int batchSize = 1000000, bool verbose = false);
// off_t GetTSFileSize() const {return tsFileSize;}
//TODO //TODO
//void SplitFile(unsigned long hitSizePreFile); //void SplitFile(unsigned long hitSizePreFile);
@ -577,6 +575,7 @@ inline std::vector<Hit> FSUReader::ReadBatch(unsigned int batchSize, bool verbos
} }
/*
inline void FSUReader::SortAndSaveTS(unsigned int batchSize, bool verbose){ inline void FSUReader::SortAndSaveTS(unsigned int batchSize, bool verbose){
int count = 0; int count = 0;
@ -706,8 +705,9 @@ inline void FSUReader::SortAndSaveTS(unsigned int batchSize, bool verbose){
printf("================= finished.\n"); printf("================= finished.\n");
} }
*/
/*
inline std::string FSUReader::SaveHit(std::vector<Hit> hitList, bool isAppend){ inline std::string FSUReader::SaveHit(std::vector<Hit> hitList, bool isAppend){
std::string outFileName; std::string outFileName;
@ -785,85 +785,6 @@ inline std::string FSUReader::SaveHit(std::vector<Hit> hitList, bool isAppend){
return outFileName; return outFileName;
} }
*/
// inline std::string FSUReader::SaveHit2NewFile(std::string saveFolder, std::string indexStr){
// std::string folder = "";
// size_t found = fileName.find_last_of('/');
// std::string outFileName = fileName;
// if( found != std::string::npos ){
// folder = fileName.substr(0, found + 1);
// outFileName = fileName.substr(found +1 );
// }
// if( saveFolder.empty() ) saveFolder = "./";
// if( saveFolder.back() != '/') saveFolder += '/';
// //checkif the saveFolder exist;
// if( saveFolder != "./"){
// if (!std::filesystem::exists(saveFolder)) {
// if (std::filesystem::create_directory(saveFolder)) {
// std::cout << "Directory created successfully." << std::endl;
// } else {
// std::cerr << "Failed to create directory." << std::endl;
// }
// }
// }
// outFileName = saveFolder + outFileName + ".ts" + indexStr;
// SaveHit( this->hit, saveFolder + outFileName, indexStr);
// FILE * outFile = fopen(outFileName.c_str(), "wb"); //overwrite binary
// uint32_t header = 0xAA000000;
// header += sn;
// fwrite( &header, 4, 1, outFile );
// uint64_t hitSize = hit.size();
// fwrite( &hitSize, 8, 1, outFile);
// for( ulong i = 0; i < hitSize; i++){
// if( i% 10000 == 0 ) printf("Saving %lu/%lu Hit (%.2f%%)\n\033[A\r", i, hitSize, i*100./hitSize);
// uint16_t flag = hit[i].ch + (hit[i].pileUp << 8) ;
// if( DPPType == DPPTypeCode::DPP_PSD_CODE ) flag += ( 1 << 15);
// if( hit[i].traceLength > 0 ) flag += (1 << 14);
// // fwrite( &(hit[i].ch), 1, 1, outFile);
// fwrite( &flag, 2, 1, outFile);
// fwrite( &(hit[i].energy), 2, 1, outFile);
// if( DPPType == DPPTypeCode::DPP_PSD_CODE ) fwrite( &(hit[i].energy2), 2, 1, outFile);
// fwrite( &(hit[i].timestamp), 6, 1, outFile);
// fwrite( &(hit[i].fineTime), 2, 1, outFile);
// if( hit[i].traceLength > 0 ) fwrite( &(hit[i].traceLength), 2, 1, outFile);
// for( uShort j = 0; j < hit[i].traceLength; j++){
// fwrite( &(hit[i].trace[j]), 2, 1, outFile);
// }
// }
// tsFileSize = ftello(outFile); // unsigned int = Max ~4GB
// fclose(outFile);
// printf("Saved to %s, size: ", outFileName.c_str());
// if( tsFileSize < 1024 ) {
// printf(" %ld Byte", tsFileSize);
// }else if( tsFileSize < 1024*1024 ) {
// printf(" %.2f kB", tsFileSize/1024.);
// }else if( tsFileSize < 1024*1024*1024){
// printf(" %.2f MB", tsFileSize/1024./1024.);
// }else{
// printf(" %.2f GB", tsFileSize/1024./1024./1024.);
// }
// printf("\n");
// return outFileName;
// }