def generateY4S(noEvents, decayTable=None, path=analysis_main): """ Generated e+e- -> Y(4S) events with EvtGen event generator. The Y(4S) decays according to the user specifed decay table. The experiment and run numbers are set to 1. If the simulation and reconstruction is not performed in the sam job, then the Gearbox needs to be loaded. Use loadGearbox(path) function for this purpose. @param noEvents number of events to be generated @param decayTable file name of the decay table to be used @param path modules are added to this path """ add_beamparameters(path, "Y4S") evtnumbers = register_module('EventInfoSetter') evtnumbers.param('evtNumList', [noEvents]) evtnumbers.param('runList', [1]) evtnumbers.param('expList', [1]) evtgeninput = register_module('EvtGenInput') if decayTable is not None: if os.path.exists(decayTable): evtgeninput.param('userDECFile', decayTable) else: B2ERROR('The specifed decay table file does not exist:' + decayTable) path.add_module(evtnumbers) path.add_module(evtgeninput)
for idau in range(int(ndau)): for jdau in range(idau): mij = (vec_p4[idau] + vec_p4[jdau]).M() h_m_ij[ij].Fill(mij) # print(idau, jdau, ij, mij) ij = ij + 1 # main path main = create_path() # event info setter main.add_module("EventInfoSetter", expList=0, runList=1, evtNumList=1000) # beam parameters beamparameters = add_beamparameters(main, "Y4S") # beamparameters.param("generateCMS", True) # beamparameters.param("smearVertex", False) # to run the framework the used modules need to be registered kkgeninput = register_module('KKGenInput') kkgeninput.param( 'tauinputFile', Belle2.FileSystem.findFile('data/generators/kkmc/tau.input.dat')) kkgeninput.param( 'KKdefaultFile', Belle2.FileSystem.findFile('data/generators/kkmc/KK2f_defaults.dat')) #kkgeninput.param('taudecaytableFile', Belle2.FileSystem.findFile('data/generators/kkmc/tau_decaytable.dat')) kkgeninput.param('taudecaytableFile', 'my_tau_decaytable_tauenubar.dat') kkgeninput.param('kkmcoutputfilename', 'kkmc_tautau.txt')
variables.addAlias('B0_cc4','CleoConeCS(4)') variables.addAlias('B0_hso02','KSFWVariables(hso02)') #variables.addAlias('MCTagBFlavor','internalTagVMCFlavor') variables.addAlias('CSMVA','extraInfo(CSMVA)') variables.addAlias('XsdM','daughterInvM(0,1,2)') variables.addAlias('pi0Likeness','extraInfo(Pi0_Prob)') variables.addAlias('etaLikeness','extraInfo(Eta_Prob)') variables.addAlias('cosThetaCMS','useCMSFrame(cosTheta)') variables.addAlias('pCMS','useCMSFrame(p)') variables.addAlias('ECMS','useCMSFrame(E)') variables.addAlias('m12','daughterInvariantMass(0,1)') variables.addAlias('m13','daughterInvariantMass(0,2)') variables.addAlias('m23','daughterInvariantMass(1,2)') main_path = b2.create_path() # Declaration of main path bp.add_beamparameters(main_path,'Y4S') ma.inputMdst('MC10', inputFilename, path=main_path) sv.goodBelleKshort(path=main_path) sg.stdPhotons('loose', path=main_path) sc.stdPi('95eff', path=main_path) ma.applyCuts('gamma:loose','1.4 < E < 4', path=main_path) krescuts = " and daughterInvM(0,1,2) < 2 and daughterInvM(0,1) > 0.6 and daughterInvM(0,1) < 0.9" #reconstructDecay(Kres+":all -> pi+:good pi-:good K_S0:all", krescuts) ma.reconstructDecay("B0:signal -> pi+:95eff pi-:95eff K_S0:legacyGoodKS gamma:loose", "Mbc > 5.2 and deltaE < 0.2 and deltaE > -0.2 and -0.65 < daughter(1, cosTheta) < 0.85"+krescuts, path=main_path) ma.vertexRave('B0:signal',0.0001, 'B0 -> ^pi+ ^pi- ^K_S0 gamma', path=main_path) #vertexTree('B0:signal',0.0001) ma.rankByHighest('B0:signal',ratingVar, 1, outputVariable='myRating', path=main_path) ma.buildRestOfEvent('B0:signal', path=main_path)
from reconstruction import add_mdst_output from modularAnalysis import analysis_main from ROOT import Belle2 from beamparameters import add_beamparameters defaultFilename = "evtgen.root" defaultFoldername = "test" filename = defaultFoldername + '/' + defaultFilename for arg in sys.argv: print(arg) if len(sys.argv)==2: filename = sys.argv[1] if os.path.isfile(filename): sys.exit('Required input file does exist. ') add_beamparameters(analysis_main, 'Y4S') # generation of 100 events according to the specified DECAY table # Y(4S) -> Btag- Bsig+ # Btag- -> D0 pi-; D0 -> K- pi+ # Bsig+ -> mu+ nu_mu # # generateY4S function is defined in analysis/scripts/modularAnalysis.py #generateY4S(1000, 'Y4SEventGeneration.dec') generateY4S(5000, 'mydec-k-cpmix.dec') # If the simulation and reconstruction is not performed in the sam job, # then the Gearbox needs to be loaded with the loadGearbox() function. loadGearbox() # dump generated events in MDST format to the output ROOT file