예제 #1
0
    def _createWriter(self, sequence):
        '''
    create writer sequence
    '''
        writeLumiSequence = _sequenceAppender(
            Sequence('writeLumiSeq',
                     ModeOR=False,
                     ShortCircuit=True,
                     IgnoreFilterPassed=False,
                     MeasureTime=True,
                     OutputLevel=self.getProp("OutputLevel")))

        # create ODIN by hand
        writeLumiSequence(createODIN('createODIN'))

        # kill non-lumi banks to make output small
        if self.getProp('KillBanks'):
            writeLumiSequence(
                bankKiller('KillAll',
                           BankTypes=['ODIN', 'HltLumiSummary', 'DAQ'],
                           DefaultIsKill=True))
        # tag input file ---
        writeLumiSequence(
            FileIdBankWriter(OutputLevel=self.getProp("OutputLevel")))

        # and activate it
        sequence.Members += [Sequence('writeLumiSeq')]

        # create lumi sequence
        lumiFsrSeq = GaudiSequencer("LumiFsrSeq", OutputLevel=INFO)
        LumiAlgsConf().LumiSequencer = lumiFsrSeq
        sequence.Members += [lumiFsrSeq]
예제 #2
0
    def __lumiAlgs(self, stream, exclude, rawLocation = None):
        # Return the list of algorithms that are required to treat lumi events

        # Don't nanofy after HLT1, of if there is nothing base nanofication on
        if self.getProp('Split') == 'Hlt1' or not exclude:
            return []

        from DAQSys.Decoders import DecoderDB
        from Configurables   import bankKiller
        from Configurables   import DeterministicPrescaler as Prescale
        from Configurables   import LoKi__HDRFilter   as HltFilter

        # Strip exclusive lumi events
        decoder = DecoderDB["HltDecReportsDecoder/Hlt2DecReportsDecoder"]
        prefix = stream + 'Lumi' if stream != 'Lumi' else stream + 'Stream'
        stripper = Sequence(prefix + 'Stripper')

        if exclude != self.getProp('LumiPredicate'):
            # Filter on which events to nanofy for all streams, except Lumi,
            # where everything is nanofied
            stripper.Members += [HltFilter(prefix + 'Hlt2StripperFilter',
                                            Code = self.__lumiPredicate(exclude, exclusive = True)[1],
                                            Location = decoder.listOutputs()[0])]
        else:
            # Keep a small fraction of non-nanofied events in the Lumi stream.
            stripper.Members += [Prescale('LumiStripperPrescaler', AcceptFraction = self.getProp('LumiBankKillerAcceptFraction'))]

        # The actual nanofier
        killer = bankKiller(prefix + 'StripperBankKiller', BankTypes = self.__nanoBanks(stream), DefaultIsKill = True)
        if rawLocation:
            killer.RawEventLocations = [rawLocation]
        stripper.Members += [killer]

        return [stripper]
예제 #3
0
  def _createWriter(self, sequence):
    '''
    create writer sequence
    '''
    debugOPL = self.getProp("OutputLevel")
    debugging = self.getProp("Debug")
    writeLumiSequence = _sequenceAppender( Sequence('writeLumiSeq',
                                                    ModeOR = False,
                                                    ShortCircuit = True,
                                                    IgnoreFilterPassed = False,
                                                    MeasureTime = True,
                                                    OutputLevel = debugOPL  ) )
    from DAQSys.Decoders import DecoderDB
    from DAQSys.DecoderClass import decodersForBank
    # create ODIN by hand
    for d in decodersForBank(DecoderDB,"ODIN"):
        writeLumiSequence( d.setup() )
    # verbose output
    if debugging:
      writeLumiSequence( RawEventDump( 'InputDump', DumpData = False, OutputLevel = debugOPL ) )
      pass
      
    # select only the right Trigger Type
    writeLumiSequence( ODINFilter ( 'OdinTriggerTypes',
                                    Code = ' ( ODIN_TRGTYP == LHCb.ODIN.LumiTrigger ) ' ))

    ## Lumi only triggers 
    # decode summary data
    for d in decodersForBank(DecoderDB,"HltLumiSummary"):
        writeLumiSequence( d.setup() ) 
    # add filter to check if this was L0 triggered
    filterRan = FilterOnLumiSummary('LumiRandomFilter', CounterName = "Random", ValueName = "RandomMethod")
    #filterLow = FilterOnLumiSummary('LumiLowFilter', CounterName = "Method", ValueName = "L0RateMethod")
    writeLumiSequence( Sequence('filterLumi', 
                                Members = [filterRan], #, filterLow],  
                                ModeOR = True,
                                ShortCircuit = True,
                                IgnoreFilterPassed = False,
                                MeasureTime = True )
                       )
    # kill non-lumi banks
    if self.getProp('KillBanks') :
      writeLumiSequence(
        bankKiller( 'KillAll', BankTypes=[ 'ODIN','HltLumiSummary','HltRoutingBits','DAQ' ],  DefaultIsKill=True )
        )
    # tag input file ---
    writeLumiSequence( FileIdBankWriter( OutputLevel = debugOPL ) ) 
    # verbose output
    if debugging:
        writeLumiSequence( RawEventDump( 'OutputDump', DumpData = True, OutputLevel = debugOPL ) )

    writeLumiSequence( MDFWriter( "MDFWriter" ) )  # configure somewhere else

    # and activate it
    sequence.Members+=[ Sequence('writeLumiSeq') ]
