Example #1
0
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])
Example #2
0
def makeTau2PhiMu(name):
    """
    Please contact Giulio Dujany if you think of prescaling this line!
    
    Arguments:
    name        : name of the Selection.
    """
    from Configurables import OfflineVertexFitter
    Tau2PhiMu = CombineParticles("Combine" + name)
    Tau2PhiMu.DecayDescriptor = " [ tau+ -> phi(1020) mu+ ]cc"

    makePhi = CombineParticles(name + "makePhi")
    makePhi.DecayDescriptor = "phi(1020) -> K+ K-"
    makePhi.DaughtersCuts = {
        "K+":
        "(ISLONG) & (TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & (PT>300*MeV) & (PIDK > 0) & ( BPVIPCHI2 () >  9 )",
        "K-":
        "(ISLONG) & (TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & (PT>300*MeV) & (PIDK > 0) & ( BPVIPCHI2 () >  9 )"
    }

    _kaons = DataOnDemand(Location='Phys/StdLooseKaons/Particles')

    makePhi.CombinationCut = "(ADAMASS('phi(1020)')<30*MeV)"
    makePhi.MotherCut = " ( VFASPF(VCHI2) < 25 ) & (MIPCHI2DV(PRIMARY)> 9)"

    SelPhi = Selection(name + "SelPhi",
                       Algorithm=makePhi,
                       RequiredSelections=[_kaons])

    Tau2PhiMu.DaughtersCuts = {
        "mu-":
        " ( PT > 300 * MeV ) & ( TRCHI2DOF < 3 ) & (TRGHOSTPROB<0.3) & ( BPVIPCHI2 () >  9 )"
    }
    Tau2PhiMu.CombinationCut = "(ADAMASS('tau-')<150*MeV)"

    Tau2PhiMu.MotherCut = "( VFASPF(VCHI2) < 25 ) &  ( (BPVLTIME () * c_light)   > 50 * micrometer ) &  ( BPVIPCHI2() < 100 ) "

    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")

    SelTau = Selection(name + "makeTau",
                       Algorithm=Tau2PhiMu,
                       RequiredSelections=[SelPhi, _stdLooseMuons])

    # Trigger selection
    from Configurables import TisTosParticleTagger
    _tisTosFilter = TisTosParticleTagger(name + "Triggered")
    _tisTosFilter.TisTosSpecs = {
        'L0Global%TIS': 0,
        'L0MuonDecision%TOS': 0,
        'Hlt1TrackAllL0Decision%TOS': 0,
        'Hlt1TrackMuonDecision%TOS': 0
    }

    SelTau_triggered = Selection(
        name,
        Algorithm=_tisTosFilter,
        RequiredSelections=[SelTau],
    )

    return SelTau_triggered, SelPhi
Example #3
0
    def buildPIDLineWithJpsi(self, configRowId):
        ## Resolves possible clone statements
        _config = self._resolveCloning(configRowId)

        ## Prepares the tag&probe cut if needed
        _combinationCutJpsi = _config['JpsiCombinationCut']
        _combinationCut = _config['CombinationCut']

        if 'TagAndProbeCut' in _config:
            _id = ["1", "2"]
            _combinationCutJpsi += ' & '
            _combinationCutJpsi += self._buildTagProbeCut(
                _config['TagAndProbeCut'], _id)

            ###print _combinationCut

        _algorithmJpsi = CombineParticles(self.name + configRowId +
                                          'JpsiAlgorithm')

        _algorithmJpsi.CombinationCut = _combinationCutJpsi
        _algorithmJpsi.DaughtersCuts = _config['DaughtersCuts']
        _algorithmJpsi.MotherCut = _config['JpsiMotherCut']
        _algorithmJpsi.DecayDescriptor = _config['DecayDescriptorJpsi']

        _requiredSelections = [
            DataOnDemand(x) for x in _config['InputTESJpsi']
        ]
        _selectionJpsi = Selection(self.name + configRowId + 'SelectionJpsi',
                                   Algorithm=_algorithmJpsi,
                                   RequiredSelections=_requiredSelections)

        _algorithm = CombineParticles(self.name + configRowId + 'Algorithm')

        _algorithm.CombinationCut = _combinationCut
        _algorithm.DaughtersCuts = _config['DaughtersCuts']
        _algorithm.MotherCut = _config['MotherCut']
        _algorithm.DecayDescriptor = _config['DecayDescriptor']

        _requiredSelections = [_selectionJpsi] + [
            DataOnDemand(x) for x in _config['InputTES']
        ]
        _selection = Selection(self.name + configRowId + 'Selection',
                               Algorithm=_algorithm,
                               RequiredSelections=_requiredSelections)

        _line = StrippingLine(self.name + configRowId + 'Line',
                              prescale=_config['Prescale'],
                              checkPV=_config['CheckPV'],
                              EnableFlavourTagging=False,
                              RequiredRawEvents=_config['RawEvent'],
                              MDSTFlag=_config['MDST.DST'],
                              HLT1=_config['HLT1'],
                              HLT2=_config['HLT2'],
                              algos=[_selection])

        return _line
