Exemplo n.º 1
0
 def addtoService(self):
     """Attach seeds stored in RandomFlags.RandomSeedList to ATLAS random number sevice
     """
     from AthenaCommon.ConfigurableDb import getConfigurable
     rndmSvc = getConfigurable(
         jobproperties.RandomFlags.RandomSvc.get_Value())()
     logRandomFlags.info(
         "Adding random number seeds stored in RandomFlags.RandomSeedList to Random Number Service '"
         + rndmSvc.name() + "'")
     if jobproperties.RandomFlags.readSeedsFromFile.get_Value():
         rndmSvc.Seeds = []
         rndmSvc.ReadFromFile = True
         rndmSvc.FileToRead = jobproperties.RandomFlags.rndmSeedInputFile.get_Value(
         )
         logRandomFlags.warning(
             "Random seeds will be read from the file %s",
             jobproperties.RandomFlags.rndmSeedInputFile.get_Value())
     else:
         self.checkRndmSvc()
         rndmSvc.Seeds += self.get_Value()
     from GaudiKernel.Configurable import WARNING
     rndmSvc.OutputLevel = WARNING
     from AthenaCommon.AppMgr import ServiceMgr
     if not hasattr(ServiceMgr,
                    jobproperties.RandomFlags.RandomSvc.get_Value()):
         ServiceMgr += rndmSvc
     return
Exemplo n.º 2
0
 def printSeeds( self ):
     """print random seeds """
     name = jobproperties.Digitization.rndmSvc.get_Value()
     rndmSvc = getConfigurable(name)()
     logDigitizationFlags.info ("Random Number Seeds stored in digitization jobProperty: " + str(jobproperties.Digitization.rndmSeedList.get_Value()))
     logDigitizationFlags.info ("Random Number Seeds attached to Service '" + name + "': " + str(rndmSvc.Seeds))
     return
Exemplo n.º 3
0
def _loadBasicIOVDb():
    """Loads the basic services for IOVDbSvc"""

    ## make sure we have been -at least- minimally correctly configured
    import AthenaCommon.AtlasUnixStandardJob

    from AthenaCommon.Logging import logging
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr

    msg = logging.getLogger('loadBasicIOVDb')
    msg.debug("Loading basic services for IOVDbSvc...")

    # Load IOVDbSvc
    from IOVDbSvc.IOVDbSvcConf import IOVDbSvc
    svcMgr += IOVDbSvc()

    # Set IOVDbSvc as proxy provider
    from AthenaCommon.ConfigurableDb import getConfigurable
    svcMgr += getConfigurable("ProxyProviderSvc")()
    svcMgr.ProxyProviderSvc.ProviderNames += ["IOVDbSvc"]

    # Load IOVSvc
    from IOVSvc.IOVSvcConf import IOVSvc
    svcMgr += IOVSvc()

    # Load EventInfoMgt
    import EventInfoMgt.EventInfoMgtInit

    # add in /TagInfo to be read from File meta data
    svcMgr.IOVDbSvc.Folders += ["/TagInfo<metaOnly/>"]

    msg.debug("Loading basic services for IOVDb... [DONE]")
    return
Exemplo n.º 4
0
 def checkRndmSvc(self):
     """Check if the random number service has already been defined"""
     from AthenaCommon.AppMgr import ServiceMgr
     if hasattr( ServiceMgr , jobproperties.SimFlags.RandomSvc.get_Value() ):
         from AthenaCommon.ConfigurableDb import getConfigurable
         rndmSvc = getConfigurable(jobproperties.SimFlags.RandomSvc.get_Value())()
         if len(rndmSvc.Seeds)!=0:
             _sflog.warn(rndmSvc.name() + ".Seeds is not empty!")
             _sflog.warn("Random Number Seeds already attached to Service '" +
                         rndmSvc.name() + "': " + str(rndmSvc.Seeds))
             _sflog.warn("Please use simFlags.RandomSeedList.addSeed() instead!")
             for seedstring in rndmSvc.Seeds:
                 if 'OFFSET' not in seedstring:
                     _sflog.warn("Existing Seed: '" + seedstring +
                                 "' incorrectly defined - missing OFFSET! " +
                                 "Removing...")
                 else:
                     # If seed is correctly formatted add seed properly after
                     # checking it hasn't already been defined in the stream list.
                     splitseedstring = seedstring.split()
                     if self.checkForExistingSeed(splitseedstring[0]):
                         _sflog.error("Initialization values for random " +
                                      "number stream " + splitseedstring[0] +
                                      " already exist!")
                     else:
                         self.addSeed( splitseedstring[0], splitseedstring[3],
                                       splitseedstring[4] )
             rndmSvc.Seeds = []
Exemplo n.º 5
0
 def printSeeds( self ):
     """print random seeds """
     from AthenaCommon.ConfigurableDb import getConfigurable
     rndmSvc = getConfigurable(jobproperties.SimFlags.RandomSvc.get_Value())()
     _sflog.info("Random Number Seeds stored in simFlag: " +
                 str(self.get_Value()))
     _sflog.info("Random Number Seeds attached to Service '" +
                 rndmSvc.name() + "': " + str(rndmSvc.Seeds))
Exemplo n.º 6
0
 def printSeeds( self ):
     """print random seeds
     """
     from AthenaCommon.ConfigurableDb import getConfigurable
     rndmSvc = getConfigurable(jobproperties.RandomFlags.RandomSvc.get_Value())()
     logRandomFlags.info ("Random Number Seeds stored in RandomFlags.RandomSeedList: " + str(self.get_Value()))
     logRandomFlags.info ("Random Number Seeds attached to Service '" + rndmSvc.name() + "': " + str(rndmSvc.Seeds))
     return
