ATLAS Offline Software
Loading...
Searching...
No Matches
python.EventSelectionConfigEventVar_unitTest.TestEventVar Class Reference
Inheritance diagram for python.EventSelectionConfigEventVar_unitTest.TestEventVar:
Collaboration diagram for python.EventSelectionConfigEventVar_unitTest.TestEventVar:

Public Member Functions

 test_float_default (self)
 test_explicit_int (self)
 test_explicit_double (self)
 test_negative_threshold (self)
 test_all_signs (self)
 test_bad_type_raises (self)
 test_bad_argcount_raises (self)
 test_chains_after_other_cuts (self)

Detailed Description

Definition at line 13 of file EventSelectionConfigEventVar_unitTest.py.

Member Function Documentation

◆ test_all_signs()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_all_signs ( self)

Definition at line 36 of file EventSelectionConfigEventVar_unitTest.py.

36 def test_all_signs(self):
37 for sym, enum in [("<", "LT"), (">", "GT"), ("==", "EQ"), (">=", "GE"), ("<=", "LE")]:
38 with self.subTest(sign=sym):
39 alg = named(run(f"EVENTVAR float score {sym} 0.5"), "EVENTVAR")[0]
40 self.assertEqual(prop(alg, "sign"), enum)
41
int run(int argc, char *argv[])

◆ test_bad_argcount_raises()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_bad_argcount_raises ( self)

Definition at line 45 of file EventSelectionConfigEventVar_unitTest.py.

45 def test_bad_argcount_raises(self):
46 self.assertRaises(ValueError, run, "EVENTVAR float score > 0.5 extra")
47 self.assertRaises(ValueError, run, "EVENTVAR score > 0.5")
48

◆ test_bad_type_raises()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_bad_type_raises ( self)

Definition at line 42 of file EventSelectionConfigEventVar_unitTest.py.

42 def test_bad_type_raises(self):
43 self.assertRaises(ValueError, run, "EVENTVAR complex score > 0.5")
44

◆ test_chains_after_other_cuts()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_chains_after_other_cuts ( self)

Definition at line 49 of file EventSelectionConfigEventVar_unitTest.py.

49 def test_chains_after_other_cuts(self):
50 algs = run("JET_N 30000 >= 2\nEVENTVAR float dnn > 0.8",
51 containers={"jets": "AnaJets"})
52 ev = [a for a in algs if a.getType() == "CP::EventScalarSelectorAlg"][0]
53 self.assertIn("NJET_1", prop(ev, "eventPreselection"))
54
55

◆ test_explicit_double()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_explicit_double ( self)

Definition at line 27 of file EventSelectionConfigEventVar_unitTest.py.

27 def test_explicit_double(self):
28 alg = named(run("EVENTVAR double ht > 300000.0"), "EVENTVAR")[0]
29 self.assertEqual(prop(alg, "doubleVariable"), "ht_%SYS%")
30

◆ test_explicit_int()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_explicit_int ( self)

Definition at line 21 of file EventSelectionConfigEventVar_unitTest.py.

21 def test_explicit_int(self):
22 alg = named(run("EVENTVAR int n_jets >= 5"), "EVENTVAR")[0]
23 self.assertEqual(prop(alg, "intVariable"), "n_jets_%SYS%")
24 self.assertEqual(prop(alg, "floatVariable", ""), "")
25 self.assertEqual(prop(alg, "sign"), "GE")
26

◆ test_float_default()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_float_default ( self)

Definition at line 14 of file EventSelectionConfigEventVar_unitTest.py.

14 def test_float_default(self):
15 alg = named(run("EVENTVAR float dnn_score > 0.5"), "EVENTVAR")[0]
16 self.assertEqual(alg.getType(), "CP::EventScalarSelectorAlg")
17 self.assertEqual(prop(alg, "floatVariable"), "dnn_score_%SYS%")
18 self.assertEqual(prop(alg, "sign"), "GT")
19 self.assertEqual(prop(alg, "refValue"), 0.5)
20

◆ test_negative_threshold()

python.EventSelectionConfigEventVar_unitTest.TestEventVar.test_negative_threshold ( self)

Definition at line 31 of file EventSelectionConfigEventVar_unitTest.py.

31 def test_negative_threshold(self):
32 alg = named(run("EVENTVAR float bdt_score > -0.2"), "EVENTVAR")[0]
33 self.assertEqual(prop(alg, "floatVariable"), "bdt_score_%SYS%")
34 self.assertEqual(prop(alg, "refValue"), -0.2)
35

The documentation for this class was generated from the following file: