示例#1
0
 def prescaleBB(BBfraction=1):
     from Configurables import LoKi__ODINFilter as ODINFilter
     from Configurables import DeterministicPrescaler, GaudiSequencer
     odinFiltNonBB = ODINFilter('ODINBXTypeFilterNonBB',
                                Code='ODIN_BXTYP < 3')
     odinFiltBB = ODINFilter('ODINBXTypeFilterBB', Code='ODIN_BXTYP == 3')
     prescBB = DeterministicPrescaler("DetPrescBB",
                                      AcceptFraction=BBfraction)
     prescBB_seq = GaudiSequencer("PrescBB")
     prescBB_seq.Members = [odinFiltBB, prescBB]
     collTypeSeq = GaudiSequencer('CollTypeSelector', ModeOR=True)
     collTypeSeq.Members = [odinFiltNonBB, prescBB_seq]
     GaudiSequencer('HltFilterSeq').Members.append(collTypeSeq)
示例#2
0
    def prescaleBB2(BBfraction=1):

        from Configurables import LoKi__Hybrid__HltFactory as HltFactory
        HltFactory().Modules.append("LoKiHlt.functions")

        from Configurables import LoKi__HDRFilter as HLTFilter
        from Configurables import DeterministicPrescaler, GaudiSequencer
        odinFiltNonBB = HLTFilter('Hlt1FilterNonBB',
                                  Code="HLT_PASS_SUBSTR('Hlt1BeamGas')")
        odinFiltBB = HLTFilter(
            'Hlt1FilterBB',
            Code=
            "HLT_PASS_RE('Hlt1(?!ODIN)(?!L0)(?!Lumi)(?!Tell1)(?!MB)(?!NZS)(?!Velo)(?!BeamGas)(?!Incident).*Decision')"
        )
        prescBB = DeterministicPrescaler("DetPrescBB",
                                         AcceptFraction=BBfraction)
        prescBB_seq = GaudiSequencer("PrescBB")
        prescBB_seq.Members = [odinFiltBB, prescBB]
        collTypeSeq = GaudiSequencer('CollTypeSelector', ModeOR=True)
        collTypeSeq.Members = [odinFiltNonBB, prescBB_seq]
        GaudiSequencer('HltFilterSeq').Members.append(collTypeSeq)
示例#3
0
sc = StrippingConf(Streams=allStreams)

from Configurables import SelDSTWriter
dstWriter = SelDSTWriter("MyDSTWriter",
                         SelectionSequences=sc.activeStreams(),
                         OutputPrefix='Strip',
                         OutputFileSuffix='000000')
dstWriter.ExtraItems += [
    '/Event/DAQ/RawEvent#1', '/Event/Strip/Phys/DecReports#1'
]

#
# Prescales of StrippingLines
#
from Configurables import DeterministicPrescaler
DeterministicPrescaler("StrippingMBMicroBiasPreScaler").AcceptFraction = 0.01
DeterministicPrescaler("StrippingMBNoBiasPreScaler").AcceptFraction = 0.01
DeterministicPrescaler("StrippingHlt1L0AnyPreScaler").AcceptFraction = 0.01

#
# DaVinci configuration
#
from Configurables import DaVinci
DaVinci().DataType = "2010"
DaVinci().InputType = 'SDST'
DaVinci().EvtMax = 10000
DaVinci().appendToMainSequence([sc.sequence()])
DaVinci().appendToMainSequence([dstWriter.sequence()])
DaVinci().HistogramFile = "DVHistos.root"

