Пример #1
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)
        self.__confdict__ = config

        ####################### BASIC FINAL STATE PARTICLE SELECTIONS ##########################

        self.HadronCuts = "(P>%(HadronP)s) & (PT > %(HadronPT)s )"\
            "& (TRCHI2DOF < %(TRCHI2)s)"\
            "& (TRGHOSTPROB < %(TRGHOSTPROB)s)"\
            "& (MIPCHI2DV(PRIMARY)> %(HadronIPCHI2)s)" % config

        self.MuonTrackCuts = "(PT > %(MuonPT)s ) & (P> %(MuonP)s)"\
            "& (TRCHI2DOF < %(TRCHI2)s)"\
            "& (TRGHOSTPROB < %(TRGHOSTPROB)s)"\
            "& (MIPCHI2DV(PRIMARY)> %(MuonIPCHI2)s)" %config

        inputs = {
            "muons": StdLooseMuons,
            "pions": StdLoosePions,
            "kaons": StdLooseKaons,
            "protons": StdLooseProtons,
            "electrons": StdLooseElectrons,
            "fakemuons": StdNoPIDsMuons
        }

        if config["UseNoPIDsInputs"] == True:
            inputs["muons"] = StdNoPIDsMuons
            inputs["pions"] = StdNoPIDsPions
            inputs["kaons"] = StdNoPIDsKaons
            inputs["protons"] = StdNoPIDsProtons

        self.cuts = {"muons":self.MuonTrackCuts + " & (PIDmu > %(MuonPIDmu)s)" % config,
                     "fakemuons":self.MuonTrackCuts + " & (INMUON) & (PIDmu < %(MuonPIDmu)s)" % config,
                     "kaons":self.HadronCuts + " & (P>%(KaonP)s) & (PIDK> %(KaonPIDK)s)" % config,
                     "pions":self.HadronCuts + " & (PIDK< %(PionPIDK)s)" % config,
                     "protons":self.HadronCuts + "& (P>%(ProtonP)s)"\
                         "& (PIDp > %(ProtonPIDp)s) & (PIDp-PIDK > %(ProtonPIDpK)s)" % config,
                     "electrons":self.MuonTrackCuts + " & (PT> %(ElectronPT)s) & (PIDe > %(ElectronPIDe)s)" % config
                     }

        self.selMuon = Selection(
            "Mufor" + name,
            Algorithm=FilterDesktop(Code=self.cuts["muons"]),
            RequiredSelections=[inputs["muons"]])

        self.selKaon = Selection(
            "Kfor" + name,
            Algorithm=FilterDesktop(Code=self.cuts["kaons"]),
            RequiredSelections=[inputs["kaons"]])

        self.selPion = Selection(
            "Pifor" + name,
            Algorithm=FilterDesktop(Code=self.cuts["pions"]),
            RequiredSelections=[inputs["pions"]])

        self.selProton = Selection(
            "ProtonsFor" + name,
            Algorithm=FilterDesktop(Code=self.cuts["protons"]),
            RequiredSelections=[inputs["protons"]])

        self.selElectron = Selection(
            "efor" + name,
            Algorithm=FilterDesktop(Code=self.cuts["electrons"]),
            RequiredSelections=[inputs["electrons"]])

        self.selMuonFakes = Selection(
            "FakeMuonsFor" + name,
            Algorithm=FilterDesktop(Code=self.cuts["fakemuons"]),
            RequiredSelections=[inputs["fakemuons"]])

        D0_CONFIG = config.copy()
        D0_CONFIG[
            "CharmComboCuts"] = "(ADAMASS('D0') < %(D_AMassWin)s )" % config
        D0_CONFIG[
            "CharmMotherCuts"] = "(ADMASS('D0') < %(D_MassWin)s )" % config

        Dp_CONFIG = config.copy()
        Dp_CONFIG["CharmComboCuts"] = "(DAMASS('D_s+') < %(D_AMassWin)s )"\
            "& (DAMASS('D+')> -%(D_AMassWin)s )" %config
        Dp_CONFIG["CharmMotherCuts"] = "(DMASS('D_s+') < %(D_MassWin)s )"\
            "& (DMASS('D+')> -%(D_AMassWin)s )" %config

        Lc_CONFIG = config.copy()
        Lc_CONFIG[
            "CharmComboCuts"] = "(ADAMASS('Lambda_c+') < %(D_AMassWin)s )" % config
        Lc_CONFIG[
            "CharmMotherCuts"] = "(ADMASS('Lambda_c+') < %(D_MassWin)s )" % config

        Xic_CONFIG = config.copy()
        Xic_CONFIG[
            "CharmComboCuts"] = "(ADAMASS('Xi_c+') < %(D_AMassWin)s )" % config
        Xic_CONFIG[
            "CharmMotherCuts"] = "(ADMASS('Xi_c+') < %(D_MassWin)s )" % config

        Omegac_CONFIG = config.copy()
        Omegac_CONFIG["CharmComboCuts"] = "((ADAMASS('Omega_c0') < %(D_AMassWin)s )"\
            "|(ADAMASS('Xi_c+') < %(D_AMassWin)s ))" % config
        Omegac_CONFIG["CharmMotherCuts"] = "((ADMASS('Omega_c0') < %(D_MassWin)s )"\
            "|(ADMASS('Xi_c+') < %(D_MassWin)s ))"  % config

        self.b2D0MuXLine = BtoDlnuLine(
            name, 'D0', ['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            ['[D0 -> K- pi+]cc'], D0_CONFIG, [self.selKaon, self.selPion],
            self.selMuon, self.selMuonFakes)

        self.b2D0eXLine = BtoDlnuLine(name, 'D0e', ['[B- -> D0 e-]cc'],
                                      ['[D0 -> K- pi+]cc'], D0_CONFIG,
                                      [self.selKaon, self.selPion],
                                      self.selElectron)

        self.b2D0MuXKKLine = BtoDlnuLine(
            name, 'D0toKK', ['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            ['D0 -> K- K+'], D0_CONFIG, [self.selKaon], self.selMuon)

        self.b2D0MuXpipiLine = BtoDlnuLine(
            name, 'D0topipi', ['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            ['D0 -> pi- pi+'], D0_CONFIG, [self.selPion], self.selMuon)

        self.b2DpMuXLine = BtoDlnuLine(
            name, 'Dp', ['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            ['[D+ -> K- pi+ pi+]cc'], Dp_CONFIG, [self.selKaon, self.selPion],
            self.selMuon, self.selMuonFakes)

        self.b2DsMuXLine = BtoDlnuLine(
            name, 'Ds', ['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            ['[D+ -> K+ K- pi+]cc'], Dp_CONFIG, [self.selKaon, self.selPion],
            self.selMuon, self.selMuonFakes)

        self.lb2LcMuXLine = BtoDlnuLine(name, "Lc", [
            '[Lambda_b0 -> Lambda_c+ mu-]cc', '[Lambda_b0 -> Lambda_c+ mu+]cc'
        ], ['[Lambda_c+ -> K- p+ pi+]cc'
            ], Lc_CONFIG, [self.selProton, self.selKaon, self.selPion],
                                        self.selMuon, self.selMuonFakes)
        self.Xic_Line = BtoDlnuLine(
            name, "Xic", ['[Xi_b0 -> Xi_c+ mu-]cc', '[Xi_b0 -> Xi_c+ mu+]cc'],
            ['[Xi_c+ -> K- p+ pi+]cc'], Xic_CONFIG,
            [self.selProton, self.selKaon, self.selPion], self.selMuon,
            self.selMuonFakes)

        self.Omegac_Line = BtoDlnuLine(
            name, "Omegac",
            ['[Omega_b- -> Omega_c0 mu-]cc', '[Omega_b- -> Omega_c0 mu+]cc'],
            ['[Omega_c0 -> p+ K- K- pi+]cc'], Omegac_CONFIG,
            [self.selProton, self.selKaon, self.selPion], self.selMuon,
            self.selMuonFakes)

        ##### line registration
        self.registerLine(self.b2D0eXLine)
        for Mu in ["RealMuon", "FakeMuon"]:
            self.registerLine(self.b2D0MuXLine[Mu])
            self.registerLine(self.b2DpMuXLine[Mu])
            self.registerLine(self.b2DsMuXLine[Mu])
            self.registerLine(self.lb2LcMuXLine[Mu])
            self.registerLine(self.Omegac_Line[Mu])
            self.registerLine(self.Xic_Line[Mu])
Пример #2
0
 def createSubSel( self, OutputList, InputList, Cuts ) :
     '''create a selection using a FilterDesktop'''
     filter = FilterDesktop(Code = Cuts)
     return Selection( OutputList,
                       Algorithm = filter,
                       RequiredSelections = [ InputList ] )
    'pi-': '(PT > 750*MeV) & (P > 4000*MeV) & (MIPCHI2DV(PRIMARY) > 4)',
    'K+': '(PT > 750*MeV) & (P > 4000*MeV) & (MIPCHI2DV(PRIMARY) > 4)'
}
d0_comb = "(AMAXDOCA('') < 0.2*mm) & (ADAMASS('D0') < 100*MeV)"
# We can split long selections across multiple lines
d0_vertex = ('(VFASPF(VCHI2/VDOF)< 9)'
             '& (BPVDIRA > 0.9997)'
             "& (ADMASS('D0') < 70*MeV)")

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

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

dstar_decay_products = {'pi+': '(TRCHI2DOF < 3) & (PT > 100*MeV)'}
dstar_comb = "(ADAMASS('D*(2010)+') < 400*MeV)"
dstar_vertex = ("(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_decay_products,
                            CombinationCut=dstar_comb,
                            MotherCut=dstar_vertex)

dstar_seq = SelectionSequence('Dstar_Seq', TopSelection=dstar_sel)
    def GammaEE(self, Name, eDLLe, GammaEEChi2, GammaEEMass, GammaEETau):

        # cuts
        daughterCut = "PIDe > %(eDLLe)s" % locals()
        motherCut = "(VFASPF(VCHI2/VDOF)<%(GammaEEChi2)s) & (MM < %(GammaEEMass)s*MeV) & (abs(BPVLTIME()) <   %(GammaEETau)s*ps )" % locals(
        )

        # imports
        from Configurables import NoPIDsParticleMaker
        from CommonParticles.Utils import trackSelector, updateDoD
        from PhysSelPython.Wrappers import MergedSelection

        #
        # setup electrons
        #

        # TTrack electrons not OK yet ?
        algorithm = NoPIDsParticleMaker('StdNoPIDsTtrackElectrons',
                                        DecayDescriptor='Electron',
                                        Particle='electron')
        algorithm.AddBremPhotonTo = []
        selector = trackSelector(algorithm, trackTypes=["Ttrack"])
        locations = updateDoD(algorithm)
        StdNoPIDsTtrackElectrons = algorithm

        # switch off Bremsstrahlung correction until fully tuned
        algorithm = NoPIDsParticleMaker('StdAllNoPIDsElectrons',
                                        DecayDescriptor='Electron',
                                        Particle='electron')
        algorithm.AddBremPhotonTo = []

        algorithm = NoPIDsParticleMaker('StdNoPIDsUpElectrons',
                                        DecayDescriptor='Electron',
                                        Particle='electron')
        algorithm.AddBremPhotonTo = []

        algorithm = NoPIDsParticleMaker('StdNoPIDsDownElectrons',
                                        DecayDescriptor='Electron',
                                        Particle='electron')
        algorithm.AddBremPhotonTo = []

        # all required electrons
        from CommonParticles import StdNoPIDsDownElectrons, StdNoPIDsUpElectrons, StdNoPIDsVeloElectrons

        eLong = DataOnDemand('Phys/StdAllNoPIDsElectrons/Particles')
        eUp = DataOnDemand('Phys/StdNoPIDsUpElectrons/Particles')
        eDown = DataOnDemand('Phys/StdoPIDsDownElectrons/Particles')
        eTtrack = DataOnDemand('Phys/StdNoPIDsTtrackElectrons/Particles')
        allElectrons = MergedSelection(
            'allElectrons', RequiredSelections=[eLong, eUp, eDown, eTtrack])

        from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
        electronFilter = FilterDesktop(Code=daughterCut)
        myElectrons = Selection(Name + '_MuonSel',
                                Algorithm=electronFilter,
                                RequiredSelections=[allElectrons])

        ConvFind = CombineParticles(DecayDescriptor="KS0 -> e+ e-",
                                    CombinationCut="(AM>0*MeV)",
                                    MotherCut=motherCut)

        #ConvFind.DecayDescriptor  = "KS0 -> e+ e-"
        #ConvFind.DaughtersCuts    = {"e+" : "ALL" }
        #ConvFind.CombinationCut   = "(AM>0*MeV)"
        #ConvFind.MotherCut        = motherCut

        GammaEESel = Selection(Name + "_GammaEESel",
                               Algorithm=ConvFind,
                               RequiredSelections=[myElectrons])

        return GammaEESel
Пример #5
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)
        self.__confdict__ = config

        self.selmuon = Selection("Mufor" + name,
                                 Algorithm=self._muonFilter(),
                                 RequiredSelections=[StdLooseMuons])

        self.selmuonhighPT = Selection(
            "MuhighPTfor" + name,
            Algorithm=FilterDesktop(
                Code=
                "(TRCHI2DOF < %(TRCHI2)s) & (PT>1.2*GeV) & (MIPCHI2DV(PRIMARY)> 9.0)"
                % self.__confdict__),
            RequiredSelections=[self.selmuon])

        self.selmuontight = Selection(
            "Mutightfor" + name,
            Algorithm=FilterDesktop(Code="(MIPCHI2DV(PRIMARY)> 100)"),
            RequiredSelections=[self.selmuonhighPT])

        self.selmuonnew = Selection(
            "Munewfor" + name,
            Algorithm=FilterDesktop(
                Code="(MIPCHI2DV(PRIMARY)> 9.0) & (TRCHI2DOF < %(TRCHI2)s)" %
                self.__confdict__),
            RequiredSelections=[self.selmuon])

        self.selmuonTOS = TOSFilter("MuTOS" + name, self.selmuontight,
                                    "Hlt2SingleMuonDecision")

        self.selKaon = Selection("Kfor" + name,
                                 Algorithm=self._kaonFilter(),
                                 RequiredSelections=[StdLooseKaons])

        self.selPion = Selection("Pifor" + name,
                                 Algorithm=self._pionFilter(),
                                 RequiredSelections=[StdLoosePions])

        self.selPionloose = Selection("Piloosefor" + name,
                                      Algorithm=self._pionlooseFilter(),
                                      RequiredSelections=[StdLoosePions])

        self.selKaonloose = Selection("Kloosefor" + name,
                                      Algorithm=self._kaonlooseFilter(),
                                      RequiredSelections=[StdLooseKaons])

        self.selphi2kk = Selection("Phi2KKfor" + name,
                                   Algorithm=self._Phi2KKFilter(),
                                   RequiredSelections=[self.selKaonloose])

        self.seld02kpi = Selection(
            "D02KPifor" + name,
            Algorithm=self._D02KPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion])

        self.seld02kk = Selection("D02KKfor" + name,
                                  Algorithm=self._D02KKFilter(),
                                  RequiredSelections=[self.selKaon])

        self.seld02k3pi = Selection(
            "D02K3Pifor" + name,
            Algorithm=self._D02K3PiFilter(),
            RequiredSelections=[self.selKaon, StdLoosePions])

        self.seldp2kpipi = Selection(
            "Dp2KPiPifor" + name,
            Algorithm=self._Dp2KPiPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion])

        self.selds2kkpi = Selection(
            "Ds2KKPifor" + name,
            Algorithm=self._Ds2KKPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion])

        self.sellambdac = Selection(
            "Lc2PKPifor" + name,
            Algorithm=self._Lc2PKPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion, StdLooseProtons])

        self.selds2phipi = Selection(
            "Ds2PhiPifor" + name,
            Algorithm=self._Ds2PhiPiFilter(),
            RequiredSelections=[self.selphi2kk, self.selPionloose])

        self.selb2D0MuX = makeb2DMuX(
            'b2D0MuX' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuonhighPT,
            DSel=self.seld02kpi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2D0MuXKK = makeb2DMuX(
            'b2D0MuXKK' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuon,
            DSel=self.seld02kk,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2D0MuXK3Pi = makeb2DMuX(
            'b2D0MuXK3Pi' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuonTOS,
            DSel=self.seld02k3pi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2DpMuX = makeb2DMuX(
            'b2DpMuX' + name,
            DecayDescriptors=['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            MuSel=self.selmuonnew,
            DSel=self.seldp2kpipi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2DsMuX = makeb2DMuX(
            'b2DsMuX' + name,
            DecayDescriptors=['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            MuSel=self.selmuonnew,
            DSel=self.selds2kkpi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2LcMuX = makeb2DMuX('b2LcMuX' + name,
                                     DecayDescriptors=[
                                         '[Lambda_b0 -> Lambda_c+ mu-]cc',
                                         '[Lambda_b0 -> Lambda_c+ mu+]cc'
                                     ],
                                     MuSel=self.selmuonnew,
                                     DSel=self.sellambdac,
                                     BVCHI2DOF=config['BVCHI2DOF'],
                                     BDIRA=config['BDIRA'],
                                     DZ=config['DZ'])

        self.selb2DsMuXPhiPi = makeb2DMuX(
            'b2DsMuXPhiPi' + name,
            DecayDescriptors=['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            MuSel=self.selmuon,
            DSel=self.selds2phipi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.b2D0MuXLine = StrippingLine(
            'b2D0MuX' + name + 'Line'
            #, HLT     = " HLT_PASS_RE('Hlt.*(Muon|MuTrack).*Decision') "
            ,
            prescale=config['PrescalD0Mu'],
            selection=self.selb2D0MuX)

        self.b2D0MuXKKLine = StrippingLine('b2D0MuXKK' + name + 'Line',
                                           prescale=1,
                                           selection=self.selb2D0MuXKK)

        self.b2D0MuXK3PiLine = StrippingLine('b2D0MuXK3Pi' + name + 'Line',
                                             prescale=1,
                                             selection=self.selb2D0MuXK3Pi)

        self.b2DpMuXLine = StrippingLine('b2DpMuX' + name + 'Line',
                                         prescale=1,
                                         selection=self.selb2DpMuX)

        self.b2DsMuXLine = StrippingLine('b2DsMuX' + name + 'Line',
                                         prescale=1,
                                         selection=self.selb2DsMuX)

        self.b2LcMuXLine = StrippingLine('b2LcMuX' + name + 'Line',
                                         prescale=1,
                                         selection=self.selb2LcMuX)

        self.b2DsMuXPhiPiLine = StrippingLine('b2DsMuXPhiPi' + name + 'Line',
                                              prescale=1,
                                              selection=self.selb2DsMuXPhiPi)

        self.registerLine(self.b2D0MuXLine)
        self.registerLine(self.b2DpMuXLine)
        self.registerLine(self.b2DsMuXLine)
        self.registerLine(self.b2LcMuXLine)
        self.registerLine(self.b2D0MuXK3PiLine)
        self.registerLine(self.b2D0MuXKKLine)
        self.registerLine(self.b2DsMuXPhiPiLine)
Пример #6
0
    def applyBDT( self, name, config):
        
        if "DD" in name:
            _FilterB2KShh = FilterDesktop( Code = "FILTER('B2KShhBDTSelection/B2KShhBDTDD')" )
        
            if "SameSign" in name:
                self.selB2KSDDhhBDTCut_SameSign = Selection( name,
                                    Algorithm = _FilterB2KShh,
                                    RequiredSelections = [ self.selB2KSLDhh_SameSign ]
                                    )
            else:    
                self.selB2KSDDhhBDTCut = Selection( name,
                                    Algorithm = _FilterB2KShh,
                                    RequiredSelections = [ self.selB2KSDDhh ]
                                    )
    
            """
            Name is special here, since this is the last algorithm,
            whose name seems to be the one of the stripping line....
            """
            from Configurables import B2KShhBDTSelection
    
            MyBDT = B2KShhBDTSelection( name + "Line.B2KShhBDTDD" )
            MyBDT.BDTCut = config["DD_BDTCutValue"]
            MyBDT.WeightsFile = config["DD_BDTWeightsFile"]
            MyBDT.typeKS = "DD"

        elif "LL" in name:
            _FilterB2KShh = FilterDesktop( Code = "FILTER('B2KShhBDTSelection/B2KShhBDTLL')" )
        
            if "SameSign" in name:
                self.selB2KSLLhhBDTCut_SameSign = Selection( name,
                                    Algorithm = _FilterB2KShh,
                                    RequiredSelections = [ self.selB2KSLLhh_SameSign ]
                                    )
            else:    
                self.selB2KSLLhhBDTCut = Selection( name,
                                    Algorithm = _FilterB2KShh,
                                    RequiredSelections = [ self.selB2KSLLhh ]
                                    )
    
            """
            Name is special here, since this is the last algorithm,
            whose name seems to be the one of the stripping line....
            """
            from Configurables import B2KShhBDTSelection
    
            MyBDT = B2KShhBDTSelection( name + "Line.B2KShhBDTLL" )
            MyBDT.BDTCut = config["LL_BDTCutValue"]
            MyBDT.WeightsFile = config["LL_BDTWeightsFile"]
            MyBDT.typeKS = "LL"

        elif "LD" in name:
            _FilterB2KShh = FilterDesktop( Code = "FILTER('B2KShhBDTSelection/B2KShhBDTLD')" )
        
            if "SameSign" in name:
                self.selB2KSLDhhBDTCut_SameSign = Selection( name,
                                    Algorithm = _FilterB2KShh,
                                    RequiredSelections = [ self.selB2KSLDhh_SameSign ]
                                    )
            else:
                self.selB2KSLDhhBDTCut = Selection( name,
                                    Algorithm = _FilterB2KShh,
                                    RequiredSelections = [ self.selB2KSLDhh ]
                                    )
    
            """
            Name is special here, since this is the last algorithm,
            whose name seems to be the one of the stripping line....
            """
            from Configurables import B2KShhBDTSelection
    
            MyBDT = B2KShhBDTSelection( name + "Line.B2KShhBDTLD" )
            MyBDT.BDTCut = config["LD_BDTCutValue"]
            MyBDT.WeightsFile = config["LD_BDTWeightsFile"]
            MyBDT.typeKS = "LD"
        
        else: print "\nHelp!! 'name' variable didn't have 'LL', 'LD' or 'DD' in it!\n"
def test_clone_sequence():
    _sel00 = AutomaticData(Location='Phys/Sel00')
    _sel01 = AutomaticData(Location='Phys/Sel01')
    _sel02 = AutomaticData(Location='Phys/Sel02')
    _sel03 = AutomaticData(Location='Phys/Sel03')

    sel01 = Selection('00120',
                      Algorithm=MockConfGenerator(),
                      RequiredSelections=[_sel00, _sel01])
    sel02 = Selection('00121',
                      Algorithm=MockConfGenerator(),
                      RequiredSelections=[_sel02, _sel03])
    sel03 = Selection('00122',
                      Algorithm=MockConfGenerator(),
                      RequiredSelections=[sel01, sel02])

    presel0 = MockConfGenerator()
    presel1 = MockConfGenerator()
    postsel0 = MockConfGenerator()
    postsel1 = MockConfGenerator()

    presels = [presel0, presel1]
    postsels = [postsel0, postsel1]

    seq = SelectionSequence('Seq03',
                            TopSelection=sel03,
                            EventPreSelector=presels,
                            PostSelectionAlgs=postsels,
                            sequencerType=DummySequencer)

    clone = seq.clone(name='clone')

    seqAlgos = clone.sequence().Members

    ref_algos = [
        presel0, presel1,
        _sel00.algorithm(),
        _sel01.algorithm(),
        _sel02.algorithm(),
        _sel03.algorithm(),
        sel02.algorithm(),
        sel01.algorithm(),
        sel03.algorithm(), postsel0, postsel1
    ]

    assert len(seqAlgos) == len(ref_algos)
    assert presels == seqAlgos[:len(presels)]
    assert postsels == seqAlgos[len(ref_algos) - len(postsels):]
    # sel03 must come just before the post selection algos.
    assert sel03.algorithm() == ref_algos[len(ref_algos) - (len(presels) + 1)]
    # order of sel01 and sel02 doesn't matter.
    for sel in [sel01, sel02]:
        assert sel.algorithm() in ref_algos[len(presels):len(ref_algos) -
                                            len(postsels)]

    seqAlgos = seq.algorithms()

    assert len(seqAlgos) == len(ref_algos)
    assert presels == seqAlgos[:len(presels)]
    assert postsels == seqAlgos[len(ref_algos) - len(postsels):]

    for sel in [sel01, sel02, sel03]:
        assert sel.algorithm() in ref_algos[len(presels):len(ref_algos) -
                                            len(postsels)]
def filterSelection(name, code, inputs):
    return Selection(name + 'Beauty2CharmFilter',
                     Algorithm=FilterDesktop(Code=code),
                     RequiredSelections=inputs)
Пример #9
0
 def _pionFilter(self):
     _pi = FilterDesktop(Code=self._NominalPiSelection() % self._config)
     return Selection("Pi_for" + self._name,
                      Algorithm=_pi,
                      RequiredSelections=[StdLoosePions])
Пример #10
0
 def _kaonFilter(self):
     _ka = FilterDesktop(Code=self._NominalKSelection() % self._config)
     return Selection("K_for" + self._name,
                      Algorithm=_ka,
                      RequiredSelections=[StdLooseKaons])
Пример #11
0
 def _muonFilter(self):
     _mu = FilterDesktop(Code=self._NominalMuSelection() % self._config)
     return Selection("Mu_for" + self._name,
                      Algorithm=_mu,
                      RequiredSelections=[StdLooseMuons])
def makeFilter(name, _input, _preambulo, _code):
    _filter = FilterDesktop(Preambulo=[_preambulo], Code=_code)
    return Selection(name, Algorithm=_filter, RequiredSelections=[_input])
Пример #13
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)
        self.__confdict__ = config

        #########
        self.dauPions = Selection(
            "dauPifor" + name,
            Algorithm=FilterDesktop(
                Code=
                "(TRGHOSTPROB < %(GHOSTPROB_MAX)s) & (PIDK < %(PionPIDK)s) & (MIPCHI2DV(PRIMARY)> %(dau_MIPCHI2DV)s) & (TRCHI2DOF < %(TRCHI2)s) & (PT > %(dau_PT_MIN)s *MeV)"
                % config),
            RequiredSelections=[StdLoosePions])

        self.dauKaons = Selection(
            "dauKfor" + name,
            Algorithm=FilterDesktop(
                Code=
                "(TRGHOSTPROB < %(GHOSTPROB_MAX)s) & (PIDK > %(KaonPIDK)s) & (MIPCHI2DV(PRIMARY)> %(dau_MIPCHI2DV)s) & (TRCHI2DOF < %(TRCHI2)s) & (PT > %(dau_PT_MIN)s *MeV)"
                % config),
            RequiredSelections=[StdLooseKaons])

        #########
        self.comb_D2PiPi = CombineParticles(
            DecayDescriptors=['[D- -> pi- pi-]cc'],
            CombinationCut=
            "(AM+10 > %(D_MASS_MIN)s *MeV) & (AM-10 < %(D_MASS_MAX)s *MeV) & (APT+20 > %(D_PT_MIN)s *MeV) & (AMAXDOCA('') < %(D_AMAXDOCA)s *mm) & (ADOCACHI2CUT(%(D_DOCACHI2_MAX)s,''))"
            % config,
            MotherCut=
            "(M > %(D_MASS_MIN)s *MeV) & (M < %(D_MASS_MAX)s *MeV) & (PT > %(D_PT_MIN)s *MeV) & (BPVDIRA>0.99) & (VFASPF(VCHI2/VDOF)< %(D_VFASPF)s) & (BPVVDCHI2>%(D_BPVVDCHI2)s)"
            % config)
        self.seld2pi = Selection("D2PiPifor" + name,
                                 Algorithm=self.comb_D2PiPi,
                                 RequiredSelections=[self.dauPions])

        #########
        self.comb_Lc2Kpi = CombineParticles(
            DecayDescriptors=['[Lambda_c+ -> K- pi+]cc'],
            CombinationCut=
            "(AM+10 > %(Lc_MASS_MIN)s *MeV) & (AM-10 < %(Lc_MASS_MAX)s *MeV) & (APT+20 > %(Lc_PT_MIN)s *MeV) & (AMAXDOCA('') < %(Lc_AMAXDOCA)s *mm) & (ADOCACHI2CUT(%(Lc_DOCACHI2_MAX)s,''))"
            % config,
            MotherCut=
            "(M > %(Lc_MASS_MIN)s *MeV) & (M < %(Lc_MASS_MAX)s *MeV) & (PT > %(Lc_PT_MIN)s *MeV) & (BPVDIRA>0.99) & (VFASPF(VCHI2/VDOF)< %(Lc_VFASPF)s) & (BPVVDCHI2>%(Lc_BPVVDCHI2)s)"
            % config)
        self.selLc2Kpi = Selection(
            "LcToKpifor" + name,
            Algorithm=self.comb_Lc2Kpi,
            RequiredSelections=[self.dauKaons, self.dauPions])

        #########
        self.comb_a2PiPiPi = CombineParticles(
            DecayDescriptors=['[a_1(1260)+ -> pi+ pi- pi+]cc'],
            CombinationCut=
            "(AM+10 > %(A1_MASS_MIN)s *MeV) & (AM-10 < %(A1_MASS_MAX)s *MeV) & (APT+20 > %(A1_PT_MIN)s *MeV) & (AMAXDOCA('') < %(A1_AMAXDOCA)s *mm) & (ADOCACHI2CUT(%(D_DOCACHI2_MAX)s,''))"
            % config,
            MotherCut=
            "(M > %(A1_MASS_MIN)s *MeV) & (M < %(A1_MASS_MAX)s *MeV) & (PT > %(A1_PT_MIN)s *MeV) & (VFASPF(VCHI2/VDOF)< %(A1_VFASPF)s) & (BPVVDCHI2>%(A1_BPVVDCHI2)s)"
            % config)
        self.sela3pi = Selection("A2PiPiPifor" + name,
                                 Algorithm=self.comb_a2PiPiPi,
                                 RequiredSelections=[self.dauPions])

        #########
        self.comb_B2Dhhh = CombineParticles(
            DecayDescriptor='[B0 -> D- a_1(1260)+]cc',
            CombinationCut=
            "(AM+10 > %(B_MASS_MIN)s *MeV) & (AM-10 < %(B_MASS_MAX)s *MeV) & (AM-AM1+10 > %(B_D_deltamass_MIN)s *MeV) & (AM-AM1-10 < %(B_D_deltamass_MAX)s *MeV) & (APT+20 > %(B_PT_MIN)s *MeV) & (ADOCACHI2CUT(%(B_DOCACHI2_MAX)s,''))"
            % config,
            MotherCut=
            "(M > %(B_MASS_MIN)s *MeV) & (M < %(B_MASS_MAX)s *MeV) & (PT > %(B_PT_MIN)s *MeV) & (BPVDIRA> 0.999) & (VFASPF(VCHI2/VDOF) < %(B_VFASPF)s) & (BPVVDCHI2>%(B_BPVVDCHI2)s) & (MINTREE(((ABSID=='D+')|(ABSID=='D0')|(ABSID=='Lambda_c+')) , VFASPF(VZ))-VFASPF(VZ) > %(B_DZ)s *mm )"
            % config)
        self.selB2Dhhh = Selection(
            "B2Dhhh_DPiPi_for" + name,
            Algorithm=self.comb_B2Dhhh,
            RequiredSelections=[self.seld2pi, self.sela3pi])

        #########
        self.diPiPi = PiPiMaker("PiPi_For" + name, config, [self.dauPions],
                                ['rho(770)0 -> pi+ pi-'])

        self.comb_Lb2Lchhh = CombineParticles(
            DecayDescriptor='[Lambda_b0 -> Lambda_c+ rho(770)0 pi-]cc',
            CombinationCut=
            "(AM+10 > %(Lb_MASS_MIN)s *MeV) & (AM-10 < %(Lb_MASS_MAX)s *MeV) & (AM-AM1+10 > %(Lb_Lc_deltamass_MIN)s *MeV) & (AM-AM1-10 < %(Lb_Lc_deltamass_MAX)s *MeV) & (AM12-AM1+10 > %(LcStar_MASS_MIN)s *MeV) & (AM12-AM1-10 < %(LcStar_MASS_MAX)s *MeV) & (APT+20 > %(Lb_PT_MIN)s *MeV) & (ADOCACHI2CUT(%(Lb_DOCACHI2_MAX)s,''))"
            % config,
            MotherCut=
            "(M > %(Lb_MASS_MIN)s *MeV) & (M < %(Lb_MASS_MAX)s *MeV) & (PT > %(Lb_PT_MIN)s *MeV) & (BPVDIRA> 0.999) & (VFASPF(VCHI2/VDOF) < %(Lb_VFASPF)s ) & (BPVVDCHI2>%(Lb_BPVVDCHI2)s) & (MINTREE(((ABSID=='D+')|(ABSID=='D0')|(ABSID=='Lambda_c+')) , VFASPF(VZ))-VFASPF(VZ) > %(Lb_DZ)s *mm )"
            % config)
        self.selLb2Lchhh = Selection(
            "Lb2Lchhh_LcKpi_for" + name,
            Algorithm=self.comb_Lb2Lchhh,
            RequiredSelections=[self.selLc2Kpi, self.diPiPi, self.dauPions])

        #########
        self.selB2Dhhh_tos = TOSFilter("B2Dhhh_DPiPiTOS_for" + name,
                                       self.selB2Dhhh)
        self.selLb2Lchhh_tos = TOSFilter("Lb2Lchhh_LcKpiTOS_for" + name,
                                         self.selLb2Lchhh)
        #########

        GECs = {
            "Code":
            "( recSummaryTrack(LHCb.RecSummary.nLongTracks, TrLONG) < %(GEC_nLongTrk)s )"
            % config,
            "Preambulo": ["from LoKiTracks.decorators import *"]
        }

        #########
        self.B2DhhhLine = StrippingLine('B2DHHHwD2PiPi' + name + 'Line',
                                        prescale=config['PreScale'],
                                        FILTER=GECs,
                                        selection=self.selB2Dhhh_tos)
        self.Lb2LchhhLine = StrippingLine('Lb2LcHHHwLc2KPi' + name + 'Line',
                                          prescale=config['PreScale'],
                                          FILTER=GECs,
                                          selection=self.selLb2Lchhh_tos)

        self.registerLine(self.B2DhhhLine)
        self.registerLine(self.Lb2LchhhLine)
_jpsiFilter.addTool(PlotTool("InputPlots"))
_jpsiFilter.InputPlots.Histos = {
    "P/1000": ('momentum', 0, 150),
    "PT/1000": ('pt_%1%', 0, 5, 750),
    "M": ('mass in MeV_%1%_%2%_%3%', 2.8 * Units.GeV, 3.2 * Units.GeV)
}
_jpsiFilter.addTool(PlotTool("OutputPlots"))
_jpsiFilter.OutputPlots.Histos = {
    "P/1000": ('momentum', 0, 150),
    "PT/1000": ('pt_%1%', 0, 5, 750),
    "M": ('mass in MeV_%1%_%2%_%3%', 2.8 * Units.GeV, 3.2 * Units.GeV)
}
#

JpsiFilterSel = Selection(name='JpsiFilterSel',
                          Algorithm=_jpsiFilter,
                          RequiredSelections=[JpsiSel])

JpsiSeq = SelectionSequence('SeqJpsi', TopSelection=JpsiFilterSel)
seq = JpsiSeq.sequence()

dv = DaVinci()
dv.PrintFreq = 10
dv.HistogramFile = "DVHistos_Strip.root"
dv.EvtMax = -1
dv.DataType = "MC09"
dv.Simulation = True
dv.RedoMCLinks = False
dv.UserAlgorithms = [seq]
dv.InputType = 'DST'
# MC09
def test_instantiate_sequencer():
    sel00 = AutomaticData(Location='Phys/Sel00')
    sel01 = AutomaticData(Location='Phys/Sel01')
    alg0 = MockConfGenerator()
    sel = Selection('00011', Algorithm=alg0, RequiredSelections=[sel00, sel01])
    seq = SelectionSequence('Seq00', TopSelection=sel)
Пример #16
0
def tisTosSelection(sel):
    '''Filters Selection sel to be TOS OR TIS.'''
    tisTosFilter = makeTISTOSFilter(sel.name())
    return Selection(sel.name() + 'TISTOS',
                     Algorithm=tisTosFilter,
                     RequiredSelections=[sel])
Пример #17
0
    "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonJPsiDecision"
]

#### -- B mass cut -- ####

from Configurables import FilterDesktop, CombineParticles
from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence

BMassSel = AutomaticData(
    Location='/Event/Bhadron/Phys/B02D0PiPiD2HHBeauty2CharmLine/Particles')

_bmassFilter = FilterDesktop(
    'bmassFilter', Code='(M<6000.*MeV) & (BPVIPCHI2()<15) & (BPVDIRA>0.9999)')

BMassFilterSel = Selection(name='BMassFilterSel',
                           Algorithm=_bmassFilter,
                           OutputBranch=teslocation + 'Phys',
                           RequiredSelections=[BMassSel])

BMassSeq = SelectionSequence('SeqBMass', TopSelection=BMassFilterSel)

BMassseq = BMassSeq.sequence()

### Tuple part
tuple = DecayTreeTuple()

tuple.RootInTES = teslocation
tuple.Inputs = ['Phys/BMassFilterSel/Particles']
#tuple.Inputs = [ '/Event/Bhadron/Phys/B02D0KPiD2HHBeauty2CharmLine/Particles' ]

tuple.ToolList += [
    "TupleToolGeometry", "TupleToolRecoStats", "TupleToolKinematic",
Пример #18
0
    def makeA1(self,name,type) :
        """
        Prompt A1 selection
        Arguments:
        name        : name of the Selection.
        type        : 0 (prompt), 1 (simple), 2 (detached)
        """

        A1 = CombineParticles("Combine"+name)
        A1.DecayDescriptor = "KS0 -> mu+ mu-"
        # prompt
        if type==0:
            A1.DaughtersCuts = { "mu+" : "(TRCHI2DOF < %(MuTrackChi2DoF)s ) "\
                                 "& ( TRGHOSTPROB < %(MuGhostProb)s ) " \
                                 "& (PT > %(MupTprompt)s * MeV ) "\
                                 "& (MIPCHI2DV(PRIMARY)< %(MuMaxIPchi2)s )" %self.config_dict }
            
            A1.CombinationCut = "(AM < %(A1maxMass)s * MeV ) "\
                                 "& (AMAXDOCA('')<%(A1Doca)s * mm)" %self.config_dict
            
            A1.MotherCut = "(VFASPF(VCHI2)< %(A1Vchi2)s ) "\
                           "& (MM < %(A1maxMass)s * MeV)" %self.config_dict

        # simple: tighten DOCA and Vchi2, tighten muID cut
        elif type==1:
            A1.DaughtersCuts = { "mu+" : "(TRCHI2DOF < %(MuTrackChi2DoF)s ) "\
                                         "& ( TRGHOSTPROB < %(MuGhostProb)s ) " \
                                         "& (PIDmu > %(MuPIDdll)s )  "\
                                         "& (PPINFO(LHCb.ProtoParticle.MuonNShared,99999)<= %(MuNShared)s ) " %self.config_dict }
            A1.CombinationCut = "(AM < %(A1maxMass)s * MeV ) "\
                                 "& (AMAXDOCA('')<%(A1DocaTight)s * mm)" %self.config_dict
            
            A1.MotherCut = "(VFASPF(VCHI2)< %(A1Vchi2Tight)s ) "\
                           "& (MM < %(A1maxMass)s * MeV)" %self.config_dict


        #detached
        elif type==2:

            #A1.addTool( OfflineVertexFitter )
            #A1.ParticleCombiners.update( { "" : "OfflineVertexFitter"} )
            #A1.ReFitPVs = True

            A1.DaughtersCuts = { "mu+" : "(TRCHI2DOF < %(MuTrackChi2DoF)s ) "\
                                 "& (PT > %(MupTdetached)s * MeV ) "\
                                 "& ( TRGHOSTPROB < %(MuGhostProb)s ) " \
                                 "& (MIPCHI2DV(PRIMARY)> %(MuMinIPchi2)s )" %self.config_dict }
            
            A1.CombinationCut = "(AM < %(A1maxMass)s * MeV ) "\
                                 "& (AMAXDOCA('')<%(A1Doca)s * mm)" %self.config_dict
            
            A1.MotherCut = "(VFASPF(VCHI2)< %(A1Vchi2)s ) "\
                           "& (MM < %(A1maxMass)s * MeV)" \
                           "& (BPVDIRA > %(A1Dira)s )" \
                           "& (BPVIPCHI2() < %(A1maxIPchi2)s )" \
                           "& (BPVVDCHI2 > %(A1FDChi2)s )" %self.config_dict

            
        _stdAllLooseMuons = DataOnDemand(Location = "Phys/StdAllLooseMuons/Particles")

        if self.debug_cuts:
            print "DEBUG - A1 cuts for type", type
            print A1.DaughtersCuts
            print A1.MotherCut
            print A1.CombinationCut


        
        return Selection ("Sel"+name,
                          Algorithm = A1,
                          RequiredSelections = [ _stdAllLooseMuons ])
Пример #19
0
    def __init__(self, name, config):
        self.name = name
        LineBuilder.__init__(self, name, config)
        modeName = "Bu2rho0rhoPlus"
        ### filters ----------------------------------------------------------------------------------------
        _resVoidFilter = "((CONTAINS('Phys/StdLoosePions/Particles')>0) & (CONTAINS('Phys/StdLooseResolvedPi0/Particles')>0))"
        _mgdVoidFilter = "((CONTAINS('Phys/StdLoosePions/Particles')>0) & (CONTAINS('Phys/StdLooseMergedPi0/Particles')>0))"
        _hltFilter = "( HLT_PASS_RE('Hlt1TrackAllL0Decision') & HLT_PASS_RE('Hlt2Topo[23].*Decision') )"
        _TisTosTaggerSpecs = {'Hlt2Topo[23].*Decision%TOS': 0}
        if config["isMC"]:
            _hltFilter = None
        ### build cuts -------------------------------------------------------------------------------------
        _trackCuts = (
            "(MIPCHI2DV(PRIMARY) > %(trMinIPChi2PV)s) & (PROBNNpi > %(trMinProbNNpi)s) & (PROBNNK < %(trMaxProbNNK)s)"
            " & (TRCHI2DOF < %(trMaxChi2Dof)s) & (TRGHOSTPROB < %(trMaxGhostProb)s)"
        ) % locals()["config"]

        _rhoCombMassWindow = "(AM > %(rhoCombMassMin)s) & (AM < %(rhoCombMassMax)s)" % locals(
        )["config"]

        _rho0CombCuts = _rhoCombMassWindow + " & (ADOCACHI2CUT(%(rho0DauMaxDocaChi2)s,''))" % locals(
        )["config"]
        _rho0MotherCuts = (
            "(M > %(rhoMothMassMin)s) & (M < %(rhoMothMassMax)s) & (BPVVDZ > %(rho0MinDeltaZ)s) & (VFASPF(VCHI2/VDOF) < %(rho0MinVChi2Dof)s)"
            " & (BPVDIRA > %(rho0MinDira)s) & (BPVVDCHI2 > %(rho0MinVDisplChi2)s)"
        ) % locals()["config"]

        _rhoPResDaughtersCuts = {
            "pi+":
            "ALL",
            "pi0":
            ("(P > %(pi0ResMinP)s) & (PT > %(pi0ResMinPT)s) & (CHILD(CL,1) > %(pi0ResDauMinCL)s) & (CHILD(CL,2) > %(pi0ResDauMinCL)s)"
             " & (CHILD(PT,1) > %(pi0ResDauMinPT)s) & (CHILD(PT,2) > %(pi0ResDauMinPT)s)"
             ) % locals()["config"]
        }
        _rhoPResMotherCuts = "(M > %(rhoMothMassMin)s) & (M < %(rhoMothMassMax)s) & (PT > %(rhoPResMinPT)s)" % locals(
        )["config"]

        _BuResCombCuts = "(ADAMASS('B0') < %(BuResCombMassWindow)s)" % locals(
        )["config"]
        _BuResMotherCuts = (
            "(VFASPF(VCHI2/VDOF) < %(BuResMinVChi2Dof)s) & (ADMASS('B+') < %(BuResMothMassWindow)s)"
            " & (BPVDIRA > %(BuResMinDira)s) & (PT > %(BuResMinPT)s)"
        ) % locals()["config"]

        _rhoPMgdDaughtersCuts = {
            "pi+": "ALL",
            "pi0": "(PT > %(pi0MgdMinPT)s)" % locals()["config"]
        }
        _rhoPMgdMotherCuts = "ALL"

        _BuMgdCombCuts = "(AM > %(BuMgdCombMassMin)s) & (AM < %(BuMgdCombMassMax)s)" % locals(
        )["config"]
        _BuMgdMotherCuts = (
            "(M > %(BuMgdMothMassMin)s) & (M < %(BuMgdMothMassMax)s) & (VFASPF(VCHI2/VDOF) < %(BuMgdMinVChi2Dof)s)"
            " & (BPVDIRA > %(BuMgdMinDira)s)") % locals()["config"]

        _extraInfoList = [{
            "Type": "ConeVariables",
            "ConeAngle": 1.0,
            "ConeNumber": 3,
            "Variables": ['angle', 'mult', 'ptasy']
        }, {
            "Type": "VertexIsolation"
        }]

        ### shared particles -------------------------------------------------------------------------------
        _trackFilter = FilterDesktop(Code=_trackCuts)
        _tracks = Selection("tracks" + self.name,
                            Algorithm=_trackFilter,
                            RequiredSelections=[StdLoosePions])

        _rho0 = CombineParticles(DecayDescriptor="rho(770)0 -> pi+ pi-",
                                 CombinationCut=_rho0CombCuts,
                                 MotherCut=_rho0MotherCuts)
        _selRho0 = Selection("selRho0",
                             Algorithm=_rho0,
                             RequiredSelections=[_tracks])

        ### resolved line ----------------------------------------------------------------------------------
        _selRhoPResolved = makeRhoP("RhoPResolved",
                                    DauCuts=_rhoPResDaughtersCuts,
                                    combCuts=_rhoCombMassWindow,
                                    mothCuts=_rhoPResMotherCuts,
                                    inputSel=[_tracks, StdLooseResolvedPi0])

        _selBuResolved = makeBu2rho0rhoPlus(
            modeName + "Resolved",
            combCuts=_BuResCombCuts,
            mothCuts=_BuResMotherCuts,
            inputSel=[_selRho0, _selRhoPResolved])

        if config["isMC"]:
            self.stripCandResolved = _selBuResolved
        else:
            # self.stripCandResolved = makeTisTosSelection( _selBuResolved, _TisTosTaggerSpecs )
            self.stripCandResolved = _selBuResolved

        self.Bu2rho0rhoPlusResolvedLine = StrippingLine(
            modeName + "ResolvedLine",
            prescale=config["PrescaleBu2rho0rhoPlusResolved"],
            HLT=_hltFilter,
            FILTER=_resVoidFilter,
            checkPV=True,
            ExtraInfoTools=_extraInfoList,
            selection=self.stripCandResolved)

        self.registerLine(self.Bu2rho0rhoPlusResolvedLine)

        ### merged line ------------------------------------------------------------------------------------
        _selRhoPMerged = makeRhoP("RhoPMerged",
                                  DauCuts=_rhoPMgdDaughtersCuts,
                                  combCuts=_rhoCombMassWindow,
                                  mothCuts=_rhoPMgdMotherCuts,
                                  inputSel=[_tracks, StdLooseMergedPi0])

        _selBuMerged = makeBu2rho0rhoPlus(modeName + "Merged",
                                          combCuts=_BuMgdCombCuts,
                                          mothCuts=_BuMgdMotherCuts,
                                          inputSel=[_selRho0, _selRhoPMerged])

        if config["isMC"]:
            self.stripCandMerged = _selBuMerged
        else:
            # self.stripCandMerged = makeTisTosSelection( _selBuMerged, _TisTosTaggerSpecs )
            self.stripCandMerged = _selBuMerged

        self.Bu2rho0rhoPlusMergedLine = StrippingLine(
            modeName + "MergedLine",
            prescale=config["PrescaleBu2rho0rhoPlusMerged"],
            HLT=_hltFilter,
            FILTER=_mgdVoidFilter,
            checkPV=True,
            ExtraInfoTools=_extraInfoList,
            selection=self.stripCandMerged)

        self.registerLine(self.Bu2rho0rhoPlusMergedLine)
Пример #20
0
    def __init__( self, name, config ):
        LineBuilder.__init__( self, name, config )

        #######################################################################
        ###                                                                 ###
        ###     VELO BASED VERTEXING SEQUENCE                               ###
        ###                                                                 ###
        #######################################################################

        bestTracks = AutomaticData("Rec/Track/Best")

        withVeloTracksForVertexing = bestTracks
        if self.configurationParameter("FilterVelo")["Apply"]:
            from GaudiConfUtils.ConfigurableGenerators import SelectVeloTracksNotFromPV

            veloWithIP = SelectVeloTracksNotFromPV()
            self.validatedSetProps( "FilterVelo", DisplVerticesLinesConf.veloWithIPCuts, veloWithIP )

            withVeloTracksForVertexing = Selection( "%sVeloFilteredTracks" % self.name()
                                           , RequiredSelections = [ bestTracks ]
                                           , Algorithm = veloWithIP
                                           )

        # Displaced Vertex reconstruction with best tracks (dominated by those with a Velo segment)
        from Configurables import PatPV3D, PVOfflineTool, PVSeed3DTool, LSAdaptPV3DFitter, LSAdaptPVFitter

        withVeloVertexFinder = PVOfflineTool( "%sWithVeloVertexFinder" % self.name()
                                 , PVsChi2Separation = 0
                                 , PVsChi2SeparationLowMult = 0
                                 , PVSeedingName   = "PVSeed3DTool"
                                 , PVFitterName    = "LSAdaptPV3DFitter"
                                 )
        withVeloVertexFinder.addTool(PVSeed3DTool)
        withVeloVertexFinder.PVSeed3DTool.MinCloseTracks       = 3

        withVeloVertexFinder.addTool(LSAdaptPV3DFitter)
        withVeloVertexFinder.LSAdaptPV3DFitter.maxIP2PV        = 2.0*units.mm
        withVeloVertexFinder.LSAdaptPV3DFitter.MinTracks       = 4

        withVeloVertexAlg = PatPV3D( "%sWithVeloVertexAlg" )
        withVeloVertexAlg.addTool( withVeloVertexFinder, name="PVOfflineTool" )

        withVeloVertexing = SelectionPatPV3DWrapper( "%sWithVeloVertexing" % self.name()
                              , withVeloVertexAlg
                              , RequiredSelections = [ withVeloTracksForVertexing ]
                              )

        # Make Particles out of the RecVertices
        from GaudiConfUtils.ConfigurableGenerators import LLParticlesFromRecVertices

        rv2pWithVelo = LLParticlesFromRecVertices(
                           VerticesFromVeloOnly = False
                         , WriteP2PVRelations   = False
                         , ForceP2PVBuild       = False
                         , VeloProtoParticlesLocation = "Phys/%s/VeloProtoP" % self.name()
                         )
        self.validatedSetProps( "RV2PWithVelo", DisplVerticesLinesConf.recoCuts + DisplVerticesLinesConf.singleCuts, rv2pWithVelo )

        withVeloCandidates = Selection( "%sWithVeloCandidates" % self.name()
                               , RequiredSelections = [ withVeloVertexing ]
                               , Algorithm          = rv2pWithVelo
                               , InputDataSetter    = "RecVertexLocations"
                               )

        #######################################################################
        ###                                                                 ###
        ###     DOWNSTREAM VERTEXING SEQUENCE                               ###
        ###                                                                 ###
        #######################################################################

        from GaudiConfUtils.ConfigurableGenerators import CopyDownstreamTracks

        downTracks = Selection( "%sDownstreamTracks" % self.name()
                       , RequiredSelections = [ bestTracks ]
                       , Algorithm          = CopyDownstreamTracks()
                       )

        # Displaced Vertex reconstruction from downstream tracks
        downVertexFinder = PVOfflineTool( "%sDownVertexFinder" % self.name()
                                        , RequireVelo     = False
                                        , PVsChi2Separation = 0
                                        , PVsChi2SeparationLowMult = 0
                                        , PVSeedingName   = "PVSeed3DTool"
                                        , PVFitterName    = "LSAdaptPVFitter"
                                        )
        downVertexFinder.addTool(PVSeed3DTool)
        downVertexFinder.PVSeed3DTool.TrackPairMaxDistance = 2.0*units.mm
        downVertexFinder.PVSeed3DTool.zMaxSpread           = 20.0*units.mm
        downVertexFinder.PVSeed3DTool.MinCloseTracks       = 4
        downVertexFinder.addTool(LSAdaptPVFitter)
        downVertexFinder.LSAdaptPVFitter.MinTracks          = 4
        downVertexFinder.LSAdaptPVFitter.maxChi2            = 400.0
        downVertexFinder.LSAdaptPVFitter.maxDeltaZ          = 0.0005 *units.mm
        downVertexFinder.LSAdaptPVFitter.maxDeltaChi2NDoF   = 0.002
        downVertexFinder.LSAdaptPVFitter.acceptTrack        = 0.000000001
        downVertexFinder.LSAdaptPVFitter.trackMaxChi2       = 9
        downVertexFinder.LSAdaptPVFitter.trackMaxChi2Remove = 64

        downVertexAlg = PatPV3D( "%sDownVertexAlg" % self.name() )
        downVertexAlg.addTool(downVertexFinder, name="PVOfflineTool")

        downVertexing = SelectionPatPV3DWrapper( "%sDownVertexing" % self.name()
                          , downVertexAlg
                          , RequiredSelections = [ downTracks ]
                          )

        # Make Particles out of the RecVertices
        rv2pDown = LLParticlesFromRecVertices(
                       VerticesFromVeloOnly = False
                     , WriteP2PVRelations   = False
                     , ForceP2PVBuild       = False
                     #, OutputLevel          = VERBOSE
                     )
        self.validatedSetProps( "RV2PDown", DisplVerticesLinesConf.recoCuts + DisplVerticesLinesConf.singleCuts, rv2pDown )

        downCandidates = Selection( "%sDownCandidates" % self.name()
                           , RequiredSelections = [ downVertexing ]
                           , Algorithm          = rv2pDown
                           , InputDataSetter    = "RecVertexLocations"
                           )

        #######################################################################
        ###                                                                 ###
        ###     LINE DEFINITIONS                                            ###
        ###                                                                 ###
        #######################################################################

        ##============================== Single ===================================##

        singleLineNames = [ p.split("Single")[1].split("Selection")[0]
                                for p in self.configKeys()
                                    if p.startswith("Single")
                                    and p.endswith("Selection")
                          ]

        for lAcroName in singleLineNames:
            lShortName = "Single%s" % lAcroName             # SingleMedium
            lSelName   = "%sSelection" % lShortName         # SingleMediumSelection
            lLineName  = "%s%s" % (self.name(), lShortName) # DisplVerticesSingleMedium

            # Choose between Velo-based and downstream vertexing input
            candidates = withVeloCandidates
            code = None
            if "Down" in lAcroName:
                candidates = downCandidates
                code = self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts + DisplVerticesLinesConf.downCuts) )
            else:
                code = self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts) )

            lineFilter = FilterDesktop(
                             DecayDescriptor    = LLPLHCbName
                           , Preambulo          = DisplVerticesLinesConf.llpSelectionPreambulo
                           , Code               = code
                           , WriteP2PVRelations = False
                           , ForceP2PVBuild     = False
                           #, OutputLevel        = VERBOSE
                           )

            lineSel = Selection( "".join(( self.name(), lSelName ))
                        , RequiredSelections = [ candidates ]
                        , Algorithm          = lineFilter
                        )

            line = StrippingLine(lLineName
                     , prescale  = self.validatedGetProps(lSelName, ["PreScale"])["PreScale"]
                     , selection = lineSel
                     ## , FILTER    = { "Preambulo" : [ "nVeloTracks   = RECSUMMARY(13,  0)"
                     ##                               , "nVeloClusters = RECSUMMARY(30, -1)"
                     ##                               , "from LoKiCore.functions import *" ]
                     ##               , "Code"      : "monitor( 1.*nVeloTracks/nVeloClusters , Gaudi.Histo1DDef('Number of Velo Tracks / Clusters', 0., 1., 100) , 'NumVeloTracksPerCluster' ) < 0.2" }
                     )
            if lShortName in self.configurationParameter("HLT"):
                line.HLT = self.configurationParameter("HLT")[lShortName]

            self.registerLine(line)

        ##============================== Double ===================================##

        doubleLineNames = [ p.split("Double")[1].split("Selection")[0]
                                for p in self.configKeys()
                                    if p.startswith("Double")
                                    and p.endswith("Selection")
                          ]
        for lAcroName in doubleLineNames:
            lShortName = "Double%s" % lAcroName
            lSelName   = "%sSelection" % lShortName
            lLineName  = "%s%s" % (self.name(), lShortName)

            combinationCut, motherCut = self.getResonanceSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.doubleResonanceCuts) )
            lineFilter = CombineParticles(
                             DecayDescriptor    = "H_10 -> %s %s" % (LLPLHCbName, LLPLHCbName)
                           , Preambulo          = DisplVerticesLinesConf.llpSelectionPreambulo
                           , DaughtersCuts      = { LLPLHCbName : self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts) ) }
                           , CombinationCut     = combinationCut
                           , MotherCut          = motherCut
                           , WriteP2PVRelations = False
                           , ForceP2PVBuild     = False
                           #, OutputLevel        = VERBOSE
                           )
            lineSel = Selection( "".join(( self.name(), lSelName ))
                        , RequiredSelections = [ withVeloCandidates ]
                        , Algorithm          = lineFilter
                        )
            line = StrippingLine(lLineName
                     , prescale  = self.validatedGetProps(lSelName, ["PreScale"])["PreScale"]
                     , selection = lineSel
                     )
            if lShortName in self.configurationParameter("HLT"):
                line.HLT = self.configurationParameter("HLT")[lShortName]

            self.registerLine(line)

        ##============================== HLT PS ===================================##

        hltPSLineNames = [ p.split("HLTPS")[0]
                               for p in self.configKeys()
                                   if p.endswith("HLTPS")
                         ]
        for lAcroName in hltPSLineNames:
            lShortName = "%sHLTPS" % lAcroName
            lLineName  = "%s%s" % (self.name(), lShortName) # DisplVerticesSingleMedium

            hltSelAlg = GaudiSequenceroid(ModeOR = True, ShortCircuit = False,
                Members = [ GaudiSequencer( "%sHltFilterTCK%s-%s" % (lLineName, tckBegin, tckEnd),
                                            Members = [ ODINFilter("%sODINFilterTCK%s-%s" % (lLineName, tckBegin, tckEnd), Code="( ODIN_TCK >= %s ) & ( ODIN_TCK <= %s )" % (tckBegin, tckEnd))
                                                      , HltFilter("%sHltDecisionFilterTCK%s-%s" % (lLineName, tckBegin, tckEnd), Code=hltFilter) ])
                            for (tckBegin, tckEnd), hltFilter in self.validatedGetProps("HLT", [lShortName])[lShortName]
                          ]
                )

            hltSelection = EventSelection( "%sHltFilter" % lLineName
                              , Algorithm = hltSelAlg
                              )

            line = StrippingLine(lLineName
                     , prescale  = self.validatedGetProps(lShortName, ["PreScale"])["PreScale"]
                     , selection = hltSelection
                     )

            self.registerLine(line)

        ##============================== OTHER  ===================================##

        hltEffLineNames = [ p.split("HltEff")[1].split("Selection")[0]
                                for p in self.configKeys()
                                    if p.startswith("HltEff")
                                    and p.endswith("Selection")
                          ]
        for lShortName in hltEffLineNames:
            lSelName  = "HltEff%sSelection" % lShortName
            lLineName = "%s%s" % (self.name(), lShortName)

            # HltEff lines are single, Velo-vertexing based lines
            lineFilter = FilterDesktop(
                             DecayDescriptor    = LLPLHCbName
                           , Preambulo          = DisplVerticesLinesConf.llpSelectionPreambulo
                           , Code               = self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts) )
                           , WriteP2PVRelations = False
                           , ForceP2PVBuild     = False
                           #, OutputLevel        = VERBOSE
                           )

            lineSel = Selection( "".join(( self.name(), lSelName ))
                        , RequiredSelections = [ withVeloCandidates ]
                        , Algorithm          = lineFilter
                        )

            line = StrippingLine(lLineName
                     , prescale  = self.validatedGetProps(lSelName, ["PreScale"])["PreScale"]
                     # these lines MUST have an HLT filter
                     , HLT       = self.configurationParameter("HLT")[lShortName]
                     , selection = lineSel
                     )

            self.registerLine(line)
