Example #1
0
    def __init__(self, name, config) :
        LineBuilder.__init__(self, name, config)
        self.name = name
        self.config = config


        _trackCuts = "((TRCHI2DOF< %(TrackChi2Ndof)s) & (TRGHOSTPROB< %(TrackGhostProb)s) & (MIPCHI2DV(PRIMARY)> %(TrackIPChi2)s)"% self.config
        _pionCuts = _trackCuts
        # _pionCuts += " & (PROBNNpi> %(PionProbNNpi)s ) & (PT> %(PionPT)s *MeV))"% self.config
        _pionCuts += " & ((PIDK - PIDpi)< %(PionPIDKpi)s ) & (PT> %(PionPT)s *MeV))"% self.config

        _kaonCuts = _trackCuts
        _kaonCuts += " & (P> %(KaonP)s *MeV)) & (PT> %(KaonPT)s *MeV)"% self.config

        _protonCuts = _trackCuts
        _protonCuts += " & ((PIDp-PIDpi)> %(ProtonPIDppi)s) & ((PIDp-PIDK)> %(ProtonPIDpK)s) & (P> %(ProtonP)s *MeV)) & (PT> %(ProtonPT)s *MeV)"%self.config


        self.PionForLb2Dp = SimpleSelection( "PionFor" + self.name, FilterDesktop, 
          [ DataOnDemand(Location = 'Phys/StdAllLoosePions/Particles') ],
          Code  = _pionCuts,
        )

        self.ProtonForLb2Dp = SimpleSelection( "ProtonFor" + self.name, FilterDesktop,
          [ DataOnDemand(Location = 'Phys/StdAllNoPIDsProtons/Particles') ],
          Code  = _protonCuts,
        )

        self.DeuteronForLb2Dp = SimpleSelection( "KaonFor" + self.name, FilterDesktop, 
          [ DataOnDemand(Location = 'Phys/StdAllNoPIDsKaons/Particles') ],
          Code  = _kaonCuts,
        )
        
        self.makeLb2Dp()
        self.makeLb2Dppipi()
Example #2
0
def DisplPhiPhi(conf):

    inputs = [AutomaticData(Location=conf['input'])]

    dc = (
        "TOS('%(TisTosSpec)s','Hlt1TriggerTisTos')"
        "& (PT > %(PhiPT)s) "
        "& (MINTREE('K+'==ABSID,PT) > %(KPT)s) "
        "& (MINTREE('K+'==ABSID,BPVIPCHI2()) > %(KIPChi2)s) "
        "& (MAXTREE('K+'==ABSID,TRGHOSTPROB) < %(GhostProb)s) "
        "& (MINTREE('K+'==ABSID,PROBNNK) > %(KProbNNk)s) "
        "& (VFASPF(VCHI2PDOF) < %(VChi2)s) "
        "& (in_range( PDGM('phi(1020)') - %(PhiMassWindow)s , M , PDGM('phi(1020)') + %(PhiMassWindow)s ) )"
    ) % conf

    mc = ("(HASVERTEX)"
          "& (VFASPF(VCHI2) < %(VChi2)s) "
          "& (BPVVDCHI2 > %(FDChi2)s)") % conf

    ## TOS on HLT2 on-demand
    if 'TOS_HLT2' in conf:
        mc += '& (TOS("%(TOS_HLT2)s", "Hlt2TriggerTisTos"))' % conf

    return SimpleSelection(
        'DisplPhiPhi',
        CombineParticles,
        inputs,
        DecayDescriptor='B0 -> phi(1020) phi(1020)',
        DaughtersCuts={'phi(1020)': dc},
        MotherCut=mc,
    )
Example #3
0
def makeCombination( name, daughters, mother ) :
    return SimpleSelection( name, CombineParticles, [StdAllLooseMuons],
        DecayDescriptor    = 'Z0 -> mu+ mu-',
        DaughtersCuts      = { 'mu+' : daughters, 'mu-' : daughters },
        MotherCut          = mother,
        WriteP2PVRelations = False,
    )
Example #4
0
    def make_selection(self, tag, algotype, inputs, *args, **kwargs):
        """
        Technical method for creation of 1-step selections 
        """
        sel_tag = '%s_Selection' % tag
        sel_name = 'Sel%sFor%s' % (tag, self.name())
        #
        ## check existing selection
        #
        sel = self._selection(sel_tag)
        if sel: return sel

        #
        ## adjust a bit the arguments
        if not kwargs.has_key('Preambulo'):
            kwargs['Preambulo'] = self['Preambulo']

        if not kwargs.has_key('ParticleCombiners'):
            kwargs['ParticleCombiners'] = {'': 'LoKi::VertexFitter:PUBLIC'}

        #
        ## use "simple-selection"
        #
        from PhysSelPython.Wrappers import SimpleSelection
        sel = SimpleSelection(sel_name, algotype, inputs, *args, **kwargs)
        #
        return self._add_selection(sel_tag, sel)
