Belle II Software  release-06-00-14
test_trackIsolationVariables.py
1 
8 import basf2 as b2
9 import modularAnalysis as ma
10 import stdCharged as stdc
11 import b2test_utils
12 
13 path = b2.create_path()
14 
16 b2.set_random_seed("1337")
17 
18 ma.inputMdstList("default",
19  filelist=[b2test_utils.require_file("mdst14.root", "validation")],
20  entrySequences=["0:1"],
21  path=path)
22 
23 ntup_vars = []
24 for det in ("CDC", "PID", "ECL", "KLM"):
25  ntup_vars.extend([f"dist3DToClosestTrkAtSurface{det}", f"dist2DRhoPhiToClosestTrkAtSurface{det}"])
26 
27 
28 for ptype in stdc._chargednames:
29 
30  # Note that this is just to test module behaviour against different user's input:
31  # in fact, for any choice of particle list's charge, the charge-conjugated one
32  # gets loaded automatically.
33  for ch in ("+", "-"):
34 
35  # Protons are a bit special...
36  if ptype == "p" and ch == "-":
37  ptype = f"anti-{ptype}"
38 
39  pname = f"{ptype}{ch}:all"
40  ma.fillParticleList(pname, "", path=path)
41 
42  ma.calculateTrackIsolation(pname,
43  path,
44  "CDC", "PID", "ECL", "KLM",
45  alias="dist3DToClosestTrkAtSurface")
46  ma.calculateTrackIsolation(pname,
47  path,
48  "CDC", "PID", "ECL", "KLM",
49  use2DRhoPhiDist=True,
50  alias="dist2DRhoPhiToClosestTrkAtSurface")
51 
52  ma.printList(pname, full=True, path=path)
53  ma.printVariableValues(pname, ntup_vars, path=path)
54 
55  ma.variablesToNtuple(pname,
56  ntup_vars,
57  treename=f"{ptype}{ch}",
58  filename="TrackIsolationVariables.root", path=path)
59 
61  with b2test_utils.set_loglevel(b2.LogLevel.INFO):
62  b2.process(path)
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:106
def set_loglevel(loglevel)
Definition: __init__.py:77
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54
def clean_working_directory()
Definition: __init__.py:185