Belle II Software  release-08-01-10
LowEnergyPi0Identification.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
14 
15 import argparse
16 import basf2
17 import b2biiConversion
18 import modularAnalysis as ma
19 import variables.collections as vc
20 from variables import variables
21 
22 # Arguments.
23 parser = argparse.ArgumentParser()
24 parser.add_argument('--belle1', action='store_true',
25  help='Belle 1 data analysis.')
26 arguments = parser.parse_args()
27 
28 # Create path.
29 analysis_path = basf2.create_path()
30 
31 # Load input file.
32 if arguments.belle1:
34  basf2.find_file('analysis/mdstBelle1_exp65_charged.root', 'validation'),
35  path=analysis_path)
36 else:
37  ma.inputMdst(filename=basf2.find_file("mdst14.root", "validation"),
38  path=analysis_path)
39 
40 # Reconstruction of photons.
41 gamma_list = 'gamma:all'
42 ma.fillParticleList(gamma_list, '', path=analysis_path)
43 
44 # Reconstruction of pi0.
45 mass_window = 0.02
46 mass_cut = f'abs(dM) < {mass_window}'
47 ma.cutAndCopyList('gamma:pi0', gamma_list, 'E > 0.02', path=analysis_path)
48 # Belle 1 has pi0:mdst, but reconstruct pi0 again to avoid preliminary cuts.
49 pi0_list = 'pi0:gamma'
50 ma.reconstructDecay('pi0:gamma -> gamma:pi0 gamma:pi0', mass_cut,
51  path=analysis_path)
52 if arguments.belle1:
53  payload_name_suffix = 'Belle1'
54  tag = ma.getAnalysisGlobaltagB2BII()
55 else:
56  payload_name_suffix = 'Belle2Release5'
57  tag = ma.getAnalysisGlobaltag()
58 
59 # lowEnergyPi0Identification requires a payload stored in the analysis global tag
60 # It must be appended (or prepended) manually
61 basf2.conditions.append_globaltag(tag)
62 
63 ma.lowEnergyPi0Identification(pi0_list, 'gamma:pi0', payload_name_suffix,
64  path=analysis_path)
65 
66 # Variables.
67 variables.addAlias('identification', 'extraInfo(lowEnergyPi0Identification)')
68 pi0_vars = vc.kinematics + ['InvM', 'identification']
69 
70 # Output file.
71 filename = 'pi0_identification.root'
72 ma.variablesToNtuple('pi0:gamma', pi0_vars, filename=filename, treename='t1', path=analysis_path)
73 
74 # Progress.
75 analysis_path.add_module('Progress')
76 
77 # Process the events.
78 basf2.process(analysis_path)
79 
80 # Print out the summary.
81 print(basf2.statistics)
def convertBelleMdstToBelleIIMdst(inputBelleMDSTFile, applySkim=True, saveResultExtraInfo=False, useBelleDBServer=None, convertBeamParameters=True, generatorLevelReconstruction=False, generatorLevelMCMatching=False, path=None, entrySequences=None, matchType2E9oE25Threshold=-1.1, enableNisKsFinder=True, HadronA=True, HadronB=True, enableRecTrg=False, enableEvtcls=True, SmearTrack=2, enableLocalDB=True, convertNbar=False)