Esempio n. 1
0
def SelWDiJets(name, conf, desc, sel_W, TOS_HLT2=None):
    """
  Create the combination of W + DiJets
  """
    ## Create CombineParticle, with caveat on jet combining.
    DiJet = CombineParticles("Combine" + name)
    DiJet.ParticleCombiners = {"": "LoKi::VertexFitter"}
    DiJet.addTool(LoKi__VertexFitter, name="LoKi::VertexFitter")
    vfitter = getattr(DiJet, "LoKi::VertexFitter")
    vfitter.Jets = ""

    ## Apply cuts, with TOS optionally
    #  Asking AT LEAST one of the jet to be TOSed by given trigger.
    ccut = "AALLSAMEBPV "\
           "& ( dr_13 > %(dr_lepton_jet)s )"\
           "& ( dr_23 > %(dr_lepton_jet)s )" %conf
    if TOS_HLT2:
        cut_tos = "(TOS('%s','Hlt2TriggerTisTos'))" % TOS_HLT2
        cut_tosjet = '(ACHILDCUT({0}, 1) | ACHILDCUT({0}, 2))'.format(cut_tos)
        ccut += ('&' + cut_tosjet)

    DiJet.Preambulo = preambulo
    DiJet.DecayDescriptor = desc
    DiJet.DaughtersCuts = {"CELLjet": "(PT > %(min_jet_pT)s)" % conf}
    DiJet.CombinationCut = ccut
    DiJet.MotherCut = "ALL"

    return Selection(name,
                     Algorithm=DiJet,
                     RequiredSelections=[sel_W, StdJets])
Esempio n. 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
Esempio n. 3
0
    def makeDiJet(self, _name):

        DiJet = CombineParticles("Combine" + _name)
        DiJet.DecayDescriptor = "[H+ -> CELLjet CELLjet mu+]cc"
        DiJet.ParticleCombiners = {"": "LoKi::VertexFitter"}
        DiJet.addTool(LoKi__VertexFitter, name="LoKi::VertexFitter")
        vfitter = getattr(DiJet, "LoKi::VertexFitter")
        vfitter.Jets = ""

        DiJet.DaughtersCuts = {
            "CELLjet": " (PT > %(min_jet_pT)s * GeV ) " % self._config
        }

        DiJet.Preambulo = [
            "from GaudiKernel.SystemOfUnits import degree",
            "eta_1 = ACHILDFUN(1,ETA)",
            "eta_2 = ACHILDFUN(2,ETA)",
            "eta_3 = ACHILDFUN(3,ETA)",
            "phi_1 = ACHILDFUN(1,PHI)",
            "phi_2 = ACHILDFUN(2,PHI)",
            "phi_3 = ACHILDFUN(3,PHI)",

            ##
            "deta_13 = eta_1 - eta_3",
            "deta_23 = eta_2 - eta_3",

            ##
            "dphi_13 = phi_1 - phi_3 ",
            "dphi_23 = phi_2 - phi_3",

            ##
            "dphi_13 = switch ( dphi_13 >  180 * degree ,  dphi_13 - 180 * degree , dphi_13 ) ",
            "dphi_13 = switch ( dphi_13 < -180 * degree ,  dphi_13 + 180 * degree , dphi_13 ) ",
            "dphi_23 = switch ( dphi_23 >  180 * degree ,  dphi_23 - 180 * degree , dphi_23 ) ",
            "dphi_23 = switch ( dphi_23 < -180 * degree ,  dphi_23 + 180 * degree , dphi_23 ) ",

            ##
            "dr_13 = sqrt(deta_13**2 + dphi_13**2)",
            "dr_23 = sqrt(deta_23**2 + dphi_23**2)",
        ]

        DiJet.CombinationCut = "AALLSAMEBPV "\
                               "& ( dr_13 > %(dr_lepton_jet)s )"\
                               "& ( dr_23 > %(dr_lepton_jet)s )" %self._config

        DiJet.MotherCut = "ALL"

        requiredSelections = [self.sel_Wmu, StdJets]

        return Selection("Sel" + _name,
                         Algorithm=DiJet,
                         RequiredSelections=requiredSelections)
