def _Lb2pMuNuVub_low_Lb(self): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection _pMu = CombineParticles(DecayDescriptors=["[Lambda_b0 -> p+ mu-]cc"], ReFitPVs=True) _pMu.Preambulo = self._Definitions() _pMu.CombinationCut = "(AM>%(pMuMassLower)s*MeV)" % self._config _pMu.MotherCut = "(VFASPF(VCHI2/VDOF)< %(BVCHI2DOF)s) & (BPVDIRA> %(BDIRA)s)"\ "& (Lb_PT > %(pMuPT)s)"\ "& (Lb_MCORR < %(pMuMCORR)s)"\ "& (BPVVDCHI2 >%(BFDCHI2HIGH)s)" % self._config _pMu.ReFitPVs = True _pMuSel = Selection( "pMu_low_Lb_for" + self._name, Algorithm=_pMu, RequiredSelections=[self._muonFilter(), self._protonFilter()]) _LbSel = tosSelection( _pMuSel, { 'Hlt2.*TopoMu2Body.*Decision%TOS': 0, 'Hlt2.*SingleMuon.*Decision%TOS': 0 }) return _LbSel
def _Bs2KMuNuSS(self): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection _KMuSS = CombineParticles( DecayDescriptors = ["[B_s~0 -> K- mu-]cc"], CombinationCut = "(AM>%(KMuMassLowTight)s*MeV) & (AM<%(XMuMassUpper)s*MeV)" % self._config, MotherCut = " (VFASPF(VCHI2/VDOF)< %(BVCHI2DOFTight)s) & (BPVDIRA> %(BDIRATight)s)"\ "& (BPVVDCHI2 >%(BFDCHI2Tight)s) & (ratio > 0.4)" % self._config, ReFitPVs = True ) _KMuSS.Preambulo = [ "from LoKiPhys.decorators import *", "dx = (VFASPF(VX)-BPV(VX))", "dy = (VFASPF(VY)-BPV(VY))", "dz = (VFASPF(VZ)-BPV(VZ))", "norm = (max(sqrt(dx*dx+dy*dy+dz*dz),0))", "B_xdir = ((dx)/norm)", "B_ydir = ((dy)/norm)", "B_zdir = ((dz)/norm)", "Pxkmu = (CHILD(PX,1)+CHILD(PX,2))", "Pykmu = (CHILD(PY,1)+CHILD(PY,2))", "Pzkmu = (CHILD(PZ,1)+CHILD(PZ,2))", "Bflight = (B_xdir*Pxkmu + B_ydir*Pykmu+ B_zdir*Pzkmu)", "mB = 5366.77", "M_2 = (mB*mB + M12*M12)", "kmu_E = (CHILD(E,1)+CHILD(E,2))", "quada = (Bflight*Bflight - kmu_E*kmu_E)", "quadb = (M_2*Bflight)", "quadc = (((M_2*M_2)/4) - (kmu_E*kmu_E*mB*mB))", "Discriminant = ((quadb*quadb)-(4*quada*quadc))", "solution_a = ((-quadb + sqrt(max(Discriminant,0)))/(2*quada))", "solution_b = ((-quadb - sqrt(max(Discriminant,0)))/(2*quada))", "ratio = (solution_a/solution_b)" ] _KMuSelSS = Selection( "KMuSS_for" + self._name, Algorithm=_KMuSS, RequiredSelections=[self._muonFilterTOS(), self._kaonFilter()]) return _KMuSelSS
def _makeBLine(self, _name, _decay, inputs, pre): _b = CombineParticles( DecayDescriptors=_decay, CombinationCut="(AM<%(BMass_MAX)s *MeV)" % self._config, MotherCut= "(MDNDOCA(5.279,0) < %(Plane_MAX)s*mm) & (lim_up<0) & (lim_lo>0)" % self._config, ) _b.Preambulo = [ "from LoKiPhys.decorators import *", "m_B = 5279.29 ", "m_D = 1864.84 ", "m_3 = CHILD(M,2)", "e3 = (m_B*m_B - m_D*m_D - m_3*m_3)/(2.*m_D)", "p3 = sqrt(e3*e3 - m_3*m_3)", "m_all = M", "m_n = CHILD(M,1)", "lim_up = (m_all*m_all - m_B*m_B) - (1.+e3/m_D -p3/m_D)*(m_n*m_n - m_D*m_D) ", "lim_lo = (m_all*m_all - m_B*m_B) - (1.+e3/m_D + p3/m_D)*(m_n*m_n - m_D*m_D) ", ] _bsel = Selection("Sel" + _name, Algorithm=_b, RequiredSelections=inputs) hlt2 = "(HLT_PASS_RE('Hlt2Topo.*Decision') |"\ " HLT_PASS_RE('Hlt2.*SingleMuon.*Decision'))" Line = StrippingLine(_name + 'Line', prescale=pre, checkPV=True, FILTER=self.GECs, HLT2=hlt2, selection=_bsel) return Line
def Dstar ( name, D0Sel, config, Monitor) : """ Selection for D* """ _DSt = CombineParticles() _DSt.DecayDescriptor = "[D*(2010)+ -> D0 pi+]cc" slowPiCuts = "(PT>%(SlowPiPt)s) & (TRCHI2DOF < %(SlowPiTrkChi2)s)" %locals()['config'] d0Cuts = "ALL" _DSt.DaughtersCuts = { 'pi+' : slowPiCuts, 'D0' : d0Cuts } combcut = """ (APT>%(DstarPt)s) & (ADAMASS('D*(2010)+')<75) & (AM - AM1 < 165 * MeV) """ _DSt.CombinationCut = combcut %locals()['config'] mothercut = """ (VFASPF(VCHI2PDOF)<%(DstarVtxChi2Ndof)s) & (M-MAXTREE('D0'==ABSID,M)<%(DeltaM_Max)s) & (M-MAXTREE('D0'==ABSID,M)>%(DeltaM_Min)s) """ _DSt.MotherCut = mothercut %locals()['config'] if Monitor != None : _DSt.Preambulo = [ ## define historam type (shortcut) "Histo = Gaudi.Histo1DDef" , ## monitor LL-case "mass = monitor ( M / GeV , Histo ( 'DSt' , 1.93 , 2.09 , 100 ) , 'M' ) " , "deltaM = monitor ( M - M1 /MeV, Histo ( 'DSt' , 135 , 160 , 50 ) , 'DeltaM') " , "pT = monitor ( PT / GeV , Histo ( 'DSt' , 0.00 , 20.0 , 100 ) , 'pT' ) " , "y = monitor ( Y , Histo ( 'DSt' , 1.60 , 5.40 , 100 ) , 'y' ) " ] _DSt.Monitor = True _DSt.HistoProduce = True _DSt.MotherMonitor = """ process ( mass ) >> process ( deltaM ) >> process ( pT ) >> process ( y ) >> EMPTY """ DSt = Selection("SelDSt2D0PiFor"+name, Algorithm = _DSt, RequiredSelections = [StdAllNoPIDsPions, D0Sel]) return DSt
def _fakePpipi( self ): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection Ppipi = CombineParticles(DecayDescriptors = ["[N(1440)+ -> p+ pi+ pi-]cc"], ReFitPVs = True) Ppipi.Preambulo = self._Definitions() Ppipi.MotherCut = self._PPbarSelection() % self._config Ppipi.ReFitPVs = True PpipiSel=Selection("fakePpipi_Lb_for"+self._name, Algorithm=Ppipi, RequiredSelections = [self._fakeprotonFilter(),self._pionFilter()]) return PpipiSel
def _fakePPbar( self ): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection PPbar = CombineParticles(DecayDescriptors = ["J/psi(1S) -> p+ p~-"], ReFitPVs = True) PPbar.Preambulo = self._Definitions() PPbar.MotherCut = self._fakePPbarSelection() % self._config PPbar.ReFitPVs = True PPbarSel=Selection("fakePPbar_Lb_for"+self._name, Algorithm=PPbar, RequiredSelections = [self._fakeprotonFilter()]) return PPbarSel
def D0 ( name, config, Monitor ) : """ Selection for D0 """ _D0 = CombineParticles() _D0.DecayDescriptor = "[D0 -> K- pi+]cc" dauCutStr = "(PT > %(DaugPt)s) & (P > %(DaugP)s) & (TRCHI2DOF < %(DaugTrkChi2)s) & (MIPCHI2DV(PRIMARY) > %(DaugIPChi2)s)" %locals()['config'] _D0.DaughtersCuts = { "K+" : dauCutStr, "pi+" : dauCutStr } _D0.CombinationCut = "(ADAMASS('D0')<85 * MeV)" %locals()['config'] mothercut = """ (PT>%(D0Pt)s) & (VFASPF(VCHI2PDOF)<%(D0VtxChi2Ndof)s) & (BPVVDCHI2>%(D0FDChi2)s) & (BPVDIRA>%(D0BPVDira)s) & (BPVIPCHI2()<%(D0IPChi2)s) & (ADMASS('D0') < %(D0MassWin)s ) & ( ADWM( 'D0' , WM( 'pi-' , 'K+') ) > %(DCS_WrongMass)s) & ( ADWM( 'D0' , WM( 'K-' , 'K+') ) > %(KK_WrongMass)s) & ( ADWM( 'D0' , WM( 'pi-' , 'pi+') ) > %(PiPi_WrongMass)s) """ _D0.MotherCut = mothercut %locals()['config'] if Monitor != None : _D0.Preambulo = [ ## define historam type (shortcut) "Histo = Gaudi.Histo1DDef" , ## monitor LL-case "mass = monitor ( M / GeV , Histo ( 'D0' , 1.79 , 1.94 , 100 ) , 'M' ) " , "pT = monitor ( PT / GeV , Histo ( 'D0' , 0.00 , 20.0 , 100 ) , 'pT' ) " , "y = monitor ( Y , Histo ( 'D0' , 1.60 , 5.40 , 100 ) , 'y' ) " ] _D0.Monitor = True _D0.HistoProduce = True _D0.MotherMonitor = """ process ( mass ) >> process ( pT ) >> process ( y ) >> EMPTY """ D0 = Selection("SelD02RSKPiFor"+name, Algorithm = _D0, RequiredSelections = [StdAllNoPIDsKaons, StdAllNoPIDsPions]) return D0
def _Lb2pMuNuVubSS_Lb( self ): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection _pMuSS = CombineParticles(DecayDescriptors = self._config["SSDECAYS"], ReFitPVs = True) _pMuSS.Preambulo = self._Definitions() _pMuSS.CombinationCut = "(AM>%(pMuMassLower)s*MeV)" % self._config _pMuSS.MotherCut = self._LbMotherSelection() % self._config _pMuSS.ReFitPVs = True _pMuSSSel=Selection("pMuSS_Lb_for"+self._name, Algorithm=_pMuSS, RequiredSelections = [self._muonFilter(), self._daughters()]) _pMuSSSel = tosSelection(_pMuSSSel,{'Hlt2.*TopoMu2Body.*Decision%TOS':0,'Hlt2.*SingleMuon.*Decision%TOS':0}) return _pMuSSSel
def _Bu2RhoMuNuSB(self): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection _RhoMu = CombineParticles( DecayDescriptors=["[B+ -> rho(770)0 mu+]cc"], CombinationCut= "(AM>%(RhoMuMassLowTight)s*MeV) & (AM<%(XMuMassUpper)s*MeV)" % self._config, MotherCut= "(VFASPF(VCHI2/VDOF)< %(BVCHI2DOFTight)s) & (BPVDIRA> %(BDIRATight)s) & (BPVVDCHI2 >%(BFDCHI2Tight)s) & (ratio >0.4)" % self._config, #" ( ((((5279.17*5279.17) -(MASS(1,2))*(MASS(1,2))))/(2*5279.17)) < %(Enu)s*MeV)"\ ReFitPVs=True) _RhoMu.Preambulo = [ "from LoKiPhys.decorators import *", "dx = (VFASPF(VX)-BPV(VX))", "dy = (VFASPF(VY)-BPV(VY))", "dz = (VFASPF(VZ)-BPV(VZ))", "norm = (max(sqrt(dx*dx+dy*dy+dz*dz),0))", "B_xdir = ((dx)/norm)", "B_ydir = ((dy)/norm)", "B_zdir = ((dz)/norm)", "Pxrhomu = (CHILD(PX,1)+CHILD(PX,2))", "Pyrhomu = (CHILD(PY,1)+CHILD(PY,2))", "Pzrhomu = (CHILD(PZ,1)+CHILD(PZ,2))", "Bflight = (B_xdir*Pxrhomu + B_ydir*Pyrhomu+ B_zdir*Pzrhomu)", "mB = 5279.25", "M_2 = (mB*mB + M12*M12)", "rhomu_E = (CHILD(E,1)+CHILD(E,2))", "quada = (Bflight*Bflight - rhomu_E*rhomu_E)", "quadb = (M_2*Bflight)", "quadc = (((M_2*M_2)/4) - (rhomu_E*rhomu_E*mB*mB))", "Discriminant = ((quadb*quadb)-(4*quada*quadc))", "solution_a = ((-quadb + sqrt(max(Discriminant,0)))/(2*quada))", "solution_b = ((-quadb - sqrt(max(Discriminant,0)))/(2*quada))", "ratio = (solution_a/solution_b)" ] _RhoMuSel = Selection("RhoMuSB_for" + self._name, Algorithm=_RhoMu, RequiredSelections=[ self._muonFilterTight(), self._Rho02PiPiSBFilter() ]) return _RhoMuSel
def _D2HMuNuBuilder(self, _name, _decay, inputs): _d = CombineParticles( DecayDescriptors = _decay, CombinationCut = "(ASUM(PT)>%(SUMPT_MIN)s*MeV) "\ "& (ADOCA(1,2)<%(ADOCA_MAX)s*mm) "\ "& (AM<%(DMass_MAX)s*MeV)" % self._config, MotherCut = "(VFASPF(VCHI2/VDOF)< %(VCHI2DOF_MAX)s )"\ "& (cos<%(Cos_MAX)s)" \ # "& (MIPCHI2DV(PRIMARY)> %(MIPCHI2DV_MIN)s )"\ "& (BPVVDCHI2 >%(BPVVDCHI2_MIN)s)"% self._config, ) _d.Preambulo = [ "from LoKiPhys.decorators import *", "px1 = CHILD(PX,1)", "py1 = CHILD(PY,1)", "pz1 = CHILD(PZ,1)", "px2 = CHILD(PX,2)", "py2 = CHILD(PY,2)", "pz2 = CHILD(PZ,2)", "cos = (px1*px2+py1*py2+pz1*pz2)/(sqrt(px1*px1+py1*py1+pz1*pz1)*sqrt(px2*px2+py2*py2+pz2*pz2))", ] return Selection(_name + "_for" + self._name, Algorithm=_d, RequiredSelections=inputs)
def BtoDlnuLine(module_name, name, BDecays, DDecays, CONFIG, CHARM_DAUGHTERS, MUON, FAKE_MUON=None): DEFAULT_GECs = { "Code": "( recSummaryTrack(LHCb.RecSummary.nLongTracks, TrLONG) < %(GEC_nLongTrk)s )" % CONFIG, "Preambulo": ["from LoKiTracks.decorators import *"] } CHARM_DaugCuts = {} CHARM_ComboCuts = CONFIG["CharmComboCuts"] CHARM_MotherCuts = CONFIG["CharmMotherCuts"] CHARM_ComboCuts += " & (ADOCACHI2CUT( %(D_DocaChi2Max)s, ''))" % CONFIG CHARM_MotherCuts += "& (VFASPF(VCHI2/VDOF) < %(D_VCHI2DOF)s) " \ "& (BPVVDCHI2 > %(D_FDCHI2)s) & (BPVDIRA> %(D_BPVDIRA)s)" % CONFIG if "CharmDaugCuts" in CONFIG.keys(): CHARM_DaugCuts = CONFIG["CharmDaugCuts"] if "CharmExtraComboCuts" in CONFIG.keys(): CHARM_ComboCuts += CONFIG["CharmExtraComboCuts"] if "CharmExtraMotherCuts" in CONFIG.keys(): CHARM_MotherCuts += CONFIG["CharmExtraMotherCuts"] CHARM = Selection("CharmSelFor" + name + module_name, Algorithm=CombineParticles( DecayDescriptors=DDecays, DaughtersCuts=CHARM_DaugCuts, CombinationCut=CHARM_ComboCuts, MotherCut=CHARM_MotherCuts), RequiredSelections=CHARM_DAUGHTERS) USED_CHARM = CHARM if "D*" in BDecays: DST = makeDstar("CharmSelDstFor" + name + module_name, CHARM, CONFIG) USED_CHARM = DST B_combinationCut = "(AM > %(B_MassMin)s) & (AM < %(B_MassMax)s) & (ADOCACHI2CUT( %(B_DocaChi2Max)s, ''))" % CONFIG B_motherCut = " (MM>%(B_MassMin)s) & (MM<%(B_MassMax)s)"\ "&(VFASPF(VCHI2/VDOF)< %(B_VCHI2DOF)s) & (BPVDIRA> %(B_DIRA)s)"\ "&(MINTREE(((ABSID=='D+')|(ABSID=='D0')|(ABSID=='Lambda_c+')|(ABSID=='Omega_c0')|(ABSID=='Xi_c+'))"\ ", VFASPF(VZ))-VFASPF(VZ) > %(B_D_DZ)s ) " %CONFIG if "ExtraComboCuts" in CONFIG.keys(): B_combinationCut += CONFIG["ExtraComboCuts"] if "ExtraMotherCuts" in CONFIG.keys(): B_motherCut += CONFIG["ExtraMotherCuts"] B_DaugCuts = {} if "ExtraMuonCuts" in CONFIG.keys(): B_DaugCuts = {"mu+": CONFIG["ExtraMuonCuts"]} if "ExtraElectronCuts" in CONFIG.keys(): B_DaugCuts = {"e+": CONFIG["ExtraElectronCuts"]} _B = CombineParticles(DecayDescriptors=BDecays, DaughtersCuts=B_DaugCuts, CombinationCut=B_combinationCut, MotherCut=B_motherCut) if CONFIG["Monitor"] == True: _B.Preambulo = [ "hdm1 = Gaudi.Histo1DDef ( 'D_M' , 1700 , 2800 , 200 )" ] _B.Monitor = True _B.MotherMonitor = "process ( monitor ( CHILD(M,1) , hdm1 , 'D_M' ) ) >> ~EMPTY " "" BSel = Selection("BSelFor" + name + module_name, Algorithm=_B, RequiredSelections=[MUON, USED_CHARM]) BSelTOS = TOSFilter("BSelFor" + name + module_name + "TOS", BSel, CONFIG["TTSpecs"]) LINE_NAME = module_name + "_" + name _prescale = 1.0 if LINE_NAME in CONFIG["prescales"].keys(): _prescale = CONFIG["prescales"][LINE_NAME] main_line = StrippingLine(LINE_NAME, selection=BSelTOS, HLT1=CONFIG["HLT1"], HLT2=CONFIG["HLT2"], FILTER=DEFAULT_GECs, prescale=_prescale) if FAKE_MUON == None: return main_line else: BSelFake = Selection("BSelFakeFor" + name + module_name, Algorithm=_B, RequiredSelections=[FAKE_MUON, USED_CHARM]) BSelFakeTOS = TOSFilter("BSelFakeFor" + name + module_name + "TOS", BSelFake, CONFIG["TTSpecs"]) return { "RealMuon": main_line, "FakeMuon": StrippingLine(LINE_NAME + '_FakeMuon', selection=BSelFakeTOS, HLT1=CONFIG["HLT1"], HLT2=CONFIG["HLT2"], FILTER=DEFAULT_GECs, prescale=CONFIG["prescaleFakes"]) }
def DstarMaker(self, _name, _D0Decays, hfiler, lfilter): from GaudiConfUtils.ConfigurableGenerators import CombineParticles from PhysSelPython.Wrappers import Selection from StrippingConf.StrippingLine import StrippingLine _KMu = CombineParticles( DecayDescriptors = _D0Decays, CombinationCut = "(AM>%(KLepMassLow)s*MeV) & (AM<%(KLepMassHigh)s*MeV)" % self._config, MotherCut = "(VFASPF(VCHI2/VDOF)< %(BVCHI2DOF)s )"\ "& (BPVVDCHI2 >%(BFDCHI2HIGH)s)" #" & (ratio > 0.0)" % self._config, ReFitPVs = True ) _KMu.Preambulo = [ "from LoKiPhys.decorators import *", "dx = (VFASPF(VX)-BPV(VX))", "dy = (VFASPF(VY)-BPV(VY))", "dz = (VFASPF(VZ)-BPV(VZ))", "norm = (max(sqrt(dx*dx+dy*dy+dz*dz),0))", "D_xdir = ((dx)/norm)", "D_ydir = ((dy)/norm)", "D_zdir = ((dz)/norm)", "Pxkmu = (CHILD(PX,1)+CHILD(PX,2))", "Pykmu = (CHILD(PY,1)+CHILD(PY,2))", "Pzkmu = (CHILD(PZ,1)+CHILD(PZ,2))", "Dflight = (D_xdir*Pxkmu + D_ydir*Pykmu+ D_zdir*Pzkmu)", "mD = 1864.84", "M_2 = (mD*mD + M12*M12)", "kmu_E = (CHILD(E,1)+CHILD(E,2))", "quada = (Dflight*Dflight - kmu_E*kmu_E)", "quadb = (M_2*Dflight)", "quadc = (((M_2*M_2)/4) - (kmu_E*kmu_E*mD*mD))", "Discriminant = ((quadb*quadb)-(4*quada*quadc))", "solution_a = ((-quadb + sqrt(max(Discriminant,0)))/(2*quada))", "solution_b = ((-quadb - sqrt(max(Discriminant,0)))/(2*quada))", "ratio = (solution_a/solution_b)" ] _D0Sel = Selection("SelD0_for" + _name, Algorithm=_KMu, RequiredSelections=[lfilter, hfiler]) DstComb = CombineParticles( #name = "CombDst"+_name, DecayDescriptors=['[D*(2010)+ -> D0 pi+]cc'], CombinationCut= "(AM - ACHILD(M,1) < %(DELTA_MASS_MAX)s+5 *MeV) & (ADOCACHI2CUT(20,''))" % self._config, MotherCut= "(M - CHILD(M,1) < %(DELTA_MASS_MAX)s *MeV) & (VFASPF(VCHI2/VDOF) < 9.0)" % self._config) DstSel = Selection("SelDst" + _name, Algorithm=DstComb, RequiredSelections=[_D0Sel, self._slowpionFilter()]) _tosFilter = self._config['TOSFilter'] DstSelTOS = TOSFilter("SelDstHMu_Hlt2TOS" + _name, DstSel, _tosFilter) hlt2 = "" if self._config["useTOS"] == True: # and _name.find('E') < 0: Line = StrippingLine(_name + 'Line', prescale=1.0, FILTER=self.GECs, HLT2=hlt2, selection=DstSelTOS) else: Line = StrippingLine(_name + 'Line', prescale=1.0, FILTER=self.GECs, HLT2=hlt2, selection=DstSel) return Line