13 print(
"Usage: {} [bbbrem|bhwide|bhwide_largeangle]".format(sys.argv[0]), file=sys.stderr)
16generator = sys.argv[1].lower()
18kill = basf2.create_path()
19main = basf2.create_path()
20main.add_module(
"EventInfoSetter", expList=0, runList=1, evtNumList=1000000)
21main.add_module(
"EventInfoPrinter")
23basf2.set_log_level(basf2.LogLevel.DEBUG)
24basf2.set_debug_level(250)
25basf2.logging.package(
"framework").log_level = basf2.LogLevel.WARNING
28def add_cut(name, minParticles, maxParticles, minTheta, maxTheta=None):
29 """Add a generator level cut and kill the event if the cut is not passed. In
30 this case the cut is on the min/max charged particles which have a
31 center-of-mass theta angle between minTheta
and maxTheta. If maxTheta
is not
32 given assume it to be 180-minTheta
for a symmetric window
"""
36 maxTheta = 180 - minTheta
37 selection = main.add_module(
"GeneratorPreselection", applyInCMS=
True, nChargedMin=minParticles, nChargedMax=maxParticles,
38 MinChargedTheta=minTheta, MaxChargedTheta=maxTheta, MinChargedP=0., MinChargedPt=0.)
39 selection.if_value(
"!=11", kill)
40 selection.set_name(
"generator cut: " + name)
43if generator ==
"bbbrem":
44 main.add_module(
"BBBremInput", MinPhotonEnergyFraction=0.000001, Unweighted=
True, MaxWeight=1.57001e+07)
46 add_cut(
"at least one track below 0.5 degree", 0, 1, 0.5)
47elif generator ==
"bhwide":
48 main.add_module(
"BHWideInput", ScatteringAngleRangeElectron=[0.5, 179.5], ScatteringAngleRangePositron=[0.5, 179.5])
49 add_cut(
"both tracks at least 0.5 degree", 2, 2, 0.5)
52 add_cut(
"max one track in 1-170", 0, 1, 1, 170)
53 add_cut(
"max one track in 10-179", 0, 1, 10, 179)
54elif generator ==
"bhwide_largeangle":
55 main.add_module(
"BHWideInput", ScatteringAngleRangeElectron=[0.5, 179.5], ScatteringAngleRangePositron=[0.5, 179.5])
56 add_cut(
"both tracks at least 1 degree", 2, 2, 1)
57 add_cut(
"at least one 10 degree", 1, 2, 10)
59 print(
"unknown generation setting: {}".format(generator))
61main.add_module(
"Progress")
62main.add_module(
"RootOutput", outputFileName=
"%s.root" % generator)
64print(basf2.statistics)