Esempio n. 4
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
Esempio n. 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'
    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
Esempio n. 6
0
    def makeDefault(self,name,type=0) :
        """
        H-->A0(mumu)A0(mumu) selection.
        Arguments:
        name        : name of the Selection.
        type        : 0 (prompt), 1 (simple), 2 (detached)
        """
        
        from Configurables import OfflineVertexFitter
        
        SelA1 = self.makeA1("A1"+name,type)
        
        H25 = CombineParticles("Combine_H25"+name)
        H25.DecayDescriptor = "H_10 -> KS0 KS0"
        H25.DaughtersCuts = {}

        # simple: do not cut in pT, cut tighter in DOCA, VCHI2
        if type==1:
            H25.CombinationCut = "(AMAXDOCA('')< %(HmaxDOCATight)s * mm )" %self.config_dict
            H25.MotherCut = "(VFASPF(VCHI2)< %(HVchi2Tight)s )" %self.config_dict
        

        # prompt or detached
        else:
            H25.CombinationCut = "(AMAXDOCA('')< %(HmaxDOCA)s * mm )" %self.config_dict
            H25.MotherCut = "(PT > %(HpT)s * MeV ) "\
                            "& (VFASPF(VCHI2)< %(HVchi2)s ) " %self.config_dict


        # in all cases, add mass in DeltaM between both A1s
        H25.Preambulo = ["M1 = ACHILDFUN(1,MM)",
                         "M2 = ACHILDFUN(2,MM)",                     
                         "DeltaM = abs(M1 - M2)"]
        H25.CombinationCut+= "& ( DeltaM < %(A1sDeltaMass)s * MeV )" %self.config_dict

        if self.debug_cuts:
            print "DEBUG - H cuts for type", type
            print H25.MotherCut
            print H25.CombinationCut
        
        return Selection( "SelH4mu"+name,
                          Algorithm = H25,
                          RequiredSelections=[SelA1] )
Esempio n. 7
0
def selection_tau_h3(Config, preambulo, inputs):
    config = Config['tau_h3']  ## Pickout tau_h3 config from big one.
    #
    dcut = parse_cuts_auto(config['dcuts'])
    algo = CombineParticles('CombTauNoiso_h3')
    algo.DecayDescriptor = '[ tau- -> pi- pi- pi+ ]cc'
    algo.Preambulo = preambulo0 + preambulo.split('\n')
    algo.DaughtersCuts = {'pi-': dcut, 'pi+': dcut}
    algo.CombinationCut = parse_cuts_auto(config['ccuts'])
    algo.MotherCut = parse_cuts_auto(config['mcuts'])
    #
    config_refit = Config['PVRefitter']
    if config_refit:
        tool = LoKi__PVReFitter('PVRefitter_tauh3', **config_refit)
        algo.ReFitPVs = True
        algo.IgnoreP2PVFromInputLocations = True
        algo.addTool(tool)
        algo.PVReFitters.update({'': 'LoKi::PVReFitter/PVRefitter_tauh3'})
    #
    return Selection('SelTauNoiso_h3',
                     Algorithm=algo,
                     RequiredSelections=inputs)
