from basf2 import *
from modularAnalysis import generateY4S
from modularAnalysis import analysis_main
from simulation import add_simulation
from reconstruction import add_reconstruction
from reconstruction import add_mdst_output
from ROOT import Belle2
import glob

# generate signal MC
generateY4S(
    100,
    Belle2.FileSystem.findFile(
        '../dec_files/B0_etapr-eta-gg2pi_KS-pi+pi-.dec'
        #'../dec_files/B0_etapr-eta-gg2pi_KS-pi0pi0.dec'
        #'../dec_files/B0_etapr-eta-gg2pi_KL.dec'
        #'../dec_files/B0_etapr-eta-3pi2pi_KS-pi+pi-.dec'
        #'../dec_files/B0_etapr-eta-3pi2pi_KS-pi0pi0.dec'
    ))

# simulation
add_simulation(analysis_main)  # WITHOUT beam background

# reconstruction
add_reconstruction(analysis_main)

# dump in MDST format
add_mdst_output(
    analysis_main, True, 'B0_etapr-eta-gg2pi_KS-pi+pi-_gsim-BKGx0.root'
    #'B0_etapr-eta-gg2pi_KS-pi0pi0_gsim-BKGx0.root'
Пример #2
0
#######################################################                                                                                     #
#
# Adapted from B2A104 tutorial
#
# Author: A.Gaz
#
######################################################

from basf2 import *
from modularAnalysis import generateY4S
from modularAnalysis import loadGearbox
from modularAnalysis import analysis_main
from reconstruction import add_mdst_output
from ROOT import Belle2

# generate signal MC
generateY4S(1000000, Belle2.FileSystem.findFile('../dec_files/genericBBbar.dec'))

# dump in MDST format
add_mdst_output(analysis_main, True,
                'Gen_bbar_gsim-BKGx1-1M.root')

# if simulation/reconstruction scripts are not added than one needs to load gearbox
loadGearbox()

# Process the events
process(analysis_main)

# print out the summary
print statistics
Пример #3
0
if len(sys.argv)==2:
	filename = sys.argv[1]

if os.path.isfile(filename):
	sys.exit('Required input file does exist. ')

add_beamparameters(analysis_main, 'Y4S')

# generation of 100 events according to the specified DECAY table
# Y(4S) -> Btag- Bsig+
# Btag- -> D0 pi-; D0 -> K- pi+
# Bsig+ -> mu+ nu_mu
#
# generateY4S function is defined in analysis/scripts/modularAnalysis.py
#generateY4S(1000, 'Y4SEventGeneration.dec')
generateY4S(5000, 'mydec-k-cpmix.dec')

# If the simulation and reconstruction is not performed in the sam job,
# then the Gearbox needs to be loaded with the loadGearbox() function.
loadGearbox()

# dump generated events in MDST format to the output ROOT file
#
# add_mdst_output function is defined in reconstruction/scripts/reconstruction.py
add_mdst_output(analysis_main, True, filename)
printPrimaryMCParticles()

# process all modules added to the analysis_main path
# (note: analysis_main is the default path created in the modularAnapys.py)
process(analysis_main)
    sys.exit('\n Usage: basf2 GenSimAndReco-withoutBeamBkg.py `output file name`.\n\n'
    )

outFile = str(sys.argv[1])

from basf2 import *
from modularAnalysis import generateY4S
from modularAnalysis import analysis_main
from simulation import add_simulation
from reconstruction import add_reconstruction
from reconstruction import add_mdst_output
from ROOT import Belle2
import glob

# generate signal MC
generateY4S(10000, Belle2.FileSystem.findFile('../dec_files/B0_phi-K+K-_KS-pi+pi-.dec'))

# simulation
add_simulation(analysis_main)      # WITHOUT beam background

# reconstruction
add_reconstruction(analysis_main)

# dump in MDST format
add_mdst_output(analysis_main, True, outFile)

# Process the events
process(analysis_main)

# print out the summary
print (statistics)
Пример #5
0
#
# Author: A.Gaz
#
######################################################

from basf2 import *
from modularAnalysis import generateY4S
from modularAnalysis import analysis_main
from simulation import add_simulation
from reconstruction import add_reconstruction
from reconstruction import add_mdst_output
from ROOT import Belle2

# generate signal MC
generateY4S(
    10000,
    Belle2.FileSystem.findFile('../dec_files/B0_phi-K+K-_KS-pi+pi-.dec'))

bkgdir = '/sw/belle2/bkg/'
bkgFiles = [bkgdir + '*.root']

# simulation
add_simulation(analysis_main, None, bkgFiles)  # WITH beam background

# reconstruction
add_reconstruction(analysis_main)

# dump in MDST format
add_mdst_output(analysis_main, True, 'B0_Phi-KK_Ks-pi+pi-_gsim-BKGx1.root')

# Process the events
Пример #6
0
if args.decay_file:
    print("Input file set to:\t" + args.decay_file)
print("Trained model loaded:\t" + str(args.model))
print("Number of events to generate:\t" + str(args.num_events))

# Need to fetch output directory from basf2 -o flag and create it

main = b2.create_path()

# ma.setupEventInfo(args.num_events, path=main)
# Need to input decay file with Y4S -> B0 B0 if I want mixed bkg?
if args.decay_file:
    # add_evtgen_generator(main, 'signal', args.decay_file)
    # Deprecated
    ma.generateY4S(noEvents=args.num_events,
                   decayTable=args.decay_file,
                   path=main)
else:
    # Annoying, need to add flag for this shit now
    # add_evtgen_generator(main, 'mixed')
    ma.generateY4S(noEvents=args.num_events, path=main)

# Override event number -- use skip-events flag for basf2 instead -- easy in htcondor
# set_module_parameters(path=main, name='EventInfoSetter', recursive=False, runList=[0], expList=[0])

NNApplyModule_m = NNApplyModule(model_file=args.model[0],
                                model_type=args.model_type[0],
                                threshold=args.threshold,
                                extra_info_var='smartBKG')
dead_path = b2.create_path()
NNApplyModule_m.if_false(dead_path)