def makeKst2Kpi(name, KaonPT, KaonIPCHI2, PionPT, PionIPCHI2, KstarPT,
                KaonPIDK, KstarVCHI2, KstarMassWin, PionPIDK):
    """
    Create and return a Kstar -> K+pi- Selection object.
    Starts from DataOnDemand 'Phys/StdVeryLooseDetachedKst2Kpi'.
    Arguments:
    name             : name of the Selection.
    KaonPT           : Minimum transverse momentum of K (MeV).
    KaonIPCHI2       : Minimum impact parameter chi2 of K.
    PionPT           : Minimum transverse momentum of pi (MeV).
    PionIPCHI2       : Minimum impact parameter chi2 of pi.
    PionPIDK         : Maximum PID_{K-pi} of pi.
    KstarPT          : Minimum transverse momentum of Kstar (MeV).
    KaonPIDK         : Minimum PID_{K-pi} of K.
    KstarVCHI2       : Maximum Kstar vertex chi2 per degree of freedom.
    KstarMassWin     : Kstar invariant mass window around PDG mass value (MeV).
    """


    KstarCuts = "(INTREE((ABSID=='K+') & (PT > %(KaonPT)s *MeV) & (MIPCHI2DV(PRIMARY)> %(KaonIPCHI2)s) & (PIDK > %(KaonPIDK)s) ))"\
        "& (INTREE((ABSID=='pi-') & (PT > %(PionPT)s *MeV) & (MIPCHI2DV(PRIMARY)> %(PionIPCHI2)s) & (PIDK < %(PionPIDK)s )  ))"\
        "& (ADMASS('K*(892)0') < %(KstarMassWin)s *MeV)"\
        "& (VFASPF(VCHI2/VDOF)< %(KstarVCHI2)s) & (PT > %(KstarPT)s *MeV)"% locals()

    _KstarFilter = FilterDesktop("_filterFor" + name)
    _KstarFilter.Code = KstarCuts
    _stdKst2Kpi = DataOnDemand(
        Location="Phys/StdVeryLooseDetachedKst2Kpi/Particles")

    return Selection(name,
                     Algorithm=_KstarFilter,
                     RequiredSelections=[_stdKst2Kpi])
示例#2
0
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 get_selection_sequence(name):
    """Get the selection from stripping stream"""
    # Relative lesLoc for uDST, no preceeding '/'
    tesLoc = 'Phys/B2DPiPiD2HHHCFPIDBeauty2CharmLine/Particles'
    alg = FilterDesktop('SelFilterFor{}B2D'.format(name))
    alg.Code = 'ALL'
    reqSels = [DataOnDemand(Location=tesLoc)]
    sel = Selection('Sel' + name, Algorithm=alg, RequiredSelections=reqSels)
    return SelectionSequence('SelSeq' + name, TopSelection=sel)