Example #5
0
def selection_tauiso(tau_noiso, conf):
    """
  Take single Selection containing heteregenous list of 'tau' (11,13,15,211),
  cut on isolation variable given for each tau type.

  The code is separated into 2 parts:
  1. Attach related info to given Selection: Phys/TauNoiso/Iso
  2. Perform actual cut

  Sadly, I couldn't find a way to add info without staging a new selection,
  so I use PassThroughSelection.

  """
    ## First part is attaching
    tool = RelInfoConeVariables('TauIsoInfo', ConeAngle=0.5)
    algo = AddRelatedInfo()
    algo.Inputs = [tau_noiso.outputLocation()]
    algo.Location = 'Iso'  # Use for chaining!
    algo.Tool = tool.getFullName()
    tau_withinfo = PassThroughSelection('TauInfo',
                                        Algorithm=algo,
                                        RequiredSelection=tau_noiso)

    ## Second part is filtering
    loc = tau_noiso.outputLocation().replace('/Particles', '/Iso')
    code = cut_iso_tau(loc, **conf)
    return SimpleSelection('TauIso', FilterDesktop, [tau_withinfo], Code=code)
Example #6
0
def makeFilter(name, single_input, code):
    return SimpleSelection(
        name,
        FilterDesktop,
        [single_input],
        Preambulo=["from LoKiTracks.decorators import *"],
        Code=code,
    )
Example #7
0
def wg_Upsilon_selection(year):
    """    
    get WG selection for Y->mu+mu (MC) 
    Essentially re-run stripping & WG-selection withotu muon-ID cuts 
    """
    if '2012' == year:
        import StrippingArchive.Stripping20.StrippingDiMuonNew as DiMuon
        import StrippingSettings.Stripping20.LineConfigDictionaries_BandQ as LineSettings
        logger.info('Use Stirpping20   settings')
    elif '2011' == year:
        import StrippingArchive.Stripping20r1.StrippingDiMuonNew as DiMuon
        import StrippingSettings.Stripping20r1.LineConfigDictionaries_BandQ as LineSettings
        logger.info('Use Stirpping20r1 settings')
    else:
        raise AttributeError, "Invalid year %s " % year

    #
    ## stripping line builder
    config = LineSettings.FullDSTDiMuon['CONFIG']

    ## switch off PID-cut !
    config['DiMuonHighMass_MuonPIDCut'] = ''
    logger.info('Switch PID-cuts for DiMuonHighMass line')

    ## use builder
    builder = DiMuon.DiMuonConf('FullDST', config)

    ## Y-selection at stripping DST
    strip_ups = builder.SelDiMuonHighMass
    logger.info("ALGO:\n" + str(strip_ups.algorithm()))

    # =============================================================================
    ## Upsilon -> mumu, cuts by  Giulia Manca
    # =============================================================================
    from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
    from PhysSelPython.Wrappers import SimpleSelection
    sel_ups = SimpleSelection(
        'Upsilon',
        FilterDesktop,
        [strip_ups],
        ## algorithm parameters
        Code="""
        ( M > 7 * GeV ) & 
        DECTREE   ('Meson -> mu+ mu-'  )                      &
        CHILDCUT( 1 , HASMUON & ISMUON )                      &
        CHILDCUT( 2 , HASMUON & ISMUON )                      & 
        ( MINTREE ( 'mu+' == ABSID , PT ) > 1 * GeV         ) &
        ( MAXTREE ( ISBASIC & HASTRACK , TRCHI2DOF ) < 4    ) & 
        ( MINTREE ( ISBASIC & HASTRACK , CLONEDIST ) > 5000 ) & 
        ( VFASPF  ( VPCHI2 ) > 0.5/100 ) 
        & ( abs ( BPV ( VZ    ) ) <  0.5 * meter     ) 
        & (       BPV ( vrho2 )   < ( 10 * mm ) ** 2 ) 
        """,
        Preambulo=["vrho2 = VX**2 + VY**2"],
        ReFitPVs=True)

    return sel_ups
Example #8
0
def SelWmu(name, conf, TOS_HLT2=None):
    """ 
  Define the W->mu selection 
  """
    ## Apply cuts, with TOS optionally
    code = '(PT>%(min_mu_pT)s) & (PT<%(max_mu_pT)s)' % conf
    if TOS_HLT2:
        code += "& (TOS('%s','Hlt2TriggerTisTos'))" % TOS_HLT2
    return SimpleSelection(name, FilterDesktop, [StdAllLooseMuons], Code=code)
