ATLAS Offline Software
Functions
python.plotting.stepPlot Namespace Reference

Functions

argparse.Namespace parse_args ()
 
None set_atlas_style (str style_dir)
 
None main ()
 

Detailed Description

compare_volumes.py
Compare two G4Debugger “volumeSummary” histograms and plot their ratio. These histograms are
Created by G4DebuggingTools.G4DebuggingToolsConfig.StepHistogramToolCfg.

Example
-------
python compare_volumes.py \
--base path_where_hisgrom\
--in1 root_file_name_1 \
--in2 root_file_name_2 \
--atlas-style path_to_AtlasStyle \
--out-dir ./plots

Function Documentation

◆ main()

None python.plotting.stepPlot.main ( )

Definition at line 72 of file stepPlot.py.

72 def main() -> None:
73  args = parse_args()
74  gROOT.SetBatch(True)
75  set_atlas_style(args.atlas_style)
76 
77  dbg1 = G4Debugger(args.base, args.in1)
78  dbg2 = G4Debugger(args.base, args.in2)
79 
80  print(dbg1.volumeSummary) # quick sanity check
81 
83  dbg1.volumeSummary,
84  dbg2.volumeSummary,
85  xaxis="Volumes",
86  v1=args.v1_label,
87  v2=args.v2_label,
88  directory=args.out_dir,
89  name="volumeSummary",
90  )
91 
92 

◆ parse_args()

argparse.Namespace python.plotting.stepPlot.parse_args ( )
Define and parse CLI arguments.

Definition at line 26 of file stepPlot.py.

26 def parse_args() -> argparse.Namespace:
27  """Define and parse CLI arguments."""
28  parser = argparse.ArgumentParser(
29  description="Compare volume summaries from two G4Debugger runs."
30  )
31 
32  parser.add_argument(
33  "--base",
34  required=True,
35  help="Base directory containing the StepHistograms_* sub-directories.",
36  )
37  parser.add_argument(
38  "--in1", required=True, metavar="SUBDIR_1",
39  help="First StepHistograms_* sub-directory."
40  )
41  parser.add_argument(
42  "--in2", required=True, metavar="SUBDIR_2",
43  help="Second StepHistograms_* sub-directory."
44  )
45  parser.add_argument(
46  "--atlas-style", required=True,
47  help="Directory holding AtlasStyle.C / AtlasLabels.C / AtlasUtils.C."
48  )
49  parser.add_argument(
50  "--out-dir", default=".",
51  help="Where to write the output plot [default: current directory]."
52  )
53  parser.add_argument("--v1-label", default="Non Opt", help="Legend label for first sample.")
54  parser.add_argument("--v2-label", default="Opt", help="Legend label for second sample.")
55 
56  return parser.parse_args()
57 
58 

◆ set_atlas_style()

None python.plotting.stepPlot.set_atlas_style ( str  style_dir)
Load ATLAS style macros if they exist.

Definition at line 59 of file stepPlot.py.

59 def set_atlas_style(style_dir: str) -> None:
60  """Load ATLAS style macros if they exist."""
61  if not os.path.isdir(style_dir):
62  raise FileNotFoundError(f"AtlasStyle directory not found: {style_dir}")
63 
64  print(f"Loading ATLAS style from {style_dir}")
65  gROOT.LoadMacro(os.path.join(style_dir, "AtlasStyle.C"))
66  gROOT.LoadMacro(os.path.join(style_dir, "AtlasLabels.C"))
67  gROOT.LoadMacro(os.path.join(style_dir, "AtlasUtils.C"))
68  ROOT.SetAtlasStyle()
69 
70 
71 # ---------------------------------------------------------------------------
python.plotting.stepPlot.set_atlas_style
None set_atlas_style(str style_dir)
Definition: stepPlot.py:59
python.plotting.stepPlot.main
None main()
Definition: stepPlot.py:72
python.plotting.stepPlot.parse_args
argparse.Namespace parse_args()
Definition: stepPlot.py:26
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.plotting.G4DebuggerUtils.plotSummaryRatio
def plotSummaryRatio(dict1, dict2, xaxis, v1, v2, directory="", name="")
Definition: G4DebuggerUtils.py:57