ATLAS Offline Software
pdg_comparison.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 # Short script to compare ATLAS material radiation/ionization losses with PDG tables
4 
5 import matplotlib.pyplot as plt
6 
7 plt.style.use("tableau-colorblind10")
8 
9 import ROOT
10 import ctypes
11 
12 from AthenaCommon.SystemOfUnits import millimeter, centimeter
13 
14 ROOT.gInterpreter.ProcessLine('#include "TrkExUtils/MaterialInteraction.h"')
15 ROOT.gSystem.Load("libTrkExUtils.so")
16 
17 # Values for silicon from
18 # https://pdg.lbl.gov/2022/AtomicNuclearProperties/HTML/silicon_Si.html
19 
20 # Momentum MeV
21 p = [
22  92.85,
23  100.3,
24  107.4,
25  114.3,
26  121.0,
27  127.6,
28  140.3,
29  152.7,
30  164.7,
31  176.4,
32  199.4,
33  221.8,
34  254.6,
35  286.8,
36  339.6,
37  363.3,
38  391.7,
39  443.2,
40  494.5,
41  545.5,
42  596.4,
43  647.1,
44  697.7,
45  798.7,
46  899.5,
47  1000.0,
48  1101.0,
49  1301.0,
50  1502.0,
51  1803.0,
52  2103.0,
53  2604.0,
54  3104.0,
55  3604.0,
56  4104.0,
57  4604.0,
58  5105.0,
59  5605.0,
60  6105.0,
61  7105.0,
62  8105.0,
63  9105.0,
64  10110.0,
65  12110.0,
66  14110.0,
67  17110.0,
68  20110.0,
69  25110.0,
70  30110.0,
71  35110.0,
72  40110.0,
73  45110.0,
74  50110.0,
75  55110.0,
76  60110.0,
77  70110.0,
78  80110.0,
79  90110.0,
80  100100.0,
81  120100.0,
82  140100.0,
83  170100.0,
84  200100.0,
85  250100.0,
86  300100.0,
87  350100.0,
88  400100.0,
89  450100.0,
90  500100.0,
91  550100.0,
92  581600.0,
93  600100.0,
94  700100.0,
95  800100.0,
96  900100.0,
97  1000000.0,
98  1200000.0,
99  1400000.0,
100  1700000.0,
101  2000000.0,
102  2500000.0,
103  3000000.0,
104  3500000.0,
105  4000000.0,
106  4500000.0,
107  5000000.0,
108  5500000.0,
109  6000000.0,
110  7000000.0,
111  8000000.0,
112  9000000.0,
113  10000000.0,
114 ]
115 
116 # PDG values for the radiation energy loss [MeV cm^2/g]
117 pdg_rad = [
118  6.158e-05,
119  6.377e-05,
120  6.596e-05,
121  6.839e-05,
122  7.161e-05,
123  7.486e-05,
124  8.145e-05,
125  8.815e-05,
126  9.496e-05,
127  0.0001019,
128  0.000116,
129  0.0001304,
130  0.0001528,
131  0.0001757,
132  0.0002153,
133  0.0002563,
134  0.0002563,
135  0.0002985,
136  0.0003418,
137  0.0003861,
138  0.0004314,
139  0.0004774,
140  0.0005242,
141  0.00062,
142  0.0007182,
143  0.0008186,
144  0.0009391,
145  0.001234,
146  0.001547,
147  0.002045,
148  0.002575,
149  0.003524,
150  0.004531,
151  0.005588,
152  0.006687,
153  0.007823,
154  0.008992,
155  0.01019,
156  0.01141,
157  0.01392,
158  0.01652,
159  0.0192,
160  0.02194,
161  0.02764,
162  0.03356,
163  0.04275,
164  0.05227,
165  0.06896,
166  0.08631,
167  0.1042,
168  0.1226,
169  0.1414,
170  0.1605,
171  0.1798,
172  0.1994,
173  0.2393,
174  0.2801,
175  0.3217,
176  0.364,
177  0.4491,
178  0.5361,
179  0.6696,
180  0.806,
181  1.034,
182  1.267,
183  1.505,
184  1.745,
185  1.989,
186  2.235,
187  2.478,
188  2.632,
189  2.723,
190  3.216,
191  3.715,
192  4.218,
193  4.726,
194  5.735,
195  6.754,
196  8.298,
197  9.857,
198  12.44,
199  15.04,
200  17.66,
201  20.3,
202  22.95,
203  25.61,
204  28.25,
205  30.9,
206  36.21,
207  41.55,
208  46.9,
209  52.27,
210 ]
211 # PDG values for the mean energy loss [MeV cm^2/g]
212 pdg_mean_ion = [
213  2.796,
214  2.608,
215  2.461,
216  2.345,
217  2.25,
218  2.172,
219  2.052,
220  1.965,
221  1.899,
222  1.849,
223  1.781,
224  1.737,
225  1.699,
226  1.678,
227  1.665,
228  1.664,
229  1.665,
230  1.672,
231  1.681,
232  1.692,
233  1.703,
234  1.714,
235  1.726,
236  1.747,
237  1.767,
238  1.786,
239  1.803,
240  1.834,
241  1.86,
242  1.894,
243  1.922,
244  1.96,
245  1.991,
246  2.017,
247  2.038,
248  2.057,
249  2.074,
250  2.089,
251  2.102,
252  2.126,
253  2.145,
254  2.162,
255  2.177,
256  2.203,
257  2.224,
258  2.249,
259  2.27,
260  2.297,
261  2.319,
262  2.336,
263  2.352,
264  2.365,
265  2.377,
266  2.387,
267  2.396,
268  2.413,
269  2.427,
270  2.44,
271  2.451,
272  2.47,
273  2.485,
274  2.505,
275  2.522,
276  2.545,
277  2.563,
278  2.579,
279  2.593,
280  2.605,
281  2.616,
282  2.625,
283  2.631,
284  2.634,
285  2.65,
286  2.664,
287  2.676,
288  2.687,
289  2.706,
290  2.723,
291  2.743,
292  2.76,
293  2.784,
294  2.804,
295  2.821,
296  2.836,
297  2.849,
298  2.86,
299  2.871,
300  2.881,
301  2.898,
302  2.913,
303  2.926,
304  2.938,
305 ]
306 
307 # The ATLAS method return [MeV/mm] for the mean energy loss
308 # So multiply ATLAS values by cm/rho to match PDG
309 # The Atlas method returns [MeV] for the path dependent most
310 # propable energy loss, calculate with for 1cm and divide with rho
311 
312 
313 # silicon properties
314 X0 = 21.82 # Radiation length
315 L0 = 108.4 # Nuclear interaction length, not used here
316 A = 28.0855
317 Z = 14
318 rho = 2.329 # given in g/cm^3
319 
320 
321 conv = (centimeter / millimeter) / rho
322 mat = ROOT.Trk.Material(X0 * conv, L0 * conv, A, Z, rho / centimeter**3)
323 particle = ROOT.Trk.muon
324 sigma = ctypes.c_double()
325 kazL = ctypes.c_double()
326 
327 # lets do the calculations and compare
328 atlas_mean_ion = []
329 atlas_rad = []
330 atlas_mop_ion = []
331 print(
332  "|{0:<17}|{1:<17}|{2:<17}|{3:<17}|{4:<17}|{5:<17}|".format(
333  "Momentum P",
334  "PDG Ion <dE/dX>",
335  "ATLAS Ion <dE/dX>",
336  "ATLAS MPV dE",
337  "PDG rad <dE/dX>",
338  "ATLAS rad <dE/dX>",
339  )
340 )
341 for i in range(len(p)):
342  atlas_mean_ion.append(
343  -ROOT.Trk.MaterialInteraction.dEdl_ionization(p[i], mat, particle, sigma, kazL)
344  * conv
345  )
346  atlas_mop_ion.append(
347  -ROOT.Trk.MaterialInteraction.dE_MPV_ionization(
348  p[i], mat, particle, sigma, kazL, centimeter
349  )
350  / rho
351  )
352  atlas_rad.append(
353  -ROOT.Trk.MaterialInteraction.dEdl_radiation(p[i], mat, particle, sigma) * conv
354  )
355 
356  print(
357  "|{0:17.5}|{1:17.6}|{2:17.6}|{3:17.6}|{4:17.6}|{5:17.6}|".format(
358  p[i],
359  pdg_mean_ion[i],
360  atlas_mean_ion[i],
361  atlas_mop_ion[i],
362  pdg_rad[i],
363  atlas_rad[i],
364  )
365  )
366 
367 plt.plot(p, pdg_rad, label="PDG rad", marker=".")
368 plt.plot(p, atlas_rad, label="ATLAS rad", marker="x")
369 plt.xlabel("p [MeV]")
370 plt.ylabel("-<dE/dx> [MeV cm^2/g]")
371 plt.legend()
372 plt.savefig("dEdx_rad_vs_p.png", dpi=300)
373 plt.clf()
374 
375 plt.plot(p, pdg_mean_ion, label="PDG mean ion", marker=".", markersize=4)
376 plt.plot(p, atlas_mean_ion, label="ATLAS mean ion", marker="x", markersize=4)
377 plt.plot(p, atlas_mop_ion, label="ATLAS mpv ion", marker="+", markersize=4)
378 plt.ylabel("-<dE/dx> [MeV cm^2/g]")
379 plt.xlabel("p [MeV]")
380 plt.legend()
381 plt.xscale("log")
382 plt.ylim(0, 5)
383 plt.savefig("dEdx_ion_vs_p_all.png", dpi=300)
SystemOfUnits
vtune_athena.format
format
Definition: vtune_athena.py:14
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70