4 Compare two G4Debugger “volumeSummary” histograms and plot their ratio. These histograms are
5 Created by G4DebuggingTools.G4DebuggingToolsConfig.StepHistogramToolCfg.
9 python compare_volumes.py \
10 --base path_where_hisgrom\
11 --in1 root_file_name_1 \
12 --in2 root_file_name_2 \
13 --atlas-style path_to_AtlasStyle \
19 from ROOT
import gROOT
21 from G4Debugger
import G4Debugger
22 from G4DebuggerUtils
import plotSummaryRatio
27 """Define and parse CLI arguments."""
28 parser = argparse.ArgumentParser(
29 description=
"Compare volume summaries from two G4Debugger runs."
35 help=
"Base directory containing the StepHistograms_* sub-directories.",
38 "--in1", required=
True, metavar=
"SUBDIR_1",
39 help=
"First StepHistograms_* sub-directory."
42 "--in2", required=
True, metavar=
"SUBDIR_2",
43 help=
"Second StepHistograms_* sub-directory."
46 "--atlas-style", required=
True,
47 help=
"Directory holding AtlasStyle.C / AtlasLabels.C / AtlasUtils.C."
50 "--out-dir", default=
".",
51 help=
"Where to write the output plot [default: current directory]."
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.")
56 return parser.parse_args()
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}")
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"))
80 print(dbg1.volumeSummary)
88 directory=args.out_dir,
93 if __name__ ==
"__main__":