Q3D-Calibration/include/getADC.h

21 lines
402 B
C++

#include "GaussFit.h"
#include <TH1F.h>
#include <iostream>
#define CHANNEL_NUMBER 4096
double getADC(TH1F *hist) {
int n, cnt = 0;
double *parma = new double[3];
GaussFit *GF = new GaussFit();
for (int k = 0; k < CHANNEL_NUMBER; k++) {
n = hist->GetBinContent(k);
if (n == 0) continue;
GF->addData(k, n);
}
parma = GF->fit();
return parma[1];
}