예제 #1
0
def runsandbox(head,
               find=None,
               outputname="sandbox.dst",
               runAllAfter=False,
               findalg=findalg):
    from GaudiConf.Manipulations import configurableInstanceFromString, nameFromConfigurable, postConfigCallable, configurableClassFromString
    if find is None:
        raise ValueError("You didn't ask me to search for anything!")
    found, before, contains, after, contained_stuff = findalg(head, find)
    print found, before, contains, after, contained_stuff
    if not found:
        raise NameError("I could not find the thing you asked me to excise!")
    user_algs = getUserAlgs()
    for a in before:
        if a not in contains and a not in user_algs and a not in contained_stuff:
            ac = configurableInstanceFromString(a)
            ac.Enable = False
    if not insertEmptyKiller(contains[-1], find):
        raise ValueError("Could not insert EmptyNodeKiller")
    if not insertSomething(contains[-1], find,
                           GaudiSequencer('PreExciseUserAlgs')):
        raise ValueError("Could not insert PreAlgs")
    if not insertSomething(
            contains[-1], find, GaudiSequencer('PostExciseUserAlgs'),
            before=False):
        raise ValueError("Could not insert PostAlgs")
    if not runAllAfter:
        for a in after:
            if a not in before and a not in contains and a not in user_algs and a not in contained_stuff:
                ac = configurableInstanceFromString(a)
                ac.Enable = False
    from GaudiConf import IOExtension
    IOExtension().inputFiles([outputname], clear=True)
    return
예제 #2
0
    def _lumi(self):
        """
        read FSR and accumulate event and luminosity data
        calculate normalization - toolname:
        """
        log.info("Creating Lumi Algorithms")
        seq = []
        self.setOtherProps(LumiAlgsConf(), ["DataType", "InputType"])

        # add merge, touch-and-count sequence
        lumiSeq = GaudiSequencer("LumiSeq")
        LumiAlgsConf().LumiSequencer = lumiSeq
        seq += [lumiSeq]

        if self.getProp("Lumi"):
            tupleFile = self.getProp('TupleFile')
            if tupleFile == '':
                log.warning(
                    'TupleFile has not been set. No Lumi ntuple will be produced.'
                )
            # add integrator for normalization
            self.setOtherProps(LumiIntegratorConf(),
                               ["InputType", "TupleFile", "IgnoreDQFlags"])
            lumiInt = GaudiSequencer("IntegratorSeq")
            LumiIntegratorConf().LumiSequencer = lumiInt
            seq += [lumiInt]

        return seq
예제 #3
0
    def monitorSeq(self):
        from Configurables import (TrackVertexMonitor,
                                   ParticleToTrackContainer)
        from Configurables import LoKi__VoidFilter as Filter
        monitorSeq = GaudiSequencer("AlignMonitorSeq", IgnoreFilterPassed=True)
        for i in self.getProp("TrackSelections"):
            if isinstance(i, str): i = TrackSelection(i)
            name = i.name()
            location = i.location()
            monitorSeq.Members += self.createTrackMonitors(name, location)
        for i in self.getProp("ParticleSelections"):
            location = i.location()
            name = i.name()
            pmonseq = GaudiSequencer("AlignMonitorSeq" + name)
            # add a filter on the alignment particles
            fltr = Filter('Seq' + name + 'Output',
                          Code=" 0 < CONTAINS ( '%s') " % location)
            pmonseq.Members += [fltr]
            pmonseq.Members += [
                ParticleToTrackContainer(name + "ParticleToTrackForMonitoring",
                                         ParticleLocation=location,
                                         TrackLocation=location + "Tracks")
            ]
            pmonseq.Members += self.createTrackMonitors(
                name, location + "Tracks")
            monitorSeq.Members.append(pmonseq)

        if self.getProp("VertexLocation") != "":
            monitorSeq.Members.append(
                TrackVertexMonitor("AlignVertexMonitor",
                                   PVContainer=self.getProp("VertexLocation")))
        return monitorSeq
예제 #4
0
 def postMonitorSeq(self):
     from Configurables import (TrackMonitor, TrackVertexMonitor)
     monitorSeq = GaudiSequencer("AlignMonitorSeq")
     postMonitorSeq = GaudiSequencer("AlignPostMonitorSeq")
     for m in monitorSeq.Members:
         copy = m.clone(m.name() + "Post")
         postMonitorSeq.Members.append(copy)
     return postMonitorSeq