#
示例#4
0
    def __apply_configuration__(self) :

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

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

        if self.getProp("RunSelection") :

            # STD particles
            from StandardParticles import StdLooseMuons

            # J/psi -> mu mu
            JPsiMuMuName               = self.__sel_name__
            JPsiMuMu                   = CombineParticles(JPsiMuMuName)
            JPsiMuMu.DecayDescriptor   = "J/psi(1S) -> mu+ mu- "
            JPsiMuMu.CombinationCut    = "(ADAMASS('J/psi(1S)') < 150*MeV)"
            JPsiMuMu.MotherCut         = "(ADMASS('J/psi(1S)') < 130*MeV) & (VFASPF(VCHI2/VDOF)<6) & (PT > 2500*MeV)"
            JPsiMuMu.DaughtersCuts     = {"mu+" : "(PT>1400*MeV)"\
                                          "& (P>5*GeV)"\
                                          "& (TRCHI2DOF<2.0)"\
                                          "& (PPINFO(LHCb.ProtoParticle.MuonBkgLL,-10000)<-2.5)"\
                                          "& (PPINFO(LHCb.ProtoParticle.MuonMuLL,-10000)>-10)"}
            self.setOptions(JPsiMuMu)
            JPsiMuMuSel = Selection( JPsiMuMuName+'Sel',
                                     Algorithm = JPsiMuMu,
                                     RequiredSelections = [StdLooseMuons] )

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

            # 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:
                musel = "(PT>1400*MeV) & (P>5*GeV) & (TRCHI2DOF<2.0) & "\
                        "(PPINFO(LHCb.ProtoParticle.MuonBkgLL,-10000)<-2.5) & "\
                        "(PPINFO(LHCb.ProtoParticle.MuonMuLL,-10000)>-10)"
                _code = "( ( INTREE( ('mu+'==ID) & "+musel+" ) ) | ( INTREE( ('mu-'==ID) & "+musel+" ) ) )"
                from Configurables import FilterDesktop
                filter = FilterDesktop( name = self.__sel_name__+"RICHFiltered",
                                        Code = _code,
                                        Inputs = self.getProp("Candidates") )
                plotter.Inputs = [ 'Phys/'+filter.name() ]
                seq.Members += [filter]
            plotter.PeakCut     = "(ADMASS('J/psi(1S)')<20*MeV)" # Considering sigma = 13
            plotter.SideBandCut = "(ADMASS('J/psi(1S)')>20*MeV)" # Considering sigma = 13
            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(JPsiMuMuName+"MCPerf")
            mcPerf.Inputs = ['Phys/'+self.__sel_name__+'Sel']
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]

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

            from Configurables import ( DecayTreeTuple,
                                        TupleToolDecay,
                                        LoKi__Hybrid__FilterCriterion,
                                        LoKi__Hybrid__TupleTool,
                                        TupleToolMCBackgroundInfo,
                                        BackgroundCategory,
                                        TupleToolTrigger,
                                        TupleToolMCTruth,
                                        MCTupleToolKinematic,
                                        MCTupleToolHierarchy,
                                        TupleToolVtxIsoln,
                                        TupleToolP2VV
                                        )
            
            JPsiMuMuTree = DecayTreeTuple( JPsiMuMuName + 'Tuple')
            JPsiMuMuTree.Inputs = [ 'Phys/'+JPsiMuMuName]
            JPsiMuMuTree.Decay = 'J/psi(1S) ->  ^mu+ ^mu- '
            
            # set some names for ntuple branchs
            MyBranch_jpsi  = "jpsi"
            MyBranch_mup   = "mup"
            MyBranch_mum   = "mum"
            
            # label the branches for the particle tools
            JPsiMuMuTree.Branches = {
                MyBranch_jpsi  : "J/psi(1S) : J/psi(1S) ->  mu+ mu- ",
                MyBranch_mup   : "J/psi(1S) ->  ^mu+ mu- ",
                MyBranch_mum   : "J/psi(1S) ->  mu+ ^mu- ",
                }
            
            JPsiMuMuTree.ToolList = [
                "TupleToolEventInfo"
                , "TupleToolGeneration"
                , "TupleToolMCTruth"
                , "TupleToolMCBackgroundInfo"
                , "MCTupleToolKinematic"
                , "TupleToolPrimaries"
                , "TupleToolVtxIsoln"
                , "TupleToolTrackInfo"
                , "TupleToolPid"
                , "TupleToolGeometry"
                , "TupleToolKinematic"
                , "TupleToolPropertime"
                , "TupleToolPid"
                , "TupleToolPrimaries"
                , "TupleToolTrigger"
                ]
            
            JPsiMuMuTree.addTool(BackgroundCategory())
            JPsiMuMuTree.BackgroundCategory.SoftPhotonCut = 2000
            JPsiMuMuTree.OutputLevel = INFO
            JPsiMuMuTree.addTool(TupleToolTrigger())
            JPsiMuMuTree.TupleToolTrigger.VerboseL0 = True
            JPsiMuMuTree.addTool(TupleToolMCTruth())
            JPsiMuMuTree.TupleToolMCTruth.addTool(MCTupleToolKinematic())
            JPsiMuMuTree.TupleToolMCTruth.addTool(MCTupleToolHierarchy())
            JPsiMuMuTree.TupleToolMCTruth.ToolList = [
                "MCTupleToolKinematic" ,
                "MCTupleToolHierarchy"
                ]
            JPsiMuMuTree.TupleToolMCTruth.MCTupleToolKinematic.StoreKineticInfo = True
            JPsiMuMuTree.TupleToolMCTruth.MCTupleToolKinematic.StoreVertexInfo = True
            JPsiMuMuTree.TupleToolMCTruth.MCTupleToolKinematic.StorePropertimeInfo = False
            JPsiMuMuTree.addTool(TupleToolVtxIsoln( OutputLevel = 6 ))
            JPsiMuMuTree.TupleToolVtxIsoln.IP = 2.0
            JPsiMuMuTree.TupleToolVtxIsoln.InputParticles = [ "Phys/StdLooseMuons"]
            
            seq.Members += [JPsiMuMuTree]
            
            JPsiMuMuTree.NTupleLUN = "JPSIMUMU"
            
            from Configurables import NTupleSvc
            NTupleSvc().Output = ["JPSIMUMU DATAFILE='JpsiMuMu_Presel.root'  TYP='ROOT'  OPT='NEW'"]