Exemplo n.º 7
0
def dump(outputFilename):
    log.info(
        "Start dumping configuration for further use in the trigger configuration database"
    )

    dumper = Dumper.getDumperInstance(outputFilename)

    from AthenaCommon.AppMgr import ToolSvc, ServiceMgr, theApp
    svcMgr = theApp.serviceMgr()
    toolSvc = svcMgr.ToolSvc
    topAlgs = theApp.TopAlg
    auditorSvc = svcMgr.AuditorSvc

    # Dump the ApplicationMgr
    dumper.append(theApp, algtype='Algorithm', dumpChildren=False)

    # Dump the Tools
    dumper.append(toolSvc, algtype='Service', dumpChildren=False)
    for alg in toolSvc.getAllChildren():
        dumper.append(alg, algtype='PublicTool', dumpChildren=True)

    # Dump the Auditors
    dumper.append(auditorSvc, algtype='Service', dumpChildren=False)
    for alg in auditorSvc.getAllChildren():
        dumper.append(alg, algtype='Auditor', dumpChildren=True)

    # Dump the Services
    dumper.append(svcMgr, algtype='Service', dumpChildren=False)
    for alg in svcMgr.getAllChildren():
        if alg.getName() in ('AuditorSvc', 'ToolSvc'): continue
        dumper.append(alg, algtype='Service', dumpChildren=True)

    # Dump the top Algorithms
    from AthenaCommon.ConfigurableDb import getConfigurable
    from AthenaCommon.Configurable import Configurable

    for algNameClass in topAlgs:
        algClass, algName = algNameClass.split('/')[0:2]
        alg = None
        if algName in Configurable.allConfigurables:
            alg = Configurable.allConfigurables[algName]
            if alg.getFullName() != algNameClass:
                alg = None

        if alg == None:
            from AthenaCommon import CfgMgr
            cfg_class = getConfigurable(algClass, assumeCxxClass=True)
            stmt = 'alg = CfgMgr.%s("%s")' % (cfg_class.__name__, algName)
            try:
                exec stmt
            except Exception, exc:
                print "ERROR:\t\tTop algorithm: %s/%s was not assigned: %s" % (
                    algClass, algName)
                print exc
        if alg:
            dumper.append(alg, algtype='TopAlg', dumpChildren=True)
        else:
            print "Top algorithm: %s/%s was not assigned" % (algClass, algName)
Exemplo n.º 8
0
 def addtoService(self):
     """ Attach seeds stored in digitization jobProperties to ATLAS random number sevice
     """
     name = jobproperties.Digitization.rndmSvc.get_Value()
     rndmSvc = getConfigurable(name)()
     logDigitizationFlags.info ("Adding Digitization random number seed stored in jobProperties to Random Number Service '" + name + "'")
     #FIXME: add second check for seeds duplication upon insertion into random nubmer service!
     rndmSvc.Seeds += jobproperties.Digitization.rndmSeedList.get_Value()
     return
Exemplo n.º 9
0
 def addtoService(self):
     """ Attach seeds stored in simFlags to ATLAS random number sevice
     """
     from AthenaCommon.ConfigurableDb import getConfigurable
     rndmSvc = getConfigurable(jobproperties.SimFlags.RandomSvc.get_Value())()
     _sflog.info("Adding Simulation random number seed stored in jobProperties " +
                 "to Random Number Service '" + rndmSvc.name() + "'")
     self.checkRndmSvc()
     rndmSvc.Seeds += self.get_Value()
     from GaudiKernel.Configurable import WARNING
     rndmSvc.OutputLevel = WARNING
     from AthenaCommon.AppMgr import ServiceMgr
     if not hasattr( ServiceMgr , jobproperties.SimFlags.RandomSvc.get_Value() ):
         ServiceMgr += rndmSvc
Exemplo n.º 10
0
    def getHandle(self, selfOptions={}):
        if not self._cppApp:
            # temporarily store this list as it will be touched by the C++ app
            # through the __getattribute__ method
            _createSvc = self.__dict__['CreateSvc']
            if not selfOptions:
                selfOptions = self.bootProps()
                for k, v in selfOptions.items():
                    setattr(self, k, v)
            svcMgr = self.serviceMgr()
            # the following code is stopped when minimal to prevent the loading of
            # ConfigurableDb when no configuration is done; FIXME: minimal is set
            # to go when all code has been cleaned up
            if self._opts and not self._opts.minimal:
                from AthenaCommon.ConfigurableDb import getConfigurable
                if not hasattr(svcMgr, 'JobOptionsSvc'):
                    svcMgr += getConfigurable(
                        self.JobOptionsSvcType)("JobOptionsSvc")
                if not hasattr(svcMgr, 'MessageSvc'):
                    svcMgr += getConfigurable(
                        self.MessageSvcType)("MessageSvc")
        # -- end minimal
            try:
                from GaudiPython import AppMgr as GaudiAppMgr
            except ImportError:
                from gaudimodule import AppMgr as GaudiAppMgr
            self._cppApp = GaudiAppMgr(outputlevel=self.outputLevel,
                                       joboptions=None,
                                       selfoptions=selfOptions)
            self.__dict__['state'] = getattr(self._cppApp, 'state')
            for k, v in selfOptions.items():
                setattr(self._cppApp, k, v)
            self.__dict__['CreateSvc'] = _createSvc
            del _createSvc

        import GaudiPython  # this module might have disappeared b/c of cleansing # noqa: F401
        return self._cppApp
Exemplo n.º 11
0
 def addPublicTool(self, tool):
     """Add ConfigurableAlgTool instance to ToolSvc, and store
     in local dictionary, with tool name as key.
     If <tool> is a string, it is assumed to be the C++ class
     name, and the corresponding (default) configurable is
     retrieved and added. The configurable is returned."""
     global ToolSvc
     if type(tool) == str:
         tool = getConfigurable(tool)()
     gaudiType = tool.getGaudiType()
     if gaudiType != 'AlgTool':
         raise TypeError('%r is not an AlgTool, but an %s' %
                         (tool, gaudiType))
     ToolSvc += tool
     self._publicTools.append(tool)
     self.__dict__[tool.getName()] = tool
     return tool
