From d6121ddd73296854a6c1b452bc07d5d6c199fb8d Mon Sep 17 00:00:00 2001
From: Wudr-1995 <wudr@ihep.ac.cn>
Date: Tue, 24 Oct 2023 16:21:05 +0800
Subject: [PATCH] update

---
 Analysis/HitRateAnaTool/src/HitRateAnaTool.cc |   9 +-
 .../src/HitRateDisAnaTool.cc                  |  17 ++-
 .../HitRateDisAnaTool/src/HitRateDisAnaTool.h |   1 +
 Analysis/HitSpecAnaTool/src/HitSpecAnaTool.cc | 130 ++++++++++++++----
 Analysis/HitSpecAnaTool/src/HitSpecAnaTool.h  |  22 ++-
 Analysis/NoiseAnaTool/src/NoiseAnaTool.cc     |  61 ++++++--
 Analysis/NoiseAnaTool/src/NoiseAnaTool.h      |   8 +-
 Convert/Binary2ROOTAlg/src/Binary2ROOTAlg.cc  |   5 +
 README.md                                     |   3 +-
 share/getHitRateDis.py                        |   2 +-
 share/getNoise.py                             |   4 +
 share/run.py                                  |   2 +-
 12 files changed, 205 insertions(+), 59 deletions(-)

