ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
EventSelectionAlgorithms
python
EventSelectionConfigGhost_unitTest.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
"""Unit tests for JET_N_GHOST and LJET_N_GHOST: ghost mapping, veto, pT form."""
4
5
import
unittest
6
from
EventSelectionAlgorithms.EventSelectionConfigTestSupport
import
run, named, prop
7
8
9
class
TestGhost
(unittest.TestCase):
10
def
test_ghost_basic
(self):
11
for
kw, opt, val, tag
in
[(
"JET_N_GHOST"
,
"jets"
,
"AnaJets"
,
"NJETGHOST"
),
12
(
"LJET_N_GHOST"
,
"largeRjets"
,
"AnaLRJets"
,
"NLJETGHOST"
)]:
13
with
self.subTest(kw=kw):
14
algs = named(
run
(f
"{kw} B >= 1"
, containers={opt: val}), tag)
15
self.assertEqual(len(algs), 1)
16
self.assertEqual(algs[0].getType(),
"CP::JetNGhostSelectorAlg"
)
17
self.assertEqual(prop(algs[0],
"ghost"
),
"GhostBHadronsFinalCount"
)
18
self.assertEqual(prop(algs[0],
"count"
), 1)
19
20
def
test_ghost_with_veto
(self):
21
algs = named(
run
(
"JET_N_GHOST B!C >= 1"
, containers={
"jets"
:
"AnaJets"
}),
"NJETGHOST"
)
22
self.assertEqual(prop(algs[0],
"ghost"
),
"GhostBHadronsFinalCount"
)
23
self.assertEqual(prop(algs[0],
"veto"
),
"GhostCHadronsFinalCount"
)
24
25
def
test_ghost_with_minpt_5arg
(self):
26
algs = named(
run
(
"JET_N_GHOST B 30000 >= 1"
, containers={
"jets"
:
"AnaJets"
}),
"NJETGHOST"
)
27
self.assertEqual(prop(algs[0],
"minPt"
), 30000.0)
28
self.assertEqual(prop(algs[0],
"count"
), 1)
29
30
def
test_ghost_wrong_argcount
(self):
31
self.assertRaises(ValueError, run,
"JET_N_GHOST B 30000 >= 1 extra"
,
32
containers={
"jets"
:
"AnaJets"
})
33
34
35
if
__name__ ==
"__main__"
:
36
unittest.main()
python.EventSelectionConfigGhost_unitTest.TestGhost
Definition
EventSelectionConfigGhost_unitTest.py:9
python.EventSelectionConfigGhost_unitTest.TestGhost.test_ghost_with_minpt_5arg
test_ghost_with_minpt_5arg(self)
Definition
EventSelectionConfigGhost_unitTest.py:25
python.EventSelectionConfigGhost_unitTest.TestGhost.test_ghost_basic
test_ghost_basic(self)
Definition
EventSelectionConfigGhost_unitTest.py:10
python.EventSelectionConfigGhost_unitTest.TestGhost.test_ghost_with_veto
test_ghost_with_veto(self)
Definition
EventSelectionConfigGhost_unitTest.py:20
python.EventSelectionConfigGhost_unitTest.TestGhost.test_ghost_wrong_argcount
test_ghost_wrong_argcount(self)
Definition
EventSelectionConfigGhost_unitTest.py:30
run
int run(int argc, char *argv[])
Definition
ttree2hdf5.cxx:28
Generated on
for ATLAS Offline Software by
1.17.0