コード例 #1
0
def AssembleIO():
    #--------------------------------------------------------------
    # Reduce the event loop spam a bit
    #--------------------------------------------------------------
    from AthenaCommon.Logging import logging
    recoLog = logging.getLogger('MuonAnalysis I/O')
    recoLog.info('****************** STARTING the job *****************')

    if os.path.exists("%s/athfile-cache.ascii.gz" % (os.getcwd())):
        recoLog.info(
            "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 ClusterSubmission.Utils import ReadListFromFile, ResolvePath, IsROOTFile
    from MuonAnalysis.Utils import IsTextFile
    ServiceMgr += AthenaEventLoopMgr(EventPrintoutInterval=1000000)

    ServiceMgr += THistSvc()
    OutFileName = "AnalysisOutput.root" if not "outFile" in globals(
    ) else outFile
    ServiceMgr.THistSvc.Output += [
        "MuonAnalysis DATAFILE='{}' OPT='RECREATE'".format(OutFileName)
    ]
    recoLog.info("Will save the job's output to " + OutFileName)
    ROOTFiles = []

    if "inputFile" in globals():
        recoLog.info("Use the following %s as input" % (inputFile))
        ROOTFiles = []
        ResolvedInFile = ResolvePath(inputFile)

        if inputFile.startswith('root://'):
            ROOTFiles.append(inputFile)

        elif ResolvedInFile and os.path.isfile(ResolvedInFile):
            if IsTextFile(ResolvedInFile):
                ROOTFiles = ReadListFromFile(ResolvedInFile)
            else:
                ROOTFiles.append(ResolvedInFile)

        elif ResolvedInFile and os.path.isdir(ResolvedInFile):
            for DirEnt in os.listdir(ResolvedInFile):
                if IsROOTFile(DirEnt):
                    if DirEnt.find(ResolvedInFile) != -1:
                        ROOTFiles.append(DirEnt)
                    else:
                        ROOTFiles.append("%s/%s" % (ResolvedInFile, 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 "nevents" in globals():
        recoLog.info("Only run on %i events" % (int(nevents)))
        theApp.EvtMax = int(nevents)
    if "nskip" in globals():
        recoLog.info("Skip the first %i events" % (int(nskip)))
        ServiceMgr.EventSelector.SkipEvents = int(nskip)
    """if isData(): recoLog.info("We're running over data today")
コード例 #2
0
#------------------------------------------------------------------------------
from AthenaCommon.AppMgr import ServiceMgr
import AthenaPoolCnvSvc.ReadAthenaPool

ServiceMgr.EventSelector.InputCollections = inputFiles
print ServiceMgr.EventSelector.InputCollections

if 'EvtMax' in dir():
    theApp.EvtMax = EvtMax
else:
    theApp.EvtMax = -1

#------------------------------------------------------------------------------
if not hasattr(ServiceMgr, 'AthenaEventLoopMg'):
    from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
    ServiceMgr += AthenaEventLoopMgr(EventPrintoutInterval = 100)

if 'dumpSG' in dir():
    StoreGateSvc = Service('StoreGateSvc')
    StoreGateSvc.Dump = dumpSG

#------------------------------------------------------------------------------
muon_sf  = CfgMgr.CP__MuonTriggerScaleFactors('muonTrigSFs', OutputLevel = INFO)

#muon_sf.filename = "/pc2012-data2/rustem/testarea/AtlasMuon/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/share/muon_trigger_eff_jun30.root"

ToolSvc += muon_sf

#------------------------------------------------------------------------------
def getTestMuon(input_name):
コード例 #3
0
                                                   "TileRawChannelContainer/TileRawChannelCnt",
                                                   "CTP_RDO/CTP_RDO",
                                                   "CTP_RIO/CTP_RIO",
                                                  ]


svcMgr.MessageSvc.defaultLimit= MsgLinesLimit
svcMgr.MessageSvc.OutputLevel = OutputLevel
svcMgr.MessageSvc.Format = "% F%35W%S%7W%R%T %0W%M"
svcMgr.MessageSvc.useColors = useColors
#svcMgr.HistorySvc.OutputLevel = 3

theApp.EvtMax = EvtMax

from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
svcMgr += AthenaEventLoopMgr()
svcMgr.AthenaEventLoopMgr.EventPrintoutInterval = 100

if TileUseCOOL:
    from DBReplicaSvc.DBReplicaSvcConf import DBReplicaSvc
    svcMgr += DBReplicaSvc(UseCOOLSQLite=False)

if hasattr (svcMgr.ToolSvc, 'TileRawChannelBuilderOpt2Filter') and False:
    svcMgr.ToolSvc.TileRawChannelBuilderOpt2Filter.OutputLevel = DEBUG


if hasattr (svcMgr.ToolSvc, 'TileCellBuilder') and False:
    svcMgr.ToolSvc.TileCellBuilder.OutputLevel = DEBUG


コード例 #4
0
# If not defined the defaults given above are used
for var in loadInDetRec_Options:
    if var in dir():
        loadInDetRec_Options[var] = eval(var)

print "Starting loadInDet_Rec"

#--------------------------------------------------------------
# Import config
#--------------------------------------------------------------
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
from RecExConfig.RecFlags import rec
from RecExConfig.RecAlgsFlags import recAlgs

from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr
ServiceMgr += AthenaEventLoopMgr()
ServiceMgr.AthenaEventLoopMgr.EventPrintoutInterval = 100

#--------------------------------------------------------------------------------
#Setup jobProperties  - Override Autoconfiguration of the BField. Needed for MC BOFF-
#--------------------------------------------------------------------------------
from AthenaCommon.BeamFlags import jobproperties
from AthenaCommon.BFieldFlags import jobproperties
if not loadInDetRec_Options["realData"] and loadInDetRec_Options[
        "Cosmics"]:  # and not loadInDetRec_Options["BField"] PF: I think this causes the wrong setup in Cosmics MC
    print "INFO::Setting Up Manually for MC Cosmics"
    jobproperties.Beam.numberOfCollisions.set_Value_and_Lock(0.0)
    jobproperties.Beam.beamType.set_Value_and_Lock("cosmics")
    jobproperties.BField.solenoidOn.set_Value_and_Lock(
        loadInDetRec_Options["BField"])
    jobproperties.BField.barrelToroidOn.set_Value_and_Lock(
コード例 #5
0
class WasteTimeAlg(PyAlgorithm):
    def execute(self):
        printfunc("waste some time")
        for i in range(200000):
            foo = i * i / (i + 1) / (i + 2)
        return 1


waste = WasteTimeAlg()
import ROOT
ROOT.SetOwnership(waste, 0)

include("AthenaServices/SimplePOSIXTimeKeeperOptions.py")

from AthenaCommon.AlgSequence import AlgSequence
from AthenaCommon.Configurable import ConfigurablePyAlgorithm
top = AlgSequence()
top += ConfigurablePyAlgorithm('WasteTimeAlg')

from AthenaCommon.AppMgr import ServiceMgr
from AthenaServices.AthenaServicesConf import SimplePOSIXTimeKeeperSvc, AthenaEventLoopMgr

ServiceMgr += SimplePOSIXTimeKeeperSvc()
ServiceMgr.SimplePOSIXTimeKeeperSvc.OutputLevel = 1
ServiceMgr.SimplePOSIXTimeKeeperSvc.AllocTime = 6

ServiceMgr += AthenaEventLoopMgr(TimeKeeper="SimplePOSIXTimeKeeperSvc")

#from GaudiSvc.GaudiSvcConf import MessageSvc
#ServiceMgr.MessageSvc.OutputLevel = 2