def reconstructLambda(outlist, match=False, only=None, path=None): """Reconstruct Lambda based on Lambda0:mdst outlist: Output particle list name. You can use for example 'Lambda0:belle' match: Perform MC truth match or not only: If only == 'signal', then only keep matched signal If only == 'background', then only keep background Otherwise, no further cuts. This option is for generating balanced training samples """ if path == None: raise Exception('Path cannot be None!') if outlist == 'Lambda0:mdst': raise Exception('outlist name cannot be Lambda0:mdst') inlist = 'Lambda0:mdst' ma.vertexTree(inlist, path=path) if match: ma.matchMCTruth(inlist, path=path) if only == 'signal': ma.cutAndCopyList(outlist, inlist, 'isSignal == 1', path=path) elif only == 'background': ma.cutAndCopyList(outlist, inlist, 'isSignal == 0', path=path) else: ma.cutAndCopyList(outlist, inlist, '', path=path)
def create_path(self): path = basf2.create_path() modularAnalysis.inputMdstList( 'default', self.get_input_file_names("reconstructed_output.root"), path=path) modularAnalysis.fillParticleLists([('K+', 'kaonID > 0.1'), ('pi+', 'pionID > 0.1')], path=path) modularAnalysis.reconstructDecay('D0 -> K- pi+', '1.7 < M < 1.9', path=path) modularAnalysis.fitVertex('D0', 0.1, path=path) modularAnalysis.matchMCTruth('D0', path=path) modularAnalysis.reconstructDecay('B- -> D0 pi-', '5.2 < Mbc < 5.3', path=path) modularAnalysis.fitVertex('B+', 0.1, path=path) modularAnalysis.matchMCTruth('B-', path=path) modularAnalysis.variablesToNtuple( 'D0', [ 'M', 'p', 'E', 'useCMSFrame(p)', 'useCMSFrame(E)', 'daughter(0, kaonID)', 'daughter(1, pionID)', 'isSignal', 'mcErrors' ], filename=self.get_output_file_name("D_n_tuple.root"), path=path) modularAnalysis.variablesToNtuple( 'B-', ['Mbc', 'deltaE', 'isSignal', 'mcErrors', 'M'], filename=self.get_output_file_name("B_n_tuple.root"), path=path) return path
def create_path(self): path = basf2.create_path() modularAnalysis.inputMdstList( 'default', self.get_input_file_names("reconstructed_output.root"), path=path) modularAnalysis.fillParticleLists([('K+', 'kaonID > 0.1'), ('pi+', 'pionID > 0.1')], path=path) modularAnalysis.reconstructDecay('D0 -> K- pi+', '1.7 < M < 1.9', path=path) modularAnalysis.matchMCTruth('D0', path=path) modularAnalysis.reconstructDecay('B- -> D0 pi-', '5.2 < Mbc < 5.3', path=path) try: # treeFit is the new function name in light releases after release 4 (e.g. light-2002-janus) vertex.treeFit('B+', 0.1, update_all_daughters=True, path=path) except AttributeError: # vertexTree is the function name in release 4 vertex.vertexTree('B+', 0.1, update_all_daughters=True, path=path) modularAnalysis.matchMCTruth('B-', path=path) modularAnalysis.variablesToNtuple( 'D0', [ 'M', 'p', 'E', 'useCMSFrame(p)', 'useCMSFrame(E)', 'daughter(0, kaonID)', 'daughter(1, pionID)', 'isSignal', 'mcErrors' ], filename=self.get_output_file_name("D_n_tuple.root"), path=path) modularAnalysis.variablesToNtuple( 'B-', ['Mbc', 'deltaE', 'isSignal', 'mcErrors', 'M'], filename=self.get_output_file_name("B_n_tuple.root"), path=path) return path
def create_analysis_path( b_ntuple_filename="B_ntuple.root", d_ntuple_filename="D_ntuple.root", mbc_range=(5.2, 5.3), ): """ Example of a minimal reconstruction with a cut as a changeable function parameter, adapted from code in the ``B2T_Basics_3_FirstAnalysis.ipynb`` notebook from b2 starter kit. """ path = basf2.create_path() # this local inputMdstList will only be used when this steerig file is run locally, gbasf2 overrides it local_input_files = [ "/group/belle2/dataprod/MC/MC13a/prod00009434/s00/e1003/4S/r00000/mixed/mdst/sub00/mdst_000001_prod00009434_task10020000001.root" ] mA.inputMdstList( environmentType="default", filelist=local_input_files, path=path, ) stdK("higheff", path=path) stdPi("higheff", path=path) mA.reconstructDecay('D0:Kpi -> K-:higheff pi+:higheff', '1.7 < M < 1.9', path=path) # use try except to have this code work for both the old and new function names for the tree fit mA.matchMCTruth('D0:Kpi', path=path) mA.reconstructDecay('B- -> D0:Kpi pi-:higheff', f"{mbc_range[0]} < Mbc < {mbc_range[1]}", path=path) try: vx.treeFit('B+', 0.1, path=path) except AttributeError: vx.vertexTree('B+', 0.1, path=path) mA.setAnalysisConfigParams({"mcMatchingVersion": "BelleII"}, path) mA.matchMCTruth('B-', path=path) vm.addAlias("p_cms", "useCMSFrame(p)") # include aliases to test if they work vm.addAlias("E_cms", "useCMSFrame(E)") mA.variablesToNtuple('D0:Kpi', [ 'M', 'p', 'E', 'E_cms', 'p_cms', 'daughter(0, kaonID)', 'daughter(1, pionID)', 'isSignal', 'mcErrors' ], filename=d_ntuple_filename, treename="D", path=path) mA.variablesToNtuple('B-', ['Mbc', 'deltaE', 'isSignal', 'mcErrors', 'M'], filename=b_ntuple_filename, treename="B", path=path) return path
if len(sys.argv) == 1: infile = '/ghi/fs01/belle2/bdata/MC/release-03-01-00/DB00000547/MC12b/prod00007426/s00/e1003/4S/r00000/ccbar/mdst/sub00'\ '/mdst_000001_prod00007426_task10020000001.root' outfile = 'test.root' else: infile = sys.argv[1] outfile = sys.argv[2] print(f"Input = {infile}") print(f"Output = {outfile}") ma.inputMdstList('default', [infile], path = mp) eff = 60 stdSigmas(f'pi0eff{eff}', path = mp) ma.matchMCTruth('Sigma+:std', path = mp) va.addAlias('cosa', 'cosAngleBetweenMomentumAndVertexVector') va.addAlias('cosaXY', 'cosAngleBetweenMomentumAndVertexVectorInXYPlane') va.addAlias('abs_dM', 'abs(dM)') va.addAlias('M_noupdate', 'extraInfo(M_noupdate)') va.addAlias('p_noupdate', 'extraInfo(p_noupdate)') ntuple = ['M', 'p', 'chiProb', 'cosa', 'cosaXY', 'dr', 'dz', 'distance', 'isSignal', 'genMotherPDG'] ntuple += ['IPX', 'IPY', 'IPZ'] ntuple += create_aliases_for_selected(['protonID', 'pionID', 'dr', 'dz', 'p', 'isSignal'], 'Sigma+ -> ^p+ pi0', prefix = ['p']) ntuple += create_aliases_for_selected(['mcP', 'p', 'M', 'distance', 'isSignal', 'genMotherPDG', 'M_noupdate', 'p_noupdate'], 'Sigma+ -> p+ ^pi0', prefix = ['pi0']) ma.variablesToNtuple('Sigma+:std', ntuple, treename = f'sigma_eff{eff}', filename = outfile, path = mp)
# combine final state particles to form composite particles ma.reconstructDecay('J/psi:ee -> e+:corrected e-:corrected ?addbrems', cut='dM < 0.11', path=main) # perform vertex fit of J/psi candidates vertex.KFit('J/psi:ee', conf_level=0.0, path=main) # combine J/psi and KS candidates to form B0 candidates ma.reconstructDecay('B0 -> J/psi:ee K_S0:merged', cut='Mbc > 5.2 and abs(deltaE) < 0.3', path=main) # match reconstructed with MC particles ma.matchMCTruth('B0', path=main) # build the rest of the event ma.buildRestOfEvent('B0', fillWithMostLikely=True, path=main) # call flavor tagging ft.flavorTagger('B0', path=main) # remove B0 candidates without a valid flavor information ma.applyCuts('B0', 'qrOutput(FBDT) > -2', path=main) # fit B vertex on the tag-side vertex.TagV('B0', constraintType='tube', fitAlgorithm='Rave', path=main) # perform best candidate selection #b2.set_random_seed('USBelleIISummerSchool')
vm.addAlias('dxDstar', 'dx') vm.addAlias('dyDstar', 'dy') vm.addAlias('dzDstar', 'dz') vm.addAlias('pDstar', 'p') vm.addAlias('eDstar', 'E') vm.addAlias('eCmsDstar', 'useCMSFrame(E)') vm.addAlias('mDstar', 'M') vm.addAlias('mD', 'daughter(0,M)') vm.addAlias('slowPiID', 'daughter(1,pionID)') Vars = [ 'xDstar', 'yDstar', 'zDstar', 'xGenDstar', 'yGenDstar', 'zGenDstar', 'dxDstar', 'dyDstar', 'dzDstar', 'pDstar', 'eDstar', 'eCmsDstar', 'mDstar', 'mD', 'slowPiID'] Vars.append('isSignal') Vars.append('IPX') Vars.append('IPCov(0,0)') # Match to the MC truth information ma.matchMCTruth('D*+:my', path=path) ma.variablesToNtuple('D*+:my', Vars, filename='nTupleNo.root', treename="Dstar", path=path) b2.process(path, max_event=100000) print(b2.statistics)
dmID=5, path=my_path) # merge the D0 lists together into one single list ma.copyLists(outputListName='D0:all', inputListNames=['D0:ch1', 'D0:ch2', 'D0:ch3', 'D0:ch4', 'D0:ch5'], path=my_path) # 3. reconstruct B+ -> anti-D0 pi+ decay ma.reconstructDecay(decayString='B+:D0pi -> anti-D0:all pi+', cut='5.24 < Mbc < 5.29 and abs(deltaE) < 1.0', dmID=1, path=my_path) # perform MC matching (MC truth asociation) ma.matchMCTruth(list_name='B+:D0pi', path=my_path) # Select variables that we want to store to ntuple d_vars = vc.inv_mass + vc.kinematics pi_vars = vc.kinematics b_vars = vc.deltae_mbc + \ vc.mc_truth + \ vu.create_aliases_for_selected(list_of_variables=d_vars, decay_string='B+ -> ^anti-D0 pi+', prefix='D0') + \ vu.create_aliases_for_selected(list_of_variables=pi_vars, decay_string='B+ -> anti-D0 ^pi+', prefix='pi') + \ vu.create_aliases(list_of_variables=['decayModeID'], wrapper='daughter(0,extraInfo(variable))', prefix="")
ma.applyCuts('Sigma+:loose', 'M >= 1.1 and M <= 1.3', path=mp) # ma.matchMCTruth('Sigma+:loose', path = mp) # mp.add_module('VariablesToNtuple', particleList = 'Sigma+:loose', # variables=ntuple_vars, treeName='sigma_loose', fileName=sys.argv[2]) # Eff of this cut is about 96% and rejects about 50% of the background for Sigma+ pi0_mass_cut = 'daughter(1, M) >= 0.12 and daughter(1, M) <= 0.15' ma.cutAndCopyList('Sigma+:good', 'Sigma+:loose', pi0_mass_cut, path=mp) ma.vertexTree('Sigma+:good', 0, ipConstraint=True, massConstraint=[], updateAllDaughters=False, path=mp) ma.applyCuts('Sigma+:good', 'M >= 1.16 and M <= 1.22', path=mp) ma.matchMCTruth('Sigma+:good', path=mp) mp.add_module('VariablesToNtuple', particleList='Sigma+:good', variables=ntuple_vars, treeName='sigma_good', fileName=sys.argv[2]) # # Mass constrain pi0 and update the daughters # ma.vertexTree('Sigma+:good', 0, ipConstraint = True, massConstraint = [111], # updateAllDaughters = True, path = mp) # ma.matchMCTruth('Sigma+:good', path = mp) # mp.add_module('VariablesToNtuple', particleList = 'Sigma+:good', # variables=ntuple_vars, treeName='sigma_updated', fileName=sys.argv[2]) b2.process(path=mp)
list_pid = ['pid_ppi', 'pid_pk', 'pid_kpi'] list_event = ['IPX', 'IPY', 'IPZ'] # Variables # ============================================= # Lambda0 list_ntuple = list_basics + list_lambda + list_event + list_mc # proton and pion list_ntuple += create_aliases_for_selected(list_basics + list_pid + list_mc, 'Lambda0 -> ^p+ ^pi-', prefix=['p', 'pi']) # Reconstruction # ============================================== # No reconstruction. Just MC match the Lambda0:mdst list ma.vertexTree('Lambda0:mdst', 0, path=mp) ma.matchMCTruth('Lambda0:mdst', path=mp) ma.applyCuts('Lambda0:mdst', 'isSignal == 0', path=mp) # Output # ============================================= mp.add_module('VariablesToNtuple', particleList='Lambda0:mdst', variables=list_ntuple, treeName='lambda', fileName=sys.argv[2]) b2.process(path=mp) print(b2.statistics)
path=mp) stdPr('loose', path=mp) # good tracks and protonID > 0.1 ma.reconstructDecay('Sigma+:loose -> p+:loose pi0:for_sigma', '1.1 < M < 1.3', path=mp) # Have to use ipConstraint otherwise not enough degrees of freedom ma.vertexTree('Sigma+:loose', 0, ipConstraint=True, massConstraint=[111], updateAllDaughters=False, path=mp) ma.applyCuts('Sigma+:loose', 'abs(dM) < 0.03', path=mp) ma.matchMCTruth('Sigma+:loose', path=mp) va.addAlias('cosa', 'cosAngleBetweenMomentumAndVertexVector') va.addAlias('cosaXY', 'cosAngleBetweenMomentumAndVertexVectorInXYPlane') va.addAlias('abs_dM', 'abs(dM)') va.addAlias('M_noupdate', 'extraInfo(M_noupdate)') va.addAlias('p_noupdate', 'extraInfo(p_noupdate)') ntuple = [ 'M', 'p', 'chiProb', 'cosa', 'cosaXY', 'dr', 'dz', 'distance', 'isSignal', 'genMotherPDG' ] ntuple += ['IPX', 'IPY', 'IPZ'] ntuple += create_aliases_for_selected( ['protonID', 'pionID', 'dr', 'dz', 'p', 'isSignal'], 'Sigma+ -> ^p+ pi0',
def reconstruct(infile='default.root', outfile='output_beta.root', path=None): """ Args: infile: Input file name (use overwrite from basf2) outfile: output file name (use overwrite from basf2) path: (optional) basf2 path Returns: path """ setup() # EXAMPE RECONSTRUCTION CODE # DELETE OR MODIFY FROM HERE just_an_example = True if just_an_example: with open(outfile, 'w') as f: f.write("Proccessed example input " + infile) else: path = b2.create_path() if path is None else path # Input file ma.inputMdstList("default", infile, path=path) # Event level cuts examples ma.applyEventCuts('R2EventLevel<0.6 and nTracks>=3', path=path) # # Load Primary particles # from stdPhotons import stdPhotons stdPhotons('cdc', path) ma.cutAndCopyList('gamma:sig', 'gamma:cdc', 'clusterNHits > 1.5 and E > 1.5', True, path) from stdPi0s import stdPi0s stdPi0s('eff20', path) # Loading charged tracks good_track = 'thetaInCDCAcceptance and nCDCHits>20 and dr < 0.5 and abs(dz) < 2' ma.fillParticleList("pi+:sig", good_track + " and pionID > 0.0", path=path) ma.fillParticleList("K+:sig", good_track + " and kaonID > 0.0", path=path) # # Combine particles # ma.reconstructDecay('K*0:sig -> K+:sig pi-:sig', '0.6 < M < 1.6', path=path) ma.reconstructDecay('B0:sig -> K*0:sig gamma:sig', '5.22 < Mbc < 5.3 and abs(deltaE)< 1', path=path) # Final Calculateions ma.rankByHighest("B0:ch1", "formula(-1*abs(deltaE))", outputVariable='Rank_deltaE', path=path) ma.buildEventShape(allMoments=True, path=path) ma.matchMCTruth("B0:sig", path=path) # # Write out Ntuples # all_vars = get_variables() ma.variablesToNtuple('B0:ch1', all_vars, filename=outfile, treename="B0", path=path) # TO HERE #ma.printMCParticles(path=path) return path
cut='chiProb > 0.001 and pionID > 0.5', path=main) ma.reconstructDecay(decayString='K_S0 -> pi+:good pi-:good', cut='0.480<=M<=0.516', dmID=1, path=main) ma.reconstructDecay(decayString='pi0 -> gamma:all gamma:all', cut='0.115<=M<=0.152', dmID=1, path=main) ma.reconstructDecay(decayString='B0 -> K_S0 pi0', cut='5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2', path=main) ma.matchMCTruth(list_name='B0', path=main) ma.buildRestOfEvent(list_name='B0', path=main) # The momentum cuts used to be hard-coded in the continuum suppression module. They can now be applied # via this mask. The nCDCHits requirement is new, and is recommended to remove VXD-only fake tracks. cleanMask = ('cleanMask', 'nCDCHits > 0 and useCMSFrame(p)<=3.2', 'p >= 0.05 and useCMSFrame(p)<=3.2') ma.appendROEMasks(list_name='B0', mask_tuples=[cleanMask], path=main) ma.buildContinuumSuppression(list_name='B0', roe_mask='cleanMask', path=main) # Define the variables for training. # For details, please see: https://confluence.desy.de/display/BI/Continuum+Suppression+Framework # Note that KSFWVariables takes the optional additional argument FS1, to return the variables calculated from the # signal-B final state particles. # CleoCone also takes the optional additional argument ROE, to return the cones calculated from ROE particles only.
ma.applyCuts('Lambda_c+:loose', 'M >= 2.24 and M <= 2.34', path=mp) # Dalitz variables variables.addAlias('m_sigma_pi_plus', 'daughterInvM(0, 1)') variables.addAlias('m_sigma_pi_minus', 'daughterInvM(0, 2)') variables.addAlias('m_pi_pi', 'daughterInvM(1, 2)') dalitz_vars = ['m_sigma_pi_plus', 'm_sigma_pi_minus', 'm_pi_pi'] lamc_vars = [ 'M', 'p', 'distance', 'significanceOfDistance', 'chiProb', 'xp', 'mcPDG', 'genMotherPDG', 'isSignal' ] ntuple_vars = lamc_pi_vars + lamc_sigma_vars + dalitz_vars + lamc_vars ma.matchMCTruth('Lambda_c+:loose', path=mp) # ma.cutAndCopyList('Sigma+:sig', 'Sigma+:good', 'isSignal == 1', path = mp) # Randomly throw away 99% of the background to make sig:bkg ~ 1:1 # ma.cutAndCopyList('Sigma+:bkg', 'Sigma+:good', 'isSignal == 0 and random < 0.01', path = mp) # ma.copyLists('Sigma+:merged', ['Sigma+:sig', 'Sigma+:bkg'], path = mp) mp.add_module('VariablesToNtuple', particleList='Lambda_c+:loose', variables=ntuple_vars, treeName='lambda_c', fileName=sys.argv[2]) b2.process(path=mp) print(b2.statistics)
ma.cutAndCopyList('p+:berger', 'p+:all', 'pid_ppi > 0.6 and pid_pk > 0.6', path=mp) # M Berger: photons > 40 MeV and pi0 lab frame momentum > 100 MeV ma.cutAndCopyList( 'pi0:berger', 'pi0:mdst', 'daughter(0, E) > 0.05 and daughter(0, E) > 0.05 and p > 0.1', path=mp) ma.reconstructDecay('Sigma+:berger_loose -> p+:berger pi0:berger', 'M >= 1.0 and M <= 1.4', path=mp) # Set updateAllDaughters = True because the pi0:mdst list is mass constrained ma.vertexTree('Sigma+:berger_loose', 0, ipConstraint=True, massConstraint=[111], path=mp) # M Berger: discard condidates with wrong sign of flight distance ma.applyCuts('Sigma+:berger_loose', 'M >= 1.15 and M <= 1.225', path=mp) ma.matchMCTruth('Sigma+:berger_loose', path=mp) mp.add_module('VariablesToNtuple', particleList='Sigma+:berger_loose', variables=ntuple_vars, treeName='sigma_loose', fileName=sys.argv[2]) b2.process(path=mp) print(b2.statistics)
root_vars += [ 'kaonID', 'pionID', 'electronID', 'muonID', 'protonID', 'deuteronID' ] # Import mdst file and fill particle list without applying any cuts modularAnalysis.inputMdstList("default", ['sample.mdst.root'], path=path) modularAnalysis.fillParticleLists([(p, '') for p in particles], path=path) for p in particles: child_vars = [] for d in detectors: for p_2 in particles: child_vars += [ 'pidLogLikelihoodValueExpert(' + str(pdg.from_name(p_2)) + ', ' + str(d) + ')' ] child_vars += [ 'pidProbabilityExpert(' + str(pdg.from_name(p_2)) + ', ' + str(d) + ')' ] # Export variables of the analysis to NTuple root file # Inspect the value using modularAnalysis.printVariableValues('K+', `varName(varArg)`, path=path) modularAnalysis.matchMCTruth(p, path=path) modularAnalysis.variablesToNTuple(p, root_vars + child_vars, filename=p + '.root', path=path) basf2.process(path)
cut='1.8 < M < 1.9', dmID=5, path=my_path) # merge the D0 lists together into one single list ma.copyLists(outputListName='D0:all', inputListNames=['D0:ch1', 'D0:ch2', 'D0:ch3', 'D0:ch4', 'D0:ch5'], path=my_path) # 2. reconstruct Btag+ -> anti-D0 pi+ ma.reconstructDecay(decayString='B+:tag -> anti-D0:all pi+:loose', cut='5.2 < Mbc < 5.29 and abs(deltaE) < 1.0', dmID=1, path=my_path) ma.matchMCTruth(list_name='B+:tag', path=my_path) # 3. reconstruct Upsilon(4S) -> Btag+ Bsig- -> Btag+ mu- ma.reconstructDecay(decayString='Upsilon(4S) -> B-:tag mu+:loose', cut="", path=my_path) # perform MC matching (MC truth asociation) ma.matchMCTruth(list_name='Upsilon(4S)', path=my_path) # 5. build rest of the event ma.buildRestOfEvent(target_list_name='Upsilon(4S)', path=my_path) # 6. Select variables that we want to store to ntuple d_vars = vc.mc_truth + vc.kinematics + vc.inv_mass b_vars = vc.mc_truth + \
cut='chiProb > 0.001 and pionID > 0.5', path=my_path) ma.reconstructDecay(decayString='K_S0 -> pi+:good pi-:good', cut='0.480<=M<=0.516', dmID=1, path=my_path) ma.reconstructDecay(decayString='pi0 -> gamma:all gamma:all', cut='0.115<=M<=0.152', dmID=1, path=my_path) ma.reconstructDecay(decayString='B0 -> K_S0 pi0', cut='5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2', path=my_path) ma.matchMCTruth(list_name='B0', path=my_path) ma.buildRestOfEvent(target_list_name='B0', path=my_path) # The momentum cuts used to be hard-coded in the continuum suppression module. They can now be applied # via this mask. The nCDCHits requirement is new, and is recommended to remove VXD-only fake tracks. cleanMask = ('cleanMask', 'nCDCHits > 0 and useCMSFrame(p)<=3.2', 'p >= 0.05 and useCMSFrame(p)<=3.2') ma.appendROEMasks(list_name='B0', mask_tuples=[cleanMask], path=my_path) ma.buildContinuumSuppression(list_name='B0', roe_mask='cleanMask', path=my_path) # Define the variables for training. # For details, please see: https://confluence.desy.de/display/BI/Continuum+Suppression+Framework
ma.buildRestOfEvent('B0:signal', path=main_path) # define the "cleaner" mask eclCut = '[E > 0.062 and abs(clusterTiming) < 18 and clusterReg==1] or \ [E>0.060 and abs(clusterTiming) < 20 and clusterReg==2] or \ [E>0.056 and abs(clusterTiming) < 44 and clusterReg==3]' cleanMask = ('cleanMask', 'abs(d0) < 10.0 and abs(z0) < 20.0', eclCut) # append both masks to ROE ma.appendROEMasks('B0:signal', [cleanMask], path=main_path) # choose one mask which is applied ma.buildContinuumSuppression('B0:signal', 'cleanMask', path=main_path) ma.matchMCTruth('B0:signal', path=main_path) vtx.TagV('B0:signal', 'internal', path=main_path) ft.flavorTagger(particleLists = 'B0:signal', weightFiles='B2nunubarBGx1', path=main_path) #matchMCTruth('pi+:all') #matchMCTruth(Kres+':all') #matchMCTruth('gamma:loose') main_path.add_module('MVAExpert', listNames=['B0:signal'], extraInfoName='CSMVA', identifier='./mva-addition/MyTMVA.xml') ma.writePi0EtaVeto('B0:signal', 'B0 -> pi+:good pi-:good K_S0:all ^gamma', path=main_path) #myVetoVariables() kin_variables = vc.mc_truth + ['p', 'E', 'pCMS', 'ECMS', 'cosTheta', 'phi', 'M', 'dM', 'chiProb','charge', 'PDG']
###################################################### #ma.applyEventCuts('thrust > 0.8', path=my_path) #ma.applyEventCuts('thrust < 0.99', path=my_path) # Read carefully what these aliases mean #var.addAlias('cosTheta1', # 'formula(daughter(0, daughter(0, cosToThrustOfEvent))*daughter(1, daughter(0,cosToThrustOfEvent)))') # Now, using the above aliases, select vpho candidates with signal and tag in opposite sides of the event. #ma.applyCuts('vpho:photon_B2SS', 'cosTheta1 < 0', path=my_path) ######## MC Matching ###### ########################### # Perform MC matching of the tau candidates ma.matchMCTruth('tau+:signal', path=my_path) ma.matchMCTruth('tau+:tag', path=my_path) ##################################################### # select the variables to be stored in the ntuple ##################################################### # -- event based variables eventVariables = ['thrust', 'M', 'tauPlusMCMode', 'tauMinusMCMode'] # -- tau candidate variables # added vc.kinematics for taus tauVariables = vc.inv_mass + vc.kinematics + vc.deltae_mbc tauVariables += ['mcErrors', 'genMotherPDG', 'mcPDG', 'isSignal'] # -- track level variables trackVariables = vc.kinematics + vc.pid + vc.track + vc.track_hits + vc.vertex
path=my_path) # 2. reconstruct D+ -> K- pi+ pi+ ma.reconstructDecay(decayString='D+:kpipi -> K-:loose pi+:loose pi+:loose', cut='1.8 < M < 1.9 and 2.5 < useCMSFrame(p) < 5.5', dmID=1, path=my_path) # 3. reconstruct Ds+ -> K- K+ pi+ ma.reconstructDecay(decayString='D_s+:kkpi -> K-:loose K+:loose pi+:loose', cut='1.9 < M < 2.0 and 2.5 < useCMSFrame(p) < 5.5', dmID=1, path=my_path) # perform MC matching (MC truth asociation) ma.matchMCTruth(list_name='D0:all', path=my_path) ma.matchMCTruth(list_name='D+:kpipi', path=my_path) ma.matchMCTruth(list_name='D_s+:kkpi', path=my_path) # print out summary of lists # first for D0 lists only ma.summaryOfLists(particleLists=['D0:ch1', 'D0:ch2', 'D0:ch3'], path=my_path) # and for all charm ma.summaryOfLists(particleLists=['D0:all', 'D+:kpipi', 'D_s+:kkpi'], path=my_path) # Process the events b2.process(my_path) # print out the summary print(b2.statistics)