Пример #1
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
Пример #2
0
LHCbApp().CondDBtag = 'cond-20141002'

#--- determine application to run
from Configurables import LumiAlgsConf, DumpFSR
from LumiAlgs.LumiIntegratorConf import LumiIntegratorConf

#-- cannot test this in REC due to dependence on PropertyConfigSvc (TCK)
## LumiIntegratorConf().UseOnline = False
LumiIntegratorConf().UseOnline = True

# clock service for CondDB
from Configurables import EventClockSvc
EventClockSvc().EventTimeDecoder = "OdinTimeDecoder"

# standard sequence from configurable
LumiAlgsConf().LumiSequencer = GaudiSequencer("LumiSeq", ShortCircuit=False)
LumiAlgsConf().InputType = 'DST'
LumiAlgsConf().OutputLevel = INFO

# standard sequence from configurable
LumiIntegratorConf().LumiSequencer = GaudiSequencer("LumiIntSeq",
                                                    ShortCircuit=False)

#-- main
ApplicationMgr(
    TopAlg=[
        GaudiSequencer("LumiSeq"),
        GaudiSequencer("LumiIntSeq"),
        #DumpFSR()
    ],
    HistogramPersistency='NONE')
Пример #3
0
appMgr.ExtSvc += [ ntSvc ]

from Configurables import ( LHCbApp, PhysConf, AnalysisConf,
                            DstConf, LumiAlgsConf, DDDBConf )

#LHCbApp().DDDBtag   = "dddb-20150724"
#LHCbApp().CondDBtag = "cond-20150805"

# Can be enabled for next full stack release
PhysConf().OutputLevel     = appMgr.OutputLevel
#AnalysisConf().OutputLevel = appMgr.OutputLevel

datatype =  "2015"
PhysConf().DataType      = datatype
AnalysisConf().DataType  = datatype
LumiAlgsConf().DataType  = datatype
DDDBConf().DataType      = datatype

inputType = "DST"
LumiAlgsConf().InputType = inputType
PhysConf().InputType     = inputType

unPack = ["Reconstruction"]
PhysConf().EnableUnpack = unPack
DstConf().EnableUnpack  = unPack

lumiSeq = GaudiSequencer("LumiSeq")
LumiAlgsConf().LumiSequencer = lumiSeq

