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 makeXi(localname, _RequiredSelections, config=default_config['CONFIG']): _xi = CombineParticles(localname + "xi2lambda") _xi.DecayDescriptor = "[Xi- -> Lambda0 pi-]cc" _xi.DaughtersCuts = { "pi-": ("(PT > %(Pions4Ximinus_PT)s) & " + "(PROBNNpi > %(Pions4Ximinus_ProbNNpi)s) & " + "(TRPCHI2 > %(Pions4Ximinus_TRPCHI2)s) & " + "(MIPCHI2DV(PRIMARY) > %(Pions4Ximinus_MINIPCHI2)s)") % config } _xi.CombinationCut = ("(ADAMASS('Xi-') < %(Ximinus_MassWindowLarge)s) & " + "(APT > %(Ximinus_APT)s)") % config _xi.MotherCut = ("((VFASPF(VCHI2/VDOF) < %(Ximinus_ENDVERTEXCHI2)s) " "& (ADMASS('Xi-') < %(Ximinus_MassWindowTight)s)" "& (BPVVDZ/P > %(Ximinus_FlightDistance)s))") % config #Selection return Selection(localname + "SelLooseXi", Algorithm=_xi, RequiredSelections=_RequiredSelections)
def makeK0s2mm(name, mupt=0, kspt=0, optm=0): """ K0s2mumu selection object with muon Id and wide mass window starts from Phys/StdLooseMuons Please contact Diego Martinez Santos if you think of prescaling this line! Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter K0s2MuMu = CombineParticles("Combine" + name) K0s2MuMu.DecayDescriptor = "KS0 -> mu+ mu-" K0s2MuMu.addTool(OfflineVertexFitter) K0s2MuMu.ParticleCombiners.update({"": "OfflineVertexFitter"}) K0s2MuMu.OfflineVertexFitter.useResonanceVertex = False K0s2MuMu.ReFitPVs = True K0s2MuMu.DaughtersCuts = { "mu+": "(MIPCHI2DV(PRIMARY)> 100.)&(TRCHI2DOF < 5 ) & (PT >" + str(mupt) + " * MeV)" } K0s2MuMu.CombinationCut ="(ADAMASS('KS0')<1000*MeV)"\ "& (AMAXDOCA('')<0.3*mm)" if optm == "sig": K0s2MuMu.MotherCut = "((BPVDIRA>0) & ((BPVVDSIGN*M/P) > 0.1*89.53*2.9979e-01) & (MIPDV(PRIMARY)<0.4*mm) & (M>" + MSB + ") & (PT > " + str( kspt) + " * MeV))" elif optm == "sb": K0s2MuMu.MotherCut = "((BPVDIRA>0) & ((BPVVDSIGN*M/P) > 0.1*89.53*2.9979e-01) & (MIPDV(PRIMARY)<0.4*mm) & (M>350) & (M<" + MSB + ") & (PT > " + str( kspt) + " * MeV))" else: K0s2MuMu.MotherCut = "((BPVDIRA>0) & ((BPVVDSIGN*M/P) > 0.1*89.53*2.9979e-01) & (MIPDV(PRIMARY)<0.4*mm) & (M>450) & (PT > " + str( kspt) + " * MeV))" _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") return Selection(name, Algorithm=K0s2MuMu, RequiredSelections=[_stdLooseMuons])
def makeX(localname, _RequiredSelections, config=default_config, requireBadPointing=True): _combinex = CombineParticles(localname + "HighMassState") _combinex.DecayDescriptor = "[Xi_bc+ -> J/psi(1S) p+]cc" _combinex.CombinationCut = ( "(AM > %(HighMassBaryon_MassLowEdge)s ) &" + " (APT > %(HighMassBaryon_MinAPT)s ) ") % config if (requireBadPointing == True): _combinex.CombinationCut += ( "& ((ACHILD(PX,1)*ACHILD(PX,2)+ACHILD(PY,1)*ACHILD(PY,2)+ACHILD(PZ,1)*ACHILD(PZ,2))/" + "(ACHILD(P,1)*ACHILD(P,2)) < %(JpsiProtonForHighMassBaryonCosth)s)" ) % config else: _combinex.CombinationCut += ( "& ((ACHILD(PX,1)*ACHILD(PX,2)+ACHILD(PY,1)*ACHILD(PY,2)+ACHILD(PZ,1)*ACHILD(PZ,2))/" + "(ACHILD(P,1)*ACHILD(P,2)) > %(JpsiProtonForHighMassBaryonCosth)s)" ) % config _combinex.DaughtersCuts = { "p+": ("(PT > %(ProtonsForHighMassBaryon_PT)s) &" + " (PIDp > %(ProtonsForHighMassBaryon_PIDp)s) &" + " (TRGHP < %(GlobalGhostProb_Max)s) &" + " (TRPCHI2 > %(ProtonsForHighMassBaryon_TRPCHI2)s) & " + " ( P > %(ProtonsForHighMassBaryon_P)s)") % config, "J/psi(1S)": ("(PT > %(JpsiForHighMassBaryon_PT)s) & " + "(ADMASS('J/psi(1S)') < %(JpsiForHighMassBaryon_MassWin)s) &" + "(MAXTREE(TRGHP, ISBASIC) < %(GlobalGhostProb_Max)s) & " "(MINTREE('mu+'==ABSID,PIDmu) > %(JpsiForHighMassBaryon_MuonPIDmu)s)") % config } _combinex.MotherCut = "(ALL)" #No cut return Selection(localname + "SelHighMassBaryonicStates", Algorithm=_combinex, RequiredSelections=_RequiredSelections)
def makeB2DMu(name): _myMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") D2MuMu = CombineParticles("MyD2MuMuCombination") D2MuMu.DecayDescriptors = ["[D0 -> mu+ mu-]cc", "[D0 -> mu+ mu+]cc"] D2MuMu.DaughtersCuts = {"mu+": DTrackCuts} D2MuMu.CombinationCut = DCombinationCut D2MuMu.MotherCut = DMotherCut D2MuMuSelection = Selection("MyD2MuMuSelection", Algorithm=D2MuMu, RequiredSelections=[_myMuons]) B2DMu = CombineParticles("Combine" + name) B2DMu.DecayDescriptors = ["[B+ -> D0 mu+]cc"] B2DMu.DaughtersCuts = {"mu+": BDTrackCuts} #B2DMu.CombinationCut = BDCombinationCut B2DMu.MotherCut = BDMotherCut return Selection(name, Algorithm=B2DMu, RequiredSelections=[D2MuMuSelection, _myMuons])
def makeDiJet(self, _name, loose=0): DiJet = CombineParticles("Combine" + _name) DiJet.DecayDescriptor = "H_10 -> CELLjet CELLjet" DiJet.ParticleCombiners = {'': 'LoKi::VertexFitter:PUBLIC'} if loose: DiJet.DaughtersCuts = { "CELLjet": " (PT > %(minJetpTLoose)s * GeV ) " % self._config } else: DiJet.DaughtersCuts = { "CELLjet": " (PT > %(minJetpT)s * GeV ) " % self._config } DiJet.CombinationCut = "AALLSAMEBPV" DiJet.MotherCut = "ALL" return Selection("Sel" + _name, Algorithm=DiJet, RequiredSelections=[StdJets])
def makeLc2pKpi(name): Lc2pKpi = CombineParticles("Combine" + name) Lc2pKpi.DecayDescriptors = ["[Lambda_c+ -> p+ K- pi+]cc"] Lc2pKpi.DaughtersCuts = { "p+": TrackCuts + " & ((PIDp-PIDpi)>5)" + " & ((PIDp-PIDK)>0)", "K-": TrackCuts + " & ((PIDK-PIDpi)>5)" + " & ((PIDK-PIDp)>0)", "pi+": TrackCuts } Lc2pKpi.CombinationCut = LambdaCCombiCut200 Lc2pKpi.MotherCut = CommonMotherCut _myProtons = DataOnDemand(Location="Phys/StdLooseProtons/Particles") _myKaons = DataOnDemand(Location="Phys/StdLooseKaons/Particles") _myPions = DataOnDemand(Location="Phys/StdLoosePions/Particles") return Selection(name, Algorithm=Lc2pKpi, RequiredSelections=[_myProtons, _myKaons, _myPions])
def makeDstar2D2MuMuMuMu(name,inputSel) : from Configurables import OfflineVertexFitter """ D* --> pi (D0 --> 4 mu) selection """ Dstar2Dpi = CombineParticles("CombineDstar"+name) Dstar2Dpi.DecayDescriptor = "[D*(2010)+ -> D0 pi+]cc" Dstar2Dpi.addTool( OfflineVertexFitter() ) Dstar2Dpi.VertexFitters.update( { "" : "OfflineVertexFitter"} ) Dstar2Dpi.DaughtersCuts = { "pi+" : "(TRCHI2DOF < 2.0 ) "\ " & (MIPCHI2DV(PRIMARY) < 25.)"} Dstar2Dpi.CombinationCut = "(ADAMASS('D*(2010)+')<500.*MeV) "\ " & ( AMAXDOCA('')< 0.3*mm)" Dstar2Dpi.MotherCut = "(VFASPF(VCHI2/VDOF) < 12.)"\ " & (MM - CHILD(MM,1) > 120.*MeV) & (MM - CHILD(MM,1) < 174.*MeV)" return Selection (name, Algorithm = Dstar2Dpi, RequiredSelections = inputSel)
def makeD2MuMuMuMu(name,inputSel) : """ D --> 4 mu selection """ from Configurables import OfflineVertexFitter D2MuMuMuMu = CombineParticles("Combine"+name) D2MuMuMuMu.DecayDescriptor = "[D0 -> J/psi(1S) J/psi(1S)]cc" D2MuMuMuMu.addTool( OfflineVertexFitter() ) D2MuMuMuMu.VertexFitters.update( { "" : "OfflineVertexFitter"} ) D2MuMuMuMu.CombinationCut = "(ADAMASS('D0')<500*MeV) "\ "& (AMAXDOCA('')<0.3*mm) " D2MuMuMuMu.MotherCut = "(VFASPF(VCHI2/VDOF)<12.) "\ "& (MIPCHI2DV(PRIMARY) < 25. )" return Selection (name, Algorithm = D2MuMuMuMu, RequiredSelections = inputSel)
def makeLb2Kmu(name): Lb2Kmu = CombineParticles("Combine" + name) Lb2Kmu.DecayDescriptors = [ "[Lambda_b0 -> K+ mu-]cc", "[Lambda_b0 -> K+ mu+]cc" ] Lb2Kmu.DaughtersCuts = { "K+": TrackCuts + " & ((PIDK-PIDpi)>0)", "mu+": TrackCuts } Lb2Kmu.CombinationCut = Lb2KmuCombinationCut Lb2Kmu.MotherCut = Lb2KmuMotherCut _myMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") _myKaons = DataOnDemand(Location="Phys/StdLooseKaons/Particles") return Selection(name, Algorithm=Lb2Kmu, RequiredSelections=[_myKaons, _myMuons])
def makeB2TauMu(name): """ Please contact Johannes Albrecht if you think of prescaling this line! Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter Bs2TauMu = CombineParticles("Combine" + name) Bs2TauMu.DecayDescriptors = [ "[B_s0 -> tau+ mu-]cc", "[B_s0 -> tau+ mu+]cc" ] # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar: Bs2TauMu.addTool(OfflineVertexFitter) Bs2TauMu.ParticleCombiners.update({"": "OfflineVertexFitter"}) Bs2TauMu.OfflineVertexFitter.useResonanceVertex = False #Bs2TauMu.ReFitPVs = True Bs2TauMu.DaughtersCuts = { "mu+": "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3)" } Bs2TauMu.CombinationCut = "(ADAMASS('B_s0')<1200*MeV)"\ "& (AMAXDOCA('')<0.3*mm)" Bs2TauMu.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\ "& (ADMASS('B_s0') < 1200*MeV )"\ "& (BPVDIRA > 0) "\ "& (BPVVDCHI2> 225)"\ "& (BPVIPCHI2()< 25) " from CommonParticles import StdLooseDetachedTau, StdLooseDipion _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") _stdLooseDetachedTaus = DataOnDemand( Location="Phys/StdLooseDetachedTau3pi/Particles") return Selection( name, Algorithm=Bs2TauMu, RequiredSelections=[_stdLooseMuons, _stdLooseDetachedTaus])
def makeDefault(name) : """ default Bs2mumu selection object (tighter selection a la roadmap) starts from Phys/StdNoPIDsMuons Please contact Johannes Albrecht if you think of prescaling this line! Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter Bs2MuMuNoMuID = CombineParticles("Comine"+name) Bs2MuMuNoMuID.DecayDescriptor = "B_s0 -> mu+ mu-" # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar: Bs2MuMuNoMuID.addTool( OfflineVertexFitter ) Bs2MuMuNoMuID.ParticleCombiners.update( { "" : "OfflineVertexFitter"} ) Bs2MuMuNoMuID.OfflineVertexFitter.useResonanceVertex = False Bs2MuMuNoMuID.ReFitPVs = True Bs2MuMuNoMuID.DaughtersCuts = { "mu+" : "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 3 )"\ " & (0.5<PPINFO(LHCb.ProtoParticle.InAccMuon,-1))"\ " & (PT < 40*GeV)"\ " & (P < 500*GeV)"\ " & ( TRGHOSTPROB < 0.3 )" } Bs2MuMuNoMuID.CombinationCut = "(ADAMASS('B_s0')<500*MeV)"\ "& (AMAXDOCA('')<0.3*mm)" Bs2MuMuNoMuID.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\ "& (ADMASS('B_s0') < 500*MeV )"\ "& (BPVDIRA > 0) "\ "& (BPVVDCHI2> 225)"\ "& (BPVIPCHI2()< 25) "\ "& (BPVLTIME()<13.248*ps)"\ "& (PT > 350*MeV)" _stdNoPIDsMuons = DataOnDemand(Location = "Phys/StdNoPIDsMuons/Particles") return Selection (name, Algorithm = Bs2MuMuNoMuID, RequiredSelections = [ _stdNoPIDsMuons])
def makeLoose(name, MuIPChi2, MuTrChi2, BIPChi2, BFDChi2): """ loose Bs2mumu selection object to monitor selection, systematics from cuts, etc. starts from Phys/StdNoPIDsMuons prescaled Arguments: name : name of the Selection. MuIPChi2 : muon MIPCHI2DV(PRIMARY) MuTrChi2 : muon TRCHI2 BIPChi2 : Bs MIPCHI2DV(PRIMARY) BFDChi2 : Bs BPVVDCHI2> %(BFDChi2) """ from Configurables import OfflineVertexFitter Bs2MuMuNoMuIDLoose = CombineParticles("Combine" + name) Bs2MuMuNoMuIDLoose.DecayDescriptor = "B_s0 -> mu+ mu-" # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar: Bs2MuMuNoMuIDLoose.addTool(OfflineVertexFitter()) Bs2MuMuNoMuIDLoose.VertexFitters.update({"": "OfflineVertexFitter"}) Bs2MuMuNoMuIDLoose.OfflineVertexFitter.useResonanceVertex = False Bs2MuMuNoMuIDLoose.ReFitPVs = True Bs2MuMuNoMuIDLoose.DaughtersCuts = { "mu+" : "(TRCHI2DOF < %(MuTrChi2)s ) "\ "& (MIPCHI2DV(PRIMARY)> %(MuIPChi2)s ) "% locals() } Bs2MuMuNoMuIDLoose.CombinationCut = "(ADAMASS('B_s0')<600*MeV)"\ "& (AMAXDOCA('')<0.5*mm)" Bs2MuMuNoMuIDLoose.MotherCut = "(VFASPF(VCHI2/VDOF)<25) "\ "& (ADMASS('B_s0') < 600*MeV )"\ "& (BPVDIRA > 0) "\ "& (BPVVDCHI2> %(BFDChi2)s)"\ "& (BPVIPCHI2()< %(BIPChi2)s) "% locals() _stdNoPIDsMuons = DataOnDemand(Location="Phys/StdNoPIDsMuons/Particles") return Selection(name, Algorithm=Bs2MuMuNoMuIDLoose, RequiredSelections=[_stdNoPIDsMuons])
def makeSigmaPMuMuLFV(name, config): """ Line for the selection of Sigma+ -> p- mu+ mu+ for background checks Before prescaling this line, please contact Francesco Dettori Arguments: name : name of the Selection. config : dictionary of tunable cuts """ from Configurables import OfflineVertexFitter SigmaPMuMu = CombineParticles("Combine" + name) SigmaPMuMu.DecayDescriptor = "[Sigma+ -> p~- mu+ mu+]cc" SigmaPMuMu.addTool(OfflineVertexFitter) SigmaPMuMu.ParticleCombiners.update({"": "OfflineVertexFitter"}) SigmaPMuMu.OfflineVertexFitter.useResonanceVertex = False SigmaPMuMu.DaughtersCuts = { "mu+": "(TRCHI2DOF<3) & (TRGHOSTPROB<0.3) & (MIPCHI2DV(PRIMARY)>%(muonMinIpChi2)s)" % config, "p+": "(TRCHI2DOF<3) & (TRGHOSTPROB<0.3) & (PIDp > %(protonPIDp)s)" % config } SigmaPMuMu.CombinationCut = "(ADAMASS('Sigma+')<%(SigmaMassWin)s *MeV) & (AMAXDOCA('')< %(SigmaMaxDOCA)s *mm)" % config SigmaPMuMu.MotherCut = "(VFASPF(VCHI2/VDOF)< %(SigmaVtxChi2)s) & (PT> %(SigmaMinPt)s *MeV)"\ "& (ADMASS('Sigma+') < %(SigmaMassWin)s *MeV )"\ "& (BPVDIRA > %(SigmaMinDIRA)s) "\ "& (BPVIPCHI2()< %(SigmaMaxIpChi2)s)"\ "& (BPVLTIME()> %(SigmaMinTauPs)s * ps)" %config # AllLooseMuons are needed in order to avoid the pt and ip cuts used in StdLooseMuons: do not change this! _stdAllLooseMuons = DataOnDemand( Location="Phys/StdAllLooseMuons/Particles") _stdLooseProtons = DataOnDemand(Location="Phys/StdLooseProtons/Particles") return Selection(name, Algorithm=SigmaPMuMu, RequiredSelections=[_stdAllLooseMuons, _stdLooseProtons])
def makeLc2muee(name): Lc2muee = CombineParticles("Combine" + name) Lc2muee.DecayDescriptors = [ "[Lambda_c+ -> mu+ e+ e-]cc", "[Lambda_c+ -> mu- e+ e+]cc", "[Lambda_c+ -> mu+ e+ e+]cc" ] Lc2muee.DaughtersCuts = { "mu+": TrackCuts, "e+": TrackCuts + " & ((PIDe-PIDpi)>2)" } Lc2muee.CombinationCut = LambdaCCombiCut300 Lc2muee.MotherCut = CommonMotherCut _myMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") _myElectrons = DataOnDemand(Location="Phys/StdLooseElectrons/Particles") return Selection(name, Algorithm=Lc2muee, RequiredSelections=[_myMuons, _myElectrons])
def makeX (localname, _RequiredSelections, config=default_config['CONFIG']): _combinex = CombineParticles(localname + "HighMassState"); _combinex.DecayDescriptor = "[Xi_bc+ -> J/psi(1S) p+]cc" _combinex.CombinationCut = ("(AM > %(HighMassBaryon_MassLowEdge)s ) &" + " (APT > %(HighMassBaryon_MinAPT)s ) " ) % config _combinex.DaughtersCuts = { "p+" : ("(PT > %(ProtonsForHighMassBaryon_PT)s) &"+ " (PROBNNp > %(ProtonsForHighMassBaryon_ProbNNp)s) &"+ " (TRGHP < %(GlobalGhostProb_Max)s) &" + " (TRPCHI2 > %(ProtonsForHighMassBaryon_TRPCHI2)s) & "+ " ( P > %(ProtonsForHighMassBaryon_P)s)") % config , "J/psi(1S)" : ("(PT > %(JpsiForHighMassBaryon_PT)s) & "+ "(ADMASS('J/psi(1S)') < %(JpsiForHighMassBaryon_MassWin)s) &"+ "(MAXTREE(TRGHP, ISBASIC) < %(GlobalGhostProb_Max)s) & " "(MINTREE('mu+'==ABSID,PIDmu) > %(JpsiForHighMassBaryon_MuonPIDmu)s)" ) % config } _combinex.MotherCut = "(ALL)" #No cut return Selection(localname + "SelHighMassBaryonicStates", Algorithm =_combinex, RequiredSelections = _RequiredSelections);
def makeEtap( self, name, config): _massCut = "(ADAMASS('eta_prime')<%s*MeV)" % config['eta_prime_MassWindow'] _PTCut = "(PT>%s*MeV)" % config['eta_prime_PT'] _vtxCut = "(VFASPF(VCHI2/VDOF)<%s)" % config['eta_prime_vtxChi2'] _docaCut = "(ACUTDOCA(%s,''))" % config['eta_prime_DOCA'] _track_PT="(PT>%s*MeV)" % config['Trk_PT'] _track_Chi2="(TRCHI2DOF<%s)" % config['Trk_Chi2'] _track_IPCut = "(BPVIPCHI2()>%s)" % config['Trk_IPChi2'] _allCuts = _PTCut+'&'+_vtxCut _trackCuts = _track_PT+'&'+_track_Chi2+'&'+_track_IPCut _combCuts=_massCut+'&'+_docaCut _etap=CombineParticles("etap") _etap.DecayDescriptors = ["[eta_prime -> rho(770)0 gamma]cc", "[eta_prime -> eta pi+ pi-]cc"] _etap.CombinationCut=_combCuts _etap.MotherCut=_allCuts _etap.DaughtersCuts = { "pi+" : _trackCuts, "pi-" : _trackCuts} self.selEtap = Selection(name, Algorithm=_etap, RequiredSelections=[self.selRho, self.daughters])
def selection_tau_h3(Config, preambulo, inputs): config = Config['tau_h3'] ## Pickout tau_h3 config from big one. # dcut = parse_cuts_auto(config['dcuts']) algo = CombineParticles('CombTauNoiso_h3') algo.DecayDescriptor = '[ tau- -> pi- pi- pi+ ]cc' algo.Preambulo = preambulo0 + preambulo.split('\n') algo.DaughtersCuts = {'pi-': dcut, 'pi+': dcut} algo.CombinationCut = parse_cuts_auto(config['ccuts']) algo.MotherCut = parse_cuts_auto(config['mcuts']) # config_refit = Config['PVRefitter'] if config_refit: tool = LoKi__PVReFitter('PVRefitter_tauh3', **config_refit) algo.ReFitPVs = True algo.IgnoreP2PVFromInputLocations = True algo.addTool(tool) algo.PVReFitters.update({'': 'LoKi::PVReFitter/PVRefitter_tauh3'}) # return Selection('SelTauNoiso_h3', Algorithm=algo, RequiredSelections=inputs)
def makeJPsi2mumu(name, MuonPT, MuonIPCHI2, JPsiPT, JPsiVCHI2) : """ Create and return a JPsi -> Mu Mu Selection object. Starts from DataOnDemand 'Phys/StdLooseMuons/Particles'. Arguments: name : name of the Selection. MuonPT : Minimum transverse momentum of Mu (MeV). MuonIPCHI2 : Minimum impact parameter chi2 of Mu. JPsiPT : Minimum transverse momentum of JPsi (MeV). JPsiVCHI2 : Maximum JPsi vertex chi2 per degree of freedom. """ MuCuts = "(TRCHI2DOF < 5 )"\ "& (MIPCHI2DV(PRIMARY)> %(MuonIPCHI2)s)"\ "& (PT > %(MuonPT)s *MeV)" % locals() MotherCuts = "(VFASPF(VCHI2/VDOF)< %(JPsiVCHI2)s)"\ "& (PT > %(JPsiPT)s *MeV)"\ "& (ADMASS('J/psi(1S)') < 100*MeV )" % locals() _JPsi = CombineParticles("_"+name) _JPsi.DecayDescriptor = "J/psi(1S) -> mu+ mu-" _JPsi.DaughtersCuts = { "mu+" : MuCuts} _JPsi.CombinationCut = "(ADAMASS('J/psi(1S)')<100*MeV) "\ "& (AMAXDOCA('')<0.3*mm)" _JPsi.MotherCut = MotherCuts _stdLooseMuons = DataOnDemand(Location = "Phys/StdLooseMuons/Particles") return Selection (name, Algorithm = _JPsi, RequiredSelections = [ _stdLooseMuons ])
def makeKPiMuMuLFV(name, config): """ Line for the selection of K+ -> pi- mu+ mu+, Before prescaling this line, please contact the authors listed above Arguments: name : name of the Selection. config : dictionary of tunable cuts """ from Configurables import OfflineVertexFitter KPiMuMuLFV = CombineParticles("Combine" + name) KPiMuMuLFV.DecayDescriptor = "[K+ -> pi- mu+ mu+]cc" #KPiMuMuLFV.addTool( OfflineVertexFitter ) #KPiMuMuLFV.ParticleCombiners.update( { "" : "OfflineVertexFitter"} ) #KPiMuMuLFV.OfflineVertexFitter.useResonanceVertex = False KPiMuMuLFV.DaughtersCuts = { "mu+": "(P>3000) & (TRCHI2DOF<%(KDauTrChi2)s) & (TRGHOSTPROB<0.3) & (MIPCHI2DV(PRIMARY)>%(KDauMinIpChi2)s)" % config, "pi+": "(P>1000) & (TRCHI2DOF<%(KDauTrChi2)s) & (TRGHOSTPROB < 0.3) & (MIPCHI2DV(PRIMARY)>%(KDauMinIpChi2)s)" % config, } KPiMuMuLFV.CombinationCut = "(ADAMASS('K+') < %(KMassWin)s *MeV) & (AMAXDOCA('')< %(KMaxDOCA)s *mm)" % config KPiMuMuLFV.MotherCut ="(PT> %(KMinPT)s) & (ADMASS('K+') < %(KMassWin)s *MeV) & ((BPVDIRA > %(KMinDIRA)s))"\ "& (VFASPF(VCHI2) < %(KVtxChi2)s) & (BPVVDCHI2 > %(KMinVDChi2)s) & (BPVIPCHI2()< %(KMaxIpChi2)s )"%config _stdAllLoosePions = DataOnDemand( Location="Phys/StdAllLoosePions/Particles") _stdAllLooseMuons = DataOnDemand( Location="Phys/StdAllLooseMuons/Particles") return Selection(name, Algorithm=KPiMuMuLFV, RequiredSelections=[_stdAllLooseMuons, _stdAllLoosePions])
def makeLambdac(localname, _RequiredSelections, config=default_config): _lambdacCP = CombineParticles(localname + "lambdacAlgorithm") _lambdacCP.DecayDescriptor = "[Lambda_c+ -> p+ pi+ K-]cc" _lambdacCP.DaughtersCuts = { "p+": ("(TRPCHI2 > %(Protons4Lambdac_TRPCHI2)s) & " + " (PIDp > %(Protons4Lambdac_PIDp)s) & " + " (TRGHP < %(GlobalGhostProb_Max)s) &" + " (PT > %(Protons4Lambdac_PT)s) & " + " (P > %(Protons4Lambdac_minP)s) & " + " (PIDp - PIDK > %(Protons4Lambdac_PIDp-PIDK)s)") % config, "K-": ("(TRPCHI2 > %(Kaon4Lambdac_TRPCHI2)s) &" + "(PIDK > %(Kaon4Lambdac_PIDK)s) & " + "(TRGHP < %(GlobalGhostProb_Max)s) &" + "(P > %(Kaon4Lambdac_minP)s) & " + "(PT > %(Kaon4Lambdac_PT)s)") % config, "pi+": ("(MIPCHI2DV(PRIMARY)> %(Pions4Lambdac_MINIPCHI2)s) &" + " (TRPCHI2 > %(Pion4Lambdac_TRPCHI2)s) &" + " (TRGHP < %(GlobalGhostProb_Max)s) &" + " (PIDK < %(Pion4Lambdac_PIDK)s) &" + "(PT > %(Pion4Lambdac_PT)s)") % config } _lambdacCP.CombinationCut = ( "(ADAMASS('Lambda_c+') < %(Lambdac_MassWindowLarge)s) & " + "(APT > %(Lambdac_MinAPT)s) & " + "(ADOCAMAX('') < %(Lambdac_MaxADOCA)s)") % config _lambdacCP.MotherCut = ( "(VFASPF(VCHI2/VDOF) < %(Lambdac_ENDVERTEXCHI2)s) & " + "(ADMASS('Lambda_c+') < %(Lambdac_MassWindowTight)s) & " + "(BPVDIRA > %(Lambdac_BPVDIRA)s) & " + "(BPVLTIME('PropertimeFitter/properTime:PUBLIC')>%(Lambdac_minTAU)s)" ) % config return Selection(name=localname + 'LcSelection', Algorithm=_lambdacCP, RequiredSelections=_RequiredSelections)
def makeBd2JPsiKst(name, JPsisel, Kstsel, BMassWin, BVCHI2, BDOCA, BIPCHI2, BDIRA): """ Create and return a Bd -> JPsi(mumu) Kstar (Kpi) Selection object. Arguments: name : name of the Selection. JPsisel : JPsi -> mu+ mu- Selection object. Kstsel : Kst -> K+pi- Selection object. BMassWin : Bd invariant mass window around PDG mass value (MeV). BVCHI2 : Maximum Bd vertex chi2 per degree of freedom. BDOCA : Maximum Bd DOCA. """ _motherCuts = " (VFASPF(VCHI2/VDOF) < %(BVCHI2)s) & (MIPCHI2DV(PRIMARY)< %(BIPCHI2)s) & (BPVDIRA > %(BDIRA)s)"% locals() _combinationCut = "(ADAMASS('B_s0') < %(BMassWin)s *MeV) & (AMAXDOCA('')< %(BDOCA)s *mm)" % locals() _Bd = CombineParticles('_'+name) _Bd.DecayDescriptor = "[B0 -> J/psi(1S) K*(892)0]cc" _Bd.CombinationCut = _combinationCut _Bd.MotherCut = _motherCuts _Bd.ReFitPVs = True _Bd.addTool( OfflineVertexFitter ) # _Bd.VertexFitters.update( { "" : "OfflineVertexFitter"} ) _Bd.ParticleCombiners.update( { "" : "OfflineVertexFitter"} ) # Fix for DaVinci v32r0 by A.Poluektov _Bd.OfflineVertexFitter.useResonanceVertex = False return Selection ( name, Algorithm = _Bd, RequiredSelections = [JPsisel,Kstsel])
def makeBs2PhiKst(name, Phisel, Kstsel, BMassWin, BVCHI2, BDOCA, BDIRA): """ Create and return a Bs -> Phi (KK) Kstar (Kpi) Selection object. Arguments: name : name of the Selection. Phisel : Phi -> K+K- Selection object. Kstsel : Kst -> K+pi- Selection object. BMassWin : Bs invariant mass window around PDG mass value (MeV). BVCHI2 : Maximum Bs vertex chi2 per degree of freedom. BDOCA : Maximum Bs DOCA. """ _motherCuts = "(VFASPF(VCHI2/VDOF) < %(BVCHI2)s) & (BPVDIRA > %(BDIRA)s)"% locals() _combinationCut = "(ADAMASS('B_s0') < %(BMassWin)s *MeV) & (AMAXDOCA('')< %(BDOCA)s *mm)" % locals() _Bs = CombineParticles('_'+name) _Bs.DecayDescriptor = "[B_s0 -> phi(1020) K*(892)~0]cc" _Bs.CombinationCut = _combinationCut _Bs.MotherCut = _motherCuts _Bs.ReFitPVs = True _Bs.addTool( OfflineVertexFitter ) # _Bs.VertexFitters.update( { "" : "OfflineVertexFitter"} ) _Bs.ParticleCombiners.update( { "" : "OfflineVertexFitter"} ) # Fix for DaVinci v32r0 by A.Poluektov _Bs.OfflineVertexFitter.useResonanceVertex = False return Selection ( name, Algorithm = _Bs, RequiredSelections = [Phisel,Kstsel])
def makeBd2InflatonRho(name, SelInflatonLong, SelRho): """ detached Bd -> Inflaton rho selection. Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter Bd2InflatonRho = CombineParticles("Combine" + name) Bd2InflatonRho.DecayDescriptor = "B0 -> KS0 rho(770)0" Bd2InflatonRho.addTool(OfflineVertexFitter) #Bd2InflatonRho.VertexFitters.update( { "" : "OfflineVertexFitter"} ) Bd2InflatonRho.ParticleCombiners.update({"": "OfflineVertexFitter"}) Bd2InflatonRho.OfflineVertexFitter.useResonanceVertex = False Bd2InflatonRho.ReFitPVs = True Bd2InflatonRho.DaughtersCuts = {"rho(770)0": "MIPCHI2DV(PRIMARY)> 25."} Bd2InflatonRho.CombinationCut = "(ADAMASS('B0') < 500*MeV)" Bd2InflatonRho.MotherCut = "(BPVIPCHI2()< 50) & (VFASPF(VCHI2)<100)& (D2DVVDDOT(1) > 0.3*mm)" return Selection("Sel" + name, Algorithm=Bd2InflatonRho, RequiredSelections=[SelInflatonLong, SelRho])
def makeK3Pi(name): """ Line for the selection of K+ -> pi+ pi+ pi- Before prescaling this line, please contact Francesco Dettori Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter K3Pi = CombineParticles("Combine" + name) K3Pi.DecayDescriptor = "[K+ -> pi+ pi+ pi-]cc" K3Pi.addTool(OfflineVertexFitter) K3Pi.ParticleCombiners.update({"": "OfflineVertexFitter"}) K3Pi.OfflineVertexFitter.useResonanceVertex = False K3Pi.DaughtersCuts = { "pi+": "(TRCHI2DOF<3) & (TRGHOSTPROB<0.3) & (MIPCHI2DV(PRIMARY)>9)" } K3Pi.CombinationCut = "(ADAMASS('K+')<100*MeV)"\ "& (AMAXDOCA('')<2*mm)" K3Pi.MotherCut = "(VFASPF(VCHI2/VDOF)<9) & (PT>100*MeV)"\ "& (ADMASS('K+') < 100*MeV )"\ "& (BPVDIRA > 0.999) "\ "& (BPVIPCHI2()< 9)"\ "& (BPVLTIME()>10*ps)" #"& (BPVVDCHI2> 9)"\ _stdAllLoosePions = DataOnDemand( Location="Phys/StdAllLoosePions/Particles") return Selection(name, Algorithm=K3Pi, RequiredSelections=[_stdAllLoosePions])
def makeD2MuMuMuMu(name, inputSel): """ D --> 4 mu selection """ from Configurables import OfflineVertexFitter D2MuMuMuMu = CombineParticles("Combine" + name) D2MuMuMuMu.DecayDescriptor = "D0 -> mu+ mu- mu+ mu-" D2MuMuMuMu.addTool(OfflineVertexFitter) D2MuMuMuMu.VertexFitters.update({"": "OfflineVertexFitter"}) D2MuMuMuMu.DaughtersCuts = { "mu+" : "(TRCHI2DOF < 3.0 ) "\ " & (MIPCHI2DV(PRIMARY)> 4.)"\ " & (P> 3000.*MeV)"} D2MuMuMuMu.CombinationCut = "(ADAMASS('D0')<300*MeV) "\ "& (AMAXDOCA('')<0.4*mm) " D2MuMuMuMu.MotherCut = "(VFASPF(VCHI2/VDOF)<12.) "\ "& (BPVVDZ > 0.) " \ "& (MIPCHI2DV(PRIMARY) < 25. )" return Selection(name, Algorithm=D2MuMuMuMu, RequiredSelections=inputSel)
# simulation = False year = "2016" magnetPolarity = "Down" ###################################################################################################### # if you are setting something wrong, it should die here... if year not in [ "2016" ]: raise RuntimeError(year + " is not a valid year") if magnetPolarity not in ["Up", "Down"]: raise RuntimeError(magnetPolarity + " is not a valid magnet polarity") ###################################################################################################### from Configurables import CombineParticles KsPiPi= CombineParticles("KsPiPi") KsPiPi.DecayDescriptor = "KS0 -> pi+ pi-" KsPiPi.CombinationCut = "ADAMASS('KS0')<100*MeV" KsPiPi.MotherCut = "(VFASPF(VCHI2/VDOF)<10)" KsPiPi.DaughtersCuts = { "pi+" : "ALL", "pi-" : "ALL" } KsPiPi.MotherCut = "(M > 400) & (M < 600) & (BPVVDCHI2 > 100.) & (VFASPF(VCHI2/VDOF) < 10)" from PhysSelPython.Wrappers import Selection from StandardParticles import StdNoPIDsDownPions, StdLoosePions LooseKsPiPi = Selection("SelLooseKsPiPi", Algorithm = KsPiPi, RequiredSelections = [StdNoPIDsDownPions ]) #RequiredSelections = [StdLoosePions]) from PhysSelPython.Wrappers import SelectionSequence SeqKsPiPi = SelectionSequence('SeqKsPiPi', TopSelection = LooseKsPiPi) KsPiPiTuple = DecayTreeTuple("KsPiPiTuple")
# Stripping filter strippingFilter = LoKi__HDRFilter( 'StripPassFilter', Code="HLT_PASS('Stripping"+line+"Decision')", Location="/Event/Strip/Phys/DecReports" ) evtPreselectors.append(strippingFilter) # Muons and kaons looseMuons = DataOnDemand(Location = 'Phys/StdLooseMuons/Particles') looseKaons = DataOnDemand(Location = 'Phys/StdLooseKaons/Particles') loosePions = DataOnDemand(Location = 'Phys/StdLoosePions/Particles') # Select Phi recoPhi = CombineParticles("Phi2KK") recoPhi.DecayDescriptor = 'phi(1020) -> K+ K-' recoPhi.DaughtersCuts = {"K+": "(ISLONG) & (TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & ( BPVIPCHI2 () > 9 ) & (PT>300*MeV) & (PIDK > 5)", "K-": "(ISLONG) & (TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & ( BPVIPCHI2 () > 9 ) & (PT>300*MeV) & (PIDK > 5)"} recoPhi.CombinationCut = "(ADAMASS('phi(1020)')<10*MeV)" recoPhi.MotherCut = " ( VFASPF(VCHI2) < 10 ) & (MIPCHI2DV(PRIMARY)> 16.)" # Very loose version for testing # recoPhi = CombineParticles("Phi2KK") # recoPhi.DecayDescriptor = 'phi(1020) -> K+ K-' # recoPhi.DaughtersCuts = {"K+": "(ISLONG) & (TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & ( BPVIPCHI2 () > 9 ) & (PT>300*MeV) & (PIDK > -5)", # "K-": "(ISLONG) & (TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & ( BPVIPCHI2 () > 9 ) & (PT>300*MeV) & (PIDK > -5)"} # recoPhi.CombinationCut = "(ADAMASS('phi(1020)')<35*MeV)" # recoPhi.MotherCut = " ( VFASPF(VCHI2) < 25 ) & (MIPCHI2DV(PRIMARY)> 4.)" phi_selection = Selection('SelPhi2KK', Algorithm = recoPhi, RequiredSelections = [ looseKaons ]) # Select Tau recoTau = CombineParticles("Tau2PhiMu")
KsLL = Selection( "Sel_KsLL", Algorithm = FilterDesktop(name = "KsLLFilter", Code = KsLLCuts ), RequiredSelections = [StdLooseKsLL]) #RequiredSelections = [DataOnDemand(Location = 'Phys/StdLooseKsLL/Particles')]) KsDD = Selection( "Sel_KsDD", Algorithm = FilterDesktop(name = "KsDDFilter", Code = KsDDCuts ), RequiredSelections = [StdLooseKsDD]) #RequiredSelections = [DataOnDemand(Location = 'Phys/StdLooseKsDD/Particles')]) Ks = MergedSelection("Ks", RequiredSelections = [KsLL, KsDD]) Phi = CombineParticles("Phi2KsKs") Phi.DecayDescriptor = 'phi(1020) -> KS0 KS0' #Cuts from the stripping line Phi.CombinationCut = "( (ACHILDCUT(CHILDCUT(ISLONG,1),1)) | (ACHILDCUT(CHILDCUT(ISLONG,1),2)) ) & (APT > %(Phi_PT_MIN)s *MeV) & (AM < %(Phi_MASS_MAX)s + 30*MeV) & (ACUTDOCACHI2(%(Phi_DOCACHI2_MAX)s,''))" %config Phi.MotherCut = "(M < %(Phi_MASS_MAX)s *MeV) & (VFASPF(VCHI2/VDOF) < %(Phi_VCHI2NDOF_MAX)s) & (MIPCHI2DV(PRIMARY) < %(Phi_IPCHI2_MAX)s)" %config Phi_Sel = Selection(name = "Sel_Phi2KsKs", Algorithm = Phi, RequiredSelections = [Ks])#[StdLooseKsDD,StdLooseKsLL]) Ds = CombineParticles("Ds2PhiPi") Ds.DecayDescriptor = '[D_s+ -> phi(1020) pi+]cc' Ds.CombinationCut = " (APT > %(Dp_PT_MIN)s *MeV) & (ADAMASS(1920*MeV) < %(Dp_MASS_WIN)s + 30*MeV) & (ACUTDOCACHI2(%(Dp_DOCACHI2_MAX)s,''))" %config#"( (ACHILDCUT(CHILDCUT(ISLONG,1),1)) | (ACHILDCUT(CHILDCUT(ISLONG,1),2)) ) &" Ds.MotherCut = "(DMASS(1920*MeV) < %(Dp_MASS_WIN)s *MeV) & (VFASPF(VCHI2/VDOF) < %(Dp_VCHI2NDOF_MAX)s) & (MIPCHI2DV(PRIMARY) < %(Dp_IPCHI2_MAX)s)" %config # Ds.DaughtersCuts = { '' : 'ALL' , 'phi(1020)' : '(ALL)' , 'pi+' : '(PT >150 *MeV) & (BPVIPCHI2() > 1.0) & ( TRCHI2DOF < 5 )& (TRGHOSTPROB<0.3)'}
def __init__(self, name, config): self.name = name LineBuilder.__init__(self, name, config) ################################################################################# # Configure trigger ################################################################################# l0 = None if config['L0']: l0 = "L0_CHANNEL_RE('%s')" % ('|'.join(config['L0'])) hlt = None if config['HLT']: hlt = "HLT_PASS_RE('%s')" % ('|'.join(config['HLT'])) ################################################################################# # Build Lambda_0 ################################################################################# tracks_code = """(MAXTREE(TRCHI2DOF, HASTRACK) < %(Track_Chi2ndf_Max)s) & (MINTREE(TRCHI2DOF, HASTRACK) < %(Track_MinChi2ndf_Max)s) & (MAXTREE(TRGHOSTPROB, HASTRACK) < %(Track_GhostProb_Max)s) & (INTREE(('p+'==ABSID) & (PT > %(Proton_Pt_Min)s))) & (INTREE(('pi+'==ABSID) & (PT > %(Pion_Pt_Min)s))) & (INTREE(('p+'==ABSID) & (P > %(Proton_P_Min)s))) & (INTREE(('pi+'==ABSID) & (P > %(Pion_P_Min)s)))""" lambda0_ll_dod = DataOnDemand( Location='Phys/StdLooseLambdaLL/Particles') lambda0_ll_code = """(PT>%(Lambda0_Pt_Min)s*MeV) & (VFASPF(VCHI2/VDOF)<%(Lambda0_VtxChi2_Max)s) & (MINTREE(MIPCHI2DV(PRIMARY), ISLONG) > %(TrackLL_IPChi2_Min)s) & (MIPDV(PRIMARY) > %(Lambda0LL_IP_Min)s*mm) & (ADMASS('Lambda0') < %(Lambda0LL_MassWindow)s*MeV)""" lambda0_ll_code = (lambda0_ll_code + " & " + tracks_code) % config lambda0_ll_filter = FilterDesktop(Code=lambda0_ll_code) lambda0_ll = Selection("LooseLambda0LL", Algorithm=lambda0_ll_filter, RequiredSelections=[lambda0_ll_dod]) lambda0_dd_dod = DataOnDemand( Location='Phys/StdLooseLambdaDD/Particles') lambda0_dd_code = """(PT>%(Lambda0_Pt_Min)s*MeV) & (VFASPF(VCHI2/VDOF)<%(Lambda0_VtxChi2_Max)s) & (ADMASS('Lambda0') < %(Lambda0DD_MassWindow)s*MeV)""" lambda0_dd_code = (lambda0_dd_code + " & " + tracks_code) % config lambda0_dd_filter = FilterDesktop(Code=lambda0_dd_code) lambda0_dd = Selection("LooseLambda0DD", Algorithm=lambda0_dd_filter, RequiredSelections=[lambda0_dd_dod]) lambda0 = MergedSelection("LooseLambda0", RequiredSelections=[lambda0_ll, lambda0_dd]) ################################################################################# # Filter photons ################################################################################# photons_noncnv_filter = FilterDesktop( Code="(PT > %(Photon_PT_Min)s*MeV) & (CL > %(Photon_CL_Min)s)" % config) photons_noncnv = Selection("Photons_NonCnv", Algorithm=photons_noncnv_filter, RequiredSelections=[StdLooseAllPhotons]) photons_cnv_merged = MergedSelection( "Photons_Cnv_Merge", RequiredSelections=[StdAllLooseGammaDD, StdAllLooseGammaLL]) photons_cnv_code = """(HASVERTEX) & (MM < %(PhotonCnv_MM_Max)s*MeV) & (PT > %(PhotonCnv_PT_Min)s*MeV) & (VFASPF(VCHI2/VDOF)<%(PhotonCnv_VtxChi2_Max)s)""" % config photons_cnv_filter = FilterDesktop(Code=photons_cnv_code % config) photons_cnv = Selection("Photons_Cnv", Algorithm=photons_cnv_filter, RequiredSelections=[photons_cnv_merged]) ################################################################################# # Build Lambda_b ################################################################################# # With non-converted photons lambda_b_combine = CombineParticles("Lambdab_NonConv_Combine") lambda_b_combine.DecayDescriptor = "[Lambda_b0 -> Lambda0 gamma]cc" lambda_b_combine.DaughtersCuts = {'Lambda0': 'ALL', 'gamma': 'ALL'} lambda_b_combine.ParticleCombiners = {'': 'ParticleAdder'} lambda_b_combine.CombinationCut = """(ADAMASS('Lambda_b0') < %(Lambdab_MassWindow)s*MeV) & (ASUM(PT) > %(Lambdab_SumPt_Min)s )""" % config lambda_b_combine.MotherCut = """(PT > %(Lambdab_Pt_Min)s*MeV) & (MTDOCACHI2(1) < %(Lambdab_MTDOCAChi2_Max)s)""" % config lambda_b = Selection("Lambdab_NonConv_Sel", Algorithm=lambda_b_combine, RequiredSelections=[photons_noncnv, lambda0]) # With converted photons lambda_b_cnv_combine = CombineParticles("Lambdab_Conv_Combine") lambda_b_cnv_combine.DecayDescriptor = "[Lambda_b0 -> Lambda0 gamma]cc" lambda_b_cnv_combine.DaughtersCuts = {'Lambda0': 'ALL', 'gamma': 'ALL'} lambda_b_cnv_combine.ParticleCombiners = { "": "OfflineVertexFitter:PUBLIC" } lambda_b_cnv_combine.CombinationCut = "(ADAMASS('Lambda_b0') < 1.5*%(Lambdab_MassWindow)s*MeV)" % config lambda_b_cnv_combine.MotherCut = """(HASVERTEX) & (VFASPF(VCHI2/VDOF)<%(Lambdab_VtxChi2_Max)s) & (PT > %(Lambdab_Pt_Min)s*MeV) & (BPVIPCHI2() < %(Lambdab_IPChi2_Max)s) & (ADMASS('Lambda_b0') < %(Lambdab_MassWindow)s*MeV)""" % config #(MTDOCACHI2(1) < %(Lambdab_MTDOCAChi2_Max)s) & lambda_b_cnv = Selection("Lambdab_Conv_Sel", Algorithm=lambda_b_cnv_combine, RequiredSelections=[photons_cnv, lambda0]) ################################################################################# # Build lines ################################################################################# sels_line = { 'Phys/StdLooseLambdaLL': 'Lambda0', 'Phys/StdLooseLambdaDD': 'Lambda0' } self.line = StrippingLine("Lb2L0Gamma", prescale=config["Lb2L0GammaPrescale"], L0DU=l0, HLT=hlt, checkPV=True, RelatedInfoTools=[ self.get_cone_relinfo(sels_line, 1.7, 1), self.get_cone_relinfo( sels_line, 1.35, 1), self.get_cone_relinfo(sels_line, 1.0, 1), self.get_vtxisol_relinfo(lambda_b), ], RequiredRawEvents=['Calo'], selection=lambda_b) self.registerLine(self.line) sels_line_cnv = { 'Phys/StdLooseLambdaLL': 'Lambda0', 'Phys/StdLooseLambdaDD': 'Lambda0', lambda_b_cnv: 'Lambdab' } self.line_cnv = StrippingLine( "Lb2L0GammaConverted", prescale=config["Lb2L0GammaPrescale"], L0DU=l0, HLT=hlt, checkPV=True, RelatedInfoTools=[ self.get_cone_relinfo(sels_line_cnv, 1.7, 1), self.get_cone_relinfo(sels_line_cnv, 1.35, 1), self.get_cone_relinfo(sels_line_cnv, 1.0, 1), self.get_vtxisol_relinfo(lambda_b_cnv), ], RequiredRawEvents=['Calo'], selection=lambda_b_cnv) self.registerLine(self.line_cnv)
"VV":"( ANUM( ( TRTYPE == 1 ) & ( ABSID == 'e-' ) ) == 2 )", "LU":"( ( ANUM( ( TRTYPE == 3 ) & ( ABSID == 'e-' ) ) == 1 ) & ( ANUM( ( TRTYPE == 4 ) & ( ABSID == 'e-' ) ) == 1 ) )", "LV":"( ( ANUM( ( TRTYPE == 3 ) & ( ABSID == 'e-' ) ) == 1 ) & ( ANUM( ( TRTYPE == 1 ) & ( ABSID == 'e-' ) ) == 1 ) )", "UV":"( ( ANUM( ( TRTYPE == 4 ) & ( ABSID == 'e-' ) ) == 1 ) & ( ANUM( ( TRTYPE == 1 ) & ( ABSID == 'e-' ) ) == 1 ) )"} ## build combinations Ks2pipiee = {} for name in combs: Ks2pipiee[name] = CombineParticles("TrackSel"+name+"_Ks2pipiee") Ks2pipiee[name].DecayDescriptor = "KS0 -> pi+ pi- e+ e-" Ks2pipiee[name].Preambulo=["from LoKiPhysMC.decorators import *", "from LoKiPhysMC.functions import mcMatch"] ## only take pions mctruth matched to pions from signal... Ks2pipiee[name].DaughtersCuts = {"pi+" : "mcMatch('KS0 ==> ^pi+ pi- e+ e-' )", "pi-" : "mcMatch('KS0 ==> pi+ ^pi- e+ e-' )"} Ks2pipiee[name].CombinationCut = combs[name] Ks2pipiee[name].MotherCut = "ALL" ## input all possible daughters Ks2pipiee[name].Inputs =['Phys/StdAllNoPIDsPions', 'Phys/StdAllNoPIDsElectrons', 'Phys/StdNoPIDsUpElectrons', 'Phys/StdNoPIDsVeloElectrons'] DaVinci().UserAlgorithms +=[Ks2pipiee[name]] DaVinci().EvtMax = 0 DaVinci().DataType = "2016" DaVinci().Simulation = True HOME = "/eos/lhcb/wg/RD/K0S2pipiee/dsts/MC2016/Priv/Sim09cMagUpLDST/" DaVinci().Input = map(lambda x: 'PFN:root://eoslhcb.cern.ch/'+HOME+x,os.listdir(HOME)) #DaVinci().Input gaudi = GaudiPython.AppMgr() gaudi.initialize()
## ============================================================================ ## create the algorithm - physical tau+ -> pi+ pi- pi+ StdTightDetachedTau3pi = CombineParticles('StdTightDetachedTau3pi') StdTightDetachedTau3pi.Inputs = ["Phys/StdLoosePions/Particles"] #Build physical tau and tau+++ StdTightDetachedTau3pi.DecayDescriptors = ["[tau+ -> pi+ pi- pi+]cc"] StdTightDetachedTau3pi.DaughtersCuts = { "pi+": "(PT>250.*MeV) & (P>2000.*MeV) & (MIPCHI2DV(PRIMARY) > 16.0) & (TRCHI2DOF<4) & (TRGHOSTPROB<0.4) & (PROBNNpi > 0.55)", "pi-": "(PT>250.*MeV) & (P>2000.*MeV) & (MIPCHI2DV(PRIMARY) > 16.0) & (TRCHI2DOF<4) & (TRGHOSTPROB<0.4) & (PROBNNpi > 0.55)" } StdTightDetachedTau3pi.CombinationCut = "(APT>800.*MeV) & ((AM>400.*MeV) & (AM<2100.*MeV)) & (AMAXDOCA('')<0.2*mm) & (ANUM(PT > 800*MeV) >= 1) " StdTightDetachedTau3pi.MotherCut = "(PT>1000.*MeV) & (M>500.*MeV) & (M<2000.*MeV) & (BPVDIRA>0.99) & (VFASPF(VCHI2) < 16) & (BPVVDCHI2>16) & (BPVVDRHO>0.1*mm) & (BPVVDRHO<7.0*mm) & (BPVVDZ>5.0*mm)" ## configure Data-On-Demand service locations = updateDoD(StdTightDetachedTau3pi) ## ============================================================================ if '__main__' == __name__: print __doc__ print __author__ print __version__ print locationsDoD(locations) # ============================================================================= # The END
def configure ( inputdata , ## the list of input files catalogs = [] , ## xml-catalogs (filled by GRID) castor = False , ## use the direct access to castor/EOS ? params = {} ) : ## configure Track <--> MC relation table import LoKiPhysMC.Track2MC_Configuration import LoKiMC.MC ## import DaVinci from Configurables import DaVinci, GaudiSequencer ## delegate the actual configurtaion to DaVinci dv = DaVinci ( DataType = '2011' , InputType = 'MDST', Lumi = True, Simulation = True, DDDBtag="MC11-20111102", CondDBtag="sim-20111111-vc-md100", HistogramFile = "mcd02kpi_tracks7_histo.root", TupleFile = "mcd02kpi_tracks7_ntuple.root", PrintFreq = 1000) from Configurables import DecayTreeTuple, FilterDesktop, TupleToolGeometry, CombineParticles from Configurables import MCDecayTreeTuple, TupleToolMCTruth, MCTupleToolHierarchy from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence, DataOnDemand from Configurables import CheckPV # First using CombineParticle to create the D0 ################################################################################ #from StandardParticles import StdAllNoPIDsPions, StdAllNoPIDsKaons _pions = DataOnDemand(Location='Phys/StdAllNoPIDsPions/Particles') _kaons = DataOnDemand(Location='Phys/StdAllNoPIDsKaons/Particles') _d2kpi = CombineParticles("d2kpi") _d2kpi.DecayDescriptor = "[D0 -> K- pi+]cc" _d2kpi.DaughtersCuts = { "K-" : "(PT > 500.0) & (0.0 < PIDK)", "pi+" : "(PT > 500.0) & (5.0 > PIDK)", "K+" : "(PT > 500.0) & (0.0 < PIDK)", "pi-" : "(PT > 500.0) & (5.0 > PIDK) " } _d2kpi.MotherCut = "(VFASPF(VCHI2/VDOF)<10)" _d2kpi.CombinationCut = "(ADAMASS('D0') < 50.0)" _d2kpi.Preambulo = [ "from LoKiPhysMC.decorators import *" , "from PartProp.Nodes import CC" ] #_d2kpi.ReFitPVs = True SelD2KPi = Selection( "SelD2KPi", Algorithm= _d2kpi, RequiredSelections=[_pions,_kaons] ) SeqD2KPi = SelectionSequence('SeqD2KPi',TopSelection = SelD2KPi) # Now the CheckPV method to filter algorithms c = CheckPV("OnePV") c.MinPVs = 1 # And a sequencer to put them together gseq = GaudiSequencer() gseq.Members = [ c, SeqD2KPi.sequence() ] ## define the input data setData ( inputdata , catalogs , castor ) ## get/create application manager gaudi = appMgr() # ## modify/update the configuration: # ## (1) create the algorithm alg = TrackFilter( 'TrackFilter' ) #seq = createSequencer() ## (2) replace the list of top level algorithm by # new list, which contains only *THIS* algorithm gaudi.setAlgorithms( [ gseq, alg ] ) return SUCCESS
from os import environ import GaudiKernel.SystemOfUnits as Units from Gaudi.Configuration import * from Configurables import CombineParticles, PhysDesktop from Configurables import LoKi__Hybrid__PlotTool as PlotTool importOptions("$DAVINCIROOT/options/DaVinciCommon.opts") ApplicationMgr().TopAlg += ["GaudiSequencer/TutorialSeq"] jpsi2mumu = CombineParticles("Jpsi2MuMu") jpsi2mumu.addTool(PhysDesktop()) jpsi2mumu.PhysDesktop.InputLocations = ["Phys/StdLooseMuons"] jpsi2mumu.DecayDescriptor = "J/psi(1S) -> mu+ mu-" jpsi2mumu.DaughtersCuts = {"mu+": "ALL", "mu-": "ALL"} jpsi2mumu.CombinationCut = "ADAMASS('J/psi(1S)')<30" jpsi2mumu.MotherCut = "(VFASPF(VCHI2/VDOF)<100)" GaudiSequencer("TutorialSeq").Members.append(jpsi2mumu) phi2kk = CombineParticles("Phi2KK") phi2kk.addTool(PhysDesktop()) phi2kk.PhysDesktop.InputLocations = ["Phys/StdLooseKaons"] phi2kk.DecayDescriptor = "phi(1020) -> K+ K-" phi2kk.CombinationCut = "ADAMASS('phi(1020)')<50" phi2kk.MotherCut = "(VFASPF(VCHI2/VDOF)<100)" GaudiSequencer("TutorialSeq").Members.append(phi2kk) bs2jpsiphi = CombineParticles("Bs2JpsiPhi") bs2jpsiphi.addTool(PhysDesktop()) bs2jpsiphi.PhysDesktop.InputLocations = ["Phys/Jpsi2MuMu", "Phys/Phi2KK"] bs2jpsiphi.DecayDescriptor = "B_s0 -> phi(1020) J/psi(1S)"
def execute(simulation=True, turbo=True, decay_descriptor="J/psi(1S) -> mu- mu+"): # Configure all the unpacking, algorithms, tags and input files appConf = ApplicationMgr() appConf.ExtSvc+= ['ToolSvc', 'DataOnDemandSvc', LoKiSvc()] ConfigTarFileAccessSvc().File = 'config.tar' dv = DaVinci() dv.DataType = "2012" lhcbApp = LHCbApp() lhcbApp.Simulation = simulation CondDB().Upgrade = False dtt = DecayTreeTuple("Early2015") if turbo: tesla_prefix = "Hlt2DiMuonJPsi" dtt.Inputs = ["/Event/"+tesla_prefix+"/Particles"] dtt.InputPrimaryVertices = "/Event/"+tesla_prefix+"/Primary" dtt.WriteP2PVRelations = False else: LHCbApp().DDDBtag = "dddb-20140729" polarity = "u" LHCbApp().CondDBtag = "sim-20140730-vc-m%s100"%polarity muons = AutomaticData(Location="Phys/StdAllLooseMuons/Particles") jpsi = CombineParticles('MyJPsi') jpsi.DecayDescriptors = [decay_descriptor] jpsi.CombinationCut = "(AM < 7100.0 *GeV)" jpsi.DaughtersCuts = {"": "ALL", "mu+": "ALL", "mu-": "ALL"} jpsi.MotherCut = "(VFASPF(VCHI2/VDOF) < 999999.0)" code = """ ('J/psi(1S)' == ID) & in_range(2.990*GeV, M, 3.210*GeV) & DECTREE('%s') & CHILDCUT(1, HASMUON & ISMUON) & CHILDCUT(2, HASMUON & ISMUON) & (MINTREE('mu+' == ABSID, PT) > 700*MeV) & (MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF) < 5) & (MINTREE(ISBASIC & HASTRACK, CLONEDIST) > 5000) & (VFASPF(VPCHI2) > 0.5/100) & (abs(BPV(VZ)) < 0.5*meter) & (BPV(vrho2) < (10*mm)**2) """%(decay_descriptor) # similar to the HLT2 line code = """ (ADMASS('J/psi(1S)')< 120*MeV) & DECTREE('%s') & (PT>0*MeV) & (MAXTREE('mu-'==ABSID,TRCHI2DOF) < 4) & (MINTREE('mu-'==ABSID,PT)> 0*MeV) & (VFASPF(VCHI2PDOF)< 25) """%(decay_descriptor) filter_jpsi = FilterDesktop("MyFilterJPsi", Code=code, Preambulo=["vrho2 = VX**2 + VY**2"], ReFitPVs=True, #IgnoreP2PVFromInputLocations=True, #WriteP2PVRelations=True ) jpsi_sel = Selection("SelMyJPsi", Algorithm=jpsi, RequiredSelections=[muons]) filter_jpsi_sel = Selection("SelFilterMyJPsi", Algorithm=filter_jpsi, RequiredSelections=[jpsi_sel]) jpsi_seq = SelectionSequence("SeqMyJPsi", TopSelection=filter_jpsi_sel) dtt.Inputs = [jpsi_seq.outputLocation()] # Overwriting default list of TupleTools dtt.ToolList = ["TupleToolKinematic", "TupleToolPid", "TupleToolEventInfo", "TupleToolMCBackgroundInfo", "TupleToolMCTruth", #"MCTupleToolHierarchy", #"MCTupleToolPID", "TupleToolGeometry", "TupleToolTISTOS", # with turbo this crashes #"TupleToolTrackInfo", "TupleToolTrigger", ] tlist = ["L0HadronDecision", "L0MuonDecision", "L0DiMuonDecision", "L0ElectronDecision", "L0PhotonDecision", "Hlt1DiMuonHighMassDecision", "Hlt1DiMuonLowMassDecision", "Hlt1TrackMuonDecision", "Hlt1TrackAllL0Decision", "Hlt2DiMuonJPsiDecision", "Hlt2SingleMuonDecision", ] dtt.addTool(TupleToolTrigger, name="TupleToolTrigger") dtt.addTool(TupleToolTISTOS, name="TupleToolTISTOS") # Get trigger info dtt.TupleToolTrigger.Verbose = True dtt.TupleToolTrigger.TriggerList = tlist dtt.TupleToolTISTOS.Verbose = True dtt.TupleToolTISTOS.TriggerList = tlist from Configurables import TupleToolMCTruth, MCTupleToolHierarchy dtt.addTool(TupleToolMCBackgroundInfo, name="TupleToolMCBackgroundInfo") dtt.TupleToolMCBackgroundInfo.Verbose = True dtt.addTool(MCTupleToolHierarchy, name="MCTupleToolHierarchy") dtt.MCTupleToolHierarchy.Verbose = True dtt.addTool(TupleToolMCTruth, name="TupleToolMCTruth") dtt.TupleToolMCTruth.Verbose = True if turbo: assoc_seq = TeslaTruthUtils.associateSequence(tesla_prefix, False) ChargedPP2MC(tesla_prefix+"ProtoAssocPP").OutputLevel = 1 assoc_seq.Members.insert(0, PatLHCbID2MCParticle()) from Configurables import MuonCoord2MCParticleLink muon_coords = MuonCoord2MCParticleLink("TeslaMuonCoordLinker") assoc_seq.Members.insert(1, muon_coords) TrackAssociator("TeslaAssocTr").DecideUsingMuons = True relations = TeslaTruthUtils.getRelLoc(tesla_prefix) else: relations = "Relations/Rec/ProtoP/Charged" TeslaTruthUtils.makeTruth(dtt, relations, ["MCTupleToolKinematic", "MCTupleToolHierarchy", "MCTupleToolPID", ] ) dtt.Decay = mark(2, mark(3, decay_descriptor)) #"J/psi(1S) -> ^mu- ^mu+" dtt.addBranches({"X": "^(%s)"%(decay_descriptor), "muplus": mark(3, decay_descriptor),#"J/psi(1S) -> mu- ^mu+", "muminus": mark(2, decay_descriptor),#"J/psi(1S) -> ^mu- mu+", }) x_preamble = ["DZ = VFASPF(VZ) - BPV(VZ)", ] x_vars = {"ETA": "ETA", "Y": "Y", "PHI": "PHI", "VPCHI2": "VFASPF(VPCHI2)", "DELTAZ": "DZ", # DZ * M / PZ / c with c in units of mm/s # XXX should this be the PDG mass or measured mass? #"TZ": "DZ*M / PZ / 299792458000.0", #seconds "TZ": "DZ*3096.916 / PZ/299792458000.0*(10**12)", #ps "minpt": "MINTREE('mu+' == ABSID, PT)", "minclonedist": "MINTREE(ISBASIC & HASTRACK, CLONEDIST)", "maxtrchi2dof": "MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF)", } muon_vars = {"ETA": "ETA", "Y": "Y", "PHI": "PHI", "CHARGE": "Q", "CLONEDIST": "CLONEDIST", "TRCHI2DOF": "TRCHI2DOF", } loki_X = dtt.X.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_X") loki_X.Variables = x_vars loki_X.Preambulo = x_preamble loki_mup = dtt.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuPlus") loki_mup.Variables = muon_vars #dtt.muplus.addTupleTool("TupleToolGeometry") loki_mum = dtt.muminus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuMinus") loki_mum.Variables = muon_vars #dtt.muminus.addTupleTool("TupleToolGeometry") dv.TupleFile = "DVNtuples.root" if turbo: dv.UserAlgorithms = [assoc_seq, dtt] else: assocpp = ChargedPP2MC("TimsChargedPP2MC") assocpp.OutputLevel = 1 dv.UserAlgorithms = [jpsi_seq.sequence(), assocpp, dtt]
KsLL = Selection( "Sel_KsLL", Algorithm = FilterDesktop(name = "KsLLFilter", Code = KsLLCuts ), RequiredSelections = [StdLooseKsLL]) #RequiredSelections = [DataOnDemand(Location = 'Phys/StdLooseKsLL/Particles')]) KsDD = Selection( "Sel_KsDD", Algorithm = FilterDesktop(name = "KsDDFilter", Code = KsDDCuts ), RequiredSelections = [StdLooseKsDD]) #RequiredSelections = [DataOnDemand(Location = 'Phys/StdLooseKsDD/Particles')]) Ks = MergedSelection("Ks", RequiredSelections = [KsLL, KsDD]) Phi = CombineParticles("Phi2KsKs") Phi.DecayDescriptor = 'phi(1020) -> KS0 KS0' #Cuts from the stripping line Phi.CombinationCut = "( (ACHILDCUT(CHILDCUT(ISLONG,1),1)) | (ACHILDCUT(CHILDCUT(ISLONG,1),2)) ) & (APT > %(Phi_PT_MIN)s *MeV) & (ADAMASS('phi(1020)')<%(Phi_MASS_RANGE)s +30*MeV) & (ACUTDOCACHI2(%(Phi_DOCACHI2_MAX)s,''))" %config Phi.MotherCut = "(ADMASS('phi(1020)')<%(Phi_MASS_RANGE)s*MeV) & (VFASPF(VCHI2/VDOF) < %(Phi_VCHI2NDOF_MAX)s)" %config Phi_Sel = Selection(name = "Sel_Phi2KsKs", Algorithm = Phi, RequiredSelections = [Ks])#[StdLooseKsDD,StdLooseKsLL]) Ds = CombineParticles("Ds2PhiPi") Ds.DecayDescriptor = '[D_s+ -> phi(1020) pi+]cc' Ds.DaughtersCuts = { '' : 'ALL' , 'phi(1020)' : '(ALL)' , 'pi+' : '(PT >150 *MeV) & (BPVIPCHI2() > 1.0) & ( TRCHI2DOF < 5 )& (TRGHOSTPROB<0.3)'} Ds.CombinationCut = "(ADAMASS('D_s+')<180*MeV)" Ds.MotherCut = "(VFASPF(VCHI2/VDOF) < 25.0)& (((BPVVDCHI2 > 16.0)|(BPVLTIME() > 0.150 * picosecond)))"#& (BPVDIRA > 35.0*mrad)"