Esempio n. 1
0
def main():
    """Run a functional test if module is executed"""
    log = logging.getLogger('ByteStreamConfig')
    Configurable.configurableRun3Behavior = True

    config_flags = AthenaConfiguration.AllConfigFlags.ConfigFlags
    config_flags.Input.Files = defaultTestFiles.RAW
    config_flags.Output.doWriteBS = True
    config_flags.lock()

    read = ByteStreamReadCfg(config_flags)
    read.store(open("test.pkl", "wb"))
    print("All OK")

    write = ByteStreamWriteCfg(config_flags)
    write.printConfig()
    log.info("Write setup OK")

    acc = MainServicesCfg(config_flags)
    acc.merge(read)
    acc.merge(write)
    acc.printConfig()
    log.info("Config OK")

    acc.run(10)
Esempio n. 2
0
def fromRunArgs(runArgs):
    from AthenaConfiguration.AllConfigFlags import ConfigFlags    

    commonRunArgsToFlags(runArgs,ConfigFlags)
    
    cfg=MainServicesCfg(ConfigFlags)
    cfg.merge(HelloWorldCfg())
    cfg.run()
Esempio n. 3
0
def OverlayMainServicesCfg(flags):
    """Configure event loop for overlay"""
    acc = MainServicesCfg(flags)
    if not flags.Overlay.DataOverlay:
        if flags.Concurrency.NumThreads > 0:
            AthenaHiveEventLoopMgr = CompFactory.AthenaHiveEventLoopMgr
            elmgr = AthenaHiveEventLoopMgr()
        else:
            AthenaEventLoopMgr = CompFactory.AthenaEventLoopMgr
            elmgr = AthenaEventLoopMgr()
        elmgr.UseSecondaryEventNumber = True
        acc.addService(elmgr)
    return acc
Esempio n. 4
0
def SetupMuonStandaloneCA(args, ConfigFlags):
    # When running from a pickled file, athena inserts some services automatically. So only use this if running now.
    if args.run:
        from AthenaConfiguration.MainServicesConfig import MainServicesCfg
        cfg = MainServicesCfg(ConfigFlags)
        msgService = cfg.getService('MessageSvc')
        msgService.Format = "S:%s E:%e % F%128W%S%7W%R%T  %0W%M"
    else:
        cfg = ComponentAccumulator()

    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
    cfg.merge(PoolReadCfg(ConfigFlags))
    return cfg
Esempio n. 5
0
    def skip_test_sequences_merging(self):
        from AthenaConfiguration.AllConfigFlags import ConfigFlags
        ConfigFlags.lock()
        from AthenaCommon.Logging import logging
        logging.getLogger('ComponentAccumulator').setLevel(DEBUG)

        print("ca1")
        ca1 = ComponentAccumulator()
        ca1.addEventAlgo(TestAlgo("alg1"))
        ca1.printConfig()
        ca1.addSequence(seqAND("someSequence"))

        print("ca2")
        from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
        ca2 = OutputStreamCfg(ConfigFlags,
                              "RDO",
                              ItemList=[
                                  "SCT_RDO_Container#SCT_RDOs",
                                  "InDetSimDataCollection#SCT_SDO_Map"
                              ])
        ca2.printConfig()

        print("after merge")
        ca1.merge(ca2)
        ca1.printConfig()

        self.assertEqual(len(ca1._allSequences), 2,
                         "Dangling sequences not maintained")

        print("Instantiating top CA")
        from AthenaConfiguration.MainServicesConfig import MainServicesCfg
        topca = MainServicesCfg(ConfigFlags)
        topca.printConfig()

        print("Merging to the top level CA")
        topca.merge(ca1)
        topca.printConfig()
        topca.wasMerged()