Exemplo n.º 12
0
 def addtoService(self):
     """Attach seeds stored in RandomFlags.RandomSeedList to ATLAS random number sevice
     """
     from AthenaCommon.ConfigurableDb import getConfigurable
     rndmSvc = getConfigurable(jobproperties.RandomFlags.RandomSvc.get_Value())()
     logRandomFlags.info ("Adding random number seeds stored in RandomFlags.RandomSeedList to Random Number Service '" + rndmSvc.name() + "'")
     if jobproperties.RandomFlags.readSeedsFromFile.get_Value():
         rndmSvc.Seeds = []
         rndmSvc.ReadFromFile = True
         rndmSvc.FileToRead = jobproperties.RandomFlags.rndmSeedInputFile.get_Value()
         logRandomFlags.warning("Random seeds will be read from the file %s", jobproperties.RandomFlags.rndmSeedInputFile.get_Value())
     else:
         self.checkRndmSvc()
         rndmSvc.Seeds += self.get_Value()
     from GaudiKernel.Configurable import WARNING
     rndmSvc.OutputLevel = WARNING
     from AthenaCommon.AppMgr import ServiceMgr
     if not hasattr( ServiceMgr , jobproperties.RandomFlags.RandomSvc.get_Value() ):
         ServiceMgr += rndmSvc
     return
Exemplo n.º 13
0
 def addAlg(self, alg):
     """Add ConfigurableAlgorithm instance for the topSequence, and store
     in local dictionary, with algorithm name as key.
     If <alg> is a string, it is assumed to be the C++ class
     name, and the corresponding (default) configurable is
     retrieved and added. The configurable is returned.
     If <alg> is None, then None is returned."""
     if alg is None: return None
     global topSequence
     if type(alg) == str:
         alg = getConfigurable(alg)()
     # check that it is indeed Algorithm
     gaudiType = alg.getGaudiType()
     if gaudiType != 'Algorithm':
         raise TypeError('%r is not an Algorithm, but an %s' %
                         (alg, gaudiType))
     # add to local dictionary
     if not alg in self._algs:
         self._algs.append(alg)
         # add to own dict for direct access: self.AlgName
         self.__dict__[alg.getName()] = alg
     return alg
Exemplo n.º 14
0
 def checkRndmSvc(self):
     """Check if the random number service has already been defined
     """
     from AthenaCommon.AppMgr import ServiceMgr
     if hasattr( ServiceMgr , jobproperties.RandomFlags.RandomSvc.get_Value() ):
         from AthenaCommon.ConfigurableDb import getConfigurable
         rndmSvc = getConfigurable(jobproperties.RandomFlags.RandomSvc.get_Value())()
         if len(rndmSvc.Seeds) != 0:
             logRandomFlags.warn (rndmSvc.name() + ".Seeds is not empty!")
             logRandomFlags.warn ("Random Number Seeds already attached to Service '" + rndmSvc.name() + "': " + str(rndmSvc.Seeds))
             logRandomFlags.warn ( "Please use simFlags.RandomSeedList.addSeed() instead!")
             for seedstring in rndmSvc.Seeds:
                 if 'OFFSET' not in seedstring:
                     logRandomFlags.warn ( "Existing Seed:'" + seedstring + "' incorrectly defined - missing OFFSET! Removing...")
                 else:
                     ## If seed is correctly formatted add seed properly
                     ## after checking it hasn't already been defined in the stream list.
                     splitseedstring = seedstring.split()
                     if self.checkForExistingSeed(splitseedstring[0]):
                         logRandomFlags.error ("Initialization values for random number stream " + splitseedstring[0] + " already exist!")
                     else:
                         self.addSeed( splitseedstring[0], splitseedstring[3], splitseedstring[4] )
             rndmSvc.Seeds = []
     return
include( "GeneratorObjectsAthenaPool/GeneratorObjectsAthenaPool_joboptions.py" )

include( "InDetEventAthenaPool/InDetEventAthenaPool_joboptions.py" )

#--------------------------------------------------------------
#---   EventMixer configuration
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 300

#run without file catalog
ServiceMgr.PoolSvc.AttemptCatalogPatch = True

#ServiceMgr.ProxyProviderSvc.ProviderNames += [ "MixingEventSelector/EventMixer" ]
from AthenaCommon.ConfigurableDb import getConfigurable
ServiceMgr += getConfigurable("AthenaPoolAddressProviderSvc")("AthenaPoolAddressProviderSvc" )
ServiceMgr.ProxyProviderSvc.ProviderNames += [ "AthenaPoolAddressProviderSvc" ]
#ServiceMgr.AthenaPoolAddressProviderSvc.DataHeaderKey = "MinBiasSelector"

#why not !!! AthenaEventLoopMgr.EvtSel = "EventMixer";
theApp.EvtSel = "EventMixer";  #FIXME should decode ListItem
#
ServiceMgr += getConfigurable("MixingEventSelector")("EventMixer")
ServiceMgr.ProxyProviderSvc.ProviderNames += [ "MixingEventSelector/EventMixer" ]
# Event mixing trigger list
# format is [frequency in %]
ServiceMgr.EventMixer.TriggerList += [ "EventSelectorAthenaPool/MinBiasSelector:0:1000" ]
ServiceMgr.EventMixer.TriggerList += [ "EventSelectorAthenaPool/CavernSelector:0:1000" ]
ServiceMgr.EventMixer.StreamStatusFileName = "streamStatus.txt"
# Pool input G4Sim  use 
ServiceMgr += getConfigurable("EventSelectorAthenaPool")("CavernSelector" )
Exemplo n.º 16
0
include("GeneratorObjectsAthenaPool/GeneratorObjectsAthenaPool_joboptions.py")