예제 #4
0
    def _configureInput(self):
        files = self.getProp('inputFiles')
        #    #  veto lumi events..
        #    #ApplicationMgr().EvtSel.REQ1 = "EvType=2;TriggerMask=0x0,0x4,0x0,0x0;VetoMask=0,0,0,0;MaskType=ANY;UserType=USER;Frequency=PERC;Perc=100.0"

        if files:
            from GaudiConf import IOExtension
            IOExtension().inputFiles(files, clear=True)
        # remove any HLT rawbanks from the input if so requested...

        if self.getProp('RemoveInputHltRawBanks'):
            from Configurables import bankKiller, ApplicationMgr
            app = ApplicationMgr()
            hlt_banks = [
                'HltDecReports', 'HltRoutingBits', 'HltSelReports',
                'HltVertexReports', 'HltLumiSummary', 'HltTrackReports'
            ]
            bk = bankKiller('RemoveInputHltRawBanks', BankTypes=hlt_banks)
            app.TopAlg.insert(0, bk)
예제 #5
0
    def __rawEventAlgs(self, stream, banks, lumiExclude, routingBits = None, rawLocation = None):
        # Return the list of algorithms that are required to correctly output an
        # event to a stream

        from Configurables import LHCb__RawEventCopy as RawEventCopy
        from Configurables import LoKi__VoidFilter as VoidFilter
        from Configurables import HltRoutingBitsWriter
        from Configurables import bankKiller

        rawAlgs = []

        # Copy RawEvent if needed
        if rawLocation:
            copier = RawEventCopy(stream + "RawEventCopy", Destination = '/Event/' + rawLocation,
                                  DeepCopy = True)
            rawAlgs += [copier]

        # Write RoutingBits for this stream
        if routingBits:
            rawAlgs += [self.__hlt2RoutingBitsWriter(stream, routingBits, rawLocation)]

        # Strip banks if needed
        if banks and banks != self.__nanoBanks(stream):
            nbs = set(self.__nanoBanks(stream))
            if (stream.upper() in self.getProp('StreamsWithLumi') and self.getProp('EnableLumiEventWriting')
                and nbs.intersection(set(banks)) != nbs):
                raise ValueError("Lumi banks are being stripped by the raw event stripper, while this stream"
                                 " needs lumi events")
            stripper = bankKiller(stream + 'Stripper', BankTypes = banks, DefaultIsKill = True)
            if rawLocation:
                stripper.RawEventLocations = [rawLocation]
            rawAlgs += [stripper]

        # Lumi writing
        if self.getProp("EnableLumiEventWriting"):
            rawAlgs += self.__lumiAlgs(stream, lumiExclude, rawLocation)

        return rawAlgs
