15import modularAnalysis
as ma
19from vertex
import kFit
20from b2biiConversion
import convertBelleMdstToBelleIIMdst
21from b2biiMonitors
import addBeamParamsConversionMonitors
22from b2biiMonitors
import addTrackConversionMonitors
23from b2biiMonitors
import addNeutralsConversionMonitors
25os.environ[
'USE_GRAND_REPROCESS_DATA'] =
'1'
26os.environ[
'PGUSER'] =
'g0db'
31 basf2.B2WARNING(
"In the beginning of an analysis it is recommended to study the monitoring histograms.\n"
32 "These tell you if the conversion works as expected.\n"
33 "If you want to create them, just provide any argument to this script.")
37print(
'BELLE2_EXTERNALS_DIR = ' + str(os.getenv(
'BELLE2_EXTERNALS_DIR')))
38print(
'BELLE2_EXTERNALS_SUBDIR = ' + str(os.getenv(
'BELLE2_EXTERNALS_SUBDIR')))
39print(
'BELLE2_EXTERNALS_OPTION = ' + str(os.getenv(
'BELLE2_EXTERNALS_OPTION')))
40print(
'BELLE2_EXTERNALS_VERSION = ' + str(os.getenv(
'BELLE2_EXTERNALS_VERSION')))
41print(
'BELLE2_LOCAL_DIR = ' + str(os.getenv(
'BELLE2_LOCAL_DIR')))
42print(
'BELLE2_RELEASE = ' + str(os.getenv(
'BELLE2_RELEASE')))
43print(
'BELLE2_OPTION = ' + str(os.getenv(
'BELLE2_OPTION')))
44print(
'BELLE_POSTGRES_SERVER = ' + str(os.getenv(
'BELLE_POSTGRES_SERVER')))
45print(
'USE_GRAND_REPROCESS_DATA = ' + str(os.getenv(
'USE_GRAND_REPROCESS_DATA')))
46print(
'PANTHER_TABLE_DIR = ' + str(os.getenv(
'PANTHER_TABLE_DIR')))
47print(
'PGUSER = ' + str(os.getenv(
'PGUSER')))
50mypath = basf2.create_path()
51inputfile = basf2.find_file(
'b2bii_input_evtgen_exp_07_BptoD0pip-D0toKpipi0-0.mdst',
'examples',
False)
52convertBelleMdstToBelleIIMdst(inputfile, path=mypath)
57 addBeamParamsConversionMonitors(path=mypath)
58 addTrackConversionMonitors(path=mypath)
59 addNeutralsConversionMonitors(path=mypath)
65ma.fillParticleList(
'pi+:all',
'', path=mypath)
66ma.fillParticleList(
'K+:all',
'', path=mypath)
67ma.fillParticleList(
'mu+:all',
'', path=mypath)
68ma.fillParticleList(
'e+:all',
'', path=mypath)
72ma.matchMCTruth(
'pi0:mdst', path=mypath)
73ma.printVariableValues(
'gamma:mdst', [
'mcPDG',
'E',
'clusterE9E25'], path=mypath)
74ma.printVariableValues(
'pi0:mdst', [
'mcPDG',
'p',
'M',
'InvM'], path=mypath)
81ma.cutAndCopyList(
'K_S0:good',
'K_S0:mdst', cut=
'goodBelleKshort', path=mypath)
85kFit(
'K_S0:good', 0, path=mypath)
88ma.matchMCTruth(
'K_S0:good', path=mypath)
89ma.printVariableValues(
'K_S0:good', [
'mcPDG',
'M',
'InvM',
'p',
'px',
'py',
'pz',
90 'extraInfo(goodKs)',
'extraInfo(ksnbVLike)',
'extraInfo(ksnbNoLam)'], path=mypath)
93va.variables.addAlias(
'Lkpi',
'atcPIDBelle(3,2)')
94va.variables.addAlias(
'Lppi',
'atcPIDBelle(4,2)')
95va.variables.addAlias(
'Lpk',
'atcPIDBelle(4,3)')
101ma.printVariableValues(
'pi+:all', [
'mcPDG',
'p',
'Lkpi',
'Lppi',
'muIDBelle',
102 'muIDBelleQuality',
'eIDBelle',
'nSVDHits'], path=mypath)
105ma.reconstructDecay(
'D0:Kpipi0 -> K-:all pi+:all pi0:mdst',
'1.7 < M < 2.0', path=mypath)
106ma.reconstructDecay(
'B+:D0pi -> anti-D0:Kpipi0 pi+:all',
'4.8 < M < 5.5', path=mypath)
108ma.matchMCTruth(
'B+:D0pi', path=mypath)
111kinematics_and_truth = vc.kinematics + vc.mc_truth
112variables = vu.create_aliases_for_selected(kinematics_and_truth,
'^B+ -> [ ^D0 -> ^K- ^pi+ ^pi0] ^pi+')
114belle1pid = [
'eIDBelle',
'muIDBelleQuality',
'muIDBelle',
'Lkpi',
'Lppi',
'Lpk']
115variables += vu.create_aliases_for_selected(belle1pid,
'B+ -> [ D0 -> ^K- ^pi+ pi0] ^pi+')
117ma.variablesToNtuple(
'B+:D0pi', variables, filename=
'B2BII_ConvertAndReconstruct_Example.root', path=mypath)
120mypath.add_module(
'Progress')
125print(basf2.statistics)