Ejemplo n.º 1
0
###############################################################################
# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      #
#                                                                             #
# This software is distributed under the terms of the GNU General Public      #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
#                                                                             #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization  #
# or submit itself to any jurisdiction.                                       #
###############################################################################
from DAQSys.Decoders import DecoderDB
l0du = DecoderDB["L0DUDecoder/L0DUFromRaw"]
l0du.Properties["SpammySpamSpam"] = False

wasset = []
for k, d in DecoderDB.iteritems():
    if d == l0du:
        continue
    if "SpammySpamSpam" in d.Properties:
        wasset.append(k)

if len(wasset):
    raise KeyError("Setting a property also accidentally set a property for" +
                   wasset.__str__())

print "Pass"
Ejemplo n.º 2
0
    def _outputLevel(self):
        """
        Set the print out of various tools, services, all algorithms, and properties of all things like algorithms
        Sensitive to the OutputLevel of Moore

        a) configure things independently of level
        b) configure things depending on level
           - ThresholdSettings via postConfigActions
           - TCKs via transforms

        defaults are now WARNING printouts only, so I need to handle the case the user wishes to switch back if a TCK has been generated with a warning

        """
        #firstly explicitly configure things not seen by TCK
        #firstly configure things which are level-independent

        # Usual output levels for services
        from Configurables import XmlParserSvc
        XmlParserSvc().OutputLevel = WARNING
        ApplicationMgr(
        ).OutputLevel = INFO  #I still want the Application Manager Finalized Sucessfully printout

        # Print algorithm name with 40 characters
        if not self.getProp("RunOnline"):
            if not MessageSvc().isPropertySet("Format"):
                MessageSvc().Format = '% F%40W%S%7W%R%T %0W%M'

        #this should be OK to do here...
        from Funcs import _minSetFileTypes

        #postconfig away common warnings
        def suppresswarningifneeded():
            #histogram warning isn't needed if I didn't want histograms
            from Configurables import RootHistCnv__PersSvc
            if RootHistCnv__PersSvc().getProp(
                    "OutputFile") == "UndefinedROOTOutputFileName" or not len(
                        RootHistCnv__PersSvc().getProp("OutputFile")):
                RootHistCnv__PersSvc().OutputEnabled = False
            if HistogramPersistencySvc().getProp(
                    "OutputFile") == '' or not HistogramPersistencySvc(
                    ).isPropertySet("OutputFile"):
                HistogramPersistencySvc().Warnings = False
            #error from IODataManager is pointless when I have MDFs
            from Funcs import _minSetFileTypes
            if Moore().getProp("RunOnline") or _minSetFileTypes() in [
                    "MDF", "RAW"
            ]:
                from Configurables import IODataManager
                IODataManager().DisablePFNWarning = True

        appendPostConfigAction(suppresswarningifneeded)

        #then configure things that depend on the level
        level = self.getProp("OutputLevel")
        from Configurables import LHCbSequencerTimerTool, SequencerTimerTool
        if level >= INFO: LHCbSequencerTimerTool().OutputLevel = WARNING
        if level >= INFO: SequencerTimerTool().OutputLevel = WARNING

        if level > DEBUG:
            from Configurables import LoKi__DistanceCalculator
            LoKi__DistanceCalculator().MaxPrints = 0
        if level > VERBOSE:
            from Configurables import LoKiSvc
            LoKiSvc().Welcome = False

        from Configurables import Hlt__Service
        if not Hlt__Service().isPropertySet('Pedantic'):
            Hlt__Service().Pedantic = (level < DEBUG)
        ###############################################################
        #if level is less than INFO, I don't need to edit anything else
        #it's up to the users to do that themselves!
        ###############################################################
        if level < INFO:
            return

        if level > INFO:
            if not self.getProp("RunOnline"):
                MessageSvc().OutputLevel = level
            ToolSvc().OutputLevel = level

        if level > INFO and hasattr(
                self, "EnableTimer") and self.getProp("EnableTimer") and type(
                    self.getProp("EnableTimer")) is not str:
            print "# WARNING: Timing table is too verbose for printing, consider outputting to a file instead please, Moore().EnableTimer='timing.csv', for example."

        #################################################
        # If the OutputLevel is set I need
        # Either a postConfigAction or a transform
        # to suppress the outputs properly
        #################################################

        #################################################
        # Running from thresholds, use post config action
        #################################################
        if not self.getProp("UseTCK") and level > INFO:
            #post config to really reset all the output to null
            from DAQSys.Decoders import DecoderDB
            from GaudiConf.Manipulations import recurseConfigurables, setPropertiesAndAddTools
            props = {}
            props["OutputLevel"] = level
            props["StatPrint"] = (level < WARNING)
            props["ErrorsPrint"] = (level < WARNING)
            props["PropertiesPrint"] = (level < WARNING)

            from DAQSys.Decoders import DecoderDB
            for k, v in DecoderDB.iteritems():
                for pk, pv in props.iteritems():
                    v.Properties[pk] = pv

            props["HistoCountersPrint"] = (level < WARNING)
            calo_tools = [
                "CaloECorrection/ECorrection",
                "CaloSCorrection/SCorrection",
                "CaloLCorrection/LCorrection",
                "CaloHypoEstimator",
                "CaloExtraDigits/SpdPrsExtraE",
                "CaloExtraDigits/SpdPrsExtraG",
                "CaloExtraDigits/SpdPrsExtraM",
                "CaloExtraDigits/SpdPrsExtraS",
                "CaloSelectCluster/PhotonCluster",
                "CaloSelectCluster/ElectronCluster",
                "CaloSelectChargedClusterWithSpd/ChargedClusterWithSpd",
                "CaloSelectClusterWithPrs/ClusterWithPrs",
                "CaloSelectNeutralClusterWithTracks/NeutralCluster",
                "CaloSelectNeutralClusterWithTracks/NotNeutralCluster",
                "CaloSelectorNOT/ChargedCluster",
                "CaloSelectNeutralClusterWithTracks/ChargedCluster.NeutralCluster",
            ]
            tools_per_type = {
                # turn off the calo tool finalize printout, there are *a lot* of tools here
                "CaloSinglePhotonAlg":
                calo_tools,
                "CaloElectronAlg":
                calo_tools,
                "CaloMergedPi0Alg":
                calo_tools,
                "NeutralProtoPAlg":
                calo_tools,
                # three extras for merged pi0
                "CaloMergedPi0Alg": [
                    "CaloCorrectionBase/ShowerProfile",
                    "CaloCorrectionBase/Pi0SCorrection",
                    "CaloCorrectionBase/Pi0LCorrection"
                ],
                # and one calo clustering
                "CellularAutomatonAlg": ["CaloClusterizationTool"],
            }
            func = partial(setPropertiesAndAddTools,
                           properties=props,
                           tools_per_type=tools_per_type,
                           force=True)

            # Instantiate a few public tools (members of the ToolService),
            # which means their output properties will also be set in the post config action
            from Configurables import LoKi__LifetimeFitter, CaloDigitFilterTool, CaloGetterTool, OTChannelMapTool, CaloClusterizationTool
            LoKi__LifetimeFitter("ToolSvc.lifetime")
            CaloDigitFilterTool("ToolSvc.FilterTool")
            CaloGetterTool("ToolSvc.CaloGetter")
            OTChannelMapTool("ToolSvc.OTChannelMapTool")
            CaloClusterizationTool("ToolSvc.CaloClusterizationTool")

            # visit_properties = ['Members', 'Filter0', 'Filter1', 'TopAlg']
            descend_properties = [
                'Members', 'Prescale', 'ODIN', 'L0DU', 'HLT', 'HLT1', 'HLT2',
                'Filter0', 'Filter1', 'Postscale'
            ]
            appendPostConfigAction(
                partial(recurseConfigurables,
                        func,
                        descend_properties=descend_properties,
                        descend_tools=True))

            #I still want to print "Application Manager Finalized Successfully"
            #and "End of event input reached" no matter what

            def AppMrgOP():
                if ApplicationMgr().getProp("OutputLevel") > INFO:
                    ApplicationMgr().OutputLevel = INFO
                if EventSelector().getProp("OutputLevel") > INFO:
                    EventSelector().OutputLevel = INFO

            appendPostConfigAction(AppMrgOP)

            def RestoreGenConfig():
                Moore().getConfigAccessSvc().OutputLevel = INFO
                from Configurables import HltGenConfig
                HltGenConfig().OutputLevel = INFO

            if self.getProp("generateConfig"):
                appendPostConfigAction(RestoreGenConfig)

            #################################################
            # Running from TCK define a similar transform
            #################################################
        elif self.getProp("UseTCK"):
            trans = {".*": {"OutputLevel": {"^.*$": str(level)}}}
            #turn certain things back on if INFO is set again...
            trans[".*"]["StatPrint"] = {"^.*$": str(level < WARNING)}
            trans[".*"]["ErrorsPrint"] = {"^.*$": str(level < WARNING)}
            trans[".*"]["PropertiesPrint"] = {"^.*$": str(level < WARNING)}
            trans[".*"]["HistoCountersPrint"] = {"^.*$": str(level < WARNING)}

            Funcs._mergeTransform(trans)

            #kill LoKi warnings
            set = 0
            if level < WARNING:
                set = 3
            trans = {
                ".*DistanceCalculator.*": {
                    "MaxPrints": {
                        "^.*$": str(set)
                    }
                }
            }
            Funcs._mergeTransform(trans)
            #kill one extra loki print in tool service
            from GaudiConf.Manipulations import recurseConfigurables, setPropertiesAndAddTools
            props = {}
            props["OutputLevel"] = level
            props["StatPrint"] = (level < WARNING)
            props["ErrorsPrint"] = (level < WARNING)
            props["PropertiesPrint"] = (level < WARNING)
            # postConfForAll(head=["LoKi::LifetimeFitter/ToolSvc.lifetime"],force=True,prop_value_dict=props)
            func = partial(setPropertiesAndAddTools,
                           properties=props,
                           force=True)
            appendPostConfigAction(
                partial(recurseConfigurables,
                        func,
                        head="LoKi::LifetimeFitter/ToolSvc.lifetime"))

            from Configurables import HltConfigSvc
            cfg = HltConfigSvc()
            #self-defeating warnings!
            cfg.OutputLevel = ERROR