예제 #6
0
    def configureInit(self, inputType):
        # Init sequence
        if not self.isPropertySet("InitSequence"):
            if self._isReprocessing(inputType):
                self.setProp( "InitSequence", self.DefaultReproInitSequence )
            else:
                self.setProp( "InitSequence", self.DefaultInitSequence )
        from Configurables import ProcessPhase
        ProcessPhase("Init").DetectorList += self.getProp("InitSequence")

        from Configurables import RecInit, MemoryTool
        recInit = RecInit( "BrunelInit",
                           PrintFreq = self.getProp("PrintFreq"))
        GaudiSequencer("InitBrunelSeq").Members += [ recInit ]
        recInit.addTool( MemoryTool(), name = "BrunelMemory" )
        recInit.BrunelMemory.HistoTopDir = "Brunel/"
        recInit.BrunelMemory.HistoDir    = "MemoryTool"
        if not recInit.isPropertySet( "MemoryPurgeLimit" ): recInit.MemoryPurgeLimit = 2000 * 1000 # 2GB

        # count events
        from Configurables import EventCountHisto
        evtC = EventCountHisto("BrunelEventCount")
        evtC.HistoTopDir = "Brunel/"
        GaudiSequencer("InitBrunelSeq").Members += [ evtC ]

        # kill some RAW banks
        banksToKill = []
        if self.isPropertySet( "RawBanksToKill" ):
            banksToKill  = self.getProp( "RawBanksToKill" )
        if ("2009" == self.getProp("DataType")) and (inputType in ["MDF"]) and not self.getProp("Simulation") :
            banksToKill += ["VeloFull", "L0PUFull"]
        if len(banksToKill) > 0 :
            from Configurables import bankKiller
            bkKill = bankKiller("BrunelBankKiller")
            bkKill.BankTypes = banksToKill
            GaudiSequencer("InitBrunelSeq").Members += [ bkKill ]

        # Do not print event number at every event (done already by BrunelInit)
        EventSelector().PrintFreq = -1

        # OutputLevel
        self.setOtherProp(LHCbApp(),"OutputLevel")
        if self.isPropertySet( "OutputLevel" ) :
            level = self.getProp("OutputLevel")
            if level == ERROR or level == WARNING :
                # Suppress known warnings
                importOptions( "$BRUNELOPTS/SuppressWarnings.opts" )
                if not recInit.isPropertySet( "OutputLevel" ): recInit.OutputLevel = INFO
        self.setOtherProps(RecSysConf(), ["OutputLevel","Detectors"])
        self.setOtherProps(RecMoniConf(),["OutputLevel","Detectors"])

        # New NoSPDPRS switches
        noSPDPRS = False
        if [det for det in ['Spd', 'Prs'] if det not in self.getProp("Detectors")]:
            noSPDPRS = True
        # only set properties if no use RecoSequence is defined or if it contains 'PROTO'
        # not that 'PROTO' alone is not sufficient to run the Calo reconstruction, but a requirement
        if ( not self.isPropertySet("RecoSequence") or "PROTO" in self.getProp("RecoSequence") ):
            CaloProcessor().setProp("NoSpdPrs", noSPDPRS)
            GlobalRecoConf().setProp("NoSpdPrs", noSPDPRS)


        # Always print Magnetic Field used
        from Configurables import MagneticFieldSvc
        magSvc = MagneticFieldSvc()
        if not magSvc.isPropertySet("OutputLevel") :
            magSvc.setProp("OutputLevel", INFO)

        # Switch off LoKi banner
        from Configurables import LoKiSvc
        LoKiSvc().Welcome = False
from Gaudi.Configuration import *
from Configurables import bankKiller, RawEventDump, GaudiSequencer
from Configurables import LHCbApp

import os
if os.path.exists("rewritten.mdf"):
    print "EXISTS"
    os.system("rm rewritten.mdf")
else:
    print "NOTHING!"

LHCbApp().EvtMax = 10
dump = RawEventDump(RawBanks=[], DumpData=True)
decoders = GaudiSequencer("Decode", Members=[])
killer = bankKiller(BankTypes=[])
killer2 = bankKiller("Killer2", BankTypes=[])
encoders = GaudiSequencer("Encode", Members=[])

import Configurables
from Configurables import IODataManager
IODataManager().DisablePFNWarning = True

locs = {"Decoder": "Output", "Writer": "Input"}

#can't do track just yet, can be added easily, though later
bankTypes = ["Dec", "Sel", "Vertex"]

from itertools import product
for stage, t, (seq, at) in product(
    (1, 2), bankTypes, ((decoders, "Decoder"), (encoders, "Writer"))):
    algType = "Hlt{0}Reports{1}".format(t, at)