def configure ( inputdata        ,    ## the list of input files  
                catalogs = []    ,    ## xml-catalogs (filled by GRID)
                castor   = False ,    ## use the direct access to castor/EOS ? 
                params   = {}    ) :

    ## configure  Track <--> MC relation table  
    import LoKiPhysMC.Track2MC_Configuration
    import LoKiMC.MC
    
    ## import DaVinci 
    from Configurables import DaVinci, GaudiSequencer
    ## delegate the actual configurtaion to DaVinci 
    dv = DaVinci ( DataType   = '2011' ,
                   InputType  = 'MDST',
                   Lumi = True,
                   Simulation = True,
                   DDDBtag="MC11-20111102",
                   CondDBtag="sim-20111111-vc-md100",
                   HistogramFile = "mcd02kpi_tracks7_histo.root",
                   TupleFile = "mcd02kpi_tracks7_ntuple.root",
                   PrintFreq = 1000)
    

    from Configurables import DecayTreeTuple, FilterDesktop, TupleToolGeometry, CombineParticles
    from Configurables import MCDecayTreeTuple, TupleToolMCTruth, MCTupleToolHierarchy
    from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence, DataOnDemand
    from Configurables import CheckPV
    

    # First using CombineParticle to create the D0
    ################################################################################
    #from StandardParticles import  StdAllNoPIDsPions, StdAllNoPIDsKaons
    _pions = DataOnDemand(Location='Phys/StdAllNoPIDsPions/Particles')
    _kaons = DataOnDemand(Location='Phys/StdAllNoPIDsKaons/Particles')

    _d2kpi = CombineParticles("d2kpi")
    _d2kpi.DecayDescriptor = "[D0 -> K- pi+]cc"
    _d2kpi.DaughtersCuts = { "K-"  : "(PT > 500.0) & (0.0 < PIDK)",
                             "pi+" : "(PT > 500.0) & (5.0 > PIDK)",
                             "K+"  : "(PT > 500.0) & (0.0 < PIDK)",
                             "pi-" : "(PT > 500.0) & (5.0 > PIDK) " }
    _d2kpi.MotherCut = "(VFASPF(VCHI2/VDOF)<10)"
    _d2kpi.CombinationCut = "(ADAMASS('D0') < 50.0)"
    _d2kpi.Preambulo = [ 
        "from LoKiPhysMC.decorators import *" ,
        "from PartProp.Nodes import CC"      ]
    #_d2kpi.ReFitPVs = True

    SelD2KPi = Selection( "SelD2KPi",
                          Algorithm= _d2kpi,
                          RequiredSelections=[_pions,_kaons] ) 
    
    SeqD2KPi = SelectionSequence('SeqD2KPi',TopSelection = SelD2KPi)

    
    # Now the CheckPV method to filter algorithms
    c = CheckPV("OnePV")
    c.MinPVs = 1

    # And a sequencer to put them together
    gseq = GaudiSequencer()
    gseq.Members = [ c, SeqD2KPi.sequence() ]
    
    ## define the input data
    setData  ( inputdata , catalogs , castor )
    
    ## get/create application manager
    gaudi = appMgr() 
    
    #
    ## modify/update the configuration:
    #
    
    ## (1) create the algorithm
    alg = TrackFilter( 'TrackFilter' )
    
    #seq = createSequencer()
    ## (2) replace the list of top level algorithm by
    #     new list, which contains only *THIS* algorithm
    gaudi.setAlgorithms( [ gseq, alg ] )
             
    return SUCCESS
Esempio n. 9
0
matchD02KKPi0     = "(mcMatch('[D0 ==> K- K+ pi0]CC'))"
matchD02KPiAnyPi0 = "(mcMatch('[D0 ==> K- pi+ {pi0}]CC'))"
matchD02KPiPi0    = "(mcMatch('[D0 ==> K- pi+ pi0]CC'))"


#Algorithms
StdMCD02KKPiPi=CombineParticles ('StdMCD02KKPiPi')
StdMCD02KKPiPi.Inputs = [ npkaons, nppions]
StdMCD02KKPiPi.DecayDescriptor = "[D0 -> K+ K- pi+ pi-]cc"
StdMCD02KKPiPi.MotherCut =  matchD02KKPiPi
#StdMCD02KKPiPi.DaughtersCuts = {
#		"K+" : matchKaons,
#		"pi+" : matchPions
#	}
StdMCD02KKPiPi.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]
locations.update(updateDoD ( StdMCD02KKPiPi ))