示例#5
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'"
            ]
示例#6
0
    def __hlt1_monitoring(self, lines1):
        monSeq = Sequence("Hlt1MonitorSequence", IgnoreFilterPassed=True)

        l0Mon = self.__l0_monitoring("Hlt1")
        monSeq.Members += l0Mon

        # Tell the monitoring what it should expect..
        # the keys are the Labels for the Histograms in the GUI
        # the values are the Pattern Rules to for the Decisions contributing

        ## Global monitor
        from Configurables import HltGlobalMonitor
        globalMon = self.__globalMonitor("Hlt1")
        globalMon.DecToGroup = self.__groupLines(
            [i.decision() for i in lines1],
            [
                ("L0", "Hlt1L0.*Decision"),
                ("LumiBeamGas", "Hlt1(Lumi|BeamGas).*Decision"),
                ("SingleMuon", "Hlt1(Single|Track)Muon.*Decision"),
                ("DiMuon", "Hlt1DiMuon.*Decision"),
                ("TrackMVA", "Hlt1(Two)?TrackMVADecision"),
                ("ECAL", "Hlt1.*(Electron|Photon).*Decision"),
                ("LowMult", "Hlt1LowMult.*Decision"),
                ("Beauty", "Hlt1B2.*Decision"),
                ("Commissioning", "Hlt1(ODIN.*|Tell1Error|Incident)Decision"),
                ("MinBias", "Hlt1MB.*Decision"),
                ("Calibration", "Hlt1CalibTracking.*"),
                ("Global", ".*Global.*"),
                (
                    "Other", ".*"
                )  # add a 'catch all' term to pick up all remaining decisions...
            ])
        if self.getProp("EnableGlobalMonitor"):
            monSeq.Members.append(globalMon)

        ## Mass monitor
        from Configurables import HltMassMonitor
        from DAQSys.Decoders import DecoderDB
        massMon = HltMassMonitor("Hlt1MassMonitor")
        massMon.DecReportsLocation = DecoderDB[
            "HltDecReportsDecoder/Hlt1DecReportsDecoder"].listOutputs()[0]
        massMon.SelReportsLocation = DecoderDB[
            "HltSelReportsDecoder/Hlt1SelReportsDecoder"].listOutputs()[0]
        massMon.Decisions = {
            "Jpsi": "Hlt1DiMuonHighMassDecision",
            "JpsiAlign": "Hlt1CalibMuonAlignJpsiDecision",
            "D0->Kpi(det)": 'Hlt1CalibTrackingKPiDetachedDecision',
            "D0->Kpi": 'Hlt1CalibTrackingKPiDecision',
            "D0->KK": 'Hlt1CalibTrackingKKDecision',
            "D0->pipi": "Hlt1CalibTrackingPiPiDecision",
            "phi->KK": "Hlt1IncPhiDecision"
        }
        massMon.DecisionStructure = {"Jpsi": [105.658, 105.658]}
        massMon.Histograms = {
            "Jpsi": [3010, 3190, 90],
            "JpsiAlign": [3010, 3190, 90],
            "D0->Kpi(det)": [1815, 1915, 50],
            "D0->Kpi": [1815, 1915, 50],
            "D0->KK": [1815, 1915, 50],
            "D0->pipi": [1815, 1915, 50],
            "phi->KK": [1000, 1040, 80]
        }
        if self.getProp("EnableMassMonitor"):
            monSeq.Members.append(massMon)

        # Setup the track monitoring
        from Configurables import Hlt1TrackMonitor
        import HltTracking
        from HltTracking.HltSharedTracking import MinimalVelo, VeloTTTracking, HltHPTTracking
        from Configurables import DeterministicPrescaler
        trackMon = Hlt1TrackMonitor("Hlt1TrackMonitor")
        trackMon.VeloTrackLocation = MinimalVelo.outputSelection()
        trackMon.VeloTTTrackLocation = VeloTTTracking.outputSelection()
        trackMon.ForwardTrackLocation = HltHPTTracking.outputSelection()

        # This is not so nice but currently unavoidable
        from HltTracking.Hlt1TrackNames import Hlt1TrackLoc
        from HltTracking.HltTrackNames import HltDefaultFitSuffix
        trackMon.FittedTrackLocation = Hlt1TrackLoc["FitTrack"]

        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        gecUnit = Hlt1GECUnit(self.getProp("Hlt1TrackMonitorGEC"))
        prescaler = DeterministicPrescaler(
            "Hlt1TrackMonitorPrescaler",
            AcceptFraction=self.getProp("Hlt1TrackMonitorPrescale"))
        trackMonSeq = Sequence('Hlt1TrackMonitorSequence',
                               Members=[gecUnit, prescaler] +
                               HltHPTTracking.members() + [trackMon])

        if self.getProp("EnableTrackMonitor"):
            monSeq.Members.append(trackMonSeq)

        return monSeq