示例#4
0
    def inputSeq(self, outputLevel=INFO):
        if not allConfigurables.get("AlignInputSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Filter Sequencer not defined! Defining!"

            inputSequencer = GaudiSequencer("AlignInputSeq")
            inputSequencer.MeasureTime = True
            trackselections = self.getProp("TrackSelections")
            if len(trackselections) > 0:
                trackInputSeq = GaudiSequencer("AlignTrackSelSeq",
                                               IgnoreFilterPassed=True)
                inputSequencer.Members.append(trackInputSeq)
                # add the algorithms for the track selections to the sequence.
                # also merge the tracks lists into one list
                from Configurables import TrackListMerger
                trackmerger = TrackListMerger(
                    "AlignTracks", outputLocation="Rec/Track/AlignTracks")
                self.setProp("TrackLocation", trackmerger.outputLocation)
                for i in trackselections:
                    alg = i.algorithm()
                    if alg: trackInputSeq.Members.append(alg)
                    trackmerger.inputLocations.append(i.location())
                trackInputSeq.Members.append(trackmerger)

            # add all particle selections
            if len(self.getProp("ParticleSelections")) > 0:
                particleInputSeq = GaudiSequencer("AlignParticleSelSeq",
                                                  IgnoreFilterPassed=True)
                inputSequencer.Members.append(particleInputSeq)
                from Configurables import FilterDesktop
                particlemerger = FilterDesktop("AlignParticles", Code="ALL")
                particlemerger.Code = "ALL"
                particlemerger.CloneFilteredParticles = False
                for i in self.getProp("ParticleSelections"):
                    alg = i.algorithm()
                    if alg:
                        particleInputSeq.Members.append(alg)
                        print "adding particleinputsel to sequence: ", i.name(
                        ), i.algorithm(), i.location()
                    particlemerger.Inputs.append(i.location())
                particleInputSeq.Members.append(particlemerger)
                self.setProp("ParticleLocation",
                             '/Event/Phys/AlignParticles/Particles')

            # add the PV selection
            if hasattr(self, "PVSelection"):
                inputSequencer.Members.append(
                    self.getProp("PVSelection").algorithm())
                self.setProp("VertexLocation",
                             self.getProp("PVSelection").location())

            return inputSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: AlignInputSeq already defined!"
            return allConfigurables.get("AlignInputSeq")
示例#5
0
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
示例#6
0
def filterJpsi (localname, 
                _InputLocation=_my_immutable_config['JpsiForExclusiveLinesLocation'], 
                config=default_config):
  _filterAlgorithm = FilterDesktop(localname+"JpsiMuonFilter");
  _myCutOnMuons = ("(PIDmu > %(Muon4Jpsi_PIDmu)s) &"+
                  " (TRPCHI2 > %(Muon4Jpsi_TRPCHI2)s) &"+
                  " (PT > %(Muon4Jpsi_PT)s) ")%config
  _filterAlgorithm.Code = ("(CHILDCUT(("+_myCutOnMuons+"),1) & CHILDCUT(("+_myCutOnMuons+"),2)) &"+
                  " (VFASPF(VCHI2/VDOF)<%(Jpsi_ENDVERTEXCHI2)s) &"+
                  " (ADMASS('J/psi(1S)') < %(Jpsi_MassWindowTight)s)") % config
	

  return Selection (name = localname + 'JpsiMuonFilterSelection', 
                  Algorithm = _filterAlgorithm, 
                  RequiredSelections = [ AutomaticData(_InputLocation) ])
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
示例#8
0
    def __apply_configuration__(self):

        from Configurables import (CombinedParticleMaker,
                                   ProtoParticleMUONFilter,
                                   ProtoParticleCALOFilter, FilterDesktop)

        mName = "TaggingMuons"
        eName = "TaggingElectrons"
        pName = "TaggingPions"
        tagName = 'TaggingParticles'

        hat = 'Phys/'
        leaf = '/Particles'

        mLoc, eLoc, pLoc, tagLoc = [
            hat + name + leaf for name in mName, eName, pName, tagName
        ]

        taggerMuons = CombinedParticleMaker(mName)
        taggerMuons.Particle = 'Muon'
        taggerMuons.addTool(ProtoParticleMUONFilter, name="Muon")
        taggerMuons.Muon.Selection = [
            "RequiresDet='MUON' CombDLL(mu-pi)>'0.0'"
        ]

        taggerElectrons = CombinedParticleMaker(eName)
        taggerElectrons.Particle = 'Electron'
        taggerElectrons.addTool(ProtoParticleCALOFilter, name="Electron")
        taggerElectrons.Electron.Selection = [
            "RequiresDet='CALO' CombDLL(e-pi)>'4.0'"
        ]

        taggerPions = CombinedParticleMaker(pName)
        taggerPions.Particle = 'Pion'

        taggingParticles = FilterDesktop(tagName)
        taggingParticles.Inputs = [eLoc, mLoc, pLoc]
        taggingParticles.Code = "(P>2.0*GeV)"

        dod = DataOnDemandSvc()
        dod.AlgMap.update({mLoc: taggerMuons})
        dod.AlgMap.update({eLoc: taggerElectrons})
        dod.AlgMap.update({pLoc: taggerPions})
        dod.AlgMap.update({tagLoc: taggingParticles})

        # configure charm candidate lists
        import FlavourTagging.CharmTaggerLists
示例#9
0
    def __init__(self, name='Tagging'):

        mName = name + "Muons"
        eName = name + "Electrons"
        pName = name + "Pions"
        tagName = name + 'Particles'

        _taggerMuons = CombinedParticleMaker(mName)
        _taggerMuons.Particle = 'Muon'
        _taggerMuons.addTool(ProtoParticleMUONFilter, name="Muon")
        _taggerMuons.Muon.Selection = [
            "RequiresDet='MUON' CombDLL(mu-pi)>'0.0'"
        ]

        _taggerElectrons = CombinedParticleMaker(eName)
        _taggerElectrons.Particle = 'Electron'
        _taggerElectrons.addTool(ProtoParticleCALOFilter, name="Electron")
        _taggerElectrons.Electron.Selection = [
            "RequiresDet='CALO' CombDLL(e-pi)>'4.0'"
        ]

        _taggerPions = CombinedParticleMaker(pName)
        _taggerPions.Particle = 'Pion'

        _taggingParticles = FilterDesktop(tagName)
        _taggingParticles.Code = "(P>2.0*GeV)"

        taggerMuons = Selection(mName, Algorithm=_taggerMuons)

        taggerElectrons = Selection(eName, Algorithm=_taggerElectrons)

        taggerPions = Selection(pName, Algorithm=_taggerPions)

        allTaggers = MergedSelection(
            name + 'All',
            RequiredSelections=[taggerPions, taggerMuons, taggerElectrons])

        self.selection = Selection(tagName,
                                   Algorithm=_taggingParticles,
                                   RequiredSelections=[allTaggers])
示例#10
0
from Configurables import DaVinci, FilterDesktop, DecayTreeTuple
from PhysSelPython.Wrappers import Selection, SelectionSequence, TupleSelection
import StandardParticles

alg = FilterDesktop('pions')
alg.Code = 'ALL'
sel = Selection('pions_sel',
                Algorithm=alg,
                RequiredSelections=[StandardParticles.StdAllNoPIDsPions])

tuplesel = TupleSelection('pions_tuple_sel',
                          Decay='[pi+]cc',
                          RequiredSelection=sel)

selseq = SelectionSequence('pions_seq', TopSelection=tuplesel)
DaVinci().UserAlgorithms.append(selseq.sequence())
DaVinci().TupleFile = 'DVTuples.root'
示例#11
0
def patchBrunel():
    """
        Instantiate the options to run Brunel with raw data

        @author M.Frank
  """
    import GaudiConf.DstConf
    import Brunel.Configuration
    import OnlineEnv

    brunel = Brunel.Configuration.Brunel()
    brunel.OnlineMode = True
    try:
        brunel.DDDBtag = OnlineEnv.DDDBTag
    except:
        print "DDDBTag not found, use default"

    try:
        brunel.CondDBtag = OnlineEnv.CondDBTag
    except:
        print "CondDBTag not found, use default"

    ##print '[ERROR]', OnlineEnv.DDDBTag, OnlineEnv.CondDBTag

    conddb = CondDB()
    conddb.IgnoreHeartBeat = True
    #
    # Adjust to pickup the proper online conditions
    #
    import ConditionsMap
    conddb.setProp('RunChangeHandlerConditions',
                   ConditionsMap.RunChangeHandlerConditions)
    conddb.setProp('EnableRunChangeHandler', True)

    brunel.DataType = "2015"
    brunel.UseDBSnapshot = True  # Try it
    brunel.WriteFSR = False  # This crashes Jaap's stuff

    conddb = CondDB()
    conddb.Online = True
    #
    # Adjust to pickup the proper online conditions from ConditionsMap
    #
    conddb.RunChangeHandlerConditions = ConditionsMap.RunChangeHandlerConditions
    conddb.setProp('EnableRunChangeHandler', True)

    # Enabled data-on-demand
    Gaudi.ApplicationMgr().ExtSvc += ["DataOnDemandSvc"]

    ################################################################################
    #                                                                              #
    # Set up PID monitoring sequence                                               #
    #                                                                              #
    ################################################################################

    # The sequencer to run all the monitoring in
    seq = GaudiSequencer("PIDMoniSeq")

    pidSeq = GaudiSequencer("RichPIDSelections")

    brunel.setOtherProps(RichPIDQCConf(), ['OutputLevel', 'Context'])
    RichPIDQCConf().setProp("CalibSequencer", pidSeq)

    seq.Members += [pidSeq]

    ################################################################################
    #                                                                              #
    # Configure the muon efficiency monitor                                        #
    #                                                                              #
    ################################################################################

    muEffMoni = MuEffMonitor("MuEffMonitor")

    muEffMoni.addTool(TrackMasterExtrapolator, name="MuEffExtrap")
    muEffMoni.Extrapolator = muEffMoni.MuEffExtrap

    muEffMoni.MuEffExtrap.ApplyMultScattCorr = True
    muEffMoni.MuEffExtrap.ApplyEnergyLossCorr = True
    muEffMoni.MuEffExtrap.MaterialLocator = "SimplifiedMaterialLocator"
    muEffMoni.MuEffExtrap.OutputLevel = 6

    muEffMoni.nSigma1X = [11., 8., 7., 7.]
    muEffMoni.nSigma1Y = [6., 5., 5., 5.]
    muEffMoni.nSigmaX = [5., 5., 5., 5.]
    muEffMoni.nSigmaY = [5., 5., 5., 5.]

    muEffMoni.RequiredStations = 4
    muEffMoni.MomentumCut = 3000.0
    muEffMoni.nSigmaFidVol = 3.0

    muEffMoni.UseCalo = True
    muEffMoni.EecalMax = 1500.0
    muEffMoni.EhcalMax = 5000.0
    muEffMoni.EhcalMin = 1000.0

    muEffMoni.Chi2ProbTrMin = 0.01
    muEffMoni.Chi2MuMin = 10.0
    muEffMoni.nSigmaXother = 2.0
    muEffMoni.nSigmaYother = 2.0

    muEffMoni.HistoLevel = "OfflineFull"

    seq.Members += [muEffMoni]

    ################################################################################
    #                                                                              #
    # Configure the muon pid monitor                                               #
    #                                                                              #
    ################################################################################

    from Configurables import MuIDMonitor, CombineParticles
    from Configurables import FilterDesktop
    from StandardParticles import StdNoPIDsPions, StdNoPIDsProtons, StdNoPIDsMuons
    from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

    MuPidMoniSeq_Lambda = GaudiSequencer("MuPidMoniSeq_Lambda")
    MuPidMoniSeq_Jpsi = GaudiSequencer("MuPidMoniSeq_Jpsi")

    #
    # Make pions and protons
    #

    PionsFilter = FilterDesktop("PionsFilter")
    PionsFilter.Code = "(P>3000*MeV) & (PT>100*MeV) & (TRCHI2DOF<2) & (ISLONG) & (MIPCHI2DV(PRIMARY)>9)"
    PionsFilterSel = Selection("PionsFilterSel",
                               Algorithm=PionsFilter,
                               RequiredSelections=[StdNoPIDsPions])

    ProtonsFilter = FilterDesktop("ProtonsFilter")
    ProtonsFilter.Code = "(P>3000*MeV) & (PT>100*MeV) & (TRCHI2DOF<2) & (ISLONG) & (MIPCHI2DV(PRIMARY)>9)"
    ProtonsFilterSel = Selection("ProtonsFilterSel",
                                 Algorithm=ProtonsFilter,
                                 RequiredSelections=[StdNoPIDsProtons])
    #
    # Make Lambda_0
    #

    LambdaMonitor = CombineParticles("LambdaMonitor")
    LambdaMonitor.DecayDescriptor = "[Lambda0 -> p+ pi-]cc"
    LambdaMonitor.CombinationCut = "(ADAMASS('Lambda0')<10*MeV)"
    LambdaMonitor.MotherCut = "(50<BPVVDZ) & (600>BPVVDZ) & (BPVDIRA>0.9999995)  & (CHILDCUT((PT>0.2*GeV),1) | CHILDCUT((PT>0.2*GeV),2)) & (ADWM('KS0', WM('pi+', 'pi-')) > 20*MeV)"

    LambdaMonitorSel = Selection(
        "LambdaMonitorSel",
        Algorithm=LambdaMonitor,
        RequiredSelections=[PionsFilterSel, ProtonsFilterSel])

    LambdaMonitorSeq = SelectionSequence("LambdaMonitorSeq",
                                         TopSelection=LambdaMonitorSel)

    MuPidMoniSeq_Lambda.Members += [LambdaMonitorSeq.sequence()]

    #
    # Make muons and J/psi
    #

    mucocut = '(0.5<PPINFO(LHCb.ProtoParticle.InAccMuon,-1)) & (P>3*GeV) & (PT>800*MeV) & (TRCHI2DOF<3) & (ISLONG)'

    tag1cuts = " (CHILDCUT(ISMUON,1)) & (CHILDCUT((P>6*GeV),1)) & (CHILDCUT((PT>1.5*GeV),1)) "
    tag2cuts = " (CHILDCUT(ISMUON,2)) & (CHILDCUT((P>6*GeV),2)) & (CHILDCUT((PT>1.5*GeV),2)) "

    probe2cuts = " ( (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)<1000*MeV),2)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)<4000*MeV),2)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)>-10*MeV),2)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)>1000*MeV),2)) ) "
    probe1cuts = " ( (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)<1000*MeV),1)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)<4000*MeV),1)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)>-10*MeV),1)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)>1000*MeV),1)) )  "

    child1cuts = tag1cuts + " & " + probe2cuts

    child2cuts = tag2cuts + " & " + probe1cuts

    MuonsFilter = FilterDesktop("MuonsFilter")
    MuonsFilter.Code = mucocut
    MuonsFilterSel = Selection("MuonsFilterSel",
                               Algorithm=MuonsFilter,
                               RequiredSelections=[StdNoPIDsMuons])

    JpsiMonitor = CombineParticles("JpsiMonitor")
    JpsiMonitor.DecayDescriptor = "J/psi(1S) -> mu+ mu-"
    JpsiMonitor.CombinationCut = "(ADAMASS('J/psi(1S)')<300*MeV)"
    JpsiMonitor.MotherCut = "(VFASPF(VCHI2/VDOF)<20) & ( " + child1cuts + " | " + child2cuts + " ) "

    JpsiMonitor.OutputLevel = 6

    JpsiMonitorSel = Selection("JpsiMonitorSel",
                               Algorithm=JpsiMonitor,
                               RequiredSelections=[MuonsFilterSel])

    JpsiMonitorSeq = SelectionSequence("JpsiMonitorSeq",
                                       TopSelection=JpsiMonitorSel)

    MuPidMoniSeq_Jpsi.Members += [JpsiMonitorSeq.sequence()]

    #
    # Monitoring muon mis-id with Lambda_0
    #

    MuIDLambdaPlot = MuIDMonitor("MuIDLambdaPlot")
    MuIDLambdaPlot.Inputs = [LambdaMonitorSel.outputLocation()]
    MuIDLambdaPlot.OutputLevel = 6

    MuIDLambdaPlot.MassMean = 1115.68
    MuIDLambdaPlot.MassWindow = 20.
    MuIDLambdaPlot.EffMassWin = 2.

    MuIDLambdaPlot.JpsiAnalysis = 0
    MuIDLambdaPlot.LambdaAnalysis = 1
    MuIDLambdaPlot.HitInFoi = 1

    MuIDLambdaPlot.PreSelMomentum = 3000.  # MuonID preselection momentum (MeV/c)
    MuIDLambdaPlot.MomentumCuts = [6000., 10000.
                                   ]  # MuonID momentum cut ranges (MeV/c)

    # MuonID FOI parameters

    MuIDLambdaPlot.FOIfactor = 1.

    MuIDLambdaPlot.XFOIParameter1 = [
        5.5, 4.0, 3.3, 2.8, 5.2, 3.6, 2.4, 2.4, 5.7, 4.4, 2.8, 2.3, 5.1, 3.1,
        2.3, 2.1, 5.8, 3.4, 2.6, 2.8
    ]

    MuIDLambdaPlot.XFOIParameter2 = [
        11., 3., 1., 1., 31., 28., 21., 17., 30., 31., 27., 22., 28., 33., 35.,
        47., 31., 39., 56., 151.
    ]

    MuIDLambdaPlot.XFOIParameter3 = [
        0.20, 0.08, 0.03, 0.1, 0.06, 0.08, 0.10, 0.15, 0.04, 0.06, 0.09, 0.12,
        0.08, 0.15, 0.23, 0.36, 0.07, 0.14, 0.24, 0.49
    ]

    MuIDLambdaPlot.YFOIParameter1 = [
        2.8, 1.7, -153., 1.9, 3.3, 2.1, 1.7, 1.6, 3.6, 2.8, 1.9, 1.8, 4.4, 3.3,
        2.2, 2.2, 4.8, 3.9, 2.6, 2.3
    ]

    MuIDLambdaPlot.YFOIParameter2 = [
        3., 2., 156., 0., 17., 15., 9., 5., 26., 25., 16., 15., 30., 49., 57.,
        92., 32., 55., 96., 166.
    ]

    MuIDLambdaPlot.YFOIParameter3 = [
        0.03, 0.02, 0.00, 0.09, 0.13, 0.19, 0.19, 0.24, 0.11, 0.19, 0.21, 0.32,
        0.10, 0.22, 0.30, 0.52, 0.08, 0.20, 0.34, 0.52
    ]

    #
    # Parameters of the Landau functions
    #

    MuIDLambdaPlot.distMuon = [
        0.311, 1.349, 0.524, 0.0020, 17., 10.6, 0.04, 4.1, 1.64
    ]
    MuIDLambdaPlot.distPion = [
        11., -12., 0.2029, -0.026, 0.06, 0.59, 0.008, -29., 41.
    ]

    MuPidMoniSeq_Lambda.Members += [MuIDLambdaPlot]

    #
    # Monitoring muon id with J/psi
    #

    MuIDJpsiPlot = MuIDMonitor("MuIDJpsiPlot")
    MuIDJpsiPlot.Inputs = [JpsiMonitorSel.outputLocation()]
    MuIDJpsiPlot.OutputLevel = 6

    MuIDJpsiPlot.MassMean = 3096.91
    MuIDJpsiPlot.MassWindow = 300.
    MuIDJpsiPlot.EffMassWin = 20.

    MuIDJpsiPlot.JpsiAnalysis = 1
    MuIDJpsiPlot.LambdaAnalysis = 0
    MuIDJpsiPlot.HitInFoi = 1

    MuIDJpsiPlot.PreSelMomentum = MuIDLambdaPlot.PreSelMomentum
    MuIDJpsiPlot.MomentumCuts = MuIDLambdaPlot.MomentumCuts

    # MuonID FOI parameters

    MuIDJpsiPlot.FOIfactor = MuIDLambdaPlot.FOIfactor
    MuIDJpsiPlot.XFOIParameter1 = MuIDLambdaPlot.XFOIParameter1
    MuIDJpsiPlot.XFOIParameter2 = MuIDLambdaPlot.XFOIParameter2
    MuIDJpsiPlot.XFOIParameter3 = MuIDLambdaPlot.XFOIParameter3
    MuIDJpsiPlot.YFOIParameter1 = MuIDLambdaPlot.YFOIParameter1
    MuIDJpsiPlot.YFOIParameter2 = MuIDLambdaPlot.YFOIParameter2
    MuIDJpsiPlot.YFOIParameter3 = MuIDLambdaPlot.YFOIParameter3

    #
    # Parameters of the Landau functions
    #

    MuIDJpsiPlot.distMuon = MuIDLambdaPlot.distMuon
    MuIDJpsiPlot.distPion = MuIDLambdaPlot.distPion

    MuPidMoniSeq_Jpsi.Members += [MuIDJpsiPlot]
    MuPidMoniSeq_Jpsi.IgnoreFilterPassed = True
    MuPidMoniSeq_Lambda.IgnoreFilterPassed = True

    seq.Members += [MuPidMoniSeq_Lambda, MuPidMoniSeq_Jpsi]

    # set the options

    class __MonAdd:
        def __init__(self, s):
            self.seq = s

        def addMonitors(self):
            # Append to processing
            GaudiSequencer("PhysicsSeq").Members += [self.seq]

    mon = __MonAdd(seq)
    Gaudi.appendPostConfigAction(mon.addMonitors)

    EventLoopMgr().OutputLevel = MSG_DEBUG  #ERROR
    EventLoopMgr().Warnings = False

    brunel.UseDBSnapshot = True  # try it
    Brunel.Configuration.Brunel.configureOutput = dummy
    HistogramPersistencySvc().OutputFile = ""
    HistogramPersistencySvc().OutputLevel = MSG_ERROR
    print brunel
    return brunel
示例#12
0
with loose PID cuts.
'''

from Gaudi.Configuration import *
from StrippingConf.StrippingLine import StrippingLine, StrippingMember
from Configurables import FilterDesktop, CombineParticles, OfflineVertexFitter
import GaudiKernel.SystemOfUnits as Units

################
# KS long long #
################
KSLLForBd2Jpsi2MuMuKS = FilterDesktop("StripKSLLForBd2Jpsi2MuMuKS")
KSLLForBd2Jpsi2MuMuKS.InputLocations = ["StdLooseKsLL"]
KSLLForBd2Jpsi2MuMuKS.Code = "  (MINTREE( ('pi+'==ABSID), P) >2.*GeV)"\
                             "& (MINTREE( ('pi+'==ABSID), MIPCHI2DV(PRIMARY)) >9.)"\
                             "& (MAXTREE( ('pi+'==ABSID), TRCHI2DOF) <10.)"\
                             "& (VFASPF(VCHI2/VDOF)<10.)"\
                             "& (ADMASS('KS0') < 80.0*MeV)"

############################
# KS downstream downstream #
############################
KSDDForBd2Jpsi2MuMuKS = FilterDesktop("StripKSDDForBd2Jpsi2MuMuKS")
KSDDForBd2Jpsi2MuMuKS.InputLocations = ["StdLooseKsDD"]
KSDDForBd2Jpsi2MuMuKS.Code = "  (MINTREE( ('pi+'==ABSID), P) >2.*GeV)"\
                             "& (MINTREE( ('pi+'==ABSID), MIPCHI2DV(PRIMARY)) >4.)"\
                             "& (MAXTREE( ('pi+'==ABSID), TRCHI2DOF) <20.)"\
                             "& (VFASPF(VCHI2/VDOF)<20.)"\
                             "& (ADMASS('KS0') < 100.0*MeV)"

################
#
# @author Patrick Koppenburg
# @date 2009-02-03
#
##############################################################################
from Gaudi.Configuration import *
from Configurables import DaVinci, SelDSTWriter
##############################################################################
from Configurables import GaudiSequencer, FilterDesktop
MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"

#
# Get a J/psi
#
jpsi = FilterDesktop('MyJpsi')
jpsi.Code = "ALL"

from PhysSelPython.Wrappers import Selection, DataOnDemand, SelectionSequence

MyLooseJpsi = DataOnDemand(Location = 'Phys/StdLooseJpsi2MuMu')

SelJpsi = Selection('SelJpsi',
                    Algorithm = jpsi,
                    RequiredSelections = [MyLooseJpsi])

SeqJpsi = SelectionSequence('SeqJpsi', TopSelection = SelJpsi)

#from MicroDSTExample.Selections import SeqBs2Jpsi2MuMuPhi2KK
#SeqBs = SeqBs2Jpsi2MuMuPhi2KK.SeqBs2Jpsi2MuMuPhi2KK

#
示例#14
0
  @ Created by R. LAmbert
  @ date 2009-11-20
  Mu selection for tests
  Long track muons with PT > 1 GeV
"""

__author__ = 'R. Lambert'
__date__ = 'November 2009'
__version__ = '$Revision: 1.3 $'

import GaudiKernel.SystemOfUnits as Units
from Gaudi.Configuration import *
from Configurables import FilterDesktop, DaVinci
from PhysSelPython.Wrappers import Selection, DataOnDemand, SelectionSequence
from StandardParticles import StdLooseMuons as MyStdMuons

MuForTests = FilterDesktop("_bachelorMu")
MuForTests.Code = "((ISLONG) & (PT > 250.*MeV))"

SelMuForTests = Selection("BachelorMuForTests",
                          Algorithm=MuForTests,
                          RequiredSelections=[MyStdMuons])
from Configurables import CheckPV
checkPV = CheckPV('TestCheckPV')
TestSequence = SelectionSequence("TestSeq",
                                 TopSelection=SelMuForTests,
                                 EventPreSelector=[checkPV])

dv = DaVinci()
DaVinci().UserAlgorithms = [TestSequence.sequence()]
示例#15
0
    def __apply_configuration__(self) :

        from Configurables import ( GaudiSequencer,
                                    CombineParticles, FilterDesktop )
        from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand
                
        if not self.isPropertySet("Sequencer") :
            raise RuntimeError("ERROR : Sequence not set")
        seq = self.getProp("Sequencer")

        if self.getProp("RunSelection") : 

            # STD particles
            from StandardParticles import StdNoPIDsPions, StdNoPIDsProtons
      
            # Filter Pi Tracks
            pionfilterName = self.__sel_name__+"_PiFilter"
            pionfilter = FilterDesktop(pionfilterName)
            pionfilter.Code = "(ISLONG) & (TRCHI2DOF < 3) & (PT > 0.1*GeV) & (MIPCHI2DV(PRIMARY) > 9)"
            self.setOptions(pionfilter)
            pionfilterSel = Selection( pionfilterName+'Sel',
                                       Algorithm = pionfilter,
                                       RequiredSelections = [StdNoPIDsPions] )

            # Filter Proton Tracks
            protonfilterName = self.__sel_name__+"_PrFilter"
            protonfilter = FilterDesktop(protonfilterName)
            protonfilter.Code = "(ISLONG) & (TRCHI2DOF < 3) & (PT > 0.4*GeV) & (MIPCHI2DV(PRIMARY) > 9)"
            self.setOptions(protonfilter)
            protonfilterSel = Selection( protonfilterName+'Sel',
                                         Algorithm = protonfilter,
                                         RequiredSelections = [StdNoPIDsProtons] ) 

            # Make the Lambda
            lambda2ppi = CombineParticles(self.__sel_name__)
            lambda2ppi.DecayDescriptor = "[ Lambda0 -> p+ pi- ]cc"
            lambda2ppi.CombinationCut = "(ADAMASS('Lambda0') < 100*MeV) & (AMAXDOCA('') < 0.2*mm)"
            lambda2ppi.MotherCut = "(ADMASS('Lambda0') < 50.0*MeV) & (PT > 0.5*GeV) & (VFASPF(VCHI2/VDOF) < 6.0) & (MIPDV(PRIMARY) < 0.5) & (BPVVDCHI2 > 750) & (MIPCHI2DV(PRIMARY) < 200) & ( ADWM( 'KS0' , WM( 'pi+' , 'pi-') ) > 15*MeV ) & (LV01 < 0.98) & (LV02 < 0.98) & (LV01 > -0.98) & (LV02 > -0.98)"
            self.setOptions(lambda2ppi)
            lambda2ppiSel = Selection( self.__sel_name__+'Sel',
                                       Algorithm = lambda2ppi,
                                       RequiredSelections = [pionfilterSel,protonfilterSel] )

            # Selection Sequence
            selSeq = SelectionSequence( self.__sel_name__+'Seq', TopSelection = lambda2ppiSel )

            # Run the selection sequence.
            seq.Members += [selSeq.sequence()]

        # Particle Monitoring plots
        if self.getProp("RunMonitors") :
            
            from Configurables import ParticleMonitor
            plotter = ParticleMonitor(self.__sel_name__+"Plots")
            if self.getProp("RunSelection") : 
                plotter.Inputs  = [ 'Phys/'+self.__sel_name__+'Sel' ]
            else:
                plotter.Inputs = self.getProp("Candidates")
            plotter.PeakCut     = "(ADMASS('Lambda0')<2*MeV)"
            plotter.SideBandCut = "(ADMASS('Lambda0')>2*MeV)"
            plotter.PlotTools   = self.getProp("PlotTools") 
            self.setOptions(plotter)
            seq.Members += [ plotter ]
            
        # Make a DST ?
        if self.getProp("MakeSelDST"):

            # Prescale
            from Configurables import DeterministicPrescaler
            scaler = DeterministicPrescaler( self.__sel_name__+'PreScale',
                                             AcceptFraction = self.getProp("DSTPreScaleFraction") )
            seq.Members += [scaler]
            # Write the DST
            MyDSTWriter = SelDSTWriter( self.__sel_name__+"DST",
                                        SelectionSequences = [ selSeq ],
                                        OutputPrefix = self.__sel_name__ )
            seq.Members += [MyDSTWriter.sequence()]
        
        # MC Performance checking ?
        if self.getProp("MCChecks") :

            from Configurables import ParticleEffPurMoni
            mcPerf = ParticleEffPurMoni(lambda2ppiName+"MCPerf")
            mcPerf.Inputs = ["Phys/"+lambda2ppiName]
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]
                    
        # Ntuple ?
        if self.getProp("MakeNTuple") : pass
示例#16
0
#         MyStream.appendLines( [ line ] )
            
# sc = StrippingConf( HDRLocation = "MyStrip", Streams = [ MyStream ] )
# #------------------------------------------------------------------------

#----selection p+ and K- and Lambda0 -------------------------
# protons = DataOnDemand(Location = "Phys/StdNoPIDsProtons/Particles")
# protons = DataOnDemand(Location = "Phys/StdLooseProtons/Particles")
# pions = DataOnDemand(Location = "Phys/StdLoosePions/Particles")
Lambda0LL = DataOnDemand(Location = "Phys/StdLooseLambdaLL/Particles")
Lambda0DD = DataOnDemand(Location = "Phys/StdLooseLambdaDD/Particles")
AllLambda0 = MergedSelection( "AllLambda0", RequiredSelections = [Lambda0LL, Lambda0DD])

#----Selection /\->p+ pi-
_FilterL = FilterDesktop("_FilterL")
_FilterL.Code = "(ADMASS('Lambda0') < 30.*MeV)"\
                  "& (VFASPF(VCHI2/VDOF) < 12.0)" 

FilterL = Selection( "FilterL",
                      Algorithm          = _FilterL ,
                      RequiredSelections = [ AllLambda0 ] )

# _L2ppi = CombineParticles( "_L2ppi",
#                            DecayDescriptor = "[Lambda0 -> p+ pi-]cc",
#                            CombinationCut  = "(ADMASS('Lambda0') < 30.*MeV) & (VFASPF(VCHI2/VDOF) < 12.0)",
#                            # CombinationCut  = "AM < 2700. * MeV", 
#                            MotherCut       = "(VFASPF(VCHI2/VDOF)<2500) & (BPVDIRA > 0.9)",
#                            # MotherCut       = "(VFASPF(VCHI2/VDOF)<25) & (BPVDIRA > 0.999) & (VFASPF(VCHI2PDOF) < 10)",# & (BPVVD > 1.5 *mm)",
#                            # MotherCut       = "(ADMASS('Lambda0') < 30.*MeV)"\
#                            #     "& (VFASPF(VCHI2/VDOF) < 12.0)",
#                            ReFitPVs        = False )
# L2ppi = Selection( "L2ppi",
示例#17
0
    def __apply_configuration__(self):

        from Configurables import (GaudiSequencer, CombineParticles,
                                   FilterDesktop)
        from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

        if not self.isPropertySet("Sequencer"):
            raise RuntimeError("ERROR : Sequence not set")
        seq = self.getProp("Sequencer")

        if self.getProp("RunSelection"):

            # STD particles
            from StandardParticles import StdNoPIDsPions

            # Filter Pi Tracks
            pionFilterName = self.__sel_name__ + "_PiFilter"
            pionfilter = FilterDesktop(pionFilterName)
            pionfilter.Code = "(ISLONG) & (TRCHI2DOF < 5) & (P > 2*GeV) & (MIPCHI2DV(PRIMARY) > 30)"
            self.setOptions(pionfilter)
            pionfilterSel = Selection(pionFilterName + 'Sel',
                                      Algorithm=pionfilter,
                                      RequiredSelections=[StdNoPIDsPions])

            # Make the KS0
            ks02pipi = CombineParticles(self.__sel_name__)
            ks02pipi.DecayDescriptor = "KS0 -> pi+ pi-"
            ks02pipi.CombinationCut = "(ADAMASS('KS0') < 200*MeV) & (AMAXDOCA('') < 0.6*mm)"
            ks02pipi.MotherCut = "(ADMASS('KS0') < 100*MeV) & (VFASPF(VCHI2/VDOF) < 10) & (MIPDV(PRIMARY) < 0.75) & (BPVVDCHI2 > 150) & (MIPCHI2DV(PRIMARY) < 100) & ( ADWM( 'Lambda0' , WM( 'p+' , 'pi-') ) > 8*MeV ) & ( ADWM( 'Lambda0' , WM( 'pi+' , 'p~-') ) > 8*MeV )"
            self.setOptions(ks02pipi)
            ks02pipiSel = Selection(self.__sel_name__ + 'Sel',
                                    Algorithm=ks02pipi,
                                    RequiredSelections=[pionfilterSel])

            # Selection Sequence
            selSeq = SelectionSequence(self.__sel_name__ + 'Seq',
                                       TopSelection=ks02pipiSel)

            # Run the selection sequence.
            seq.Members += [selSeq.sequence()]

        # Particle Monitoring plots
        if self.getProp("RunMonitors"):

            from Configurables import ParticleMonitor
            plotter = ParticleMonitor(self.__sel_name__ + "Plots")
            if self.getProp("RunSelection"):
                plotter.Inputs = ['Phys/' + self.__sel_name__ + 'Sel']
            else:
                plotter.Inputs = self.getProp("Candidates")
            plotter.PeakCut = "(ADMASS('KS0')<7*MeV)"
            plotter.SideBandCut = "(ADMASS('KS0')>7*MeV)"
            plotter.PlotTools = self.getProp("PlotTools")
            self.setOptions(plotter)
            seq.Members += [plotter]

        # Make a DST ?
        if self.getProp("MakeSelDST"):

            # Prescale
            from Configurables import DeterministicPrescaler
            scaler = DeterministicPrescaler(
                self.__sel_name__ + 'PreScale',
                AcceptFraction=self.getProp("DSTPreScaleFraction"))
            seq.Members += [scaler]
            # Write the DST
            MyDSTWriter = SelDSTWriter(self.__sel_name__ + "DST",
                                       SelectionSequences=[selSeq],
                                       OutputPrefix=self.__sel_name__)
            seq.Members += [MyDSTWriter.sequence()]

        # MC Performance checking ?
        if self.getProp("MCChecks"):

            from Configurables import ParticleEffPurMoni

            #mcPerfPi = ParticleEffPurMoni("StdNoPIDsPionsMCPerf")
            #mcPerfPi.Inputs = ["Phys/StdNoPIDsPions"]
            #mcPerfPi.OutputLevel = DEBUG
            #seq.Members += [mcPerfPi]

            #mcPerfPiFilt = ParticleEffPurMoni(pionFilterName+"MCPerf")
            #mcPerfPiFilt.Inputs = ["Phys/"+pionFilterName]
            #seq.Members += [mcPerfPiFilt]

            mcPerfD = ParticleEffPurMoni(ks02pipiName + "MCPerf")
            mcPerfD.Inputs = ["Phys/" + ks02pipiName]
            self.setOptions(mcPerfD)
            seq.Members += [mcPerfD]

        # Ntuple ?
        if self.getProp("MakeNTuple"): pass
示例#18
0
Bu2LLK09_DiLepton.Inputs = ["Phys/StdLooseElectrons", "Phys/StdLooseMuons"]
Bu2LLK09_DiLepton.DecayDescriptors = [
    "J/psi(1S) -> e+ e-", "J/psi(1S) -> mu+ mu-"
]

Bu2LLK09_DiLepton.DaughtersCuts = {"e+": leptoncut, "mu+": leptoncut}
Bu2LLK09_DiLepton.CombinationCut = "(AM<6*GeV)"
Bu2LLK09_DiLepton.MotherCut = "(VFASPF(VCHI2/VDOF)<25)"
###########################################################################
# Preselection
#
Presel09Bu2LLK = CombineParticles("Presel09Bu2LLK")
Sel09Bu2LLKFilterSequence.Members += [Presel09Bu2LLK]
Presel09Bu2LLK.Inputs = ["Phys/Bu2LLK09_DiLepton", "Phys/StdLooseKaons"]
Presel09Bu2LLK.DecayDescriptor = "[ B+ -> J/psi(1S) K+ ]cc"
Presel09Bu2LLK.DaughtersCuts = {"K+": kaoncut, "J/psi(1S)": llcut}
Presel09Bu2LLK.CombinationCut = combcut
Presel09Bu2LLK.MotherCut = bcut
##########################################################################
# Selection
#
from Configurables import FilterDesktop
Sel09Bu2LLK = FilterDesktop("Sel09Bu2LLK")
Sel09Bu2LLK.Inputs = ["Phys/Presel09Bu2LLK"]
Sel09Bu2LLK.Code = hardkaon + " & (" + hardelectron + " | " + hardmuon + " ) & " + harddilepton + " & " + hardB
Sel09Bu2LLKFilterSequence.Members += [Sel09Bu2LLK]

##########################################################################
#ApplicationMgr().TopAlg += [ Sel09Bu2LLKFilterSequence ]
示例#19
0
from Configurables import TupleToolTISTOS, TriggerTisTos

EVTMAX = -1
MODE = 'data'
OUTPUTLEVEL = ERROR

#########################################################################################################
# Build the candidates, with selections following the WG productions
#########################################################################################################

############
InputJpsi = AutomaticData(
    Location='/Event/Dimuon/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles')

FilteredJpsi = FilterDesktop("FilteredJpsi")
FilteredJpsi.Code = "(INTREE((ABSID=='mu+')&(PT>550*MeV)&(TRCHI2DOF<4)&(PIDmu>0)))"

SelJpsi = Selection("Selpsi",
                    Algorithm=FilteredJpsi,
                    RequiredSelections=[InputJpsi])

############
SelPhotons = AutomaticData(Location='Phys/StdLooseAllPhotons/Particles')

MakeChic2JpsiGamma = CombineParticles("MakeChic2JpsiGamma")
MakeChic2JpsiGamma.DecayDescriptors = ['chi_c1(1P) -> J/psi(1S) gamma']
MakeChic2JpsiGamma.CombinationCut = "( AM - AM1 ) < 700 * MeV"
MakeChic2JpsiGamma.MotherCut = "MM<10000.*MeV"
MakeChic2JpsiGamma.DaughtersCuts = {
    "J/psi(1S)": "M  < ( 3.100 + 0.120 ) * GeV",
    'gamma': "PT > 400 * MeV "
示例#20
0
# MyLines = [ 'StrippingFullDSTDiMuonJpsi2MuMuDetachedLine' ]

# for stream in streams:
#     for line in stream.lines:
#         if line.name() in MyLines:
#             MyStream.appendLines( [ line ] )

# sc = StrippingConf( HDRLocation = "MyStrip", Streams = [ MyStream ] )
# #------------------------------------------------------------------------

#----Jpsi->mumu---------------------------------
J2MuMu = AutomaticData(Location = "Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles")

_Jpsi2MuMu = FilterDesktop("_J2MuMu")
_Jpsi2MuMu.Code = "(ADMASS('J/psi(1S)')<50*MeV)"\
    "& (MINTREE(ABSID=='mu+',PT)>500*MeV)"\
    "& (MINTREE(ABSID=='mu+',TRCHI2DOF)<4)"

Jpsi2MuMu = Selection("FilterJ",
                      Algorithm = _Jpsi2MuMu ,
                      RequiredSelections = [ J2MuMu ] )

#----Selection K*->K+ pi-
Kstar2Kpi = DataOnDemand(Location = "Phys/StdLooseKstar2Kpi/Particles")

_Kst2Kpi = FilterDesktop("_Kst2Kpi")
_Kst2Kpi.Code = "(ADMASS('K*(892)0') < 100.*MeV)"\
    # "& (VFASPF(VCHI2/VDOF) < 4)"\
    # "& (MINTREE(ABSID=='K+',PT)>250*MeV)"\
    # "& (MINTREE(ABSID=='pi-',PT)>250*MeV)"\
    # "& ((MINTREE(ABSID=='K+',PT)+MINTREE(ABSID=='pi-',PT))>900*MeV)"\
示例#21
0
    def __apply_configuration__(self):

        from Configurables import (GaudiSequencer, CombineParticles,
                                   FilterDesktop)
        from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

        if not self.isPropertySet("Sequencer"):
            raise RuntimeError("ERROR : Sequence not set")
        seq = self.getProp("Sequencer")

        if self.getProp("RunSelection"):
            # STD particles
            from StandardParticles import StdNoPIDsPions, StdNoPIDsKaons

            # Filter Pi/K Tracks
            trackfilterName = self.__sel_name__ + "_TrackFilter"
            trackfilter = FilterDesktop(trackfilterName)
            trackfilter.Code = "(PT > 0.4*GeV) & (P > 2.0*GeV) & (TRCHI2DOF < 10) & (MIPCHI2DV(PRIMARY) > 6)"
            self.setOptions(trackfilter)
            trackfilterSel = Selection(
                trackfilterName + 'Sel',
                Algorithm=trackfilter,
                RequiredSelections=[StdNoPIDsPions, StdNoPIDsKaons])

            # Filter Pi Tracks
            pionfilterName = self.__sel_name__ + "_PiFilter"
            pionfilter = FilterDesktop(pionfilterName)
            pionfilter.Code = "(PT > 110*MeV) & (MIPCHI2DV(PRIMARY) > 2)"
            self.setOptions(pionfilter)
            pionfilterSel = Selection(pionfilterName + 'Sel',
                                      Algorithm=pionfilter,
                                      RequiredSelections=[StdNoPIDsPions])

            # Make the D0
            d02kpiName = self.__sel_name__ + "_D0ToKPiSel"
            d02kpi = CombineParticles(d02kpiName)
            d02kpi.DecayDescriptor = "[ D0 -> K- pi+ ]cc"
            d02kpi.CombinationCut = "(ADAMASS('D0') < 100*MeV)"
            d02kpi.MotherCut = "(ADMASS('D0') < 50.0*MeV)"\
                               "& (PT > 1.00*GeV)"\
                               "& (VFASPF(VCHI2/VDOF)< 10.0)"\
                               "& (BPVDIRA > 0.9999)"\
                               "& (BPVVDCHI2 > 12)"
            self.setOptions(d02kpi)
            d02kpiSel = Selection(d02kpiName + 'Sel',
                                  Algorithm=d02kpi,
                                  RequiredSelections=[trackfilterSel])

            # Make the D*
            dstar2d0piName = self.__sel_name__
            dstar2d0pi = CombineParticles(dstar2d0piName)
            dstar2d0pi.DecayDescriptor = "[ D*(2010)+ -> D0 pi+ ]cc"
            dstar2d0pi.CombinationCut = "(ADAMASS('D*(2010)+') < 100*MeV)"
            dstar2d0pi.MotherCut = "(ADMASS('D*(2010)+') < 50.0*MeV)"\
                                   "& (PT > 2.2*GeV)"\
                                   "& (VFASPF(VCHI2/VDOF)< 15.0)"\
                                   "& (M-MAXTREE('D0'==ABSID,M)<155.5)"
            self.setOptions(dstar2d0pi)
            dstar2d0piSel = Selection(
                dstar2d0piName + 'Sel',
                Algorithm=dstar2d0pi,
                RequiredSelections=[d02kpiSel, pionfilterSel])

            # Selection Sequence
            selSeq = SelectionSequence(self.__sel_name__ + 'Seq',
                                       TopSelection=dstar2d0piSel)

            # Run the selection sequence.
            seq.Members += [selSeq.sequence()]

        # Particle Monitoring plots
        if self.getProp("RunMonitors"):
            from Configurables import ParticleMonitor
            plotter = ParticleMonitor(self.__sel_name__ + "Plots")
            if self.getProp("RunSelection"):
                plotter.Inputs = ['Phys/' + self.__sel_name__ + 'Sel']
            else:
                plotter.Inputs = self.getProp("Candidates")
            plotter.PeakCut     = "(M-MAXTREE('D0'==ABSID,M)<147.43) "\
                                  "& (M-MAXTREE('D0'==ABSID,M)>143.43) "\
                                  "& (INTREE((ABSID=='D0') & (ADMASS('D0') < 15*MeV) ))"
            plotter.SideBandCut = "(M-MAXTREE('D0'==ABSID,M)>147.43) "\
                                  "& (M-MAXTREE('D0'==ABSID,M)<143.43) "\
                                  "& (INTREE((ABSID=='D0') & (ADMASS('D0') > 15*MeV) ))"
            plotter.PlotTools = self.getProp("PlotTools")
            self.setOptions(plotter)
            seq.Members += [plotter]

        # Make a DST ?
        if self.getProp("MakeSelDST"):

            # Prescale
            from Configurables import DeterministicPrescaler
            scaler = DeterministicPrescaler(
                self.__sel_name__ + 'PreScale',
                AcceptFraction=self.getProp("DSTPreScaleFraction"))
            seq.Members += [scaler]
            # Write the DST
            MyDSTWriter = SelDSTWriter(self.__sel_name__ + "DST",
                                       SelectionSequences=[selSeq],
                                       OutputPrefix=self.__sel_name__)
            seq.Members += [MyDSTWriter.sequence()]

        # MC Performance checking ?
        if self.getProp("MCChecks"):

            from Configurables import ParticleEffPurMoni
            mcPerf = ParticleEffPurMoni(dstar2d0piName + "MCPerf")
            mcPerf.Inputs = ["Phys/" + dstar2d0piName]
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]

        # Ntuple ?
        if self.getProp("MakeNTuple"): pass
示例#22
0
from Configurables import CombineParticles, FilterDesktop
from Configurables import TupleToolMCBackgroundInfo, TupleToolMCTruth, BackgroundCategory
from StrippingConf.StrippingLine import StrippingLine

########################################################################
B2DhOfflineDplus2KPiPi = CombineParticles("B2DhOfflineDplus2KPiPi")
B2DhOfflineDplus2KPiPi.InputLocations = [ "StdTightPions", "StdTightKaons" ]
B2DhOfflineDplus2KPiPi.DecayDescriptor = "[D+ -> K- pi+ pi+]cc"

B2DhOfflineDplus2KPiPi.DaughtersCuts = {"pi+" : "((PT > 300*MeV) & (P > 2*GeV) & (MIPCHI2DV(PRIMARY) > 9))" , "K+" :  "((PT> 300*MeV) & (P > 2*GeV) & (MIPCHI2DV(PRIMARY) > 9))"};
B2DhOfflineDplus2KPiPi.CombinationCut = "( (ADAMASS('D+') < 21*MeV) & (APT > 2.*GeV) )";
B2DhOfflineDplus2KPiPi.MotherCut = "((VFASPF(VCHI2/VDOF)<15) & (BPVVDCHI2>100.) & (MIPCHI2DV(PRIMARY)>9))";
########################################################################
B2DhOfflineBachelor = FilterDesktop("B2DhOfflineBachelor")
B2DhOfflineBachelor.InputLocations  = [ "StdLoosePions" ]
B2DhOfflineBachelor.Code = "((PT > 500*MeV) & (P > 2*GeV) & (MIPCHI2DV(PRIMARY) > 9))"
########################################################################
B2DhOfflineSel = CombineParticles("B2DhOfflineSel")
B2DhOfflineSel.InputLocations  = [   "B2DhOfflineDplus2KPiPi",
                                                 "B2DhOfflineBachelor"]
B2DhOfflineSel.DecayDescriptor  = "[B0 -> D+ pi-]cc"
B2DhOfflineSel.DaughtersCuts = { "D+" : "ALL" }
B2DhOfflineSel.CombinationCut = "(ADAMASS('B0')<50*MeV)"
B2DhOfflineSel.MotherCut = "(VFASPF(VCHI2/VDOF)<10) & (BPVIPCHI2()<16.) & (BPVVDCHI2 > 6.25) & (BPVDIRA>0.9999)"
########################################################################
B2DhOfflineFilterSequence = GaudiSequencer("B2DhOfflineFilterSequence")
B2DhOfflineFilterSequence.Members += [ B2DhOfflineDplus2KPiPi ]
B2DhOfflineFilterSequence.Members += [ B2DhOfflineBachelor ]
B2DhOfflineFilterSequence.Members += [ B2DhOfflineSel ]
########################################################################
########################################################################
示例#23
0
configurables. PV refitting is done. Based on roadmap selection
with loose PID cuts.
'''

from Gaudi.Configuration import *
from StrippingConf.StrippingLine import StrippingLine, StrippingMember
from Configurables import FilterDesktop, CombineParticles, OfflineVertexFitter
import GaudiKernel.SystemOfUnits as Units

#############################
# Standard Unbiased Phi->KK #
#############################
StdUnbiasedPhi2KK = FilterDesktop("StripStdUnbiasedPhi2KK")
StdUnbiasedPhi2KK.InputLocations = ["StdLooseUnbiasedPhi2KK"]
StdUnbiasedPhi2KK.Code = "  (MINTREE('K+'==ABSID, PIDK) > -5.0)" \
                         "& (ADMASS('phi(1020)') < 15.*MeV)" \
                         "& (PT > 1000.*MeV)" \
                         "& (VFASPF(VCHI2/VDOF) < 20.0)"
######
# Bs #
######
Bs2JpsiPhi = CombineParticles("StripBs2JpsiPhi")
Bs2JpsiPhi.DecayDescriptor = "B_s0 -> J/psi(1S) phi(1020)"
Bs2JpsiPhi.InputLocations = [
    "StdLTUnbiasedJpsi2MuMu", "StripStdUnbiasedPhi2KK"
]
# Set the OfflineVertexFitter to keep the 4 tracks and not the J/Psi Phi
Bs2JpsiPhi.addTool(OfflineVertexFitter())
Bs2JpsiPhi.VertexFitters.update({"": "OfflineVertexFitter"})
Bs2JpsiPhi.OfflineVertexFitter.useResonanceVertex = False
Bs2JpsiPhi.ReFitPVs = True
示例#24
0
# =============================================================================
__author__ = " Albert Bursche "
__date__ = " 2011-07-22 "
__version__ = "0.1"
# =============================================================================

# =============================================================================
"""
Select MC particles having a chance to pass the offline criteria. Needs updating if these citeria change.
"""

from Configurables import FilterDesktop
MCPartFilter = FilterDesktop("FilteredStableParticles")  #,OutputLevel = DEBUG)
MCPartFilter.InputLocations = ["Phys/StdHepMCParticles/Particles"]
MCPartFilter.Code = "(PT > 150*MeV) & (ETA >0)"  # corresponds to an 200 MeV cut on reco tracks
# eta cut for speed optimisation
OutputTightKaonList = "Phys/Tag_CharmTightKaonList/Particles"
OutputKSList = "Phys/Tag_CharmKSList/Particles"
OutputProtonList = "Phys/Tag_CharmProtonList/Particles"

CharmPreambulo = [
    "from LoKiPhysMC.decorators import *" ,
    "from LoKiPhysMC.functions import mcMatch",
    "from GaudiKernel.SystemOfUnits import *"
    ]

# =============================================================================

# PARTICLE LISTS #

Tag_CharmElecList = FilterDesktop("Tag_CharmElecList")
Tag_CharmElecList.Code = "(PT>100*MeV) & (P>1000*MeV) & (BPVIPCHI2() > 4.0) & (PROBNNe > 0.05) & (PROBNNmu < 0.35) & (PROBNNghost < 0.35)" 
Tag_CharmElecList.Inputs = [InputElecList]
Tag_CharmElecList.Output = OutputElecList
locations = updateDoD(Tag_CharmElecList)
#Tag_CharmRecSeq.Members += [Tag_CharmElecList]

Tag_CharmMuonList = FilterDesktop("Tag_CharmMuonList")
Tag_CharmMuonList.Code = "(PT>100*MeV) & (P>1000*MeV) & (BPVIPCHI2() > 4.0) & (PROBNNmu > 0.05) & (PROBNNe < 0.35) & (PROBNNghost < 0.35)" 
Tag_CharmMuonList.Inputs = [InputMuonList]
Tag_CharmMuonList.Output = OutputMuonList
locations.update(updateDoD(Tag_CharmMuonList))
#Tag_CharmRecSeq.Members += [Tag_CharmMuonList]

Tag_CharmPionList = FilterDesktop("Tag_CharmPionList")
Tag_CharmPionList.Code = "(PT>100*MeV) & (P>1000*MeV) & (BPVIPCHI2() > 4.0) & (PROBNNK < 0.35) & (PROBNNghost < 0.35)" 
Tag_CharmPionList.Inputs = [InputPionList]
示例#26
0
Jpsi2MuMu = AutomaticData(Location = location)

#----selection p+ and K- -------------------------
kaons = DataOnDemand(Location = "/Event/Phys/StdNoPIDsKaons/Particles")
protons = DataOnDemand(Location = "/Event/Phys/StdNoPIDsProtons/Particles")
Lambda0LL = DataOnDemand(Location = "/Event/Phys/StdLooseLambdaLL/Particles")
Lambda0DD = DataOnDemand(Location = "/Event/Phys/StdLooseLambdaDD/Particles")

#----Selection /\->p+ pi-


AllLambda0 = MergedSelection( "AllLambda0", RequiredSelections = [Lambda0LL, Lambda0DD])

_FilterL = FilterDesktop("_FilterL")
_FilterL.Code = "(ADMASS('Lambda0') < 30.*MeV)"\
                  "& (VFASPF(VCHI2/VDOF) < 12.0)"\
                  "& (ADWM( 'KS0' , WM( 'pi+' , 'pi-') ) > 20*MeV )"

FilterL = Selection( "FilterL",
                      Algorithm          = _FilterL ,
                      RequiredSelections = [ AllLambda0 ] )

#----Selection /\b -> J/psi p+ K-------------------
_Lb2JpsipK = CombineParticles( "_Lb2JpsipK",
                              DecayDescriptor = "[Lambda_b0 -> J/psi(1S) Lambda0]cc",
                              CombinationCut = "AM < 6000. * MeV",
                              MotherCut       = "(VFASPF(VCHI2/VDOF)<25) & (BPVDIRA > 0.999) & (VFASPF(VCHI2PDOF) < 10) & (BPVVD > 1.5 *mm)",
#                              DaughtersCuts   = {  'K-': DaughtCutK },
                              ReFitPVs        = True )

示例#27
0
"""
__author__ = "Greig Cowan"
__version__ = "CVS tag $Name: not supported by cvs2svn $, version $Revision: 1.2 $"
# =============================================================================
__all__ = ('StdLTUnbiasedJpsi2MuMu', 'locations')
# =============================================================================
from Gaudi.Configuration import *
from Configurables import FilterDesktop
from CommonParticles.Utils import *

## ============================================================================
StdLTUnbiasedJpsi2MuMu = FilterDesktop("StdLTUnbiasedJpsi2MuMu")
StdLTUnbiasedJpsi2MuMu.Inputs = ["Phys/StdLooseJpsi2MuMu/Particles"]
StdLTUnbiasedJpsi2MuMu.Code = "  (MINTREE('mu+'==ABSID, PT) > 500.*MeV)" \
                              "& (MINTREE('mu+'==ABSID, PIDmu) > -10.0)" \
                              "& (MAXTREE('mu+'==ABSID, PIDK) < 10.0)" \
                              "& (ADMASS('J/psi(1S)') < 50.*MeV)" \
                              "& (PT > 1000.*MeV)" \
                              "& (VFASPF(VCHI2) < 6.0)"

## configure Data-On-Demand service
locations = updateDoD(StdLTUnbiasedJpsi2MuMu)

## ============================================================================
if '__main__' == __name__:

    print __doc__
    print __author__
    print __version__
    print locationsDoD(locations)
示例#28
0
"""
Configuration file for Standard Loose Kstar2Kpi
"""

__author__ = 'Diego Martinez Santos, P. Koppenburg'
__date__ = '29/06/2009'

from Gaudi.Configuration import *
from Configurables import FilterDesktop
from CommonParticles.Utils import *
import GaudiKernel.SystemOfUnits as Units

###########################
# StdLooseDetachetKst2Kpi #
###########################

StdLooseDetachedKst2Kpi = FilterDesktop("StdLooseDetachedKst2Kpi")
StdLooseDetachedKst2Kpi.Inputs = ["Phys/StdVeryLooseDetachedKst2Kpi/Particles"]
StdLooseDetachedKst2Kpi.Code = "(MIPCHI2DV(PRIMARY)> 2.25)"
locations = updateDoD(StdLooseDetachedKst2Kpi)
示例#29
0
# =============================================================================
__author__ = "Albert Bursche"
__date__ = " 2011-07-22 "
__version__ = "0.1"
# =============================================================================

# =============================================================================
"""
Select a track sample for jet reconstruction. 
"""

from Configurables import FilterDesktop
SelectedTracks = FilterDesktop("FilteredPions")  #,OutputLevel = DEBUG)
SelectedTracks.InputLocations = [
    "/Event/Phys/StdNoPIDsPions/Particles", "Phys/StdNoPIDsDownPions/Particles"
]
SelectedTracks.Code = "(PT > 200*MeV) & (PERR2/(P*P) < 0.04) "
#SelectedTracks.Preambulo = [ "from LoKiProtoParticles.decorators import *"]