Ejemplo n.º 3
0
from Gaudi.Configuration import *
from Configurables import DecodeRawEvent

from DAQSys.Decoders import DecoderDB

for i,v in DecoderDB.iteritems():
    v.Properties["OutputLevel"]=VERBOSE
    if "Hlt" in i and "ReportsDecoder" in i:
        v.Active=False
        #v.Inputs={"InputRawEventLocation":"DAQ/RawEvent"}
    for b in ["UT","FT","FTCluster","VP","VL"]:
        if b in v.Banks:
            v.Active=False

DecoderDB["MuonRec"].Active=False

DecodeRawEvent().OverrideInputs=999
from Configurables import GaudiSequencer
#DecodeRawEvent().Sequencer=GaudiSequencer("SPAM")

for i,v in DecoderDB.iteritems():
    if v.Active:
       GaudiSequencer("SPAM").Members.append(v.setup())

from Configurables import StoreExplorerAlg

StoreExplorerAlg().Load=True

ApplicationMgr().TopAlg=[GaudiSequencer("SPAM"),StoreExplorerAlg()]
Ejemplo n.º 4
0
from Gaudi.Configuration import *
from Configurables import DecodeRawEvent, LHCbApp
from Configurables import GaudiSequencer

LHCbApp()

mySeq = GaudiSequencer("Decoding")
mySeq.OutputLevel = VERBOSE
DecodeRawEvent().Sequencer = mySeq
ApplicationMgr().TopAlg = [mySeq]

from DAQSys.DecoderClass import decodersForBank
from DAQSys.Decoders import DecoderDB as ddb

#only calo banks
for k, v in ddb.iteritems():
    v.Active = False

flagged = []

for b in ["PrsE", "EcalE", "HcalE", "ODIN"]:
    for d in decodersForBank(ddb, b, ignoreActive=True, addRequired=True):
        flagged.append(d)

for k, v in ddb.iteritems():
    if v not in flagged:
        v.Active = False

#configure L0TCKs
importOptions('$L0TCK/L0DUConfig.opts')