#Algorithms
StdMCD02KsKK=CombineParticles ('StdMCD02KsKK')
StdMCD02KsKK.Inputs = [ npkaons, mcksll, mcksdd]
StdMCD02KsKK.DecayDescriptor = "[D0 -> KS0 K+ K-]cc"
StdMCD02KsKK.MotherCut =  matchD02KsKK
#StdMCD02KsKK.DaughtersCuts = {
#		"K+" : matchKaons,
#		"KS0" : matchKshorts
#	}
StdMCD02KsKK.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]
Esempio n. 10
0
# =============================================================================
from Gaudi.Configuration import *
from Configurables import CombineParticles
from CommonParticles.Utils import *
from CommonMCParticles import *

## ============================================================================
## create the algorithm
StdMCJpsi2MuMu = CombineParticles("StdMCJpsi2MuMu")
StdMCJpsi2MuMu.Inputs = [npmuons]
StdMCJpsi2MuMu.DecayDescriptor = "J/psi(1S) -> mu+ mu-"
StdMCJpsi2MuMu.MotherCut = matchJpsi2MuMu
#tdMCJpsi2MuMu.DaughtersCuts = {"mu+" : matchmuons}
StdMCJpsi2MuMu.Preambulo = [
    "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC"
]

## configure Data-On-Demand service
locations.update(updateDoD(StdMCJpsi2MuMu))

## create the algorithm
StdMCpsi2s2MuMu = CombineParticles("StdMCpsi2s2MuMu")
StdMCpsi2s2MuMu.Inputs = [npmuons]
StdMCpsi2s2MuMu.DecayDescriptor = "psi(2S) -> mu+ mu-"
StdMCpsi2s2MuMu.MotherCut = matchpsi2s2MuMu
#tdMCpsi2s2MuMu.DaughtersCuts = {"mu+" : matchmuons}
StdMCpsi2s2MuMu.Preambulo = [
    "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC"
]
Esempio n. 11
0
                                 , Output = "Phys/MergedKaons/Particles"
                                 , WriteP2PVRelations = False
                                 , InputPrimaryVertices = "Rec/Vertex/Primary"
                                 )

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

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

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

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

combineAB = CombineParticles('CombineAB')
combineAB.DecayDescriptor = "B_s0 -> D_s- D_s+"
combineAB.MotherCut = "ALL"
combineAB.Preambulo = [
    "from LoKiPhysMC.decorators import *",
Esempio n. 12
0
}

StdLooseDplus2hhh.CombinationCut = """(APT>1.*GeV) & (ADOCACHI2CUT(50, '')) & (
                                      in_range(1769*MeV, mpipipi    , 2069 * MeV) | 
                                      in_range(1769*MeV, mKpipi     , 2069 * MeV) | 
                                      in_range(1769*MeV, mKKpi1     , 2069 * MeV) | 
                                      in_range(1769*MeV, mKKpi2     , 2069 * MeV) | 
                                      in_range(1769*MeV, mKpipiDCS1 , 2069 * MeV) |
                                      in_range(1769*MeV, mKpipiDCS2 , 2069 * MeV)
                                      )
                                    """
StdLooseDplus2hhh.MotherCut = "(VFASPF(VCHI2) < 30 )"
StdLooseDplus2hhh.Preambulo = [
    "mpipipi = AWM ('pi-'  , 'pi+', 'pi+' ) ",
    "mKpipi  = AWM ('K-'   , 'pi+', 'pi+' ) ",
    "mKKpi1  = AWM ('K-'   , 'K+' , 'pi+' ) ",
    "mKKpi2  = AWM ('K-'   , 'pi+', 'K+'  ) ",
    "mKpipiDCS1 = AWM ( 'pi-' , 'K+' , 'pi+'  )",
    "mKpipiDCS2 = AWM ( 'pi-' , 'pi+', 'K+'   )"
]
## configure Data-On-Demand service
locations = updateDoD(StdLooseDplus2hhh)

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

    print __doc__
    print __author__
    print __version__
    print locationsDoD(locations)