예제 #5
0
 def PostConfigurationActions():
     from Configurables import GaudiSequencer
     if not TrackContainter:
         GaudiSequencer('MoniTrSeq').Members += [goodtracksselector]
     if Efficiency:
         GaudiSequencer('MoniTrSeq').Members += [itEff, ttEff]
     if Residuals:
         GaudiSequencer('MoniTrSeq').Members += [ttMon, itMon]
    def configure(self, name="MuonPID", UseMC=True, HistosLevel="OfflineFull"):
        """
    configure the MuonPIDchecker algorithm
    """

        if self.debug: print "CONFIGURING MUONPIDCHECKER"

        ## check if input is already an instance or this must be created
        ext = "Checker"
        if (not UseMC): ext = "Monitor"

        myalg1 = MuonPIDChecker(name + ext + "Long")
        myalg1.HistoTopDir = "Muon/"
        myalg1.RunningMC = UseMC
        myalg1.TrackType = 0
        myalg1.MonitorCutValues = self.info.MonitorCutValues
        myalg1.HistoDir = name + "/" + ext + "Long"

        if (HistosLevel == "Expert" or HistosLevel == "OfflineFull"):
            myalg1.HistosOutput = 4
            # Configure and additional instance to look at Downstream tracks
            myalg2 = MuonPIDChecker(name + ext + "Down")
            myalg2.HistoTopDir = "Muon/"
            myalg2.RunningMC = UseMC
            myalg2.HistosOutput = 1
            myalg2.TrackType = 1
            myalg2.MonitorCutValues = self.info.MonitorCutValues
            myalg2.HistoDir = name + "/" + ext + "Down"
            myalg2.HistosOutput = 4
            if (HistosLevel == "OfflineFull"):
                myalg1.HistosOutput = 3
                myalg2.HistosOutput = 3
            if (UseMC):
                GaudiSequencer("CheckMUONSeq").Members += [
                    "MuonPIDChecker/" + name + ext + "Down"
                ]
            else:
                GaudiSequencer("MoniMUONSeq").Members += [
                    "MuonPIDChecker/" + name + ext + "Down"
                ]

        else:

            if (HistosLevel == "OfflineExpress"):
                myalg1.HistosOutput = 2
            if (HistosLevel == "Online"):
                myalg1.HistosOutput = 1
            if (HistosLevel == "None"):
                myalg1.HistosOutput = 0

        if (UseMC):
            GaudiSequencer("CheckMUONSeq").Members += [
                "MuonPIDChecker/" + name + ext + "Long"
            ]
        else:
            GaudiSequencer("MoniMUONSeq").Members += [
                "MuonPIDChecker/" + name + ext + "Long"
            ]
예제 #7
0
    def _unpackProtoParticles(self):

        from Configurables import (GaudiSequencer, UnpackProtoParticle)

        # Neutrals
        # --------

        neutralLoc = "/Event/Rec/ProtoP/Neutrals"
        unpackNeutrals = UnpackProtoParticle(
            name="UnpackNeutralProtos",
            OutputName=neutralLoc,
            InputName="/Event/pRec/ProtoP/Neutrals")
        DataOnDemandSvc().AlgMap[neutralLoc] = unpackNeutrals

        # Charged
        # -------

        chargedLoc = "/Event/Rec/ProtoP/Charged"
        chargedSeq = GaudiSequencer("UnpackChargedProtosSeq")
        DataOnDemandSvc().AlgMap[chargedLoc] = chargedSeq

        # Unpacker
        unpackCharged = UnpackProtoParticle(
            name="UnpackChargedProtos",
            OutputName=chargedLoc,
            InputName="/Event/pRec/ProtoP/Charged")
        chargedSeq.Members += [unpackCharged]

        # Additional processing, not for MDST
        inputtype = self.getProp('DstType').upper()
        if inputtype != 'MDST':

            # PID calibration
            from Configurables import (ChargedProtoParticleAddRichInfo,
                                       ChargedProtoParticleAddMuonInfo,
                                       ChargedProtoCombineDLLsAlg, TESCheck)
            recalib = GaudiSequencer("ProtoParticleCombDLLs")
            recalib.IgnoreFilterPassed = False
            chargedSeq.Members += [recalib]
            # Filter to check in Protos exist
            recalib.Members += [
                TESCheck(name="CheckChargedProtosExist",
                         Inputs=[chargedLoc],
                         OutputLevel=5,
                         Stop=False)
            ]
            # Add Rich and Muon PID results to protoparticles
            recalib.Members += [
                ChargedProtoParticleAddMuonInfo("ChargedProtoPAddMuon")
            ]
            recalib.Members += [
                ChargedProtoParticleAddRichInfo("ChargedProtoPAddRich")
            ]
            # Combined DLLs
            recalib.Members += [
                ChargedProtoCombineDLLsAlg("ChargedProtoPCombDLL")
            ]
예제 #8
0
    def inputSeq(self, outputLevel=INFO):
        if not allConfigurables.get("AlignInputSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Filter Sequencer not defined! Defining!"

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

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

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

            return inputSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: AlignInputSeq already defined!"
            return allConfigurables.get("AlignInputSeq")
예제 #9
0
    def __configure(self):
        recoSeq = GaudiSequencer("Hlt2JetRecoSequence", ModeOR = True, ShortCircuit = False)

        from HltTracking.Hlt2TrackingConfigurations import Hlt2BiKalmanFittedForwardTracking
        from HltTracking.Hlt2TrackingConfigurations import Hlt2BiKalmanFittedDownstreamTracking

        # Long charged proto particles
        longTracking = Hlt2BiKalmanFittedForwardTracking()
        longChargedProtos = longTracking.hlt2ChargedNoPIDsProtos()
        longSeq = GaudiSequencer("Hlt2JetLongRecoSequence", Members = longChargedProtos.members())

        # Downstream charged proto particles
        downTracking = Hlt2BiKalmanFittedDownstreamTracking()
        downChargedProtos = downTracking.hlt2ChargedNoPIDsProtos()
        downSeq = GaudiSequencer("Hlt2JetDownRecoSequence", Members = downChargedProtos.members())

        from Hlt2SharedParticles.TrackFittedBasicParticles import BiKalmanFittedPhotons as Photons
        from Hlt2SharedParticles.Pi0 import ResolvedPi0s
        from Hlt2SharedParticles.Pi0 import MergedPi0s
        from Hlt2SharedParticles.Ks import KsLLTF as KsLL
        from Hlt2SharedParticles.Ks import KsLLTF as KsDD
        from Hlt2SharedParticles.Lambda import LambdaLLTrackFitted as LambdaLL
        from Hlt2SharedParticles.Lambda import LambdaDDTrackFitted as LambdaDD

        self.__caloProcessor = longTracking.caloProcessor()
        ecalSeq = self.__caloProcessor.clusters()

        inputs = [
            ['Particle',       'particle', self.__sharedParticleInput(Photons, "Photons")],
            ['Particle',       'particle', self.__sharedParticleInput(ResolvedPi0s, "ResolvedPi0s")],
            ['Particle',       'particle', self.__sharedParticleInput(MergedPi0s, "MergedPi0s")],
            ['Particle',       'particle', self.__sharedParticleInput(KsLL, "KsLL")],
            ['Particle',       'particle', self.__sharedParticleInput(KsDD, "KsDD")],
            ['Particle',       'particle', self.__sharedParticleInput(LambdaLL, "LambdaLL")],
            ['Particle',       'particle', self.__sharedParticleInput(LambdaDD, "LambdaDD")],
            ['ProtoParticle',  'best',     (longSeq, longChargedProtos.outputSelection())],
            ['ProtoParticle',  'best',     (downSeq, downChargedProtos.outputSelection())],
            ['CaloCluster',    'gamma',    (None, self.__findCaloLocation(Photons.members(), CellularAutomatonAlg, "OutputData"))],
            ['CaloCluster',    'gamma',    self.__hcalClusters()],
            ['IClusTrTable2D', 'ecal',     (None, self.__findCaloLocation(Photons.members(), PhotonMatchAlg, "Output"))],
            ['IClusTrTable2D', 'hcal',     self.__hcal2Track(longTracking, Photons)]
        ]

        pfInputs = []
        for inputClass, inputType, (seq, loc) in inputs:
            if seq and seq not in recoSeq.Members:
                recoSeq.Members += [seq]
            pfInputs.append([inputClass, inputType, loc])

        from Configurables import HltParticleFlow
        particleFlow = HltParticleFlow("HltParticleFlow", **self.getProp('ParticleFlowOptions'))
        particleFlow.Inputs = pfInputs
        particleFlow.Output = "Hlt2/ParticleFlow/Particles"

        from HltLine.HltLine    import bindMembers
        self.__particleFlow = bindMembers("Hlt2Jet", [recoSeq, particleFlow])
예제 #10
0
def fullReco() :
    from Configurables import ( ProcessPhase, GaudiSequencer, RecSysConf )
    brunelSeq = GaudiSequencer("BrunelSequencer")
    # analysis and Phys init are not run with MDF
    GaudiSequencer("DaVinciInitSeq").Members += [ brunelSeq ] 
    brunelSeq.Members += [ "ProcessPhase/Init", "ProcessPhase/Reco", "ProcessPhase/Moni"]
    ProcessPhase("Init").DetectorList += [ "Brunel", "Calo"]
    GaudiSequencer("InitCaloSeq").Members += ["GaudiSequencer/CaloBanksHandler"]
    importOptions("$CALODAQROOT/options/CaloBankHandler.opts")
    configureMoni(False,False)
예제 #11
0
def getUserAlgs(findalg=findalg):
    allalgs = []
    from Configurables import GaudiSequencer
    for alg in [
            GaudiSequencer("PreExciseUserAlgs"),
            GaudiSequencer('PostExciseUserAlgs')
    ]:
        found, b, c, a, ci = findalg(alg, find="THisisprobablynotgoingtoexist")
        allalgs = allalgs + b + c + a + ci
    return allalgs
예제 #12
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)
def trackingPreFilter(name, prefilter):

    VeloMuonBuilder1 = VeloMuonBuilder("VeloMuonBuilder")
    VeloMuonBuilder1.OutputLevel = 6
    VeloMuonBuilder1.MuonLocation = "Hlt1/Track/MuonSeg"
    VeloMuonBuilder1.VeloLocation = "Rec/Track/UnFittedVelo"
    VeloMuonBuilder1.lhcbids = 4
    VeloMuonBuilder1.OutputLocation = "Rec/VeloMuon/Tracks"

    preve = TrackPrepareVelo("preve")
    preve.inputLocation = "Rec/Track/Velo"
    preve.outputLocation = "Rec/Track/UnFittedVelo"
    preve.bestLocation = ""

    #TODO: apparently FastVelo is now (april 2012) run with fixes in the production which don't neccessarily apply to the stripping...
    alg = GaudiSequencer(
        "VeloMuonTrackingFor" + name,
        Members=[
            DecodeVeloRawBuffer(name + "VeloDecoding",
                                DecodeToVeloLiteClusters=True,
                                DecodeToVeloClusters=True),
            FastVeloTracking(name + "FastVelo",
                             OutputTracksName="Rec/Track/Velo"), preve,
            StandaloneMuonRec(name + "MuonStandalone"), VeloMuonBuilder1
        ])

    return GSWrapper(name="WrappedVeloMuonTracking",
                     sequencer=alg,
                     output='Rec/VeloMuon/Tracks',
                     requiredSelections=prefilter)
