diff --git a/include/BindHandler.h b/include/BindHandler.h new file mode 100644 index 0000000..0790230 --- /dev/null +++ b/include/BindHandler.h @@ -0,0 +1,15 @@ +#pragma once + +#ifndef bind_handler_h +#define bind_handler_h + +#include "GaussFit.h" +#include "FileHandler.h" + +class BindHandler { +public: + BindHandler(); + ~BindHandler() {}; +}; + +#endif diff --git a/include/FileHandler.h b/include/FileHandler.h index 1943b03..83a3757 100644 --- a/include/FileHandler.h +++ b/include/FileHandler.h @@ -3,17 +3,16 @@ #ifndef file_handler_h #define file_handler_h -#include "GaussFit.h" -#include +#include "utils.h" using std::string; using std::to_string; class FileHandler { public: - FileHandler(); + FileHandler() {}; FileHandler(string, int n_ = 6, int thMin_ = 800, int thMax_ = 4000); - ~FileHandler(); + ~FileHandler() {}; public: int n = 6, m = 8; @@ -22,14 +21,9 @@ public: std::vector adcValue[6][8][2]; public: - double getADC(TH1F hist); void readData(); - void save(); - void save(string); }; -FileHandler::FileHandler() {} - FileHandler::FileHandler(string file_, int n_, int thMin_, int thMax_) { file = file_; n = n_; @@ -37,32 +31,6 @@ FileHandler::FileHandler(string file_, int n_, int thMin_, int thMax_) { thMax = thMax_; } -FileHandler::~FileHandler() {} - -double FileHandler::getADC(TH1F hist) { - int n, cnt = 0; - double *parma = new double[3]; - GaussFit GF = GaussFit(); - for (int k = 10; k < CHANNEL_NUMBER; k++) { - n = hist.GetBinContent(k); - if (n == 0) continue; - GF.addData(hist.GetBinCenter(k), n); - } - parma = GF.fit(); - if (DEBUG) GF.draw(); - - return parma[1]; -} - void FileHandler::readData() { readROOTData(file.c_str(), adcValue, n, m, thMin, thMax); } -void FileHandler::save() { - string path = rmString(file, ".root") + ".csv"; - save(path); -} - -void FileHandler::save(string path) { - std::ofstream ofs(path); -} - #endif diff --git a/include/GaussFit.h b/include/GaussFit.h index 69ac43a..da13955 100644 --- a/include/GaussFit.h +++ b/include/GaussFit.h @@ -27,8 +27,8 @@ double* GaussianJacobian(double x, double* p) { class GaussFit { public: - GaussFit(); - ~GaussFit(); + GaussFit() {}; + ~GaussFit() {}; public: void addData(double x, double y); @@ -42,10 +42,6 @@ public: std::vector data; }; -GaussFit::GaussFit() {} - -GaussFit::~GaussFit() {} - void GaussFit::addData(double x, double y) { data.push_back(Eigen::Vector2d(x, y)); } double* GaussFit::fit(int type_) { diff --git a/include/GaussNewton.h b/include/GaussNewton.h index 6fccc60..694b71f 100644 Binary files a/include/GaussNewton.h and b/include/GaussNewton.h differ diff --git a/include/LevenbergMarquardt.h b/include/LevenbergMarquardt.h index ead604f..a0374d3 100644 Binary files a/include/LevenbergMarquardt.h and b/include/LevenbergMarquardt.h differ diff --git a/include/clip.h b/include/clip.h index a6e2a17..3b1d982 100644 --- a/include/clip.h +++ b/include/clip.h @@ -18,7 +18,7 @@ public: SigmaClip(double sigma = 3, int maxiters = 5, double (*cenF)(std::vector data) = nullptr, double (*stdF)(std::vector data) = nullptr); - ~SigmaClip(); + ~SigmaClip() {}; std::vector clip(std::vector data); std::vector clipN(std::vector data); @@ -35,8 +35,6 @@ SigmaClip::SigmaClip(double sigma_, int maxiters_, stdF = stdF_ == nullptr ? dataStd2D : stdF_; } -SigmaClip::~SigmaClip() {} - void SigmaClip::computeBound(std::vector data) { double std = (*stdF)(data); double mean = (*cenF)(data); diff --git a/include/csvReader.h b/include/csvReader.h index 9ed74d8..433a5fb 100644 --- a/include/csvReader.h +++ b/include/csvReader.h @@ -15,7 +15,7 @@ using std::vector; class CsvReader { public: CsvReader(string); - ~CsvReader(); + ~CsvReader() {}; public: string file; @@ -29,8 +29,6 @@ public: CsvReader::CsvReader(string file_) { file = file_; } -CsvReader::~CsvReader() {} - int CsvReader::rows() { return strArray.size(); } void CsvReader::readData() { diff --git a/main.cpp b/main.cpp index 8633c7a..fc9240a 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,7 @@ +#include "BindHandler.h" #include "CsvReader.h" #include "FileHandler.h" +#include "utils.h" #include