def AssembleIO():
    #--------------------------------------------------------------
    # Reduce the event loop spam a bit
    #--------------------------------------------------------------
    if os.path.exists("%s/athfile-cache.ascii.gz" % (os.getcwd())):
        print "Old athfile-cache found. Will delete it otherwise athena just freaks out. This little boy"
        os.system("rm %s/athfile-cache.ascii.gz" % (os.getcwd()))
    from GaudiSvc.GaudiSvcConf import THistSvc
    from AthenaCommon.JobProperties import jobproperties
    import AthenaPoolCnvSvc.ReadAthenaPool
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
    from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
    from AthenaCommon.AppMgr import ServiceMgr
    from RecExConfig import AutoConfiguration
    from PathResolver import PathResolver
    from XAMPPbase.Utils import ReadListFromFile
    ServiceMgr += AthenaEventLoopMgr(EventPrintoutInterval=5000)

    ServiceMgr += THistSvc()
    OutFileName = "AnalysisOutput.root" if not "outFile" in globals(
    ) else outFile
    ServiceMgr.THistSvc.Output += [
        "XAMPP DATAFILE='{}' OPT='RECREATE'".format(OutFileName)
    ]
    ROOTFiles = []

    if "inputFile" in globals():
        print "Use the following %s as input" % (inputFile)
        ROOTFiles = []
        ResolvedInFile = PathResolver.FindCalibFile(inputFile)
        ReolvedInDir = PathResolver.FindCalibDirectory(inputFile)
        if os.path.isfile(ResolvedInFile):
            if IsTextFile(ResolvedInFile):
                ROOTFiles = ReadListFromFile(ResolvedInFile)
            else:
                ROOTFiles.append(ResolvedInFile)

        elif os.path.isdir(ReolvedInDir):
            for DirEnt in os.listdir(ReolvedInDir):
                if DirEnt.endswith(".root"):
                    ROOTFiles.append(DirEnt)
        else:
            raise RuntimeError("Invalid input " + inputFile)
        if len(ROOTFiles) == 0:
            raise RuntimeError("No ROOT files could be loaded as input")
        ServiceMgr.EventSelector.InputCollections = ROOTFiles
        acf.FilesInput = ROOTFiles

    if len(ROOTFiles) > 0: AutoConfiguration.ConfigureSimulationOrRealData()
    if "nevents" in globals():
        print "Only run on %i events" % (int(nevents))
        theApp.EvtMax = int(nevents)
    if "nskip" in globals():
        print "Skip the first %i events" % (int(nskip))
        ServiceMgr.EventSelector.SkipEvents = int(nksip)
    if isData(): print "INFO: We're running over data today"
    elif isAF2():
        print "INFO: Please fasten your seatbelt the journey will be on Atlas fast "
示例#2
0
    def _apply_cfg(self):
        cfg = self.cfgopts[:]

        self.acf['FilesInput'] = self.input_files[:]

        from AthenaCommon.AthenaCommonFlags import jobproperties as jp
        acf = jp.AthenaCommonFlags
        for k, v in self.acf.iteritems():
            getattr(acf, k).set_Value_and_Lock(v)

        from RecExConfig.RecFlags import rec
        for k, v in self.rec.iteritems():
            globals()[k] = False  # FIXME: backward compat...
            getattr(rec, k).set_Value_and_Lock(v)

        rec.AutoConfiguration = cfg
        import RecExConfig.AutoConfiguration as auto
        if (self.is_rdo() or self.is_esd() or self.is_aod() or self.is_tag()):
            # FIXME: autocfg fails when input is Stream1-evgen !
            return auto.ConfigureFromListOfKeys(rec.AutoConfiguration())
        else:
            from AthenaCommon.AppMgr import ServiceMgr as svcMgr
            import AthenaPoolCnvSvc.ReadAthenaPool
            svcMgr.EventSelector.InputCollections = acf.FilesInput()
示例#3
0
#---------------------------------------------------------------------------------#

# Make sure PerfMon is off
include( "PerfMonGPerfTools/DisablePerfMon_jobOFragment.py" )

# Input file
dataFile = "/afs/cern.ch/atlas/project/rig/referencefiles/MC/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.e3099_s2578/RDO.04919495._000958.pool.root.1"

from AthenaCommon.AthenaCommonFlags  import athenaCommonFlags
athenaCommonFlags.FilesInput=[dataFile,dataFile]

# AutoConfiguration
from RecExConfig.RecFlags import rec
rec.AutoConfiguration = ['everything']
import RecExConfig.AutoConfiguration as auto
auto.ConfigureFromListOfKeys(rec.AutoConfiguration())

from RecExConfig.ObjKeyStore import objKeyStore, CfgKeyStore
from PyUtils.MetaReaderPeeker import convert_itemList
objKeyStore.addManyTypesInputFile(convert_itemList(layout = '#join'))

#---------------------------------------------------------------------------------#
# Detector Description
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit

from LArGeoAlgsNV.LArGeoAlgsNVConf import LArDetectorToolNV
from TileGeoModel.TileGeoModelConf import TileDetectorTool

ServiceMgr.GeoModelSvc.DetectorTools += [ LArDetectorToolNV(ApplyAlignments = True, GeometryConfig = "RECO"),
                                          TileDetectorTool(GeometryConfig = "RECO")