def trackingPreFilter(name, prefilter):

    VeloMuonBuilder1 = VeloMuonBuilder("VeloMuonBuilder")
    VeloMuonBuilder1.OutputLevel = 6
    VeloMuonBuilder1.MuonLocation = "Hlt1/Track/MuonSeg"
    VeloMuonBuilder1.VeloLocation = "Rec/Track/UnFittedVelo"
    VeloMuonBuilder1.lhcbids = 4
    VeloMuonBuilder1.OutputLocation = "Rec/VeloMuon/Tracks"

    preve = TrackPrepareVelo("preve")
    preve.inputLocation = "Rec/Track/Velo"
    preve.outputLocation = "Rec/Track/UnFittedVelo"
    preve.bestLocation = ""

    alg = GaudiSequencer(
        "VeloMuonTrackingFor" + name,
        Members=[
            DecodeVeloRawBuffer(name + "VeloDecoding",
                                DecodeToVeloLiteClusters=True,
                                DecodeToVeloClusters=True),
            FastVeloTracking(name + "FastVelo",
                             OutputTracksName="Rec/Track/Velo"), preve,
            StandaloneMuonRec(name + "MuonStandalone"), VeloMuonBuilder1
        ])

    return GSWrapper(name="WrappedVeloMuonTracking",
                     sequencer=alg,
                     output='Rec/VeloMuon/Tracks',
                     requiredSelections=prefilter)
예제 #15
0
 def configureSequence(self):
     misalignSeq = GaudiSequencer("MisAlignSequence")
     ApplicationMgr().TopAlg = [misalignSeq]
     misalignSeq.Members += ["MisAlignAlg"]
     from Configurables import WriteAlignmentConditions
     if "VELO" in self.getProp("Detectors"):
         writeVelo = WriteAlignmentConditions()
         writeVelo.topElement = "/dd/Structure/LHCb/BeforeMagnetRegion/Velo"
         writeVelo.outputFile = "VeLo_1.xml"
         writeVelo.depths = [0, 1, 2, 3]
         misalignSeq.Members += [writeVelo]
     if "OT" in self.getProp("Detectors"):
         writeOT = WriteAlignmentConditions()
         writeOT.topElement = "/dd/Structure/LHCb/AfterMagnetRegion/T/OT"
         writeOT.depths = [0, 1, 2, 3]
         writeOT.outputFile = "OT_1.xml"
         misalignSeq.Members += [writeOT]
     if "TT" in self.getProp("Detectors"):
         writeTT = WriteAlignmentConditions()
         writeTT.topElement = "/dd/Structure/LHCb/BeforeMagnetRegion/TT"
         writeTT.outputFile = "TT_1.xml"
         writeTT.depths = [0, 1, 2, 3]
         misalignSeq.Members += [writeTT]
     if "IT" in self.getProp("Detectors"):
         writeIT = WriteAlignmentConditions()
         writeIT.topElement = "/dd/Structure/LHCb/AfterMagnetRegion/T/IT"
         writeIT.outputFile = "IT_1.xml"
         writeIT.depths = [0, 1, 2, 3]
         misalignSeq.Members += [writeIT]
예제 #16
0
def configuredParticleListFromDST(ParticleLocation, FilterCode=""):
    from Configurables import GaudiSequencer
    from Configurables import TrackParticleRefitter, TrackMasterFitter
    from TrackFitter.ConfiguredFitters import ConfiguredMasterFitter
    # create a sequence to refit and monitor
    name = ParticleLocation
    name = name.replace("/Event", "")
    name = name.replace("/Phys", "")
    name = name.replace("/Particles", "")
    name = name.replace("/", "")
    fitter = TrackParticleRefitter(name + "Refitter",
                                   TrackFitter=TrackMasterFitter(),
                                   ParticleLocation=ParticleLocation)
    ConfiguredMasterFitter(fitter.TrackFitter, SimplifiedGeometry=True)
    seq = GaudiSequencer(name + "Seq", IgnoreFilterPassed=True)
    seq.Members.append(fitter)
    if FilterCode != "":
        from Configurables import FilterDesktop
        newLocation = ParticleLocation.replace("/Particles", "") + "Filtered"
        newfilter = FilterDesktop(  #name + "Filter",#Output =
            newLocation,
            Inputs=[ParticleLocation],
            CloneFilteredParticles=False,
            Code=FilterCode)
        seq.Members.append(newfilter)
        ParticleLocation = newLocation + "/Particles"
    sel = ParticleSelection(Name=name,
                            Location=ParticleLocation,
                            Algorithm=seq)
    return sel