예제 #8
0
    def __apply_configuration__(self):
        #make sure the dictionaries are there... Hack! %TODO -> Remove this!
        RawEventFormatConf().loadIfRequired()
        #then get them ...
        locs, rec = _getDict()
        added_locations = []

        if not self.isPropertySet("Output") or not self.isPropertySet("Input"):
            raise AttributeError(
                "You must set both the input and the output version, this can be a version number (float, int) or a name, see: "
                + rec.__str__())

        #swap logical for numeric, and check it exists
        ov = _checkv(self.getProp("Output"), locs, rec)
        iv = _checkv(self.getProp("Input"), locs, rec)

        output_locations = ReverseDict(ov, locs, rec)
        input_locations = ReverseDict(iv, locs, rec)
        #check if a Trigger TCK is needed

        if len([
                loc for loc in input_locations
                if self.getProp("TCKReplacePattern") in loc
        ]) or len([
                loc for loc in output_locations
                if self.getProp("TCKReplacePattern") in loc
        ]):
            if (not self.isPropertySet("TCK")) and (
                    not RawEventFormatConf().isPropertySet("TCK")):
                raise AttributeError(
                    "The raw event version you specified requires a TCK to be given. Set RawEventJuggler().TCK"
                )
        for prop in ["TCK", "GenericReplacePatterns", "TCKReplacePattern"]:
            self.__safeset__(RawEventFormatConf(), prop)

        killBefore = []
        loc_to_alg_dict = {}
        killAfter = []

        ######################################
        # Stage 1: KillBefore if requested
        ######################################
        if self.isPropertySet("KillInputBanksBefore"):
            from Configurables import bankKiller
            #if KillBanks or KillNodes... has been requested, I can't use DoD, it's unsafe. I don't know what's "before" and "after"
            if self.getProp("DataOnDemand"):
                raise AttributeError(
                    "You have asked for some killing of banks, and asked for DoD, which is not a safe way to run. Either cope with the extra banks, or use a sequencer instead of DoD"
                )
            import re
            for loc in input_locations:
                #see if this location has banks to kill
                killBanks = [
                    abank for abank in input_locations[loc]
                    if re.match(self.getProp("KillInputBanksBefore"), abank)
                ]
                if not len(killBanks):
                    continue
                loc = _replaceWrap(loc)
                bk = bankKiller(
                    ("kill_" + loc.replace("/", "_") + "_Before").replace(
                        "__", "_"))
                killBefore.append(bk)
                bk.RawEventLocations = [loc]
                bk.BankTypes = killBanks

        ##################################
        # The part which does the juggling
        ##################################
        if iv != ov:
            ######################################
            # Stage 2: Check options
            ######################################
            #if a bank is needed to be added to an existing location, I can't do that.
            for loc in input_locations:
                if loc in output_locations:
                    for abank in output_locations[loc]:
                        if abank not in input_locations[loc]:
                            print "# WARNING, don't know how to add new bank " + abank + " to existing location " + loc + " ...skipping..."
                            output_locations[loc].remove(abank)
            #if banks need to be juggled, tell me how to do it, sequencer or DoD
            if not (self.getProp("DataOnDemand")
                    or self.isPropertySet("Sequencer")):
                raise AttributeError(
                    "You have asked for some juggling, but not told me where to put the algorithms. Set either DataOnDemand or pass a Sequencer"
                )
            #if banks need to be juggled, tell me how to do it, sequencer or DoD
            if self.getProp("DataOnDemand") and self.isPropertySet(
                    "Sequencer"):
                raise AttributeError(
                    "You asked for DoD and also gave a sequencer, I can't do both at the same time"
                )

            #if KillBanks or KillNodes... has been requested, I can't use DoD, it's unsafe. I don't know what's "before" and "after"
            if self.getProp("DataOnDemand") and (
                    self.getProp("KillExtraNodes")
                    or self.isPropertySet("KillInputBanksBefore")
                    or self.isPropertySet("KillInputBanksAfter")
                    or self.getProp("KillExtraBanks")):
                raise AttributeError(
                    "You have asked for some killing of banks, and asked for DoD, which is not a safe way to run. Either cope with the extra banks, or use a sequencer instead of DoD"
                )
            if self.getProp("KillExtraDirectories"
                            ) and not self.getProp("KillExtraNodes"):
                raise AttributeError(
                    "In order to kill extra directories, you must also be killing the extra nodes (raw events)"
                )
            #raise import error if you don't have the correct requirements
            from Configurables import RawEventMapCombiner, EventNodeKiller, bankKiller

            ###############################################
            # Stage 3: Recombine banks from given locations
            ###############################################

            #for each new location, add a RawEventMapCombiner to the DoD or to the sequencer
            loc_to_alg_dict = {}
            for loc in output_locations:
                if loc not in input_locations:
                    #if none of the banks are available, skip
                    if len([
                            abank for abank in output_locations[loc]
                            if abank in locs[iv]
                    ]) == 0:
                        print "#WARNING, nowhere to copy any banks for " + loc + " from, skipping"
                        continue
                    wloc = _replaceWrap(loc)
                    loc_to_alg_dict[wloc] = RawEventMapCombiner(
                        ("create_" + wloc.replace("/", "_")).replace(
                            "__", "_").rstrip("_"))
                    loc_to_alg_dict[wloc].OutputRawEventLocation = wloc
                    loc_to_alg_dict[wloc].RawBanksToCopy = {}

                    added_locations.append(wloc)

                    for abank in output_locations[loc]:
                        if abank not in locs[iv]:
                            print "#WARNING, nowhere to copy " + abank + " from, skipping"
                            continue
                        loc_to_alg_dict[wloc].RawBanksToCopy[
                            abank] = WhereBest(abank, iv, locs, rec)

            ###############################################
            # Stage 4: Clean up, kill after if requested
            ###############################################

            killAfter = []
            if self.isPropertySet("KillInputBanksAfter") or self.getProp(
                    "KillExtraBanks"):
                import re
                for loc in input_locations:
                    #see if this location has banks to kill
                    killBanks = []
                    if self.isPropertySet("KillInputBanksAfter"):
                        killBanks += [
                            abank
                            for abank in input_locations[loc] if re.match(
                                self.getProp("KillInputBanksAfter"), abank)
                        ]
                    if self.getProp("KillExtraBanks"):
                        killBanks += [
                            abank for abank in input_locations[loc]
                            if (loc in output_locations
                                and abank not in output_locations[loc])
                        ]
                    if not len(killBanks):
                        continue
                    loc = _replaceWrap(loc)
                    bk = bankKiller(
                        ("kill_" + loc.replace("/", "_") + "_After").replace(
                            "__", "_"))
                    killAfter.append(bk)
                    bk.RawEventLocations = [loc]
                    bk.BankTypes = killBanks

            #for each missing location, kill that location?
            if self.getProp("KillExtraNodes"):
                if len([
                        loc for loc in input_locations
                        if loc not in output_locations
                ]) > 0:
                    enk = EventNodeKiller("KillRawEventNodes")
                    enk.Nodes = []
                    killAfter.append(enk)
                    for loc in input_locations:
                        if loc not in output_locations:
                            enk.Nodes.append(_replaceWrap(loc))
                            if self.getProp("KillExtraDirectories"):
                                dloc = loc.replace("/RawEvent", "")
                                flags = [
                                    o.startswith(dloc)
                                    for o in output_locations
                                ]
                                if (True not in flags) and (dloc
                                                            not in enk.Nodes):
                                    enk.Nodes.append(_replaceWrap(dloc))

        elif self.isPropertySet("KillInputBanksAfter") or self.getProp(
                "KillExtraNodes") or self.isPropertySet("KillExtraBanks"):
            raise AttributeError(
                "You've asked to kill something from the input *after* copying, but you aren't actually doing any copying. Please kill them yourself without this configurable, or use KillInputBanksBefore!"
            )

        ###############################################
        # Stage 5: Add to sequence or DoD
        ###############################################
        if self.getProp("DataOnDemand"):
            if len(loc_to_alg_dict):
                from Configurables import DataOnDemandSvc
                ApplicationMgr().ExtSvc = ["DataOnDemandSvc"] + [
                    svc for svc in ApplicationMgr().ExtSvc
                    if svc is not "DataOnDemandSvc"
                ]
                for loc in loc_to_alg_dict:
                    DataOnDemandSvc().AlgMap[loc] = loc_to_alg_dict[loc]
        else:
            for alg in killBefore:
                self.getProp("Sequencer").Members.append(alg)
            for loc in loc_to_alg_dict:
                self.getProp("Sequencer").Members.append(loc_to_alg_dict[loc])
            for alg in killAfter:
                self.getProp("Sequencer").Members.append(alg)

        ###############################################
        # Stage 6: now handle the writers if appended
        ###############################################
        if self.isPropertySet("WriterOptItemList"):
            self.getProp("WriterOptItemList").OptItemList += self.__opWrap__(
                output_locations.keys())
        if self.isPropertySet("WriterItemList"):
            self.getProp("WriterItemList").ItemList += self.__opWrap__(
                output_locations.keys())
