def filterPID(name, input, config, level=1): cuts = ["(NINGENERATION(('p+'==ABSID) & (PIDp < %s),%d) == 0)" \ % (config['P']['PIDp_MIN'],level), "(NINGENERATION(('K+'==ABSID) & (PIDK < %s), %d) == 0)" \ % (config['K']['PIDK_MIN'],level), "(NINGENERATION(('pi+'==ABSID) & (PIDK > %s), %d) == 0)" \ % (config['PI']['PIDK_MAX'],level)] return filterSelection(name, LoKiCuts.combine(cuts), input)
def _makeXic2pKpi(self): '''Makes Xic -> p K pi + cc''' dm,units = LoKiCuts.cutValue(self.config['MASS_WINDOW']) comboCuts = [LoKiCuts(['ASUMPT'],self.config).code(), "(ADAMASS('Xi_c+') < %s*%s) " % (dm+10,units), hasTopoChild()] comboCuts.append(LoKiCuts(['AMAXDOCA'],self.config).code()) comboCuts = LoKiCuts.combine(comboCuts) momCuts = ["(ADMASS('Xi_c+') < %s*%s) " % (dm,units), LoKiCuts(['VCHI2DOF','BPVVDCHI2','BPVDIRA'], self.config).code()] momCuts = LoKiCuts.combine(momCuts) cp = CombineParticles(CombinationCut=comboCuts,MotherCut=momCuts, DecayDescriptors=["[Xi_c+ -> p+ K- pi+]cc"]) return Selection('Xic2PKPiBeauty2Charm',Algorithm=cp, RequiredSelections=[self.pions,self.kaons, self.protons])
def _makeHc2Dpi(self,name,massCut,decays,inputs): comboCuts = [massCut,LoKiCuts(['AMAXDOCA'],self.config).code()] comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF','BPVVDCHI2','BPVDIRA'], self.config).code() cp = CombineParticles(CombinationCut=comboCuts,MotherCut=momCuts, DecayDescriptors=decays) return [Selection(name+'2D0PiBeauty2Charm',Algorithm=cp, RequiredSelections=inputs)]
def _makeX2HH(self,name,decays,amass,config,inputs): ''' Makes all X -> HH selections with charged tracks only.''' comboCuts = [LoKiCuts(['ASUMPT'],config).code(),amass,hasTopoChild()] #comboCuts.append(LoKiCuts(['AMAXDOCA'],config).code()) comboCuts = LoKiCuts.combine(comboCuts) #momCuts = LoKiCuts(['VCHI2DOF','BPVVDCHI2','BPVDIRA'],config).code() momCuts = LoKiCuts(['VCHI2DOF','BPVVDCHI2'],config).code() cp = CombineParticles(CombinationCut=comboCuts,MotherCut=momCuts, DecayDescriptors=decays) return Selection(name+'Beauty2XGamma',Algorithm=cp,RequiredSelections=inputs)
def _makeD2X(self,name,decays,wm,config,extrainputs=[]): ''' Makes all D -> X selections.''' comboCuts = [LoKiCuts(['ASUMPT'],config).code(),wm,hasTopoChild()] comboCuts.append(LoKiCuts(['AMAXDOCA'],config).code()) comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF','BPVVDCHI2','BPVDIRA'],config).code() cp = CombineParticles(CombinationCut=comboCuts,MotherCut=momCuts, DecayDescriptors=decays) return Selection('Proto'+name+'Beauty2Charm',Algorithm=cp, RequiredSelections=[self.pions]+extrainputs)
def _makeX2HHH(self,name,decays,amass,config,inputs,pi0=False): ''' Makes all X -> HHH selections involving neutrals.''' comboCuts = [LoKiCuts(['ASUMPT'],config).code(),amass,hasTopoChild()] comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF','BPVVDCHI2'],config).code() cp = CombineParticles(CombinationCut=comboCuts,MotherCut=momCuts,DecayDescriptors=decays) if pi0: cp = cp.configurable(name+'Beauty2XGammaCombiner') cp.ParticleCombiners = { '' : 'LoKi::VertexFitter' } return Selection(name+'Beauty2XGamma',Algorithm=cp,RequiredSelections=inputs)
def __init__(self,pions,ks,pi0,config,config_pid): self.pions = pions self.ks = ks self.pi0 = pi0 self.config = config self.hh = self._makeD2hh() self.hhh = self._makeD2hhh() self.hhhh = self._makeD2hhhh() self.ksh_ll = self._makeD2KSh("LL") self.ksh_dd = self._makeD2KSh("DD") self.kshh_ll = self._makeD2KShh("LL") self.kshh_dd = self._makeD2KShh("DD") self.pi0hh_merged = self._makeD2Pi0hh("Merged") self.pi0hh_resolved = self._makeD2Pi0hh("Resolved") self.pi0hhh_merged = self._makeD2Pi0hhh("Merged") self.pi0hhh_resolved = self._makeD2Pi0hhh("Resolved") # PID filtered selections self.hh_pid = [filterPID('D2HHPID',self.hh,config_pid)] self.hhh_pid = [filterPID('D2HHHPID',self.hhh,config_pid)] # subset decays oneK = "NINTREE(ABSID=='K+') == 1" d_cf = "(((ID=='D+') & (NINTREE(ID=='K-')==1) & (%s)) | "\ "((ID=='D-') & (NINTREE(ID=='K+')==1) & (%s)))" % (oneK,oneK) ds_cf = "((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1))" self.kpi_pid = [filterSelection('D2KPIPID',oneK,self.hh_pid)] self.k3pi = [filterSelection('D2K3PI',oneK,self.hhhh)] self.pi0kpi_merged = [filterSelection('D2Pi0KPi_Merged',oneK, self.pi0hh_merged)] self.pi0kpi_resolved = [filterSelection('D2Pi0KPi_Resolved',oneK, self.pi0hh_resolved)] d_min,d_max,ds_min,ds_max = self._massWindowD2HHHCF() d_cf = LoKiCuts.combine([d_cf,"in_range(%s,MM,%s)"%(d_min,d_max)]) ds_cf = LoKiCuts.combine([ds_cf,"in_range(%s,MM,%s)"%(ds_min,ds_max)]) cf = '('+d_cf+') | (' + ds_cf + ')' self.hhh_cf_pid = [filterSelection('D2HHHCFPID',cf,self.hhh_pid)] # WS decays self.kshh_ll_ws = self._makeD2KShhWS("LL") self.kshh_dd_ws = self._makeD2KShhWS("DD") self.hh_ws = self._makeD2hhWS() self.pi0hh_merged_ws = self._makeD2Pi0hhWS('Merged') self.pi0hh_resolved_ws = self._makeD2Pi0hhWS('Resolved') self.hhhh_ws = self._makeD2hhhhWS()
def _makeXiccp2Xic0pi(self): '''Makes Lc -> p K pi + cc''' dm, units = LoKiCuts.cutValue(self.config['MASS_WINDOW']) comboCuts = [ LoKiCuts(['ASUMPT'], self.config).code(), "(ADAMASS('Xi_cc+') < %s*%s) " % (dm + 410, units) ] comboCuts.append(LoKiCuts(['AMAXDOCA'], self.config).code()) comboCuts = LoKiCuts.combine(comboCuts) momCuts = [ "(ADMASS('Xi_cc+') < %s*%s) " % (dm + 400, units), LoKiCuts(['VCHI2DOF', 'BPVVDCHI2', 'BPVDIRA'], self.config).code() ] momCuts = LoKiCuts.combine(momCuts) cp = CombineParticles(CombinationCut=comboCuts, MotherCut=momCuts, DecayDescriptors=["[Xi_cc+ -> Xi_c0 pi+]cc"]) return Selection('Xiccp2Xic0PiXic02PKKPiPBeauty2Charm', Algorithm=cp, RequiredSelections=self.xic0 + [self.pions])
def makeJ(default_config,inputs): comboCuts = "(ADAMASS('J/psi(1S)') < %s)" % default_config['ADAMASS_MAX'] comboCuts += " & (ACUTDOCA(0.2*mm,''))" comboCuts += "& (ADOCACHI2CUT(25,''))" momCuts = LoKiCuts(['HASVERTEX','VCHI2DOF'],default_config).code() momCuts = LoKiCuts.combine(['(BPVDIRA > 0)',momCuts]) j = CombineParticles(DecayDescriptors=['J/psi(1S) -> mu+ mu-'], CombinationCut=comboCuts,MotherCut=momCuts) #print 'makeJ:',comboCuts,momCuts return Selection("J2MuMuDarkBosonSel",Algorithm=j, RequiredSelections=inputs)
def _makeXPLUS2HH(self,name,decays,amass,config,inputs,pi0=False): ''' Makes all X+ -> HH selections involving neutrals.''' comboCuts = [LoKiCuts(['ASUMPT'],config).code(),amass,hasTopoChild()] comboCuts = LoKiCuts.combine(comboCuts) momCuts = "ALL" cp = CombineParticles(CombinationCut=comboCuts,MotherCut=momCuts, DecayDescriptors=decays) if pi0: cp = cp.configurable(name+'Beauty2XGammaCombiner') cp.ParticleCombiners.update({'':'MomentumCombiner'}) return Selection(name+'Beauty2XGamma',Algorithm=cp, RequiredSelections=inputs)
def makeX(which,default_config,dec,inputs): comboCuts = "(AM < 5000*MeV) & (APT > %s)" % default_config['PT_MIN'] if(which.find('DD') < 0): comboCuts += " & (ACUTDOCA(0.2*mm,''))" comboCuts += "& (ADOCACHI2CUT(25,''))" momCuts = LoKiCuts(['HASVERTEX','BPVVDCHI2','VCHI2DOF'],default_config).code() momCuts = LoKiCuts.combine(['(BPVDIRA > 0)',momCuts]) x = CombineParticles(DecayDescriptors=[dec], CombinationCut=comboCuts,MotherCut=momCuts) #print 'makeX:',which,comboCuts,momCuts return Selection("X2"+which+"DarkBosonSel",Algorithm=x, RequiredSelections=inputs)
def makeB2X(name, decay, inputs, config): '''Makes all B -> X selections.''' comboCuts = LoKiCuts(['SUMPT', 'AM', 'AMAXDOCA'], config).code() momCuts = [ LoKiCuts(['VCHI2DOF'], config).code(), has1TrackChild(), hasTopoChildren(), LoKiCuts(['BPVIPCHI2', 'BPVLTIME', 'BPVDIRA'], config).code() ] momCuts = LoKiCuts.combine(momCuts) b2x = CombineParticles(DecayDescriptors=decay, CombinationCut=comboCuts, MotherCut=momCuts) return Selection(name, Algorithm=b2x, RequiredSelections=inputs)
def _makeSels(self,decays,xtag,inputs): sels = [] for tag, decay in decays.iteritems(): comboCuts = LoKiCuts(['SUMPT','AM'],self.config).code() momCuts = [LoKiCuts(['VCHI2DOF'],self.config).code(), hasTopoChildren()] momCuts = LoKiCuts.combine(momCuts) b2x = CombineParticles(DecayDescriptors=decay, CombinationCut=comboCuts, MotherCut=momCuts) sel = Selection(tag+xtag+'Beauty2Charm',Algorithm=b2x, RequiredSelections=inputs[tag]) sels.append(sel) return sels
def makeB2DstarX(sel, uppions, config): # change B to something that doesn't fly sub = SubstitutePID('SubPID' + sel.name(), Code="DECTREE('Beauty -> Charm ...')") sub.MaxChi2PerDoF = -666 sub.Substitutions = {'Beauty -> Charm ...': 'J/psi(1S)'} subsel = Selection(sel.name() + 'DstarUPSel', Algorithm=sub, RequiredSelections=[sel]) filter = "INTREE(ID=='J/psi(1S)')" subsel = filterSelection(sel.name() + 'DstarUPFilter', filter, [subsel]) # Delta M cut on D* (preambulo is below) #dmcut = '((ISD1 & ((MD1PI-MD1) < 180)) | (ISD2 & ((MD2PI-MD2) < 180)))' #dmcut = '((MD1PI-MD1) < 180) | ((MD2PI-MD2) < 180)' dmcut = "((((IDD1==421)|(IDD1==411)) & ((MD1PI-MD1) < 180)) | (((IDD2==421)|(IDD2==411)) & ((MD2PI-MD2) < 180)))" # add UP track combConfig = {'AMAXDOCA_MAX': '0.5*mm'} comboCuts = [LoKiCuts(['AMAXDOCA'], combConfig).code(), dmcut] comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF', 'BPVVDCHI2', 'BPVDIRA'], config).code() #did = "((ABSID=='D+')|(ABSID=='D0'))" preambulo = [ 'PXPI = ACHILD(PX,2)', 'PYPI = ACHILD(PY,2)', 'PZPI = ACHILD(PZ,2)', 'EPI = ACHILD(E,2)', 'IDD1 = ACHILD(CHILD(ABSID,1),1)', #'ISD1 = ACHILD(CHILD(%s,1),1)' % did, 'PXD1 = ACHILD(CHILD(PX,1),1)', 'PYD1 = ACHILD(CHILD(PY,1),1)', 'PZD1 = ACHILD(CHILD(PZ,1),1)', 'ED1 = ACHILD(CHILD(E,1),1)', 'MD1 = ACHILD(CHILD(M,1),1)', 'MD1PI = sqrt((EPI+ED1)**2 - (PXPI+PXD1)**2 - (PYPI+PYD1)**2 - (PZPI+PZD1)**2)', #'ISD2 = ACHILD(CHILD(%s,2),1)' % did, 'IDD2 = ACHILD(CHILD(ABSID,2),1)', 'PXD2 = ACHILD(CHILD(PX,2),1)', 'PYD2 = ACHILD(CHILD(PY,2),1)', 'PZD2 = ACHILD(CHILD(PZ,2),1)', 'ED2 = ACHILD(CHILD(E,2),1)', 'MD2 = ACHILD(CHILD(M,2),1)', 'MD2PI = sqrt((EPI+ED2)**2 - (PXPI+PXD2)**2 - (PYPI+PYD2)**2 - (PZPI+PZD2)**2)', ] cp = CombineParticles(CombinationCut=comboCuts, MotherCut=momCuts, Preambulo=preambulo, DecayDescriptor='[B+ -> J/psi(1S) pi+]cc') return Selection('DstarUP' + sel.name(), Algorithm=cp, RequiredSelections=[uppions] + [subsel])
def makeBc2BX(name,decay,inputs,config): from copy import deepcopy config = deepcopy(config) comboCuts = LoKiCuts(['SUMPT','AM'],config).code() flightCuts = ['BPVLTIME','DZ1'] flightCuts += ['BPVIPCHI2','BPVDIRA'] momCuts = [LoKiCuts(['VCHI2DOF'],config).code(), "INTREE( HASTRACK & ISBASIC & (P>5000*MeV) & (PT > 500*MeV) & (MIPCHI2DV(PRIMARY) > 10) & (MIPDV(PRIMARY) > 0.06*mm))", LoKiCuts(flightCuts,config).code()] momCuts = LoKiCuts.combine(momCuts) bc2bx = CombineParticles(DecayDescriptors=decay, CombinationCut=comboCuts, MotherCut=momCuts) return Selection(name,Algorithm=bc2bx,RequiredSelections=inputs)
def _makeFiltCharm(self,input,name,tag): x = self.tightCuts dCuts = deepcopy(x) childPIDp = "(NINGENERATION( ('p+'==ABSID) & (PIDp < %s), 1) < 1 )"\ %(self.config['pPIDp_MIN']) childPIDK = "(NINGENERATION( ('K+'==ABSID) & (PIDK < %s), 1) < 1 )"\ %(self.config['KPIDK_MIN']) childPIDpi = "(NINGENERATION( ('pi+'==ABSID) & (PIDK > %s), 1) < 1 )"\ %(self.config['piPIDK_MAX']) dCuts.append(childPIDK ) dCuts.append(childPIDpi ) dCuts.append(childPIDp ) # Create Tight D+- Mesons dCuts.append(self._massWindow(tag)) dCuts = LoKiCuts.combine(dCuts) return [filterSelection(name,dCuts,input)]
def _makeX2HHH(self, name, decays, amass, config, inputs): ''' Makes all X -> HHH selections with charged tracks only.''' comboCuts = [ LoKiCuts(['ASUMPT'], config).code(), amass, hasTopoChild() ] comboCuts12 = [LoKiCuts(['ADOCA12'], config).code()] comboCuts.append(LoKiCuts(['ADOCA13'], config).code()) comboCuts.append(LoKiCuts(['ADOCA23'], config).code()) numPassPtCut = "(ANUM(PT < %s) <= 1)" % (config['PTMIN1']) comboCuts.append(numPassPtCut) comboCuts = LoKiCuts.combine(comboCuts) comboCuts12 = LoKiCuts.combine(comboCuts12) momCuts = LoKiCuts([ 'VCHI2DOF', 'BPVVDCHI2', 'BPVDIRA', 'MIPCHI2DV', 'BPVVDRHO', 'BPVVDZ' ], config).code() cp = DaVinci__N3BodyDecays(Combination12Cut=comboCuts12, CombinationCut=comboCuts, MotherCut=momCuts, DecayDescriptors=decays) return Selection(name + 'Beauty2Charm', Algorithm=cp, RequiredSelections=inputs)
def makeB(name,decays,inputs,default_config): comboCuts = LoKiCuts(['AM','SUMPT'],default_config).code() momCuts = LoKiCuts(['HASVERTEX','PT','VCHI2DOF','BPVLTIME','BPVIPCHI2'],default_config).code() cuts = '(BPVDIRA > 0) & ' cuts += '(NINGENERATION(ISBASIC & (MIPCHI2DV(PRIMARY) < %s),1)==0)' \ % default_config['HAD_MINIPCHI2_MIN'] momCuts = LoKiCuts.combine([cuts,momCuts]) momCuts += ' & (MM > %s) & (MM < %s)' % (default_config['AM_MIN'],default_config['AM_MAX']) alg = CombineParticles(DecayDescriptors=decays) alg.ReFitPVs = True alg.CombinationCut=comboCuts alg.MotherCut=momCuts #print 'makeB:',name,comboCuts,momCuts,decays return Selection(name+"DarkBosonSel",Algorithm=alg, RequiredSelections=inputs)
def makeLambda2X(name, decay, inputs, config): '''Makes all Lambda -> X selections.''' from copy import deepcopy comboCuts = LoKiCuts(['SUMPT', 'AM'], config).code() #flightCuts = ['BPVLTIME'] #if useIP: # flightCuts += ['BPVIPCHI2','BPVDIRA'] #momCuts = [LoKiCuts(['VCHI2DOF'],config).code(), momCuts = [has1TrackChild()] momCuts = LoKiCuts.combine(momCuts) b2x = CombineParticles(DecayDescriptors=decay, CombinationCut=comboCuts, MotherCut=momCuts) b2x.ParticleCombiners = {'': 'LoKi::VertexFitter'} return Selection(name, Algorithm=b2x, RequiredSelections=inputs)
def makeY2X(name,decay,inputs,config,vertex=True): wm = ['in_range(%s,AM,%s)' % (config['MASS_MIN']['Y'], config['MASS_MAX']['Y'])] wm = '('+('|'.join(wm))+')' comboCuts = [LoKiCuts(['SUMPT'],config).code(),wm] comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF','BPVDIRA'],config).code() y2x = CombineParticles(DecayDescriptors=decay,CombinationCut=comboCuts, MotherCut=momCuts) if not vertex: y2x = y2x.configurable(name+'B2MuMuXVertexFitter') y2x.addTool(OfflineVertexFitter) y2x.ParticleCombiners.update( { "" : "OfflineVertexFitter"} ) y2x.OfflineVertexFitter.useResonanceVertex = False return Selection(name,Algorithm=y2x,RequiredSelections=inputs)
def makeB2X(name,decay,inputs,config,useIP=True,resVert=True): '''Makes all B -> X selections.''' from copy import deepcopy comboCuts = LoKiCuts(['SUMPT','AM'],config).code() flightCuts = ['BPVLTIME'] if useIP: flightCuts += ['BPVIPCHI2','BPVDIRA'] momCuts = [LoKiCuts(['VCHI2DOF'],config).code(),has1TrackChild(), hasTopoChildren(),LoKiCuts(flightCuts,config).code()] momCuts = LoKiCuts.combine(momCuts) b2x = CombineParticles(DecayDescriptors=decay,CombinationCut=comboCuts, MotherCut=momCuts) if not resVert: b2x = b2x.configurable(name+'Beauty2CharmVertexFitter') b2x.addTool(OfflineVertexFitter) b2x.VertexFitters.update( { "" : "OfflineVertexFitter"} ) b2x.OfflineVertexFitter.useResonanceVertex = False return Selection(name,Algorithm=b2x,RequiredSelections=inputs)
def makeV0s(name, particles, decay, config): ''' Makes all V0 -> X+X- selections.''' dauPiCuts = { 'pi+': LoKiCuts(['P', 'PT', 'TRCHI2DOF', 'MIPCHI2DV'], config['DAUGHTERS']).code() } dauKCuts = { 'K+': LoKiCuts(['P', 'PT', 'TRCHI2DOF', 'MIPCHI2DV'], config['DAUGHTERS']).code() } if 'Rho' in name: wm = [ 'in_range(%s,AM,%s)' % (config['MASS_MIN']['RHO'], config['MASS_MAX']['RHO']) ] elif 'Kst' in name: wm = [ 'in_range(%s,AM,%s)' % (config['MASS_MIN']['KST'], config['MASS_MAX']['KST']) ] elif 'Phi' in name: wm = [ 'in_range(%s,AM,%s)' % (config['MASS_MIN']['PHI'], config['MASS_MAX']['PHI']) ] wm = '(' + ('|'.join(wm)) + ')' comboCuts = [LoKiCuts(['ASUMPT'], config).code(), wm] comboCuts.append(LoKiCuts(['AMAXDOCA'], config).code()) comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF', 'BPVVDCHI2', 'BPVDIRA'], config).code() cp = CombineParticles(CombinationCut=comboCuts, MotherCut=momCuts, DecayDescriptors=[decay]) return Selection(name + 'B2MuMuX', Algorithm=cp, RequiredSelections=particles)
def filterEE(which,econf,xconf,inputs): code = "(ID=='J/psi(1S)') & (PT > %s) & (MINTREE('e+'==ABSID,PIDe) > %s)" \ % (xconf['PT_MIN'],econf['PIDe_MIN']) code += " & (MINTREE('e+'==ABSID,MIPCHI2DV(PRIMARY)) > %s)" \ % econf['MIPCHI2DV_MIN'] code += " & (MINTREE('e+'==ABSID,PT) > %s)" % econf['PT_MIN'] code += " & (MAXTREE('e+'==ABSID,TRGHP) < %s)" % econf['TRGHP_MAX'] code = LoKiCuts.combine([code,LoKiCuts(['HASVERTEX','BPVVDCHI2','VCHI2DOF'], xconf).code()]) #print "filterEE: ", code sel = Selection(which+'FilterEEDarkBosonFilter', Algorithm=FilterDesktop(Code=code), RequiredSelections=inputs) sub = SubstitutePID(which+'EESubPIDDarkBoson', Code="DECTREE('J/psi(1S) -> e+ e-')") sub.MaxChi2PerDoF = -666 sub.Substitutions = {'J/psi(1S) -> e+ e-' : 'KS0'} return Selection(which+'EESubPIDDarkBosonSel',Algorithm=sub, RequiredSelections=[sel])
def makeB2TwoDetachedDimuons(name, config, inputSel): """ B --> KS0 KS0 --> 4mu selection """ # define cuts on B object wm = [ 'in_range(%s,AM,%s)' % (config['MASS_MIN']['B'], config['MASS_MAX']['B']) ] wm = '(' + ('|'.join(wm)) + ')' comboCuts = [LoKiCuts(['SUMPT'], config).code(), wm] comboCuts = LoKiCuts.combine(comboCuts) momCuts = LoKiCuts(['VCHI2DOF', 'BPVVDCHI2', 'BPVIPCHI2', 'BPVDIRA'], config).code() B2KSKS = CombineParticles("Combine" + name) B2KSKS.DecayDescriptor = 'B0 -> KS0 KS0' B2KSKS.CombinationCut = comboCuts B2KSKS.MotherCut = momCuts return Selection(name, Algorithm=B2KSKS, RequiredSelections=inputSel)
def makeB2X(name,decay,inputs,config,useIP=True,resVert=True): '''Makes all B -> X selections.''' from copy import deepcopy config = deepcopy(config) if name.find('B02') >= 0 or name.find('B2D0PiNoIP') >= 0: config['AM_MAX'] = '6000*MeV' if name.find('B02DPiD2HHHBeauty2Charm') >=0 or name.find('B02DKD2HHHBeauty2Charm') >=0 : config['AM_MAX'] = '7000*MeV' if name.find('B02DPiD2Pi0HHHResolvedBeauty2Charm') >=0 or name.find('B02DKD2Pi0HHHResolvedBeauty2Charm') >=0 : config['AM_MAX'] = '7000*MeV' #if name.find('Bc') >=0 : # config['AM_MIN'] = '6000*MeV' # config['AM_MAX'] = '7000*MeV' comboCuts = LoKiCuts(['SUMPT','AM'],config).code() flightCuts = ['BPVLTIME','DZ1','DZ2'] if useIP: flightCuts += ['BPVIPCHI2','BPVDIRA'] momCuts = [LoKiCuts(['VCHI2DOF', 'BPVCORRM'],config).code(),has1TrackChild(), hasTopoChildren(),LoKiCuts(flightCuts,config).code()] momCuts = LoKiCuts.combine(momCuts) b2x = CombineParticles(DecayDescriptors=decay,CombinationCut=comboCuts, MotherCut=momCuts) return Selection(name,Algorithm=b2x,RequiredSelections=inputs)
def filterPhotonsConv(inputs, config): ''' Makes converted photons before the magnet ''' cuts = ['MM', 'VCHI2DOF'] code = LoKiCuts.combine(["HASVERTEX", LoKiCuts(cuts, config).code()]) return filterSelection("GammaConv", code, inputs)
def filterPhotons(inputs, config): cuts = ['PT', 'CL'] code = LoKiCuts.combine(["ABSID==22", LoKiCuts(cuts, config).code()]) return filterSelection("Gamma", code, inputs)
def __init__(self,pions,kaons,ks,pi0,uppions,muons,config,config_pid): self.pions = pions self.kaons = kaons self.ks = ks self.pi0 = pi0 self.uppions = uppions self.muons = muons self.config = config self.config_pid = config_pid self.hh = self._makeD2hh() self.hhh = self._makeD2hhh() self.hhhh = self._makeD2hhhh() self.ksh_ll = self._makeD2KSh("LL") self.ksh_dd = self._makeD2KSh("DD") self.kshh_ll = self._makeD2KShh("LL") self.kshh_dd = self._makeD2KShh("DD") self.pi0hh_merged = self._makeD2Pi0hh("Merged") self.pi0hh_resolved = self._makeD2Pi0hh("Resolved") self.pi0hhh_merged = self._makeD2Pi0hhh("Merged") self.pi0hhh_resolved = self._makeD2Pi0hhh("Resolved") self.kspi0hh_ll_merged = self._makeD2KSPi0hh("LL","Merged") self.kspi0hh_ll_resolved = self._makeD2KSPi0hh("LL","Resolved") self.kspi0hh_dd_merged = self._makeD2KSPi0hh("DD","Merged") self.kspi0hh_dd_resolved = self._makeD2KSPi0hh("DD","Resolved") # UP tracks in D self.hh_up = self._makeD2hh(True) self.hhh_up = self._makeD2hhh(True) self.hhhh_up = self._makeD2hhhh(True) self.ksh_ll_up = self._makeD2KSh("LL",True) self.ksh_dd_up = self._makeD2KSh("DD",True) self.kshh_ll_up = self._makeD2KShh("LL",True) self.kshh_dd_up = self._makeD2KShh("DD",True) self.pi0hh_merged_up = self._makeD2Pi0hh("Merged",True) self.pi0hh_resolved_up = self._makeD2Pi0hh("Resolved",True) self.pi0hhh_merged_up = self._makeD2Pi0hhh("Merged",True) self.pi0hhh_resolved_up = self._makeD2Pi0hhh("Resolved",True) # PID filtered selections self.hh_pid = [filterPID('D2HHPID',self.hh,config_pid)] self.hh_pid_tight = [filterPID('D2HHTIGHTPID',self.hh_pid, config_pid['TIGHT'])] self.hhh_pid = [filterPID('D2HHHPID',self.hhh,config_pid)] self.hhh_pid_tight = [filterPID('D2HHHPIDTIGHT',self.hhh_pid, config_pid['TIGHT'])] self.hh_pid_tight_up = [filterPID('D2HHPIDTIGHTUP',self.hh_up,config_pid['TIGHT'])] # subset decays oneK = "NINTREE(ABSID=='K+') == 1" self.kpi = [filterSelection('D2KPi',oneK,self.hh)] d_cf = "(((ID=='D+') & (NINTREE(ID=='K-')==1) & (%s)) | "\ "((ID=='D-') & (NINTREE(ID=='K+')==1) & (%s)))" % (oneK,oneK) ds_cf = "((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1))" self.kpi_pid = [filterSelection('D2KPIPID',oneK,self.hh_pid)] self.kpi_pid_tight = [filterSelection('D2KPITIGHTPID',oneK,self.hh_pid_tight)] self.kpi_pid_tighter1 = [filterPID('D2KPITIGHTER1PID',self.kpi_pid,config_pid['TIGHTER1'])] #d0 narrow mass window +-40MeV d0_narrow_min,d0_narrow_max = self._massWindow('D0narrow') self.kpi_pid_tighter1_narrow = [filterSelection('D2KPITIGHTER1PIDNARROWMW','in_range(%s,MM,%s)'%(d0_narrow_min,d0_narrow_max),self.kpi_pid_tighter1)] self.kpi_pid_tight_up = [filterSelection('D2KPITIGHTPIDUP',oneK,self.hh_pid_tight_up)] self.k3pi = [filterSelection('D2K3PI',oneK,self.hhhh)] self.k3pi_up = [filterSelection('D2K3PIUP',oneK,self.hhhh_up)] self.k3pi_pid = [filterPID('D2K3PIPID',self.k3pi,config_pid)] self.k3pi_pid_tight = [filterPID('D2K3PIPIDTIGHT',self.k3pi,config_pid['TIGHT'])] self.k3pi_pid_tighter1 = [filterPID('D2K3PIPIDTIGHTER1',self.k3pi,config_pid['TIGHTER1'])] self.k3pi_pid_tighter1_narrow = [filterSelection('D2K3PIPIDTIGHTER1NARROWMW','in_range(%s,MM,%s)'%(d0_narrow_min,d0_narrow_max),self.k3pi_pid_tighter1)] self.k3pi_pid_tight_up = [filterPID('D2K3PIPIDTIGHTUP',self.k3pi_up,config_pid['TIGHT'])] self.d0_cf_pid = [MergedSelection('D0CFPID', RequiredSelections=self.kpi_pid+self.k3pi_pid)] self.pi0kpi_merged = [filterSelection('D2Pi0KPi_Merged',oneK, self.pi0hh_merged)] self.pi0kpi_resolved = [filterSelection('D2Pi0KPi_Resolved',oneK, self.pi0hh_resolved)] d_min,d_max,ds_min,ds_max = self._massWindowD2HHHCF() #use this below d_cf_noMassWin = d_cf d_cf = LoKiCuts.combine([d_cf,"in_range(%s,MM,%s)"%(d_min,d_max)]) ds_cf = LoKiCuts.combine([ds_cf,"in_range(%s,MM,%s)"%(ds_min,ds_max)]) cf = '('+d_cf+') | (' + ds_cf + ')' self.hhh_cf_pid = [filterSelection('D2HHHCFPID',cf,self.hhh_pid)] ds = "(((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1)) |" ds += "(NINTREE(ABSID=='K+')==0) | " ds += "((ID=='D+') & (NINTREE(ID=='K+')==1) & (%s)) | "\ "((ID=='D-') & (NINTREE(ID=='K-')==1) & (%s)))" % (oneK,oneK) ds = LoKiCuts.combine([ds,"in_range(%s,MM,%s)"%(ds_min,ds_max)]) #print 'ds =', ds self.ds_hhh_pid_tight = [filterSelection('Ds2HHHPIDTIGHT',ds, self.hhh_pid_tight)] # WS decays self.kshh_ll_ws = self._makeD2KShhWS("LL") self.kshh_dd_ws = self._makeD2KShhWS("DD") self.hh_ws = self._makeD2hhWS() self.pi0hh_merged_ws = self._makeD2Pi0hhWS('Merged') self.pi0hh_resolved_ws = self._makeD2Pi0hhWS('Resolved') self.hhhh_ws = self._makeD2hhhhWS() # phi mu nu self.phimu = self._makeD2PhiMuNu() #Different subsets or selections for FULL DST lines #Different PID filtering self.hhh_pid_tightpi = [filterPID('D2HHHPIDTIGHTPI',self.hhh_pid,config_pid['TIGHTPI'])] self.hhh_pid_tightpi_up = [filterPID('D2HHHPIDTIGHTPIUP',self.hhh_up,config_pid['TIGHTPI'])] self.hhh_pid_tighter = [filterPID('D2HHHPIDTIGHTER',self.hhh_pid,config_pid['TIGHTER'])] self.hhh_pid_special = [filterPID('D2HHHPIDSPECIAL',self.hhh,config_pid['SPECIAL'])] self.hhh_pid_specialpi = [filterPID('D2HHHPIDSPECIALPI',self.hhh,config_pid['SPECIALPI'])] self.hh_pid_tight = [filterPID('D2HHPIDTIGHT',self.hh_pid,config_pid['TIGHT'])] kkpi = "((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1))" self.kkpi_pid_tightpi = [filterSelection('D2KKPiPIDTIGHTPI',kkpi,self.hhh_pid_tightpi)] self.kkpi_pid_specialpi = [filterSelection('D2KKPiPIDSPECIALPI',kkpi,self.hhh_pid_specialpi)] #filter fo d2kkpi myPreAmble = [ "qPion = CHILD(Q,'pi+' == ABSID)", "qKaonP = CHILD(Q, 'K+' == ID)", "qKaonM = CHILD(Q, 'K-' == ID)", "px_pi = CHILD(PX, 'pi+' == ABSID ) " , "py_pi = CHILD(PY, 'pi+' == ABSID ) " , "pz_pi = CHILD(PZ, 'pi+' == ABSID ) " , "e_pi = CHILD(E, 'pi+' == ABSID ) " , "px_kp = CHILD(PX, 'K+' == ID ) " , "py_kp = CHILD(PY, 'K+' == ID ) " , "pz_kp = CHILD(PZ, 'K+' == ID ) " , "e_kp = CHILD(E, 'K+' == ID ) " , "pid_kp = CHILD(PIDK, 'K+' == ID ) " , "px_km = CHILD(PX, 'K-' == ID ) " , "py_km = CHILD(PY, 'K-' == ID ) " , "pz_km = CHILD(PZ, 'K-' == ID ) " , "e_km = CHILD(E, 'K-' == ID ) " , "pid_km = CHILD(PIDK, 'K-' == ID ) " , "px_KK = px_kp + px_km ", "py_KK = py_kp + py_km ", "pz_KK = pz_kp + pz_km ", "e_KK = e_kp + e_km" , "m_KK = sqrt ( e_KK**2 - px_KK**2 - py_KK**2 - pz_KK**2 ) ", "px_Kpi1 = px_kp + px_pi " , "py_Kpi1 = py_kp + py_pi " , "pz_Kpi1 = pz_kp + pz_pi " , "e_Kpi1 = e_kp + e_pi " , "m_KpPim = sqrt ( e_Kpi1**2 - px_Kpi1**2 - py_Kpi1**2 - pz_Kpi1**2 ) ", "px_Kpi2 = px_km + px_pi " , "py_Kpi2 = py_km + py_pi " , "pz_Kpi2 = pz_km + pz_pi " , "e_Kpi2 = e_km + e_pi " , "m_KmPip = sqrt ( e_Kpi2**2 - px_Kpi2**2 - py_Kpi2**2 - pz_Kpi2**2 ) " ] D1isDs2KKPi = "( ((pid_km>0) & (pid_kp>0)) | (m_KK<1040) | ((qPion*qKaonP<0) & (abs(m_KpPim-892)<100)) | ((qPion*qKaonM<0) & (abs(m_KmPip-892)<100) ) )" #self.kkpi_custom = [filterSelection('D2KKPiCUSTOM',D1isDs2KKPi,self.kkpi_pid_tightpi,myPreAmble)] self.kkpi_custom = [filterSelection('D2KKPiCUSTOM',D1isDs2KKPi,self.kkpi_pid_specialpi,myPreAmble)] #for use with the FULL DST B --> Ds 3H lines #ds non CF selection = (Ds+ --> K+pi+pi-) | (Ds+ --> 3pi) ds_pipipi = "(NINTREE(ABSID=='K+')==0)" ds_kpipi = "((ID=='D+') & (NINTREE(ID=='K+')==1) & (%s)) | "\ "((ID=='D-') & (NINTREE(ID=='K-')==1) & (%s))" % (oneK,oneK) self.ds_hhh_cf_custom = [filterSelection('Ds2HHHCFCUSTOM',"in_range(%s,MM,%s)"%(ds_min,ds_max),self.kkpi_custom)] self.ds_pipipi_pid_tightpi = [filterSelection('Ds2PiPiPiPIDTIGHTPI',ds_pipipi,self.hhh_pid_tightpi)] self.ds_kpipi_pid_special = [filterSelection('Ds2KPiPiPIDSPECIAL',ds_kpipi,self.hhh_pid_special)] self.ds_hhh_pid_custom = [MergedSelection('Ds2HHHPIDCUSTOM', RequiredSelections=self.ds_pipipi_pid_tightpi+self.ds_kpipi_pid_special+self.ds_hhh_cf_custom)] #this spans the whole mass range covered by D+ and Ds (comes from self.hhh) #either d(s) --> pipipi kpipi or kkpi self.hhh_pid_custom = [MergedSelection('D2HHHPIDCUSTOM', RequiredSelections=self.ds_pipipi_pid_tightpi+self.ds_kpipi_pid_special+self.kkpi_custom)] #for use with the FULL DST B --> DD line #add D+ --> K+K-pi+ to the d_cf selection #remove trailing bracket to add this charge combo in #d_cf_plus = d_cf_noMassWin[:-1] + " | ((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1)))" #d_cf_plus = LoKiCuts.combine([d_cf_plus,"in_range(%s,MM,%s)"%(d_min,d_max)]) #d_kkpi_custom = [filterSelection('Dplus2KKPiCUSTOM',"in_range(%s,MM,%s)"%(d_min,d_max),self.kkpi_custom)] self.d_cf_hhh_pid_tightpi = [filterSelection('Dplus2HHHCF',d_cf,self.hhh_pid_tightpi)] #self.d_hhh_custom = [MergedSelection('Dplus2HHHCUSTOM',RequiredSelections=d_kkpi_custom+self.d_cf_hhh_pid_tightpi)] self.d_cf_hhh_pid_tightpi_up = [filterSelection('Dplus2HHHCFUP',d_cf,self.hhh_pid_tightpi_up)] #self.d_hhh_4_B2DD_custom = [MergedSelection('D2HHH_4_B2DD_CUSTOM_Beauty2Charm', # RequiredSelections=self.ds_hhh_pid_custom+self.d_hhh_custom)] self.d_hhh_4_B2DD_custom = [MergedSelection('D2HHH_4_B2DD_CUSTOM_Beauty2Charm', RequiredSelections=self.hhh_pid_custom+self.d_cf_hhh_pid_tightpi)] #for use with FULL DST D0D0 line self.d0_cf_pid_tight = [filterPID('D0CFPIDTIGHT', self.d0_cf_pid,config_pid['TIGHT'])] self.d0_cf_pid_tight_up = [MergedSelection('D0CFPIDTIGHTUP', RequiredSelections=self.kpi_pid_tight_up+self.k3pi_pid_tight_up)]
def __init__(self, pions, kaons, ks, pi0, uppions, muons, config, config_pid): self.pions = pions self.kaons = kaons self.ks = ks self.pi0 = pi0 self.uppions = uppions self.muons = muons self.config = config self.config_pid = config_pid self.hh = self._makeD2hh() self.hhh = self._makeD2hhh() self.hhhh = self._makeD2hhhh() self.ksh_ll = self._makeD2KSh("LL") self.ksh_dd = self._makeD2KSh("DD") self.kshh_ll = self._makeD2KShh("LL") self.kshh_dd = self._makeD2KShh("DD") self.pi0hh_merged = self._makeD2Pi0hh("Merged") self.pi0hh_resolved = self._makeD2Pi0hh("Resolved") self.pi0hhh_merged = self._makeD2Pi0hhh("Merged") self.pi0hhh_resolved = self._makeD2Pi0hhh("Resolved") # UP tracks in D self.hh_up = self._makeD2hh(True) self.hhh_up = self._makeD2hhh(True) self.hhhh_up = self._makeD2hhhh(True) self.ksh_ll_up = self._makeD2KSh("LL", True) self.ksh_dd_up = self._makeD2KSh("DD", True) self.kshh_ll_up = self._makeD2KShh("LL", True) self.kshh_dd_up = self._makeD2KShh("DD", True) self.pi0hh_merged_up = self._makeD2Pi0hh("Merged", True) self.pi0hh_resolved_up = self._makeD2Pi0hh("Resolved", True) self.pi0hhh_merged_up = self._makeD2Pi0hhh("Merged", True) self.pi0hhh_resolved_up = self._makeD2Pi0hhh("Resolved", True) # PID filtered selections self.hh_pid = [filterPID('D2HHPID', self.hh, config_pid)] self.hhh_pid = [filterPID('D2HHHPID', self.hhh, config_pid)] self.hhh_pid_tight = [ filterPID('D2HHHPIDTIGHT', self.hhh_pid, config_pid['TIGHT']) ] # subset decays oneK = "NINTREE(ABSID=='K+') == 1" d_cf = "(((ID=='D+') & (NINTREE(ID=='K-')==1) & (%s)) | "\ "((ID=='D-') & (NINTREE(ID=='K+')==1) & (%s)))" % (oneK,oneK) ds_cf = "((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1))" self.kpi_pid = [filterSelection('D2KPIPID', oneK, self.hh_pid)] self.k3pi = [filterSelection('D2K3PI', oneK, self.hhhh)] self.k3pi_pid = [filterPID('D2K3PIPID', self.k3pi, config_pid)] self.d0_cf_pid = [ MergedSelection('D0CFPID', RequiredSelections=self.kpi_pid + self.k3pi_pid) ] self.pi0kpi_merged = [ filterSelection('D2Pi0KPi_Merged', oneK, self.pi0hh_merged) ] self.pi0kpi_resolved = [ filterSelection('D2Pi0KPi_Resolved', oneK, self.pi0hh_resolved) ] d_min, d_max, ds_min, ds_max = self._massWindowD2HHHCF() d_cf = LoKiCuts.combine([d_cf, "in_range(%s,MM,%s)" % (d_min, d_max)]) ds_cf = LoKiCuts.combine( [ds_cf, "in_range(%s,MM,%s)" % (ds_min, ds_max)]) cf = '(' + d_cf + ') | (' + ds_cf + ')' self.hhh_cf_pid = [filterSelection('D2HHHCFPID', cf, self.hhh_pid)] ds = "(((NINTREE(ID=='K-')==1) & (NINTREE(ID=='K+')==1)) |" ds += "(NINTREE(ABSID=='K+')==0) | " ds += "((ID=='D+') & (NINTREE(ID=='K+')==1) & (%s)) | "\ "((ID=='D-') & (NINTREE(ID=='K-')==1) & (%s)))" % (oneK,oneK) ds = LoKiCuts.combine([ds, "in_range(%s,MM,%s)" % (ds_min, ds_max)]) #print 'ds =', ds self.ds_hhh_pid = [ filterSelection('Ds2HHHPIDTIGHT', ds, self.hhh_pid_tight) ] # WS decays self.kshh_ll_ws = self._makeD2KShhWS("LL") self.kshh_dd_ws = self._makeD2KShhWS("DD") self.hh_ws = self._makeD2hhWS() self.pi0hh_merged_ws = self._makeD2Pi0hhWS('Merged') self.pi0hh_resolved_ws = self._makeD2Pi0hhWS('Resolved') self.hhhh_ws = self._makeD2hhhhWS() # phi mu nu self.phimu = self._makeD2PhiMuNu()