예제 #17
0
        def genConfigAction():
            def gather(c, overrule):
                def check(config, prop, value):
                    if prop not in config.getDefaultProperties(): return False
                    if hasattr(config, prop):
                        return getattr(config, prop) == value
                    return config.getDefaultProperties()[prop] == value

                def addOverrule(config, rule):
                    if c.name() not in overrule.keys():
                        overrule[c.name()] = []
                    if rule not in overrule[c.name()]:
                        overrule[c.name()] += [rule]

                if check(c, 'HistoProduce', False):
                    addOverrule(c, 'HistoProduce:@OnlineEnv.Monitor@False')
                if c.getType() in ['FilterDesktop', 'CombineParticles'
                                   ] and check(c, 'Monitor', False):
                    addOverrule(c, 'Monitor:@OnlineEnv.Monitor@False')
                if check(c, 'Enable', False):
                    addOverrule(c, 'OutputLevel:3')
                for p in ['Members', 'Filter0', 'Filter1']:
                    if not hasattr(c, p): continue
                    x = getattr(c, p)
                    if list is not type(x): x = [x]
                    for i in x:
                        gather(i, overrule)

            from Configurables import HltGenConfig, GaudiSequencer
            HltGenConfig().Overrule = {
                'Hlt1ODINTechnicalPreScaler':
                ['AcceptFraction:@OnlineEnv.AcceptRate@0']
            }
            gather(GaudiSequencer('Hlt'), HltGenConfig().Overrule)
            print HltGenConfig()
예제 #18
0
def copyGoodEvents(filename, extraitems=[], incident='GoodEvent'):
    """
    Utitity to copy ``good/tagged'' events

    It is based on configurables,
    thus it needs to be invoked BEFORE GaudiPython
    
    #
    ##Configurables:
    #
    from Bender.Utils import copyGoodEvents
    copyGoodEvents ( filename = 'SelectedEvents' )
    
    """
    from GaudiConf import IOHelper
    ioh = IOHelper('ROOT', 'ROOT')
    algs = ioh.outputAlgs(filename, 'InputCopyStream/%s' % incident)

    ioh.setupServices()
    from Configurables import Gaudi__IncidentFilter as Tagger
    tag = Tagger("%sInc" % incident, Incidents=[incident])

    from Configurables import GaudiSequencer
    seq = GaudiSequencer('%sSeq' % incident, Members=[tag] + algs)

    from Configurables import ApplicationMgr
    AM = ApplicationMgr()

    if not AM.OutStream: AM.OutStream = []

    AM.OutStream.append(seq)

    logger.info("Prepare the file %s to keep ``%s'' incidents" %
                (filename, incident))
def trackingPreFilter(name, prefilter):

    VeloMuonBuilder1 = VeloMuonBuilder("VeloMuonBuilder")
    VeloMuonBuilder1.OutputLevel = 6
    VeloMuonBuilder1.MuonLocation = "Hlt1/Track/MuonSeg"
    VeloMuonBuilder1.VeloLocation = "Rec/Track/FittedVelo"
    VeloMuonBuilder1.lhcbids = 4
    VeloMuonBuilder1.OutputLocation = "Rec/VeloMuon/Tracks"

    preve = TrackPrepareVelo("preve")
    preve.inputLocation = "Rec/Track/Velo"
    preve.outputLocation = "Rec/Track/UnfittedPreparedVelo"
    preve.bestLocation = ""
    vefit = ConfiguredFit("vefit", "Rec/Track/UnfittedPreparedVelo")
    vefit.TracksOutContainer = "Rec/Track/FittedVelo"
    vefit.addTool(TrackMasterFitter, name='Fitter')
    ConfiguredFastFitter(getattr(vefit, 'Fitter'))

    alg = GaudiSequencer(
        "VeloMuonTrackingFor" + name,
        Members=[
            DecodeVeloRawBuffer(name + "VeloDecoding",
                                DecodeToVeloLiteClusters=True,
                                DecodeToVeloClusters=True),
            FastVeloTracking(name + "FastVelo",
                             OutputTracksName="Rec/Track/Velo"), preve, vefit,
            StandaloneMuonRec(name + "MuonStandalone"), VeloMuonBuilder1
        ])

    return GSWrapper(name="WrappedVeloMuonTracking",
                     sequencer=alg,
                     output='Rec/VeloMuon/Tracks',
                     requiredSelections=prefilter)