# =============================================================================
Esempio n. 13
0
sel_refit_Bminus2D0Mu = Selection(
    'SelMyRefitB-2D0Mu',
    Algorithm=FitDecayTrees(
        'MyRefitB-2D0Mu',
        Code="DECTREE('[B- -> (D0->K- pi+) mu-]CC')",
        UsePVConstraint=False,
    ),
    RequiredSelections=[sel_Bminus]
)

# B-_ws ########################################################################
# 'WS' means wrong-sign.
algo_Bminus_ws = CombineParticles('MyB-WS')
algo_Bminus_ws.DecayDescriptor = '[B+ -> D0 mu+]cc'  # D0 is WS, D~0 is correct.

algo_Bminus_ws.Preambulo = algo_Bminus.Preambulo
algo_Bminus_ws.DaughtersCuts = algo_Bminus.DaughtersCuts
algo_Bminus_ws.CombinationCut = algo_Bminus.CombinationCut
algo_Bminus_ws.MotherCut = algo_Bminus.MotherCut

sel_Bminus_ws = Selection(
    'SelMyB-WS',
    Algorithm=algo_Bminus_ws,
    RequiredSelections=[sel_D0, sel_Mu]
)

sel_refit_Bminus2D0Mu_ws = Selection(
    'SelMyRefitB-2D0MuWS',
    Algorithm=FitDecayTrees(
        'MyRefitB-2D0MuWS',
        Code="DECTREE('[B+ -> (D0->K- pi+) mu+]CC')",
Esempio n. 14
0
nppions = "Phys/StdMCPions/Particles"
npprotons = "Phys/StdMCProtons/Particles"
#matchProtons = "mcMatch( '[p+]cc' )"
#matchPions = "mcMatch( '[pi+]cc' )"
locations = {}
#Create matching strings
matchLambda02pPi = "(mcMatch('[Lambda0 ==> p+ pi-]CC'))"

## ============================================================================
## create the algorithm
StdMCLambda02pPi = CombineParticles("StdMCLambda02pPi")
StdMCLambda02pPi.Inputs = [nppions, npprotons]
StdMCLambda02pPi.DecayDescriptor = "[Lambda0 -> p+ pi-]cc"
StdMCLambda02pPi.MotherCut = matchLambda02pPi
#StdMCLambda02pPi.DaughtersCuts = {"p+" : matchProtons,"pi+" : matchPions}
StdMCLambda02pPi.Preambulo = [
    "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC"
]

## configure Data-On-Demand service
locations.update(updateDoD(StdMCLambda02pPi))

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

    print __doc__
    print __author__
    print __version__
    print locationsDoD(locations)
Esempio n. 15
0
myseq.Members +=[myprotos,charged]
DaVinci().UserAlgorithms+=[myseq]

##
def get_mcpar(proto):
    LinkRef = GaudiPython.gbl.LHCb.LinkReference()
    linker = TES["Link/Rec/ProtoP/MyProtoParticles/PP2MC"]
    ok = linker.firstReference(proto.key(), None ,LinkRef)
    if not ok: return 0
    return TES["MC/Particles"][LinkRef.objectKey()]


## DOWN DOWN KS0
MyMuonsDown = DataOnDemand(Location = 'Phys/StdNoPIDsDownMuons')
Ks2MuMuDown = CombineParticles("MCSel_Ks2MuMuDown")
Ks2MuMuDown.Preambulo=["from LoKiPhysMC.decorators import *",
                       "from LoKiPhysMC.functions import mcMatch"]
## build KS0->pipi
Ks2MuMuDown.DecayDescriptor = "KS0 -> mu+ mu-"
## only select real KS0s, matched to MCTruth muons
Ks2MuMuDown.DaughtersCuts = {"mu+"  : " mcMatch( '[mu+]cc' )" }
Ks2MuMuDown.MotherCut = " mcMatch('KS0 ==>  mu+ mu-' )"
Ks2MuMuDown.Inputs =['Phys/StdNoPIDsDownMuons']
DaVinci().UserAlgorithms +=[Ks2MuMuDown] ## downstream pions




DaVinci().EvtMax = 0
DaVinci().DataType = "Upgrade"
DaVinci().Simulation = True
DaVinci().DDDBtag  = "upgrade/dddb-20171126"
Esempio n. 16
0
DpCombCut = "(ADAMASS('D+')<100*MeV) & (ADOCAMAX('')<0.5*mm)"
DstCombCut = "(ADAMASS('D*(2010)+')<50*MeV) & (ADOCAMAX('')<0.5*mm)"
LCCombCut = "(ADAMASS('Lambda_c+')<110*MeV) & (ADOCAMAX('')<0.5*mm)"

DMotherCut = "(VFASPF(VCHI2/VDOF)<10) & (BPVVDCHI2>25) & (BPVDIRA>0.998)"
D0MotherCut = "(ADMASS('D0')<50*MeV) & " + DMotherCut
DpMotherCut = "(ADMASS('D+')<50*MeV) & " + DMotherCut
DstMotherCut = "(M-MAXTREE('D0'==ABSID,M)<165.5) & (VFASPF(VCHI2/VDOF)<25) & (BPVVDCHI2>25) & (BPVDIRA>0.998)"
LCMotherCut = "(ADMASS('Lambda_c+')<100*MeV) & (VFASPF(VCHI2/VDOF)<10) & (BPVVDCHI2>25) & (BPVDIRA>0.998)"

# =============================================================================
# D0 -> K Pi #

Tag_StdD02KPi = CombineParticles("Tag_StdD02KPi")
Tag_StdD02KPi.ParticleCombiners = {'' : 'LoKi::VertexFitter:PUBLIC' }
Tag_StdD02KPi.Preambulo = CharmPreambulo
Tag_StdD02KPi.DecayDescriptors = ["[D0 -> K- pi+]cc"]
Tag_StdD02KPi.CombinationCut = D0CombCut
Tag_StdD02KPi.MotherCut = D0MotherCut
Tag_StdD02KPi.Inputs = [OutputKaonList, OutputPionList]
Tag_StdD02KPi.Output = "Phys/" + Tag_StdD02KPi.name() + "/Particles"
locations.update(updateDoD(Tag_StdD02KPi))
#Tag_CharmRecSeq.Members += [Tag_StdD02KPi]

# =============================================================================
# D0 -> K Pi Pi Pi #

Tag_StdD02KPiPiPi = CombineParticles ("Tag_StdD02KPiPiPi")
Tag_StdD02KPiPiPi.ParticleCombiners = {'' : 'LoKi::VertexFitter:PUBLIC' }
Tag_StdD02KPiPiPi.Preambulo = CharmPreambulo
Tag_StdD02KPiPiPi.DecayDescriptors = ["[D0 -> K- pi+ pi+ pi-]cc"]
Esempio n. 17
0
#locations of nopidsparticles: 

nppions =  "Phys/StdMCPions/Particles"
npdownpions =  "Phys/StdMCDownPions/Particles"
#Create matching strings
locations={}
matchKs = "(mcMatch('[KS0]cc ==> pi+ pi-'))"

## create the algorithm
StdMCKsLL = CombineParticles("StdMCKsLL")
StdMCKsLL.Inputs = [nppions]
StdMCKsLL.DecayDescriptor = "[KS0 -> pi+ pi-]cc"
StdMCKsLL.MotherCut = matchKs
#StdMCKsLL.DaughtersCuts = {"pi+" : matchpions}
StdMCKsLL.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]

## configure Data-On-Demand service
locations.update(updateDoD ( StdMCKsLL ))


## create the algorithm
StdMCKsDD = CombineParticles("StdMCKsDD")
StdMCKsDD.Inputs = [npdownpions]
StdMCKsDD.DecayDescriptor = "[KS0 -> pi+ pi-]cc"
StdMCKsDD.MotherCut = matchKs
#StdMCKsDD.DaughtersCuts = {"pi+" : matchpions}
StdMCKsDD.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]
Esempio n. 18
0
########################