Example #4
0
def makeBd(name) :
    """
    detached Bd-->JPsiK* selection. Selection is aligned to the Bs2MuMu
    selection.

    Please contact Johannes Albrecht if you think of prescaling this line!

    Arguments:
    name        : name of the Selection.
    """

    
    from Configurables import OfflineVertexFitter
   
    SelDJPsi = makeDetachedJPsi(name)


    ## make Kstar

    makeKstar = CombineParticles("makeKstar")

    makeKstar.DecayDescriptor =  "[K*(892)0 -> K+ pi-]cc"
    makeKstar.DaughtersCuts = {"K+": "(ISLONG) & (TRCHI2DOF < 3 ) "\
                               " & ( TRGHOSTPROB < 0.3 )"\
                               " & (MIPCHI2DV(PRIMARY)> 4.)& (PT>250*MeV)",
                               "pi-":"(ISLONG) & (TRCHI2DOF < 3 ) "\
                               " & ( TRGHOSTPROB < 0.3 )"\
                               "& (MIPCHI2DV(PRIMARY)> 4.)& (PT>250*MeV)"}
    makeKstar.CombinationCut =  "(ADAMASS('K*(892)0')<2000*MeV)"#huge, to allow to study JPsi K1 etc
    makeKstar.MotherCut = " (MIPCHI2DV(PRIMARY)> 25.)"

    _pions = DataOnDemand(Location='Phys/StdNoPIDsPions/Particles')
    _kaons = DataOnDemand(Location='Phys/StdNoPIDsKaons/Particles')

    SelKst = Selection( "SelKst",
                        Algorithm= makeKstar,
                        RequiredSelections=[_pions,_kaons] )
    

    ## make BtoJPsiKstar
    PreselBd2JPsiKstCommon = CombineParticles("PreselBd2JPsiKstCommon")
    PreselBd2JPsiKstCommon.DecayDescriptor = "[B0 -> J/psi(1S) K*(892)0]cc"
    PreselBd2JPsiKstCommon.addTool( OfflineVertexFitter )
    PreselBd2JPsiKstCommon.ParticleCombiners.update( { "" : "OfflineVertexFitter"} )
    PreselBd2JPsiKstCommon.OfflineVertexFitter.useResonanceVertex = False
    PreselBd2JPsiKstCommon.ReFitPVs = True
    PreselBd2JPsiKstCommon.DaughtersCuts = {}
    PreselBd2JPsiKstCommon.CombinationCut = "(ADAMASS('B0') < 500*MeV)"
    PreselBd2JPsiKstCommon.MotherCut = "(BPVIPCHI2()< 25) & (VFASPF(VCHI2)<75)"

    return Selection( "SelBd2JPsiKstar",
                      Algorithm = PreselBd2JPsiKstCommon,
                      RequiredSelections=[SelDJPsi,SelKst] )
Example #5
0
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 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.VertexFitters.update( { "" : "OfflineVertexFitter"} )
    Bs2MuMuNoMuID.OfflineVertexFitter.useResonanceVertex = False
    Bs2MuMuNoMuID.ReFitPVs = True
    Bs2MuMuNoMuID.DaughtersCuts = { "mu+" : "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 4 )" }
    Bs2MuMuNoMuID.CombinationCut = "(ADAMASS('B_s0')<600*MeV)"\
                                   "& (AMAXDOCA('')<0.3*mm)"

    Bs2MuMuNoMuID.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\
                              "& (ADMASS('B_s0') < 600*MeV )"\
                              "& (BPVDIRA > 0) "\
                              "& (BPVVDCHI2> 225)"\
                              "& (BPVIPCHI2()< 25) "
                             
    _stdNoPIDsMuons = DataOnDemand(Location = "Phys/StdNoPIDsMuons/Particles")

    return Selection (name,
                      Algorithm = Bs2MuMuNoMuID,
                      RequiredSelections = [ _stdNoPIDsMuons])
Example #7
0
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])
Example #8
0
def makeDefault(name):
    """
    very detached JPSi selection
    """
    from Configurables import OfflineVertexFitter
    Detached2mu = CombineParticles("Combine" + name)
    Detached2mu.DecayDescriptor = "J/psi(1S) -> mu+ mu-"
    Detached2mu.addTool(OfflineVertexFitter)
    Detached2mu.VertexFitters.update({"": "OfflineVertexFitter"})
    Detached2mu.OfflineVertexFitter.useResonanceVertex = False
    Detached2mu.ReFitPVs = True
    Detached2mu.DaughtersCuts = { "mu+" : "(TRCHI2DOF < 4 ) "\
                                  " & (MIPCHI2DV(PRIMARY)> 100)"\
                                  "& (PT > 0.7) "}

    Detached2mu.CombinationCut = " (AMAXDOCA('')<0.1*mm)"
    #"(ADAMASS('B_s0')<1000*MeV) "\
    Detached2mu.MotherCut = "(VFASPF(VCHI2/VDOF)<15) "\
                            "& (M>1500)"\
                            "& (BPVDIRA > 0) "\
                            "& (BPVVDCHI2>625)"\
                            "& (BPVVD>50)"

    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")

    return Selection(name,
                     Algorithm=Detached2mu,
                     RequiredSelections=[_stdLooseMuons])
def makeBs2PhiKst(name, Phisel, Kstsel, BMassWin, BVCHI2, BDOCA):
    """
       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)" % 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.OfflineVertexFitter.useResonanceVertex = False

    return Selection(name, Algorithm=_Bs, RequiredSelections=[Phisel, Kstsel])
def makeBd2JPsiKst(name, JPsisel, Kstsel, BMassWin, BVCHI2, BDOCA, BIPCHI2):
    """
       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)" % 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])