diff --git a/Analysis/HitRateAnaTool/src/HitRateAnaTool.cc b/Analysis/HitRateAnaTool/src/HitRateAnaTool.cc
index 190c948..a19ac25 100644
--- a/Analysis/HitRateAnaTool/src/HitRateAnaTool.cc
+++ b/Analysis/HitRateAnaTool/src/HitRateAnaTool.cc
@@ -58,8 +58,8 @@ bool HitRateAnaTool::configure(string outDir, SPMTMap *spmtMap) {
 
 bool HitRateAnaTool::reset() {
 
-	m_hitsPerCh->Reset("ICE");
-	m_timePerCh->Reset("ICE");
+	m_hitsPerCh->Reset("");
+	m_timePerCh->Reset("");
 	for (int i = 0; i < NCH; i ++) {
 		m_hitsPerCycle[i].clear();
 		m_timePerCyc[i].clear();
@@ -111,14 +111,15 @@ bool HitRateAnaTool::analyze(const Params& paras) {
 				m_hitsPerCycle[m_abcCh].push_back(0);
 		}
 		m_hitsPerCycle[m_abcCh].push_back(m_hits[m_abcCh]);
-		if (m_hitsPerCycle[m_abcCh].size() > m_nCycle)
-			m_nCycle = m_hitsPerCycle[m_abcCh].size();
+		// if (m_hitsPerCycle[m_abcCh].size() > m_nCycle)
+		// 	m_nCycle = m_hitsPerCycle[m_abcCh].size();
 		m_hits[m_abcCh] = 1;
 		m_timePerCyc[m_abcCh].push_back(25 * static_cast<double>(m_edTime[m_abcCh] - m_stTime[m_abcCh]));
 		m_stTime[m_abcCh] = m_coarseTime;
 		m_edTime[m_abcCh] = m_coarseTime;
 	}
 
+	m_nCycle = paras.get("OverflowCounter");
 	m_cycle[m_abcCh] = paras.get("OverflowCounter");
 	m_timePerCh->SetBinContent(m_abcCh + 1, m_cycle[m_abcCh] * TCYCLE + m_coarseTime * 25);
 	m_lastCoarseTimes[m_abcCh] = m_coarseTime;
diff --git a/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.cc b/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.cc
index abdacd1..d85d73f 100644
--- a/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.cc
+++ b/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.cc
@@ -89,7 +89,9 @@ bool HitRateDisAnaTool::analyze(const Params& paras) {
 	}
 
 	if (m_cycle[m_abcCh] == -1 || m_cycle[m_abcCh] == paras.get("OverflowCounter")) {
-		m_hits[m_abcCh] ++;
+		if (!(m_hrFlag && !(m_coarseTime < CYCLE && m_coarseTime > LOWRANGE))) {
+			m_hits[m_abcCh] ++;
+		}
 		if (m_coarseTime > m_edTime[m_abcCh])
 			m_edTime[m_abcCh] = m_coarseTime;
 		if (m_coarseTime < m_stTime[m_abcCh])
@@ -140,6 +142,7 @@ bool HitRateDisAnaTool::output() {
 	if (m_hrFlag)
 		times = TCYCLE / 12.5E-3;
 
+	ofstream tmpFile(m_outTxt, std::ios::app);
 	for (int i = 0; i < NCH; i ++) {
 		int size = m_hitsPerCycle[i].size();
 		int nPoint = size / 10;
@@ -149,14 +152,22 @@ bool HitRateDisAnaTool::output() {
 			nPoint = 1;
 		double nHits = 0;
 		double time = 0;
-		for (int j = 0; j < size; j += 10) {
+		for (int j = 0; j < size; j ++) {
 			nHits += m_hitsPerCycle[i].at(j);
 			time += static_cast<double>(TCYCLE);
 		}
+		double rate = nHits / time * times;
 		TVector3 pos = m_spmtMap->getPosition(m_gcuId, i);
-		m_rateDis->SetPoint(m_nPoint, pos.X() / 1000., pos.Y() / 1000., nHits / time);
+		tmpFile << rate << "\t"
+				<< pos.X() << "\t"
+				<< pos.Y() << "\t"
+				<< pos.Z() << endl;
+		if (rate > 1000)
+			continue;
+		m_rateDis->SetPoint(m_nPoint, pos.X() / 1000., pos.Y() / 1000., rate);
 		m_nPoint ++;
 	}
+	tmpFile.close();
 
 	m_canvas->Clear();
 
diff --git a/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.h b/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.h
index f8e9878..2982240 100644
--- a/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.h
+++ b/Analysis/HitRateDisAnaTool/src/HitRateDisAnaTool.h
@@ -24,6 +24,7 @@
 
 #define CYCLE 67108864
 #define TCYCLE 1.6777216
+#define LOWRANGE 66584576
 
 using namespace std;
 
diff --git a/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.cc b/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.cc
index 09f9f68..a5144ba 100644
--- a/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.cc
+++ b/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.cc
@@ -12,6 +12,7 @@ bool HitSpecAnaTool::configure(string outDir, SPMTMap *spmtMap) {
 	m_outDir = outDir;
 	m_spmtMap = spmtMap;
 
+	m_maxt = 0;
 	m_pulsePerCh.reserve(NCH);
 	m_pulsePerChZoomed.reserve(NCH);
 	m_lastCTPerCh.reserve(NCH);
@@ -22,18 +23,38 @@ bool HitSpecAnaTool::configure(string outDir, SPMTMap *spmtMap) {
 
 	for (int i = 0; i < NCH; i ++) {
 		TString tmp("Unzoomed CH");
-		m_pulsePerCh.push_back(make_unique<TH1F>(tmp + i, ";Hit time / #mus;Charge / ADCu", 6E5, 0, 6E7));
+		m_pulsePerCh.push_back(make_unique<TGraph>());
+		// m_pulsePerCh.push_back(make_unique<TH1F>(tmp + i, ";Hit time / #mus;Charge / ADCu", 6E5, 0, 6E7));
 		tmp = "Zoomed CH";
-		m_pulsePerChZoomed.push_back(make_unique<TH1F>(tmp + i, ";Hit time / #mus;Charge / ADCu", 1E6, 0, 0.5E6));
+		m_pulsePerChZoomed.push_back(make_unique<TGraph>());
+		// m_pulsePerChZoomed.push_back(make_unique<TH1F>(tmp + i, ";Hit time / #mus;Charge / ADCu", 1E6, 0, 0.5E6));
 
-		m_pulsePerCh[i]->SetDirectory(0);
-		m_pulsePerChZoomed[i]->SetDirectory(0);
+		// m_pulsePerCh[i]->SetDirectory(0);
+		// m_pulsePerChZoomed[i]->SetDirectory(0);
+
+		m_pulsePerCh[i]->SetTitle("Waveform;time / #mus;Charge / ADCu");
+		m_pulsePerCh[i]->SetMarkerStyle(22);
+
+		m_pulsePerChZoomed[i]->SetTitle("WaveformZoomed;time / #mus;Charge / ADCu");
+		m_pulsePerChZoomed[i]->SetMarkerStyle(22);
 	}
 
-	m_hitPulse.reset(new TH1F("PulseDis", ";Hit time / #mus;Charge / ADCu", 6E5, 0, 6E7));
-	m_hitPulseZoomed.reset(new TH1F("PulseDisZoomed", ";Hit Time / #mus;Charge / ADCu", 1E6, 0, 0.5E6));
-	m_hitPulse->SetDirectory(0);
-	m_hitPulseZoomed->SetDirectory(0);
+	m_hitPulse.reset(new TGraph());
+	m_hitPulseZoomed.reset(new TGraph());
+
+	m_hitPulseHist.reset(new TH1F("PulseDis", ";Hit time / #mus;Charge / ADCu", 6E5, 0, 6E7));
+	// m_hitPulseZoomedHist.reset(new TH1F("PulseDisZoomed", ";Hit Time / #mus;Charge / ADCu", 1024, 0, 25600));
+	m_hitPulseZoomedHist.reset(new TH1F("PulseDisZoomed", ";Hit Time / (0.1 ms);Charge / ADCu", 4096, 0, 102400));
+
+	m_hitPulseHist->SetDirectory(0);
+	m_hitPulseZoomedHist->SetDirectory(0);
+
+	m_hitPulse->SetTitle("Waveform;time / #mus;Charge / ADCu");
+	m_hitPulse->SetMarkerStyle(22);
+	m_hitPulseZoomed->SetTitle("WaveformZoomed;time / #mus;Charge / ADCu");
+	m_hitPulseZoomed->SetMarkerStyle(22);
+
+	m_fftRes = NULL;
 
 	m_lastCoarseTime = -1;
 	m_cyc = 0;
@@ -44,17 +65,28 @@ bool HitSpecAnaTool::configure(string outDir, SPMTMap *spmtMap) {
 }
 
 bool HitSpecAnaTool::reset() {
-	m_hitPulse->Reset();
-	m_hitPulseZoomed->Reset();
+	m_hitPulse->Set(0);
+	m_hitPulseZoomed->Set(0);
+
+	m_hitPulseHist->Reset();
+	m_hitPulseZoomedHist->Reset();
+
+	delete m_fftRes;
+	m_fftRes = NULL;
+
 	m_cyc = 0;
 	m_lastCoarseTime = -1;
+	m_maxt = 0;
 
 	std::fill(m_lastCTPerCh.begin(), m_lastCTPerCh.end(), -1);
 	std::fill(m_cycPerCh.begin(), m_cycPerCh.end(), 0);
 
 	for (int i = 0; i < NCH; i ++) {
-		m_pulsePerCh[i]->Reset();
-		m_pulsePerChZoomed[i]->Reset();
+		m_pulsePerCh[i]->Set(0);
+		m_pulsePerChZoomed[i]->Set(0);
+
+		// m_pulsePerCh[i]->Reset();
+		// m_pulsePerChZoomed[i]->Reset();
 	}
 
 	return true;
@@ -67,17 +99,36 @@ bool HitSpecAnaTool::analyze(const Params& paras) {
 	m_coarseTime = paras.get("CoarseTime");
 	m_gcuId = paras.get("GCUId");
 	m_runNum = paras.get("RunNum");
+	m_overFlowCounter = paras.get("OverflowCounter");
+	m_gain = paras.get("Gain");
+
+	m_charge *= m_gain ? 1 : 10;
+
+	if (!m_gain || m_charge < 90 || m_abcCh != 43)
+		return true;
+
+	int64_t t = static_cast<int64_t>(m_overFlowCounter) * TCYCLE + static_cast<int64_t>(m_coarseTime) * 25;
+	if (t > m_maxt)
+		m_maxt = t;
 
 	if (m_coarseTime < m_lastCTPerCh[m_abcCh])
 		m_cycPerCh[m_abcCh] ++;
-	int64_t t = static_cast<int64_t>(m_cycPerCh[m_abcCh]) * TCYCLE + static_cast<int64_t>(m_coarseTime) * 25;
-	m_pulsePerCh[m_abcCh]->Fill(t / 1000, m_charge);
+	m_pulsePerCh[m_abcCh]->SetPoint(m_pulsePerCh[m_abcCh]->GetN(), t / 1000., m_charge);
+	// m_pulsePerCh[m_abcCh]->Fill(t / 1000, m_charge);
 	if (t / 1000 < 5E5)
-		m_pulsePerChZoomed[m_abcCh]->Fill(t / 1000, m_charge);
+		m_pulsePerChZoomed[m_abcCh]->SetPoint(m_pulsePerChZoomed[m_abcCh]->GetN(), t / 1000., m_charge);
+		// m_pulsePerChZoomed[m_abcCh]->Fill(t / 1000, m_charge);
+
+	// t = getTime();
+	m_hitPulse->SetPoint(m_hitPulse->GetN(), t / 1000., m_charge);
+	if (t > 1.3E12 && t < 1.31E12) {
+	// if (t > 1.3E12 && t < 1.3E12 + 102400000) {
+		m_hitPulseZoomed->SetPoint(m_hitPulseZoomed->GetN(), t / 100000., m_charge);
+		m_hitPulseZoomedHist->Fill((t - 1.3E12) / 100000., m_charge);
+	}
 
-	t = getTime();
-	m_hitPulse->Fill(t / 1000, m_charge);
-	m_hitPulseZoomed->Fill(t / 1000, m_charge);
+
+	m_hitPulseHist->Fill(t / 1000, m_charge);
 
 	return true;
 }
@@ -91,6 +142,7 @@ int64_t HitSpecAnaTool::getTime() {
 }
 
 bool HitSpecAnaTool::output() {
+	LogInfo << m_maxt << endl;
 	TString outFile(m_outDir);
 	outFile += "_";
 	outFile += to_string(m_gcuId);
@@ -109,23 +161,43 @@ bool HitSpecAnaTool::output() {
 
 	m_canvas->Print(m_outPdf + "[");
 
-	// m_canvas->Clear();
-	// m_canvas->cd();
-	// m_hitPulse->Draw();
-	// m_canvas->Print(m_outPdf);
+	m_canvas->Clear();
+	m_canvas->cd();
+	m_hitPulse->DrawClone("AP");
+	m_canvas->Print(m_outPdf);
+
+	m_canvas->Clear();
+	m_canvas->cd();
+	m_hitPulseZoomed->DrawClone("AP");
+	m_canvas->Print(m_outPdf);
 
 	// m_canvas->Clear();
 	// m_canvas->cd();
-	// m_hitPulseZoomed->Draw();
+	// m_hitPulseHist->DrawClone();
 	// m_canvas->Print(m_outPdf);
 
+	m_canvas->Clear();
+	m_canvas->cd();
+	m_hitPulseZoomedHist->DrawClone();
+	m_canvas->Print(m_outPdf);
+
+	m_fftRes = (TH1F*)m_hitPulseZoomedHist->FFT(NULL, "MAG");
+	m_fftRes->GetXaxis()->SetRangeUser(0, 2048);
+	m_fftRes->GetXaxis()->SetTitle("Frequency / (400 / 4096 Hz)");
+	m_fftRes->SetTitle("");
+	m_canvas->Clear();
+	m_canvas->cd();
+	// m_hitPulseZoomedHist->DrawClone();
+	m_fftRes->DrawClone();
+	m_canvas->Print(m_outPdf);
+
 	// m_canvas->SetCanvasSize(4000, 1600);
-	for (int i = 0; i < NCH; i ++) {
-		// m_canvas->Clear();
-		m_canvas->cd();
-		m_pulsePerCh[i]->Draw();
-		m_canvas->Print(m_outPdf);
-	}
+	// for (int i = 0; i < NCH; i ++) {
+	// 	// m_canvas->Clear();
+	// 	m_canvas->cd();
+	// 	m_pulsePerCh[i]->Draw();
+	// 	m_canvas->Print(m_outPdf);
+	// }
 
 	m_canvas->Print(m_outPdf + "]");
 
diff --git a/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.h b/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.h
index 7cbc8ee..6a13139 100644
--- a/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.h
+++ b/Analysis/HitSpecAnaTool/src/HitSpecAnaTool.h
@@ -14,10 +14,12 @@
 
 #include <TH1F.h>
 #include <TH2F.h>
+#include <TGraph.h>
 #include <TCanvas.h>
 #include <TF1.h>
 #include <TString.h>
 #include <TFile.h>
+#include <TVirtualFFT.h>
 
 #define TCYCLE 1677721600
 
@@ -37,14 +39,23 @@ class HitSpecAnaTool : public AnaTool, public ToolBase {
 		TString m_outPdf;
 		TString m_outTxt;
 
+		TH1 *m_fftRes;
 		unique_ptr<TFile> m_fileOut;
 
-		unique_ptr<TH1F> m_hitPulse;
-		unique_ptr<TH1F> m_hitPulseZoomed;
+		unique_ptr<TGraph> m_hitPulse;
+		unique_ptr<TGraph> m_hitPulseZoomed;
+
+		unique_ptr<TH1F> m_hitPulseHist;
+		unique_ptr<TH1F> m_hitPulseZoomedHist;
+
 		unique_ptr<TCanvas> m_canvas;
 
-		vector<unique_ptr<TH1F>> m_pulsePerCh;
-		vector<unique_ptr<TH1F>> m_pulsePerChZoomed;
+		vector<unique_ptr<TGraph>> m_pulsePerCh;
+		vector<unique_ptr<TGraph>> m_pulsePerChZoomed;
+
+		// vector<unique_ptr<TH1F>> m_pulsePerCh;
+		// vector<unique_ptr<TH1F>> m_pulsePerChZoomed;
+
 		vector<int> m_lastCTPerCh;
 		vector<int> m_cycPerCh;
 
@@ -55,6 +66,9 @@ class HitSpecAnaTool : public AnaTool, public ToolBase {
 		int m_coarseTime;
 		int m_lastCoarseTime;
 		int m_cyc;
+		int m_overFlowCounter;
+		int m_gain;
+		int64_t m_maxt;
 		double m_charge;
 
 		const SPMTMap *m_spmtMap;
diff --git a/Analysis/NoiseAnaTool/src/NoiseAnaTool.cc b/Analysis/NoiseAnaTool/src/NoiseAnaTool.cc
index 162504c..8596205 100644
--- a/Analysis/NoiseAnaTool/src/NoiseAnaTool.cc
+++ b/Analysis/NoiseAnaTool/src/NoiseAnaTool.cc
@@ -11,6 +11,7 @@ bool NoiseAnaTool::configure(string outDir, SPMTMap *spmtMap) {
 	LogInfo << "configuring..." << endl;
 	m_outDir = outDir;
 	m_spmtMap = spmtMap;
+	m_nPoint = 0;
 
 	m_pingHgHists.reserve(NCH);
 	m_pongHgHists.reserve(NCH);
@@ -28,8 +29,16 @@ bool NoiseAnaTool::configure(string outDir, SPMTMap *spmtMap) {
 		m_pongLgHists[i]->SetDirectory(0);
 	}
 
+	m_graph2d.reset(new TGraph2D());
+	m_graph2d->SetDirectory(0);
+
+	m_graph2d->SetTitle(";X / m;Y / m");
+	m_graph2d->SetMarkerStyle(22);
+	m_graph2d->SetMarkerSize(1.5);
+
 	m_canvas.reset(new TCanvas("", "", 4000, 4000));
 	m_canvas->Divide(4, 4);
+	m_canvas2d.reset(new TCanvas("", "", 1000, 1000));
 	return true;
 }
 
@@ -143,6 +152,21 @@ bool NoiseAnaTool::output() {
 
 	m_canvas->Print(m_outPdf + "]");
 
+	outFile = m_outDir;
+	outFile += "_";
+	outFile += to_string(m_runNum);
+	m_outPdf = outFile + "_2D.pdf";
+
+	// m_canvas2d->Clear();
+
+	m_canvas2d->SetLeftMargin(0.15);
+	m_canvas2d->SetBottomMargin(0.15);
+	m_canvas2d->SetTheta(90);
+	m_canvas2d->SetPhi(0.001);
+	m_canvas2d->cd();
+	m_graph2d->DrawClone("PCOL");
+	m_canvas2d->SaveAs(m_outPdf);
+
 	resetHists();
 	return true;
 }
@@ -155,30 +179,37 @@ bool NoiseAnaTool::fitCharge() {
 	for (int i = 0; i < NCH; i ++) {
 		m_pingHgHists[i]->GetXaxis()->SetRangeUser(50, 300);
 		maxBin = m_pingHgHists[i]->GetMaximumBin();
-		func.reset(new TF1("func", "gaus", maxBin - 20, maxBin + 20));
+		func.reset(new TF1("func", "gaus", maxBin - 15, maxBin + 15));
 		func->SetParameters(m_pingHgHists[i]->GetMaximum(), maxBin, m_pingHgHists[i]->GetRMS());
-		m_pingHgHists[i]->Fit(func.get(), "R");
+		m_pingHgHists[i]->Fit(func.get(), "QR");
 		m_pingHgHists[i]->GetXaxis()->UnZoom();
 
+		TVector3 pos = m_spmtMap->getPosition(m_gcuId, i);
 		outTxt << func->GetParameter(0) << "\t"
 			   << func->GetParameter(1) << "\t"
 			   << func->GetParameter(2) << "\t"
-			   << m_pingHgHists[i]->GetEntries() << endl;
-	}
-
-	for (int i = 0; i < NCH; i ++) {
-		m_pongHgHists[i]->GetXaxis()->SetRangeUser(50, 300);
-		maxBin = m_pongHgHists[i]->GetMaximumBin();
-		func.reset(new TF1("func", "gaus", maxBin - 20, maxBin + 20));
-		func->SetParameters(m_pongHgHists[i]->GetMaximum(), maxBin, m_pongHgHists[i]->GetRMS());
-		m_pongHgHists[i]->Fit(func.get(), "R");
-		m_pongHgHists[i]->GetXaxis()->UnZoom();
+			   << m_pingHgHists[i]->GetEntries() << "\t"
+			   << pos.X() << "\t"
+			   << pos.Y() << "\t"
+			   << pos.Z() << endl;
 
-		outTxt << func->GetParameter(0) << "\t"
-			   << func->GetParameter(1) << "\t"
-			   << func->GetParameter(2) << endl;
+		m_graph2d->SetPoint(m_nPoint, pos.X() / 1000., pos.Y() / 1000., func->GetParameter(2));
+		m_nPoint ++;
 	}
 
+	// for (int i = 0; i < NCH; i ++) {
+	// 	m_pongHgHists[i]->GetXaxis()->SetRangeUser(50, 300);
+	// 	maxBin = m_pongHgHists[i]->GetMaximumBin();
+	// 	func.reset(new TF1("func", "gaus", maxBin - 20, maxBin + 20));
+	// 	func->SetParameters(m_pongHgHists[i]->GetMaximum(), maxBin, m_pongHgHists[i]->GetRMS());
+	// 	m_pongHgHists[i]->Fit(func.get(), "R");
+	// 	m_pongHgHists[i]->GetXaxis()->UnZoom();
+
+	// 	outTxt << func->GetParameter(0) << "\t"
+	// 		   << func->GetParameter(1) << "\t"
+	// 		   << func->GetParameter(2) << endl;
+	// }
+
 	outTxt.close();
 
 	return true;
diff --git a/Analysis/NoiseAnaTool/src/NoiseAnaTool.h b/Analysis/NoiseAnaTool/src/NoiseAnaTool.h
index ecfdfe1..1d74640 100644
--- a/Analysis/NoiseAnaTool/src/NoiseAnaTool.h
+++ b/Analysis/NoiseAnaTool/src/NoiseAnaTool.h
@@ -16,6 +16,8 @@
 #include <TCanvas.h>
 #include <TF1.h>
 #include <TString.h>
+#include <TGraph2D.h>
+#include <TVector3.h>
 
 using namespace std;
 
@@ -39,12 +41,16 @@ class NoiseAnaTool : public AnaTool, public ToolBase {
 		vector<unique_ptr<TH1F>> m_pongLgHists;
 
 		unique_ptr<TCanvas> m_canvas;
+		unique_ptr<TCanvas> m_canvas2d;
+
+		unique_ptr<TGraph2D> m_graph2d;
 
 		int m_gcuId;
 		int m_runNum;
 		int m_evtType;
+		int m_nPoint;
 
-		const SPMTMap *m_spmtMap;
+		SPMTMap *m_spmtMap;
 
 		bool resetHists();
 		bool fitCharge();
diff --git a/Convert/Binary2ROOTAlg/src/Binary2ROOTAlg.cc b/Convert/Binary2ROOTAlg/src/Binary2ROOTAlg.cc
index ab5fcc7..057ef22 100644
--- a/Convert/Binary2ROOTAlg/src/Binary2ROOTAlg.cc
+++ b/Convert/Binary2ROOTAlg/src/Binary2ROOTAlg.cc
@@ -36,6 +36,7 @@ bool Binary2ROOTAlg::initialize() {
 		m_fileList.push_back(dir);
 		size_t lastSlash = dir.find_last_of("/");
 		if (lastSlash != string::npos) {
+			LogDebug << dir.substr(lastSlash + 1) << endl;
 			m_fileNameList.push_back(dir.substr(lastSlash + 1));
 		}
 		else {
@@ -87,6 +88,10 @@ bool Binary2ROOTAlg::resetFile() {
 	m_date = stoi(m_fileNameList[m_iFile].substr(5, 6));
 	m_time = stoi(m_fileNameList[m_iFile].substr(12, 4));
 	m_fCount = stoi(m_fileNameList[m_iFile].substr(17, 1));
+	LogDebug << "m_runNum: " << m_runNum << endl;
+	LogDebug << "m_gcuId: " << m_gcuId << endl;
+	LogDebug << "m_date: " << m_date << endl;
+	LogDebug << "m_time: " << m_time << endl;
 	m_fileChanged = 1;
 	return true;
 }
diff --git a/README.md b/README.md
index 6a2ad91..af9c478 100644
--- a/README.md
+++ b/README.md
@@ -115,7 +115,7 @@ ExampleAlg::ExampleAlg(const string &name) : AlgBase(name) {
 
 More detail can be found in `./Analysis/CommissioningAlg/`.
 
-## Create your own analsis tool
+## Create your own analysis tool
 
 Similar to `ExampleAlg`, the folders, CMakeLists.txt and \_\_init\_\_.py should be created
 
@@ -208,3 +208,4 @@ python run.py --input ./listOfInput --output ./result/ --evtmax -1 --toollist ./
 
 ## Suggestions
 1. The `CommissioningAlg` can read in the current version of ROOT file, only tools are needed for different tasks.
+2. There is a standard method for converting from binary file to ROOT file.
diff --git a/share/getHitRateDis.py b/share/getHitRateDis.py
index 7f1a106..ea17036 100644
--- a/share/getHitRateDis.py
+++ b/share/getHitRateDis.py
@@ -46,7 +46,7 @@ alg.property("toolNameList").set(args.toollist)
 alg.property("mapGcu2Pos").set(args.gcu2pos)
 alg.property("mapAbc2Cnt").set(args.abc2cnt)
 
-htTool.property("HighRate").set(args.highRate)
+# htTool.property("HighRate").set(args.highRate)
 
 task.setLogLevel(0)
 task.setEvtMax(1)
diff --git a/share/getNoise.py b/share/getNoise.py
index 904c40a..d417a91 100644
--- a/share/getNoise.py
+++ b/share/getNoise.py
@@ -14,6 +14,8 @@ def get_parser():
 	parser.add_argument("--output", default="./", help="output file name")
 	parser.add_argument("--evtmax", type=int, default=-1)
 	parser.add_argument("--toollist", default="{}/noiseToolList".format(os.environ.get('SHAREROOT')))
+	parser.add_argument("--gcu2pos", default="{}/gcu2pos".format(os.environ.get('SHAREROOT')))
+	parser.add_argument("--abc2cnt", default="{}/abc2cnt".format(os.environ.get('SHAREROOT')))
 	return parser
 
 parser = get_parser();
@@ -40,6 +42,8 @@ alg.property("inputList").set(args.input)
 alg.property("outputDir").set(args.output)
 alg.property("evtMax").set(args.evtmax)
 alg.property("toolNameList").set(args.toollist)
+alg.property("mapGcu2Pos").set(args.gcu2pos)
+alg.property("mapAbc2Cnt").set(args.abc2cnt)
 
 task.setLogLevel(0)
 task.setEvtMax(1)
diff --git a/share/run.py b/share/run.py
index 1779b08..d1d5b2e 100644
--- a/share/run.py
+++ b/share/run.py
@@ -13,7 +13,7 @@ def get_parser():
 	parser.add_argument("--input", default="./testList", help="the file which contains input file names")
 	parser.add_argument("--output", default="./", help="output file name")
 	parser.add_argument("--evtmax", type=int, default=-1)
-	parser.add_argument("--toollist", default="./toolList")
+	parser.add_argument("--toollist", default="{}/toolList".format(os.environ.get('SHAREROOT')))
 	return parser
 
 parser = get_parser();
-- 
GitLab