예제 #20
0
    def configureInput(self, inputType):
        """
        Tune initialisation according to input type
        """

        # By default, Brunel only needs to open one input file at a time
        # Only set to zero if not previously set to something else.
        if not IODataManager().isPropertySet("AgeLimit") : IODataManager().AgeLimit = 0

        if self._isReprocessing(inputType):
            # Kill knowledge of any previous Brunel processing
            from Configurables import ( TESCheck, EventNodeKiller )
            InitReprocSeq = GaudiSequencer( "InitReprocSeq" )
            if ( self.getProp("WithMC") and inputType in ["XDST","DST"] ):
                # Load linkers, to kill them (avoid appending to them later)
                InitReprocSeq.Members.append( "TESCheck" )
                TESCheck().Inputs = ["Link/Rec/Track/Best"]
            killer = EventNodeKiller()
            killer.Nodes += [ "Raw", "Link/Rec" ]
            if self.getProp("SkipTracking"):
                killer.Nodes += [ "pRec/Rich", "pRec/Muon", "pRec/Calo", "pRec/Track/Muon", "pRec/ProtoP" ]
            else:
                killer.Nodes += [ "pRec", "Rec" ]
            InitReprocSeq.Members.append( killer )
            ### see configureOutput to see how the remainder of the juggler is configured
            
        # Get the event time (for CondDb) from ODIN
        from Configurables import EventClockSvc
        EventClockSvc().EventTimeDecoder = "OdinTimeDecoder";
def selMuonPParts(name, trackingSeq):
    """
       Make ProtoParticles out of VeloMuon tracks
   """
    veloprotos = ChargedProtoParticleMaker(name + "ProtoPMaker")
    veloprotos.Inputs = ["Rec/VeloMuon/Tracks"]
    veloprotos.Output = "Rec/ProtoP/" + name + "ProtoPMaker/ProtoParticles"
    veloprotos.addTool(DelegatingTrackSelector, name="TrackSelector")
    tracktypes = ["Long"]
    veloprotos.TrackSelector.TrackTypes = tracktypes
    selector = veloprotos.TrackSelector
    for tsname in tracktypes:
        selector.addTool(TrackSelector, name=tsname)
        ts = getattr(selector, tsname)
        # Set Cuts
        ts.TrackTypes = [tsname]

    veloprotoseq = GaudiSequencer(name + "ProtoPSeq")
    veloprotoseq.Members += [veloprotos]

    return GSWrapper(name="WrappedVeloMuonProtoPSeqFor" + name,
                     sequencer=veloprotoseq,
                     output='Rec/ProtoP/' + name +
                     'ProtoPMaker/ProtoParticles',
                     requiredSelections=[trackingSeq])
예제 #22
0
    def algorithm(self):
        Name = self._name
        inputTrackLocation = self._inputLocation
        from Configurables import GaudiSequencer, HltTrackConverter, TrackContainerCopy, Escher
        from Configurables import TrackContainerCopy, TrackSelector
        trackRefitSeq = GaudiSequencer(
            self.name() + "Seq")  # GaudiSequencer("TrackRefitSeq")

        # create a track list for tracks with velo hits
        velotrackselector = TrackContainerCopy(
            "GoodLongRefittedVeloTracks",
            inputLocations=["Rec/Track/Best"],
            outputLocation="Rec/Track/GoodLongRefittedVeloTracks",
            Selector=TrackSelector())
        velotrackselector.Selector.MinNVeloRHits = 7
        velotrackselector.Selector.MinNVeloPhiHits = 6
        # refit the tracks in that list
        from TrackFitter.ConfiguredFitters import *
        velotrackrefitter = ConfiguredEventFitter(
            Name="TracksWithVeloHitsFitter",
            TracksInContainer="Rec/Track/GoodLongRefittedVeloTracks",
            FieldOff=True)
        velotrackrefitter.Fitter.MeasProvider.IgnoreIT = True
        velotrackrefitter.Fitter.MeasProvider.IgnoreOT = True
        velotrackrefitter.Fitter.MeasProvider.IgnoreTT = True
        velotrackrefitter.Fitter.MeasProvider.IgnoreMuon = True
        velotrackrefitter.Fitter.MakeNodes = True
        velotrackrefitter.Fitter.MakeMeasurements = True

        trackRefitSeq.Members += [velotrackselector, velotrackrefitter]
        return trackRefitSeq
예제 #23
0
    def _init(self):
        from Configurables import (PhysConf, AnalysisConf)

        inputType = self.getProp("InputType").upper()

        initSeqs = []

        if ((inputType != 'MDST') & (inputType != "MDF") &
            (inputType != "DIGI")):
            physinit = PhysConf().initSequence()  # PhysConf initSequence
            # Analysis
            AnalysisConf().RedoMCLinks = self.getProp("RedoMCLinks")
            analysisinit = AnalysisConf().initSequence()
            initSeqs = [physinit, analysisinit]
#        if inputType == 'RDST' :
#            log.info('Setting HltDecReportsDecoders RawEventLocations to ["pRec/RawEvent"]')
#            from DAQSys.Decoders import DecoderDB
#            from DAQSys.DecoderClass import decodersForBank
#            for bank in ["Sel","Dec","Vertex","Track"]:
#                for d in decodersForBank(DecoderDB,"Hlt"+bank+"Reports"):
#                    d.overrideInputs("pRec/RawEvent")
#                    #d.setup()
#            from Configurables import ANNDispatchSvc
#
#            ANNDispatchSvc().RawEventLocation = "pRec/RawEvent"

        return GaudiSequencer('DaVinciEventInitSeq',
                              Members=initSeqs,
                              IgnoreFilterPassed=True)
