8 import modularAnalysis
as ma
12 from vertex
import kFit
13 from b2biiConversion
import convertBelleMdstToBelleIIMdst
14 from b2biiMonitors
import addBeamParamsConversionMonitors
15 from b2biiMonitors
import addTrackConversionMonitors
16 from b2biiMonitors
import addNeutralsConversionMonitors
18 os.environ[
'USE_GRAND_REPROCESS_DATA'] =
'1'
19 os.environ[
'PGUSER'] =
'g0db'
23 if len(sys.argv) == 1:
24 basf2.B2WARNING(
"In the beginning of an analysis it is recommended to study the monitoring histograms.\n"
25 "These tell you if the conversion works as expected.\n"
26 "If you want to create them, just provide any argument to this script.")
30 print(
'BELLE2_EXTERNALS_DIR = ' + str(os.getenv(
'BELLE2_EXTERNALS_DIR')))
31 print(
'BELLE2_EXTERNALS_SUBDIR = ' + str(os.getenv(
'BELLE2_EXTERNALS_SUBDIR')))
32 print(
'BELLE2_EXTERNALS_OPTION = ' + str(os.getenv(
'BELLE2_EXTERNALS_OPTION')))
33 print(
'BELLE2_EXTERNALS_VERSION = ' + str(os.getenv(
'BELLE2_EXTERNALS_VERSION')))
34 print(
'BELLE2_LOCAL_DIR = ' + str(os.getenv(
'BELLE2_LOCAL_DIR')))
35 print(
'BELLE2_RELEASE = ' + str(os.getenv(
'BELLE2_RELEASE')))
36 print(
'BELLE2_OPTION = ' + str(os.getenv(
'BELLE2_OPTION')))
37 print(
'BELLE_POSTGRES_SERVER = ' + str(os.getenv(
'BELLE_POSTGRES_SERVER')))
38 print(
'USE_GRAND_REPROCESS_DATA = ' + str(os.getenv(
'USE_GRAND_REPROCESS_DATA')))
39 print(
'PANTHER_TABLE_DIR = ' + str(os.getenv(
'PANTHER_TABLE_DIR')))
40 print(
'PGUSER = ' + str(os.getenv(
'PGUSER')))
43 mypath = basf2.create_path()
44 inputfile = basf2.find_file(
'b2bii_input_evtgen_exp_07_BptoD0pip-D0toKpipi0-0.mdst',
'examples',
False)
45 convertBelleMdstToBelleIIMdst(inputfile, path=mypath)
50 addBeamParamsConversionMonitors(path=mypath)
51 addTrackConversionMonitors(path=mypath)
52 addNeutralsConversionMonitors(path=mypath)
58 ma.fillParticleList(
'pi+:all',
'', path=mypath)
59 ma.fillParticleList(
'K+:all',
'', path=mypath)
60 ma.fillParticleList(
'mu+:all',
'', path=mypath)
61 ma.fillParticleList(
'e+:all',
'', path=mypath)
65 ma.matchMCTruth(
'pi0:mdst', path=mypath)
66 ma.printVariableValues(
'gamma:mdst', [
'mcPDG',
'E',
'clusterE9E25'], path=mypath)
67 ma.printVariableValues(
'pi0:mdst', [
'mcPDG',
'p',
'M',
'InvM'], path=mypath)
74 ma.cutAndCopyList(
'K_S0:good',
'K_S0:mdst', cut=
'goodBelleKshort', path=mypath)
78 kFit(
'K_S0:good', 0, path=mypath)
81 ma.matchMCTruth(
'K_S0:good', path=mypath)
82 ma.printVariableValues(
'K_S0:good', [
'mcPDG',
'M',
'InvM',
'p',
'px',
'py',
'pz',
83 'extraInfo(goodKs)',
'extraInfo(ksnbVLike)',
'extraInfo(ksnbNoLam)'], path=mypath)
86 va.variables.addAlias(
'Lkpi',
'atcPIDBelle(3,2)')
87 va.variables.addAlias(
'Lppi',
'atcPIDBelle(4,2)')
88 va.variables.addAlias(
'Lpk',
'atcPIDBelle(4,3)')
94 ma.printVariableValues(
'pi+:all', [
'mcPDG',
'p',
'Lkpi',
'Lppi',
'muIDBelle',
95 'muIDBelleQuality',
'eIDBelle',
'nSVDHits'], path=mypath)
98 ma.reconstructDecay(
'D0:Kpipi0 -> K-:all pi+:all pi0:mdst',
'1.7 < M < 2.0', path=mypath)
99 ma.reconstructDecay(
'B+:D0pi -> anti-D0:Kpipi0 pi+:all',
'4.8 < M < 5.5', path=mypath)
101 ma.matchMCTruth(
'B+:D0pi', path=mypath)
104 kinematics_and_truth = vc.kinematics + vc.mc_truth
105 variables = vu.create_aliases_for_selected(kinematics_and_truth,
'^B+ -> [ ^D0 -> ^K- ^pi+ ^pi0] ^pi+')
107 belle1pid = [
'eIDBelle',
'muIDBelleQuality',
'muIDBelle',
'Lkpi',
'Lppi',
'Lpk']
108 variables += vu.create_aliases_for_selected(belle1pid,
'B+ -> [ D0 -> ^K- ^pi+ pi0] ^pi+')
110 ma.variablesToNtuple(
'B+:D0pi', variables, filename=
'B2BII_ConvertAndReconstruct_Example.root', path=mypath)
113 mypath.add_module(
'Progress')
118 print(basf2.statistics)