## build all possible combinations of track types
combs = {"LL":"( ANUM( ( TRTYPE == 3 ) &  ( ABSID == 'e-' ) ) == 2 )",
         "UU":"( ANUM( ( TRTYPE == 4 ) &  ( ABSID == 'e-' ) ) == 2 )",
         "VV":"( ANUM( ( TRTYPE == 1 ) & ( ABSID == 'e-' ) ) == 2 )",
         "LU":"( ( ANUM( ( TRTYPE == 3 ) &  ( ABSID == 'e-' ) ) == 1 ) & ( ANUM( ( TRTYPE == 4 ) & ( ABSID == 'e-' ) ) == 1 ) )",
         "LV":"( ( ANUM( ( TRTYPE == 3 ) &  ( ABSID == 'e-' ) ) == 1 ) & ( ANUM( ( TRTYPE == 1 ) & ( ABSID == 'e-' ) ) == 1 ) )",
         "UV":"( ( ANUM( ( TRTYPE == 4 ) &  ( ABSID ==  'e-' ) ) == 1 ) & ( ANUM( ( TRTYPE == 1 ) & ( ABSID == 'e-' ) ) == 1 ) )"}

## build combinations
Ks2pipiee = {}
for name in combs:
    Ks2pipiee[name] = CombineParticles("TrackSel"+name+"_Ks2pipiee")
    Ks2pipiee[name].DecayDescriptor = "KS0 -> pi+ pi- e+ e-"
    Ks2pipiee[name].Preambulo=["from LoKiPhysMC.decorators import *",
                               "from LoKiPhysMC.functions import mcMatch"]
    ## only take pions mctruth matched to pions from signal...
    Ks2pipiee[name].DaughtersCuts = {"pi+"  : "mcMatch('KS0 ==>  ^pi+ pi- e+ e-' )",
                                     "pi-"  : "mcMatch('KS0 ==>  pi+ ^pi- e+ e-' )"}
    Ks2pipiee[name].CombinationCut = combs[name]
    Ks2pipiee[name].MotherCut = "ALL"
    ## input all possible daughters
    Ks2pipiee[name].Inputs =['Phys/StdAllNoPIDsPions', 'Phys/StdAllNoPIDsElectrons', 'Phys/StdNoPIDsUpElectrons', 'Phys/StdNoPIDsVeloElectrons']
    DaVinci().UserAlgorithms +=[Ks2pipiee[name]]