Example #9
0
def selection_tau_single(config, preambulo, inputs, ttype):
    return SimpleSelection(
        'FiltTauCand_' + ttype,
        FilterDesktop,
        inputs,
        'LooseTauCand_' + ttype,
        Preambulo=preambulo0 + preambulo.split('\n'),
        Code=parse_cuts_auto(config),
    )
Example #10
0
def selection_filt(config, preambulo, sel, newname):
    """
  Given a selection, apply FilterDesktop on top of it, 
  with cuts from config to be parsed.
  """
    return SimpleSelection(
        newname,
        FilterDesktop,
        sel,
        Preambulo=preambulo0 + preambulo.split('\n'),
        Code=parse_cuts_auto(config),
    )
Example #11
0
def makeSSCombination(name, dcut, mcut):
    return SimpleSelection(
        name,
        CombineParticles,
        [StdAllLooseMuons],
        DecayDescriptor='[Z0 -> mu- mu-]cc',
        DaughtersCuts={
            'mu-': dcut,
            'mu+': dcut
        },
        MotherCut=mcut,
        WriteP2PVRelations=False,
    )
Example #12
0
def filterDiMuon( name,
                  inputs,
                  MuonPT,
                  MuonP,
                  MuonTRCHI2DOF,
                  MuMuMinMass,
                  MuMuVCHI2PDOF,
                  MuMuPT ):

  MuonCut = "(MINTREE('mu+'==ABSID,PT) > %(MuonPT)s) & (MINTREE('mu+'==ABSID,P) > %(MuonP)s) & (MAXTREE('mu+'==ABSID,TRCHI2DOF) < %(MuonTRCHI2DOF)s)" % locals()
  MuMuCut = "(MM > %(MuMuMinMass)s) & (VFASPF(VCHI2PDOF)< %(MuMuVCHI2PDOF)s) & (PT > %(MuMuPT)s)" % locals()
  code    = MuonCut + " & " + MuMuCut
  return SimpleSelection( name, FilterDesktop, inputs, Code=code)
Example #13
0
def DisplDiMuonNoPoint(conf, sharedDiMuon):
    code = ("(MINTREE('mu+'==ABSID,BPVIPCHI2()) > %(MuIPChi2)s)"
            "& (MINTREE('mu+'==ABSID,PROBNNmu) > %(MuProbNNmu)s)"
            "& (PT > %(PT)s)"
            "& (HASVERTEX)"
            "& (BPVVDCHI2 > %(FDChi2)s)") % conf

    ## TOS on HLT2 on-demand
    if 'TOS_HLT2' in conf:
        code += '& (TOS("%(TOS_HLT2)s", "Hlt2TriggerTisTos"))' % conf

    return SimpleSelection('DisplDiMuonNoPoint',
                           FilterDesktop,
                           sharedDiMuon,
                           Code=code)
Example #14
0
def selection_tau_h3(config, preambulo, inputs):
    dcut = parse_cuts_auto(config['dcuts'])
    return SimpleSelection(
        'FiltTauCand_h3',
        CombineParticles,
        inputs,
        'CombTauCand_h3',
        DecayDescriptor='[ tau- -> pi- pi- pi+ ]cc',
        Preambulo=preambulo0 + preambulo.split('\n'),
        DaughtersCuts={
            'pi-': dcut,
            'pi+': dcut
        },
        CombinationCut=parse_cuts_auto(config['ccuts']),
        MotherCut=parse_cuts_auto(config['mcuts']),
    )
Example #15
0
def QuadMuonNoIP(conf, sharedDiMuon):
    cc = "APT > %(PT)s" % conf
    mc = "(HASVERTEX) & (VFASPF(VCHI2) < %(VChi2)s)" % conf

    ## TOS on HLT2 on-demand
    if 'TOS_HLT2' in conf:
        mc += '& (TOS("%(TOS_HLT2)s", "Hlt2TriggerTisTos"))' % conf

    return SimpleSelection(
        'QuadMuonNoIP',
        CombineParticles,
        sharedDiMuon,
        DecayDescriptor='B0 -> KS0 KS0',
        CombinationCut=cc,
        MotherCut=mc,
    )
Example #16
0
def SelWe(name, conf, TOS_HLT2=None):
    """ 
  Define the W->e selection 
  """
    ## Quality cut.
    code = '(PT>%(min_e_pT)s) & (PT<%(max_e_pT)s)'\
            '& (PPINFO(LHCb.ProtoParticle.CaloPrsE,0)>%(PrsCalMin)s) '\
            '& (PPINFO(LHCb.ProtoParticle.CaloEcalE,0)>P*%(ECalMin)s) '\
            '& (PPINFO(LHCb.ProtoParticle.CaloHcalE,99999)<P*%(HCalMax)s)'\
            "& (HASTRACK & TRCUT(0<TrIDC('isTT')))"%conf
    ## Apply cuts, with TOS optionally
    if TOS_HLT2:
        code += "& (TOS('%s','Hlt2TriggerTisTos'))" % TOS_HLT2
    preambulo = ["from LoKiTracks.decorators import *"]
    return SimpleSelection(name,
                           FilterDesktop, [StdAllNoPIDsElectrons],
                           Code=code,
                           Preambulo=preambulo)