Пример #21
0
    def __init__(self, name, config):
        """Initialise this LineBuilder instance."""
        self.name = name
        self.config = config
        LineBuilder.__init__(self, name, config)

        # Line names
        lambdac_name = '{0}Lambdac2PKPi'.format(name)
        lambdac_pKK_name = '{0}Lambdac2PKK'.format(name)
        lambdac_ppipi_name = '{0}Lambdac2PPiPi'.format(name)
        lambdac_ppiK_name = '{0}Lambdac2PPiKWS'.format(name)
        sigmacz_name = '{0}Sigmacz2LambdacPi'.format(name)
        sigmacpp_name = '{0}Sigmacpp2LambdacPi'.format(name)

        # Build pion, kaon, and proton cut strings
        daugCuts = ('(PT > {0[Daug_All_PT_MIN]})'
                    '& (BPVIPCHI2() > {0[Daug_All_BPVIPCHI2_MIN]})').format(
                        self.config)
        pidFiducialCuts = (
            '(in_range({0[Daug_P_MIN]}, P, {0[Daug_P_MAX]}))'
            '& (in_range({0[Daug_ETA_MIN]}, ETA, {0[Daug_ETA_MAX]}))').format(
                self.config)
        protonPIDCuts = (
            pidFiducialCuts + '& ((PIDp - PIDpi) > {0[Proton_PIDpPIDpi_MIN]})'
            '& ((PIDp - PIDK) > {0[Proton_PIDpPIDK_MIN]})').format(self.config)
        kaonPIDCuts = (pidFiducialCuts +
                       '& ((PIDK - PIDpi) > {0[K_PIDK_MIN]})').format(
                           self.config)
        pionPIDCuts = (pidFiducialCuts +
                       '& ((PIDK - PIDpi) < {0[Pi_PIDK_MAX]})').format(
                           self.config)
        pionCuts = '{0} & {1}'.format(daugCuts, pionPIDCuts)
        kaonCuts = '{0} & {1}'.format(daugCuts, kaonPIDCuts)
        protonCuts = '{0} & {1}'.format(daugCuts, protonPIDCuts)

        # Filter StdAllNoPIDs particles
        self.inPions = Selection('PionsFor{0}'.format(name),
                                 Algorithm=FilterDesktop(
                                     'FilterPionsFor{0}'.format(name),
                                     Code=pionCuts),
                                 RequiredSelections=[StdAllNoPIDsPions])
        self.inKaons = Selection('KaonsFor{0}'.format(name),
                                 Algorithm=FilterDesktop(
                                     'FilterKaonsFor{0}'.format(name),
                                     Code=kaonCuts),
                                 RequiredSelections=[StdAllNoPIDsKaons])
        self.inProtons = Selection('ProtonsFor{0}'.format(name),
                                   Algorithm=FilterDesktop(
                                       'FilterProtonsFor{0}'.format(name),
                                       Code=protonCuts),
                                   RequiredSelections=[StdAllNoPIDsProtons])
        # Don't used filtered pions for soft pions, cut would be too tight
        self.inSoftPions = StdAllNoPIDsPions

        self.selLambdac2PKPi = self.makeLambdac2PHH(
            name=lambdac_name,
            inputSel=[self.inProtons, self.inKaons, self.inPions],
            decDescriptors=self.Lambdac2PKPi)
        self.selLambdac2PKPiMVA = self.makeMVASelection(
            '{0}MVASelection'.format(lambdac_name), self.selLambdac2PKPi)

        self.selLambdac2PKK = self.makeLambdac2PHH(
            name=lambdac_pKK_name,
            inputSel=[self.inProtons, self.inKaons],
            decDescriptors=self.Lambdac2PKK)
        self.selLambdac2PKKMVA = self.makeMVASelection(
            '{0}MVASelection'.format(lambdac_pKK_name), self.selLambdac2PKK)

        self.selLambdac2PPiPi = self.makeLambdac2PHH(
            name=lambdac_ppipi_name,
            inputSel=[self.inProtons, self.inPions],
            decDescriptors=self.Lambdac2PPiPi)
        self.selLambdac2PPiPiMVA = self.makeMVASelection(
            '{0}MVASelection'.format(lambdac_ppipi_name),
            self.selLambdac2PPiPi)

        self.selLambdac2PPiKWS = self.makeLambdac2PHH(
            name=lambdac_ppiK_name,
            inputSel=[self.inProtons, self.inKaons, self.inPions],
            decDescriptors=self.Lambdac2PPiKWS)
        self.selLambdac2PPiKWSMVA = self.makeMVASelection(
            '{0}MVASelection'.format(lambdac_ppiK_name),
            self.selLambdac2PPiKWS)

        self.selSigmacz2LambdacPi = self.makeSigmac2LambdacPi(
            name=sigmacz_name,
            inputSel=[self.selLambdac2PKPiMVA, self.inSoftPions],
            decDescriptors=self.Sigmacz2LambdacPi)

        self.selSigmacpp2LambdacPi = self.makeSigmac2LambdacPi(
            name=sigmacpp_name,
            inputSel=[self.selLambdac2PKPiMVA, self.inSoftPions],
            decDescriptors=self.Sigmacpp2LambdacPi)

        self.line_Lambdac2PKPi = self.make_line(
            name='{0}Line'.format(lambdac_name),
            selection=self.selLambdac2PKPiMVA,
            prescale=config['PrescaleLambdac2PKPi'],
            postscale=config['PostscaleLambdac2PKPi'],
            HLT1=config['Hlt1Filter'],
            HLT2=config['Hlt2Filter'])

        self.line_Lambdac2PKK = self.make_line(
            name='{0}Line'.format(lambdac_pKK_name),
            selection=self.selLambdac2PKKMVA,
            prescale=config['PrescaleLambdac2PKK'],
            postscale=config['PostscaleLambdac2PKK'],
            HLT1=config['Hlt1Filter'],
            HLT2=config['Hlt2Filter'])

        self.line_Lambdac2PPiPi = self.make_line(
            name='{0}Line'.format(lambdac_ppipi_name),
            selection=self.selLambdac2PPiPiMVA,
            prescale=config['PrescaleLambdac2PPiPi'],
            postscale=config['PostscaleLambdac2PPiPi'],
            HLT1=config['Hlt1Filter'],
            HLT2=config['Hlt2Filter'])

        self.line_Lambdac2PPiKWS = self.make_line(
            name='{0}Line'.format(lambdac_ppiK_name),
            selection=self.selLambdac2PPiKWSMVA,
            prescale=config['PrescaleLambdac2PPiKWS'],
            postscale=config['PostscaleLambdac2PPiKWS'],
            HLT1=config['Hlt1Filter'],
            HLT2=config['Hlt2Filter'])

        self.line_Sigmacz2LambdacPi = self.make_line(
            name='{0}Line'.format(sigmacz_name),
            selection=self.selSigmacz2LambdacPi,
            prescale=config['PrescaleSigmacz2LambdacPi'],
            postscale=config['PostscaleSigmacz2LambdacPi'],
            HLT1=config['Hlt1Filter'],
            HLT2=config['Hlt2Filter'])

        self.line_Sigmacpp2LambdacPi = self.make_line(
            name='{0}Line'.format(sigmacpp_name),
            selection=self.selSigmacpp2LambdacPi,
            prescale=config['PrescaleSigmacpp2LambdacPi'],
            postscale=config['PostscaleSigmacpp2LambdacPi'],
            HLT1=config['Hlt1Filter'],
            HLT2=config['Hlt2Filter'])