Example #11
0
    def makeJetGroup(self, name, config):

        JetGroup = CombineParticles("Combine" + name)
        JetGroup.DecayDescriptor = "H_10 -> CELLjet CELLjet"

        JetGroup.ParticleCombiners = {"": "LoKi::VertexFitter"}
        JetGroup.addTool(LoKi__VertexFitter, name="LoKi::VertexFitter")
        vfitter = getattr(JetGroup, "LoKi::VertexFitter")
        vfitter.Jets = ""

        JetGroup.DaughtersCuts = {
            "CELLjet": " (PT > %(min_jet_pT)s ) " % config
        }
        JetGroup.CombinationCut = "AALLSAMEBPV "
        JetGroup.MotherCut = "ALL"

        ## TOS_HLT2 on-demand
        hlt = config['TOS_HLT2']
        if hlt:
            JetGroup.MotherCut += '& (TOS("%s", "Hlt2TriggerTisTos"))' % hlt

        requiredSelections = [DataOnDemand(Location="Phys/StdJets/Particles")]

        return Selection("Sel" + name,
                         Algorithm=JetGroup,
                         RequiredSelections=requiredSelections)
Example #12
0
def makeDs2PhiPi(name, config):
    """
    Please contact Johannes Albrecht if you think of prescaling this line!
    
    Arguments:
    name        : name of the Selection.
    """

    Ds2PhiPi = CombineParticles("Comine" + name)
    Ds2PhiPi.DecayDescriptor = " [ D_s+  -> pi+  mu+ mu- ]cc "
    Ds2PhiPi.DaughtersCuts = {
        "pi+":
        " ( PT > 300 * MeV ) & ( TRGHOSTPROB < %(TrackGhostProb)s ) & ( TRCHI2DOF < 3  ) & ( BPVIPCHI2 () >  9 ) "
        % config,
        "mu+":
        " ( PT > 300 * MeV ) & ( TRGHOSTPROB < %(TrackGhostProb)s ) & ( TRCHI2DOF < 3  ) & ( BPVIPCHI2 () >  9 ) "
        % config
    }

    Ds2PhiPi.CombinationCut = "(ADAMASS('D_s+')<250*MeV) & in_range ( 970 * MeV , AM23 , 1070 * MeV )"

    Ds2PhiPi.MotherCut = """
            ( VFASPF(VCHI2) < 15 ) &
            ( (BPVLTIME () * c_light)   >100 * micrometer ) &
            ( BPVIPCHI2() < 225 )
            """

    _stdLoosePions = DataOnDemand(Location="Phys/StdLoosePions/Particles")
    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")

    return Selection(name,
                     Algorithm=Ds2PhiPi,
                     RequiredSelections=[_stdLooseMuons, _stdLoosePions])
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])
Example #14
0
def makeBs2InflatonPhi(name, SelInflatonLong):
    """
    detached Bs -> Inflaton Phi selection. 

    Arguments:
    name        : name of the Selection.
    """

    from Configurables import OfflineVertexFitter

    _phi = DataOnDemand(Location='Phys/StdLooseDetachedPhi2KK/Particles')

    Bs2InflatonPhi = CombineParticles("Combine" + name)
    Bs2InflatonPhi.DecayDescriptor = "B_s0 -> KS0 phi(1020)"
    Bs2InflatonPhi.addTool(OfflineVertexFitter)
    #Bs2InflatonPhi.VertexFitters.update( { "" : "OfflineVertexFitter"} )
    Bs2InflatonPhi.ParticleCombiners.update({"": "OfflineVertexFitter"})
    Bs2InflatonPhi.OfflineVertexFitter.useResonanceVertex = False
    Bs2InflatonPhi.ReFitPVs = True
    Bs2InflatonPhi.DaughtersCuts = {"phi(1020)": "MIPCHI2DV(PRIMARY)> 25."}
    Bs2InflatonPhi.CombinationCut = "(ADAMASS('B_s0') < 500*MeV)"
    Bs2InflatonPhi.MotherCut = "(BPVIPCHI2()< 50)& (VFASPF(VCHI2)<100)& (D2DVVDDOT(1) > 0.3*mm)"

    return Selection("Sel" + name,
                     Algorithm=Bs2InflatonPhi,
                     RequiredSelections=[SelInflatonLong, _phi])
Example #15
0
def makeBd2InflatonKst(name, SelInflatonLong):
    """
    detached Bd -> Inflaton K* selection.

    Arguments:
    name        : name of the Selection.
    """

    from Configurables import OfflineVertexFitter

    _kstar = DataOnDemand(Location='Phys/StdLooseDetachedKst2Kpi/Particles')

    Bd2InflatonKst = CombineParticles("Combine" + name)
    Bd2InflatonKst.DecayDescriptor = "[B0 -> KS0 K*(892)0]cc"
    Bd2InflatonKst.addTool(OfflineVertexFitter)
    #Bd2InflatonKst.VertexFitters.update( { "" : "OfflineVertexFitter"} )
    Bd2InflatonKst.ParticleCombiners.update({"": "OfflineVertexFitter"})
    Bd2InflatonKst.OfflineVertexFitter.useResonanceVertex = False
    Bd2InflatonKst.ReFitPVs = True
    Bd2InflatonKst.DaughtersCuts = {"K*(892)0": "MIPCHI2DV(PRIMARY)> 25."}
    Bd2InflatonKst.CombinationCut = "(ADAMASS('B0') < 500*MeV)"
    Bd2InflatonKst.MotherCut = "(BPVIPCHI2()< 50) & (VFASPF(VCHI2)<100)& (D2DVVDDOT(1) > 0.3*mm)"

    return Selection("Sel" + name,
                     Algorithm=Bd2InflatonKst,
                     RequiredSelections=[SelInflatonLong, _kstar])