Example #17
0
def selection_ditau(config, preambulo, pcomb, dcname, decay, inputs):
    ## dcuts are quite complicate since it's a-priori nested dict index by particle-name.
    dcuts = {
        key: parse_cuts_auto(val)
        for key, val in doubling_sign_dict(config['dcuts']).iteritems()
    }
    return SimpleSelection(
        'SelDitau_' + dcname,
        GenCombineParticles,
        inputs,
        Preambulo=preambulo0 + preambulo.split('\n'),
        DecayDescriptor=decay,
        DaughtersCuts=dcuts,
        CombinationCut=parse_cuts_auto(config['ccuts']),
        MotherCut=parse_cuts_auto(config['mcuts']),
        ParticleCombiners=pcomb,
        # CombinationCut  = 'AALLSAMEBPV',  # BUGGY, don't use me!
    )
Example #18
0
def PrmptDiMuonHighMass(conf, sharedDiMuon):
    code = (
        '(M > %(M)s) &'
        "(MINTREE('mu+'==ABSID,PT) > %(MuPT)s) & (MINTREE('mu+'==ABSID,P) > %(MuP)s)"
        "& (MINTREE('mu+'==ABSID,BPVIPCHI2()) < %(MuIPChi2)s)"
        "& (MINTREE('mu+'==ABSID,PROBNNmu) > %(MuProbNNmu)s)"
        "& (PT > %(PT)s)"
        "& (HASVERTEX)"
        "& (BPVVDCHI2 < %(FDChi2)s)") % conf

    ## TOS on HLT2 on-demand
    if 'TOS_HLT2' in conf:
        code += '& (TOS("%(TOS_HLT2)s", "Hlt2TriggerTisTos"))' % conf

    return SimpleSelection('PrmptDiMuonHighMass',
                           FilterDesktop,
                           sharedDiMuon,
                           Code=code)
Example #19
0
def SharedDiMuonNoIP(conf):

    inputs = [AutomaticData(Location=conf['input'])]

    dc = ("(PT > %(MuPT)s) "
          "& (P > %(MuP)s) "
          "& (TRGHOSTPROB < %(GhostProb)s) "
          "& (PROBNNmu > %(MuProbNNmu)s) ") % conf
    cc = "(AMAXDOCA('') < %(DOCA)s)" % conf
    mc = "(VFASPF(VCHI2PDOF) < %(VChi2)s) " % conf

    return SimpleSelection(
        'SharedDiMuonNoIP',
        CombineParticles,
        inputs,
        DecayDescriptor="KS0 -> mu+ mu-",
        DaughtersCuts={
            'mu+': dc,
            'mu-': dc
        },
        CombinationCut=cc,
        MotherCut=mc,
    )
Example #20
0
# ============================================================================= 
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
from PhysSelPython.Wrappers                import SimpleSelection
sel_ups = SimpleSelection (
    'Upsilon'     ,
    FilterDesktop , 
    [ upss ]      , 
    ## algorithm parameters 
    Code     = """
    ( M > 7 * GeV ) & 
    DECTREE   ('Meson -> mu+ mu-'  )                      &
    CHILDCUT( 1 , HASMUON & ISMUON )                      &
    CHILDCUT( 2 , HASMUON & ISMUON )                      & 
    ( MINTREE ( 'mu+' == ABSID , PT ) > 1 * GeV         ) &
    ( MAXTREE ( ISBASIC & HASTRACK , TRCHI2DOF ) < 4    ) & 
    ( MINTREE ( ISBASIC & HASTRACK , CLONEDIST ) > 5000 ) & 
    ( VFASPF  ( VPCHI2 ) > 0.5/100 ) 
    & ( abs ( BPV ( VZ    ) ) <  0.5 * meter     ) 
    & (       BPV ( vrho2 )   < ( 10 * mm ) ** 2 ) 
    """ ,
    ##
    Preambulo = [
    "vrho2 = VX**2 + VY**2"
    ] ,
    ## 
    ReFitPVs = True
    ##
    )

# =============================================================================
## chi_b -> Upsilon gamma 
Example #21
0
from PhysConf.Filters import LoKi_Filters
fltrs = LoKi_Filters(STRIP_Code="""
   HLT_PASS_RE ( 'StrippingHeavyIonTopologyLowActivityLineDecision' )
   """)

from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles

##other selections
from StandardParticles import StdAllNoPIDsKaons as loosekaons

kaons = SimpleSelection(
    'kaons',
    FilterDesktop,
    [loosekaons],
    DecayDescriptor="[K+]cc",
    Code=(  #"(PIDK - PIDpi > 5) & "
        "(PT>50*MeV)"
        "& (TRGHOSTPROB<0.3)")
    #"& (MIPCHI2DV(PRIMARY) > 4)")
)

dcDiK = {}
dcDiK['K+'] = "(PT > 50.0) & (P > 500.0) & (TRGHOSTPROB < 0.3)"
combcutsDiK = "(AMAXDOCA('') < 0.5) & (in_range( 0, AM, 1200 ))"
parentcutsDiK = "(VFASPF(VCHI2PDOF) < 10)"

phis = SimpleSelection(
    'phis',
    CombineParticles,
    [kaons],
    DecayDescriptor="phi(1020) -> K+ K-",
Example #22
0
def configure(
        inputdata,  ## the list of input files  
        catalogs=[],  ## xml-catalogs (filled by GRID)
        castor=False,  ## use the direct access to castor/EOS ? 
        params={}):

    ## import DaVinci
    from Configurables import DaVinci
    ## delegate the actual configuration to DaVinci
    dv = DaVinci(DataType='2012',
                 InputType='DST',
                 Simulation=True,
                 TupleFile='Jascha.root',
                 DDDBtag='dddb-20130929-1',
                 CondDBtag='sim-20130522-1-vc-md100')

    from StandardParticles import StdAllLooseKaons as kaons
    from StandardParticles import StdAllLooseMuons as muons
    from StandardParticles import StdLooseResolvedPi0 as pi0

    decay = '[ B+ -> (J/psi(1S) =>  mu+  mu- )  ( K*(892)+ ->  K+  pi0 ) ]CC'
    decay_K = '[ B+ -> (J/psi(1S) =>  mu+  mu- )  ( K*(892)+ -> ^K+  pi0 ) ]CC'
    decay_Kst = '[ B+ -> (J/psi(1S) =>  mu+  mu- ) ^( K*(892)+ ->  K+  pi0 ) ]CC'
    decay_mu = '[ B+ -> (J/psi(1S) => ^mu+ ^mu- )  ( K*(892)+ -> ^K+  pi0 ) ]CC'
    decay_pi0 = '[ B+ -> (J/psi(1S) => ^mu+ ^mu- )  ( K*(892)+ ->  K+ ^pi0 ) ]CC'
    decay_gamma = '[ B+ -> (J/psi(1S) => ^mu+ ^mu- )  ( K*(892)+ ->  K+ (pi0 -> ^gamma ^gamma ) ) ]CC'

    from PhysSelPython.Wrappers import SimpleSelection
    from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
    #
    true_kaons = SimpleSelection(
        'MCTrueKaon',  ## selection name 
        FilterDesktop,  ## algorithm type
        [kaons],  ## input/required selection
        ## algorithm propperties
        Preambulo=["from LoKiPhysMC.decorators import *"],
        Code="mcMatch ('%s', 2 )" % decay_K)
    #
    true_muons = SimpleSelection(
        'MCTrueMuon',  ## selection name 
        FilterDesktop,  ## algorithm type
        [muons],  ## input/required selection
        ## algorithm propperties
        Preambulo=["from LoKiPhysMC.decorators import *"],
        Code="mcMatch ('%s', 2 )" % decay_mu)

    true_pi0 = SimpleSelection(
        'MCTruePi0',  ## selection name 
        FilterDesktop,  ## algorithm type
        [pi0],  ## input/required selection
        ## algorithm propperties
        Preambulo=["from LoKiPhysMC.decorators import *"],
        Code="""
        mcMatch ('%s')
        & CHILDCUT ( mcMatch ('%s') , 1 )
        & CHILDCUT ( mcMatch ('%s') , 2 )
        """ % (decay_pi0, decay_gamma, decay_gamma))

    from GaudiConfUtils.ConfigurableGenerators import CombineParticles
    sel_Kst = SimpleSelection(
        'SelKst',  ## name 
        CombineParticles,  ## algorithm type 
        [true_pi0, true_kaons],  ## input/required selections 
        ## algorithm propperties
        Preambulo=["from LoKiPhysMC.decorators import *"],
        ## the decays to be reconstructed
        DecayDescriptor='[K*(892)+ -> K+ pi0]cc',
        ## combination cut : mass window
        CombinationCut="""
        in_range ( 0.8 *  GeV ,  AM , 1.0 * GeV )
        """,
        ##      mother cut : require good vertex
        MotherCut="mcMatch ('%s' )" % decay_Kst)

    from GaudiConfUtils.ConfigurableGenerators import CombineParticles
    sel_Jpsi = SimpleSelection(
        'SelJpsi',  ## name 
        CombineParticles,  ## algorithm type 
        [true_muons],  ## input/required selections 
        ## the decays to be reconstructed
        DecayDescriptor='J/psi(1S) -> mu+ mu-',
        ## combination cut : mass window
        CombinationCut="""
        in_range ( 3.0 *  GeV ,  AM , 3.2 * GeV )
        """,
        ##      mother cut : require good vertex
        MotherCut="  VFASPF( VCHI2 ) <  10 ")

    from PhysSelPython.Wrappers import SelectionSequence
    SEQ_Kst = SelectionSequence('TRUEKSSTAR', sel_Kst)
    SEQ_Jpsi = SelectionSequence('TRUEPSI', sel_Jpsi)
    SEQ_K = SelectionSequence('TRUEK', true_kaons)

    alg_name = 'Jascha'
    ## add the name of Bender algorithm into User sequence sequence
    from Configurables import GaudiSequencer
    seq_lines = GaudiSequencer(
        'SEQ_lines',
        Members=[
            GaudiSequencer('K', Members=[SEQ_K.sequence()]),
            GaudiSequencer('PSI', Members=[SEQ_Jpsi.sequence()]),
            GaudiSequencer('KST', Members=[SEQ_Kst.sequence()]), alg_name
        ])

    dv.UserAlgorithms = [seq_lines]

    ## define the input data
    setData(inputdata, catalogs, castor)

    ## get/create application manager
    gaudi = appMgr()

    alg = Jascha(alg_name,
                 Inputs=[
                     SEQ_K.outputLocation(),
                     SEQ_Kst.outputLocation(),
                     SEQ_Jpsi.outputLocation(),
                     'Phys/StdLooseResolvedPi0/Particles'
                 ],
                 ParticleCombiners={'': 'LoKi::VertexFitter/TESTFIT:PUBLIC'},
                 VertexFitters={'': 'LoKi::VertexFitter/TESTFIT:PUBLIC'})

    return SUCCESS
Example #23
0
def configure(
        inputdata,  ## the list of input files  
        catalogs=[],  ## xml-catalogs (filled by GRID)
        castor=False,  ## use the direct access to castor/EOS ? 
        params={}):

    ## import DaVinci
    from Configurables import DaVinci

    decay = '[(D0 =>  K-  mu+ nu_mu) && ~(D0 --> K- (pi0|eta) mu+ nu_mu ... )]CC'
    decay_K = '[(D0 => ^K-  mu+ nu_mu) && ~(D0 --> K- (pi0|eta) mu+ nu_mu ... )]CC'
    decay_mu = '[(D0 =>  K- ^mu+ nu_mu) && ~(D0 --> K- (pi0|eta) mu+ nu_mu ... )]CC'

    from PhysConf.Filters import LoKi_Filters
    fltrs = LoKi_Filters(MC_Code="has ( MCDECTREE('%s') )" % decay,
                         MC_Preambulo=["from LoKiCore.functions import has"])

    ## delegate the actual configuration to DaVinci
    dv = DaVinci(DataType='2012',
                 EventPreFilters=fltrs.filters('MC-filter'),
                 InputType='DST',
                 Simulation=True,
                 TupleFile='Xuhao.root',
                 DDDBtag='Sim08-20130503-1',
                 CondDBtag='Sim08-20130503-1-vc-md100')

    ##
    ## reconstruct D0 -> K mu candidates
    ##
    from StandardParticles import StdAllLooseKaons as kaons
    from StandardParticles import StdAllLooseMuons as muons

    from PhysSelPython.Wrappers import SimpleSelection
    from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
    #
    true_kaons = SimpleSelection(
        'MCTrueKaon',  ## selection name 
        FilterDesktop,  ## algorithm type
        [kaons],  ## input/required selection
        ## algorithm propperties
        Preambulo=["from LoKiPhysMC.decorators import *"],
        Code="mcMatch ('%s', 2 )" % decay_K)
    #
    true_muons = SimpleSelection(
        'MCTrueMuon',  ## selection name 
        FilterDesktop,  ## algorithm type
        [muons],  ## input/required selection
        ## algorithm propperties
        Preambulo=["from LoKiPhysMC.decorators import *"],
        Code="mcMatch ('%s', 2 )" % decay_mu)

    from GaudiConfUtils.ConfigurableGenerators import CombineParticles
    sel_D0 = SimpleSelection(
        'SelD0',  ## name 
        CombineParticles,  ## algorithm type 
        [true_muons, true_kaons],  ## input/required selections 
        ## the decays to be reconstructed
        DecayDescriptor='[D0 -> K- mu+]cc',
        ## combination cut : mass window
        CombinationCut="""
        in_range ( 1 *  GeV ,  AM , 2 * GeV )
        """,
        ##      mother cut : require good vertex & some separation
        MotherCut="""
        ( VFASPF( VCHI2 ) <  10 ) &
        ( BPVVDCHI2       >   9 )  
        """,
    )

    from PhysSelPython.Wrappers import SelectionSequence
    SEQ_D0 = SelectionSequence('TRUED0', sel_D0)

    alg1_name = 'Lines'
    ## add the name of Bender algorithm into User sequence sequence
    from Configurables import GaudiSequencer
    seq_lines = GaudiSequencer('SEQ_lines',
                               Members=[SEQ_D0.sequence(), alg1_name])

    alg2_name = 'TisTosAlg'
    ## add the name of Bender algorithm into User sequence sequence
    from Configurables import GaudiSequencer
    seq_tistos = GaudiSequencer('SEQ_tistos',
                                Members=[SEQ_D0.sequence(), alg2_name])

    dv.UserAlgorithms = [seq_lines, seq_tistos]

    ## define the input data
    setData(inputdata, catalogs, castor)

    from BenderTools.Utils import silence, totalSilence
    silence()
    totalSilence()

    ## get/create application manager
    gaudi = appMgr()

    alg1 = Lines(alg1_name, Inputs=[SEQ_D0.outputLocation()])
    alg2 = Tistos(alg2_name, Inputs=[SEQ_D0.outputLocation()])

    return SUCCESS
Example #24
0
from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles

###########################
###### HLT-like SVs #######

from itertools import combinations_with_replacement

pids = ['K+', 'K-', 'KS0', 'Lambda0', 'Lambda~0']
basic = "(ABSID=='K+')"
combos = list(combinations_with_replacement(pids, 2))
decays = ['K*(892)0 -> ' + ' '.join(combo) for combo in combos]

kaons = SimpleSelection('kaons',
                        FilterDesktop, [loosekaons],
                        DecayDescriptor="[K+]cc",
                        Code=("(MIPCHI2DV(PRIMARY)>16.) "
                              "& (PT>500*MeV)"
                              "& (TRGHOSTPROB<0.2)"))

combKS = MergedSelection('combKS', RequiredSelections=[looseKSLL, looseKSDD])

combLambda = MergedSelection(
    'combLambda', RequiredSelections=[vlooseLambdaLL, looseLambdaDD])

allSVs = []

for decay in decays:
    inputs = []
    if 'K+' in decay or 'K-' in decay:
        inputs.append(kaons)
    if 'KS0' in decay:
Example #25
0
    #DQFLAGStag      = 'dq-20170627',
    EvtMax=-1  ##TODO
    #EvtMax          = 1000 ##TODO
)
db = CondDB(LatestGlobalTagByDataType='2016')
db.LocalTags["DQFLAGS"] = ["herschel-20161018"]

