change: class constructor or destructor
This commit is contained in:
parent
9e63b34088
commit
1e2b51abe3
15
include/BindHandler.h
Normal file
15
include/BindHandler.h
Normal file
@ -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
|
@ -3,17 +3,16 @@
|
|||||||
#ifndef file_handler_h
|
#ifndef file_handler_h
|
||||||
#define file_handler_h
|
#define file_handler_h
|
||||||
|
|
||||||
#include "GaussFit.h"
|
#include "utils.h"
|
||||||
#include <TH1F.h>
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::to_string;
|
using std::to_string;
|
||||||
|
|
||||||
class FileHandler {
|
class FileHandler {
|
||||||
public:
|
public:
|
||||||
FileHandler();
|
FileHandler() {};
|
||||||
FileHandler(string, int n_ = 6, int thMin_ = 800, int thMax_ = 4000);
|
FileHandler(string, int n_ = 6, int thMin_ = 800, int thMax_ = 4000);
|
||||||
~FileHandler();
|
~FileHandler() {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int n = 6, m = 8;
|
int n = 6, m = 8;
|
||||||
@ -22,14 +21,9 @@ public:
|
|||||||
std::vector<int> adcValue[6][8][2];
|
std::vector<int> adcValue[6][8][2];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double getADC(TH1F hist);
|
|
||||||
void readData();
|
void readData();
|
||||||
void save();
|
|
||||||
void save(string);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FileHandler::FileHandler() {}
|
|
||||||
|
|
||||||
FileHandler::FileHandler(string file_, int n_, int thMin_, int thMax_) {
|
FileHandler::FileHandler(string file_, int n_, int thMin_, int thMax_) {
|
||||||
file = file_;
|
file = file_;
|
||||||
n = n_;
|
n = n_;
|
||||||
@ -37,32 +31,6 @@ FileHandler::FileHandler(string file_, int n_, int thMin_, int thMax_) {
|
|||||||
thMax = 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::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
|
#endif
|
||||||
|
@ -27,8 +27,8 @@ double* GaussianJacobian(double x, double* p) {
|
|||||||
|
|
||||||
class GaussFit {
|
class GaussFit {
|
||||||
public:
|
public:
|
||||||
GaussFit();
|
GaussFit() {};
|
||||||
~GaussFit();
|
~GaussFit() {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void addData(double x, double y);
|
void addData(double x, double y);
|
||||||
@ -42,10 +42,6 @@ public:
|
|||||||
std::vector<Eigen::Vector2d> data;
|
std::vector<Eigen::Vector2d> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
GaussFit::GaussFit() {}
|
|
||||||
|
|
||||||
GaussFit::~GaussFit() {}
|
|
||||||
|
|
||||||
void GaussFit::addData(double x, double y) { data.push_back(Eigen::Vector2d(x, y)); }
|
void GaussFit::addData(double x, double y) { data.push_back(Eigen::Vector2d(x, y)); }
|
||||||
|
|
||||||
double* GaussFit::fit(int type_) {
|
double* GaussFit::fit(int type_) {
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -18,7 +18,7 @@ public:
|
|||||||
SigmaClip(double sigma = 3, int maxiters = 5,
|
SigmaClip(double sigma = 3, int maxiters = 5,
|
||||||
double (*cenF)(std::vector<Eigen::Vector2d> data) = nullptr,
|
double (*cenF)(std::vector<Eigen::Vector2d> data) = nullptr,
|
||||||
double (*stdF)(std::vector<Eigen::Vector2d> data) = nullptr);
|
double (*stdF)(std::vector<Eigen::Vector2d> data) = nullptr);
|
||||||
~SigmaClip();
|
~SigmaClip() {};
|
||||||
std::vector<Eigen::Vector2d> clip(std::vector<Eigen::Vector2d> data);
|
std::vector<Eigen::Vector2d> clip(std::vector<Eigen::Vector2d> data);
|
||||||
std::vector<Eigen::Vector2d> clipN(std::vector<Eigen::Vector2d> data);
|
std::vector<Eigen::Vector2d> clipN(std::vector<Eigen::Vector2d> data);
|
||||||
|
|
||||||
@ -35,8 +35,6 @@ SigmaClip::SigmaClip(double sigma_, int maxiters_,
|
|||||||
stdF = stdF_ == nullptr ? dataStd2D : stdF_;
|
stdF = stdF_ == nullptr ? dataStd2D : stdF_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SigmaClip::~SigmaClip() {}
|
|
||||||
|
|
||||||
void SigmaClip::computeBound(std::vector<Eigen::Vector2d> data) {
|
void SigmaClip::computeBound(std::vector<Eigen::Vector2d> data) {
|
||||||
double std = (*stdF)(data);
|
double std = (*stdF)(data);
|
||||||
double mean = (*cenF)(data);
|
double mean = (*cenF)(data);
|
||||||
|
@ -15,7 +15,7 @@ using std::vector;
|
|||||||
class CsvReader {
|
class CsvReader {
|
||||||
public:
|
public:
|
||||||
CsvReader(string);
|
CsvReader(string);
|
||||||
~CsvReader();
|
~CsvReader() {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
string file;
|
string file;
|
||||||
@ -29,8 +29,6 @@ public:
|
|||||||
|
|
||||||
CsvReader::CsvReader(string file_) { file = file_; }
|
CsvReader::CsvReader(string file_) { file = file_; }
|
||||||
|
|
||||||
CsvReader::~CsvReader() {}
|
|
||||||
|
|
||||||
int CsvReader::rows() { return strArray.size(); }
|
int CsvReader::rows() { return strArray.size(); }
|
||||||
|
|
||||||
void CsvReader::readData() {
|
void CsvReader::readData() {
|
||||||
|
Loading…
Reference in New Issue
Block a user