예제 #9
0
if ics("WriteAsOptItems").OptItemList != os("WriteAsItems").ItemList or ics(
        "WriteAsOptItems").OptItemList != [
            '/Event/Foo#1', '/Event/Bar#1', '/Event/SpamAndEggs#1',
            '/Event/FooBar/Null#1'
        ]:
    print ics("WriteAsOptItems").OptItemList, os("WriteAsItems").ItemList
    raise ValueError("Output locations are wrong")

if RawEventMapCombiner("create_Bar").RawBanksToCopy != {
        'Bank_D': 'Foo/Bar',
        'Bank_B': 'FooBar'
} or RawEventMapCombiner("create_Bar").OutputRawEventLocation != "/Bar":
    print RawEventMapCombiner(
        "create_Bar").RawBanksToCopy, RawEventMapCombiner(
            "create_Bar").OutputRawEventLocation
    raise ValueError("Unexpected raw bank locations")

if EventNodeKiller("KillRawEventNodes").Nodes != ['Foo/Bar', 'Spam', 'FooBar']:
    print EventNodeKiller("KillRawEventNodes").Nodes
    raise AttributeError("EventNodeKiler misconfigured")

if [(bankKiller(name).RawEventLocations, bankKiller(name).BankTypes)
        for name in ["kill_SpamAndEggs_After", "kill_FooBar_After"]
    ] != [(['/SpamAndEggs'], ['Bank_G']), (['FooBar'], ['Bank_C'])]:
    print[(bankKiller(name).RawEventLocations, bankKiller(name).BankTypes)
          for name in ["kill_SpamAndEggs_After", "kill_FooBar_After"]]
    raise AttributeError("Kill Sequences misconfigured")

