ATLAS Offline Software
Loading...
Searching...
No Matches
python.physvalPostProcessingTools Namespace Reference

Classes

class  ConfigManager
class  EfficiencyComputation
class  HistogramAddition
class  HistogramAdjustment
class  HistogramBlackList
class  ProjectionComputation
class  RebinningOperation
class  ResolutionComputation
class  ROCCurveComputation

Functions

 find_histo (root_file, path, should_delete=False)
 — HELPER — ###
 ensure_directory_exists (root_file, path)
 — HELPER — ###

Variables

bool crash_on_error = False

Function Documentation

◆ ensure_directory_exists()

python.physvalPostProcessingTools.ensure_directory_exists ( root_file,
path )

— HELPER — ###

Definition at line 37 of file physvalPostProcessingTools.py.

37def ensure_directory_exists(root_file, path):
38 current = root_file
39 for part in path.strip("/").split("/"):
40 next_dir = current.Get(part)
41 if not next_dir:
42 logging.info(f"Saving directory not exist. Creating directory '{part}' in '{current.GetName()}'")
43 current.mkdir(part)
44 current.cd(part)
45 current = ROOT.gDirectory
46
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

◆ find_histo()

python.physvalPostProcessingTools.find_histo ( root_file,
path,
should_delete = False )

— HELPER — ###

Definition at line 10 of file physvalPostProcessingTools.py.

10def find_histo(root_file, path, should_delete=False):
11 obj = root_file.Get(path)
12 if not obj:
13 if crash_on_error:
14 raise RuntimeError(f"Object not found at path: {path}")
15 else:
16 logging.warning(f"Object not found at path: {path}")
17 return None
18 if should_delete:
19 # Extract directory and name for deletion
20 path_parts = path.strip("/").split("/")
21 *dirs, name = path_parts
22 current_dir = root_file
23 for d in dirs:
24 current_dir = current_dir.Get(d)
25 if not current_dir:
26 if crash_on_error:
27 raise RuntimeError(f"Directory '{d}' not found in path '{'/'.join(dirs)}' for deletion.")
28 else:
29 logging.warning(f"Directory '{d}' not found in path '{'/'.join(dirs)}' for deletion.")
30 return None
31 # logging.info(f"Deleting '{name}' in '{'/'.join(dirs)}'")
32 current_dir.Delete(f"{name};*")
33 return None
34 return obj
35

Variable Documentation

◆ crash_on_error

bool python.physvalPostProcessingTools.crash_on_error = False

Definition at line 7 of file physvalPostProcessingTools.py.