示例#7
0
    def __apply_configuration__(self):

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

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

        if self.getProp("RunSelection"):

            # STD particles
            from StandardParticles import StdNoPIDsPions

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

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

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

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

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

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

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

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

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

            from Configurables import ParticleEffPurMoni

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

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

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

        # Ntuple ?
        if self.getProp("MakeNTuple"): pass
ta.addTool(LHCbSequencerTimerTool, name='TIMER')
AuditorSvc().Auditors.append(ta)

sequence = GaudiSequencer("TopSequence", IgnoreFilterPassed=True)


def groupName(subs):
    return sorted(subs)[0]


groups = {("Full", "TurboFull"): 0.5, ("Turbo", ): 0.2}
filters = {}
for substreams, fraction in groups.iteritems():

    gn = sorted(substreams)[0]
    scaler = DeterministicPrescaler(gn + "Scaler", AcceptFraction=fraction)
    for substream in substreams:
        filters[substream] = [scaler.getFullName()]

    rawCopy = RawEventCopy(gn + "RawEventCopy",
                           DeepCopy=True,
                           Destination='/Event/DAQ/%sRawEvent' % gn)
    subSequence = GaudiSequencer(gn + "Sequence", Members=[scaler, rawCopy])

    sequence.Members += [subSequence]

ApplicationMgr().TopAlg = [sequence]
ApplicationMgr().AuditAlgorithms = True