print "Pass"
예제 #10
0
def execute(evtMax, dataType, mag, **leftovers):
    
  from Configurables import Moore
  from Configurables import L0MuonAlg, LoKiSvc
  from Configurables import L0Conf, CondDB, MessageSvc

  LoKiSvc().Welcome = False
  MessageSvc().Format = "% F%280W%S%7W%R%T %60W%M"

  #Configure L0 emulation
  #L0MuonAlg( "L0Muon" ).L0DUConfigProviderType = "L0DUConfigProvider"
  #Moore().L0=True
  #Moore().RunL0Emulator=True
  #Moore().ForceSingleL0Configuration = False
  Moore().CheckOdin  = False
  #CondDB().IgnoreHeartBeat = True 
  
  Moore().EnableDataOnDemand = True
  #Moore().EnableRunChangeHandler = False
  Moore().EnableMonitoring = False

  # How are we configuring the trigger? TCK or settings? 
  #Moore().ThresholdSettings = 'TomsCharmHadronLines' 
  #Moore().ThresholdSettings = 'Physics_September2012' 
  Moore().UseTCK = True
  Moore().InitialTCK = '0x99990000'
  #Moore().InitialTCK = '0x00a10045'                        #Change me to the TCK you want to use
  #Moore().WriterRequires=['HltDecsionSequence']            #What sequence must pass for the events to be written out? 
  Moore().WriterRequires=[] 
  Moore().UseDBSnapshot   = False
  #Moore().EnableRunChangeHandler = False
  #Moore().Verbose = True
  Moore().EvtMax = evtMax
  Moore().outputFile  = 'Demu.lsdata.dst'
  #Moore().Split  = 'Hlt1Hlt2'

  #Moore().RootInTES = '/Event/lsdata/Phys/dst_FilterSel'
  
  
  from Configurables import ConfigTarFileAccessSvc
  ConfigTarFileAccessSvc().File='config.tar'
  Moore().TCKData='./'
  #Moore().TCKData='/afs/cern.ch/user/t/tbird/cmtuser/Moore_v20r4/TCKData'
  
  #Moore().generateConfig = True
  #Moore().configLabel = 'D2emu like-sign enabled TCK'
  #Moore().TCKData = '/afs/cern.ch/user/t/tbird/cmtuser/Moore_v20r4/TCKData'

  if dataType == "data2012":
    Moore().DataType = "2012"
    Moore().Simulation = False
    #Moore().DDDBtag = "dddb-20130111"
    #if mag == "up":
      #Moore().CondDBtag = "cond-20130114"
    #elif mag == "down":
      #Moore().CondDBtag = "cond-20130114"
  elif dataType == "data2011":
    Moore().DataType = "2011"
    Moore().Simulation = False
    #Moore().DDDBtag = "dddb-20130111"
    #if mag == "up":
      #Moore().CondDBtag = "cond-20130114"
    #elif mag == "down":
      #Moore().CondDBtag = "cond-20130114"

  from Configurables import bankKiller
  ### Since Moore was already run in production for MC10, kill the resulting
  ### rawbanks.
  ##bk = bankKiller( "KillHltBanks", BankTypes = [ "HltRoutingBits", "HltSelReports", "HltVertexReports", "HltDecReports", "HltLumiSummary" ] )
  ##bk.RawEventLocations = ["Trigger/RawEvent","Other/RawEvent","Calo/RawEvent","Muon/RawEvent","Rich/RawEvent"]
  ##from Gaudi.Configuration import appendPostConfigAction
  ##from Configurables import ApplicationMgr
  ##appendPostConfigAction( lambda : ApplicationMgr().TopAlg.insert( 0, bk ) )
  
  
  #storeExp = StoreExplorerAlg("StoreExplorer1")
  #storeExp.Load = 1
  #storeExp.PrintFreq = 5.0
  
  #ApplicationMgr().TopAlg.insert( 0, storeExp )
  
  from Configurables import RawEventMapCombiner, RawEventSimpleCombiner, DataOnDemandSvc
  myCombiner=RawEventSimpleCombiner("resurectRawEvent")
  myCombiner.InputRawEventLocations=[
      "Trigger/RawEvent",
      "Other/RawEvent",
      "Rich/RawEvent",
      "Muon/RawEvent",
      "Calo/RawEvent"#,
      ]
  ApplicationMgr().TopAlg.insert( 0, myCombiner )
  
  bk = bankKiller( "KillHltBanks", BankTypes = [ "HltRoutingBits", "HltSelReports", "HltVertexReports", "HltDecReports", "HltLumiSummary" ] )
  bk.RawEventLocations = ['DAQ/RawEvent']
  #appendPostConfigAction( lambda : ApplicationMgr().TopAlg.insert( 0, bk ) )
  ApplicationMgr().TopAlg.insert( 1, bk )

  #from Configurables import RecombineRawEvent
  #RecombineRawEvent()
  
  #storeExp2 = StoreExplorerAlg("StoreExplorer2")
  #storeExp2.Load = 1
  #storeExp2.PrintFreq = 5.0
  
  #ApplicationMgr().TopAlg.insert( 3, storeExp2 )
  
  enk = EventNodeKiller()
  enk.Nodes=[
      "Trigger/RawEvent",
      "Other/RawEvent",
      "Rich/RawEvent",
      "Muon/RawEvent",
      "Calo/RawEvent"]
  ApplicationMgr().TopAlg.insert( 2, enk )
  
  #storeExp3 = StoreExplorerAlg("StoreExplorer3")
  #storeExp3.Load = 1
  #storeExp3.PrintFreq = 5.0
  
  #ApplicationMgr().TopAlg.insert( 5, storeExp3 )
  
  
  
  
  #ApplicationMgr().ExtSvc=["DataOnDemandSvc"]+[svc for svc in ApplicationMgr().ExtSvc if svc is not "DataOnDemandSvc"]
  #DataOnDemandSvc().AlgMap["DAQ/RawEvent"] = myCombiner
  #DataOnDemandSvc().NodeMap[ "DAQ" ] = "DataObject"
  
  
  #ApplicationMgr().TopAlg+=GaudiSequencer("Spam") 
  
  #Writer=InputCopyStream("MyStream") 
  #IOHelper().outStream("Demu.lsdata.dst",writer=Writer) 
    
  #RawEventJuggler().Input="Pit" 
  #RawEventJuggler().Output="Stripping20"
  #RawEventJuggler().Sequencer=GaudiSequencer("Spam") 
  #RawEventJuggler().KillExtraBanks=True 
  #RawEventJuggler().KillExtraNodes=True 
  #RawEventJuggler().WriterOptItemList=Writer 
  
  #from Configurables import ReadHltReport  
  #Moore().appendToMainSequence( [ ReadHltReport() ] )

  InputCopyStream("Writer").ItemList.append("/Event/DAQ/RawEvent#1")

  from Configurables import TimingAuditor, SequencerTimerTool
  TimingAuditor('TIMER').addTool(SequencerTimerTool, name="TIMER")
  TimingAuditor('TIMER').TIMER.NameSize=80