appMgr.TopAlg += [ PhysConf().initSequence(),
                   AnalysisConf().initSequence(),
Пример #4
0
    def configureSequences(self, withMC, handleLumi, vetoHltErrorEvents):
        brunelSeq = GaudiSequencer("BrunelSequencer")
        brunelSeq.Context = self.getProp("Context")
        ApplicationMgr().TopAlg += [ brunelSeq ]
        brunelSeq.Members += [ "ProcessPhase/Init" ]
        physicsSeq = GaudiSequencer( "PhysicsSeq" )

        # Treatment of luminosity events
        if handleLumi:
            lumiSeq = GaudiSequencer("LumiSeq")

            # Prepare the FSR
            if self.getProp("WriteFSR"):
                self.setOtherProps(LumiAlgsConf(),["Context","DataType","InputType","Simulation"])
                lumiCounters = GaudiSequencer("LumiCounters")
                lumiSeq.Members += [ lumiCounters ]
                LumiAlgsConf().LumiSequencer = lumiCounters

            # Trigger masks changed in 2016, see LHCBPS-1486
            if self.getProp( "DataType" ) in self.Run1DataTypes or self.getProp( "DataType" ) in [ "2015" ]:
                physFilterRequireMask = [ 0x0, 0x4, 0x0 ]
                lumiFilterRequireMask = [ 0x0, 0x2, 0x0 ]
            else:
                physFilterRequireMask = [ 0x0, 0x0, 0x80000000 ]
                lumiFilterRequireMask = [ 0x0, 0x0, 0x40000000 ]

            # Filter out Lumi only triggers from further processing, but still write to output
            from Configurables import HltRoutingBitsFilter
            physFilter = HltRoutingBitsFilter( "PhysFilter", RequireMask = physFilterRequireMask )
            physicsSeq.Members += [ physFilter ]
            lumiFilter = HltRoutingBitsFilter( "LumiFilter", RequireMask = lumiFilterRequireMask )
            lumiSeq.Members += [ lumiFilter, physFilter ]
            lumiSeq.ModeOR = True

            # Sequence to be executed if physics sequence not called (nano events)
            notPhysSeq = GaudiSequencer("NotPhysicsSeq")
            notPhysSeq.ModeOR = True
            notPhysSeq.Members = [ physFilter ]

            brunelSeq.Members += [ lumiSeq, notPhysSeq ]
            
        # Hlt decreports decoders
        from DAQSys.Decoders import DecoderDB
        from Configurables import LoKi__HDRFilter, AddToProcStatus
        hltStages = ('Hlt1',) if self.getProp('OnlineMode') else ('Hlt1', 'Hlt2')
        hltDecoders = []
        hltErrorFilters = []
        hltFilters = []
        for stage in hltStages:
            decoder = DecoderDB["HltDecReportsDecoder/%sDecReportsDecoder" % stage].setup()
            hltDecoders += [decoder]            # decode DecReports
            # identifies events that are not of type ErrorEvent
            errorFilterCode = "HLT_PASS_RE('%s(?!ErrorEvent).*Decision')" % stage
            hltErrorFilter = LoKi__HDRFilter('%sErrorFilter' % stage, Code = errorFilterCode, Location = decoder.OutputHltDecReportsLocation)
            hltErrorFilters += [decoder, hltErrorFilter] # and apply filter
            
            filterCode = self.getProp(stage + "FilterCode")
            if filterCode:
                hltFilter = LoKi__HDRFilter('%sFilter' % stage, Code = filterCode, Location = decoder.OutputHltDecReportsLocation)
                hltFilters += [decoder, hltFilter]

        # Do not process events flagged as error in Hlt, but still write procstatus
        if vetoHltErrorEvents:
            """
            By Patrick Koppenburg, 16/6/2011
            """
            # Make a sequence that selects HltErrorEvents
            hltErrorFilterSeq = GaudiSequencer("HltErrorFilterSeq")
            if handleLumi: hltErrorFilterSeq.Members = [ physFilter ]       # protect against lumi (that doesn't have decreports)
            hltErrorFilterSeq.Members += hltErrorFilters

            # Sequence to be executed if HltErrorFilter is failing to set ProcStatus
            hltErrorSeq = GaudiSequencer("HltErrorSeq", ModeOR = True, ShortCircuit = True) # anti-logic
            addToProc = AddToProcStatus("HltErrorProc", Reason = "HltError", Subsystem = "Hlt") # write a procstatus
            hltErrorSeq.Members += [hltErrorFilterSeq, addToProc]      # only run if hltErrorFilterSeq fails
            brunelSeq.Members   += [hltErrorSeq]                       # add this sequece to Brunel _before_ physseq
            physicsSeq.Members  += [hltErrorFilterSeq]                 # take good events in physics seq

        # Filter events based on HLT decisions if filters were specified
        if hltFilters:
            hltFilterSeq = GaudiSequencer("HltFilterSeq")
            hltFilterSeq.Members = hltFilters
            physicsSeq.Members += [hltFilterSeq]

        # Convert Calo ReadoutStatus to ProcStatus
        caloBanks=GaudiSequencer("CaloBanksHandler")
        caloDetectors = [det for det in ['Spd','Prs','Ecal','Hcal'] if det in self.getProp("Detectors")]
        CaloDigitConf(ReadoutStatusConvert=True,Sequence=caloBanks,Detectors=caloDetectors)
        physicsSeq.Members += [caloBanks]
        
        # Decode L0 (and HLT if not already done)
        trgSeq = GaudiSequencer("DecodeTriggerSeq")
        l0TrgSeq = GaudiSequencer("L0TriggerSeq")
        if self.getProp( "DataType" ) not in [ "2008", "2009" ]:
            trgSeq.Members += hltDecoders
        trgSeq.Members += [ l0TrgSeq ]
        physicsSeq.Members += [ trgSeq ]
        L0Conf().L0Sequencer = l0TrgSeq
        if self.getProp("RecL0Only"):
            # Setup L0 filtering if requested, runs L0 before Reco
            L0Conf().FilterL0FromRaw = True
            self.setOtherProps( L0Conf(), ["DataType"] )
        else:
            L0Conf().DecodeL0DU = True

        if not self.isPropertySet("MainSequence"):
            if withMC:
                mainSeq = self.DefaultMCSequence
            else:
                mainSeq = self.DefaultSequence
            self.MainSequence = mainSeq
        physicsSeq.Members += self.getProp("MainSequence")
        from Configurables import ProcessPhase
        outputPhase = ProcessPhase("Output")
        brunelSeq.Members  += [ physicsSeq ]
        brunelSeq.Members  += [ outputPhase ]
Пример #5
0
DaVinci().CondDBtag = 'cond-20141002'
DaVinci().DQFLAGStag = 'dq-20140822'

ApplicationMgr().AppName = 'LumiTool'
ApplicationMgr().OutputLevel = INFO
ApplicationMgr().HistogramPersistency = 'None'

IOHelper('ROOT').inputFiles([
    'root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/swtest/2011_smallfiles_EW/00010654_00000049_1.radiative.dst',
    'root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/swtest/2011_smallfiles_EW/00010352_00000014_1.radiative.dst',
    'root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/swtest/2011_smallfiles_EW/00010352_00000002_1.radiative.dst',
])

# more verbose lumi output
from Configurables import LumiAlgsConf
LumiAlgsConf().OutputLevel = INFO


def action():
    from Configurables import GetIntegratedLuminosity, LumiIntegrateFSR
    alg = GetIntegratedLuminosity('GetIntegratedLuminosity')
    alg.WriteCountersDetails = False
    alg.OutputLevel = INFO
    LumiIntegrateFSR('IntegrateBeamCrossing').OutputLevel = INFO
    LumiIntegrateFSR('IntegrateBeamCrossing').AccumulateMu = True
    # LumiIntegrateFSR('IntegrateBeamCrossing').MuKeyName = 'PoissonPV3D'


appendPostConfigAction(action)

appMgr = GaudiPython.AppMgr(outputlevel=INFO)
Пример #6
0
    def _configureForOnline(self):
        #
        DecodeRawEvent().DataOnDemand=False
        writer=InputCopyStream( self.writerName )
        DstConf().setProp("SplitRawEventOutput", self.getProp("RawFormatVersion"))
        
        # Use RawEventJuggler to create the Turbo stream raw event format
        tck = "0x409f0045" # DUMMY
        TurboBanksSeq=GaudiSequencer("TurboBanksSeq")
        RawEventJuggler().TCK=tck
        RawEventJuggler().Input="Moore"
        RawEventJuggler().Output=self.getProp("RawFormatVersion")
        RawEventJuggler().Sequencer=TurboBanksSeq
        RawEventJuggler().WriterOptItemList=writer
        RawEventJuggler().KillExtraNodes=True
        RawEventJuggler().KillExtraBanks=True
        RawEventJuggler().KillExtraDirectories = True
        self.teslaSeq.Members += [TurboBanksSeq]
        
        # Begin Lumi configuration
        lumiSeq = GaudiSequencer("LumiSeq")
        #
        # Add ODIN decoder to LumiSeq ***
        from DAQSys.Decoders import DecoderDB
        CreateODIN=DecoderDB["createODIN"].setup()
        #********************************
        #
        # Main algorithm config
        lumiCounters = GaudiSequencer("LumiCounters")
        lumiCounters.Members+=[CreateODIN]
        lumiSeq.Members += [ lumiCounters ]
        LumiAlgsConf().LumiSequencer = lumiCounters
        LumiAlgsConf().OutputLevel = self.getProp('OutputLevel')
        LumiAlgsConf().InputType = "MDF"
        #
        # Filter out Lumi only triggers from further processing, but still write to output
        # Trigger masks changed in 2016, see LHCBPS-1486
        physFilterRequireMask = []
        lumiFilterRequireMask = []
        if self.getProp( "DataType" ) in ["2012","2015"]: # 2012 needed for nightlies tests.
            physFilterRequireMask = [ 0x0, 0x4, 0x0 ]
            lumiFilterRequireMask = [ 0x0, 0x2, 0x0 ]
        else:
            physFilterRequireMask = [ 0x0, 0x0, 0x80000000 ]
            lumiFilterRequireMask = [ 0x0, 0x0, 0x40000000 ]
        from Configurables import HltRoutingBitsFilter
        physFilter = HltRoutingBitsFilter( "PhysFilter", RequireMask = physFilterRequireMask )
        lumiFilter = HltRoutingBitsFilter( "LumiFilter", RequireMask = lumiFilterRequireMask )

        lumiSeq.Members += [ lumiFilter, physFilter ]
        lumiSeq.ModeOR = True
        #
        from Configurables import RecordStream
        FSRWriter = RecordStream( "FSROutputStreamDstWriter")
        FSRWriter.OutputLevel = INFO
        #
        # Sequence to be executed if physics sequence not called (nano events)
        notPhysSeq = GaudiSequencer("NotPhysicsSeq")
        notPhysSeq.ModeOR = True
        notPhysSeq.Members = [ physFilter ]
        writer.AcceptAlgs += ["LumiSeq","NotPhysicsSeq"]
        self.teslaSeq.Members += [lumiSeq, notPhysSeq]
Пример #7
0
IOHelper().setupServices()

##############################
#fill summary every event
##############################

from Configurables import XMLSummary
XMLSummary().XMLSummary = "summary.xml"
from Configurables import XMLSummarySvc
XMLSummarySvc("CounterSummarySvc").UpdateFreq = 1

##############################
#Run the merger
##############################

from Configurables import GaudiSequencer
from Configurables import LumiAlgsConf
LumiSeq = GaudiSequencer("LumiSeq")
LumiAlgsConf().LumiSequencer = LumiSeq
LumiAlgsConf().MergeFSR = True
LumiAlgsConf().InputType = "MDST"
ApplicationMgr().TopAlg += [LumiSeq]

##############################################
#Debug printout, lists all cleaned directories
##############################################

from Configurables import FSRCleaner
FSRCleaner().OutputLevel = DEBUG
#FSRCleaner().Enable=False