# Contributors: Umberto Tamponi (October 2018) # [email protected] # #################################################################### import basf2 as b2 import modularAnalysis as ma import variables.collections # create path my_path = b2.create_path() # load input ROOT file ma.inputMdst(environmentType='default', filename=b2.find_file('B02D0pi0_D02pi0pi0.root', 'examples', False), path=my_path) # Creates a list of all the good tracks (using the pion mass hypothesys) # and good gammas with very minimal cuts ma.fillParticleList(decayString='pi+:all', cut='pt> 0.1', path=my_path) ma.fillParticleList(decayString='gamma:all', cut='E > 0.1', path=my_path) # Builds the event shape enabling explicitly ALL the variables. # Most of the are actually enabled by defoult, but here we prefer # to list explicitly all the flags
# the MC files contain the desired processes/decays. # # Contributors: A. Zupanc (June 2014) # I. Komarov (September 2018) # ###################################################### import basf2 as b2 import modularAnalysis as ma # create path my_path = b2.create_path() # load input ROOT file ma.inputMdst(environmentType='default', filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False), path=my_path) # create charged kaon and pion particle lists with names "K-:gen" and "pi-:gen" # all generated kaons(pions) will be added to the kaon(pion) list ma.fillParticleListFromMC(decayString='K-:gen', cut='', path=my_path) ma.fillParticleListFromMC(decayString='pi-:gen', cut='', path=my_path) # print charge, energy and total momentum of generated kaons # and x,y,z components of momenta for generated pions # # the list of all available variables can be obtained by executing # basf2 analysis/scripts/variables/print_variables.py ma.printVariableValues(list_name='K-:gen', var_names=['charge', 'E', 'p'], path=my_path)
if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentTypeError('Boolean value expected.') if __name__ == "__main__": import argparse parser1 = argparse.ArgumentParser() parser1.add_argument('-c', '--channel', help='which channel? ', default='kst0mumu') parser1.add_argument('-in', '--inp', help='input file', default=b2.find_file('/gpfs/group/belle2/users/seemac/Kstll/signal/BtoKstjpsi/kst0jpsi/mdst_000001_prod00012871_task10020000001.root')) parser1.add_argument('-out', '--out', help='outputfile', default='~/origin/ee.root') parser1.add_argument('-isdata', '--isdata', help='whether data oe mc. For data\ momentum corretion for FSP wil take place', default=False) parser1.print_help() args = parser1.parse_args() date = datetime.datetime.today() print(date.strftime('Start at : %d-%m-%y %H:%M:%S\n')) stime = time.time() print(args.inp, args.out, args.channel) main(args.inp, args.out, args.channel, args.isdata) date = datetime.datetime.today() print(date.strftime('End at : %y-%m-%d %H:%M:%S\n')) print('time taken', time.time()-stime)
################################################################################ import basf2 as b2 import modularAnalysis as ma import variables.collections as vc import variables.utils as vu import stdCharged as stdc from stdPi0s import stdPi0s # create path my_path = b2.create_path() # load input ROOT file ma.inputMdstList(environmentType='default', filelist=[ b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False), b2.find_file('ccbar_background.root', 'examples', False) ], path=my_path) # Apply a selection at the event level, to avoid # processing useless events ma.applyEventCuts(cut='R2EventLevel < 0.3', path=my_path) # The following lines cut&pasted from A304 # create and fill final state ParticleLists # use standard lists # creates "pi+:loose" ParticleList (and c.c.) stdc.stdPi(listtype='loose', path=my_path) # creates "K+:loose" ParticleList (and c.c.)
# that daughter is 22. I.e. in a decay like # A --> B C gamma, the gamma would be removed. # # Contributors: Moritz Gelb (June 2017) # ###################################################### import root_pandas import decayHash import basf2 as b2 from decayHash import DecayHashMap import sys # read in root-file as a pandas dataframe data = root_pandas.read_root( b2.find_file('Jpsi_from_B2A502.root', 'examples', False)) hashmap = DecayHashMap(b2.find_file('hashmap_Jpsi_from_B2A502.root', 'examples', False), removeRadiativeGammaFlag=False) hashmap2 = DecayHashMap(b2.find_file('hashmap_Jpsi_from_B2A502.root', 'examples', False), removeRadiativeGammaFlag=True) # get one reconstructed J/psi candidate42 = data.iloc[42][[ "extraInfo__boDecayHash__bc", "extraInfo__boDecayHashExtended__bc" ]].values # print the reconstruced decay print("Reconstructed Decay: ") rec = hashmap.get_reconstructed_decay(*candidate42)
# ################################################################################ import basf2 as b2 import modularAnalysis as ma import variables.collections as vc import variables.utils as vu from stdPhotons import stdPhotons import stdCharged as stdc # create path my_path = b2.create_path() # load input ROOT file ma.inputMdst(environmentType='default', filename=b2.find_file('B2rhogamma_rho2pipi.root', 'examples', False), path=my_path) # # creates "gamma:tight" ParticleList stdPhotons(listtype='tight', path=my_path) # creates "pi+:loose" ParticleList (and c.c.) stdc.stdPi(listtype='loose', path=my_path) # reconstruct rho -> pi+ pi- decay # keep only candidates with 0.6 < M(pi+pi-) < 1.0 GeV ma.reconstructDecay(decayString='rho0 -> pi+:loose pi-:loose', cut='0.6 < M < 1.0', path=my_path)
###################################################### import basf2 as b2 import modularAnalysis as ma import variables.collections as vc import variables.utils as vu import stdCharged as stdc from stdV0s import stdKshorts from stdPi0s import stdPi0s # create path my_path = b2.create_path() # load input ROOT file ma.inputMdst(environmentType='default', filename=b2.find_file('Dst2D0pi.root', 'examples', False), path=my_path) # use standard final state particle lists # # creates "pi+:all" ParticleList (and c.c.) stdc.stdPi(listtype='all', path=my_path) # creates "pi+:loose" ParticleList (and c.c.) stdc.stdPi(listtype='loose', path=my_path) # creates "K+:loose" ParticleList (and c.c.) stdc.stdK(listtype='loose', path=my_path) # reconstruct D0 -> K- pi+ decay # keep only candidates with 1.8 < M(Kpi) < 1.9 GeV ma.reconstructDecay(decayString='D0:kpi -> K-:loose pi+:loose', cut='1.8 < M < 1.9',
if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentTypeError('Boolean value expected.') if __name__ == "__main__": import argparse parser1 = argparse.ArgumentParser() parser1.add_argument('-c', '--channel', help='which channel? ', default='all') parser1.add_argument('-in', '--inp', help='input file', default=b2.find_file('/group/belle2/users/tenchini/prerelease-05-00-00a/1111540100/1111540100_eph3_BGx0_29.root')) parser1.add_argument('-out', '--out', help='outputfile', default='ee.root') parser1.add_argument('-isdata', '--isdata', help='whether data oe mc. For data\ momentum corretion for FSP wil take place', default=False) parser1.print_help() args = parser1.parse_args() date = datetime.datetime.today() print(date.strftime('Start at : %d-%m-%y %H:%M:%S\n')) stime = time.time() print(args.inp, args.out, args.channel) main(args.inp, args.out, args.channel, args.isdata) date = datetime.datetime.today() print(date.strftime('End at : %y-%m-%d %H:%M:%S\n')) print('time taken', time.time()-stime)
import basf2 as b2 import modularAnalysis as ma import flavorTagger as ft import vertex as vx import variables.collections as vc import variables.utils as vu import stdCharged as stdc from stdPi0s import stdPi0s # create path my_path = b2.create_path() # load input ROOT file ma.inputMdst(environmentType='default', filename=b2.find_file('B2JPsipi0_JPsi2mumu.root', 'examples', False), path=my_path) # use standard final state particle lists # # creates "pi0:looseFit" ParticleList # https://confluence.desy.de/display/BI/Physics+StandardParticles stdPi0s(listtype='looseFit', path=my_path) # creates "highPID" ParticleLists (and c.c.) ma.fillParticleList(decayString='mu+:highPID', cut='muonID > 0.2 and d0 < 2 and abs(z0) < 4', path=my_path) # reconstruct J/psi -> mu+ mu- decay # keep only candidates with dM<0.11 ma.reconstructDecay(decayString='J/psi:mumu -> mu+:highPID mu-:highPID',
# I. Komarov (Demeber 2017) # I. Komarov (September 2018) # ################################################################################ import basf2 as b2 import modularAnalysis as ma import variables.collections as vc import variables.utils as vu # create path my_path = b2.create_path() # load input ROOT file ma.inputMdst(environmentType='default', filename=b2.find_file('JPsi2ee_e2egamma.root', 'examples', False), path=my_path) # fill particleLists ma.fillParticleList(decayString='e+:uncorrected', cut='electronID > 0.2 and d0 < 2 and abs(z0) < 4', path=my_path) ma.fillParticleList(decayString='gamma:all', cut='E < 1.0', writeOut=False, path=my_path) # loose mc matching (recommended) ma.looseMCTruth(list_name='e+:uncorrected', path=my_path) ma.looseMCTruth(list_name='gamma:all', path=my_path)