예제 #11
0
    def _defineL0Sequencer(self):
        """
        Fill the sequencer given to the L0Sequencer attribute.
        The filling of the sequencer is done according to the L0Conf properties. 
        """

        # Set TCK
        self._setAlgTCK(emulateL0DU())
        self._setAlgTCK(emulateL0Muon())

        seq = self.getProp("L0Sequencer")

        if self.getProp("ReplaceL0BanksWithEmulated"):
            replacebanksSeq = GaudiSequencer("L0DUBankSwap")
            from Configurables import bankKiller
            removebanks = bankKiller("RemoveL0Banks")
            removebanks.BankTypes = [
                "L0DU", "L0Calo", "L0Muon", "L0MuonProcCand", "L0MuonProcData"
            ]
            replacebanksSeq.Members += [
                removebanks,
                self.l0emulatorSeq(writeBanks=True, writeOnTes=False)
            ]

            seq.Members += [replacebanksSeq]
            log.warning(
                "\n  \t** EXISTING L0 BANKS WILL BE REMOVED AND REPLACED BY EMULATED BANKS **\n\n"
            )

        if self.getProp("SimulateL0"):
            l0simulationSeq = GaudiSequencer("L0SimulationSeq")

            if self.getProp("FullPileUpSimulation"):
                # Pus specific processing : fill raw from MC
                from Configurables import PuVetoFillRawBuffer
                l0simulationSeq.Members += [PuVetoFillRawBuffer()]

            # Run emulators (L0Calo + L0Muon + PUVeto + L0DU)
            l0simulationSeq.Members += [
                self.l0emulatorSeq(writeBanks=True, writeOnTes=False)
            ]

            seq.Members += [l0simulationSeq]

        if self.getProp("DecodeL0DU"):
            seq.Members += [decodeL0DU()]

        if self.getProp("DecodeL0"):
            seq.Members += [self.l0decodingSeq(writeOnTes=True)]

        if self.getProp("EmulateL0"):
            if not self.isPropertySet("L0EmulatorContext"):
                self.setProp("L0EmulatorContext", "Emulator")
            seq.Members += [
                self.l0emulatorSeq(writeBanks=False, writeOnTes=True)
            ]

        if self.getProp("ReplayL0DU"):
            # Decode the l0du to produce the processor data (input to simulation)
            decoding = decodeL0DU()
            decoding.WriteProcData = True
            decoding.WriteOnTES = False  # Do not write the L0DU report
            decoding.ProcessorDataLocation = "Trig/L0/L0DUData"
            # Emulate the l0du from the processor data
            emulation = emulateL0DU()
            emulation.ProcessorDataLocations = ["Trig/L0/L0DUData"]
            emulation.WriteBanks = False
            emulation.WriteOnTES = True  # Write the L0DU report
            # Add decoder and emulator to the main sequence
            seq.Members += [decoding, emulation]

        if self.getProp("MonitorL0"):
            seq.Members += [self.l0monitoringSeq()]

        if self.getProp("FilterL0FromRaw"):
            from Configurables import L0Filter
            seq.Members += [decodeL0DU(), L0Filter()]

        if self.getProp("FilterL0"):
            from Configurables import L0Filter
            seq.Members += [L0Filter()]