include("InDetEventAthenaPool/InDetEventAthenaPool_joboptions.py")

#--------------------------------------------------------------
#---   EventMixer configuration
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 300

#run without file catalog
ServiceMgr.PoolSvc.AttemptCatalogPatch = True

#ServiceMgr.ProxyProviderSvc.ProviderNames += [ "MixingEventSelector/EventMixer" ]
from AthenaCommon.ConfigurableDb import getConfigurable
ServiceMgr += getConfigurable("AthenaPoolAddressProviderSvc")(
    "AthenaPoolAddressProviderSvc")
ServiceMgr.ProxyProviderSvc.ProviderNames += ["AthenaPoolAddressProviderSvc"]
#ServiceMgr.AthenaPoolAddressProviderSvc.DataHeaderKey = "MinBiasSelector"

#why not !!! AthenaEventLoopMgr.EvtSel = "EventMixer";
theApp.EvtSel = "EventMixer"
#FIXME should decode ListItem
#
ServiceMgr += getConfigurable("MixingEventSelector")("EventMixer")
ServiceMgr.ProxyProviderSvc.ProviderNames += ["MixingEventSelector/EventMixer"]
# Event mixing trigger list
# format is [frequency in %]
ServiceMgr.EventMixer.TriggerList += [
    "EventSelectorAthenaPool/MinBiasSelector:0:1000"
]
ServiceMgr.EventMixer.TriggerList += [
Exemplo n.º 17
0
EventPersistencySvc.CnvServices += [ "AthenaPoolCnvSvc" ]

#Explicitly specify the output file catalog
#PoolSvc = Service( "PoolSvc" )
#PoolSvc.WriteCatalog = "file:Catalog1.xml"

#ProxyProviderSvc = Service( "ProxyProviderSvc" )
#ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]

#CondProxyProvider = svcMgr.ProxyProvider
#CondProxyProvider.InputCollections += ["LarCondTestNoReg.root"]

from AthenaCommon.ConfigurableDb import getConfigurable
from AthenaCommon.AppMgr import ServiceMgr  
ServiceMgr.ProxyProviderSvc.ProviderNames += [ "CondProxyProvider" ]
ServiceMgr += getConfigurable( "CondProxyProvider" )()
svcMgr.CondProxyProvider.InputCollections+=["LarCondTestNoReg.root"]

#--------------------------------------------------------------
#  Use OutputConditionsAlg to register
#--------------------------------------------------------------

from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
OutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","LarCondTestAndReg.root")

OutputConditionsAlg.ObjectList=[ "LArRampMC#/LArCalorimeter/LArTests/LArRampsSingleGroup",  "LArRampMC#/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping", "LArRampMC#/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping"]
OutputConditionsAlg.WriteIOV=True
#OutputconditionsAlg.Run1=3
#OutputConditionsAlg.Event1=4
#OutputConditionsAlg.Run2=9999
#OutputConditionsAlg.Event2=999999
Exemplo n.º 18
0
# Exclude the ApplicationMgr
del names[names.index('ApplicationMgr')]
# Sort the Components (alg1 > alg1.some) in order to initialize the Parent algorithms first
names.sort()

for name in names:
    c = hlt_config_db[name]
    cfg_name = name
    cfg_type = c['type']
    if name.count('.') > 0:
        cfg_type = cfg_type.split('.')[-1]
        if 'ToolSvc.' in name:
            cfg_name = name.replace('ToolSvc.', '')
        #cfg_name = cfg_name.split('.')[-1]
    #print 'Try to get Configurable:', cfg_type, ':\t %s/%s' % (c['type'],name)
    cfg_class = getConfigurable(cfg_type, assumeCxxClass=True)
    if not cfg_class:
        print 'WARNING: Configurable %s/%s (%s/%s) not found' % (
            cfg_type, cfg_name, c['type'], name)
        continue

    ## create an instance with the correct name
    stmt = 'cfg = CfgMgr.%(cfg_class)s( "%(cfg_name)s", %(properties)s)'

    properties = []
    for n, v in c['properties'].items():
        try:
            dflt_value = cfg_class.__slots__[n]
        except KeyError, err:
            print "::ERROR:: configurable [%s] has no such property [%s] !!" % (
                cfg_class.__name__, n)
## @file AddressRemappingSvc_jobOptions.py
## @brief AddressRemappingSvc job options file to illustrate available AddressRemappingSvc properties.
## @author Peter van Gemmeren <*****@*****.**>
## $Id: AddressRemappingSvc_jobOptions.py,v 1.4 2008-06-06 18:25:04 gemmeren Exp $
###############################################################
#
# AddressRemappingSvc job options file
# Principally for documentation, to illustrate available AddressRemappingSvc properties
#
#==============================================================
# The next lines tell Athena to load the AddressRemappingSvc.
from SGComps.SGCompsConf import AddressRemappingSvc
AddressRemappingSvc = AddressRemappingSvc()
svcMgr += AddressRemappingSvc

# Add AddressRemappingSvc as ProxyProviderSvc to re-map items in updateAddress
from AthenaCommon.ConfigurableDb import getConfigurable
svcMgr += getConfigurable( "ProxyProviderSvc" )()
svcMgr.ProxyProviderSvc.ProviderNames += [ "AddressRemappingSvc" ]

# List items to be re-mapped
svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [ "<oldType>#<oldKey>-><newType>[,symlink]#<newKey>[,alias]" ]
svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [ ]
Exemplo n.º 20
0
#--------------------------------------------------------------
try:
    theApp.CreateSvc += ["FPEControlSvc"]
except Exception:
    treatException("Could not load FPEControlSvc")

#--------------------------------------------------------------
#print resource usage summary at the end of the job
#--------------------------------------------------------------
theApp.AuditServices = True
theApp.AuditAlgorithms = True
from AthenaCommon.AppMgr import theAuditorSvc
from AthenaCommon.ConfigurableDb import getConfigurable
#theAuditorSvc += getConfigurable("ChronoAuditor")()
#theAuditorSvc += getConfigurable("MemStatAuditor")()
theAuditorSvc += getConfigurable("NameAuditor")()

#--------------------------------------------------------------
#run perfmon
#--------------------------------------------------------------
from PerfMonComps.PerfMonFlags import jobproperties

jobproperties.PerfMonFlags.OutputFile = "ntuple.root"
# by default, PerfMon is disabled: enable it
# see https://twiki.cern.ch/twiki/bin/view/Atlas/PerfMonComps
jobproperties.PerfMonFlags.doMonitoring = True
protectedInclude("PerfMonComps/PerfMonSvc_jobOptions.py")
#instead of doMonitoring may also do
#jobproperties.PerfMonFlags.doFastMon = True

#use a wide name field to "see" the tools in use
## @file AddressRemappingSvc_jobOptions.py
## @brief AddressRemappingSvc job options file to illustrate available AddressRemappingSvc properties.
## @author Peter van Gemmeren <*****@*****.**>
## $Id: AddressRemappingSvc_jobOptions.py,v 1.4 2008-06-06 18:25:04 gemmeren Exp $
###############################################################
#
# AddressRemappingSvc job options file
# Principally for documentation, to illustrate available AddressRemappingSvc properties
#
#==============================================================
# The next lines tell Athena to load the AddressRemappingSvc.
from SGComps.SGCompsConf import AddressRemappingSvc
AddressRemappingSvc = AddressRemappingSvc()
svcMgr += AddressRemappingSvc

# Add AddressRemappingSvc as ProxyProviderSvc to re-map items in updateAddress
from AthenaCommon.ConfigurableDb import getConfigurable
svcMgr += getConfigurable("ProxyProviderSvc")()
svcMgr.ProxyProviderSvc.ProviderNames += ["AddressRemappingSvc"]

# List items to be re-mapped
svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [
    "<oldType>#<oldKey>-><newType>[,symlink]#<newKey>[,alias]"
]
svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = []
### Athena configuration -----------------------------------------------------
from AthenaCommon import CfgMgr

## create the application manager and start in a non-initialised state
from AthenaCommon.AppMgr import theApp
from AthenaCommon.AppMgr import ToolSvc, ServiceMgr, theAuditorSvc

## These properties have alread been set on the C++ ApplicationMgr in the Psc
## but the configurable needs to have them set as well
theApp.MessageSvcType = PscConfig.optmap["MESSAGESVCTYPE"]
theApp.JobOptionsSvcType = PscConfig.optmap["JOBOPTIONSSVCTYPE"]

## add the MessageSvc and the JobOptionsSvc to the ServiceMgr
from AthenaCommon.ConfigurableDb import getConfigurable
ServiceMgr += getConfigurable(theApp.JobOptionsSvcType)("JobOptionsSvc")
ServiceMgr += getConfigurable(theApp.MessageSvcType)("MessageSvc")

## set the default values
try:
    include(pscBootstrapFile)
except Exception, e:
    if isinstance(e, IncludeError):
        print sys.exc_type, e
        theApp._exitstate = ExitCodes.INCLUDE_ERROR
        sys.exit(ExitCodes.INCLUDE_ERROR)
    raise

## properties of the application manager
theApp.StatusCodeCheck = False  # enabled via TriggerFlags.Online.doValidation (see below)
theApp.setOutputLevel(OUTPUTLEVEL)
Exemplo n.º 23
0
    include("EventOverlayJobTransforms/MuonOverlay_jobOptions.py")

if DetFlags.overlay.LVL1_on():
    include("EventOverlayJobTransforms/Level1Overlay_jobOptions.py")

# save the overlay output first
include("EventOverlayJobTransforms/OverlayOutputItemList_jobOptions.py")

# now save the signal information in the same job
if overlayFlags.doSignal == True:
    include("EventOverlayJobTransforms/SignalOutputItemList_jobOptions.py")

# For random number initialization
from AthenaCommon.ConfigurableDb import getConfigurable

ServiceMgr += getConfigurable(jobproperties.Digitization.rndmSvc.get_Value())()
jobproperties.Digitization.rndmSeedList.addtoService()
jobproperties.Digitization.rndmSeedList.printSeeds()

#================================================================
print "overlay_trf: final outStream = ", outStream

#================================================================
# Logging
#--------------------------------------------------------------
#ServiceMgr.MessageSvc.OutputLevel = INFO
ServiceMgr.MessageSvc.OutputLevel = INFO
ServiceMgr.MessageSvc.Format = "% F%45W%S%7W%R%T %0W%M"

conddb.addFolder("LAR", "/LAR/ElecCalib/fSampl/Symmetry")
conddb.addOverride("/LAR/ElecCalib/fSampl/Symmetry",
Exemplo n.º 24
0
            ChannelSelection)

else:
    if 'InputOFCPoolFileName' in dir():
        RampLog.info("Read OFC Cali form POOL file")
        PoolFileList += [InputOFCPoolFileDir + "/" + InputOFCPoolFileName]
    else:
        RampLog.info(
            "No PoolFileList found! Please list the POOL files containing OFC or read from COOL."
        )
        theApp.exit(-1)

if (len(PoolFileList) > 0):

    from AthenaCommon.ConfigurableDb import getConfigurable
    svcMgr += getConfigurable("ProxyProviderSvc")()
    svcMgr.ProxyProviderSvc.ProviderNames += ["CondProxyProvider"]

    svcMgr += getConfigurable("CondProxyProvider")()
    svcMgr.CondProxyProvider.InputCollections += PoolFileList

if (StripsXtalkCorr):
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
    from LArCalibUtils.LArCalibUtilsConf import LArStripsCrossTalkCorrector
    theLArStripsCrossTalkCorrector = LArStripsCrossTalkCorrector()
    theLArStripsCrossTalkCorrector.KeyList = GainList
    theLArStripsCrossTalkCorrector.ADCsaturation = ADCsaturation
    theLArStripsCrossTalkCorrector.NoXtalkCorr = LArBadChannelMasker(
        "NoXtalkCorr",
        DoMasking=True,
        ProblemsToMask=["deadReadout", "deadPhys", "deadCalib", "almostDead"])
Exemplo n.º 25
0
def _loadBasicEventInfoMgt():
    """Loads the basic services for EventInfoMgt"""

    import os
    import string
    class EventInfoMgtInit:

        def __init__(self):
            self.release = self.getRelease()

        #----------------------------------------------------
        #
        # Executing a shell command
        #
        def execute (self, cmd):
            #print ('> ' + cmd)
            r = os.popen(cmd)
            lines = []
            for line in r.readlines():
                #print (line)
                line = string.rstrip (line)
                lines.append (line)
            r.close()
            return lines

        # Get the project name and it version version, the top level
        # project, AtlasOffline, has the release number
        def getRelease (self):
            try:
                #print ("EventInfoMgtInit.getRelease: get project, version")
                project = os.environ ['AtlasProject']
                version = os.environ ['AtlasVersion']
                #print ("EventInfoMgtInit.getRelease: project, version",project, version)
                return project + '-' + version
            except Exception:
                # These variables can be missing during CI builds,
                # so don't complain if they're not there.
                #print ("EventInfoMgtInit getRelease: except caught")
                #print (sys.exc_info()[0])
                #print (sys.exc_info()[1])
                pass
            return "Unknown-Unknown"


    ## make sure we have been -at least- minimally correctly configured
    import AthenaCommon.AtlasUnixStandardJob # noqa: F401

    from AthenaCommon.Logging import logging
    from AthenaCommon.AppMgr  import ServiceMgr as svcMgr

    msg = logging.getLogger( 'loadBasicEventInfoMgt' )
    msg.debug( "Loading basic services for EventInfoMgt..." )

    #from EventInfoMgt.EventInfoMgtConf import TagInfoMgr
    from EventInfoMgt.EventInfoMgtConf import TagInfoMgr
    svcMgr += TagInfoMgr()

    # Add in extra tag for the release number:
    evtMgt  = EventInfoMgtInit()
    release = evtMgt.release
    print ("EventInfoMgtInit: Got release version ",release)
    svcMgr.TagInfoMgr.ExtraTagValuePairs = {"AtlasRelease" : release }

    # Add TagInfoMgr as cnv svc
    from GaudiSvc.GaudiSvcConf import EvtPersistencySvc
    if not hasattr (svcMgr, 'EventPersistencySvc'):
        svcMgr += EvtPersistencySvc( "EventPersistencySvc" )
    svcMgr.EventPersistencySvc.CnvServices += [ "TagInfoMgr" ]

    # Set TagInfoMgr as proxy provider
    from AthenaCommon.ConfigurableDb import getConfigurable
    if not hasattr (svcMgr, 'ProxyProviderSvc'):
        svcMgr += getConfigurable("ProxyProviderSvc")()
    svcMgr.ProxyProviderSvc.ProviderNames += [ "TagInfoMgr" ]

    msg.debug( "Loading basic services for EventInfoMgt... [DONE]" )
    return
Exemplo n.º 26
0
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = -1
#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------
#---------------------------------------------------------------
# Ntuple service output
#---------------------------------------------------------------

AthenaEventLoopMgr = Service("AthenaEventLoopMgr")
AthenaEventLoopMgr.OutputLevel = 2

from ZdcRec.ZdcRawChannelGetter import ZdcRawChannelGetter
ZdcRawChannelGetter()

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

theApp.TopAlg += ["ZdcByteStreamTester"]
ZdcByteStreamTester = Algorithm("ZdcByteStreamTester")
#ZdcByteStreamTester.ZdcDigitsCollectionLocation = "ZdcDigitsCollection"

from AthenaCommon.AppMgr import theAuditorSvc
from AthenaCommon.ConfigurableDb import getConfigurable
theAuditorSvc += getConfigurable("ChronoAuditor")()
theApp.AuditAlgorithms = True
theApp.AuditServices = True
theApp.AuditTools = True
Exemplo n.º 27
0
  def dump(self) :
    # Set the output file
    document = None
    file = None
    if self.__dict__.has_key('OutputFile') and self.OutputFile != '' :
      # Dump the algorithms to the file
      file = open(self.OutputFile, 'w')
      
      # Test the xml type of the output
      if self.OutputFile[-4:] == '.xml' :
        import xml.dom.minidom
        impl = xml.dom.minidom.getDOMImplementation()
        document = impl.createDocument(None, "setup", None)
    else:
      import sys
      file = sys.stdout
    
    # Get the algorithms
    from AthenaCommon.AppMgr import ToolSvc,ServiceMgr,theApp
    from AthenaCommon.AlgSequence import AlgSequence
    #toolSvc = CfgMgr.ToolSvc()
    svcMgr = theApp.serviceMgr()
    toolSvc = svcMgr.ToolSvc
    topAlgs = theApp.TopAlg
    auditors = svcMgr.AuditorSvc
    
    # Dump the ApplicationMgr
    if document :
      topElement = document.documentElement
      topElement.appendChild(self.algtoXML(theApp, document, dumpChildren=False))
    else :
      file.write(self.algtoStr(theApp, ntabs=1, dumpChildren=False))
    
    # Dump the Tools
    if document :
      topElement = document.documentElement
      topElement.appendChild(self.algtoXML(toolSvc, document,'Service',dumpChildren=False))
    else :
      file.write(self.algtoStr(toolSvc, ntabs=1, dumpChildren=False))
    for alg in toolSvc.getAllChildren():
      if document:
        topElement = document.documentElement
        topElement.appendChild(self.algtoXML(alg, document, 'PublicTool'))
      else :
        file.write(self.algtoStr(alg))

    # Dump the Auditors
    if document :
      topElement = document.documentElement
      topElement.appendChild(self.algtoXML(auditors, document,'Service',dumpChildren=False))
    else :
      file.write(self.algtoStr(auditors, ntabs=1, dumpChildren=False))
      
    for alg in auditors.getAllChildren():
      if document:
        topElement = document.documentElement
        topElement.appendChild(self.algtoXML(alg, document, 'Auditor'))
      else :
        file.write(self.algtoStr(alg))
    
    # Dump the Services
    if document :
      topElement = document.documentElement
      topElement.appendChild(self.algtoXML(svcMgr, document,'Service',dumpChildren=False))
    else :
      file.write(self.algtoStr(svcMgr, ntabs=1, dumpChildren=False))
    for alg in svcMgr.getAllChildren():
      if alg.getName() not in ('AuditorSvc','ToolSvc') :
        if document:
          topElement = document.documentElement
          topElement.appendChild(self.algtoXML(alg, document, 'Service'))
        else :
          file.write(self.algtoStr(alg))
        
    # Dump the top Algorithms
    from AthenaCommon.ConfigurableDb import getConfigurable, cfgDb
    from AthenaCommon import CfgMgr
    from AthenaCommon.Configurable import Configurable
    for algNameClass in topAlgs:
      alg = None
      algName = algNameClass.split('/')[1]
      algClass = algNameClass.split('/')[0]
      if Configurable.allConfigurables.has_key(algName) :
        alg = Configurable.allConfigurables[algName]
        if alg.getFullName() != algNameClass: alg = None
      if not alg :
        cfg_class = getConfigurable(algClass, assumeCxxClass=True)
        Configurable.allConfigurables.has_key('TrigSteer_L2')
        stmt = 'alg = CfgMgr.%s("%s")' % (cfg_class.__name__,algName)
        try :
          exec stmt
        except Exception, exc:
          print "ERROR:\t\tTop algorithm: %s/%s was not assigned: %s" % (algClass,algName)
          print exc
      
      if alg :
        if document:
          topElement = document.documentElement
          topElement.appendChild(self.algtoXML(alg, document, 'TopAlg'))
        else :
          file.write(self.algtoStr(alg))
      else :
        print "Top algorithm: %s/%s was not assigned" % (algClass,algName)
Exemplo n.º 28
0
# ------------------------------------------------------------

ServiceMgr.StoreGateSvc.ActivateHistory = False
ServiceMgr.StoreGateSvc.Dump = False

# ------------------------------------------------------------
# Use auditors
# ------------------------------------------------------------

if doAuditors:
    # --- load AuditorSvc
    from AthenaCommon.ConfigurableDb import getConfigurable
    # --- write out summary of the memory usage
    #   | number of events to be skip to detect memory leak
    #   | 20 is default. May need to be made larger for complete jobs.
    ServiceMgr.AuditorSvc += getConfigurable("ChronoAuditor")()
    # --- memory auditors
    MemStatAuditor = getConfigurable("MemStatAuditor")()
    MemStatAuditor.OutputLevel = WARNING
    ServiceMgr.AuditorSvc += MemStatAuditor
    # --- write out a short message upon entering or leaving each algorithm
    if doNameAuditor:
        ServiceMgr.AuditorSvc += getConfigurable("NameAuditor")()
    #
    theApp.AuditAlgorithms = True
    theApp.AuditServices = True
    #
    # --- Display detailed size and timing statistics for writing and reading
    if doWriteESD or doWriteAOD or ('doCopyRDO' in dir() and doCopyRDO):
        ServiceMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True
Exemplo n.º 29
0
    from IOVDbSvc.CondDB import conddb
    conddb.setGlobalTag(globalflags.ConditionsTag())

# Temporary work-around - see ATLASSIM-2351
if ISF_Flags.UsingGeant4():
    include("G4AtlasApps/G4Atlas.flat.configuration.py")  #HACK

#--------------------------------------------------------------
# Setup the ISF Services
#--------------------------------------------------------------
# --- load AuditorSvc
from AthenaCommon.ConfigurableDb import getConfigurable
# --- write out summary of the memory usage
#   | number of events to be skip to detect memory leak
#   | 20 is default. May need to be made larger for complete jobs.
ServiceMgr.AuditorSvc += getConfigurable("ChronoAuditor")()
# --- write out a short message upon entering or leaving each algorithm
# ServiceMgr.AuditorSvc += getConfigurable("NameAuditor")()
#
theApp.AuditAlgorithms = True
theApp.AuditServices = True
#
# --- Display detailed size and timing statistics for writing and reading
ServiceMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True

#--------------------------------------------------------------
# ISF input
#--------------------------------------------------------------

# Note: automatically adds generator to TopSequence if applicable
from AthenaCommon.BeamFlags import jobproperties
Exemplo n.º 30
0
if DetFlags.overlay.LAr_on() or DetFlags.overlay.Tile_on():
   include ( "EventOverlayJobTransforms/CaloOverlay_jobOptions.py" )

if (MuonGeometryFlags.hasCSC() and DetFlags.overlay.CSC_on()) or DetFlags.overlay.MDT_on() or DetFlags.overlay.RPC_on() or DetFlags.overlay.TGC_on():
   include ( "EventOverlayJobTransforms/MuonOverlay_jobOptions.py" )

if DetFlags.overlay.LVL1_on():
   include ( "EventOverlayJobTransforms/Level1Overlay_jobOptions.py" )

# save the overlay output first
include ( "EventOverlayJobTransforms/OverlayOutputItemList_jobOptions.py" )

# For random number initialization
from AthenaCommon.ConfigurableDb import getConfigurable
ServiceMgr += getConfigurable(digitizationFlags.rndmSvc.get_Value())()
digitizationFlags.rndmSeedList.addtoService()
digitizationFlags.rndmSeedList.printSeeds()

# Write Digitization MetaData if WriteRDOFileMetaData is set to true in jO (false by default)
if hasattr(runArgs,"WriteRDOFileMetaData"):
    if runArgs.WriteRDOFileMetaData:
        from Digitization.DigitizationWriteMetaData import writeDigitizationMetadata
        writeDigitizationMetadata()

#================================================================
printfunc ("overlay_trf: final outStream = " + str(outStream))

#================================================================
# Logging
#--------------------------------------------------------------
Exemplo n.º 31
0
 def __getattr__(self, cfgName):
     if not cfgName.startswith("__"):
         return getConfigurable(cfgName.replace("::", "__"),
                                assumeCxxClass=False)
svcMgr += McEventSelector("EventSelector")
svcMgr.EventSelector.RunNumber = RunNumber
svcMgr.EventSelector.EventsPerRun = 1
svcMgr.EventSelector.FirstEvent = 1
svcMgr.EventSelector.InitialTimeStamp = 0
svcMgr.EventSelector.TimeStampInterval = 1

##########################################################################
#          don't remove otherwise infinite loop                          #
##########################################################################

theApp.EvtMax = 1

###########################################################################

#svcMgr.MessageSvc.OutputLevel  = WARNING
svcMgr.MessageSvc.defaultLimit = 100000000
#svcMgr.MessageSvc.Format       = "% F%20W%S%7W%R%T %0W%M"

#svcMgr+=CfgMgr.AthenaEventLoopMgr(OutputLevel = VERBOSE)

from AthenaCommon.AppMgr import theAuditorSvc
from AthenaCommon.ConfigurableDb import getConfigurable

theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel=DEBUG)
#theAuditorSvc += getConfigurable("ChronoAuditor")()
#theAuditorSvc += getConfigurable("NameAuditor")()