from StandardParticles import StdAllNoPIDsKaons as loosekaons

from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles
#from Configurables import FilterDesktop

kaons = SimpleSelection('kaons',
                        FilterDesktop, [loosekaons],
                        DecayDescriptor="[K+]cc",
                        Code=("(PIDK - PIDpi > 5)"
                              "& (TRGHOSTPROB<0.3)"))

dcDiK = {}
dcDiK['K+'] = "(TRGHOSTPROB < 0.3)"
combcutsDiK = "(in_range( 0, AM, 1200 ))"
parentcutsDiK = "ALL"

phis = SimpleSelection(
    'phis',
    CombineParticles,
    [kaons],
    DecayDescriptor="phi(1020) -> K+ K-",
    DaughtersCuts=dcDiK,
    CombinationCut=(combcutsDiK),
}
d0_comb = "(AMAXDOCA('') < 0.2*mm) & (ADAMASS('D0') < 100*MeV)"
# We can split long selections across multiple lines
d0_mother = ('(VFASPF(VCHI2/VDOF)< 9)'
             '& (BPVDIRA > 0.9997)'
             "& (ADMASS('D0') < 70*MeV)")

d0 = CombineParticles('Combine_D0',
                      DecayDescriptor='([D0 -> pi- K+]CC)',
                      DaughtersCuts=d0_daughters,
                      CombinationCut=d0_comb,
                      MotherCut=d0_mother)