예제 #24
0
def trackingDownPreFilter(name, prefilter, seedcut):
    #Test code for debugging
    #Jpsi_already_there = LoKi__VoidFilter("Jpsi_already_there")
    #Jpsi_already_there.Code = "1 <= CONTAINS('Rec/Track/Downstream')"

    #Jpsi_not_yet_there = LoKi__VoidFilter("Jpsi_not_yet_there")
    #Jpsi_not_yet_there.Code = "1 > CONTAINS('Rec/Track/Downstream')"

    TrackToDST(name + "_DownTrackToDST"
               ).TracksInContainer = "Rec/" + name + "_Downstream/FittedTracks"

    jpsidotracking = GaudiSequencer("DownTrackingFor" + name)

    #Add seed tracking
    DownSeeding = PatSeeding(name + "_DownSeeding")
    DownSeeding.OutputTracksName = "Rec/" + name + "_DownSeeding/Tracks"
    PatAlgConf.SeedingConf().configureAlg(SeedAlg=DownSeeding)
    #DownSeeding.addTool(PatSeedingTool, name=name+"_PatSeedingTool")
    #DownSeeding.addTool(PatSeedingTool)
    #PatSeedingTool(name+"_PatSeedingTool").MinMomentum = seedcut
    seedtoolname = name + "_PatSeedingTool"
    DownSeeding.addTool(PatSeedingTool, name=seedtoolname)
    seedtool = getattr(DownSeeding, seedtoolname)
    seedtool.MinMomentum = seedcut

    jpsidotracking.Members += [DownSeeding]
    #Add Seed Fit
    jpsidotracking.Members += [GaudiSequencer(name + "_TrackSeedFitSeq")]
    #AddPatDownstream
    downstreamTracking = PatDownstream(name + "_PatDownstream")
    downstreamTracking.InputLocation = DownSeeding.OutputTracksName
    downstreamTracking.OutputLocation = 'Rec/' + name + '_Downstream/Tracks'
    jpsidotracking.Members += [downstreamTracking]
    #AddDownstreamFitSeq
    DownInitAlg = TrackStateInitAlg(name + "_InitSeedDownstream")
    jpsidotracking.Members += [DownInitAlg]
    DownInitAlg.TrackLocation = "Rec/" + name + "_Downstream/Tracks"
    downstreamFit = ConfiguredFitDownstream(name + "_FitDownstream")
    downstreamFit.TracksInContainer = 'Rec/' + name + '_Downstream/Tracks'
    downstreamFit.TracksOutContainer = 'Rec/' + name + '_Downstream/FittedTracks'
    jpsidotracking.Members += [downstreamFit]
    jpsidotracking.Members += [TrackToDST(name + "_DownTrackToDST")]

    return GSWrapper(name="WrappedDownstreamTracking" + name,
                     sequencer=jpsidotracking,
                     output='Rec/' + name + '_Downstream/FittedTracks',
                     requiredSelections=[prefilter])
예제 #25
0
def muonTracksFORmuonAlignment():

    # this still needs to be worked out
    from Configurables import Escher
    Escher().RecoSequence = [
        "Hlt", "Decoding", "AlignTr", "Vertex", "RICH", "CALO", "MUON", "PROTO"
    ]  # ????
    Escher().MoniSequence = ["Tr", "OT"]

    # if the Escher hlt filter is not set, set it here
    if not hasattr(Escher(), "HltFilterCode") or not Escher().HltFilterCode:
        Escher(
        ).HltFilterCode = "HLT_PASS_RE( 'Hlt1DiMuonHighMass*Decision' )"  # Hlt2-->Hlt1 requirement

    # revive only particles used for trigger
    print 'Hlt lines to be used: '
    print ReviveHltTracks(['Hlt1DiMuonHighMassDecision'])

    # Now create the J/psi candidates
    from Configurables import CombineParticles, FilterDesktop
    from CommonParticles.StdAllLooseMuons import StdAllLooseMuons  # requires IsMuon==1
    from CommonParticles.StdLooseJpsi2MuMu import StdLooseJpsi2MuMu  # requires (ADAMASS('J/psi')<100.*MeV)&(ADOCACHI2CUT(30,'')) && "(VFASPF(VCHI2) < 25.)"

    StdLooseJpsi2MuMu.DaughtersCuts = {"mu-": "( P> 6000*MeV)"}  # momentum cut

    ## tighten the mass window for candidates used in alignment
    AlignJpsi2MuMu = FilterDesktop(
        "AlignJpsi2MuMu",
        Inputs=["Phys/StdLooseJpsi2MuMu"],
        Code="(ADMASS('J/psi(1S)') < 35.*MeV) & (VFASPF(VCHI2) < 10.)"
    )  # tighter requirements

    from Configurables import ChargedProtoParticleMaker, ChargedProtoParticleAddMuonInfo
    #####, ChargedProtoCombineDLLsAlg
    from Configurables import TrackParticleMonitor, GaudiSequencer
    recoJpsiSeq = GaudiSequencer("RecoJpsiSeq")
    recoJpsiSeq.Members = [
        ChargedProtoParticleMaker('ChargedProtoPMaker'),
        ChargedProtoParticleAddMuonInfo('ChargedProtoPAddMuon'),
        ###ChargedProtoCombineDLLsAlg('ChargedProtoPCombDLLs'),
        StdAllLooseMuons,
        StdLooseJpsi2MuMu,
        TrackParticleMonitor(
            'StdLooseJpsi2MuMuMonitor',
            InputLocation='/Event/Phys/StdLooseJpsi2MuMu/Particles',
            MinMass=3000,
            MaxMass=3190),
        AlignJpsi2MuMu,
        TrackParticleMonitor(
            'AlignJpsi2MuMuMonitor',
            InputLocation='/Event/Phys/AlignJpsi2MuMu/Particles',
            MinMass=3000,
            MaxMass=3190),
    ]

    sel = ParticleSelection(Name='MufromJpsiMuMu',
                            Location='/Event/Phys/AlignJpsi2MuMu/Particles',
                            Algorithm=recoJpsiSeq)
    return sel