Пример #22
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)
        self.__confdict__ = config

        ############### MUON SELECTIONS ###################
        self.selmuon = Selection("Mufor" + name,
                                 Algorithm=self._muonFilter(),
                                 RequiredSelections=[StdAllLooseMuons])

        self.selFakemuon = Selection("FakeMufor" + name,
                                     Algorithm=self._FakemuonFilter(),
                                     RequiredSelections=[StdAllNoPIDsMuons])

        ############### KAON AND PION SELECTIONS ################

        self.selKaon = Selection("Kfor" + name,
                                 Algorithm=self._kaonFilter(),
                                 RequiredSelections=[StdLooseKaons])

        self.selPion = Selection("Pifor" + name,
                                 Algorithm=self._pionFilter(),
                                 RequiredSelections=[StdLoosePions])

        ################ D0 -> HH SELECTION ##########################

        self.seld02kpi = Selection(
            "D02KPifor" + name,
            Algorithm=self._D02KPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion])

        self.selb2D0MuX = makeb2DMuX(
            'b2D0MuX' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuon,
            DSel=self.seld02kpi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'])

        self.selFakeb2D0MuX = makeFakeb2DMuX(
            'b2D0MuXFake' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            FakeMuSel=self.selFakemuon,
            DSel=self.seld02kpi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'])

        ################# DECLARE THE STRIPPING LINES #################################

        GECs = {
            "Code":
            " ( recSummary(LHCb.RecSummary.nSPDhits,'Raw/Spd/Digits') < %(SPDmax)s )"
            % config,
            "Preambulo": ["from LoKiTracks.decorators import *"]
        }

        ########## D0 -> HH ###########
        self.B2DMuForTauMu = StrippingLine('b2D0MuX' + name + 'Line',
                                           prescale=1,
                                           selection=self.selb2D0MuX,
                                           FILTER=GECs)
        self.registerLine(self.B2DMuForTauMu)

        self.FakeB2DMuForTauMu = StrippingLine('b2D0MuXFake' + name + 'Line',
                                               prescale=0.08,
                                               selection=self.selFakeb2D0MuX,
                                               FILTER=GECs)
        self.registerLine(self.FakeB2DMuForTauMu)
Пример #23
0
def filterKst():
    kst = DataOnDemand(Location='Phys/StdLooseDetachedKst2Kpi/Particles')
    code = '(MIPCHI2DV(PRIMARY) > 25)'
    return Selection('KstDarkBosonFilter',
                     Algorithm=FilterDesktop(Code=code),
                     RequiredSelections=[kst])
Пример #24
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)
        self.__confdict__ = config

        xic_PKPi_name = name + 'Xic2PKPi'
        xic_pKK_name = name + 'Xic2PKK'
        theta_pks_name = name + 'Theta2PKS0'
        xic_klam_name = name + 'Xic2KLam'

        self.KS0LL = DataOnDemand(Location="Phys/StdLooseKsLL/Particles")
        self.KS0DD = DataOnDemand(Location="Phys/StdLooseKsDD/Particles")
        self.LamLL = DataOnDemand(Location="Phys/StdLooseLambdaLL/Particles")
        self.LamDD = DataOnDemand(Location="Phys/StdLooseLambdaDD/Particles")

        ############### PROTON SELECTIONS #########################################

        self.inProtons = Selection("Protonsfor" + name,
                                   Algorithm=self._protonFilter(),
                                   RequiredSelections=[StdAllNoPIDsProtons])

        ############### PIONS, Lambda0, KS0 and KAONS SELECTIONS ##################

        self.inPions = Selection("Pionsfor" + name,
                                 Algorithm=self._pionFilter(),
                                 RequiredSelections=[StdNoPIDsPions])

        self.KS0 = Selection("KSfor" + name,
                             Algorithm=self._ksFilter(),
                             RequiredSelections=[self.KS0LL])

        self.Lam = Selection("Lambdafor" + name,
                             Algorithm=self._lamFilter(),
                             RequiredSelections=[self.LamLL, self.LamDD])

        self.inKaons = Selection("Kaonsfor" + name,
                                 Algorithm=self._kaonFilter(),
                                 RequiredSelections=[StdNoPIDsKaons])

        ###############################################################

        self.selXic2PKPi = makeXic2PKPi(
            name=xic_PKPi_name,
            inputSel=[self.inProtons, self.inKaons, self.inPions],
            Daug_All_PT_MIN=config['Daug_All_PT_MIN'],
            Daug_1of3_BPVIPCHI2_MIN=config['Daug_1of3_BPVIPCHI2_MIN'],
            Daug_P_MIN=config['Daug_P_MIN'],
            Daug_TRCHI2DOF_MAX=config['Daug_TRCHI2DOF_MAX'],
            Comb_MASS_MIN=2190. * MeV,
            Comb_MASS_MAX=2570. * MeV,
            Comb_ADOCAMAX_MAX=config['Comb_ADOCAMAX_MAX'],
            Xic_PT_MIN=config['Xic_PT_MIN'],
            Xic_VCHI2VDOF_MAX=config['Xic_VCHI2VDOF_MAX'],
            Xic_BPVVDCHI2_MIN=config['Xic_BPVVDCHI2_MIN'],
            Xic_BPVDIRA_MIN=config['Xic_BPVDIRA_MIN'],
            Xic_BPVIPCHI2_MAX=config['Xic_BPVIPCHI2_MAX'],
            Xic_BPVLTIME_MAX=config['Xic_BPVLTIME_MAX'],
            Xic_BPVLTIME_MIN=config['Xic_BPVLTIME_MIN'])

        self.selXic2PKK = makeXic2PKPi(
            name=xic_pKK_name,
            inputSel=[self.inKaons, self.inProtons],
            Daug_All_PT_MIN=config['Daug_All_PT_MIN'],
            Daug_1of3_BPVIPCHI2_MIN=config['Daug_1of3_BPVIPCHI2_MIN'],
            Daug_P_MIN=config['Daug_P_MIN'],
            Daug_TRCHI2DOF_MAX=config['Daug_TRCHI2DOF_MAX'],
            Comb_MASS_MIN=config['Comb_MASS_MIN'],
            Comb_MASS_MAX=2800. * MeV,
            Comb_ADOCAMAX_MAX=config['Comb_ADOCAMAX_MAX'],
            Xic_PT_MIN=config['Xic_PT_MIN'],
            Xic_VCHI2VDOF_MAX=config['Xic_VCHI2VDOF_MAX'],
            Xic_BPVVDCHI2_MIN=config['Xic_BPVVDCHI2_MIN'],
            Xic_BPVDIRA_MIN=config['Xic_BPVDIRA_MIN'],
            Xic_BPVIPCHI2_MAX=config['Xic_BPVIPCHI2_MAX'],
            Xic_BPVLTIME_MAX=config['Xic_BPVLTIME_MAX'],
            Xic_BPVLTIME_MIN=config['Xic_BPVLTIME_MIN'],
            decDescriptors=["[Lambda_c+ -> p+ K- K+]cc"])

        self.selTheta2PKS0 = makeTheta2PKS0(
            name=theta_pks_name,
            inputSel=[self.KS0, self.inProtons],
            Daug_All_PT_MIN=config['Daug_All_PT_MIN'],
            Daug_P_MIN=config['Daug_P_MIN'],
            Daug_TRCHI2DOF_MAX=config['Daug_TRCHI2DOF_MAX'],
            Comb_MASS_MIN=1440. * MeV,
            Comb_MASS_MAX=1800. * MeV,
            Comb_ADOCAMAX_MAX=1.0 * mm,
            Xic_PT_MIN=config['Xic_PT_MIN'],
            Xic_BPVDIRA_MIN=-100.,
            Xic_BPVIPCHI2_MAX=config['Xic_BPVIPCHI2_MAX'],
            Xic_BPVLTIME_MAX=config['Xic_BPVLTIME_MAX'],
            Xic_BPVLTIME_MIN=config['Xic_BPVLTIME_MIN'],
            decDescriptors=["[Lambda_c+ -> p+ KS0]cc"])

        self.selXic2KLam = makeXic2KLam(
            name=xic_klam_name,
            inputSel=[self.Lam, self.inKaons],
            Daug_All_PT_MIN=config['Daug_All_PT_MIN'],
            Daug_P_MIN=config['Daug_P_MIN'],
            Daug_TRCHI2DOF_MAX=config['Daug_TRCHI2DOF_MAX'],
            Comb_MASS_MIN=2100. * MeV,
            Comb_MASS_MAX=2800. * MeV,
            Comb_ADOCAMAX_MAX=0.5 * mm,
            Xic_PT_MIN=config['Xic_PT_MIN'],
            Xic_BPVDIRA_MIN=-100.,
            Xic_BPVIPCHI2_MAX=config['Xic_BPVIPCHI2_MAX'],
            Xic_BPVLTIME_MAX=config['Xic_BPVLTIME_MAX'],
            Xic_BPVLTIME_MIN=config['Xic_BPVLTIME_MIN'],
            decDescriptors=["[Lambda_c+ -> K+ Lambda0]cc"])

        self.line_Xic2PKPi = self._strippingLine(
            name=xic_PKPi_name + 'Line',
            HLT=config['HltFilter'],
            prescale=config['PrescaleXic2PKPi'],
            postscale=config['PostscaleXic2PKPi'],
            ExtraInfoTools=config['ExtraInfoTools'],
            selection=self.selXic2PKPi,
        )

        self.line_Xic2PKK = self._strippingLine(
            name=xic_pKK_name + 'Line',
            HLT=config['HltFilter'],
            prescale=config['PrescaleXic2PKK'],
            postscale=config['PostscaleXic2PKK'],
            ExtraInfoTools=config['ExtraInfoTools'],
            selection=self.selXic2PKK,
        )

        self.line_Theta2PKS0 = self._strippingLine(
            name=theta_pks_name + 'Line',
            prescale=config['PrescaleXic2PV0'],
            postscale=config['PostscaleXic2PV0'],
            ExtraInfoTools=config['ExtraInfoTools'],
            selection=self.selTheta2PKS0,
        )

        self.line_Xic2KLam = self._strippingLine(
            name=xic_klam_name + 'Line',
            prescale=config['PrescaleXic2KLam'],
            postscale=config['PostscaleXic2KLam'],
            selection=self.selXic2KLam)
Пример #25
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)
        self.__confdict__ = config

        ############### MUON SELECTIONS ###################
        self.selmuon = Selection("Mufor" + name,
                                 Algorithm=self._muonFilter(),
                                 RequiredSelections=[StdLooseMuons])

        self.selmuonhighPT = Selection(
            "MuhighPTfor" + name,
            Algorithm=FilterDesktop(
                Code=
                "(TRCHI2DOF < %(TRCHI2)s) & (PT>1.2*GeV) & (MIPCHI2DV(PRIMARY)> 9.0)"
                % self.__confdict__),
            RequiredSelections=[self.selmuon])

        self.selmuontight = Selection(
            "Mutightfor" + name,
            Algorithm=FilterDesktop(Code="(MIPCHI2DV(PRIMARY)> 100)"),
            RequiredSelections=[self.selmuonhighPT])

        self.selmuonnew = Selection(
            "Munewfor" + name,
            Algorithm=FilterDesktop(
                Code="(MIPCHI2DV(PRIMARY)> 9.0) & (TRCHI2DOF < %(TRCHI2)s)" %
                self.__confdict__),
            RequiredSelections=[self.selmuon])

        self.selmuonTOS = TOSFilter("MuTOS" + name, self.selmuontight,
                                    "Hlt2SingleMuonDecision")

        ############### KAON AND PION SELECTIONS ################

        self.selKaon = Selection("Kfor" + name,
                                 Algorithm=self._kaonFilter(),
                                 RequiredSelections=[StdLooseKaons])

        self.selPion = Selection("Pifor" + name,
                                 Algorithm=self._pionFilter(),
                                 RequiredSelections=[StdLoosePions])

        self.selPionTight = Selection(
            "PiTightfor" + name,
            Algorithm=FilterDesktop(Code="(PIDK< %(PionPIDKTight)s)" %
                                    self.__confdict__),
            RequiredSelections=[self.selPion])

        self.selPionloose = Selection("Piloosefor" + name,
                                      Algorithm=self._pionlooseFilter(),
                                      RequiredSelections=[StdNoPIDsPions])

        self.selKaonloose = Selection("Kloosefor" + name,
                                      Algorithm=self._kaonlooseFilter(),
                                      RequiredSelections=[StdLooseKaons])

        self.selpion_fakes = Selection("Pion_fakes_for" + name,
                                       Algorithm=self._pionFilter_fakes(),
                                       RequiredSelections=[StdLoosePions])

        ################ PHI->KK SELECTION ###########################

        self.selphi2kk = Selection("Phi2KKfor" + name,
                                   Algorithm=self._Phi2KKFilter(),
                                   RequiredSelections=[self.selKaonloose])

        self.selphi2kk_forfakes = Selection(
            "Phi2KK_forfakes_for" + name,
            Algorithm=self._Phi2KK_forfakes_Filter(),
            RequiredSelections=[self.selKaonloose])

        ################ D0 -> HH SELECTION ##########################

        self.seld02kpi = Selection(
            "D02KPifor" + name,
            Algorithm=self._D02KPiFilter(),
            RequiredSelections=[self.selKaon, self.selPionTight])

        self.seld02kk = Selection("D02KKfor" + name,
                                  Algorithm=self._D02KKFilter(),
                                  RequiredSelections=[self.selKaon])

        self.seld02pipi = Selection("D02PiPifor" + name,
                                    Algorithm=self._D02PiPiFilter(),
                                    RequiredSelections=[self.selPionTight])

        ################ D0 -> 4H SELECTION ##########################

        self.seld02k3pi = Selection(
            "D02K3Pifor" + name,
            Algorithm=self._D02K3PiFilter(),
            RequiredSelections=[self.selKaon, StdLoosePions])

        ################ D+/Ds+ -> HHH SELECTIONS ##########################

        self.seldp2kpipi = Selection(
            "Dp2KPiPifor" + name,
            Algorithm=self._Dp2KPiPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion])

        self.selds2kkpi = Selection(
            "Ds2KKPifor" + name,
            Algorithm=self._Ds2KKPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion])

        self.selds2phipi = Selection(
            "Ds2PhiPifor" + name,
            Algorithm=self._Ds2PhiPiFilter(),
            RequiredSelections=[self.selphi2kk, self.selPionloose])

        self.selds2phipi_forfakes = Selection(
            "Ds2PhiPi_forfakes_for" + name,
            Algorithm=self._Ds2PhiPi_forfakes_Filter(),
            RequiredSelections=[self.selphi2kk_forfakes, self.selPionloose])

        ############ Lambda_c+ -> pKpi ########################
        self.sellambdac = Selection(
            "Lc2PKPifor" + name,
            Algorithm=self._Lc2PKPiFilter(),
            RequiredSelections=[self.selKaon, self.selPion, StdLooseProtons])

        ################ MAKE THE B CANDIDATES #################################

        self.selb2D0MuX = makeb2DMuX('b2D0MuX' + name,
                                     DecayDescriptors=['[B- -> D0 mu-]cc'],
                                     MuSel=self.selmuonhighPT,
                                     DSel=self.seld02kpi,
                                     BVCHI2DOF=config['BVCHI2DOF'],
                                     BDIRA=config['BDIRA'],
                                     DZ=config['DZLoose'])

        self.selb2D0MuXKpiDCS = makeb2DMuX(
            'b2D0MuXKpiDCS' + name,
            DecayDescriptors=['[B+ -> D0 mu+]cc'],
            MuSel=self.selmuonhighPT,
            DSel=self.seld02kpi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZLoose'])

        self.selb2D0MuXKK = makeb2DMuX(
            'b2D0MuXKK' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuon,
            DSel=self.seld02kk,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZLoose'])

        self.selb2D0MuXpipi = makeb2DMuX(
            'b2D0MuXpipi' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuon,
            DSel=self.seld02pipi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZLoose'])

        self.selb2D0MuXK3Pi = makeb2DMuX(
            'b2D0MuXK3Pi' + name,
            DecayDescriptors=['[B- -> D0 mu-]cc', '[B+ -> D0 mu+]cc'],
            MuSel=self.selmuonTOS,
            DSel=self.seld02k3pi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2DpMuX = makeb2DMuX(
            'b2DpMuX' + name,
            DecayDescriptors=['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            MuSel=self.selmuonnew,
            DSel=self.seldp2kpipi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2DsMuX = makeb2DMuX(
            'b2DsMuX' + name,
            DecayDescriptors=['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            MuSel=self.selmuonnew,
            DSel=self.selds2kkpi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        self.selb2LcMuX = makeb2DMuX('b2LcMuX' + name,
                                     DecayDescriptors=[
                                         '[Lambda_b0 -> Lambda_c+ mu-]cc',
                                         '[Lambda_b0 -> Lambda_c+ mu+]cc'
                                     ],
                                     MuSel=self.selmuonnew,
                                     DSel=self.sellambdac,
                                     BVCHI2DOF=config['BVCHI2DOF'],
                                     BDIRA=config['BDIRA'],
                                     DZ=config['DZ'])

        self.selb2DsMuXPhiPi = makeb2DMuX(
            'b2DsMuXPhiPi' + name,
            DecayDescriptors=['[B0 -> D- mu+]cc', '[B0 -> D- mu-]cc'],
            MuSel=self.selmuon,
            DSel=self.selds2phipi,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])
        ################ Using another Algo for DHadron ################
        self.selb2DsPi_PhiPi_fakes = makeb2DX(
            'b2DsPi_PhiPi_fakes' + name,
            DecayDescriptors=['[B0 -> D- pi+]cc', '[B0 -> D- pi-]cc'],
            HadSel=self.selpion_fakes,
            DSel=self.selds2phipi_forfakes,
            BVCHI2DOF=config['BVCHI2DOF'],
            BDIRA=config['BDIRA'],
            DZ=config['DZ'])

        ################# DECLARE THE STRIPPING LINES #################################

        ########## D0 -> HH ###########
        self.b2D0MuXLine = StrippingLine('b2D0MuX' + name + 'Line',
                                         prescale=config['PrescalD0Mu'],
                                         selection=self.selb2D0MuX)
        self.b2D0MuXKpiDCSLine = StrippingLine('b2D0MuXKpiDCS' + name + 'Line',
                                               prescale=1,
                                               selection=self.selb2D0MuXKpiDCS)
        self.b2D0MuXKKLine = StrippingLine('b2D0MuXKK' + name + 'Line',
                                           prescale=1,
                                           selection=self.selb2D0MuXKK)
        self.b2D0MuXpipiLine = StrippingLine('b2D0MuXpipi' + name + 'Line',
                                             prescale=1,
                                             selection=self.selb2D0MuXpipi)

        ######## Lines for time integrated A_SL #########
        self.b2DpMuXLine = StrippingLine('b2DpMuX' + name + 'Line',
                                         prescale=1,
                                         selection=self.selb2DpMuX)
        self.b2DsMuXLine = StrippingLine('b2DsMuX' + name + 'Line',
                                         prescale=1,
                                         selection=self.selb2DsMuX)
        self.b2DsMuXPhiPiLine = StrippingLine('b2DsMuXPhiPi' + name + 'Line',
                                              prescale=1,
                                              selection=self.selb2DsMuXPhiPi)
        self.b2DsPi_PhiPi_fakesLine = StrippingLine(
            'b2DsPi_PhiPi_fakes' + name + 'Line',
            HLT="HLT_PASS_RE('Hlt2IncPhi.*Decision')",
            prescale=config['PrescalDsPi_fakes'],
            selection=self.selb2DsPi_PhiPi_fakes)

        ########### D0 -> HHHHH
        self.b2D0MuXK3PiLine = StrippingLine('b2D0MuXK3Pi' + name + 'Line',
                                             prescale=1,
                                             selection=self.selb2D0MuXK3Pi)

        ########## Lambda_c+ -> p HH
        self.b2LcMuXLine = StrippingLine('b2LcMuX' + name + 'Line',
                                         prescale=1,
                                         selection=self.selb2LcMuX)

        ############## REGISTER THE LINES #####################

        ######### lines from stripping 17 #######
        self.registerLine(self.b2D0MuXLine)
        self.registerLine(self.b2D0MuXKpiDCSLine)
        self.registerLine(self.b2DpMuXLine)
        self.registerLine(self.b2DsMuXLine)
        self.registerLine(self.b2LcMuXLine)
        self.registerLine(self.b2D0MuXK3PiLine)
        self.registerLine(self.b2D0MuXKKLine)
        self.registerLine(self.b2D0MuXpipiLine)
        self.registerLine(self.b2DsMuXPhiPiLine)
        self.registerLine(self.b2DsPi_PhiPi_fakesLine)
Пример #26
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)

        self.pion = Pions
        self.proton = Protons

        trkFilterP = FilterDesktop(
            Code='(MIPCHI2DV(PRIMARY) > %(Trk_MinIPChi2)s)    & \
                                               (TRGHOSTPROB        < %(Trk_MaxGhostProb)s) & \
                                               (TRCHI2DOF          < %(Trk_MaxChi2Ndof)s)  & \
                                               (P                  > %(Trk_MinP)s)         & \
                                               (PROBNNp            > %(Trk_MinProbNNp)s)'
            % config)

        trkFilterPi = FilterDesktop(
            Code='(MIPCHI2DV(PRIMARY) > %(Trk_MinIPChi2)s)    & \
                                               (TRGHOSTPROB        < %(Trk_MaxGhostProb)s) & \
                                               (TRCHI2DOF          < %(Trk_MaxChi2Ndof)s)  & \
                                               (P                  > %(Trk_MinP)s)'
            % config)

        self.myPions = Selection('PionsFor' + name,
                                 Algorithm=trkFilterPi,
                                 RequiredSelections=[self.pion])

        self.myProtons = Selection('ProtonsFor' + name,
                                   Algorithm=trkFilterP,
                                   RequiredSelections=[self.proton])

        self.makeXb2ppph(name + '_4body', config)

        self.lineXb2ppph = StrippingLine(
            'Xb2ppphLine',
            prescale=config['Prescale'],
            postscale=config['Postscale'],
            selection=self.selXb2ppph,
            RelatedInfoTools=[{
                "Type":
                "RelInfoConeVariables",
                "ConeAngle":
                0.8,
                "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'],
                "Location":
                "P2ConeVar08_0",
                "DaughterLocations": {
                    '[Lambda_b0 -> ^p+ p~- p+ pi-]CC': 'P2ConeVar08_1',
                    '[Lambda_b0 -> p+ ^p~- p+ pi-]CC': 'P2ConeVar08_2',
                    '[Lambda_b0 -> p+ p~- ^p+ pi-]CC': 'P2ConeVar08_3',
                    '[Lambda_b0 -> p+ p~- p+ ^pi-]CC': 'P2ConeVar08_4'
                }
            }, {
                "Type":
                "RelInfoConeVariables",
                "ConeAngle":
                1.0,
                "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'],
                "Location":
                "P2ConeVar10_0",
                "DaughterLocations": {
                    '[Lambda_b0 -> ^p+ p~- p+ pi-]CC': 'P2ConeVar10_1',
                    '[Lambda_b0 -> p+ ^p~- p+ pi-]CC': 'P2ConeVar10_2',
                    '[Lambda_b0 -> p+ p~- ^p+ pi-]CC': 'P2ConeVar10_3',
                    '[Lambda_b0 -> p+ p~- p+ ^pi-]CC': 'P2ConeVar10_4'
                }
            }, {
                "Type":
                "RelInfoConeVariables",
                "ConeAngle":
                1.3,
                "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'],
                "Location":
                "P2ConeVar13_0",
                "DaughterLocations": {
                    '[Lambda_b0 -> ^p+ p~- p+ pi-]CC': 'P2ConeVar13_1',
                    '[Lambda_b0 -> p+ ^p~- p+ pi-]CC': 'P2ConeVar13_2',
                    '[Lambda_b0 -> p+ p~- ^p+ pi-]CC': 'P2ConeVar13_3',
                    '[Lambda_b0 -> p+ p~- p+ ^pi-]CC': 'P2ConeVar13_4'
                }
            }, {
                "Type":
                "RelInfoConeVariables",
                "ConeAngle":
                1.7,
                "Variables": ['CONEANGLE', 'CONEMULT', 'CONEPTASYM'],
                "Location":
                "P2ConeVar17_0",
                "DaughterLocations": {
                    '[Lambda_b0 -> ^p+ p~- p+ pi-]CC': 'P2ConeVar17_1',
                    '[Lambda_b0 -> p+ ^p~- p+ pi-]CC': 'P2ConeVar17_2',
                    '[Lambda_b0 -> p+ p~- ^p+ pi-]CC': 'P2ConeVar17_3',
                    '[Lambda_b0 -> p+ p~- p+ ^pi-]CC': 'P2ConeVar17_4'
                }
            }, {
                "Type": "RelInfoVertexIsolation",
                "Location": "VertexIsoInfo"
            }])

        self.registerLine(self.lineXb2ppph)
Пример #27
0
class StrippingHyperCPXConf(LineBuilder) :
    """
    Helper class to construct stirppinglines for search Sigma+ -> p mu+ mu- 
    """
    __configuration_keys__ = tuple ( _default_configuration_.keys() ) 
    
    ## get the default configuration 
    @staticmethod
    def defaultConfiguration( key = None ) :
        """
        Get the defualt configurtaion
        >>> conf = StrippingHyperCPXConf.defaultConfiguration()
     
        Get the elements of default configurtaion:
        
        >>> SigmaPrescale = StrippingHyperCPXConf.defaultConfiguration( 'SigmaPrescale' )
        """
        from copy import deepcopy
        _config_ = deepcopy ( _default_configuration_ )
        if key : return _config_[ key ]
        return _config_
 
    
    ## constructor
    def __init__( self , name , config ) :
        """
        Constructor
        """

        ##
        if isinstance ( config , dict ) : 
            from copy import deepcopy
            _config_ = deepcopy ( _default_configuration_ )
            _config_ . update   ( config )
        else :
            _config_ = config
                
        ## base class 
        LineBuilder.__init__( self , name , _config_ )
        
        for line in self._lines_private() :
            self.registerLine(line)
            
    ## define ``main'' selection for Sigma+ -> p mu+ mu-     
    def sigma    ( self ) :
        """
        define ``main'' selection for Sigma+ -> p mu+ mu-
        """
        
        if hasattr ( self , 'Sigma' )  : return self.Sigma
        
        _SigmaAlg = CombineParticles (
            #
            DecayDescriptors = [
            " [ Sigma+  -> p+  mu+ mu- ]cc " ,  # signal           
            " [ Sigma~+ -> p~- mu+ mu+ ]cc "    # background 
            ] ,
            #
            DaughtersCuts = {
            'p+'                                 : self._config['ProtonCuts']
            } , 
            #
            Preambulo       =                      self._config [ 'Preambulo' ] , 
            # 
            CombinationCut  = """
            ADAMASS('Sigma+') < %s
            """                                   % self._config[ 'SigmaMass' ] , 
            #
            MotherCut       = """
            ( chi2vx < 25 ) &
            ( ctau   > %s   )
            """                                   % self._config['SigmaCTau']
            )
        
        self.Sigma = Selection (
            'SelSigma2pMuMuFor' + self.name()   ,
            Algorithm  = _SigmaAlg ,
            RequiredSelections = [ self.twoMuons () ,
                                   StdLooseProtons  ]
            )
        
        return self.Sigma

    
    ## define ``normalization'' selection for Ds+ -> ( phi -> mu+ mu- ) pi+
    def ds2PhiPi    ( self ) :
        """
        Define ``normalization'' selection for Ds+ -> ( phi -> mu+ mu- ) pi+
        """
        if hasattr ( self , 'PhiPi' )  : return self.PhiPi
        
        _PhiPiAlg = CombineParticles (
            #
            DecayDescriptors = [
            " [ D_s+  -> pi+  mu+ mu- ]cc " ,  # signal           
            " [ D_s+  -> pi-  mu+ mu+ ]cc "    # backghround  
            ] ,
            #
            DaughtersCuts = {
            'pi+' :                           self._config['PionCuts_forTau23Mu']
            } , 
            #
            Preambulo        =                self._config [ 'Preambulo' ] , 
            # 
            CombinationCut  = """
                        ( ADAMASS ( 'D_s+' ) < %s ) & phi 
            """                              % self._config[ 'Ds2PhiPiMass' ]  , 
            #
            MotherCut       = """
            ( chi2vx < 20 ) &
            ( ctau_forDs   > %s   ) &
            ( BPVIPCHI2() < 225 )
            """                              % self._config['DsCTau']
            )
        
        self.PhiPi = Selection (
            'SelDs2PhiPiFor' + self.name()  ,
            Algorithm  = _PhiPiAlg    ,
            RequiredSelections = [ self.twoMuons_forTau23Mu () ,
                                   StdLoosePions    ]
            )
        
        return self.PhiPi


    ## define ``normalization'' selection for Ds+ -> pi+ pi- pi+
    def ds2PiPiPi    ( self ) :
        """
        Define ``normalization'' selection for Ds+ ->  pi+ pi- pi+
        """

        def makeTISTOS( name, _input, _trigger ) :
            from Configurables import TisTosParticleTagger
            _tisTosFilter = TisTosParticleTagger( name + "Tagger" )
            _tisTosFilter.TisTosSpecs = { _trigger : 0 }
            #_tisTosFilter.ProjectTracksToCalo = False
            #_tisTosFilter.CaloClustForCharged = False
            #_tisTosFilter.CaloClustForNeutral = False
            #_tisTosFilter.TOSFrac = { 4:0.0, 5:0.0 }
            return Selection( name
                              , Algorithm = _tisTosFilter
                              , RequiredSelections = [ _input ]
                              )        


        _PiPiPiAlg = CombineParticles (
            #
            DecayDescriptors = [" [ D_s+  -> pi+ pi+ pi- ]cc " ] ,
            #
            DaughtersCuts = {
            'pi+' :                           self._config['PionCuts_forTau23Mu']
            } , 
            #
            Preambulo        =                self._config [ 'Preambulo' ] , 
            # 
            CombinationCut  = """
                        ( ADAMASS ( 'D_s+' ) < %s ) 
            """                              % self._config[ 'Ds23PiMass' ]  , 
            #
            MotherCut       = """
            ( chi2vx < 20 ) &
            ( ctau_forDs   > %s   ) &
            ( BPVIPCHI2() < 225 )
            """                              % self._config['DsCTau']
            )
        
       
        self.combPiPiPi = Selection (
            'SelDs2PiPiPiFor' + self.name()  ,
            Algorithm  = _PiPiPiAlg ,
            RequiredSelections = [ StdLoosePions  ]
            )
        
        self.selDs23PiHlt1TIS = makeTISTOS( self.name() + "Ds23PiHlt1TIS"
                                    , self.combPiPiPi
                                    , "Hlt1.*Decision%TIS"
                                            )
        self.selDs23PiHlt2TIS = makeTISTOS( self.name() + "Ds23PiHlt2TIS"
                                            , self.selDs23PiHlt1TIS
                                            , "Hlt2.*Decision%TIS"
                                            )
       
        return self.selDs23PiHlt2TIS

    
    ## define selection for D+ -> pi mu+ mu-
    def d2PiMuMu    ( self ) :
        """
        Define selection for D+ -> pi mu+ mu-
        """
        
        if hasattr ( self , 'PiMuMu' )  : return self.PiMuMu
        
        _PiMuMuAlg = CombineParticles (
            #
            DecayDescriptors = [
            " [ D+  -> pi+  mu+ mu- ]cc " ,  # signal           
            " [ D+  -> pi-  mu+ mu+ ]cc "    # backghround  
            ] ,
            #
            DaughtersCuts = {
            'pi+' :                                 self._config['PionCuts']
            } , 
            #
            Preambulo       =                       self._config [ 'Preambulo' ] , 
            # 
            CombinationCut  = """
            ( APT > 2 * GeV         ) &
            ( ADAMASS ( 'D+' ) < %s ) 
            """                                   % self._config[ 'DplusMass' ] , 
            #
            MotherCut       = """
            ( chi2vx < 25 ) &
            ( ctau   > %s   )
            """                                   % self._config['DplusCTau']
            )
        
        self.PiMuMu = Selection (
            'SelDplus2PiMuMuFor' + self.name() ,
            Algorithm  = _PiMuMuAlg ,
            RequiredSelections = [ self.twoMuons () ,
                                   StdLoosePions    ]
            )
        
        #return self.PhiPi#was bug ??? JA 20110825
        return self.PiMuMu
    
    
    ## get the muon selection 
    def twoMuons ( self ) :
        """
        Get the proton selection
        """
        if hasattr ( self , 'TwoMuons' ) : return self.TwoMuons 
        
        _MuonFilter = FilterDesktop (
            Code = " ( 'mu+' == ABSID ) & " + self._config['MuonCuts'] 
            )
        
        self.Muons = Selection (
            'SelMuonsFor' + self.name ()  ,
            Algorithm          = _MuonFilter ,
            RequiredSelections = [ StdLooseMuons ]
            )
        
        ## require at least 2 muons 
        self.TwoMuons = VoidEventSelection (
            "TwoMuonsFor" + self.name()   ,
            Code      = """
            CONTAINS('%s') > 1.5
            """       % self.Muons.outputLocation() , 
            RequiredSelection = self.Muons 
            )
        #
        return self.TwoMuons


    ## get the muon selection for Tau->3mu Ds Normalization Channels
    def twoMuons_forTau23Mu ( self ) :
        """
        Get the proton selection
        """
        if hasattr ( self , 'TwoMuons_forTau23Mu' ) : return self.TwoMuons_forTau23Mu 
        
        _MuonFilter_forTau23Mu = FilterDesktop (
            Code = " ( 'mu+' == ABSID ) & " + self._config['MuonCuts_forTau23Mu'] 
            )
        
        self.Muons_forTau23Mu = Selection (
            'Sel_T23Mu_MuonsFor' + self.name ()  ,
            Algorithm          = _MuonFilter_forTau23Mu ,
            RequiredSelections = [ StdLooseMuons ]
            )
        
        ## require at least 2 muons 
        self.TwoMuons_forTau23Mu = VoidEventSelection (
            "Two_T23Mu_MuonsFor" + self.name()   ,
            Code      = """
            CONTAINS('%s') > 1.5
            """       % self.Muons_forTau23Mu.outputLocation() , 
            RequiredSelection = self.Muons_forTau23Mu 
            )
        #
        return self.TwoMuons_forTau23Mu
     

    ## get all stripping lines 
    def _lines_private ( self ) :
        
        if hasattr ( self , '_Lines' ) : return self._Lines
        
        self._Lines = [
            ##
            StrippingLine (
            "Sigma2PMuMuFor"  + self.name()            ,
            prescale = self._config['SigmaPrescale'  ] , ## ATTENTION! Prescale here !!
            checkPV  = self._config['PrimaryVertices'] ,
            algos    = [ self.sigma() ]
            ) ,
            ##
            #StrippingLine (
            #"Ds2PhiPiFor"  + self.name ()              ,
            #prescale = self._config['DsPrescale'     ] , ## ATTENTION! Prescale here !!
            #checkPV  = self._config['PrimaryVertices'] ,
            #algos    = [ self.ds2PhiPi () ]
            #) ,
            ##
            #StrippingLine (
            #"Ds2PiPiPiFor"  + self.name ()              ,
            #prescale = self._config['Ds3PiPrescale'     ] , ## ATTENTION! Prescale here !!
            #checkPV  = self._config['PrimaryVertices'] ,
            #algos    = [ self.ds2PiPiPi () ]
            #) ,
            ##
            StrippingLine (
            "Dplus2PiMuMuFor"  + self.name ()          ,
            prescale = self._config['DplusPrescale'  ] , ## ATTENTION! Prescale here !!
            checkPV  = self._config['PrimaryVertices'] ,
            algos    = [ self.d2PiMuMu () ]
            ) 
            ]
        #
        return self._Lines
Пример #28
0
    def __apply_configuration__(self):

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

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

        if self.getProp("RunSelection"):

            # STD particles
            from StandardParticles import StdNoPIDsPions, StdNoPIDsKaons

            # phi -> K+ K-
            Phi2KKName = self.__sel_name__ + "_Phi2KK"
            Phi2KK = CombineParticles(Phi2KKName)
            Phi2KK.DecayDescriptor = "phi(1020) -> K+ K-"
            Phi2KK.CombinationCut = "(ADAMASS('phi(1020)')<75*MeV)"
            Phi2KK.MotherCut = "(ADMASS('phi(1020)')<50*MeV) & (BPVVDCHI2>60) & (MIPDV(PRIMARY)<0.5) & (VFASPF(VCHI2) < 20)"
            Phi2KK.DaughtersCuts = {
                "K+":
                "(PT>300*MeV) & (P>2*GeV) & (MIPDV(PRIMARY) < 0.5) &  (BPVIPCHI2() > 20)",
                "K-":
                "(PT>300*MeV) & (P>2*GeV) & (MIPDV(PRIMARY) < 0.5) &  (BPVIPCHI2() > 20)"
            }
            self.setOptions(Phi2KK)
            Phi2KKSel = Selection(Phi2KKName + 'Sel',
                                  Algorithm=Phi2KK,
                                  RequiredSelections=[StdNoPIDsKaons])

            # Bs -> J/psi phi
            Ds2piPhiName = self.__sel_name__
            Ds2piPhi = CombineParticles(Ds2piPhiName)
            Ds2piPhi.DecayDescriptor = "[D_s+ -> pi+ phi(1020)]cc"
            Ds2piPhi.addTool(OfflineVertexFitter)
            Ds2piPhi.ParticleCombiners.update({"": "OfflineVertexFitter"})
            Ds2piPhi.OfflineVertexFitter.useResonanceVertex = True
            Ds2piPhi.CombinationCut = "(ADAMASS('D_s+')<75*MeV)"
            Ds2piPhi.MotherCut = "(ADMASS('D_s+')<50*MeV) & (BPVDIRA>0.9999) & (BPVVDCHI2>85) & (MIPDV(PRIMARY)<0.1) &  (VFASPF(VCHI2) < 10)"
            Ds2piPhi.DaughtersCuts = {
                "pi+":
                "(PT>300*MeV) & (P>2*GeV) & (MIPDV(PRIMARY) >0.1) & (BPVIPCHI2() > 20)"
            }
            self.setOptions(Ds2piPhi)
            Ds2piPhiSel = Selection(
                Ds2piPhiName + 'Sel',
                Algorithm=Ds2piPhi,
                RequiredSelections=[Phi2KKSel, StdNoPIDsPions])

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

            # 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('D_s+')<100*MeV)"
            plotter.SideBandCut = "(ADMASS('D_s+')>100*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(Ds2piPhiName + "MCPerf")
            mcPerf.Inputs = ['Phys/' + self.__sel_name__ + 'Sel']
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]

        # Ntuple ?
        if self.getProp("MakeNTuple"):

            outputLevel = INFO

            from Configurables import (
                DecayTreeTuple, TupleToolDecay, TupleToolMCTruth,
                TupleToolMCBackgroundInfo, TupleToolGeometry,
                TupleToolKinematic, TupleToolPrimaries, TupleToolEventInfo,
                MCTupleToolHierarchy, MCTupleToolKinematic, TupleToolPid,
                TupleToolTrackInfo, TupleToolVtxIsoln, LoKi__Hybrid__TupleTool)

            Tuple = DecayTreeTuple(Ds2piPhiName + "Tuple")
            Tuple.Inputs = ["Phys/" + Ds2piPhiName]
            Tuple.Decay = "[D_s+ -> ^pi+ (^phi(1020) => ^K+ ^K-)]cc"
            Tuple.Branches = {
                "pion": "[D_s+ -> ^pi+ (phi(1020) => K+ K-)]cc",
                "kaonplus": "[D_s+ -> pi+ (phi(1020) => ^K+ K-)]cc",
                "kaonminus": "[D_s+ -> pi+ (phi(1020) => K+ ^K-)]cc",
                "phi": "[D_s+ -> pi+ (^phi(1020) => K+ K-)]cc",
                "D_s": "[D_s+]cc :[D_s+ -> pi+ (phi(1020) => K+ K-)]cc"
            }

            Tuple.addTool(TupleToolDecay, name='pion')
            Tuple.addTool(TupleToolDecay, name='phi')
            Tuple.addTool(TupleToolDecay, name='kaonplus')
            Tuple.addTool(TupleToolDecay, name='kaonminus')
            Tuple.addTool(TupleToolDecay, name='D_s')

            # k+ specific
            kaonplusLoKiTool = LoKi__Hybrid__TupleTool('kaonplusLoKiTool')
            kaonplusLoKiTool.Variables = {
                "LOKI_PIDK": "PIDK",
                "LOKI_PIDe": "PIDe",
                "LOKI_PIDpi": "PIDpi",
                "LOKI_PIDp": "PIDp",
                "LOKI_PIDmu": "PIDmu",
                "LOKI_PIDK_PIDpi": "PIDK-PIDpi",
                "LOKI_PIDK_PIDe": "PIDK-PIDe",
                "LOKI_PIDK_PIDmu": "PIDK-PIDmu",
                "LOKI_PIDK_PIDp": "PIDK-PIDp"
            }

            Tuple.kaonplus.addTool(kaonplusLoKiTool, name='kaonplusLoKiTool')
            Tuple.kaonplus.ToolList = [
                'LoKi::Hybrid::TupleTool/kaonplusLoKiTool'
            ]

            # k- specific
            kaonminusLoKiTool = LoKi__Hybrid__TupleTool('kaonminusLoKiTool')
            kaonminusLoKiTool.Variables = {
                "LOKI_PIDK": "PIDK",
                "LOKI_PIDe": "PIDe",
                "LOKI_PIDpi": "PIDpi",
                "LOKI_PIDp": "PIDp",
                "LOKI_PIDmu": "PIDmu",
                "LOKI_PIDK_PIDpi": "PIDK-PIDpi",
                "LOKI_PIDK_PIDe": "PIDK-PIDe",
                "LOKI_PIDK_PIDmu": "PIDK-PIDmu",
                "LOKI_PIDK_PIDp": "PIDK-PIDp"
            }

            Tuple.kaonminus.addTool(kaonminusLoKiTool,
                                    name='kaonminusLoKiTool')
            Tuple.kaonminus.ToolList = [
                'LoKi::Hybrid::TupleTool/kaonminusLoKiTool'
            ]

            # pi+ specific
            pionLoKiTool = LoKi__Hybrid__TupleTool('pionLoKiTool')
            pionLoKiTool.Variables = {
                "LOKI_PIDK": "PIDK",
                "LOKI_PIDe": "PIDe",
                "LOKI_PIDpi": "PIDpi",
                "LOKI_PIDp": "PIDp",
                "LOKI_PIDmu": "PIDmu",
                "LOKI_PIDpi_PIDK": "PIDpi-PIDK",
                "LOKI_PIDpi_PIDe": "PIDpi-PIDe",
                "LOKI_PIDpi_PIDmu": "PIDpi-PIDmu",
                "LOKI_PIDpi_PIDp": "PIDpi-PIDp"
            }

            Tuple.pion.addTool(pionLoKiTool, name='pionLoKiTool')
            Tuple.pion.ToolList = ['LoKi::Hybrid::TupleTool/pionLoKiTool']

            # phi specific
            phiLoKiTool = LoKi__Hybrid__TupleTool('phiLoKiTool')
            phiLoKiTool.Variables = {}

            Tuple.phi.addTool(phiLoKiTool, name='phiLoKiTool')
            Tuple.phi.ToolList = ['LoKi::Hybrid::TupleTool/phiLoKiTool']

            # D_s specific
            DsLoKiTool = LoKi__Hybrid__TupleTool('DsLoKiTool')
            DsLoKiTool.Variables = {}

            Tuple.D_s.addTool(DsLoKiTool, name='DsLoKiTool')
            Tuple.D_s.ToolList = ["LoKi::Hybrid::TupleTool/DsLoKiTool"]

            # Common to all particles
            LoKiTool = LoKi__Hybrid__TupleTool('LoKiTool')
            LoKiTool.Variables = {
                "LOKI_ABSID": "ABSID",
                "LOKI_BPVIPCHI2": "BPVIPCHI2()",
                "LOKI_BPVDIRA": "BPVDIRA",
                "LOKI_BPVLTFITCHI2":
                "BPVLTFITCHI2('PropertimeFitter/properTime:PUBLIC')",
                "LOKI_BPVLTCHI2":
                "BPVLTCHI2('PropertimeFitter/properTime:PUBLIC')",
                "LOKI_BPVLTIME":
                "BPVLTIME('PropertimeFitter/properTime:PUBLIC')",
                "LOKI_BPVVDCHI2": "BPVVDCHI2",
                "LOKI_ID": "ID",
                "LOKI_MIPDV_PRIMARY": "MIPDV(PRIMARY)",
                "LOKI_MIPCHI2DV_PRIMARY": "MIPCHI2DV(PRIMARY)",
                "LOKI_MM": "MM",
                "LOKI_M": "M",
                "LOKI_P": "P",
                "LOKI_PT": "PT",
                "LOKI_TRCHI2": "TRCHI2",
                "LOKI_TRCHI2DOF": "TRCHI2DOF",
                "LOKI_VFASPF_VCHI2": "VFASPF(VCHI2)",
                "LOKI_VFASPF_VDOF": "VFASPF(VDOF)"
            }

            Tuple.addTool(LoKiTool, name='LoKiTool')
            Tuple.ToolList = [
                "LoKi::Hybrid::TupleTool/LoKiTool", "TupleToolEventInfo",
                "TupleToolGeometry", "TupleToolKinematic",
                "TupleToolMCBackgroundInfo", "TupleToolPid",
                "TupleToolPrimaries", "TupleToolTrackInfo",
                "TupleToolVtxIsoln", "TupleToolMCTruth"
            ]

            Tuple.addTool(TupleToolEventInfo)
            Tuple.TupleToolEventInfo.OutputLevel = outputLevel

            Tuple.addTool(TupleToolGeometry)
            Tuple.TupleToolGeometry.OutputLevel = outputLevel

            Tuple.addTool(TupleToolKinematic)
            Tuple.TupleToolKinematic.OutputLevel = outputLevel

            Tuple.addTool(TupleToolMCBackgroundInfo)
            Tuple.TupleToolMCBackgroundInfo.OutputLevel = outputLevel

            Tuple.addTool(MCTupleToolHierarchy)
            Tuple.MCTupleToolHierarchy.OutputLevel = outputLevel

            Tuple.addTool(TupleToolMCTruth)
            Tuple.TupleToolMCTruth.OutputLevel = outputLevel
            Tuple.TupleToolMCTruth.addTool(MCTupleToolKinematic())
            Tuple.TupleToolMCTruth.addTool(MCTupleToolHierarchy())
            Tuple.TupleToolMCTruth.ToolList = [
                "MCTupleToolKinematic", "MCTupleToolHierarchy"
            ]
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.StoreKineticInfo = True
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.StoreVertexInfo = True
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.StorePropertimeInfo = True
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.OutputLevel = outputLevel

            Tuple.addTool(TupleToolPid)
            Tuple.TupleToolPid.OutputLevel = outputLevel

            Tuple.addTool(TupleToolPrimaries)
            Tuple.TupleToolPrimaries.OutputLevel = outputLevel

            Tuple.addTool(TupleToolTrackInfo)
            Tuple.TupleToolTrackInfo.OutputLevel = outputLevel

            Tuple.addTool(TupleToolVtxIsoln)
            Tuple.TupleToolVtxIsoln.OutputLevel = outputLevel

            seq.Members += [Tuple]

            Tuple.NTupleLUN = "DSPHIPI"

            from Configurables import NTupleSvc
            NTupleSvc().Output = [
                "DSPHIPI DATAFILE='DsToPhiPi.root'  TYP='ROOT'  OPT='NEW'"
            ]
Пример #29
0
def makeB2nbody(name,PiSel,KSel,pSel,KsSel,LmSel,DzSel,DpSel,DsSel,LcSel,PhSel,KSSel,JpSel,DSSel,
                nbody,MinBMass,MaxBMass,MinBPt,MaxBVertChi2DOF,MinBPVVDChi2,MaxBPVIPChi2,MinBPVDIRA,MaxMass,MaxNtrk,MinNvc,
                doPi,doK,dop,doKs,doLm,doDz,doDp,doDs,doLc,doPh,doKS,doJp,doDS):

    # Define a class that contains all relevant particle properties
    class particle:
        def __init__(self,name,m,ntrk,nvc,q,b):
            self.name=name
            self.m=m            #mass
            self.ntrk=ntrk      # number of charged tracks in fian state
            self.nvc=nvc        # number of vertex-contraining (pseudo)tracks
            self.Q=q            # electrical charge
            self.B=b            # baryon number
            self.cp=self
        def CP(self,name):
            p= particle(name,self.m,self.ntrk,self.nvc,-self.Q,-self.B)
            p.cp=self
            self.cp=p
            return p
        def isCP(self):
            if self.cp.name==self.name: return True
            else: return False



    # Define the particles
    particles=[]
    if doPi: particles.append(particle(        "pi+"       , 139.6,1,1,  +1,  0))
    if doPi: particles.append(particles[-1].CP("pi-"       ))
    if doK:  particles.append(particle(        "K+"        , 493.7,1,1,  +1,  0))
    if doK:  particles.append(particles[-1].CP("K-"        ))
    if dop:  particles.append(particle(        "p+"        , 938.3,1,1,  +1, +1))
    if dop:  particles.append(particles[-1].CP("p~-"       ))
    if doKs: particles.append(particle(        "KS0"       , 497.6,2,0,   0,  0))
    if doLm: particles.append(particle(        "Lambda0"   ,1115.7,2,0,   0, +1))
    if doLm: particles.append(particles[-1].CP("Lambda~0"  ))
    if doDz: particles.append(particle(        "D0"        ,1864.8,2,1,   0,  0))
    if doDz: particles.append(particles[-1].CP("D~0"       ))
    if doDp: particles.append(particle(        "D+"        ,1869.6,3,1,  +1,  0))
    if doDp: particles.append(particles[-1].CP("D-"        ))
    if doDs: particles.append(particle(        "D_s+"      ,1968.5,3,1,  +1,  0))
    if doDs: particles.append(particles[-1].CP("D_s-"      ))
    if doLc: particles.append(particle(        "Lambda_c+" ,2286.5,3,1,  +1, +1))
    if doLc: particles.append(particles[-1].CP("Lambda_c~-"))
    if doPh: particles.append(particle(        "phi(1020)" ,1019.5,2,2,   0,  0))
    if doKS: particles.append(particle(        "K*(892)0"  , 895.9,2,2,   0,  0))
    if doKS: particles.append(particles[-1].CP("K*(892)~0" ))
    if doJp: particles.append(particle(        "J/psi(1S)" ,3096.9,2,2,   0,  0))
    if doDS: particles.append(particle(        "D*(2010)+" ,2010.2,3,2,  +1,  0))
    if doDS: particles.append(particles[-1].CP("D*(2010)-" ))

    # in itertools only since python 2.7
    def combinations_with_replacement(iterable, r):
        pool = tuple(iterable)
        n = len(pool)
        if not n and r: return
        indices = [0] * r
        yield tuple(pool[i] for i in indices)
        while True:
            for i in reversed(range(r)):
                if indices[i] != n - 1: break
            else: return
            indices[i:] = [indices[i] + 1] * (r - i)
            yield tuple(pool[i] for i in indices)

    #alphabetically ordered name of particles
    def pname(ps):
        names=[]
        for p in ps: names.append(p.name)
        names.sort()
        result=""
        for name in names:
            result=result+name+' '
        return result[:-1]

    descriptors = []
    for comb in combinations_with_replacement(particles,nbody):
        #check for the mass
        m=0
        for p in comb: m+=p.m
        if m>MaxMass: continue
        #check for the number of tracks in the final state
        ntrk=0
        for p in comb: ntrk+=p.ntrk
        if ntrk>MaxNtrk: continue
        #check for the number of vertex-constraining (pseudo)tracks
        nvc=0
        for p in comb: nvc+=p.nvc
        if nvc<MinNvc: continue
        #check for charge and baryon number
        Q=0
        for p in comb: Q+=p.Q
        if abs(Q)>1: continue
        B=0
        for p in comb: B+=p.B
        if abs(B)>1: continue

        #assign identity to mother 
        mother=""
        if Q==0  and B==0: mother="B0"
        if Q==1  and B==0: mother="B+"
        if Q==0  and B==1: mother="Lambda_b0"
        if Q==-1 and B==1: mother="Xi_b-"
        if Q==+1 and B==1: mother="Xi_bc+"
        if mother=="": continue

        #check if final state is CP eigenstate
        ps=[p for p in comb if not p.isCP()]
        while True:
            doagain=False
            for p in ps:
                if ps.count(p.cp)>0:
                    ps.remove(p)
                    ps.remove(p.cp)
                    doagain=True
                    break
            if not doagain: break
        if len(ps)==0: CP=True
        else: CP=False
        
        #for B0 non-CP combinations come twice. 
        if mother=="B0" and not CP:
            combcp=[x.cp for x in comb]
            if pname(comb)<pname(combcp):continue

        #build the decay descriptor
        descriptor=mother+" -> "+pname(comb)
        if not CP:descriptor="["+descriptor+"]cc"
        descriptors.append(descriptor)

    print "%s: %d channels"%(name,len(descriptors))
    #for descriptor in descriptors: print "DESCRIPTOR:",descriptor


    #make a merge of the input selections
    AllSel=[]
    if doPi:AllSel.append(PiSel)
    if doK: AllSel.append(KSel)
    if dop: AllSel.append(pSel)
    if doKs:AllSel.append(KsSel)
    if doLm:AllSel.append(LmSel)
    if doDz:AllSel.append(DzSel)
    if doDp:AllSel.append(DpSel)
    if doDs:AllSel.append(DsSel)
    if doLc:AllSel.append(LcSel)
    if doPh:AllSel.append(PhSel)
    if doKS:AllSel.append(KSSel)
    if doJp:AllSel.append(JpSel)
    if doDS:AllSel.append(DSSel)
    InputSel= MergedSelection("InputFor"+name, RequiredSelections = AllSel )

    _combinationCuts =    "(in_range(%(MinBMass)s*MeV, AM, %(MaxBMass)s*MeV))" % locals()
    _combinationCuts += "& (APT>%(MinBPt)s*MeV)"%locals()
    _motherCuts = "(VFASPF(VCHI2/VDOF)<%(MaxBVertChi2DOF)s)"%locals()
    _motherCuts += "& (BPVVDCHI2 > %(MinBPVVDChi2)s)"% locals()
    _motherCuts += "& (BPVIPCHI2() < %(MaxBPVIPChi2)s)"%locals()
    _motherCuts += "& (BPVDIRA > %(MinBPVDIRA)s)"% locals()

    #make a selection
    _B=CombineParticles(DecayDescriptors = descriptors, CombinationCut = _combinationCuts, MotherCut = _motherCuts)

    #make a preselection
    _presel=VoidEventSelection("preselFor"+name,
                               Code="(CONTAINS('%s')> %3.1f)"%(InputSel.outputLocation(),nbody-0.5 ),
                               RequiredSelection=InputSel
                               )

    return Selection(name, Algorithm = _B, RequiredSelections = [_presel] )
Пример #30
0
if magnetPolarity not in ["Up", "Down"]:
    raise RuntimeError(magnetPolarity + " is not a valid magnet polarity")

######################################################################################################
from Configurables import CombineParticles
KsPiPi= CombineParticles("KsPiPi")
KsPiPi.DecayDescriptor =  "KS0 -> pi+ pi-"
KsPiPi.CombinationCut = "ADAMASS('KS0')<100*MeV"
KsPiPi.MotherCut = "(VFASPF(VCHI2/VDOF)<10)"
KsPiPi.DaughtersCuts = { "pi+" : "ALL",
                         "pi-" : "ALL" }
KsPiPi.MotherCut = "(M > 400) & (M < 600) & (BPVVDCHI2 > 100.) & (VFASPF(VCHI2/VDOF) < 10)"
from PhysSelPython.Wrappers import Selection
from StandardParticles import StdNoPIDsDownPions, StdLoosePions
LooseKsPiPi = Selection("SelLooseKsPiPi", 
                        Algorithm = KsPiPi, 
                        RequiredSelections = [StdNoPIDsDownPions ])
                        #RequiredSelections = [StdLoosePions])

from PhysSelPython.Wrappers import SelectionSequence
SeqKsPiPi = SelectionSequence('SeqKsPiPi', TopSelection = LooseKsPiPi)

KsPiPiTuple = DecayTreeTuple("KsPiPiTuple")

# input locations
KsPiPiTuple.Inputs = [ LooseKsPiPi.outputLocation() ]
# decay descriptors
KsPiPiTuple.Decay = "KS0 -> ^pi+ ^pi-"
# define the tools and configure them
KsPiPiTuple.ToolList = [
    "TupleToolKinematic"
Пример #31
0
 def __init__(self, name, config):
     self.name = name
     LineBuilder.__init__(self, name, config)
     #################################################################################
     # Configure trigger
     #################################################################################
     l0 = None
     if config['L0']:
         l0 = "L0_CHANNEL_RE('%s')" % ('|'.join(config['L0']))
     hlt1 = None
     if config['HLT1']:
         hlt1 = "HLT_PASS_RE('%s')" % ('|'.join(config['HLT1']))
     hlt2 = None
     if config['HLT2']:
         hlt2 = "HLT_PASS_RE('%s')" % ('|'.join(config['HLT2']))
     #################################################################################
     # Build Lambda_0
     #################################################################################
     tracks_code = """(MAXTREE(TRCHI2DOF, HASTRACK) < %(Track_Chi2ndf_Max)s) &
                      (MINTREE(TRCHI2DOF, HASTRACK) < %(Track_MinChi2ndf_Max)s) &
                      (MAXTREE(TRGHOSTPROB, HASTRACK) < %(Track_GhostProb_Max)s) &
                      (INTREE(('p+'==ABSID) & (PT > %(Proton_Pt_Min)s))) &
                      (INTREE(('pi+'==ABSID) & (PT > %(Pion_Pt_Min)s))) &
                      (INTREE(('p+'==ABSID) & (P > %(Proton_P_Min)s))) &
                      (INTREE(('pi+'==ABSID) & (P > %(Pion_P_Min)s)))"""
     lambda0_ll_dod = DataOnDemand(
         Location='Phys/StdLooseLambdaLL/Particles')
     lambda0_ll_code = """(PT>%(Lambda0_Pt_Min)s*MeV) &
                          (VFASPF(VCHI2/VDOF)<%(Lambda0_VtxChi2_Max)s) &
                          (MINTREE(MIPCHI2DV(PRIMARY), ISLONG) > %(TrackLL_IPChi2_Min)s) &
                          (MIPDV(PRIMARY) > %(Lambda0LL_IP_Min)s*mm) &
                          (ADMASS('Lambda0') < %(Lambda0LL_MassWindow)s*MeV)"""
     lambda0_ll_code = (lambda0_ll_code + " & " + tracks_code) % config
     lambda0_ll_filter = FilterDesktop(Code=lambda0_ll_code)
     lambda0_ll = Selection("LooseLambda0LL",
                            Algorithm=lambda0_ll_filter,
                            RequiredSelections=[lambda0_ll_dod])
     lambda0_dd_dod = DataOnDemand(
         Location='Phys/StdLooseLambdaDD/Particles')
     lambda0_dd_code = """(PT>%(Lambda0_Pt_Min)s*MeV) &
                          (VFASPF(VCHI2/VDOF)<%(Lambda0_VtxChi2_Max)s) &
                          (ADMASS('Lambda0') < %(Lambda0DD_MassWindow)s*MeV)"""
     lambda0_dd_code = (lambda0_dd_code + " & " + tracks_code) % config
     lambda0_dd_filter = FilterDesktop(Code=lambda0_dd_code)
     lambda0_dd = Selection("LooseLambda0DD",
                            Algorithm=lambda0_dd_filter,
                            RequiredSelections=[lambda0_dd_dod])
     lambda0 = MergedSelection("LooseLambda0",
                               RequiredSelections=[lambda0_ll, lambda0_dd])
     #################################################################################
     # Filter photons
     #################################################################################
     photons_noncnv_filter = FilterDesktop(
         Code="(PT > %(Photon_PT_Min)s*MeV) & (CL > %(Photon_CL_Min)s)" %
         config)
     photons_noncnv = Selection("Photons_NonCnv",
                                Algorithm=photons_noncnv_filter,
                                RequiredSelections=[StdLooseAllPhotons])
     photons_cnv_merged = MergedSelection(
         "Photons_Cnv_Merge",
         RequiredSelections=[StdAllLooseGammaDD, StdAllLooseGammaLL])
     photons_cnv_code = """(HASVERTEX) &
                           (MM < %(PhotonCnv_MM_Max)s*MeV) &
                           (PT > %(PhotonCnv_PT_Min)s*MeV) &
                           (VFASPF(VCHI2/VDOF)<%(PhotonCnv_VtxChi2_Max)s)""" % config
     photons_cnv_filter = FilterDesktop(Code=photons_cnv_code % config)
     photons_cnv = Selection("Photons_Cnv",
                             Algorithm=photons_cnv_filter,
                             RequiredSelections=[photons_cnv_merged])
     #################################################################################
     # Build Lambda_b
     #################################################################################
     # With non-converted photons
     lambda_b_combine = CombineParticles("Lambdab_NonConv_Combine")
     lambda_b_combine.DecayDescriptor = "[Lambda_b0 -> Lambda0 gamma]cc"
     lambda_b_combine.DaughtersCuts = {'Lambda0': 'ALL', 'gamma': 'ALL'}
     lambda_b_combine.ParticleCombiners = {'': 'MomentumCombiner:PUBLIC'}
     lambda_b_combine.CombinationCut = """(ADAMASS('Lambda_b0') < %(Lambdab_MassWindow)s*MeV) &
                                          (ASUM(PT) > %(Lambdab_SumPt_Min)s )""" % config
     lambda_b_combine.MotherCut = """(PT > %(Lambdab_Pt_Min)s*MeV) &
                                     (MTDOCACHI2(1) < %(Lambdab_MTDOCAChi2_Max)s)""" % config
     lambda_b = Selection("Lambdab_NonConv_Sel",
                          Algorithm=lambda_b_combine,
                          RequiredSelections=[photons_noncnv, lambda0])
     # With converted photons
     lambda_b_cnv_combine = CombineParticles("Lambdab_Conv_Combine")
     lambda_b_cnv_combine.DecayDescriptor = "[Lambda_b0 -> Lambda0 gamma]cc"
     lambda_b_cnv_combine.DaughtersCuts = {'Lambda0': 'ALL', 'gamma': 'ALL'}
     lambda_b_cnv_combine.ParticleCombiners = {
         "": "OfflineVertexFitter:PUBLIC"
     }
     lambda_b_cnv_combine.CombinationCut = "(ADAMASS('Lambda_b0') < 1.5*%(Lambdab_MassWindow)s*MeV)" % config
     lambda_b_cnv_combine.MotherCut = """(HASVERTEX) & (VFASPF(VCHI2/VDOF)<%(Lambdab_VtxChi2_Max)s) &
                                         (PT > %(Lambdab_Pt_Min)s*MeV) &
                                         (BPVIPCHI2() < %(Lambdab_IPChi2_Max)s) &
                                         (ADMASS('Lambda_b0') < %(Lambdab_MassWindow)s*MeV)""" % config
     #(MTDOCACHI2(1) < %(Lambdab_MTDOCAChi2_Max)s) &
     lambda_b_cnv = Selection("Lambdab_Conv_Sel",
                              Algorithm=lambda_b_cnv_combine,
                              RequiredSelections=[photons_cnv, lambda0])
     #################################################################################
     # Build lines
     #################################################################################
     children = {'L0': '[Lambda_b0 -> ^Lambda0 gamma]CC'}
     self.line = StrippingLine("Lb2L0Gamma",
                               prescale=config["Lb2L0GammaPrescale"],
                               L0DU=l0,
                               HLT1=hlt1,
                               HLT2=hlt2,
                               checkPV=True,
                               RelatedInfoTools=[
                                   self.get_cone_relinfo(1.7,
                                                         children=children),
                                   self.get_cone_relinfo(1.35,
                                                         children=children),
                                   self.get_cone_relinfo(1.0,
                                                         children=children),
                               ],
                               RequiredRawEvents=['Calo'],
                               MDSTFlag=True,
                               selection=lambda_b)
     self.registerLine(self.line)
     self.line_cnv = StrippingLine(
         "Lb2L0GammaConverted",
         prescale=config["Lb2L0GammaPrescale"],
         L0DU=l0,
         HLT1=hlt1,
         HLT2=hlt2,
         checkPV=True,
         RelatedInfoTools=[
             self.get_cone_relinfo(1.7, lambda_b_cnv, children),
             self.get_cone_relinfo(1.35, lambda_b_cnv, children),
             self.get_cone_relinfo(1.0, lambda_b_cnv, children),
             self.get_vtxisol_relinfo(lambda_b_cnv),
         ],
         RequiredRawEvents=['Calo'],
         MDSTFlag=True,
         selection=lambda_b_cnv)
     self.registerLine(self.line_cnv)