105 Load configuration from ROOT file.
107 Automatically detects and handles both formats:
108 - New format: JSON string (stored as std::string or TObjString)
109 - Old format: Pickled Python object
112 root_file: Either a ROOT.TFile object or a string path to ROOT file
113 key: The key name for the stored config (default: 'ShipGeo')
116 Config object with the loaded configuration
121 if isinstance(root_file, str):
122 root_file = ROOT.TFile.Open(root_file)
127 config_obj = root_file.Get(key)
129 raise ValueError(f
"No object with key '{key}' found in ROOT file")
132 content_str = str(config_obj)
135 if content_str.startswith(
"{"):
138 config.loads_json(content_str)
142 pickle_bytes = content_str.encode(
"latin-1")
143 config = pickle.loads(pickle_bytes)
146 if not isinstance(config, Config):