Esempio n. 6
0
    cfgFlags.Input.Files = args.filesIn.split(",")
    #cfgFlags.Input.isMC=False
    #cfgFlags.Input.Files=["/atlas/guirriec/git-athena/q431_2019-03-02T2147/myESD_2019.pool.root"]

    cfgFlags.Output.ESDFileName = "esdOut.pool.root"

    # Flags relating to multithreaded execution
    cfgFlags.Concurrency.NumThreads = args.nThreads
    if args.nThreads > 0:
        cfgFlags.Scheduler.ShowDataDeps = True
        cfgFlags.Scheduler.ShowDataFlow = True
        cfgFlags.Scheduler.ShowControlFlow = True
        cfgFlags.Concurrency.NumConcurrentEvents = args.nThreads

    from AthenaConfiguration.MainServicesConfig import MainServicesCfg
    acc = MainServicesCfg(cfgFlags)
    acc.getService("MessageSvc").Format = "% F%80W%S%7W%R%T %0W%M"

    # Prevent the flags from being modified
    cfgFlags.lock()

    acc.merge(PrepareStandAloneBTagCfg(cfgFlags))

    JetCollection = ['AntiKt4EMTopo', 'AntiKt4EMPFlow']

    if args.highlevel:
        acc.merge(BTagHLTaggersCfg(cfgFlags, JetCollection=JetCollection))
    else:
        kwargs = {}
        kwargs['Release'] = args.release
        if args.release == "21.2":
Esempio n. 7
0
    # Setup logs
    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import INFO
    log.setLevel(INFO)

    # Set the Athena configuration flags
    from AthenaConfiguration.AllConfigFlags import ConfigFlags

    path = '/afs/cern.ch/work/j/jodafons/public/valid_sampleA/AOD.20745922._000041.pool.root.1'
    ConfigFlags.Input.Files = [path]
    ConfigFlags.Input.isMC = False
    ConfigFlags.Output.HISTFileName = 'TrigEgammaMonitorOutput.root'

    ConfigFlags.lock()

    # Initialize configuration object, add accumulator, merge, and run.
    from AthenaConfiguration.MainServicesConfig import MainServicesCfg
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
    cfg = MainServicesCfg(ConfigFlags)
    cfg.merge(PoolReadCfg(ConfigFlags))

    trigEgammaMonitorAcc = TrigEgammaMonConfig(ConfigFlags)
    cfg.merge(trigEgammaMonitorAcc)

    # If you want to turn on more detailed messages ...
    #trigEgammaMonitorAcc.getEventAlgo('TrigEgammaMonAlg').OutputLevel = 2 # DEBUG
    cfg.printConfig(withDetails=False)  # set True for exhaustive info

    cfg.run(10)  #use cfg.run(20) to only run on first 20 events
Esempio n. 8
0
flags.Input.Files = [
    "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"
]

flags.Trigger.L1Decoder.forceEnableAllChains = True
flags.Concurrency.NumThreads = 1
flags.Concurrency.NumConcurrentEvents = 1

flags.InDet.useSctDCS = False
flags.InDet.usePixelDCS = False

flags.lock()

from AthenaCommon.Constants import DEBUG, WARNING

acc = MainServicesCfg(flags)
acc.getService('AvalancheSchedulerSvc').VerboseSubSlots = True

# this delcares to the scheduer that EventInfo object is produced
acc.addEventAlgo(
    CompFactory.SGInputLoader(Load=[('xAOD::EventInfo',
                                     'StoreGateSvc+EventInfo')]), "AthAlgSeq")

from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg

acc.merge(ByteStreamReadCfg(flags))

from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig

acc.merge(TriggerHistSvcConfig(flags))
Esempio n. 9
0
if __name__ == "__main__":

    if not (len(sys.argv) == 2 or len(sys.argv) == 3):
        usage()

    inputName = sys.argv[1]
    if not os.access(inputName, os.R_OK):
        print("ERROR, can't read file", inputName)
        usage()

    nEvt = 10
    if len(sys.argv) == 3:
        try:
            nEvt = int(sys.argv[2])
        except ValueError:
            print("Failed to interpret nEvent, got", sys.arv[2])
            usage()

    inFile = open(inputName, 'rb')

    acc = pickle.load(inFile)

    if acc._isMergable:  #Not a top-level accumulator
        from AthenaConfiguration.MainServicesConfig import MainServicesCfg
        from AthenaConfiguration.AllConfigFlags import ConfigFlags
        acc1 = MainServicesCfg(ConfigFlags)
        acc1.merge(acc)
        acc1.run(nEvt)
    else:
        acc.run(nEvt)
Esempio n. 10
0
    #set the source of vertex positioning
    #ConfigFlags.Sim.Vertex.Source = "VertexOverrideFile.txt"# Vertex.OverrideFile/Vertex.OverrideEventFile
    ConfigFlags.Sim.Vertex.Source = "CondDB"  # Vertex.FromCondD
    #ConfigFlags.Sim.Vertex.Source = "LongBeamspotVertexPositioner"

    #included to stop segmentation error - TODO see why it's failing
    ConfigFlags.Input.isMC = True
    ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-14"  #conditions tag for conddb (which one to use - old one for simulation)
    ConfigFlags.Input.RunNumber = 284500  # run test job with and without run number and 222510

    # Finalize
    ConfigFlags.lock()

    ## Initialize a new component accumulator
    cfg = MainServicesCfg(ConfigFlags)  #use this syntax for storegate
    # Add configuration to read EVNT pool file
    cfg.merge(PoolReadCfg(ConfigFlags))

    # Make use of our defiend function
    cfg.popToolsAndMerge(BeamEffectsAlgCfg(ConfigFlags))

    cfg.getService("StoreGateSvc").Dump = True
    cfg.printConfig(withDetails=True)
    ConfigFlags.dump()

    # Run it in athena
    cfg.run(maxEvents=20)

    # Store in a pickle file
    with open("BeamEffectsAlg.pkl", "wb") as f:
Esempio n. 11
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon import Logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory

if __name__=="__main__":
    # Setting needed for the ComponentAccumulator to do its thing
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior=True
    
    # Set message levels
    from AthenaCommon import Constants
    msgLvl = "WARNING"
    from AthenaCommon.Logging import log
    log.setLevel(msgLvl)
    
    # Config flags steer the job at various levels
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    ConfigFlags.Input.isMC  = True
    ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ASG/mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1"]
    
    # Flags relating to multithreaded execution
    nthreads=0
    ConfigFlags.Concurrency.NumThreads =nthreads
    if nthreads>0:
    	ConfigFlags.Concurrency.NumThreads = 1
    	ConfigFlags.Concurrency.NumConcurrentEvents = 1
    ConfigFlags.MET.UseTracks = True
    ConfigFlags.MET.DoPFlow = True
    if ConfigFlags.Beam.Type == 'cosmics' or ConfigFlags.Beam.Type == 'singlebeam':# used to have " or not rec.doInDet()" on the end
