12from pathlib
import Path
16import modularAnalysis
as ma
18from ROOT
import Belle2
21from variables
import variables
as vm
23from grafei
import lcaSaver
27 parser = argparse.ArgumentParser(
28 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
29 description=
'Reconstruct most likely particles and save their features and LCA matrix'
31 parser.add_argument(
'-t',
'--type', choices=[
'B0',
'B+',
'Ups'], required=
True,
32 help=
'Training target', metavar=
'type',
34 return parser.parse_args()
37if __name__ ==
'__main__':
38 b2.conditions.prepend_globaltag(ma.getAnalysisGlobaltag())
44 path = b2.create_path()
45 ma.inputMdst(str(input_file), path=path)
54 ma.fillParticleListFromMC(mc_particle_name[args.type],
'', path=path)
58 priors = [0.068, 0.050, 0.7326, 0.1315, 0.0183, 0.00006]
60 charged_cuts = [f
"pidIsMostLikely({','.join(str(p) for p in priors)})>0",
'nCDCHits>20',
61 'thetaInCDCAcceptance',
'abs(dz)<1.0',
62 'dr<0.5',
'p<5',
'pt>0.2']
64 photon_cuts = [
'beamBackgroundSuppression>0.4',
'fakePhotonSuppression>0.3',
65 'abs(clusterTiming)<100',
'abs(formula(clusterTiming/clusterErrorTiming))<2.0',
66 '[[clusterReg==1 and E>0.09] or [clusterReg==2 and E>0.09] or [clusterReg==3 and E>0.14]]']
68 charged_lists = [f
'{c}:final' for c
in [
'p+',
'e+',
'pi+',
'mu+',
'K+']]
71 [(c,
' and '.join(charged_cuts))
for c
in charged_lists],
80 ma.getBeamBackgroundProbability(
"gamma:all",
"MC15ri", path=path)
81 ma.getFakePhotonProbability(
"gamma:all",
"MC15ri", path=path)
85 ' and '.join(photon_cuts),
91 vm.addAlias(
'n_gamma_in_evt',
'nParticlesInList(gamma:final)')
92 vm.addAlias(
'n_p_in_evt',
'nParticlesInList(p+:final)')
93 vm.addAlias(
'n_e_in_evt',
'nParticlesInList(e+:final)')
94 vm.addAlias(
'n_mu_in_evt',
'nParticlesInList(mu+:final)')
95 vm.addAlias(
'n_pi_in_evt',
'nParticlesInList(pi+:final)')
96 vm.addAlias(
'n_K_in_evt',
'nParticlesInList(K+:final)')
97 vm.addAlias(
'n_charged_in_evt',
'formula(n_p_in_evt+n_e_in_evt+n_mu_in_evt+n_pi_in_evt+n_K_in_evt)')
99 ma.applyEventCuts(
'n_gamma_in_evt<20 and n_charged_in_evt<20', path=path)
104 'electronID_noSVD_noTOP',
127 p_lists = charged_lists + [
'gamma:final']
128 p_names = [x.split(
':')[0]
for x
in p_lists]
133 for i, p_list
in enumerate(p_lists):
135 ma.matchMCTruth(p_list, path=path)
138 particle_lists=p_lists,
140 mcparticle_list=mc_particle_name[args.type],
141 output_file=f
'graFEI_train_{input_file.stem}.root',
static Environment & Instance()
Static method to get a reference to the Environment instance.
def stdPhotons(listtype='loose', path=None, beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="")