atlas-ftag-tools 0.1.19__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {atlas_ftag_tools-0.1.19.dist-info → atlas_ftag_tools-0.2.1.dist-info}/METADATA +1 -1
- atlas_ftag_tools-0.2.1.dist-info/RECORD +26 -0
- {atlas_ftag_tools-0.1.19.dist-info → atlas_ftag_tools-0.2.1.dist-info}/WHEEL +1 -1
- ftag/__init__.py +1 -1
- ftag/cli_utils.py +13 -0
- ftag/flavours.yaml +60 -13
- ftag/hdf5/h5move.py +4 -3
- ftag/hdf5/h5split.py +1 -3
- ftag/test_cli_utils.py +34 -0
- ftag/wps/discriminant.py +6 -0
- ftag/wps/working_points.py +5 -2
- atlas_ftag_tools-0.1.19.dist-info/RECORD +0 -24
- {atlas_ftag_tools-0.1.19.dist-info → atlas_ftag_tools-0.2.1.dist-info}/entry_points.txt +0 -0
- {atlas_ftag_tools-0.1.19.dist-info → atlas_ftag_tools-0.2.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
ftag/__init__.py,sha256=aCC6idmHdlETdgAFN4PeESN67WpeVqo85Nledw9VkH4,629
|
2
|
+
ftag/cli_utils.py,sha256=w3TtQmUHSyAKChS3ewvOtcSDAUJAZGIIomaNi8f446U,298
|
3
|
+
ftag/cuts.py,sha256=a0BJj4cVRunc-hFLPloGvNoSFvRmZg2kVLv7sA0iAaI,2817
|
4
|
+
ftag/flavour.py,sha256=qvgp4DarOdcQgjae_NWnd81k_YqdmFY74lOKky2lpb8,3568
|
5
|
+
ftag/flavours.yaml,sha256=h0A2cw-je1oCe-rh5qhuL1BhDNhu2aLkf7W9y-Cpy3g,6959
|
6
|
+
ftag/git_check.py,sha256=Y-XqM80CVXZ5ZKrDdZcYOJt3X64uU6W3OP6Z0D7AZU0,1663
|
7
|
+
ftag/mock.py,sha256=9V6sAT4_t-rhR67q9KHaj1NKAeqU7lQjWxiOxEzk8Sw,4338
|
8
|
+
ftag/region.py,sha256=ANv0dGI2W6NJqD9fp7EfqAUReH4FOjc1gwl_Qn8llcM,360
|
9
|
+
ftag/sample.py,sha256=TFXMhDkbPmjkms9-b-bINJ32T3bO86JcU70C0nY7wa8,2500
|
10
|
+
ftag/test_cli_utils.py,sha256=xa08vf6SEOow58SSFagYdAselb-dkNOVvWsWheMnW-g,1001
|
11
|
+
ftag/transform.py,sha256=uEGGJSnqoKOzLYQv650XdK_kDNw4Aw-5dc60z9Dp_y0,3963
|
12
|
+
ftag/vds.py,sha256=nRViQZQIORB95nC7NZsW3KsSoGkLzEdOsuCViH5h8-U,3296
|
13
|
+
ftag/hdf5/__init__.py,sha256=LFDNxVOCp58SvLHwQhdT68Q-KBMS_i6jBrbXoRpHzbM,354
|
14
|
+
ftag/hdf5/h5move.py,sha256=oYpRu0IDCIJIQ2ML52HBAdoyDxmKkHTeM9JdbPEgKfI,947
|
15
|
+
ftag/hdf5/h5reader.py,sha256=et-_LXt942xegqc14bPapUgIO7MUfC2m04uJslLkXxI,13579
|
16
|
+
ftag/hdf5/h5split.py,sha256=4Wy6Xc3J58MdD9aBaSZHf5ZcVFnJSkWsm42R5Pgo-R4,2448
|
17
|
+
ftag/hdf5/h5utils.py,sha256=-4zKTMtNCrDZr_9Ww7uzfsB7M7muBKpmm_1IkKJnHOI,3222
|
18
|
+
ftag/hdf5/h5writer.py,sha256=wVyurIgfSBtvZTX-v0v3R5-8JOwWK_yF1rUX-RewXzY,4826
|
19
|
+
ftag/wps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
+
ftag/wps/discriminant.py,sha256=c2-bal124yY1rZjK87iQHb9RRo4pus6SVue6SfMKrRY,3749
|
21
|
+
ftag/wps/working_points.py,sha256=VTU6OD40ULAJQD0MlD1EZd33q8ociUvFX1YrhgJFvXc,9722
|
22
|
+
atlas_ftag_tools-0.2.1.dist-info/METADATA,sha256=KpKapru-RWOoq01J5sm04jE2brwpoPxDGVPTZoppl8c,5168
|
23
|
+
atlas_ftag_tools-0.2.1.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
24
|
+
atlas_ftag_tools-0.2.1.dist-info/entry_points.txt,sha256=LfVLsZHQolqbPnwPgtmc5IQTh527BKkN2v-IpXWTNHw,137
|
25
|
+
atlas_ftag_tools-0.2.1.dist-info/top_level.txt,sha256=qiYQuKcAvMim-31FwkT3MTQu7WQm0s58tPAia5KKWqs,5
|
26
|
+
atlas_ftag_tools-0.2.1.dist-info/RECORD,,
|
ftag/__init__.py
CHANGED
ftag/cli_utils.py
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import argparse
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
|
7
|
+
def valid_path(string):
|
8
|
+
if (path := Path(string)).is_file():
|
9
|
+
return path
|
10
|
+
raise FileNotFoundError(string)
|
11
|
+
|
12
|
+
|
13
|
+
class HelpFormatter(argparse.RawTextHelpFormatter, argparse.ArgumentDefaultsHelpFormatter): ...
|
ftag/flavours.yaml
CHANGED
@@ -140,37 +140,84 @@
|
|
140
140
|
colour: "#e76f51"
|
141
141
|
category: lepton-decay
|
142
142
|
|
143
|
+
# PDGID labelling: taken from https://pdg.lbl.gov/2023/reviews/rpp2023-rev-monte-carlo-numbering.pdf
|
144
|
+
- name: D0meson
|
145
|
+
label: $D^0$ in $c$-jet
|
146
|
+
cuts: ["HadronConeExclTruthLabelID == 4", "HadronConeExclTruthLabelPdgId in (421,-421)"]
|
147
|
+
colour: "#FFA500"
|
148
|
+
category: PDGID
|
149
|
+
- name: nonD0meson
|
150
|
+
label: $D^+$, $Ds^+$ or baryon in $c$-jet
|
151
|
+
cuts: ["HadronConeExclTruthLabelID == 4", "HadronConeExclTruthLabelPdgId notin (421,-421)"]
|
152
|
+
colour: "#800080"
|
153
|
+
category: PDGID
|
154
|
+
- name: Dplusmeson
|
155
|
+
label: $D^+$ in $c$-jet
|
156
|
+
cuts: ["HadronConeExclTruthLabelID == 4", "HadronConeExclTruthLabelPdgId in (411,-411)"]
|
157
|
+
colour: "#00FFFF"
|
158
|
+
category: PDGID
|
159
|
+
- name: Dsplusmeson
|
160
|
+
label: $Ds^+$ in $c$-jet
|
161
|
+
cuts: ["HadronConeExclTruthLabelID == 4", "HadronConeExclTruthLabelPdgId in (431,-431)"]
|
162
|
+
colour: "#781DC8"
|
163
|
+
category: PDGID
|
164
|
+
- name: B0meson
|
165
|
+
label: $B^0$ in $b$-jet
|
166
|
+
cuts: ["HadronConeExclTruthLabelID == 5", "HadronConeExclTruthLabelPdgId in (511,-511)"]
|
167
|
+
colour: "#702B1C"
|
168
|
+
category: PDGID
|
169
|
+
- name: Bplusmeson
|
170
|
+
label: $B^0$ in $b$-jet
|
171
|
+
cuts: ["HadronConeExclTruthLabelID == 5", "HadronConeExclTruthLabelPdgId in (521,-521)"]
|
172
|
+
colour: "#C81D4A"
|
173
|
+
category: PDGID
|
174
|
+
- name: Bs0meson
|
175
|
+
label: $Bs^0$ in $b$-jet
|
176
|
+
cuts: ["HadronConeExclTruthLabelID == 5", "HadronConeExclTruthLabelPdgId in (531,-531)"]
|
177
|
+
colour: "#1D62C8"
|
178
|
+
category: PDGID
|
179
|
+
|
143
180
|
# lepton isolation
|
144
181
|
## taken from https://gitlab.cern.ch/atlas/athena/-/blob/main/PhysicsAnalysis/AnalysisCommon/TruthClassification/README.md#4-details-about-the-lepton-categories
|
145
182
|
- name: elxprompt
|
146
183
|
label: prompt electrons
|
147
|
-
cuts: ["iffClass
|
184
|
+
cuts: ["iffClass in (2,3)"]
|
148
185
|
colour: tab:red
|
149
186
|
category: isolation
|
187
|
+
- name: elxnoflip
|
188
|
+
label: prompt electrons with no charge-flip
|
189
|
+
cuts: ["iffClass == 2"]
|
190
|
+
colour: darkorange
|
191
|
+
category: isolation
|
150
192
|
- name: elxflip
|
151
193
|
label: prompt electrons with charge-flip
|
152
194
|
cuts: ["iffClass == 3"]
|
153
195
|
colour: tab:orange
|
154
196
|
category: isolation
|
197
|
+
- name: elxphconv
|
198
|
+
label: electrons from prompt photon-conversions
|
199
|
+
cuts: ["iffClass == 5"]
|
200
|
+
colour: tab:purple
|
201
|
+
category: isolation
|
202
|
+
- name: elxnonprompt
|
203
|
+
label: non-prompt electrons
|
204
|
+
cuts: ["iffClass notin (2,3,5)"]
|
205
|
+
colour: "#264653"
|
206
|
+
category: isolation
|
155
207
|
- name: muxprompt
|
156
208
|
label: prompt muons
|
157
|
-
cuts: ["iffClass
|
209
|
+
cuts: ["iffClass in (4,11)"]
|
158
210
|
colour: tab:blue
|
159
211
|
category: isolation
|
212
|
+
- name: muxnoflip
|
213
|
+
label: prompt muons with no charge-flip
|
214
|
+
cuts: ["iffClass == 4"]
|
215
|
+
colour: aqua
|
216
|
+
category: isolation
|
160
217
|
- name: muxflip
|
161
218
|
label: prompt muons with charge-flip
|
162
219
|
cuts: ["iffClass == 11"]
|
163
|
-
colour:
|
164
|
-
category: isolation
|
165
|
-
- name: elxphconv
|
166
|
-
label: electrons from prompt photon-conversions
|
167
|
-
cuts: ["iffClass == 5"]
|
168
|
-
colour: tab:purple
|
169
|
-
category: isolation
|
170
|
-
- name: elxfrommu
|
171
|
-
label: electrons from muons
|
172
|
-
cuts: ["iffClass == 6"]
|
173
|
-
colour: salmon
|
220
|
+
colour: midnightblue
|
174
221
|
category: isolation
|
175
222
|
- name: npxall
|
176
223
|
label: non-prompt lepton
|
ftag/hdf5/h5move.py
CHANGED
@@ -3,14 +3,15 @@
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
5
|
import argparse
|
6
|
-
from pathlib import Path
|
7
6
|
|
8
7
|
import h5py
|
9
8
|
|
9
|
+
from ftag.cli_utils import HelpFormatter, valid_path
|
10
|
+
|
10
11
|
|
11
12
|
def parse_args(args):
|
12
|
-
parser = argparse.ArgumentParser(description=__doc__)
|
13
|
-
parser.add_argument("--fname", required=True, type=
|
13
|
+
parser = argparse.ArgumentParser(description=__doc__, formatter_class=HelpFormatter)
|
14
|
+
parser.add_argument("--fname", required=True, type=valid_path, help="path to h5 file")
|
14
15
|
parser.add_argument(
|
15
16
|
"--src",
|
16
17
|
required=True,
|
ftag/hdf5/h5split.py
CHANGED
@@ -7,12 +7,10 @@ from pathlib import Path
|
|
7
7
|
|
8
8
|
import h5py
|
9
9
|
|
10
|
+
from ftag.cli_utils import HelpFormatter
|
10
11
|
from ftag.hdf5 import H5Reader, H5Writer
|
11
12
|
|
12
13
|
|
13
|
-
class HelpFormatter(argparse.RawTextHelpFormatter, argparse.ArgumentDefaultsHelpFormatter): ...
|
14
|
-
|
15
|
-
|
16
14
|
def parse_args(args):
|
17
15
|
parser = argparse.ArgumentParser(description=__doc__, formatter_class=HelpFormatter)
|
18
16
|
parser.add_argument("--src", required=True, type=Path, help="path to source h5 file")
|
ftag/test_cli_utils.py
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
from tempfile import NamedTemporaryFile, TemporaryDirectory
|
5
|
+
|
6
|
+
import pytest
|
7
|
+
|
8
|
+
from ftag.cli_utils import valid_path
|
9
|
+
|
10
|
+
|
11
|
+
def test_valid_path_existing_file():
|
12
|
+
# Test when the input path is an existing file
|
13
|
+
# get a temp directory
|
14
|
+
with TemporaryDirectory() as tmpdir, NamedTemporaryFile(dir=tmpdir) as f:
|
15
|
+
input_path = f.name
|
16
|
+
expected_output = Path(f.name)
|
17
|
+
result = valid_path(input_path)
|
18
|
+
assert result == expected_output
|
19
|
+
|
20
|
+
|
21
|
+
def test_valid_path_non_existing_file():
|
22
|
+
# Test when the input path is a non-existing file
|
23
|
+
input_path = "non_existing_file.txt"
|
24
|
+
with pytest.raises(FileNotFoundError) as e:
|
25
|
+
valid_path(input_path)
|
26
|
+
assert str(e.value) == input_path
|
27
|
+
|
28
|
+
|
29
|
+
def test_valid_path_directory():
|
30
|
+
# Test when the input path is a directory
|
31
|
+
input_path = "directory/"
|
32
|
+
with pytest.raises(FileNotFoundError) as e:
|
33
|
+
valid_path(input_path)
|
34
|
+
assert str(e.value) == input_path
|
ftag/wps/discriminant.py
CHANGED
@@ -53,6 +53,11 @@ def discriminant(
|
|
53
53
|
return np.log((jets[f"{tagger}_{signal.px}"] + epsilon) / (denominator + epsilon))
|
54
54
|
|
55
55
|
|
56
|
+
def tautag_dicriminant(jets, tagger, fb, fc, epsilon=1e-10):
|
57
|
+
fxs = {"pb": fb, "pc": fc, "pu": 1 - fb - fc}
|
58
|
+
return discriminant(jets, tagger, Flavours.taujets, fxs, epsilon=epsilon)
|
59
|
+
|
60
|
+
|
56
61
|
def btag_discriminant(jets, tagger, fc, ftau=0, epsilon=1e-10):
|
57
62
|
fxs = {"pc": fc, "ptau": ftau, "pu": 1 - fc - ftau}
|
58
63
|
return discriminant(jets, tagger, Flavours.bjets, fxs, epsilon=epsilon)
|
@@ -99,6 +104,7 @@ def get_discriminant(
|
|
99
104
|
tagger_funcs: dict[str, Callable] = {
|
100
105
|
"bjets": btag_discriminant,
|
101
106
|
"cjets": ctag_discriminant,
|
107
|
+
"taujets": tautag_dicriminant,
|
102
108
|
"hbb": hbb_discriminant,
|
103
109
|
"hcc": hcc_discriminant,
|
104
110
|
}
|
ftag/wps/working_points.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
"""Calculate tagger working points."""
|
2
|
+
|
1
3
|
from __future__ import annotations
|
2
4
|
|
3
5
|
import argparse
|
@@ -6,6 +8,7 @@ from pathlib import Path
|
|
6
8
|
import numpy as np
|
7
9
|
import yaml
|
8
10
|
|
11
|
+
from ftag.cli_utils import HelpFormatter
|
9
12
|
from ftag.cuts import Cuts
|
10
13
|
from ftag.flavour import Flavours
|
11
14
|
from ftag.hdf5 import H5Reader
|
@@ -14,8 +17,8 @@ from ftag.wps.discriminant import get_discriminant
|
|
14
17
|
|
15
18
|
def parse_args(args):
|
16
19
|
parser = argparse.ArgumentParser(
|
17
|
-
description=
|
18
|
-
formatter_class=
|
20
|
+
description=__doc__,
|
21
|
+
formatter_class=HelpFormatter,
|
19
22
|
)
|
20
23
|
parser.add_argument(
|
21
24
|
"--ttbar",
|
@@ -1,24 +0,0 @@
|
|
1
|
-
ftag/__init__.py,sha256=ejpCAn-ZuVi3dfPhvdyw4qDs9m6S5hgpWe3jPIh8fGE,630
|
2
|
-
ftag/cuts.py,sha256=a0BJj4cVRunc-hFLPloGvNoSFvRmZg2kVLv7sA0iAaI,2817
|
3
|
-
ftag/flavour.py,sha256=qvgp4DarOdcQgjae_NWnd81k_YqdmFY74lOKky2lpb8,3568
|
4
|
-
ftag/flavours.yaml,sha256=9ifKyz1_VoHlOaWuf3JEqMLSYyLFedYJf9x1D6dCTnM,5335
|
5
|
-
ftag/git_check.py,sha256=Y-XqM80CVXZ5ZKrDdZcYOJt3X64uU6W3OP6Z0D7AZU0,1663
|
6
|
-
ftag/mock.py,sha256=9V6sAT4_t-rhR67q9KHaj1NKAeqU7lQjWxiOxEzk8Sw,4338
|
7
|
-
ftag/region.py,sha256=ANv0dGI2W6NJqD9fp7EfqAUReH4FOjc1gwl_Qn8llcM,360
|
8
|
-
ftag/sample.py,sha256=TFXMhDkbPmjkms9-b-bINJ32T3bO86JcU70C0nY7wa8,2500
|
9
|
-
ftag/transform.py,sha256=uEGGJSnqoKOzLYQv650XdK_kDNw4Aw-5dc60z9Dp_y0,3963
|
10
|
-
ftag/vds.py,sha256=nRViQZQIORB95nC7NZsW3KsSoGkLzEdOsuCViH5h8-U,3296
|
11
|
-
ftag/hdf5/__init__.py,sha256=LFDNxVOCp58SvLHwQhdT68Q-KBMS_i6jBrbXoRpHzbM,354
|
12
|
-
ftag/hdf5/h5move.py,sha256=1I4V6hUu2cPZbsvIPPpcjBWW96w286U9VOt_PbcHr9Q,881
|
13
|
-
ftag/hdf5/h5reader.py,sha256=et-_LXt942xegqc14bPapUgIO7MUfC2m04uJslLkXxI,13579
|
14
|
-
ftag/hdf5/h5split.py,sha256=qvZzZTBHYOjHDbiuoPZpJv-YK_4wmkVDryBU6iBle9I,2505
|
15
|
-
ftag/hdf5/h5utils.py,sha256=-4zKTMtNCrDZr_9Ww7uzfsB7M7muBKpmm_1IkKJnHOI,3222
|
16
|
-
ftag/hdf5/h5writer.py,sha256=wVyurIgfSBtvZTX-v0v3R5-8JOwWK_yF1rUX-RewXzY,4826
|
17
|
-
ftag/wps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
ftag/wps/discriminant.py,sha256=J2Cst9slZCLoHZYTeltQSmN1Uoa8GUX529rwNlHmyfI,3519
|
19
|
-
ftag/wps/working_points.py,sha256=0XrA-h6M3mdn5qwkdoizQtAhmrUxbKV22l4sBfVoxAE,9692
|
20
|
-
atlas_ftag_tools-0.1.19.dist-info/METADATA,sha256=lCWhyEJI8HG1hj_8oQRza_7tESH-_XuCnOLdChZAY4Q,5169
|
21
|
-
atlas_ftag_tools-0.1.19.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
22
|
-
atlas_ftag_tools-0.1.19.dist-info/entry_points.txt,sha256=LfVLsZHQolqbPnwPgtmc5IQTh527BKkN2v-IpXWTNHw,137
|
23
|
-
atlas_ftag_tools-0.1.19.dist-info/top_level.txt,sha256=qiYQuKcAvMim-31FwkT3MTQu7WQm0s58tPAia5KKWqs,5
|
24
|
-
atlas_ftag_tools-0.1.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|