Example #16
0
def makeDownstream(name):
    """
    very very detached dimuon selection with downstream tracks
    """
    from Configurables import OfflineVertexFitter
    Detached2mu = CombineParticles("Combine" + name)
    Detached2mu.DecayDescriptor = "KS0 -> mu+ mu-"
    Detached2mu.addTool(OfflineVertexFitter)
    #Detached2mu.VertexFitters.update( { "" : "OfflineVertexFitter"} )
    Detached2mu.ParticleCombiners.update({"": "OfflineVertexFitter"})
    Detached2mu.OfflineVertexFitter.useResonanceVertex = False
    Detached2mu.ReFitPVs = True
    Detached2mu.DaughtersCuts = { "mu+" : "(TRCHI2DOF < 4 ) "\
                                  " & (MIPCHI2DV(PRIMARY)> 150)"\
                                  "& (PT > 125*MeV) "\
                                  "& (PIDmu > -4)"}

    Detached2mu.CombinationCut = " (AMAXDOCA('')<0.2*mm)"
    #"(ADAMASS('B_s0')<1000*MeV) "\
    Detached2mu.MotherCut = "(VFASPF(VCHI2/VDOF)<12) "\
                            "& (M>250)"\
                            "& (BPVDIRA > 0) "\
                            "& (BPVVDCHI2>1000)"\
                            "& (BPVVD>200)"

    _stdLooseDownMuons = DataOnDemand(
        Location="Phys/StdLooseDownMuons/Particles")

    return Selection(name,
                     Algorithm=Detached2mu,
                     RequiredSelections=[_stdLooseDownMuons])
Example #17
0
def makeBu2InflatonK(name, SelInflatonLong):
    """
    detached Bu -> Inflaton K selection.

    Arguments:
    name        : name of the Selection.
    """

    from Configurables import OfflineVertexFitter

    Bu2InflatonK = CombineParticles("Combine" + name)
    Bu2InflatonK.DecayDescriptor = " [B+ -> KS0 K+]cc "
    Bu2InflatonK.addTool(OfflineVertexFitter)
    #Bu2InflatonK.VertexFitters.update( { "" : "OfflineVertexFitter"} )
    Bu2InflatonK.ParticleCombiners.update({"": "OfflineVertexFitter"})
    Bu2InflatonK.OfflineVertexFitter.useResonanceVertex = False
    Bu2InflatonK.ReFitPVs = True
    Bu2InflatonK.DaughtersCuts = {
        "K+":
        "(ISLONG) & (TRCHI2DOF < 3 ) &(MIPCHI2DV(PRIMARY)>25)& (PT>250*MeV) "
    }
    Bu2InflatonK.CombinationCut = "(ADAMASS('B+') < 500*MeV)"
    Bu2InflatonK.MotherCut = "(BPVIPCHI2()< 50)& (VFASPF(VCHI2)<100)& (D2DVVDDOT(1) > 0.3*mm)"

    _kaons = DataOnDemand(Location='Phys/StdLooseKaons/Particles')

    return Selection("Sel" + name,
                     Algorithm=Bu2InflatonK,
                     RequiredSelections=[SelInflatonLong, _kaons])
def makeDefault(name, inputSel):
    """
    B --> 4 mu selection
    should become     inclusive bb-->4 mu selection  ??
    """
    from Configurables import OfflineVertexFitter
    Detached4mu = CombineParticles("Combine" + name)
    Detached4mu.DecayDescriptor = "B_s0 -> mu+ mu- mu+ mu-"
    # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar:
    Detached4mu.addTool(OfflineVertexFitter)
    Detached4mu.VertexFitters.update({"": "OfflineVertexFitter"})
    Detached4mu.OfflineVertexFitter.useResonanceVertex = False
    Detached4mu.ReFitPVs = True
    Detached4mu.DaughtersCuts = { "mu+" : "(TRCHI2DOF < 2.5 ) "\
                                  " & (MIPCHI2DV(PRIMARY)> 9.)"}

    Detached4mu.CombinationCut = "(ADAMASS('B_s0')<1000*MeV) "\
                                   "& (AMAXDOCA('')<0.3*mm)"
    Detached4mu.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\
                              "& (BPVDIRA > 0) "\
                              "& (BPVVDCHI2>100)"\
                              " & (M>4366.3) & (M<6366.3)"\
                              "& (BPVIPCHI2()< 25) "

    return Selection(name, Algorithm=Detached4mu, RequiredSelections=inputSel)