# Configure HltOutputSvc
outputSvc.StreamGroups = {
from Gaudi.Configuration import *
from Configurables import DaVinci, SelDSTWriter, DeterministicPrescaler, FilterDesktop
from StrippingConf.Configuration import StrippingConf, StrippingStream, StrippingLine
from PhysSelPython.Wrappers import AutomaticData, SelectionSequence, Selection, MergedSelection

pions = AutomaticData(Location='Phys/StdLoosePions')
eventFilter = DeterministicPrescaler('BadEventFilter', AcceptFraction=0.5)

lineX = StrippingLine('PionLineX', algos=[pions])
lineY = StrippingLine('PionLineY', algos=[pions])

streamX = StrippingStream("StreamPionX", Lines=[lineX])
streamXBadEvent = StrippingStream("StreamPionXBadEvent",
                                  Lines=[lineX],
                                  BadEventSelection=eventFilter)
streamYBadEvent = StrippingStream("StreamPionYBadEvent",
                                  Lines=[lineY],
                                  BadEventSelection=eventFilter)

sc = StrippingConf(Streams=[streamX, streamYBadEvent, streamXBadEvent])

dstWriter = SelDSTWriter("SelDST0",
                         OutputFileSuffix="Test3",
                         SelectionSequences=sc.activeStreams())

dv = DaVinci()
dv.DataType = '2010'
dv.InputType = 'SDST'
dv.EvtMax = -1
#dv.appendToMainSequence( [ sc.sequence() ] )
dv.appendToMainSequence([dstWriter.sequence()])
示例#10
0
    def __apply_configuration__(self) :

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

        if self.getProp("RunSelection") : 

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

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

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

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

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

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

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

            from Configurables import ParticleEffPurMoni
            mcPerf = ParticleEffPurMoni(lambda2ppiName+"MCPerf")
            mcPerf.Inputs = ["Phys/"+lambda2ppiName]
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]
                    
        # Ntuple ?
        if self.getProp("MakeNTuple") : pass
示例#11
0
#
# Loop over three overlapping mass zones
#
MassRanges = [ [ 3000, 3087 ], [ 3088, 3100 ],  [ 3100, 4000 ] ]

selections = []

for i in MassRanges :
    lm = i[0]
    hm = i[1]
    ln = str(lm)
    hn = str(hm)
    name = ln+"_"+hn

    # define the prescale to have a constant (assumed flat) level of background
    prescale = DeterministicPrescaler("Prescale_"+name,
                                      AcceptFraction = 100./(hm-lm))
    filter   = FilterDesktop("Jpsi_"+name,
                             Code = "(MM>"+ln+") & (MM<"+hn+") & (MIPCHI2DV(PRIMARY) > 2)")

    SelJpsi = Selection('SelJpsi_'+name,
                        Algorithm = filter,
                        RequiredSelections = [ MyLooseJpsi ])

    printer  = PrintDecayTree("Print_"+name,
                              Inputs = [SelJpsi.outputLocation()])    

    SeqJpsi = SelectionSequence('SeqJpsi_'+name
                                , TopSelection = SelJpsi
                                , EventPreSelector = [ prescale ]
                                , PostSelectionAlgs = [ printer ])
示例#12
0
    def __apply_configuration__(self):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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