def makeB2KShh(self, name, ks_type, year, sign, config): """ Create and return either a B -> KS h+ h- Selection object, or a B -> KS h+(-) h+(-) Same Sign Selection Object Arguments: name : name of the Selection. ks_type : type of the KS, e.g. DD year : the year for which we are making the selection sign : whether we use opposite-sign or same-sign h's config : config dictionary """ _trkChi2Cut = "(TRCHI2DOF<%s)" % config['Trk_Chi2'] _trkGhostProbCut = "(TRGHOSTPROB<%s)" % config['Trk_GhostProb'] _daughtersCuts = _trkChi2Cut + '&' + _trkGhostProbCut _massCutLow = "(AM>(5279-%s)*MeV)" % config['B_Mlow'] _massCutHigh = "(AM<(5279+%s)*MeV)" % config['B_Mhigh'] _aptCut = "(APT>%s*MeV)" % config['B_APTmin'] _daugMedPtCut = "(ANUM(PT>%s*MeV)>=2)" % config['BDaug_MedPT_PT'] _daugMaxPtIPCut = "(AVAL_MAX(MIPDV(PRIMARY),PT)>%s)" % config[ 'BDaug_MaxPT_IP'] _maxDocaChi2Cut = "(ACUTDOCACHI2(%s,''))" % config[ 'BDaug_%s_maxDocaChi2' % ks_type] _daugPtSumCut = "((APT1+APT2+APT3)>%s*MeV)" % config['BDaug_%s_PTsum' % ks_type] _combCuts = _daugPtSumCut + '&' + _massCutLow + '&' + _massCutHigh + '&' + _maxDocaChi2Cut + '&' + _aptCut + '&' + _daugMedPtCut + '&' + _daugMaxPtIPCut _diraCut = "(BPVDIRA>%s)" % config['B_%s_Dira' % ks_type] _KSdiffZ = "((CHILD(VFASPF(VZ),3) - VFASPF(VZ)) > %s*mm)" % config[ 'KS_FD_Z'] _motherCuts = _diraCut + '&' + _KSdiffZ _combName = name + '_' + ks_type + '_' + year + '_' + sign + '_Comb3Body' _B = CombineParticles(_combName) _B.DaughtersCuts = {"pi+": _daughtersCuts} _B.CombinationCut = _combCuts _B.MotherCut = _motherCuts _B.ReFitPVs = True if sign == 'OS': _B.DecayDescriptors = ["B0 -> pi+ pi- KS0"] else: _B.DecayDescriptors = ["B0 -> pi+ pi+ KS0", "B0 -> pi- pi- KS0"] _selname = name + '_' + ks_type + '_' + year + '_' + sign + '_Presel' return Selection(_selname, Algorithm=_B, RequiredSelections=[self.selKS[ks_type], self.pions])
def makeB2ee(name): """ Please contact Johannes Albrecht if you think of prescaling this line! Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter Bs2ee = CombineParticles("Combine"+name) Bs2ee.DecayDescriptors = ["B_s0 -> e+ e-","[B_s0 -> e+ e+]cc"] Bs2ee.addTool( OfflineVertexFitter ) Bs2ee.ParticleCombiners.update( { "" : "OfflineVertexFitter"} ) Bs2ee.OfflineVertexFitter.useResonanceVertex = False #Bs2ee.ReFitPVs = True Bs2ee.DaughtersCuts = { "e+" : "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 3 )"} Bs2ee.CombinationCut = "(ADAMASS('B_s0')<1200*MeV)"\ "& (AMAXDOCA('')<0.3*mm)" Bs2ee.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\ "& (ADMASS('B_s0') < 1200*MeV )"\ "& (BPVDIRA > 0) "\ "& (BPVVDCHI2> 225)"\ "& (BPVIPCHI2()< 25) " _stdLooseElectrons= DataOnDemand(Location = "Phys/StdLooseElectrons/Particles") return Selection (name, Algorithm = Bs2ee, RequiredSelections = [ _stdLooseElectrons])
def makeTau2eMuMu(name): """ Please contact Johannes Albrecht if you think of prescaling this line! Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter Tau2eMuMu = CombineParticles("Comine" + name) Tau2eMuMu.DecayDescriptors = [ " [ tau+ -> e+ mu+ mu- ]cc", " [ tau+ -> mu+ mu+ e- ]cc" ] Tau2eMuMu.DaughtersCuts = { "mu+": " ( PT > 300 * MeV ) & ( TRCHI2DOF < 4 ) & ( BPVIPCHI2 () > 9 ) ", "e+": " ( PT > 300 * MeV ) & ( TRCHI2DOF < 4 ) & ( BPVIPCHI2 () > 9 ) " } Tau2eMuMu.CombinationCut = "(ADAMASS('tau+')<200*MeV)" Tau2eMuMu.MotherCut = """ ( VFASPF(VCHI2) < 15 ) & ( (BPVLTIME ( 225 ) * c_light) > 100 * micrometer ) & ( BPVIPCHI2() < 225 ) """ _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") _stdLooseElectrons = DataOnDemand( Location="Phys/StdLooseElectrons/Particles") return Selection(name, Algorithm=Tau2eMuMu, RequiredSelections=[_stdLooseMuons, _stdLooseElectrons])
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 makeTau2pmm(name, config): """ Please contact Jon Harrison if you think of prescaling this line! Arguments: name : name of the Selection. """ Tau2PMuMu = CombineParticles("Comine" + name) Tau2PMuMu.DecayDescriptors = [ " [ tau+ -> p+ mu+ mu- ]cc", " [ tau+ -> p~- mu+ mu+ ]cc", " [ Lambda_c+ -> p+ mu+ mu- ]cc", " [ Lambda_c+ -> p~- mu+ mu+ ]cc" ] Tau2PMuMu.DaughtersCuts = { "mu+" : " ( PT > 300 * MeV ) & ( TRCHI2DOF < 3 ) & ( BPVIPCHI2 () > 9 ) "\ "& ( PIDmu > -5 ) & ( (PIDmu - PIDK) > 0 ) & ( TRGHOSTPROB < %(TrackGhostProb)s )"% config, "p+" : " ( PT > 300 * MeV ) & ( TRCHI2DOF < 3 ) & ( BPVIPCHI2 () > 9 ) "\ "& (PIDp>10) & ( TRGHOSTPROB < %(TrackGhostProb)s )" % config} Tau2PMuMu.CombinationCut = "( (ADAMASS('tau+')<150*MeV) | (ADAMASS('Lambda_c+')<150*MeV) )" Tau2PMuMu.MotherCut = """ ( VFASPF(VCHI2) < 15 ) & ( (BPVLTIME () * c_light) > 100 * micrometer ) & ( BPVIPCHI2() < 225 ) """ _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") _stdLooseProtons = DataOnDemand(Location="Phys/StdLooseProtons/Particles") return Selection(name, Algorithm=Tau2PMuMu, RequiredSelections=[_stdLooseMuons, _stdLooseProtons])
def build_mc_unbiased_selection(decayDesc, arrow = '==>', refitpvs = True) : '''Make a selection for the given decay descriptor that has no cuts besides truth matching.''' preamble = [ "from LoKiPhysMC.decorators import *" , "from LoKiPhysMC.functions import mcMatch" ] decayDesc = decayDesc.copy() decayDesc.clear_aliases() decayDesc.set_carets(False) decayDescCC = decayDesc.copy() decayDescCC.cc = True algname = decayDesc.get_full_alias() + '_MCSel' algnameconj = decayDesc.conjugate().get_full_alias() + '_MCSel' if algname in selections : return selections[algname] elif algnameconj in selections : return selections[algnameconj] if not decayDesc.daughters : alg = FilterDesktop(algname + '_Filter') basicname = decayDesc.particle.name if not basicname in mcbasicinputs : basicname = decayDesc.conjugate().particle.name if basicname in mcbasicinputs : inputsels = [RebuildSelection(getattr(StandardParticles, basicinput)) for basicinput in mcbasicinputs[basicname]] else : raise ValueError("Can't find MC basic input for particle " + repr(decayDesc.particle.name)) alg.Code = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) alg.Preambulo = preamble sel = Selection(algname, Algorithm = alg, RequiredSelections = inputsels) selections[algname] = sel return sel inputs = set() daughtercuts = {} for daughter in decayDescCC.daughters : originaldaughtercc = daughter.cc daughter.cc = True sel = build_mc_unbiased_selection(daughter, arrow, refitpvs) daughter.cc = originaldaughtercc inputs.add(sel) #daughter.caret = True #daughtercuts[daughter.particle.name] = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) #daughter.caret = False #comb = nCombiners[len(decayDesc.daughters)](algname + '_Comb') comb = CombineParticles(algname + '_Comb') # CombineParticles uses small cc, so set ishead = False comb.DecayDescriptors = [decayDesc.to_string(depth = 1).replace('CC', 'cc')] comb.MotherCut = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) comb.Preambulo = preamble comb.DaughtersCuts = daughtercuts comb.ReFitPVs = refitpvs if refitpvs: comb.MotherCut += ' & BPVVALID()' sel = Selection(algname, Algorithm = comb, RequiredSelections = list(inputs)) selections[algname] = sel return sel
def makeB2hTauMu(name): """ Please contact Johannes Albrecht if you think of prescaling this line! Arguments: name : name of the Selection. """ from Configurables import OfflineVertexFitter Bs2hTauMu = CombineParticles("Combine" + name) Bs2hTauMu.DecayDescriptors = [ "[B+ -> K+ tau+ mu-]cc", "[B+ -> K- tau+ mu+]cc", "[B+ -> K+ tau- mu+]cc", "[B+ -> pi+ tau+ mu-]cc", "[B+ -> pi- tau+ mu+]cc", "[B+ -> pi+ tau- mu+]cc", "[B+ -> p+ tau+ mu-]cc", "[B- -> p+ tau- mu-]cc", "[B+ -> p+ tau- mu+]cc" ] Bs2hTauMu.addTool(OfflineVertexFitter) Bs2hTauMu.ParticleCombiners.update({"": "OfflineVertexFitter"}) Bs2hTauMu.OfflineVertexFitter.useResonanceVertex = False #Bs2hTauMu.ReFitPVs = True Bs2hTauMu.DaughtersCuts = { "mu+": "(MIPCHI2DV(PRIMARY)>36.)&(TRCHI2DOF<3)& (TRGHOSTPROB<0.3)", "pi+": "(MIPCHI2DV(PRIMARY)>36.)&(TRCHI2DOF<3) & (TRGHOSTPROB<0.3)", "K+": "(MIPCHI2DV(PRIMARY)>36.)&(TRCHI2DOF<3)&(PIDK>5)& (TRGHOSTPROB<0.3)", "p+": "(MIPCHI2DV(PRIMARY)>36.)&(TRCHI2DOF<3)&(PIDp>5)& (TRGHOSTPROB<0.3)" } Bs2hTauMu.CombinationCut = "(ADAMASS('B+')<400*MeV)"\ "& (AMAXDOCA('')<0.15*mm)" Bs2hTauMu.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\ "& (BPVDIRA>0.999)"\ "& (ADMASS('B_s0') < 400*MeV )"\ "& (BPVDIRA > 0) "\ "& (BPVVDCHI2> 225)"\ "& (BPVIPCHI2()< 16) "#maybe 16 from CommonParticles import StdLooseDetachedTau, StdLooseDipion _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") _stdLooseDetachedTaus = DataOnDemand( Location="Phys/StdLooseDetachedTau3pi/Particles") _stdNoPIDsPions = DataOnDemand(Location="Phys/StdNoPIDsPions/Particles") _stdNoPIDsKaons = DataOnDemand(Location="Phys/StdNoPIDsKaons/Particles") _stdNoPIDsProtons = DataOnDemand( Location="Phys/StdNoPIDsProtons/Particles") return Selection(name, Algorithm=Bs2hTauMu, RequiredSelections=[ _stdLooseMuons, _stdLooseDetachedTaus, _stdNoPIDsPions, _stdNoPIDsKaons, _stdNoPIDsProtons ])
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 build_mc_unbiased_selection(decayDesc, arrow = '==>') : preamble = [ "from LoKiPhysMC.decorators import *" , "from LoKiPhysMC.functions import mcMatch" ] decayDesc.set_carets(False) decayDescCC = decayDesc.copy() decayDescCC.cc = True algname = decayDesc.get_full_alias() + '_MCSel' algnameconj = decayDesc.conjugate().get_full_alias() + '_MCSel' if algname in selections : return selections[algname] elif algnameconj in selections : return selections[algnameconj] if not decayDesc.daughters : alg = FilterDesktop(algname + '_Filter') if decayDesc.particle.name in mcbasicinputs : inputsel = mcbasicinputs[decayDesc.particle.name] else : conj = decayDesc.conjugate() if conj.particle.name in mcbasicinputs : inputsel = mcbasicinputs[conj.particle.name] else : raise ValueError("Can't find MC basic input for particle " + repr(decayDesc.particle.name)) alg.Code = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) alg.Preambulo = preamble sel = Selection(algname, Algorithm = alg, RequiredSelections = [inputsel]) selections[algname] = sel return sel inputs = set() daughtercuts = {} for daughter in decayDescCC.daughters : originaldaughtercc = daughter.cc daughter.cc = True sel = build_mc_unbiased_selection(daughter, arrow) daughter.cc = originaldaughtercc inputs.add(sel) #daughter.caret = True #daughtercuts[daughter.particle.name] = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) #daughter.caret = False #comb = nCombiners[len(decayDesc.daughters)](algname + '_Comb') comb = CombineParticles(algname + '_Comb') # CombineParticles uses small cc, so set ishead = False comb.DecayDescriptors = [decayDesc.to_string(depth = 1).replace('CC', 'cc')] comb.MotherCut = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) comb.Preambulo = preamble comb.DaughtersCuts = daughtercuts sel = Selection(algname, Algorithm = comb, RequiredSelections = list(inputs)) selections[algname] = sel return sel
def makeB23Mu(name): B23Mu = CombineParticles("Combine" + name) B23Mu.DecayDescriptors = ["[B+ -> mu+ mu+ mu-]cc", "[B+ -> mu+ mu+ mu+]cc"] B23Mu.DaughtersCuts = {"mu+": BTrackCuts} B23Mu.CombinationCut = BCombinationCut B23Mu.MotherCut = BMotherCut _myMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") return Selection(name, Algorithm=B23Mu, RequiredSelections=[_myMuons])
def makeB2Lcp(name): B2Lcp = CombineParticles("Combine"+name) B2Lcp.DecayDescriptors = [ "[B0 -> Lambda_c+ p~-]cc","[B0 -> Lambda_c+ p+]cc" ] B2Lcp.DaughtersCuts = { "p~-" : TrackCuts + "& (PIDp>5)"} B2Lcp.CombinationCut = BCombinationCut B2Lcp.MotherCut = BMotherCut _myLambdaC= DataOnDemand(Location = "Phys/StdLooseLambdac2PKPi/Particles") _myProtons = DataOnDemand(Location = "Phys/StdLooseProtons/Particles") return Selection (name, Algorithm = B2Lcp, RequiredSelections = [ _myLambdaC, _myProtons ])
def makeLb2Dsmu(name): Lb2Dsmu = CombineParticles("Combine"+name) Lb2Dsmu.DecayDescriptors = [ "[Lambda_b0 -> D_s+ mu-]cc","[Lambda_b0 -> D_s+ mu+]cc" ] Lb2Dsmu.DaughtersCuts = { "D_s+" : DsCut, "mu-" : TrackCuts } Lb2Dsmu.CombinationCut = Lb2DmuCombinationCut Lb2Dsmu.MotherCut = Lb2DmuMotherCut _myDsplus = DataOnDemand(Location = "Phys/StdLooseDsplus2KKPi/Particles") _myMuons = DataOnDemand(Location = "Phys/StdLooseMuons/Particles") return Selection (name, Algorithm = Lb2Dsmu, RequiredSelections = [ _myDsplus, _myMuons ])
def makeB2Lcmu(name): B2Lcmu = CombineParticles("Combine"+name) B2Lcmu.DecayDescriptors = [ "[B0 -> Lambda_c+ mu-]cc","[B0 -> Lambda_c+ mu+]cc" ] B2Lcmu.DaughtersCuts = { "mu-" : TrackCuts } B2Lcmu.CombinationCut = BCombinationCut B2Lcmu.MotherCut = BMotherCut _myLambdaC= DataOnDemand(Location = "Phys/StdLooseLambdac2PKPi/Particles") _myMuons = DataOnDemand(Location = "Phys/StdLooseMuons/Particles") return Selection (name, Algorithm = B2Lcmu, RequiredSelections = [ _myLambdaC, _myMuons ])
def makeLb2Lcpi(name): Lb2Lcpi = CombineParticles("Combine"+name) Lb2Lcpi.DecayDescriptors = [ "[Lambda_b0 -> Lambda_c+ pi-]cc","[Lambda_b0 -> Lambda_c+ pi+]cc" ] Lb2Lcpi.DaughtersCuts = { "pi-" : TrackCuts } Lb2Lcpi.CombinationCut = Lb2DmuCombinationCut Lb2Lcpi.MotherCut = Lb2DmuMotherCut _myLambdaC= DataOnDemand(Location = "Phys/StdLooseLambdac2PKPi/Particles") _myPions = DataOnDemand(Location = "Phys/StdLoosePions/Particles") return Selection (name, Algorithm = Lb2Lcpi, RequiredSelections = [ _myLambdaC, _myPions ])
def makeB2Dpi(name): B2Dpi = CombineParticles("Combine"+name) B2Dpi.DecayDescriptors = [ "[B0 -> D- pi+]cc" ] B2Dpi.DaughtersCuts = { "pi+" : TrackCuts, "D-" : DCut } B2Dpi.CombinationCut = B0CombinationCut B2Dpi.MotherCut = B0MotherCut _myDplus = DataOnDemand(Location = "Phys/StdLooseDplus2KPiPi/Particles") _myPions = DataOnDemand(Location = "Phys/StdLoosePions/Particles") return Selection (name, Algorithm = B2Dpi, RequiredSelections = [ _myDplus, _myPions ])
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 makeBs2Dspi(name): Bs2Dspi = CombineParticles("Combine"+name) Bs2Dspi.DecayDescriptors = [ "[B_s0 -> D_s- pi+]cc" ] Bs2Dspi.DaughtersCuts = { "pi+" : TrackCuts, "D_s-" : DsCut } Bs2Dspi.CombinationCut = BsCombinationCut Bs2Dspi.MotherCut = BsMotherCut _myDsplus = DataOnDemand(Location = "Phys/StdLooseDsplus2KKPi/Particles") _myPions = DataOnDemand(Location = "Phys/StdLoosePions/Particles") return Selection (name, Algorithm = Bs2Dspi, RequiredSelections = [ _myDsplus, _myPions ])
def makeLc23mu(name): Lc23mu = CombineParticles("Combine" + name) Lc23mu.DecayDescriptors = [ "[Lambda_c+ -> mu+ mu+ mu-]cc", "[Lambda_c+ -> mu+ mu+ mu+]cc" ] Lc23mu.DaughtersCuts = {"mu+": TrackCuts} Lc23mu.CombinationCut = LambdaCCombiCut300 Lc23mu.MotherCut = CommonMotherCut _myMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") return Selection(name, Algorithm=Lc23mu, RequiredSelections=[_myMuons])
def build_mc_unbiased_selection(decayDesc, arrow = '==>') : preamble = [ "from LoKiPhysMC.decorators import *" , "from LoKiPhysMC.functions import mcMatch" ] decayDesc.set_carets(False) decayDescCC = decayDesc.copy() decayDescCC.cc = True algname = decayDesc.get_full_alias() + '_MCSel' if algname in selections : return selections[algname] if not decayDesc.daughters : alg = FilterDesktop(algname + '_Filter') if decayDesc.particle.name in mcbasicinputs : inputsel = mcbasicinputs[decayDesc.particle.name] else : conj = decayDesc.conjugate() if conj.particle.name in mcbasicinputs : inputsel = mcbasicinputs[conj.particle.name] else : raise ValueError("Can't find MC basic input for particle " + repr(decayDesc.particle.name)) alg.Code = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) alg.Preambulo = preamble sel = Selection(algname, Algorithm = alg, RequiredSelections = [inputsel]) selections[algname] = sel return sel inputs = [] daughtercuts = {} for daughter in decayDescCC.daughters : originaldaughtercc = daughter.cc daughter.cc = True sel = build_mc_unbiased_selection(daughter, arrow) daughter.cc = originaldaughtercc inputs.append(sel) #daughter.caret = True #daughtercuts[daughter.particle.name] = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) #daughter.caret = False #comb = nCombiners[len(decayDesc.daughters)](algname + '_Comb') comb = CombineParticles(algname + '_Comb') # CombineParticles uses small cc, so set ishead = False comb.DecayDescriptors = [decayDesc.to_string(depth = 1, ishead = False)] comb.MotherCut = 'mcMatch({0!r})'.format(decayDescCC.to_string(arrow)) comb.Preambulo = preamble comb.DaughtersCuts = daughtercuts sel = Selection(algname, Algorithm = comb, RequiredSelections = inputs) selections[algname] = sel return sel
def makeTau2LambdaMu(name): makeLambda = CombineParticles("Lambda") makeLambda.DecayDescriptor = "[Lambda0 -> p+ pi-]cc" makeLambda.DaughtersCuts = {"pi+": "(ISLONG) & (TRCHI2DOF < 4 ) & (TRGHOSTPROB<0.5) & ( BPVIPCHI2 () > 5 ) "\ "& (PT>250*MeV) & (PIDpi - PIDK > -5)", "p+" : " ( PT > 250 * MeV ) & ( TRCHI2DOF < 4 ) & ( BPVIPCHI2 () > 5 ) "\ "& (PIDp>3) & ( TRGHOSTPROB < 0.5 )" } _pions = DataOnDemand(Location='Phys/StdLoosePions/Particles') _protons = DataOnDemand(Location='Phys/StdLooseProtons/Particles') makeLambda.CombinationCut = "(ADAMASS('Lambda0')<100*MeV)" makeLambda.MotherCut = " ( VFASPF(VCHI2) < 10 ) & (MIPCHI2DV(PRIMARY)> 16.) & (ADMASS('Lambda0')<90*MeV)" SelLambda = Selection( name+"SelLambda", Algorithm= makeLambda, RequiredSelections=[_pions, _protons] ) Tau2LambdaMu = CombineParticles("Comine"+name) Tau2LambdaMu.DecayDescriptors = [" [ tau+ -> Lambda0 mu+ ]cc" ] Tau2LambdaMu.DaughtersCuts = { "mu+" : " ( PT > 300 * MeV ) & ( TRCHI2DOF < 3. ) & ( BPVIPCHI2 () > 9 ) "\ "& ( PIDmu > -5 ) & ( (PIDmu - PIDK) > 0 ) & ( TRGHOSTPROB < 0.3 )" } Tau2LambdaMu.CombinationCut = "( (ADAMASS('tau+')<150*MeV) )" Tau2LambdaMu.MotherCut = """ ( VFASPF(VCHI2) < 16 ) & ( (BPVLTIME () * c_light) > 100 * micrometer ) & ( BPVIPCHI2() < 250 ) """ _stdLooseMuons = DataOnDemand(Location = "Phys/StdLooseMuons/Particles") # _stdLooseLambda1 = DataOnDemand(Location = "Phys/StdLooseLambdaLL/Particles") # _stdLooseLambda2 = DataOnDemand(Location = "Phys/StdLooseLambdaDD/Particles") return Selection (name, Algorithm = Tau2LambdaMu, RequiredSelections = [ _stdLooseMuons, SelLambda ])
def makeB2LpDDMVA( self, name, config ): """ Select B -> Lambda~0 p+ event by MVA selcetion """ from Configurables import CombineParticles as CP #Selection _B = CP("B2LpDDMVA") _daugPtSumCut = "(APT1>%s*MeV)" % config['B_DD_PTMin'] _maxDocaChi2Cut = "(ACUTDOCACHI2(%s,''))" % config['BDaug_DD_maxDocaChi2'] _daugMaxPtIPCut = "(AVAL_MAX(MIPDV(PRIMARY),PT)>%s)" % config['BDaug_MaxPT_IP'] #_B.DecayDescriptors = [ "B- -> p~- ( Lambda0 -> p+ pi- )", "B+ -> p+ ( Lambda~0 -> p~- pi+ )" ] _B.DecayDescriptors = [ "B- -> p~- Lambda0", "B+ -> p+ Lambda~0" ] _B.CombinationCut = "(ADAMASS('B-')<500*MeV)&"+_maxDocaChi2Cut+'&'+_daugPtSumCut+'&'+_daugMaxPtIPCut _B.MotherCut = "VALUE('LoKi::Hybrid::DictValue/MVAResponse')> %s" % config['MVAResponseDD'] #_B.MotherCut = 'ALL' # get the Lambda's to filter _stdLambdaDD = DataOnDemand(Location = "Phys/StdLooseLambdaDD/Particles") # make the filter _filterLambdaDD = FilterDesktop( Code = "ALL" ) #Configure tool from MVADictHelpers import addTMVAclassifierValue xmldir = "$TMVAWEIGHTSROOT/data/" #xmldir = "./" Vars = {"log(B_LoKi_VCHI2NDOF)" : "log(VFASPF(VCHI2))", "log(B_LoKi_BPVIPCHI2)" : "log(MIPCHI2DV(PRIMARY))", "B_LoKi_BPVDIRA" : "BPVDIRA", "log(B_LoKi_FDwrtPV)" : "log(VFASPF(VMINVDDV(PRIMARY)))", "log(B_LoKi_FDChi2)" : "log(BPVVDCHI2)", "log(B_LoKi_PT)" : "log(PT)", "log(pB_LoKi_PT)" : "log(CHILD(PT,1))", "log(pL_LoKi_PT)" : "log(CHILD( CHILD(PT,1) ,2))", "log(L_LoKi_P)" : "log(CHILD(P,2))", "log(L_LoKi_Mass)" : "log(ADMASS('Lambda0'))", "log(L_LoKi_VtxChi2)" : "log(CHILD(VFASPF(VCHI2),2))", "log(L_LoKi_FDChi2)" : "log(CHILD(BPVVDCHI2,2))", "log(pL_LoKi_TrkChi2)" : "log(CHILD(CHILD(TRCHI2DOF,2),2))", "log(pi_LoKi_TrkChi2)" : "log(CHILD(CHILD(TRCHI2DOF,1),2))", } addTMVAclassifierValue(Component = _B , XMLFile = xmldir+"B2pLambda_DD_BDT_v1r4.xml", Variables = Vars, ToolName = "MVAResponse", ) return Selection (name, Algorithm = _B, RequiredSelections = [_stdLambdaDD, StdLooseProtons ])
def combinetwobody(self, name, config, xplus, xminus, postfix=""): from Configurables import CombineParticles if (xplus == "mu") and (xminus == "mu"): d0comb_combcut = "(AMAXDOCA('')< %(doca)s *mm) & (DAMASS('D0')< %(DMassWinMuMuHigh)s *MeV) & (DAMASS('D0')> %(DMassWinMuMuLow)s *MeV) & (AMAXCHILD(PT)>%(XmaxPT)s *MeV) & (APT> %(D0MinPT)s)" elif (((xplus == "mu") and (xminus == "e")) or ((xplus == "e") and (xminus == "mu"))): d0comb_combcut = "(AMAXDOCA('')< %(doca)s *mm) & (ADAMASS('D0')< %(DMassWinEMu)s *MeV) & (AMAXCHILD(PT)>%(XmaxPT)s *MeV) & (APT> %(D0MinPT)s)" else: d0comb_combcut = "(AMAXDOCA('')< %(doca)s *mm) & (ADAMASS('D0')< %(DMassWin)s *MeV) & (AMAXCHILD(PT)>%(XmaxPT)s *MeV) & (APT> %(D0MinPT)s)" d0comb_childcut = "(PT> %(XminPT)s *MeV) & (P>%(XminP)s *MeV) & (TRCHI2DOF<%(XTrackChi2)s) & (MIPCHI2DV(PRIMARY)> %(XminIPChi2)s) & ( TRGHOSTPROB < %(ghostProbCut)s )" d0comb_d0cut = "(BPVDIRA> %(DDira)s) & (INGENERATION( (MIPCHI2DV(PRIMARY)>%(XmaxIPChi2)s),1 ) ) & (BPVVDCHI2> %(DMinFlightChi2)s) & (MIPCHI2DV(PRIMARY)< %(DMaxIPChi2)s) & (VFASPF(VCHI2/VDOF)< %(DVChi2)s)" xx_name = "D02" + xplus + xminus + postfix xx_comb = CombineParticles(config['prefix'] + xx_name) inputLoc = { "pi": "Phys/StdAllNoPIDsPions/Particles", "mu": "Phys/StdAllLooseMuons/Particles", "K": "Phys/StdAllLooseKaons/Particles", "e": "Phys/StdAllLooseElectrons/Particles" } req_sel = [] if xplus != xminus: decays = [ "D0 -> " + xplus + "+ " + xminus + "- ", "D0 -> " + xplus + "- " + xminus + "+ " ] xx_comb.DecayDescriptors = decays xx_comb.DaughtersCuts = { xplus + "+": d0comb_childcut % config, xminus + "-": d0comb_childcut % config } req_sel.append(DataOnDemand(Location=inputLoc[xplus])) req_sel.append(DataOnDemand(Location=inputLoc[xminus])) else: decay = "D0 -> " + xplus + "+ " + xminus + "- " xx_comb.DecayDescriptor = decay xx_comb.DaughtersCuts = {xplus + "+": d0comb_childcut % config} req_sel.append(DataOnDemand(Location=inputLoc[xplus])) xx_comb.MotherCut = d0comb_d0cut % config xx_comb.CombinationCut = d0comb_combcut % config _untag_sel = Selection(name + "seq_" + xx_name + "_selection", Algorithm=xx_comb, RequiredSelections=req_sel) return _untag_sel
def combineDstar(self, name, config): from Configurables import CombineParticles dstcomb_dstcut = "(abs(M-MAXTREE('D0'==ABSID,M)-145.42) < %(DstD0DMWin)s ) & (VFASPF(VCHI2/VDOF)< %(DVChi2)s)" dstcomb_combcut = "(ADAMASS('D*(2010)+')<%(DstMassWin)s * MeV)" dstcomb_picut = "(PT> %(PiMinPT)s * MeV) & ( MIPCHI2DV(PRIMARY)< %(PiMaxIPCHI2)s) & (TRCHI2DOF<%(XTrackChi2Pi)s) " dstcomb_d0cut = "PT>0" dstar = CombineParticles(config['prefix'] + "combine") #dstar.DecayDescriptors = ['[D*(2010)+ -> D0 pi+]cc'] dstar.DecayDescriptors = ['D*(2010)+ -> D0 pi+', 'D*(2010)- -> D0 pi-'] dstar.DaughtersCuts = { "pi+": dstcomb_picut % config, "D0": dstcomb_d0cut % config } dstar.CombinationCut = dstcomb_combcut % config dstar.MotherCut = dstcomb_dstcut % config return dstar
def makeB2LambdaMu(name): makeLambda = CombineParticles("Lambda0") makeLambda.DecayDescriptor = "[Lambda0 -> p+ pi-]cc" makeLambda.DaughtersCuts = { "pi-": "(TRCHI2DOF < 3.5 ) & (TRGHOSTPROB < 0.5) & (PT>300*MeV)", "p+": " ( PT > 300 * MeV ) & ( TRCHI2DOF < 5. ) & (PIDp>-3) & ( TRGHOSTPROB < 0.5 )" } _pions = DataOnDemand(Location='Phys/StdLoosePions/Particles') _protons = DataOnDemand(Location='Phys/StdLooseProtons/Particles') makeLambda.CombinationCut = "(ADAMASS('Lambda0')<110*MeV)" makeLambda.MotherCut = " ( VFASPF(VCHI2/VDOF) < 20 ) & (ADMASS('Lambda0')<100*MeV)" SelLambda = Selection(name + "SelLambda", Algorithm=makeLambda, RequiredSelections=[_pions, _protons]) B2LambdaMu = CombineParticles("Comine" + name) B2LambdaMu.DecayDescriptors = [ " [ B+ -> Lambda0 mu+ ]cc", "[B- -> Lambda0 mu- ]cc" ] B2LambdaMu.DaughtersCuts = { "mu+": " ( PT > 300 * MeV ) & ( TRCHI2DOF < 3.5) & ( PIDmu > -5 ) & ( (PIDmu - PIDK) > 0 ) & ( TRGHOSTPROB < 0.5 )" } B2LambdaMu.CombinationCut = "( (ADAMASS('B+')<550*MeV) )" B2LambdaMu.MotherCut = "(ADMASS('B+')<500*MeV) & (BPVDIRA>0.999) & (MIPCHI2DV(PRIMARY)<25) & (BPVLTCHI2()>9) " _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles") # _stdLooseLambda1 = DataOnDemand(Location = "Phys/StdLooseLambdaLL/Particles") # _stdLooseLambda2 = DataOnDemand(Location = "Phys/StdLooseLambdaDD/Particles") return Selection(name, Algorithm=B2LambdaMu, RequiredSelections=[_stdLooseMuons, SelLambda])
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 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 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])
"pi_px= CHILD (PX,2 ) " , "pi_py= CHILD (PY,2 ) " , "pi_pz= CHILD (PZ,2 ) " , "pi_E= CHILD (E,2) " , "pi_PT=CHILD (PT,2) " , "rhopi_px= rho_px + pi_px", "rhopi_py= rho_py + pi_py", "rhopi_pz= rho_pz + pi_pz", "rhopi_E= rho_E + pi_E", "IM_rhopi = sqrt(rhopi_E**2 - rhopi_px**2 - rhopi_py**2 - rhopi_pz**2)" ] # Create B candidate B2etap_pi = CombineParticles("B2etap_pi",Preambulo=preambulo) B2etap_pi.DecayDescriptors = ['[B+ -> eta_prime pi+]cc' ] B2etap_pi.MotherCut ="(IM_rhopi>4200) & (IM_rhopi<6700) & (pi_PT>1000)" B2etap_piSub = Selection("B2etap_piSub", Algorithm = B2etap_pi, RequiredSelections = [my_etap_Sel,pion_Sel]) B2etap_piSeq = SelectionSequence("B2etap_piSeq", TopSelection =B2etap_piSub) #pt = PrintDecayTree(Inputs = [B2rhopiSeq.outputLocation()]) #SubPID SubKToPi = SubstitutePID ( name = 'SubKToPi', Code = " DECTREE('[(B+ -> eta_prime pi+),(B- -> eta_prime pi-) ]') " , Substitutions = { 'B+ -> eta_prime ^pi+' : 'K+', 'B- -> eta_prime ^pi-' : 'K-',
__version__ = "CVS tag $Name: not supported by cvs2svn $, version $Revision: 1.0 $" # ============================================================================= __all__ = ('StdTightDetachedTau3pi', 'locations') # ============================================================================= from Gaudi.Configuration import * from Configurables import CombineParticles from CommonParticles.Utils import * ## ============================================================================ ## 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__:
__version__ = "CVS tag $Name: not supported by cvs2svn $, version $Revision: 1.0 $" # ============================================================================= __all__ = ('StdLooseDetachedTau3pi', 'locations') # ============================================================================= from Gaudi.Configuration import * from Configurables import CombineParticles from CommonParticles.Utils import * ## ============================================================================ ## create the algorithm - physical tau+ -> pi+ pi- pi+ StdLooseDetachedTau3pi = CombineParticles('StdLooseDetachedTau3pi') StdLooseDetachedTau3pi.Inputs = ["Phys/StdLoosePions/Particles"] #Build physical tau and tau+++ StdLooseDetachedTau3pi.DecayDescriptors = ["[tau+ -> pi+ pi- pi+]cc"] StdLooseDetachedTau3pi.DaughtersCuts = { "pi+": "(PT>250.*MeV) & (P>2000.*MeV) & (MIPCHI2DV(PRIMARY) > 16.0) & (TRCHI2DOF<3) & (TRGHOSTPROB<0.3) & (PROBNNpi > 0.55)", "pi-": "(PT>250.*MeV) & (P>2000.*MeV) & (MIPCHI2DV(PRIMARY) > 16.0) & (TRCHI2DOF<3) & (TRGHOSTPROB<0.3) & (PROBNNpi > 0.55)" } StdLooseDetachedTau3pi.CombinationCut = "(APT>800.*MeV) & ((AM>400.*MeV) & (AM<2100.*MeV)) & (AMAXDOCA('')<0.2*mm) & (ANUM(PT > 800*MeV) >= 1) " StdLooseDetachedTau3pi.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(StdLooseDetachedTau3pi) ## ============================================================================ if '__main__' == __name__:
def makeLambda0 (localname, additionalRequiredSelections=[], config=default_config): #Lambda combine particles _protonCommonCut = ('(PIDp > %(Protons4Lambda0_PIDp)s) & ' + '(PT > %(Protons4Lambda0_PT)s)' ) % config _pionCommonCut = ('(PIDK < %(Pions4Lambda0_PIDK)s) & ' + '(PT > %(Pions4Lambda0_PT)s) & ' + '(MIPCHI2DV(PRIMARY) > %(Pions4Lambda0_MINIPCHI2)s)') % config _lambdaCommonCut = ("((VFASPF(VCHI2/VDOF)<%(Lambda0_ENDVERTEXCHI2)s) &" + "(ADMASS('Lambda0') < %(Lambda0_MassWindowTight)s) & " + "(BPVVDZ/P > %(Lambda0_minFD)s))") % config _lambda = CombineParticles(localname+"lambda2ppi") _lambda.DecayDescriptors = ["[Lambda0 -> p+ pi-]cc", "[Lambda0 -> p+ pi+]cc"] _lambda.DaughtersCuts = { "p+" : _protonCommonCut + " & (MIPCHI2DV(PRIMARY) > %(LongProtons4Lambda0_MINIPCHI2)s)" % config, "pi-" : _pionCommonCut, "pi+" : _pionCommonCut } _lambda.CombinationCut = ("(ADAMASS('Lambda0') < %(Lambda0_MassWindowLarge)s) & "+ "(APT > %(Lambda0_APT)s)" ) % config _lambda.MotherCut = _lambdaCommonCut #Selection LooseLambdaSelection = Selection(localname+"SelLooseLambda", Algorithm = _lambda, RequiredSelections = additionalRequiredSelections + [ AutomaticData(_my_immutable_config['LongProtonsForLambda']), AutomaticData(_my_immutable_config['LongPionsForLambda'])]); #Lambda combine particles WITH DOWNSTREAM TRACKS _lambdaDD = CombineParticles(localname+"lambda2ppidown") _lambdaDD.DecayDescriptors = _lambda.DecayDescriptors; _lambdaDD.CombinationCut = ("(ADAMASS('Lambda0') < %(Lambda0_MassWindowLarge)s) & "+ "(APT > %(Lambda0_APT)s)" ) % config _lambdaDD.DaughtersCuts = { "p+" : ( _protonCommonCut + "& ( TRPCHI2 > %(Lambda0_DownProtonTrackPvalue)s )") % config, "pi-" : ( _pionCommonCut + "& ( TRPCHI2 > %(Lambda0_DownPionTrackPvalue)s)" ) % config, "pi+" : ( _pionCommonCut + "& ( TRPCHI2 > %(Lambda0_DownPionTrackPvalue)s)" ) % config } _lambdaDD.MotherCut = _lambdaCommonCut #Selection LooseLambdaDDSelection = Selection(localname+"SelLooseLambdaDown", Algorithm = _lambdaDD, RequiredSelections = additionalRequiredSelections + [ AutomaticData(_my_immutable_config['DownProtonsForLambda']), AutomaticData(_my_immutable_config['DownPionsForLambda'])]); #Lambda combine particles WITH UPSTREAM TRACKS _lambdaUL = CombineParticles(localname+"lambda2ppiup") _lambdaUL.DecayDescriptors = _lambda.DecayDescriptors; _lambdaUL.DaughtersCuts = { "p+" : _protonCommonCut, "pi-": _pionCommonCut, "pi+": _pionCommonCut } _lambdaUL.CombinationCut = ("(ADAMASS('Lambda0') < %(Lambda0_MassWindowLarge)s) & "+ "(APT > %(Lambda0_APT)s)" ) % config _lambdaUL.MotherCut = _lambdaCommonCut ##Selection LooseLambdaULSelection = Selection(localname+"SelLooseLambdaUp", Algorithm = _lambdaUL, RequiredSelections = additionalRequiredSelections + [ AutomaticData(_my_immutable_config['LongProtonsForLambda']), AutomaticData(_my_immutable_config['UpPionsForLambda'])]); return MergedSelection(localname+'AllLooseLambda', RequiredSelections = [LooseLambdaSelection, LooseLambdaDDSelection, LooseLambdaULSelection ] );
def execute(inputdata=None, simulation=True, decay_descriptor="J/psi(1S) -> mu- mu+"): # Configure all the unpacking, algorithms, tags and input files appConf = ApplicationMgr() appConf.ExtSvc += ['ToolSvc', 'DataOnDemandSvc', LoKiSvc()] dv = DaVinci() dv.DataType = "2012" lhcbApp = LHCbApp() lhcbApp.Simulation = simulation CondDB().Upgrade = False # don't really need tags for looking around #LHCbApp().DDDBtag = t['DDDB'] #LHCbApp().CondDBtag = t['CondDB'] 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) filter_jpsi = FilterDesktop("MyFilterJPsi", Code=code, Preambulo=["vrho2 = VX**2 + VY**2"], ReFitPVs=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 = DecayTreeTuple("Early2015") dtt.Inputs = [jpsi_seq.outputLocation()] # Overwriting default list of TupleTools # XXX need to add TisTosTool with sensible lines dtt.ToolList = [ "TupleToolKinematic", "TupleToolPid", "TupleToolMCBackgroundInfo", ] 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 loki_mum = dtt.muminus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuMinus") loki_mum.Variables = muon_vars dv.UserAlgorithms = [jpsi_seq.sequence(), dtt] dv.TupleFile = "DVNtuples.root" if isinstance(inputdata, list): IOHelper('ROOT').inputFiles(inputdata)
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]