Example #19
0
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])
Example #20
0
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.DecayDescriptor = "B_s0 -> e+ e-"
    # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar:
    Bs2ee.addTool(OfflineVertexFitter())
    Bs2ee.VertexFitters.update({"": "OfflineVertexFitter"})
    Bs2ee.OfflineVertexFitter.useResonanceVertex = False
    #Bs2ee.ReFitPVs = True
    Bs2ee.DaughtersCuts = {"e+": "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 4 )"}

    Bs2ee.CombinationCut = "(ADAMASS('B_s0')<600*MeV)"\
                            "& (AMAXDOCA('')<0.3*mm)"

    Bs2ee.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\
                              "& (ADMASS('B_s0') < 600*MeV )"\
                              "& (BPVDIRA > 0) "\
                              "& (BPVVDCHI2> 225)"\
                              "& (BPVIPCHI2()< 25) "

    _stdLooseElectrons = DataOnDemand(
        Location="Phys/StdLooseElectrons/Particles")

    return Selection(name,
                     Algorithm=Bs2ee,
                     RequiredSelections=[_stdLooseElectrons])
Example #21
0
def makeTau25Mu(name, config):
    """
    Please contact Johannes Albrecht if you think of prescaling this line!
    
    Arguments:
    name        : name of the Selection.
    """

    Tau2MuMuMuMuMu = CombineParticles("Comine" + name)
    Tau2MuMuMuMuMu.DecayDescriptor = " [ tau+ -> mu+ mu+ mu+ mu- mu-]cc"
    Tau2MuMuMuMuMu.DaughtersCuts = {
        "mu+":
        " ( PT > 300 * MeV ) & ( TRGHOSTPROB < %(TrackGhostProb)s ) & ( TRCHI2DOF < 3  ) & ( BPVIPCHI2 () >  9 ) "
        % config
    }
    Tau2MuMuMuMuMu.CombinationCut = "(ADAMASS('tau+')<400*MeV)"

    Tau2MuMuMuMuMu.MotherCut = """
            ( VFASPF(VCHI2) < 30 ) &
            ( (BPVLTIME () * c_light)   > 100 * micrometer ) &
            ( BPVIPCHI2() < 225 )
            """

    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")

    return Selection(name,
                     Algorithm=Tau2MuMuMuMuMu,
                     RequiredSelections=[_stdLooseMuons])
