ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterMLCalibToolLiteCfg Namespace Reference

Functions

 CaloClusterMLCalibToolLiteCfg (flags, name="CaloClusterMLCalibToolLite", config_file="CaloClusterCorrection/config_hgm_mc20.yaml")

Function Documentation

◆ CaloClusterMLCalibToolLiteCfg()

CaloClusterMLCalibToolLiteCfg.CaloClusterMLCalibToolLiteCfg ( flags,
name = "CaloClusterMLCalibToolLite",
config_file = "CaloClusterCorrection/config_hgm_mc20.yaml" )

Definition at line 10 of file CaloClusterMLCalibToolLiteCfg.py.

14):
15 if flags.Input.MCCampaign.value.startswith("mc23"):
16 config_file = "CaloClusterCorrection/config_hgm_mc23.yaml"
17
18 with open(PathResolver.FindCalibFile(config_file)) as f:
19 config = yaml.safe_load(f)
20
21 onnx_model_path = config["model"]["onnx_path"]
22 features = config["data"]["features"]
23 sorted_features = sorted(features.items(), key=lambda item: item[1]["position"])
24 transform_names = [
25 item[1]["preprocessing"]["processors"][0] for item in sorted_features
26 ]
27 transform_params = [
28 [float(x) for x in item[1]["preprocessing"]["parameters"]]
29 for item in sorted_features
30 ]
31
32 ca = ComponentAccumulator()
33 onnx_tool = ca.popToolsAndMerge(OnnxRuntimeInferenceToolCfg(flags, onnx_model_path))
34 CaloClusterMLCalibToolLite = CompFactory.CaloClusterMLCalibToolLite(name)
35 CaloClusterMLCalibToolLite.ORTInferenceTool = onnx_tool
36 CaloClusterMLCalibToolLite.PreprocessingTransformNames = transform_names
37 CaloClusterMLCalibToolLite.PreprocessingTransformParams = transform_params
38 ca.setPrivateTools(CaloClusterMLCalibToolLite)
39
40 return ca
41
static std::string FindCalibFile(const std::string &logical_file_name)