예제 #26
0
def doMyChanges():
    from Configurables import VetraInit, FilterByBankType
    bankFilter = FilterByBankType()
    bankFilter.BankNames = ["TTFull", "ITFull"]
    from Configurables import LoKi__ODINFilter
    odinFilter = LoKi__ODINFilter(
        'BBODINFilter', Code=" LHCb.ODIN.BeamCrossing == ODIN_BXTYP ")
    GaudiSequencer('Init').Members = [VetraInit(), odinFilter, bankFilter]
예제 #27
0
 def initSequence(self):
     """
     Init Sequence. Called by master application.
     """
     # only one initialisiation so far
     from Configurables import GaudiSequencer
     init = GaudiSequencer("PhysInitSeq")
     self.configureReco(init)
     return init
예제 #28
0
    def fillLowLumiFSR(self):
        '''
        fill the low lumi FSR, return a sequence
        similar to the fillFSR method, but accepts more trigger types and
        applies the method filter Method:L0RateMethod
        this is valid for all versions om Moore 
        '''
        from Configurables import (LumiAccounting, HltLumiSummaryDecoder,
                                   FilterOnLumiSummary, GaudiSequencer)
        from Configurables import LoKi__ODINFilter as ODINFilter
        # Create sub-sequences according to BXTypes
        crossings = self.getProp("BXTypes")
        dsttype = ('---' + self.getProp('InputType'))[-3:] == 'DST'
        BXMembers = []
        from DAQSys.Decoders import DecoderDB
        HltLumiSummaryDecoder = DecoderDB["HltLumiSummaryDecoder"]
        for i in crossings:
            seqMembers = []
            seqMembers.append(
                ODINFilter(
                    'FilterLow' + i,
                    Code=
                    ' ( ODIN_TRGTYP <= LHCb.ODIN.LumiTrigger ) & ( ODIN_BXTYP == LHCb.ODIN.'
                    + i + ' ) '))
            ddb = HltLumiSummaryDecoder.clone(
                'HltLumiSummaryDecoder/LumiDecode' + i)
            #ddb.Active=True
            #don't think this will work, all decoders would be writing to the same location? What if a bunch is of two types?
            # this is OK, the bunchtypes are exclusive
            if dsttype:
                ddb.overrideOutputs('LumiSummaries')
            decoder = ddb.setup()
            seqMembers.append(decoder)
            methodfilter = FilterOnLumiSummary(
                'LumiLowFilter' + i,
                CounterName="Method",
                ValueName="L0RateMethod",
                OutputLevel=self.getProp("OutputLevel"))
            seqMembers.append(methodfilter)

            if not self.getProp("Simulation"):
                accounting = LumiAccounting(
                    'LumiLowCount' + i,
                    OutputDataContainer="/FileRecords/LumiLowFSR" + i,
                    OutputLevel=self.getProp("OutputLevel"))
                seqMembers.append(accounting)

            BXMembers.append(
                GaudiSequencer('LumiLow' + i + 'Seq',
                               Members=seqMembers,
                               ModeOR=False,
                               ShortCircuit=True))
            if dsttype:
                accounting.InputDataContainer = 'LumiSummaries'
                methodfilter.InputDataContainer = 'LumiSummaries'

        return BXMembers
예제 #29
0
 def optionalHPT_tracking(self, name):
     # The high pT tracking algorithms sometimes have to be wrapped in a
     # sequence that ignores FilterPassed to avoid stopping if no tracks are
     # created.
     from Configurables import GaudiSequencer
     from HltTracking.Hlt1Tracking import TrackCandidatesAlgos
     return GaudiSequencer('Hlt1%sHPTTrackingSequence' % name,
                           Members=TrackCandidatesAlgos(name).members(),
                           IgnoreFilterPassed=True)
예제 #30
0
 def initSequence(self):
     """
     Init Sequence. Called by master application.
     """
     # only one initialisiation do far
     from Configurables import GaudiSequencer
     init = GaudiSequencer("AnalysisInitSeq")
     self.redoMCLinks(init)
     return init