DaVinci().EvtMax = 0
DaVinci().DataType = "2016"
DaVinci().Simulation = True

HOME = "/eos/lhcb/wg/RD/K0S2pipiee/dsts/MC2016/Priv/Sim09cMagUpLDST/"
DaVinci().Input = map(lambda x: 'PFN:root://eoslhcb.cern.ch/'+HOME+x,os.listdir(HOME))
Esempio n. 19
0
matchD02KPi = "(mcMatch('[D0 ==> K- pi+ ]CC'))"
matchD02KK = "(mcMatch('[D0 ==> K- K+ ]CC'))"
matchD02PiPi = "(mcMatch('[D0 ==> pi- pi+ ]CC'))"
matchD02KPiDCS = "(mcMatch('[D0 ==> K+ pi- ]CC'))"

#Algorithms
StdMCD02KPi = CombineParticles('StdMCD02KPi')
StdMCD02KPi.Inputs = [npkaons, nppions]
StdMCD02KPi.DecayDescriptor = "[D0 -> K- pi+ ]cc"
StdMCD02KPi.MotherCut = matchD02KPi
#StdMCD02KPi.DaughtersCuts = {
#		"K+" : matchKaons,
#		"pi+" : matchPions
#	}
StdMCD02KPi.Preambulo = [
    "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC"
]
locations.update(updateDoD(StdMCD02KPi))