예제 #12
0
RawEventJuggler().KillInputBanksBefore=".*_C"
RawEventJuggler().KillInputBanksAfter=".*_C"
RawEventJuggler().WriterOptItemList=ics("WriteAsOptItems")
RawEventJuggler().WriterItemList=os("WriteAsItems")
RawEventJuggler().TCK="Null"
RawEventJuggler().GenericReplacePatterns={"#BAR#":"Bar"}
RawEventJuggler().__apply_configuration__()

if [ent.getFullName() for ent in GS("JuggleRawEvent").Members] != ['bankKiller/kill_FooBar_Before', 'RawEventMapCombiner/create_Foo', 'RawEventMapCombiner/create_Bar', 'RawEventMapCombiner/create_FooBar_Null', 'bankKiller/kill_SpamAndEggs_After', 'bankKiller/kill_FooBar_After', 'EventNodeKiller/KillRawEventNodes']:
    print [ent.getFullName() for ent in GS("JuggleRawEvent").Members]
    raise ValueError("Configuration order or members are wrong")

if ics("WriteAsOptItems").OptItemList!=os("WriteAsItems").ItemList or ics("WriteAsOptItems").OptItemList!=['/Event/Foo#1', '/Event/Bar#1', '/Event/SpamAndEggs#1', '/Event/FooBar/Null#1']:
    print ics("WriteAsOptItems").OptItemList, os("WriteAsItems").ItemList
    raise ValueError("Output locations are wrong")

if RawEventMapCombiner("create_Bar").RawBanksToCopy!={'Bank_D': 'Foo/Bar', 'Bank_B': 'FooBar'} or RawEventMapCombiner("create_Bar").OutputRawEventLocation!="/Bar":
    print RawEventMapCombiner("create_Bar").RawBanksToCopy, RawEventMapCombiner("create_Bar").OutputRawEventLocation
    raise ValueError("Unexpected raw bank locations")

if EventNodeKiller("KillRawEventNodes").Nodes!=['Foo/Bar', 'Spam', 'FooBar']:
    print EventNodeKiller("KillRawEventNodes").Nodes
    raise AttributeError("EventNodeKiler misconfigured")

if [(bankKiller(name).RawEventLocations, bankKiller(name).BankTypes) for name in ["kill_SpamAndEggs_After","kill_FooBar_After"]]!=[(['/SpamAndEggs'], ['Bank_G']), (['FooBar'], ['Bank_C'])]:
    print [(bankKiller(name).RawEventLocations, bankKiller(name).BankTypes) for name in ["kill_SpamAndEggs_After","kill_FooBar_After"]]
    raise AttributeError("Kill Sequences misconfigured")

print "Pass"