Example #22
0
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) & " +
                  " (PT > %(Protons4Lambdac_PT)s) & " +
                  " (P > %(Protons4Lambdac_minP)s) & " +
                  " (PIDp - PIDK > %(Protons4Lambdac_PIDp-PIDK)s)" ) % config,
        "K-"	:	("(TRPCHI2 > %(Kaon4Lambdac_TRPCHI2)s) &"+
                  "(PIDK > %(Kaon4Lambdac_PIDK)s) & "+
                  "(P > %(Kaon4Lambdac_minP)s) & "+
                  "(PT > %(Kaon4Lambdac_PT)s)" ) % config,
        "pi+"	:	("(MIPCHI2DV(PRIMARY)> %(Pions4Lambdac_MINIPCHI2)s) &"+
                  " (TRPCHI2 > %(Pion4Lambdac_TRPCHI2)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 makeBs2mmWide(name):
    """
    Bs2mumu selection object (tighter selection a la roadmap)
    with muon Id and wide mass window (1.2GeV)
    starts from Phys/StdLooseMuons

    Please contact Johannes Albrecht if you think of prescaling this line!
    
    Arguments:
    name        : name of the Selection.
    """
    from Configurables import OfflineVertexFitter
    Bs2MuMuWideMass = CombineParticles("Combine" + name)
    Bs2MuMuWideMass.DecayDescriptor = "B_s0 -> mu+ mu-"
    Bs2MuMuWideMass.addTool(OfflineVertexFitter())
    Bs2MuMuWideMass.VertexFitters.update({"": "OfflineVertexFitter"})
    Bs2MuMuWideMass.OfflineVertexFitter.useResonanceVertex = False
    Bs2MuMuWideMass.ReFitPVs = True
    Bs2MuMuWideMass.DaughtersCuts = {
        "mu+": "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 4 )"
    }
    Bs2MuMuWideMass.CombinationCut = "(ADAMASS('B_s0')<1200*MeV)"\
                                     "& (AMAXDOCA('')<0.3*mm)"

    Bs2MuMuWideMass.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\
                                "& (ADMASS('B_s0') < 1200*MeV )"\
                                "& (BPVDIRA > 0) "\
                                "& (BPVVDCHI2> 225)"\
                                "& (BPVIPCHI2()< 25) "

    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")

    return Selection(name,
                     Algorithm=Bs2MuMuWideMass,
                     RequiredSelections=[_stdLooseMuons])
Example #24
0
def makeB2pMu(name):
    """
    Please contact Johannes Albrecht if you think of prescaling this line!
    
    Arguments:
    name        : name of the Selection.
    """

    from Configurables import OfflineVertexFitter
    Bs2pMu = CombineParticles("Combine" + name)
    Bs2pMu.DecayDescriptor = "[B_s0 -> p+ mu-]cc"
    #Bs2pMu.addTool( OfflineVertexFitter )
    #Bs2pMu.VertexFitters.update( { "" : "OfflineVertexFitter"} )
    #Bs2pMu.OfflineVertexFitter.useResonanceVertex = False
    #Bs2pMu.ReFitPVs = True
    Bs2pMu.DaughtersCuts = {
        "mu+": "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 4 )",
        "p+": "(MIPCHI2DV(PRIMARY)> 25.)&(TRCHI2DOF < 4 )"
    }

    Bs2pMu.CombinationCut = "(ADAMASS('B_s0')<600*MeV)"\
                            "& (AMAXDOCA('')<0.3*mm)"

    Bs2pMu.MotherCut = "(VFASPF(VCHI2/VDOF)<9) "\
                       "& (ADMASS('B_s0') < 600*MeV )"\
                       "& (BPVDIRA > 0) "\
                       "& (BPVVDCHI2> 225)"\
                       "& (BPVIPCHI2()< 25) "

    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")
    _stdLooseProtons = DataOnDemand(Location="Phys/StdLooseProtons/Particles")

    return Selection(name,
                     Algorithm=Bs2pMu,
                     RequiredSelections=[_stdLooseMuons, _stdLooseProtons])
def makeDetachedJPsi(name):
    """
    detached JPsi selection for B--> JPsi X calibration and
    normalization channels. Selection is aligned to the Bs2MuMu
    selection.

    Please contact Johannes Albrecht if you think of prescaling this line!

    Arguments:
    name        : name of the Selection.
    """
    from Configurables import OfflineVertexFitter
    DetachedJPsi = CombineParticles("Combine" + name)
    DetachedJPsi.DecayDescriptor = "J/psi(1S) -> mu+ mu-"
    # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar:
    DetachedJPsi.addTool(OfflineVertexFitter())
    DetachedJPsi.VertexFitters.update({"": "OfflineVertexFitter"})
    DetachedJPsi.OfflineVertexFitter.useResonanceVertex = False
    DetachedJPsi.ReFitPVs = True
    DetachedJPsi.DaughtersCuts = { "mu+" : "(TRCHI2DOF < 4 ) "\
                                    "& (MIPCHI2DV(PRIMARY)> 25.)"}

    DetachedJPsi.CombinationCut = "(ADAMASS('J/psi(1S)')<100*MeV) "\
                                   "& (AMAXDOCA('')<0.3*mm)"

    DetachedJPsi.MotherCut = "(VFASPF(VCHI2)<9) "\
                             "& (ADMASS('J/psi(1S)') < 100*MeV )"\
                             "& (BPVDIRA > 0) "\
                             "& (BPVVDCHI2>169)"

    _stdLooseMuons = DataOnDemand(Location="Phys/StdLooseMuons/Particles")

    return Selection(name,
                     Algorithm=DetachedJPsi,
                     RequiredSelections=[_stdLooseMuons])
Example #26
0
def makeDetachedJPsi(name):
    """
    detached JPsi selection for B--> JPsi X calibration and
    normalization channels. 

    Please contact Flavio Archilli if you think of prescaling this line!

    Arguments:
    name        : name of the Selection.
    """
    from Configurables import OfflineVertexFitter
    DetachedJPsi = CombineParticles("Combine" + name)
    DetachedJPsi.DecayDescriptor = "J/psi(1S) -> e+ e-"
    DetachedJPsi.addTool(OfflineVertexFitter)
    DetachedJPsi.ParticleCombiners.update({"": "OfflineVertexFitter"})
    DetachedJPsi.OfflineVertexFitter.useResonanceVertex = False
    DetachedJPsi.ReFitPVs = True
    DetachedJPsi.DaughtersCuts = { "e+" : "(TRCHI2DOF < 4 ) "\
                                   "& (MIPCHI2DV(PRIMARY)> 25.) "\
                                   "& (PIDe > 2) "}

    DetachedJPsi.CombinationCut = "(ADAMASS('J/psi(1S)')<1000*MeV) "\
                                   "& (AMAXDOCA('')<0.3*mm)"

    DetachedJPsi.MotherCut = "(VFASPF(VCHI2)<9) "\
                             "& (ADMASS('J/psi(1S)') < 1000*MeV )"\
                             "& (BPVDIRA > 0) "\
                             "& (BPVVDCHI2>169)"

    _stdLooseElectrons = DataOnDemand(
        Location="Phys/StdLooseElectrons/Particles")

    return Selection(name,
                     Algorithm=DetachedJPsi,
                     RequiredSelections=[_stdLooseElectrons])
def makeBs2KstKst(name, Kstsel, BMassWin, BVCHI2, BDOCA, BIPCHI2):
    """
       Create and return a Bs -> Kstar (Kpi) anti-Kstar (Kpi) Selection object.
       Arguments:
       name        : name of the Selection.
       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) & (MIPCHI2DV(PRIMARY)< %(BIPCHI2)s)" % locals(
    )
    _combinationCut = "(ADAMASS('B_s0') < %(BMassWin)s *MeV) & (AMAXDOCA('')< %(BDOCA)s *mm)" % locals(
    )

    _Bs = CombineParticles('_' + name)
    _Bs.DecayDescriptor = "B_s0 -> K*(892)0 K*(892)~0"
    _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=[Kstsel])
Example #28
0
def makeNoMuID(name, mupt=0, kspt=0):
    """
    default K0s2mumu selection object
    starts from Phys/StdNoPIDsMuons

    Please contact Diego Martinez Santos if you think of prescaling this line!
    
    Arguments:
    name        : name of the Selection.
    """
    from Configurables import OfflineVertexFitter
    K0s2MuMuNoMuID = CombineParticles("Comine" + name)
    K0s2MuMuNoMuID.DecayDescriptor = "KS0 -> pi+ pi-"
    # Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Kstar:
    K0s2MuMuNoMuID.addTool(OfflineVertexFitter)
    K0s2MuMuNoMuID.ParticleCombiners.update({"": "OfflineVertexFitter"})
    K0s2MuMuNoMuID.OfflineVertexFitter.useResonanceVertex = False
    K0s2MuMuNoMuID.ReFitPVs = True
    K0s2MuMuNoMuID.DaughtersCuts = {
        "pi+":
        "(MIPCHI2DV(PRIMARY)> 100.)&(TRCHI2DOF < 5 ) & (PT >" + str(mupt) +
        " * MeV )"
    }
    K0s2MuMuNoMuID.CombinationCut = "(ADAMASS('KS0')<100*MeV)"\
                                   "& (AMAXDOCA('')<0.3*mm)"

    K0s2MuMuNoMuID.MotherCut = "((BPVDIRA>0) & ((BPVVDSIGN*M/P) > 0.1*89.53*2.9979e-01) & (MIPDV(PRIMARY)<0.4*mm) & (M>400) & (M<600) & (PT > " + str(
        kspt) + " * MeV))"

    _stdNoPIDsPions = DataOnDemand(Location="Phys/StdNoPIDsPions/Particles")

    return Selection(name,
                     Algorithm=K0s2MuMuNoMuID,
                     RequiredSelections=[_stdNoPIDsPions])
Example #29
0
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.ParticleCombiners.update({"": "OfflineVertexFitter"})

    D2MuMuMuMu.DaughtersCuts = { "mu+" : "(TRCHI2DOF < 3.0 ) "\
                                  " & (MIPCHI2DV(PRIMARY)> 4.)"\
                                 " & (TRGHOSTPROB<0.3) "\
                                  " & (P> 3000.*MeV)"}

    D2MuMuMuMu.CombinationCut =  "(ADAMASS('D0')<300*MeV) "\
                                 "& (AMAXDOCA('')<0.2*mm) "


    D2MuMuMuMu.MotherCut = "(VFASPF(VCHI2/VDOF)<12.) "\
         "& (BPVVDZ > 0.) " \
         "& (MIPCHI2DV(PRIMARY) < 25. )"

    return Selection(name, Algorithm=D2MuMuMuMu, RequiredSelections=inputSel)
def makeBu(name):
    """
    detached Bu-->JPsiK selection. Selection is aligned to the Bs2MuMu
    selection.

    Please contact Johannes Albrecht if you think of prescaling this line!

    Arguments:
    name        : name of the Selection.
    """

    from Configurables import OfflineVertexFitter

    SelDJPsi = makeDetachedJPsi(name)

    PreselBu2JPsiKCommon = CombineParticles("PreselBu2JPsiKCommon")
    PreselBu2JPsiKCommon.DecayDescriptor = " [B+ -> J/psi(1S) K+]cc "
    PreselBu2JPsiKCommon.addTool(OfflineVertexFitter())
    PreselBu2JPsiKCommon.VertexFitters.update({"": "OfflineVertexFitter"})
    PreselBu2JPsiKCommon.OfflineVertexFitter.useResonanceVertex = False
    PreselBu2JPsiKCommon.ReFitPVs = True
    PreselBu2JPsiKCommon.DaughtersCuts = {
        "K+":
        "(ISLONG) & (TRCHI2DOF < 5 ) &(MIPCHI2DV(PRIMARY)>25)& (PT>250*MeV) "
    }
    PreselBu2JPsiKCommon.CombinationCut = "(ADAMASS('B+') < 500*MeV)"
    PreselBu2JPsiKCommon.MotherCut = "(BPVIPCHI2()< 25)& (VFASPF(VCHI2)<45) "

    _kaons = DataOnDemand(Location='Phys/StdNoPIDsKaons/Particles')

    return Selection("SelBu2JPsiK",
                     Algorithm=PreselBu2JPsiKCommon,
                     RequiredSelections=[SelDJPsi, _kaons])
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
Example #32
0
                  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)'}
# Ds.CombinationCut =  "(ADAMASS('D_s+')<180*MeV)"
Example #33
0
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")
Example #34
0
from Configurables import CombineParticles, DecayTreeTuple
from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

# Selection for other loop
_otherKaons = DataOnDemand(Location='/Event/NewEvent/Phys/OtherAllKaons/Particles')
_otherPions = DataOnDemand(Location='/Event/NewEvent/Phys/OtherAllPions/Particles')
_otherd2kkpi = CombineParticles("otherd2kkpi", InputPrimaryVertices="/Event/NewEvent/Rec/Vertex/Primary")
_otherd2kkpi.DecayDescriptor = "D_s- -> K- K+ pi-"
_otherd2kkpi.MotherCut = "(mcMatch('D_s-  ==> K- K+ pi-', ['/Event/NewEvent/Relations/NewEvent/Rec/ProtoP/Charged'], '/Event/NewEvent/MC/Particles'))"
_otherd2kkpi.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]

selD2KKPiOther = Selection("DsMinusCandidates",
                           Algorithm = _otherd2kkpi,
                           RequiredSelections=[_otherKaons, _otherPions],
                           OutputBranch="NewEvent/Phys")

#selD2KKPiOther.OutputLevel = 1

seqD2KKPiOther = SelectionSequence('MCFilterOther', TopSelection = selD2KKPiOther)

othertuple = DecayTreeTuple("Ds2KKPiTuple", RootInTES='/Event/NewEvent')
othertuple.Decay = "[D_s+ -> K- K+ pi+]CC"
#othertuple.Inputs = [seqD2KKPi.outputLocation()]
othertuple.Inputs = ['Phys/SelD2KKPiOther/Particles']
othertuple.ToolList = []
from Configurables import MCMatchObjP2MCRelator

othertuple.addTupleTool('TupleToolKinematic')
Example #35
0
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")
recoTau.DecayDescriptor = '[tau- -> phi(1020) mu-]cc'
Example #36
0
#Truth matched commonparticles: 
_mainkaons = DataOnDemand(Location='Phys/StdMCKaons/Particles')
_mainpions = DataOnDemand(Location='Phys/StdMCPions/Particles')

#
# MC matching
#

matchD2KKPi = "(mcMatch('D_s+  ==> K- K+ pi+'))"
#matchKaons = "(mcMatch('[K+]cc'))"
#matchPions = "(mcMatch('[pi+]cc'))"

_maind2kkpi = CombineParticles("d2kkpiMain")
_maind2kkpi.DecayDescriptor = "D_s+ -> K+ K- pi+"
#_d2kkpi.DaughtersCuts = { "pi+" : matchPions, "K+" : matchKaons}
_maind2kkpi.MotherCut = matchD2KKPi
_maind2kkpi.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]

selD2KKPiMain = Selection( "DsPlusCandidates",
                            Algorithm = _maind2kkpi,
                            RequiredSelections=[_mainkaons, _mainpions])  

seqD2KKPiMain = SelectionSequence('MCFilterMain',TopSelection = selD2KKPiMain)

maintuple = DecayTreeTuple("out")
maintuple.Decay = "[D_s+ -> K- K+ pi+]CC"
maintuple.Inputs = [seqD2KKPiMain.outputLocation()]
mcTruth = maintuple.addTupleTool("TupleToolMCTruth")
maintuple.addTupleTool("TupleToolPropertime")
Example #37
0
                                 , Particle = "kaon"
                                 , Input = "MergedEvent/Rec/ProtoP/Charged"
                                 , Output = "Phys/MergedKaons/Particles"
                                 , WriteP2PVRelations = False
                                 , InputPrimaryVertices = "Rec/Vertex/Primary"
                                 )

createEvent.Members.append(mergedPions)
createEvent.Members.append(mergedKaons)

_kaons = DataOnDemand(Location='/Event/Phys/MergedPions/Particles')
_pions = DataOnDemand(Location='/Event/Phys/MergedKaons/Particles')

combineA = CombineParticles('CombineA')
combineA.DecayDescriptor = "D_s+ -> K+ K- pi+"
combineA.MotherCut = "(mcMatch('D_s+  ==> K+ K- pi+', ['/Event/MergedEvent/Relations/MergedEvent/Rec/ProtoP/Charged'], '/Event/MergedEvent/MC/Particles'))"
combineA.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]

combineB = CombineParticles('CombineB')
combineB.DecayDescriptor = "D_s- -> K- K+ pi-"
combineB.MotherCut = "(mcMatch('D_s-  ==> K- K+ pi-', ['/Event/MergedEvent/Relations/MergedEvent/Rec/ProtoP/Charged'], '/Event/MergedEvent/MC/Particles'))"
combineB.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]
#combineB.OutputLevel = 1

combineAB = CombineParticles('CombineAB')
combineAB.DecayDescriptor = "B_s0 -> D_s- D_s+"
combineAB.MotherCut = "ALL"
Example #38
0
                  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)"
Ds.MotherCut += "&(ADMASS('D_s+')<150*MeV)" %config
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]
Example #40
0
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)"
bs2jpsiphi.CombinationCut = "ADAMASS('B_s0')<2*GeV"
pion_Seq = SelectionSequence("pion_Seq", TopSelection = pion_Sel)




from StandardParticles import StdLooseAllPhotons


PhotonFilter = FilterDesktop("PhotonFilter", Code="(PT > 300.*MeV) & (CL > 0.1)")
PhotonSel    = Selection('PhotonSel', Algorithm=PhotonFilter, RequiredSelections=[StdLooseAllPhotons])



my_etap = CombineParticles("my_etap")
my_etap.DecayDescriptor = "eta_prime -> rho(770)0 gamma"
my_etap.MotherCut = "(ADMASS('eta_prime') < 100.*MeV)" # & (PT > 1500.*MeV) & (P > 4000.*MeV) " #& (VFASPF(VCHI2/VDOF) < 9.)" #   "ALL" #  
my_etap_Sel = Selection("my_etap_Sel", 
                            Algorithm = my_etap, 
                          # RequiredSelections = [rho_Sel,StdLooseAllPhotons]) 
                            RequiredSelections = [rho_Sel,PhotonSel])
#my_etap_Seq = SelectionSequence("my_etap_Seq", TopSelection = my_etap_Sel)



preambulo=[
"rho_px= CHILD (PX,1,1 ) " ,
"rho_py=CHILD  (PY,1,1 )" ,
"rho_pz=CHILD (PZ,1,1 ) ",
"rho_E= CHILD (E,1,1 ) " ,
"pi_px= CHILD (PX,2 ) " ,
"pi_py= CHILD (PY,2 ) " ,
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