d0_sel = Selection('Sel_D0', Algorithm=d0, RequiredSelections=[Pions, Kaons])

dstar_daughters = {'pi+': '(TRCHI2DOF < 3) & (PT > 100*MeV)'}
dstar_comb = "(ADAMASS('D*(2010)+') < 400*MeV)"
dstar_mother = ("(abs(M-MAXTREE('D0'==ABSID,M)-145.42) < 10*MeV)"
                '& (VFASPF(VCHI2/VDOF)< 9)')
dstar_sel = SimpleSelection('Sel_Dstar',
                            ConfigurableGenerators.CombineParticles,
                            [d0_sel, Pions],
                            DecayDescriptor='[D*(2010)+ -> D0 pi+]cc',
                            DaughtersCuts=dstar_daughters,
                            CombinationCut=dstar_comb,
                            MotherCut=dstar_mother)

dstar_seq = SelectionSequence('Dstar_Seq', TopSelection=dstar_sel)

DaVinci().UserAlgorithms += [dstar_seq.sequence()]
Example #27
0
    )
db = CondDB( LatestGlobalTagByDataType = '2016' )
db.LocalTags["DQFLAGS"] = [ "herschel-20161018" ]


from StandardParticles import StdAllNoPIDsKaons    as loosekaons
#from StandardParticles import StdAllLooseMuons as loosemuons

