ATLAS Offline Software
Simulation
G4Utilities
G4DebuggingTools
python
plotting
G4Debugger.py
Go to the documentation of this file.
1
import
ROOT
2
import
os, sys
3
4
from
G4DebuggerConfig
import
*
5
6
class
G4Debugger
:
7
8
def
__init__
(self, path, G4Version):
9
10
11
self.
volumeSummary
= {}
12
self.
materialSummary
= {}
13
self.
processSummary
= {}
14
15
self.
G4Version
= G4Version
16
self.
file
= ROOT.TFile(os.path.join(path,
"%s.root"
% G4Version),
"READ"
)
17
18
print
(self.
file
)
19
20
d = self.
file
.GetDirectory(
"volumes"
)
21
for
k
in
d.GetListOfKeys():
22
name = k.GetName()
23
if
name
in
translate.keys()
and
name !=
'other'
:
24
name = translate[name]
25
print
(name)
26
namePerm = k.GetName()
27
if
name ==
"summary"
:
28
continue
29
for
p
in
particles:
30
h = self.
GetHistogram
(
"stepLength"
,namePerm,p,
"volumes"
)
31
if
h:
32
if
not
name
in
self.
volumeSummary
.
keys
():
33
self.
volumeSummary
[name] = {}
34
if
not
p
in
self.
volumeSummary
[name].
keys
():
35
self.
volumeSummary
[name][p] = 0
36
self.
volumeSummary
[name][p] += h.Integral(0,h.GetNbinsX()+1)
37
if
p ==
"other"
:
38
for
op
in
otherParticles:
39
oh = self.
GetHistogram
(
"stepLength"
,namePerm,op,
"volumes"
)
40
if
oh:
41
self.
volumeSummary
[name][
"other"
] += oh.Integral(0,oh.GetNbinsX()+1)
42
43
d = self.
file
.GetDirectory(
"materials"
)
44
for
k
in
d.GetListOfKeys():
45
name = k.GetName()
46
if
name ==
"summary"
:
47
continue
48
for
p
in
particles:
49
h = self.
GetHistogram
(
"stepLength"
,name,p,
"materials"
)
50
if
h:
51
if
not
name
in
self.
materialSummary
.
keys
():
52
self.
materialSummary
[name] = {}
53
if
not
p
in
self.
materialSummary
[name].
keys
():
54
self.
materialSummary
[name][p] = 0
55
self.
materialSummary
[name][p] += h.Integral(0,h.GetNbinsX()+1)
56
57
d = self.
file
.GetDirectory(
"processes"
)
58
for
k
in
d.GetListOfKeys():
59
name = k.GetName()
60
if
name ==
"summary"
:
61
continue
62
for
p
in
particles:
63
h = self.
GetHistogram
(
"stepLength"
,name,p,
"processes"
)
64
if
h:
65
if
not
name
in
self.
processSummary
.
keys
():
66
self.
processSummary
[name] = {}
67
if
not
p
in
self.
processSummary
[name].
keys
():
68
self.
processSummary
[name][p] = 0
69
self.
processSummary
[name][p] += h.Integral(0,h.GetNbinsX()+1)
70
71
def
GetHistogram
(self,his,cat,p,folder):
72
middle = folder[0:3]
if
not
folder ==
"processes"
else
"prc"
73
hisName =
"%s_%s_%s_%s"
% (cat, p, middle, (his
if
his !=
"2DMaps"
else
"RZ"
))
74
h = self.
file
.
Get
(os.path.join(folder,cat,his,hisName))
75
return
h
76
77
def
GetHistogramAllATLAS
(self,his,cat,p,folder):
78
hisName =
"%s_%s_%s"
% (cat, p, his)
79
h = self.
file
.
Get
(os.path.join(folder,cat,his,hisName))
80
return
h
python.plotting.G4Debugger.G4Debugger.materialSummary
materialSummary
Definition:
G4Debugger.py:12
python.plotting.G4Debugger.G4Debugger.GetHistogramAllATLAS
def GetHistogramAllATLAS(self, his, cat, p, folder)
Definition:
G4Debugger.py:77
python.plotting.G4Debugger.G4Debugger.processSummary
processSummary
Definition:
G4Debugger.py:13
Get
T * Get(TFile &f, const std::string &n, const std::string &dir="", const chainmap_t *chainmap=0, std::vector< std::string > *saved=0)
get a histogram given a path, and an optional initial directory if histogram is not found,...
Definition:
comparitor.cxx:181
python.plotting.G4Debugger.G4Debugger
Definition:
G4Debugger.py:6
print
void print(char *figname, TCanvas *c1)
Definition:
TRTCalib_StrawStatusPlots.cxx:25
python.plotting.G4Debugger.G4Debugger.volumeSummary
volumeSummary
Definition:
G4Debugger.py:11
python.plotting.G4Debugger.G4Debugger.__init__
def __init__(self, path, G4Version)
Definition:
G4Debugger.py:8
python.plotting.G4Debugger.G4Debugger.GetHistogram
def GetHistogram(self, his, cat, p, folder)
Definition:
G4Debugger.py:71
python.plotting.G4Debugger.G4Debugger.G4Version
G4Version
Definition:
G4Debugger.py:15
python.plotting.G4Debugger.G4Debugger.file
file
Definition:
G4Debugger.py:16
python.Bindings.keys
keys
Definition:
Control/AthenaPython/python/Bindings.py:801
Generated on Tue Sep 2 2025 21:11:47 for ATLAS Offline Software by
1.8.18