4 """This script is used in the nightly build to check for memory issues with valgrind.
5 It is run as a test to make sure the memcheck does not fail because of issues in the script."""
7 from b2test_utils
import skip_test_if_light
10 from basf2
import set_random_seed, set_log_level, LogLevel, create_path, Module, find_file, process, statistics
11 from simulation
import add_simulation
12 from L1trigger
import add_tsim
13 from reconstruction
import add_reconstruction, add_mdst_output
14 from ROOT
import Belle2
15 from modularAnalysis
import reconstructDecay, rankByHighest, buildRestOfEvent, buildContinuumSuppression, matchMCTruth, \
17 from stdCharged
import stdPi, stdMu
18 from vertex
import treeFit, TagV
19 from flavorTagger
import flavorTagger
20 from rawdata
import add_packers, add_unpackers
29 set_log_level(LogLevel.ERROR)
35 main.add_module(
'EventInfoSetter')
39 """Module to stop the event processing in case the argument InitOnly is given"""
42 """Set the event meta data to end of data"""
45 eventMetaData.setEndOfData()
48 if len(sys.argv) > 1
and sys.argv[1] ==
'InitOnly':
52 evtmetainfo = main.add_module(
'EventInfoPrinter')
53 evtmetainfo.set_log_level(LogLevel.INFO)
56 main.add_module(
'EvtGenInput', userDECFile=find_file(
'decfiles/dec/1111440100.dec'))
60 if 'BELLE2_BACKGROUND_DIR' in os.environ:
61 bg = glob.glob(os.environ[
'BELLE2_BACKGROUND_DIR'] +
'/*.root')
62 add_simulation(main, bkgfiles=bg)
68 add_reconstruction(main)
71 add_mdst_output(main,
True)
74 main.add_module(
'RootOutput', outputFileName=
'dst.root')
78 stdPi(
'loose', path=main)
79 stdMu(
'loose', path=main)
82 reconstructDecay(
'K_S0:pipi -> pi+:loose pi-:loose', cut=
'0.4 < M < 0.6', path=main)
85 reconstructDecay(
'J/psi:mumu -> mu+:loose mu-:loose', cut=
'3.0 < M < 3.2', path=main)
88 reconstructDecay(
'B0:jpsiks -> J/psi:mumu K_S0:pipi', cut=
'5.2 < M < 5.4', path=main)
91 treeFit(
'B0:jpsiks', 0.0, path=main)
94 rankByHighest(
'B0:jpsiks',
'chiProb', path=main)
97 buildRestOfEvent(
'B0:jpsiks', path=main)
100 buildContinuumSuppression(
'B0:jpsiks',
'', path=main)
103 matchMCTruth(
'B0:jpsiks', path=main)
109 TagV(
'B0:jpsiks',
'breco', path=main)
112 fs_vars = [
'kaonID',
'muonID',
'dr',
'dz',
'pValue',
'isSignal',
'mcErrors',
'genMotherID']
113 b_vars = [
'nTracks',
'Mbc',
'deltaE',
'p',
'E',
'useCMSFrame(p)',
'useCMSFrame(E)',
114 'isSignal',
'mcErrors',
'nROE_KLMClusters',
'qrOutput(FBDT)',
'TagVLBoost',
'TagVz',
'TagVzErr',
'mcDeltaT'] + \
115 [
'daughter(0,daughter(0,%s))' % var
for var
in fs_vars]
118 variablesToNtuple(
'B0:jpsiks', variables=b_vars, filename=
'ntuple.root', treename=
'B0tree', path=main)
123 for module
in main.modules():
124 if module.type() ==
'SVDUnpacker':
125 module.param(
'silentlyAppend',
True)
128 main.add_module(
'Profile', outputFileName=
'vmem_profile.png', rssOutputFileName=
'rss_profile.png').set_log_level(LogLevel.INFO)