###########################################################################
Exemplo n.º 33
0
 def getComp(self, cfgName):
     return getConfigurable(cfgName.replace("::", "__"),
                            assumeCxxClass=False)
Exemplo n.º 34
0
    theApp.HistogramPersistency = "ROOT"
    from GaudiSvc.GaudiSvcConf import NTupleSvc
    if os.path.exists(OutputPedAutoCorrRootFileDir + "/" +
                      OutputPedAutoCorrRootFileName):
        os.remove(OutputPedAutoCorrRootFileDir + "/" +
                  OutputPedAutoCorrRootFileName)
    svcMgr += NTupleSvc()
    svcMgr.NTupleSvc.Output = [
        "FILE1 DATAFILE='" + OutputPedAutoCorrRootFileDir + "/" +
        OutputPedAutoCorrRootFileName + "' OPT='NEW'"
    ]

###########################################################################

svcMgr.MessageSvc.OutputLevel = WARNING
svcMgr.MessageSvc.defaultLimit = 10000
svcMgr.MessageSvc.Format = "% F%20W%S%7W%R%T %0W%M"

svcMgr += CfgMgr.AthenaEventLoopMgr(OutputLevel=INFO)

from AthenaCommon.AppMgr import theAuditorSvc
from AthenaCommon.ConfigurableDb import getConfigurable
theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel=WARNING)
theApp.AuditAlgorithms = True
theAuditorSvc += getConfigurable("ChronoAuditor")()
theAuditorSvc += getConfigurable("NameAuditor")()
svcMgr.ChronoStatSvc.OutputLevel = INFO

