From db519a9b063cae2bf765f9a2f6cd0131ced63bbb Mon Sep 17 00:00:00 2001 From: fuchenxi <1256257282@qq.com> Date: Fri, 27 Sep 2024 16:45:15 +0800 Subject: [PATCH] =?UTF-8?q?cflm=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cflm/RootPlot_1D.py | 27 ----------------- cflm/RootPlot_2D.py | 74 --------------------------------------------- cflm/__init__.py | 3 -- 3 files changed, 104 deletions(-) delete mode 100644 cflm/RootPlot_1D.py delete mode 100644 cflm/RootPlot_2D.py diff --git a/cflm/RootPlot_1D.py b/cflm/RootPlot_1D.py deleted file mode 100644 index 641a1b2..0000000 --- a/cflm/RootPlot_1D.py +++ /dev/null @@ -1,27 +0,0 @@ -import ROOT - -data = [] -low = 0 -up = 70 -nbins = 70 - -def RootPlot_1D(): - with open('./xxx_100_sic.txt', 'r') as file: - for line in file: - columns = line.split() - data.append(float(columns[2])) # X position : 1 // Z position :2 // Y position : 3 #// - - h = ROOT.TH1F("histogram", "Z position Distribution", 70, 0, 70) #// - - for value in data: - h.Fill(value) - - h.GetXaxis().SetTitle("Z position (mm)") #// - h.GetYaxis().SetTitle("Event/{:.3f}".format((up - low) / nbins)) - - c = ROOT.TCanvas("canvas", "Canvas Title", 800, 600) - h.Draw() - - c.SaveAs("RootPlot100sic_Z.png") #// - - c.Draw() diff --git a/cflm/RootPlot_2D.py b/cflm/RootPlot_2D.py deleted file mode 100644 index 7406d73..0000000 --- a/cflm/RootPlot_2D.py +++ /dev/null @@ -1,74 +0,0 @@ -import ROOT -from array import array - -X_position = [] -Z_position = [] -colors = [] -column = [] - -def RootPlot_2D(): - c1 = ROOT.TCanvas("c1", "Hit position distribution", 200, 10, 700, 500) - mg = ROOT.TMultiGraph() - gr1 = ROOT.TGraph() - gr2 = ROOT.TGraph() - gr3 = ROOT.TGraph() - gr4 = ROOT.TGraph() - - with open('raser/cflm/xxx_200_air.txt', 'r') as file: - for line in file: - columns = line.split() - column.append(columns[0]) - X_position.append(float(columns[1])) - Z_position.append(float(columns[2])) - if columns[0] == 'gamma': - colors.append(ROOT.kGreen) - elif columns[0] == 'e-': - colors.append(ROOT.kRed) - elif columns[0] == 'e+': - colors.append(ROOT.kBlue) - else: - colors.append(ROOT.kBlack) - - for i in range(len(X_position)): - particle = column[i] - if particle == 'gamma': - gr1.SetMarkerStyle(20) - gr1.SetMarkerColor(ROOT.kBlack) - gr1.SetPoint(i, X_position[i], Z_position[i]) - elif particle == 'e-': - gr2.SetMarkerStyle(22) - gr2.SetMarkerColor(ROOT.kBlack) - gr2.SetPoint(i, X_position[i], Z_position[i]) - elif particle == 'e+': - gr3.SetMarkerStyle(24) - gr3.SetMarkerColor(ROOT.kBlack) - gr3.SetPoint(i, X_position[i], Z_position[i]) - else: - gr4.SetMarkerStyle(28) - gr4.SetMarkerColor(ROOT.kBlack) - gr4.SetPoint(i, X_position[i], Z_position[i]) - - mg.Add(gr1) - mg.Add(gr2) - mg.Add(gr3) - mg.Add(gr4) - - mg.GetXaxis().SetTitle("X position (mm)") - mg.GetYaxis().SetTitle("Z position (mm)") - - mg.Draw("AP") - - legend = ROOT.TLegend(0.7, 0.2, 0.9, 0.4) - legend.AddEntry(gr1, "#gamma", "p").SetMarkerColor(ROOT.kGreen) - legend.AddEntry(gr2, "e^{-}", "p").SetMarkerColor(ROOT.kRed) - legend.AddEntry(gr3, "e^{+}", "p").SetMarkerColor(ROOT.kBlue) - legend.AddEntry(gr4, "Other", "p").SetMarkerColor(ROOT.kBlack) - - legend.SetBorderSize(0) - legend.SetFillColor(0) - legend.SetTextSize(0.03) - - legend.Draw() - - - c1.SaveAs("RootPlot100air_2D.png") \ No newline at end of file diff --git a/cflm/__init__.py b/cflm/__init__.py index 42495fe..1991874 100644 --- a/cflm/__init__.py +++ b/cflm/__init__.py @@ -15,9 +15,6 @@ def main(kwargs): if label == 'cflm': from . import cflm cflm.main() - if label == 'RootPlot_1D': - from . import RootPlot_1D - RootPlot_1D.RootPlot_1D() if label == 'GetSignal': from . import get_signal get_signal.get_signal() -- GitLab