from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles
#from Configurables import FilterDesktop

kaons = SimpleSelection (
    'kaons'         ,
    FilterDesktop   ,
    [ loosekaons ]    ,
    DecayDescriptor = "[K+]cc",
    Code = ("(PIDK - PIDpi > 5)"
            "& (TRGHOSTPROB<0.3)")
    )

dcDiK = { }
dcDiK['K+'] = "ALL"
combcutsDiK = "(in_range( 0, AM, 1200 ))"
parentcutsDiK = "ALL"

phis = SimpleSelection (
    'phis',
    CombineParticles,
    [kaons],
    DecayDescriptor = "phi(1020) -> K+ K-",
    DaughtersCuts   = dcDiK,
Example #28
0
    }


from GaudiConfUtils.ConfigurableGenerators import DecayTreeTuple as TUPLE
from PhysSelPython.Wrappers                import SimpleSelection
rd_selection = SimpleSelection (
    'Tuple'
    , TUPLE
    , [ b2omega_selection ]
    ## Properties:
    , Decay    = '[B0]cc -> ^(J/psi(1S) -> ^mu+ ^mu-) ^(omega(782) -> ^pi+ ^pi- ^(pi0 -> ^gamma ^gamma) )'
    , ToolList = tupletools
    , Branches = {
        #
          'B0'      : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- )  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma) )"
        , 'Jpsi'    : "[B0]cc -> ^(J/psi(1S) ->  mu+  mu- )  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma) )"
        , 'muplus'  : "[B0]cc ->  (J/psi(1S) -> ^mu+  mu- )  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma) )"
        , 'muminus' : "[B0]cc ->  (J/psi(1S) ->  mu+ ^mu- )  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma) )"
        , 'omega'   : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- ) ^(omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma) )"
        , 'piplus'  : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- )  (omega(782) -> ^pi+  pi-  (pi0 ->  gamma  gamma) )"
        , 'piminus' : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- )  (omega(782) ->  pi+ ^pi-  (pi0 ->  gamma  gamma) )"
        , 'pizero'  : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- )  (omega(782) ->  pi+  pi- ^(pi0 ->  gamma  gamma) )"
        , 'gamma1'  : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- )  (omega(782) ->  pi+  pi-  (pi0 -> ^gamma  gamma) )"
        , 'gamma2'  : "[B0]cc ->  (J/psi(1S) ->  mu+  mu- )  (omega(782) ->  pi+  pi-  (pi0 ->  gamma ^gamma) )"
        }
    )

tuple_B2psiomega = rd_selection.algorithm()

for particle in ["B0", "Jpsi", "muplus", "muminus", "omega", "piplus", "piminus", "pizero", "gamma1", "gamma2"]:
    tuple_B2psiomega.addTool(TupleToolDecay, name = particle)
Example #29
0
    #EvtMax          =  1000, ##TODO
    #SkipEvents      = 340000 ##TODO
)
db = CondDB(LatestGlobalTagByDataType='2015')
db.LocalTags["DQFLAGS"] = ["herschel-20161018"]

from StandardParticles import StdAllNoPIDsKaons as loosekaons
from StandardParticles import StdAllLooseMuons as loosemuons

from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles
#from Configurables import FilterDesktop

kaons = SimpleSelection('kaons',
                        FilterDesktop, [loosekaons],
                        DecayDescriptor="[K+]cc",
                        Code=("(PIDK - PIDpi > 5)"
                              "& (TRGHOSTPROB<0.3)"))

dcDiK = {}
dcDiK['K+'] = "ALL"
combcutsDiK = "(in_range( 0, AM, 1200 ))"
parentcutsDiK = "ALL"

phis = SimpleSelection(
    'phis',
    CombineParticles,
    [kaons],
    DecayDescriptor="phi(1020) -> K+ K-",
    DaughtersCuts=dcDiK,
    CombinationCut=(combcutsDiK),