###########################################################################
Exemplo n.º 35
0
 def getComps(self, *manyNames):
     return [
         getConfigurable(cfgName.replace("::", "__"), assumeCxxClass=False)
         for cfgName in manyNames
     ]
Exemplo n.º 36
0
from AthenaCommon.AppMgr import theApp, ServiceMgr, theAuditorSvc
theApp.CreateSvc += [ "StoreGateSvc/DetectorStore", "StoreGateSvc" ]
theApp.ExtSvc += [ "StoreGateSvc/HistoryStore" ]

from AthenaCommon.ConfigurableDb import getConfigurable
ServiceMgr += getConfigurable("ClassIDSvc")()
ServiceMgr.ClassIDSvc.CLIDDBFiles += [ "Gaudi_clid.db" ]

from AthenaCommon.AppMgr import theAuditorSvc
from GaudiAud.GaudiAudConf import AlgContextAuditor
theAuditorSvc += AlgContextAuditor()
Exemplo n.º 37
0
if doVP1:
  from VP1Algs.VP1AlgsConf import VP1Alg
  topSequence += VP1Alg()

# ------------------------------------------------------------
# Use auditors
# ------------------------------------------------------------

if doAuditors:
  # --- load AuditorSvc
  from AthenaCommon.ConfigurableDb import getConfigurable
  # --- write out summary of the memory usage
  #   | number of events to be skip to detect memory leak
  #   | 20 is default. May need to be made larger for complete jobs.
  ServiceMgr.AuditorSvc += getConfigurable("ChronoAuditor")()
  # --- write out a short message upon entering or leaving each algorithm
  if doNameAuditor:
    ServiceMgr.AuditorSvc += getConfigurable("NameAuditor")()
  #
  theApp.AuditAlgorithms = True
  theApp.AuditServices   = True
  #  
  # --- Display detailed size and timing statistics for writing and reading
  if doWriteESD or doWriteAOD or ('doCopyRDO' in dir() and doCopyRDO):
    ServiceMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True

# ------------------------------------------------------------
# write BS 
# ------------------------------------------------------------