Esempio n. 12
0
def TPCnvTest(infile,
              keys,
              useGeoModelSvc=False,
              useIOVDbSvc=False,
              doPixel=False,
              doSCT=False,
              doTRT=False,
              doLAr=False,
              doTile=False,
              doMuon=False):
    # Make sure we don't have a stale file catalog.
    if os.path.exists('PoolFileCatalog.xml'):
        os.remove('PoolFileCatalog.xml')

    if ('ATLAS_REFERENCE_TAG' not in globals()
            and 'ATLAS_REFERENCE_TAG' in os.environ):
        ATLAS_REFERENCE_TAG = os.environ['ATLAS_REFERENCE_TAG']  # noqa: F841

    refpaths = [
        os.environ.get('ATLAS_REFERENCE_DATA', None),
        '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art',
        '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs',
        '/afs/cern.ch/atlas/maxidisk/d33/referencefiles'
    ]

    if infile.startswith('rtt:'):
        infile = infile[4:]
    infile = find_file(infile, refpaths)

    # Provide MC input
    ConfigFlags.Input.Files = [infile]
    ConfigFlags.GeoModel.AtlasVersion = 'ATLAS-R1-2012-03-01-00'
    ConfigFlags.GeoModel.Align.Dynamic = False
    ConfigFlags.Detector.GeometryPixel = doPixel
    ConfigFlags.Detector.GeometrySCT = doSCT
    ConfigFlags.Detector.GeometryTRT = doTRT
    ConfigFlags.Detector.GeometryLAr = doLAr
    ConfigFlags.Detector.GeometryTile = doTile
    ConfigFlags.Detector.GeometryMuon = doMuon
    ConfigFlags.lock()

    # Construct ComponentAccumulator
    acc = MainServicesCfg(ConfigFlags)
    acc.merge(PoolReadCfg(ConfigFlags))
    if useIOVDbSvc:
        acc.merge(IOVDbSvcCfg(ConfigFlags))
    if useGeoModelSvc:
        if ConfigFlags.Detector.GeometryPixel:
            acc.merge(PixelGeometryCfg(ConfigFlags))
            useGeoModelSvc = True
        if ConfigFlags.Detector.GeometrySCT:
            acc.merge(SCT_GeometryCfg(ConfigFlags))
            useGeoModelSvc = True
        if ConfigFlags.Detector.GeometryTRT:
            acc.merge(TRT_GeometryCfg(ConfigFlags))
            useGeoModelSvc = True
        if ConfigFlags.Detector.GeometryLAr:
            acc.merge(LArGMCfg(ConfigFlags))
            useGeoModelSvc = True
        if ConfigFlags.Detector.GeometryTile:
            acc.merge(TileGMCfg(ConfigFlags))
            useGeoModelSvc = True
        if ConfigFlags.Detector.GeometryMuon:
            acc.merge(MuonGeoModelCfg(ConfigFlags))
            useGeoModelSvc = True
        #acc.merge(ForDetGeometryCfg(ConfigFlags))
        acc.merge(GeoModelCfg(ConfigFlags))
        acc.getService("GeoModelSvc").IgnoreTagDifference = True
    acc.addEventAlgo(
        Dumper('dumper', ConfigFlags.Input.Files[0], keys, refpaths),
        'AthAlgSeq')
    return acc.run(maxEvents=10)
Esempio n. 13
0
    numThreads = 1
    ConfigFlags.Concurrency.NumThreads = numThreads
    ConfigFlags.Concurrency.NumConcurrentEvents = numThreads  # Might change this later, but good enough for the moment.

    ConfigFlags.Detector.GeometryPixel = True
    ConfigFlags.Detector.GeometrySCT = True
    ConfigFlags.InDet.doPixelClusterSplitting = True

    from AthenaConfiguration.TestDefaults import defaultTestFiles
    ConfigFlags.Input.Files = defaultTestFiles.RDO
    ConfigFlags.lock()
    ConfigFlags.dump()

    from AthenaConfiguration.MainServicesConfig import MainServicesCfg
    top_acc = MainServicesCfg(ConfigFlags)

    msgService = top_acc.getService('MessageSvc')
    msgService.Format = "S:%s E:%e % F%138W%S%7W%R%T  %0W%M"

    acc = InDetClusterizationAlgorithmsCfg(ConfigFlags)
    top_acc.merge(acc)
    # import pdb ; pdb.set_trace()
    iovsvc = top_acc.getService('IOVDbSvc')
    iovsvc.OutputLevel = 5
    ##acc.setAppProperty("EvtMax",25)
    ##acc.store(open("test_SiClusterization.pkl", "w"))
    top_acc.run(25)
    #with open('test4.pkl', mode="wb") as f:
    #   dill.dump(acc, f)
    top_acc.store(open("test00.pkl", "wb"))