15 Example script to calculate track isolation variables.
17 For each particle's track in the input charged stable particle list,
18 calculate the minimal distance to the other candidates' tracks at a given detector entry surface.
28 import stdCharged
as stdc
30 parser = argparse.ArgumentParser(description=__doc__,
31 formatter_class=argparse.RawTextHelpFormatter)
33 parser.add_argument(
"--std_charged",
35 choices=stdc._chargednames,
37 help=
"The base name of the standard charged particle list to consider.")
38 parser.add_argument(
"--detectors",
41 default=[
"CDC",
"PID",
"ECL",
"KLM"],
42 choices=[
"CDC",
"PID",
"ECL",
"KLM"],
43 help=
"List of detectors at whose entry surface track isolation variables will be calculated.\n"
44 "Pass a space-separated list of names.\n"
45 "NB: 'PID' indicates TOP+ARICH entry surface.")
46 parser.add_argument(
"-d",
"--debug",
50 choices=list(range(11, 20)),
51 help=
"Run the TrackIsoCalculator module in debug mode. Pass the desired DEBUG level integer.")
56 if __name__ ==
"__main__":
62 args = argparser().parse_args()
65 import modularAnalysis
as ma
68 path = b2.create_path()
71 ma.inputMdstList(
"default", filelist=[b2.find_file(
"mdst14.root",
"validation")], path=path)
75 plist_name = f
"{args.std_charged}+:my_std_charged"
76 ma.fillParticleList(plist_name,
"", path=path)
77 ma.applyCuts(plist_name,
"abs(dr) < 2.0 and abs(dz) < 5.0 and p > 0.1", path=path)
80 ma.calculateTrackIsolation(plist_name,
83 alias=
"dist3DToClosestTrkAtSurface")
85 ma.calculateTrackIsolation(plist_name,
89 alias=
"dist2DRhoPhiToClosestTrkAtSurface")
92 ntup_vars = [f
"dist3DToClosestTrkAtSurface{det}" for det
in args.detectors]
93 ntup_vars += [f
"dist2DRhoPhiToClosestTrkAtSurface{det}" for det
in args.detectors]
96 ma.variablesToNtuple(plist_name,
98 treename=args.std_charged,
99 filename=
"TrackIsolationVariables.root",
104 for m
in path.modules():
105 if "TrackIsoCalculator" in m.name():
106 m.set_log_level(b2.LogLevel.DEBUG)
107 m.set_debug_level(args.debug)
109 path.add_module(
"Progress")