Belle II Software light-2406-ragdoll
LowEnergyPi0Identification.py
1#!/usr/bin/env python3
2
3
10
11
14
15import argparse
16import basf2
17import b2biiConversion
18import modularAnalysis as ma
19import variables.collections as vc
20from variables import variables
21
22# Arguments.
23parser = argparse.ArgumentParser()
24parser.add_argument('--belle1', action='store_true',
25 help='Belle 1 data analysis.')
26arguments = parser.parse_args()
27
28# Create path.
29analysis_path = basf2.create_path()
30
31# Load input file.
32if arguments.belle1:
34 basf2.find_file('analysis/mdstBelle1_exp65_charged.root', 'validation'),
35 path=analysis_path)
36else:
37 ma.inputMdst(filename=basf2.find_file("mdst14.root", "validation"),
38 path=analysis_path)
39
40# Reconstruction of photons.
41gamma_list = 'gamma:all'
42ma.fillParticleList(gamma_list, '', path=analysis_path)
43
44# Reconstruction of pi0.
45mass_window = 0.02
46mass_cut = f'abs(dM) < {mass_window}'
47ma.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.
49pi0_list = 'pi0:gamma'
50ma.reconstructDecay('pi0:gamma -> gamma:pi0 gamma:pi0', mass_cut,
51 path=analysis_path)
52if arguments.belle1:
53 payload_name_suffix = 'Belle1'
54 tag = ma.getAnalysisGlobaltagB2BII()
55else:
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
61basf2.conditions.append_globaltag(tag)
62
63ma.lowEnergyPi0Identification(pi0_list, 'gamma:pi0', payload_name_suffix,
64 path=analysis_path)
65
66# Variables.
67variables.addAlias('identification', 'extraInfo(lowEnergyPi0Identification)')
68pi0_vars = vc.kinematics + ['InvM', 'identification']
69
70# Output file.
71filename = 'pi0_identification.root'
72ma.variablesToNtuple('pi0:gamma', pi0_vars, filename=filename, treename='t1', path=analysis_path)
73
74# Progress.
75analysis_path.add_module('Progress')
76
77# Process the events.
78basf2.process(analysis_path)
79
80# Print out the summary.
81print(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)