StdMCD02KK = CombineParticles('StdMCD02KK')
StdMCD02KK.Inputs = [npkaons]
StdMCD02KK.DecayDescriptor = "[D0 -> K- K+ ]cc"
StdMCD02KK.MotherCut = matchD02KK
#StdMCD02KK.DaughtersCuts = {
#		"K+" : matchKaons
#	}
StdMCD02KK.Preambulo = [
    "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC"
]
locations.update(updateDoD(StdMCD02KK))
Esempio n. 20
0
nppions =  "Phys/StdMCPions/Particles"
npkaons =  "Phys/StdMCKaons/Particles"
#matchKaons = "mcMatch( '[K+]cc' )"
#matchpions = "mcMatch( '[pi+]cc' )"
locations={}
#Create matching strings
matchKstar = "(mcMatch('[K*(892)0 ==> K+ pi-]CC'))"

## create the algorithm
StdMCKstar = CombineParticles("StdMCKstar")
StdMCKstar.Inputs = [nppions, npkaons]
StdMCKstar.DecayDescriptor = "[K*(892)0 -> K+ pi-]cc"
StdMCKstar.MotherCut = matchKstar
#StdMCKstar.DaughtersCuts = {"K+" : matchKaons, "pi+" : matchpions}
StdMCKstar.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]

## configure Data-On-Demand service
locations.update(updateDoD ( StdMCKstar ))

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

    print __doc__
    print __author__
    print __version__
    print locationsDoD ( locations )


Esempio n. 21
0
matchDpPiPiPi = "(mcMatch('[D+ ==> pi- pi+ pi+]CC'))"
matchDpKKK = "(mcMatch('[D+ ==> K- K+ K+]CC'))"
matchDpKPiPiOppSignPi = "(mcMatch('[D- ==> K- pi+ pi-]CC'))"
matchDpKKPiOppSignK = "(mcMatch('[D- ==> K- K+ pi-]CC'))"

#Algorithms
StdMCDplus2KPiPi=CombineParticles ('StdMCDplus2KPiPi')
StdMCDplus2KPiPi.Inputs = [ npkaons, nppions]
StdMCDplus2KPiPi.DecayDescriptor = "[D+ -> K- pi+ pi+]cc"
StdMCDplus2KPiPi.MotherCut =  matchDpKPiPi
#StdMCDplus2KPiPi.DaughtersCuts = {
#	"K+" : matchKaons,
#	"pi+" : matchPions
#	}
StdMCDplus2KPiPi.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]
locations.update( updateDoD ( StdMCDplus2KPiPi ) )


StdMCDplus2KKPi=CombineParticles ('StdMCDplus2KKPi')
StdMCDplus2KKPi.Inputs = [ npkaons, nppions]
StdMCDplus2KKPi.DecayDescriptor = "[D+ -> K+ K+ pi-]cc"
StdMCDplus2KKPi.MotherCut =  matchDpKKPi
#StdMCDplus2KKPi.DaughtersCuts = {
#	"K+" : matchKaons,
#	"pi+" : matchPions	
#	}
StdMCDplus2KKPi.Preambulo = [
    "from LoKiPhysMC.decorators import *",
    "from PartProp.Nodes import CC" ]
Esempio n. 22
0
from Configurables import CombineParticles, DecayTreeTuple
from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

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

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

#selD2KKPiOther.OutputLevel = 1

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

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

othertuple.addTupleTool('TupleToolKinematic')