11from matplotlib
import pyplot
as pl
12from basf2
import logging, LogLevel, create_path, process
13from hist_utils
import hist2array
16import matplotlib
as mpl
20logging.log_level = LogLevel.ERROR
25main.add_module(
"EventInfoSetter", evtNumList=[1])
27main.add_module(
"Gearbox")
30geometry = main.add_module(
32 logLevel=LogLevel.INFO,
36main.add_module(
'FullSim')
38materialscan = main.add_module(
"MaterialScan", logLevel=LogLevel.INFO)
41 'Filename':
'MaterialRay.root',
53 'ray.sampleDepth': 0.1,
66rmaterial_file = root.TFile(
"MaterialRay.root")
69def plot_hist(region, **argk):
70 """Get the histogram for a given region from the file and plot it. Return the histogram data and edges"""
71 h = rmaterial_file.Get(f
"Ray/{region}_x0")
74 data, edges = hist2array(h, return_edges=
True)
75 data = np.append(data, 0)
76 edges[-1][-1] = h.GetXaxis().GetXmax()
78 pl.plot(edges[0], data, drawstyle=
"steps-post", **argk)
83all_data, mat_edges = plot_hist(
"All_Regions", label=
"All regions", c=
"k")
86for region
in [
"BeamPipe",
"PXD",
"SVD",
"CDC",
"ARICH",
"TOP",
"ECL",
"EKLM",
"BKLM",
"STR",
"COIL"]:
87 plot_hist(region, label=region)
92pl.xlim(xmin=mat_edges[0], xmax=mat_edges[-1] + 1)
93pl.xlabel(
"Flight length [cm]")
94pl.ylabel(f
"Radiation length [$X_0 / {mat_edges[1] - mat_edges[0]:.3g}$ cm]")
97pl.savefig(
"MaterialRay.pdf")