ATLAS Offline Software
Loading...
Searching...
No Matches
muon_eff_sf_example_PHYSLITE.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2#
3# @author Giordon Stark
4
5# This follows the code Nils wrote in the ColumnarTests at:
6# https://gitlab.cern.ch/atlas-asg/columnar-athena/-/blob/84feea5559c07a6a67233ab5465f90fb6f862509/PhysicsAnalysis/Columnar/ColumnarTests/test/gt_fullTools.cxx#L405-442
7import ColumnarToolWrapperPython as ctw
8import uproot as up
9import sys
10
11
12def main(path):
13 print("# MuonEfficiencyScaleFactors")
14 tool = ctw.Tool(
15 "CP::MuonEfficiencyScaleFactors/unique0",
16 properties={"WorkingPoint": "Tight"},
17 rename_containers={
18 "EventInfo": "EventInfoAuxDyn",
19 "Muons": "AnalysisMuonsAuxDyn",
20 },
21 )
22
23 print("columns:")
24 for column in tool.columns:
25 print(f" - {column}")
26
27 print("recommended systematics:")
28 for systematic in tool.recommended_systematics:
29 print(f" - '{systematic}'", "(nominal)" if not systematic else "")
30
31 with up.open(path) as fp:
32 tree = fp["CollectionTree"]
33 input_column_names = [c.name for c in tool.input_columns]
34 events = tree.arrays(virtual=True, filter_name=lambda x: x in input_column_names)
35
36 result = tool(events)
37 print(result["AnalysisMuonsAuxDyn.sfOut"].to_list())
38 print(result["AnalysisMuonsAuxDyn.validOut"].to_list())
39
40
41if __name__ == "__main__":
42 # Example path on UChicago: /data/krumnack/DAOD_PHYSLITE_DEV_V3.root
43 main(sys.argv[1])
void print(char *figname, TCanvas *c1)
int main()
Definition hello.cxx:18