예제 #1
0
#--------------------------------------------------------------
# Load Geometry
#--------------------------------------------------------------
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetDescrVersion = "ATLAS-R2-2015-03-01-00"
globalflags.DetGeo = "atlas"
globalflags.InputFormat = "pool"
globalflags.DataSource = "geant4"
msg.info(globalflags)

#--------------------------------------------------------------
# Set Detector setup
#--------------------------------------------------------------
# --- switch on InnerDetector
from AthenaCommon.DetFlags import DetFlags
DetFlags.ID_setOff()
DetFlags.Calo_setOff()
DetFlags.Muon_setOff()
DetFlags.Truth_setOff()
DetFlags.LVL1_setOff()
DetFlags.SCT_setOn()

# ---- switch parts of ID off/on as follows
#switch off tasks
DetFlags.pileup.all_setOff()
DetFlags.simulate.all_setOff()
DetFlags.makeRIO.all_setOff()
DetFlags.writeBS.all_setOff()
DetFlags.readRDOBS.all_setOff()
DetFlags.readRIOBS.all_setOff()
DetFlags.readRIOPool.all_setOff()
from AthenaCommon.GlobalFlags import GlobalFlags
GlobalFlags.DetGeo.set_atlas()
if InDetCosmicFlags.doSim:
    # Reading G4 simulated data from Pool
    GlobalFlags.DataSource.set_geant4()
    GlobalFlags.InputFormat.set_pool()
else:
    # Reading ByteStream real data
    GlobalFlags.DataSource.set_data()
    GlobalFlags.InputFormat.set_bytestream()

# ----------------------------------
# import DetFlags from AthenaCommon
# ----------------------------------
from AthenaCommon.DetFlags import DetFlags
DetFlags.pixel_setOn()
DetFlags.SCT_setOn()
DetFlags.TRT_setOn()

DetFlags.detdescr.pixel_setOn()
DetFlags.detdescr.SCT_setOn()
DetFlags.detdescr.TRT_setOn()
DetFlags.readRDOBS.pixel_setOff()
DetFlags.readRDOBS.SCT_setOff()
DetFlags.readRDOBS.TRT_setOff()
DetFlags.makeRIO.pixel_setOff()
DetFlags.makeRIO.SCT_setOff()
DetFlags.makeRIO.TRT_setOff()
DetFlags.Print()
#
# Access to IOVDbSvc
예제 #3
0
svcMgr.AthenaPoolCnvSvc.PoolAttributes += ["STREAM_MEMBER_WISE = '1'"]
svcMgr.AthenaPoolCnvSvc.PoolAttributes += ["DEFAULT_BUFFERSIZE = '32000'"]
svcMgr.AthenaPoolCnvSvc.PoolAttributes += [
    "ContainerName = 'TTree=POOLContainer'; TREE_AUTO_FLUSH = '0'"
]

from OutputStreamAthenaPool.CreateOutputStreams import AthenaPoolOutputStream
ostream = AthenaPoolOutputStream("StreamRDO",
                                 athenaCommonFlags.PoolRDOOutput(), True)

ostream.TakeItemsFromInput = True

ostream.ItemList += [
    n.replace("/", "#") for n in svcMgr.ByteStreamAddressProviderSvc.TypeNames
]

#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
# Print some post output post config
#-------------------------------------------------------------------------------
print(svcMgr)

print(topSequence)

print(DetFlags.Print())

svcMgr.MessageSvc.debugLimit = 500000000

svcMgr.InputMetaDataStore.Dump = True
예제 #4
0
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
from AthenaCommon import CfgMgr
toolSvc = CfgMgr.ToolSvc()

# set global flags
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetGeo.set_Value_and_Lock('commis')
globalflags.DataSource.set_Value_and_Lock('data')
globalflags.InputFormat.set_Value_and_Lock('bytestream')

from AthenaCommon.BeamFlags import jobproperties
jobproperties.Beam.beamType.set_Value_and_Lock(beamType)

# reset everything which is not needed
from AthenaCommon.DetFlags import DetFlags
DetFlags.Calo_setOff()  #Switched off to avoid geometry
DetFlags.ID_setOff()
DetFlags.Muon_setOff()
DetFlags.Truth_setOff()
DetFlags.LVL1_setOff()
DetFlags.digitize.all_setOff()

DetFlags.detdescr.ID_setOff()
DetFlags.detdescr.Muon_setOff()
DetFlags.detdescr.LAr_setOn()
DetFlags.detdescr.Tile_setOn()
DetFlags.readRDOBS.Tile_setOn()

if CheckDCS:
    DetFlags.dcs.Tile_setOn()
else:
예제 #5
0
def getATLAS(name="Atlas", **kwargs):
    kwargs.setdefault("DetectorName", "Atlas")
    kwargs.setdefault("NSurfaces", 18)
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    ## InnerRadii
    innerRadii = [0.0] * 18
    kwargs.setdefault("InnerRadii", innerRadii)

    ## Shrink the global ATLAS envelope to the activated detectors,
    ## except when running on special setups.

    ## OuterRadii
    AtlasForwardOuterR = 2751.
    AtlasOuterR1 = 14201.
    AtlasOuterR2 = 14201.
    #AtlasOuterR3 =  1501.
    if not DetFlags.Muon_on() and not simFlags.SimulateCavern.get_Value():
        AtlasOuterR1 = 4251.
        AtlasOuterR2 = 4251.
        if not DetFlags.Calo_on():
            AtlasOuterR1 = 1150.
            AtlasOuterR2 = 1150.

    outerRadii = [0.0] * 18
    for i in (0, 1, 16, 17):
        outerRadii[i] = 1501.
    for i in (2, 3, 14, 15):
        outerRadii[i] = AtlasForwardOuterR
    for i in (4, 5, 12, 13):
        outerRadii[i] = AtlasOuterR2
    for i in xrange(6, 12):
        outerRadii[i] = AtlasOuterR1

    ## World R range
    if simFlags.WorldRRange.statusOn:
        if simFlags.WorldRRange.get_Value() > max(AtlasOuterR1, AtlasOuterR2):
            routValue = simFlags.WorldRRange.get_Value()
            for i in xrange(4, 14):
                outerRadii[i] = routValue
        else:
            raise RuntimeError(
                'getATLASEnvelope: ERROR simFlags.WorldRRange must be > %f. Current value %f',
                max(AtlasOuterR1, AtlasOuterR2), routValue)
    kwargs.setdefault("OuterRadii", outerRadii)

    ## ZSurfaces
    zSurfaces = [
        -26046., -23001., -23001., -22031., -22031., -12899., -12899., -6741.,
        -6741., 6741., 6741., 12899., 12899., 22031., 22031., 23001., 23001.,
        26046.
    ]  # FIXME units mm??

    if simFlags.ForwardDetectors.statusOn:
        zSurfaces[0] = -400000.
        zSurfaces[17] = 400000.

    if simFlags.WorldZRange.statusOn:
        if simFlags.WorldZRange.get_Value() < 26046.:
            raise RuntimeError(
                'getATLASEnvelope: ERROR simFlags.WorldZRange must be > 26046. Current value: %f',
                simFlags.WorldZRange.get_Value())
        zSurfaces[17] = simFlags.WorldZRange.get_Value() + 100.
        zSurfaces[16] = simFlags.WorldZRange.get_Value() + 50.
        zSurfaces[15] = simFlags.WorldZRange.get_Value() + 50.
        zSurfaces[14] = simFlags.WorldZRange.get_Value()
        zSurfaces[13] = simFlags.WorldZRange.get_Value()
        zSurfaces[0] = -simFlags.WorldZRange.get_Value() - 100.
        zSurfaces[1] = -simFlags.WorldZRange.get_Value() - 50.
        zSurfaces[2] = -simFlags.WorldZRange.get_Value() - 50.
        zSurfaces[3] = -simFlags.WorldZRange.get_Value()
        zSurfaces[4] = -simFlags.WorldZRange.get_Value()
    kwargs.setdefault("ZSurfaces", zSurfaces)
    kwargs.setdefault("SubDetectors", generateSubDetectorList())
    return CfgMgr.PolyconicalEnvelope(name, **kwargs)
예제 #6
0
#==============================================================
#
# Job options file for Geant4 Simulations
#
# Atlas simulation 
#
#==============================================================

## Algorithm sequence
from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

#--- Detector flags -------------------------------------------
from AthenaCommon.DetFlags import DetFlags
# - Select detectors 
DetFlags.ID_setOff()
DetFlags.Calo_setOn()
DetFlags.Muon_setOff()
DetFlags.Truth_setOn()

#--- Global conditions tag ------------------------------------
from AthenaCommon.GlobalFlags import globalflags
globalflags.ConditionsTag = "OFLCOND-SDR-BS7T-05-07"

#--- AthenaCommon flags ---------------------------------------
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
#athenaCommonFlags.PoolHitsOutput='atlas_MyOutputFile.root'
athenaCommonFlags.PoolHitsOutput='atlas_MyOutputFile.pool.root'
athenaCommonFlags.EvtMax =50
athenaCommonFlags.PoolEvgenInput.set_Off()
예제 #7
0
    if runArgs.doAllNoise!="NONE":
        digilog.info('doAllNoise = %s: Overriding doInDetNoise, doCaloNoise and doMuonNoise', runArgs.doAllNoise)
        if runArgs.doAllNoise=="True":
            digitizationFlags.doInDetNoise=True
            digitizationFlags.doCaloNoise=True
            digitizationFlags.doMuonNoise=True
        else:
            digitizationFlags.doInDetNoise=False
            digitizationFlags.doCaloNoise=False
            digitizationFlags.doMuonNoise=False

if hasattr(runArgs,"LucidOn") or hasattr(runArgs,"ALFAOn") or hasattr(runArgs,"ZDCOn") or hasattr(runArgs,"AFPOn") or hasattr(runArgs,"FwdRegionOn") or hasattr(runArgs,"HGTDOn"):
    if not 'DetFlags' in dir():
        #if you configure one detflag, you're responsible for configuring them all!
        from AthenaCommon.DetFlags import DetFlags
        DetFlags.all_setOn()
        DetFlags.ALFA_setOff() #Default for now
        DetFlags.ZDC_setOff() #Default for now
        DetFlags.AFP_setOff() #Default for now
        DetFlags.FwdRegion_setOff() #Default for now
        checkHGTDOff = getattr(DetFlags, 'HGTD_setOff', None)
        if checkHGTDOff is not None:
            checkHGTDOff() #Default for now


    if hasattr(runArgs,"LucidOn"):
        if not runArgs.LucidOn:
            DetFlags.Lucid_setOff()
    if hasattr(runArgs,"ALFAOn"):
        if runArgs.ALFAOn:
            DetFlags.ALFA_setOn()
예제 #8
0
def CaloNoiseToolDefault(flag='',name='CaloNoiseToolDefault'):

    # check if tool already exists
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if hasattr(svcMgr.ToolSvc, name):
        # re-use previously configured (public) tool
        return getattr(svcMgr.ToolSvc, name)

    mlog = logging.getLogger( 'CaloNoiseToolDefault' )

    if flag=='db' :
       _useDB = True
    elif flag=='tool' :
       _useDB = False
    else :
       # will put here logic to select according to global flag
       from AthenaCommon.GlobalFlags import globalflags
       from AthenaCommon.BeamFlags import jobproperties
       if globalflags.DataSource()=='data' and globalflags.DetGeo()!='ctbh6' and globalflags.DetGeo()!='ctbh8':
           _useDB = True
       elif globalflags.DataSource()=='geant4' and jobproperties.Beam.zeroLuminosity():
           _useDB = True
       else:
          # now uses also calonoisetoolDB for MC with pileup.. requires a new global tag for pileup reco to have the noise properly read
           _useDB = True

    if _useDB :
        mlog.info(" Using CaloNoiseToolDB" )
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource()=='data':
            from CaloTools.CaloNoiseToolDBData import CaloNoiseToolDBData
            theTool = CaloNoiseToolDBData(name)
        else:
            from CaloTools.CaloNoiseToolDBMC import CaloNoiseToolDBMC
            theTool = CaloNoiseToolDBMC(name)
        return theTool
    else :
        mlog.info("Using CaloNoiseTool")
        from CaloTools.CaloToolsConf import CaloNoiseTool
        # Tile configuration
        from AthenaCommon.DetFlags      import DetFlags
        if DetFlags.Tile_on():
            from TileConditions.TileInfoConfigurator import TileInfoConfigurator
            tileInfoConfigurator = TileInfoConfigurator()
            tileInfoConfigurator.setupCOOL()
            UseTile = True
        else:
            UseTile = False
        
        # CaloNoiseTool configuration
        WorkMode=1
        WithOF=True
        TileInfoName="TileInfo"
        # get public tool LArADC2MeVTool
        from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
        theADC2MeVTool = LArADC2MeVToolDefault()
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += theADC2MeVTool
        # get public tool LArOFCTool
        from LArRecUtils.LArOFCToolDefault import LArOFCToolDefault
        theOFCTool = LArOFCToolDefault()
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += theOFCTool
        from AthenaCommon.BeamFlags import jobproperties
        if jobproperties.Beam.zeroLuminosity(): 
            ReturnNoise="electronicNoise"
            NMinBias=0
            deltaBunch=1
        else:
            ReturnNoise="totalNoise"
            NMinBias=jobproperties.Beam.numberOfCollisions()
            deltaBunch=int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5)
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource()=='data':
            IsMC = False
            UseSymmetry= False
        else:
            IsMC = True
            UseSymmetry= True

        from LArROD.LArRODFlags import larRODFlags
        theTool = CaloNoiseTool(name,
                          WorkMode = WorkMode,
                          WithOF = WithOF,
                          UseTile = UseTile,
                          TileInfoName = TileInfoName,
                          LArADC2MeVTool = theADC2MeVTool,
                          LArOFCTool = theOFCTool,
                          ReturnNoise = ReturnNoise,
                          NMinBias = NMinBias,
                          deltaBunch = deltaBunch,
                          IsMC = IsMC,
                          UseSymmetry = UseSymmetry,
                          firstSample=larRODFlags.firstSample())
        return theTool
예제 #9
0
    def hits_persistency():
        """ HITS POOL file persistency
        """
        from G4AtlasApps.SimFlags import simFlags
        from AthenaCommon.DetFlags import DetFlags
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream

        ## Not yet understood, but need to treat StreamHITS as alg in Hive.
        ## Seems to also work fine outside of Hive, but to be extra safe I'm
        ## only changing it in Hive.
        from AthenaCommon.ConcurrencyFlags import jobproperties as concurrencyProps
        if concurrencyProps.ConcurrencyFlags.NumThreads() > 0:
            as_alg = True
        else:
            as_alg = False
        ## NB. Two-arg constructor is needed, since otherwise metadata writing fails!
        stream1 = AthenaPoolOutputStream("StreamHITS",
                                         athenaCommonFlags.PoolHitsOutput(),
                                         asAlg=as_alg,
                                         noTag=True)

        ## Write geometry tag info - move to main method
        #import EventInfoMgt.EventInfoMgtInit

        ## EventInfo & TruthEvent always written by default
        stream1.ItemList = [
            "EventInfo#*", "McEventCollection#TruthEvent", "JetCollection#*"
        ]

        ## If we are running quasi-stable particle simulation, include the original event record
        if hasattr(
                simFlags, 'IncludeParentsInG4Event'
        ) and simFlags.IncludeParentsInG4Event.statusOn and simFlags.IncludeParentsInG4Event(
        ):
            stream1.ItemList += ["McEventCollection#GEN_EVENT"]

        stream1.ItemList += ["xAOD::JetContainer#*", "xAOD::JetAuxContainer#*"]

        ## Make stream aware of aborted events
        stream1.AcceptAlgs = ["G4AtlasAlg"]

        ## Detectors

        ## Inner Detector
        if DetFlags.ID_on():
            stream1.ItemList += [
                "SiHitCollection#*", "TRTUncompressedHitCollection#*",
                "TrackRecordCollection#CaloEntryLayer"
            ]
        ## Calo
        if DetFlags.Calo_on():
            stream1.ItemList += [
                "CaloCalibrationHitContainer#*",
                "LArHitContainer#*",
                "TileHitVector#*",
                #"SimpleScintillatorHitCollection#*",
                "TrackRecordCollection#MuonEntryLayer"
            ]
        ## Muon
        if DetFlags.Muon_on():
            stream1.ItemList += [
                "RPCSimHitCollection#*", "TGCSimHitCollection#*",
                "MDTSimHitCollection#*", "TrackRecordCollection#MuonExitLayer"
            ]
            if MuonGeometryFlags.hasCSC():
                stream1.ItemList += ["CSCSimHitCollection#*"]
            if MuonGeometryFlags.hasSTGC():
                stream1.ItemList += ["sTGCSimHitCollection#*"]
            if MuonGeometryFlags.hasMM():
                stream1.ItemList += ["MMSimHitCollection#*"]

        ## Lucid
        if DetFlags.Lucid_on():
            stream1.ItemList += ["LUCID_SimHitCollection#*"]

        ## FwdRegion
        if DetFlags.FwdRegion_on():
            stream1.ItemList += ["SimulationHitCollection#*"]

        ## ZDC
        if DetFlags.ZDC_on():
            stream1.ItemList += [
                "ZDC_SimPixelHit_Collection#*", "ZDC_SimStripHit_Collection#*"
            ]
        ## ALFA
        if DetFlags.ALFA_on():
            stream1.ItemList += [
                "ALFA_HitCollection#*", "ALFA_ODHitCollection#*"
            ]

        ## AFP
        if DetFlags.AFP_on():
            stream1.ItemList += [
                "AFP_TDSimHitCollection#*", "AFP_SIDSimHitCollection#*"
            ]

        ### Ancillary scintillators
        #stream1.ItemList += ["ScintillatorHitCollection#*"]

        ## TimingAlg
        stream1.ItemList += ["RecoTimingObj#EVNTtoHITS_timings"]

        ## Add cosmics and test beam configuration hit persistency if required cf. geom tag
        layout = simFlags.SimLayout.get_Value()
        if "tb" not in layout:
            from AthenaCommon.BeamFlags import jobproperties
            if jobproperties.Beam.beamType() == 'cosmics' or \
                    (hasattr(simFlags, "WriteTR") and simFlags.WriteTR.statusOn) or \
                    (hasattr(simFlags, "ReadTR") and simFlags.ReadTR.statusOn):
                stream1.ItemList += [
                    "TrackRecordCollection#CosmicRecord",
                    "TrackRecordCollection#CosmicPerigee"
                ]
        else:
            ## CTB-specific
            if layout.startswith("ctb"):
                if simFlags.LArFarUpstreamMaterial.statusOn and simFlags.LArFarUpstreamMaterial.get_Value(
                ):
                    stream1.ItemList.append(
                        "TrackRecordCollection#LArFarUpstreamMaterialExitLayer"
                    )
            ## Persistency of test-beam layout
            if layout.startswith('ctb') or layout.startswith('tb_Tile2000_'):
                stream1.ItemList += ["TBElementContainer#*"]
예제 #10
0
# note: some of these tests will need an active DecDescManager
#       so please use something like
#             preExec='simFlags.ReleaseGeoModel=False;'
#       with your transform
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()

if not hasattr(job, 'G4TestAlg'):
    from G4AtlasTests.G4AtlasTestsConf import G4TestAlg
    job += G4TestAlg()
from AthenaCommon.DetFlags import DetFlags
from G4AtlasApps.SimFlags import simFlags
simFlags.ReleaseGeoModel = False

from AthenaCommon import CfgGetter
if DetFlags.Truth_on():
    job.G4TestAlg.SimTestTools += [
        CfgGetter.getPrivateTool("TruthTestTool", checkType=True)
    ]
    job.G4TestAlg.SimTestTools += [
        CfgGetter.getPrivateTool("EvgenTruthTestTool", checkType=True)
    ]
    job.G4TestAlg.SimTestTools += [
        CfgGetter.getPrivateTool("PileupTruthTestTool", checkType=True)
    ]
    job.G4TestAlg.SimTestTools += [
        CfgGetter.getPrivateTool("PileupEvgenTruthTestTool", checkType=True)
    ]
if DetFlags.pixel_on():
    job.G4TestAlg.SimTestTools += [
        CfgGetter.getPrivateTool("PixelHitsTestTool", checkType=True)
예제 #11
0
## Global flags needed by externals
from AthenaCommon.GlobalFlags import globalflags

globalflags.DataSource = 'geant4'
if jobproperties.Beam.beamType() == 'cosmics':
    globalflags.DetGeo = 'commis'
else:
    globalflags.DetGeo = 'atlas'

## At this point we can set the global job properties flag
globalflags.DetDescrVersion = simFlags.SimLayout.get_Value()

from AthenaCommon.DetFlags import DetFlags
## Tidy up DBM DetFlags: temporary measure
DetFlags.DBM_setOff()

from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff()
if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_setOff()
if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff()

## Switch off tasks
DetFlags.pileup.all_setOff()
DetFlags.simulateLVL1.all_setOff()
DetFlags.digitize.all_setOff()
if not simFlags.IsEventOverlayInputSim():
    DetFlags.overlay.all_setOff()
DetFlags.readRDOPool.all_setOff()
DetFlags.makeRIO.all_setOff()
DetFlags.writeBS.all_setOff()
예제 #12
0
from AthenaCommon.Logging import logging
log = logging.getLogger()
log.info("importing module %r", __name__)

from AthenaCommon.GlobalFlags import globalflags
from MuonByteStream.MuonByteStreamFlags import muonByteStreamFlags
from AthenaCommon.AppMgr import theApp, ToolSvc, ServiceMgr
from AthenaCommon.DetFlags import DetFlags
from RecExConfig.RecFlags import rec as recFlags
from MuonCnvExample.MuonCnvFlags import muonCnvFlags

from AthenaCommon.AlgSequence import AthSequencer
from MuonMDT_Cabling.MuonMDT_CablingConf import MuonMDT_CablingAlg
condSequence = AthSequencer("AthCondSeq")
if DetFlags.MDT_on():
    condSequence += MuonMDT_CablingAlg("MuonMDT_CablingAlg")

# defaults have to be re-set now since the jobproperties and trigger flags are now available # SS
muonCnvFlags.setDefaults()

if globalflags.DataSource() == 'data':
    # TODO: move these flags to this package - or remove them altogether
    muonByteStreamFlags.TgcDataType = "atlas"
    muonByteStreamFlags.RpcDataType = "atlas"
    muonByteStreamFlags.MdtDataType = "atlas"

log.info("configuring Muon cabling in MuonCablingConfig")
if DetFlags.readRDOBS.RPC_on() or DetFlags.readRDOPool.RPC_on(
) or DetFlags.readRIOPool.RPC_on() or DetFlags.digitize.RPC_on():
    try:
예제 #13
0
if "GlobalTag" not in dir():
    GlobalTag = 'COMCOND-BLKPA-2017-09'

if "Geometry" not in dir():
    Geometry = 'ATLAS-R2-2015-04-00-00'

from RecExConfig.RecFlags import rec
rec.RunNumber.set_Value_and_Lock(int(RunNumberOld))

from PerfMonComps.PerfMonFlags import jobproperties
jobproperties.PerfMonFlags.doMonitoring = True
from AthenaCommon.Resilience import protectedInclude
protectedInclude("PerfMonComps/PerfMonSvc_jobOptions.py")

from AthenaCommon.DetFlags import DetFlags
DetFlags.all_setOff()
DetFlags.LAr_setOn()
DetFlags.Tile_setOn()
DetFlags.digitize.all_setOff()

from AthenaCommon.GlobalFlags import globalflags
globalflags.DetGeo.set_Value_and_Lock('atlas')
globalflags.DataSource.set_Value_and_Lock('data')
globalflags.DatabaseInstance.set_Value_and_Lock("CONDBR2")

# for scaling purposes, we need fixed 1
from CaloTools.CaloNoiseFlags import jobproperties
jobproperties.CaloNoiseFlags.FixedLuminosity.set_Value_and_Lock(1)

import AthenaCommon.AtlasUnixGeneratorJob
#--- set geometry version
globalflags.DetDescrVersion = GeometryTag
#--- printout
globalflags.print_JobProperties()

#--- beam flag : default is zero luminosity
from AthenaCommon.BeamFlags import jobproperties
jobproperties.Beam.numberOfCollisions = 0.0
jobproperties.Beam.beamType           = beamType

#--------------------------------------------------------------
# Set Detector setup
#--------------------------------------------------------------
from AthenaCommon.DetFlags import DetFlags
#--- switch on SCT only
DetFlags.all_setOff()
DetFlags.SCT_setOn()
#--- for the conditions access
DetFlags.haveRIO.SCT_on()
#--- for the cabling
DetFlags.detdescr.SCT_on()
#--- printout
DetFlags.Print()

#set variable projectName
#we need it to extract the year from the run
#else execution fails
from RecExConfig.RecFlags import rec
filelist=runArgs.inputNames
n=filelist[0].count('/')
filename=filelist[0].split('/')[n]
예제 #15
0
athenaCommonFlags.BSRDOInput.set_Value_and_Lock(runArgs.inputBS_OLDFile)
athenaCommonFlags.BSRDOOutput.set_Value_and_Lock(runArgs.outputBS_TRIG_OLDFile)

athenaCommonFlags.FilesInput = runArgs.inputBS_OLDFile
globalflags.InputFormat = 'bytestream'
globalflags.DataSource = 'geant4'
if hasattr(runArgs, "maxEvents"):
    athenaCommonFlags.EvtMax.set_Value_and_Lock(runArgs.maxEvents)
if hasattr(runArgs, "skipEvents"):
    athenaCommonFlags.SkipEvents.set_Value_and_Lock(runArgs.skipEvents)

print '################################################'
print runArgs.triggerConfig

print '########### DetFlags before ###############'
DetFlags.Print()
DetFlags.detdescr.all_setOn()
DetFlags.all_setOn()
include("RecExCond/AllDet_detDescr.py")
print '########### DetFlags after ###############'
DetFlags.Print()
include.block("RecExCond/RecExCommon_flags.py")
TriggerFlags.doID = True
TriggerFlags.doMuon = True
TriggerFlags.doCalo = True
TriggerFlags.doCalo = True
TriggerFlags.writeBS = True
#TriggerFlags.doID():
from InDetTrigRecExample.InDetTrigConfigConditions import \
         PixelConditionsSetup, SCT_ConditionsSetup, TRT_ConditionsSetup
#
ServiceMgr.MessageSvc.OutputLevel = DEBUG

from AthenaCommon.DetFlags import DetFlags
DetFlags.bpipe_setOn()
DetFlags.ALFA_setOn()

from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolEvgenInput = ['evnt.ALFA.pool.root']
athenaCommonFlags.PoolHitsOutput = "hits.ALFA.pool.root"
athenaCommonFlags.EvtMax = 10

from G4AtlasApps.SimFlags import simFlags
simFlags.load_atlas_flags()
simFlags.EventFilter.set_Off()
simFlags.MagneticField.set_Off()
simFlags.ForwardDetectors.set_On()
simFlags.ForwardDetectors = 2

from AthenaCommon.AlgSequence import AlgSequence
topSeq = AlgSequence()

include("G4AtlasApps/G4Atlas.flat.configuration.py")

from AthenaCommon.CfgGetter import getAlgorithm
topSeq += getAlgorithm("G4AtlasAlg", tryDefaultConfigurable=True)

include(
    "ForwardTransportSvc/preInclude.ForwardTransportFlags_4.0TeV_0090.00m_nominal_v01.py"
)
include("ForwardTransportSvc/ForwardTransportSvcConfig.ALFA.py")
include(
예제 #17
0
    "root://eosatlas//eos/atlas/atlascerngroupdisk/proj-sit/digitization/RTT/mc12a/mc12_8TeV.119996.Pythia8_A2MSTW2008LO_minbias_inelastic_high.merge.HITS.e1119_s1469_s1471/HITS.743322._017085.pool.root.1",
    "root://eosatlas//eos/atlas/atlascerngroupdisk/proj-sit/digitization/RTT/mc12a/mc12_8TeV.119996.Pythia8_A2MSTW2008LO_minbias_inelastic_high.merge.HITS.e1119_s1469_s1471/HITS.743322._017301.pool.root.1",
    "root://eosatlas//eos/atlas/atlascerngroupdisk/proj-sit/digitization/RTT/mc12a/mc12_8TeV.119996.Pythia8_A2MSTW2008LO_minbias_inelastic_high.merge.HITS.e1119_s1469_s1471/HITS.743322._019675.pool.root.1"
]

#--------------------------------------------------------------
# Global flags. Like eg the DD version:
#--------------------------------------------------------------
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetDescrVersion = 'ATLAS-GEO-20-00-01'

#--------------------------------------------------------------------
# DetFlags. Use to turn on/off individual subdetector or LVL1 trigger
#--------------------------------------------------------------------
from AthenaCommon.DetFlags import DetFlags
DetFlags.ID_setOff()
DetFlags.Calo_setOff()
DetFlags.Muon_setOff()
DetFlags.LVL1_setOff()
#DetFlags.Truth_setOn()

#DetFlags.TRT_setOn()

#DetFlags.SCT_setOn()

include("FastSiDigitization/PixelDigiTool_jobOptions.py")
DetFlags.pixel_setOff()
DetFlags.detdescr.pixel_setOn()

include("Digitization/ForceUseOfPileUpTools.py")
include(
예제 #18
0
#==============================================================
#
# Job options file for Geant4 Simulations
#
# CTB_G4Sim: CTB (2004) simulation production
#
__version__="$Revision: 1.31 $"
#==============================================================

#--- Detector flags -------------------------------------------
from AthenaCommon.DetFlags import DetFlags
# - Select detectors 
DetFlags.ID_setOn()
DetFlags.Calo_setOn()
DetFlags.LAr_setOn()
DetFlags.em_setOn()
DetFlags.Tile_setOn()
DetFlags.Muon_setOff() # muons are not supported in >=13.0.0
# - MCTruth
DetFlags.simulate.Truth_setOn()

#--- AthenaCommon flags ---------------------------------------
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.PoolHitsOutput='ctb_MyOutputFile.root'
athenaCommonFlags.EvtMax=3

#--- Simulation flags -----------------------------------------
from G4AtlasApps.SimFlags import SimFlags
SimFlags.import_JobProperties('G4AtlasApps.ctb_flags') # - specfic CTB flags

SimFlags.LArEMBenergyCor.set_On()
예제 #19
0
NtupleName = '/ntuple.root'

from AthenaCommon.GlobalFlags import globalflags
globalflags.DetGeo = 'atlas'
globalflags.DataSource = 'data'
globalflags.InputFormat = 'pool'

# FIXME  old global flags still use in LArDetDescr
from AthenaCommon.GlobalFlags import GlobalFlags
GlobalFlags.DetGeo.set_atlas()
GlobalFlags.DataSource.set_data()
GlobalFlags.InputFormat.set_pool()

from AthenaCommon.DetFlags import DetFlags
DetFlags.detdescr.all_setOn()
DetFlags.Muon_setOff()

include("PartPropSvc/PartPropSvc.py")

# Get a handle to the ServiceManager
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
# Get a handle to the ApplicationManager
from AthenaCommon.AppMgr import theApp

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from AthenaCommon.GlobalFlags import jobproperties
jobproperties.Global.DetDescrVersion = Geometry

from AtlasGeoModel import SetGeometryVersion
예제 #20
0
import AthenaPython.ConfigLib as apcl
cfg = apcl.AutoCfg(name='MaterialMapValidation',
                   input_files=athenaCommonFlags.FilesInput())

cfg.configure_job()

from AthenaCommon.GlobalFlags import globalflags
if len(globalflags.ConditionsTag()) != 0:
    from IOVDbSvc.CondDB import conddb
    conddb.setGlobalTag(globalflags.ConditionsTag())

from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags
InDetGeometryFlags.useDynamicAlignFolders = True

# Just the pixel and SCT
DetFlags.ID_setOn()
DetFlags.Calo_setOn()

# Initialize geometry
# THIS ACTUALLY DOES STUFF!!
from AtlasGeoModel import GeoModelInit
from AtlasGeoModel import SetGeometryVersion

from AthenaCommon.AlgScheduler import AlgScheduler
AlgScheduler.OutputLevel(INFO)
AlgScheduler.ShowControlFlow(True)
AlgScheduler.ShowDataDependencies(True)
AlgScheduler.EnableConditions(True)
AlgScheduler.setDataLoaderAlg("SGInputLoader")

## SET UP ALIGNMENT CONDITIONS ALGORITHM
예제 #21
0
    def _do_external(self):
        """ Place to handle the external services: GeoModel, CondDB, etc.
        """
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_external '+\
                                       'starting')
        from AthenaCommon.AppMgr import ServiceMgr
        from Geo2G4.Geo2G4Conf import Geo2G4Svc
        Geo2G4Svc = Geo2G4Svc()
        theApp.CreateSvc += ["Geo2G4Svc"]
        ServiceMgr += Geo2G4Svc
        Geo2G4Svc.GetTopTransform = False

        from AtlasGeoModel import SetGeometryVersion
        from AthenaCommon.Configurable import Configurable
        if Configurable.allConfigurables.get('GeoModelSvc'):
            GeoModelSvc = Configurable.allConfigurables.get('GeoModelSvc')
        else:
            GeoModelSvc = theApp.service('GeoModelSvc')
        GeoModelSvc.AlignCallbacks = False

        from G4AtlasApps.SimFlags import simFlags
        if (simFlags.SimLayout.get_Value() == 'tb_Tile2000_2003_2B2EB'):
            # 2 Barrels + 2 Extended Barrels
            GeoModelSvc.TileVersionOverride = 'TileTB-2B2EB-00'
        elif (simFlags.SimLayout.get_Value() == 'tb_Tile2000_2003_2B1EB'):
            # 2 Barrels + 1 Extended Barrel
            GeoModelSvc.TileVersionOverride = 'TileTB-2B1EB-00'
        elif (simFlags.SimLayout.get_Value() == 'tb_Tile2000_2003_3B'):
            # 3 Barrels
            GeoModelSvc.TileVersionOverride = 'TileTB-3B-00'
        elif (simFlags.SimLayout.get_Value() == 'tb_Tile2000_2003_5B'):
            # 5 Barrels
            GeoModelSvc.TileVersionOverride = 'TileTB-5B-00'

        from AtlasGeoModel import GeoModelInit
        if (DetFlags.Calo_on()):
            # Common for the Calo
            include(
                "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
            include("CaloIdCnv/CaloIdCnv_joboptions.py")
        ##--- Persistency of test-beam layout ----------------------------------
        if jobproperties.AthenaCommonFlags.PoolHitsOutput.statusOn:
            include("TBDetDescrAthenaPool/TBDetDescrAthenaPool_joboptions.py")
            from TBDetDescrAlg.TBDetDescrAlgConf import TBDetDescrLoader
            from AthenaCommon.AlgSequence import AlgSequence
            job = AlgSequence()
            TBDetDescrLoader = TBDetDescrLoader()
            job += TBDetDescrLoader
            TBDetDescrLoader.TBElementContainer = "TBElementCnt"
            TBDetDescrLoader.TBDetDescrManager = "TBDetDescrMgr"
            include("TBDetDescrCnv/TBDetDescrCnv_jobOptions.py")
            # do not read anything from StoreGate
            TBDetDescrLoader.ReadAction = 0
            # and write TBDetDescrContainer to StoreGate every event
            TBDetDescrLoader.WriteAction = 2
            TBDetDescrLoader.OutputLevel = 5

        ## Explicitly create DetectorGeometrySvc - temporary fix
        from AthenaCommon.CfgGetter import getService, getPublicTool
        from AthenaCommon.AppMgr import ServiceMgr
        ServiceMgr += getService('DetectorGeometrySvc')
        ServiceMgr.ToolSvc += getPublicTool('PhysicsListToolBase')
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_external '+\
                                       'done')
예제 #22
0
conddb.addFolder("","<dbConnection>oracle://INTR;schema=ATLAS_MLIMPER;dbname=COMP200</dbConnection>/PIXEL/ReadoutSpeed")


include( "AthenaCommon/AthenaCommonFlags.py" )

## from AthenaCommon.DetFlags import DetFlags 
## DetFlags.ID_setOn()
## DetFlags.Calo_setOff()
## DetFlags.Muon_setOff()
## DetFlags.Truth_setOff()
## DetFlags.LVL1_setOff()
## DetFlags.SCT_setOff()
## DetFlags.TRT_setOff()

from AthenaCommon.DetFlags import DetFlags
DetFlags.all_setOff()
DetFlags.pixel_setOn()

import AtlasGeoModel.SetGeometryVersion
import AtlasGeoModel.GeoModelInit

from PixelCabling.PixelCablingConf import PixelCablingSvc
PixelCablingSvc = PixelCablingSvc()
svcMgr += PixelCablingSvc

from PixelCabling.PixelCablingConf import DumpCabling
DumpCabling = DumpCabling()

DumpCabling.Write = True

import IOVDbSvc.IOVDb
예제 #23
0
    def _do_jobproperties(self):
        """ Place to handle JobProperties .
        """
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties starting')

        ## Import extra flags if it hasn't already been done
        from G4AtlasApps.SimFlags import simFlags
        if not simFlags.extra_flags:
            simFlags.load_tbLArH6_flags()

        # - switch off tasks
        DetFlags.pileup.all_setOff()
        DetFlags.simulateLVL1.all_setOff()
        DetFlags.overlay.all_setOff()
        DetFlags.digitize.all_setOff()
        DetFlags.readRDOPool.all_setOff()
        DetFlags.makeRIO.all_setOff()
        DetFlags.writeBS.all_setOff()
        DetFlags.readRDOBS.all_setOff()
        DetFlags.readRIOBS.all_setOff()
        DetFlags.readRIOPool.all_setOff()
        DetFlags.writeRIOPool.all_setOff()
        DetFlags.writeRDOPool.all_setOff()

        DetFlags.ID_setOff()
        DetFlags.Muon_setOff()
        DetFlags.Tile_setOff()

        globalflags.DataSource = "geant4"
        globalflags.DetGeo = "ctbh6"
        # mgallas this is a hack! needed for GeoModel and IOVDbSvc
        # TODO: Wow! Is this really still needed?
        import __main__
        __main__.globalflags = globalflags
        if simFlags.SimLayout.get_Value() == "tb_LArH6_2003":
            globalflags.DetDescrVersion = 'ATLAS-H6-2003-02'
            __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value()
        elif simFlags.SimLayout.get_Value() == "tb_LArH6_2002":
            globalflags.DetDescrVersion = 'ATLAS-H6-2002-01'
            __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value()
        elif simFlags.SimLayout.get_Value() == "tb_LArH6EC_2002":
            globalflags.DetDescrVersion = 'ATLAS-TBEC-01'
            __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value()
        elif simFlags.SimLayout.get_Value() == "tb_LArH6_2004":
            globalflags.DetDescrVersion = 'ATLAS-H6-2004-00'
            __main__.DetDescrVersion = globalflags.DetDescrVersion.get_Value()

        ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!!
        from AthenaCommon.AppMgr import ServiceMgr
        from IOVDbSvc.IOVDbSvcConf import IOVDbSvc
        ServiceMgr += IOVDbSvc()
        if not hasattr(
                globalflags,
                "ConditionsTag") or not globalflags.ConditionsTag.get_Value():
            msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. "
            msg += "You must set the globaltags.ConditionsTag flag in your job options."
            AtlasG4Eng.G4Eng.log.error(msg)
            raise SystemExit(
                "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set"
            )
        if not hasattr(ServiceMgr.IOVDbSvc,
                       'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag:
            ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value(
            )

        if not simFlags.ISFRun:
            from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata
            checkForSpecialConfigurationMetadata()

        ## Print flags
        if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40:
            AtlasG4Eng.G4Eng.log.info(
                'SimCtbKernel : printing detector flags DetFlags')
            DetFlags.Print()
            AtlasG4Eng.G4Eng.log.info(
                'SimCtbKernel : printing simulation flags simFlags')
            jobproperties.print_JobProperties('tree&value')
        jobproperties.lock_JobProperties()
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties done')
예제 #24
0
    # --- write out a short message upon entering or leaving each algorithm
    doNameAuditor = True
else:
    doEdmMonitor = False
    doNameAuditor = False

#--------------------------------------------------------------
# Additional Detector Setup
#--------------------------------------------------------------

from RecExConfig.RecFlags import rec
rec.Commissioning = False

from AthenaCommon.DetFlags import DetFlags
# --- switch on InnerDetector
DetFlags.ID_setOn()
DetFlags.makeRIO.SCT_setOff()
DetFlags.makeRIO.TRT_setOff()

# --- and switch off all the rest
DetFlags.Calo_setOff()
DetFlags.Muon_setOff()

# ---- switch parts of ID off/on as follows (always use both lines)
DetFlags.SCT_setOff()
DetFlags.detdescr.SCT_setOn()
DetFlags.TRT_setOff()
DetFlags.detdescr.TRT_setOn()

# --- switch off DCS
DetFlags.dcs.SCT_setOff()
예제 #25
0
    def _do_jobproperties(self):
        """ Place to handle JobProperties .
        """
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties starting')

        ## Import extra flags if it hasn't already been done
        from G4AtlasApps.SimFlags import simFlags
        if not simFlags.extra_flags:
            simFlags.load_ctb_flags()

        # - switch off tasks
        DetFlags.pileup.all_setOff()
        DetFlags.simulateLVL1.all_setOff()
        DetFlags.digitize.all_setOff()
        DetFlags.overlay.all_setOff()
        DetFlags.readRDOPool.all_setOff()
        DetFlags.makeRIO.all_setOff()
        DetFlags.writeBS.all_setOff()
        DetFlags.readRDOBS.all_setOff()
        DetFlags.readRIOBS.all_setOff()
        DetFlags.readRIOPool.all_setOff()
        DetFlags.writeRIOPool.all_setOff()
        DetFlags.writeRDOPool.all_setOff()

        # - see if there are beam-conditions
        if (simFlags.BeamConditions.statusOn
                and simFlags.BeamConditions.get_Value()):
            try:
                AtlasG4Eng.G4Eng.log.info(' SimCtbKernel: '+\
                       ' loading CTB beam-conditions from the'+\
                       ' CTB run-condition file !!')
                BeamCond = __import__(modulepath, globals(), locals(),
                                      prepath).BeamCond
                beam_cond_obj = BeamCond.retrieve_Run(
                    simFlags.RunNumber.get_Value())
                beam_cond_obj._map()
            except:
                AtlasG4Eng.G4Eng.log.warning(' SimCtbKernel: '+
                'No particular beam conditions found for the run '+\
                str(simFlags.RunNumber.get_Value()))
        # - switch off non-existing detectors
        DetFlags.FCal_setOff()
        DetFlags.HEC_setOff()
        # - Muons off for 13.0.0 release
        DetFlags.Muon_setOff()
        AtlasG4Eng.G4Eng.log.info(
            'SimCtbKernel : Muons are not supported in releases >= 13.0.0')
        # -  photon runs under run-conditions. For all the photon runs with
        # run number > 2860 SCT and Pixel were not at the beam
        # -- LAr material studies
        if (simFlags.SimLayout.get_Value() == 'ctbh8_lar-material'):
            DetFlags.SCT_setOff()
            DetFlags.Muon_setOff()
        if (simFlags.SimLayout.get_Value() == 'ctbh8_calodata'):
            DetFlags.ID_setOff()
            DetFlags.Muon_setOff()
        #
        # Note: for combined    runs tag 04 in IDET
        #           photon      runs tag 08
        #           larmaterial runs tag 01
        if simFlags.SimLayout.get_Value(
        ) == 'ctbh8_combined' and not simFlags.IdetOracleTag.statusOn:
            simFlags.IdetOracleTag = "InnerDetector-CTB-04-01"
        elif simFlags.SimLayout.get_Value(
        ) == 'ctbh8_phothon' and not simFlags.IdetOracleTag.statusOn:
            simFlags.IdetOracleTag = "InnerDetector-CTB-08-01"
        elif simFlags.SimLayout.get_Value(
        ) == 'ctbh8_lar-material' and not simFlags.IdetOracleTag.statusOn:
            simFlags.IdetOracleTag = "InnerDetector-CTB-01-01"
        else:
            simFlags.IdetOracleTag.set_On()
        #
        globalflags.DataSource = "geant4"
        globalflags.DetGeo = "ctbh8"
        ## mgallas this is a hack! needed for GeoModel and IOVDbSvc
        # TODO: Wow! Is this really still needed?
        import __main__
        __main__.DetDescrVersion = 'CTB'
        __main__.globalflags = globalflags
        globalflags.DetDescrVersion = 'CTB'

        ## Translate conditions tag into IOVDbSvc global tag: must be done before job properties are locked!!!
        from AthenaCommon.AppMgr import ServiceMgr
        from IOVDbSvc.IOVDbSvcConf import IOVDbSvc
        ServiceMgr += IOVDbSvc()
        if not hasattr(
                globalflags,
                "ConditionsTag") or not globalflags.ConditionsTag.get_Value():
            msg = "AtlasSimSkeleton._do_jobproperties :: conditions tag has not been set and is no longer guessed by SimAtlasKernel. "
            msg += "You must set the globaltags.ConditionsTag flag in your job options."
            AtlasG4Eng.G4Eng.log.error(msg)
            raise SystemExit(
                "AtlasSimSkeleton._do_jobproperties :: Global ConditionsTag not set"
            )
        if not hasattr(ServiceMgr.IOVDbSvc,
                       'GlobalTag') or not ServiceMgr.IOVDbSvc.GlobalTag:
            ServiceMgr.IOVDbSvc.GlobalTag = globalflags.ConditionsTag.get_Value(
            )

        if not simFlags.ISFRun:
            from G4AtlasApps.G4Atlas_Metadata import checkForSpecialConfigurationMetadata
            checkForSpecialConfigurationMetadata()

        ## Print out flags
        if AtlasG4Eng.G4Eng.log.getEffectiveLevel() < 40:
            AtlasG4Eng.G4Eng.log.info(
                'SimCtbKernel : printing detector flags DetFlags')
            DetFlags.Print()
            AtlasG4Eng.G4Eng.log.info(
                'SimCtbKernel : printing simulation flags simFlags')
            jobproperties.print_JobProperties('tree&value')

        jobproperties.lock_JobProperties()
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_JobProperties done')
예제 #26
0
def HitsFilePeeker(runArgs, skeletonLog):
    from PyUtils.MetaReader import read_metadata
    try:
        input_file = getHITSFile(runArgs)
        metadata_peeker = read_metadata(input_file, mode='peeker')
        metadata_peeker = metadata_peeker[
            input_file]  # promote all keys one level up

        metadata_full = read_metadata(input_file, mode='full')
        metadata_full = metadata_full[
            input_file]  # promote all keys one level up
    except AssertionError:
        skeletonLog.error("Failed to open input file: %s",
                          getHITSFile(runArgs))
    # check eventTypes of input file
    if 'eventTypes' in metadata_peeker:
        import re
        if 'IS_SIMULATION' not in metadata_peeker['eventTypes']:
            skeletonLog.error('This input file has incorrect evt_type: %s',
                              metadata_peeker['eventTypes'])
            skeletonLog.info(
                'Please make sure you have set input file metadata correctly.')
            skeletonLog.info(
                'Consider using the job transforms for earlier steps if you aren\'t already.'
            )
            #then exit gracefully
            raise SystemExit(
                "Input file eventTypes is incorrect, please check your g4sim and evgen jobs."
            )
    else:
        skeletonLog.warning(
            'Could not find \'eventTypes\' key in metadata. Unable to that check eventTypes is correct.'
        )

    metadatadict = dict()

    if metadata_full:
        if '/Simulation/Parameters' in metadata_full:
            metadatadict = metadata_full['/Simulation/Parameters']

        ##Get IOVDbGlobalTag
        if 'IOVDbGlobalTag' not in metadatadict:
            try:
                assert metadata_full['/TagInfo']['IOVDbGlobalTag'] is not None
                metadatadict['IOVDbGlobalTag'] = metadata_full['/TagInfo'][
                    'IOVDbGlobalTag']
            except:
                try:
                    assert metadata_full['/Digitization/Parameters'][
                        'IOVDbGlobalTag'] is not None
                    metadatadict['IOVDbGlobalTag'] = metadata_full[
                        '/Digitization/Parameters']['IOVDbGlobalTag']
                except:
                    skeletonLog.warning("Failed to find IOVDbGlobalTag.")
    else:
        ##Patch for older hit files
        if 'SimulatedDetectors' not in metadatadict:
            if 'itemList' in metadata_peeker:
                metadatadict[
                    'SimulatedDetectors'] = hitColls2SimulatedDetectors(
                        metadata_peeker['itemList'])
            else:
                metadatadict['SimulatedDetectors'] = [
                    'pixel', 'SCT', 'TRT', 'BCM', 'Lucid', 'LAr', 'Tile',
                    'MDT', 'CSC', 'TGC', 'RPC', 'Truth'
                ]

    import re
    from AthenaCommon.GlobalFlags import globalflags
    globalflags.DataSource = "geant4"
    ## Configure DetDescrVersion
    if hasattr(runArgs, "geometryVersion"):
        inputGeometryVersion = runArgs.geometryVersion
        if isinstance(
                inputGeometryVersion,
                basestring) and inputGeometryVersion.endswith("_VALIDATION"):
            inputGeometryVersion = inputGeometryVersion.replace(
                "_VALIDATION", "")
        if 'SimLayout' in metadatadict:
            if not re.match(metadatadict['SimLayout'], inputGeometryVersion):
                skeletonLog.warning(
                    "command-line geometryVersion (%s) does not match the value used in the Simulation step (%s) !",
                    inputGeometryVersion, metadatadict['SimLayout'])
        globalflags.DetDescrVersion.set_Value_and_Lock(inputGeometryVersion)
        skeletonLog.info("Using geometryVersion from command-line: %s",
                         globalflags.DetDescrVersion.get_Value())
    elif 'SimLayout' in metadatadict:
        globalflags.DetDescrVersion.set_Value_and_Lock(
            metadatadict['SimLayout'])
        skeletonLog.info("Using geometryVersion from HITS file metadata %s",
                         globalflags.DetDescrVersion.get_Value())
    else:
        raise SystemExit(
            "geometryVersion not found in HITS file metadata or on transform command-line!"
        )

    ## Configure ConditionsTag
    if hasattr(runArgs, "conditionsTag"):
        if 'IOVDbGlobalTag' in metadatadict:
            if not re.match(metadatadict['IOVDbGlobalTag'],
                            runArgs.conditionsTag):
                skeletonLog.warning(
                    "command-line conditionsTag (%s) does not match the value used in the Simulation step (%s) !",
                    runArgs.conditionsTag, metadatadict['IOVDbGlobalTag'])
            if not globalflags.ConditionsTag.is_locked():
                globalflags.ConditionsTag.set_Value_and_Lock(
                    runArgs.conditionsTag)
                skeletonLog.info("Using conditionsTag from command-line: %s",
                                 globalflags.ConditionsTag.get_Value())
            else:
                skeletonLog.info(
                    "globalflags.ConditionsTag already locked to %s - will not alter it.",
                    globalflags.ConditionsTag.get_Value())
    elif 'IOVDbGlobalTag' in metadatadict:
        globalflags.ConditionsTag.set_Value_and_Lock(
            metadatadict['IOVDbGlobalTag'])
        skeletonLog.info("Using conditionsTag from HITS file metadata %s",
                         globalflags.ConditionsTag.get_Value())
    else:
        skeletonLog.fatal(
            "conditionsTag not found in HITS file metadata or on transform command-line!"
        )
        raise SystemExit(
            "conditionsTag not found in HITS file metadata or on transform command-line!"
        )

    ## Configure DetFlags
    if 'SimulatedDetectors' in metadatadict:
        from AthenaCommon.DetFlags import DetFlags
        # by default everything is off
        DetFlags.all_setOff()
        skeletonLog.debug(
            "Switching on DetFlags for subdetectors which were simulated")
        simulatedDetectors = eval(metadatadict['SimulatedDetectors'])
        for subdet in simulatedDetectors:
            cmd = 'DetFlags.%s_setOn()' % subdet
            skeletonLog.debug(cmd)
            try:
                exec(cmd)
            except:
                skeletonLog.warning('Failed to switch on subdetector %s',
                                    subdet)
        DetFlags.simulateLVL1.all_setOff()
        DetFlags.digitize.all_setOff()
        if hasattr(DetFlags, 'overlay'): DetFlags.overlay.all_setOff()
        DetFlags.pileup.all_setOff()
        DetFlags.readRDOBS.all_setOff()
        DetFlags.readRDOPool.all_setOff()
        DetFlags.readRIOBS.all_setOff()
        DetFlags.readRIOPool.all_setOff()
        DetFlags.makeRIO.all_setOff()
        DetFlags.writeBS.all_setOff()
        DetFlags.writeRDOPool.all_setOff()
        DetFlags.writeRIOPool.all_setOff()
        print('{} -> __Test__001__:\n{}'.format(__file__, metadatadict))
    return
예제 #27
0
from GaudiSvc.GaudiSvcConf import THistSvc
import AthenaPoolCnvSvc.ReadAthenaPool

from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier
MCClassifier = MCTruthClassifier(name="MCTruthClassifier",
                                 ParticleCaloExtensionTool="")
ToolSvc += MCClassifier
# Ouput Message Level
svcMgr.MessageSvc.OutputLevel = INFO

Geometry = "ATLAS-R2-2016-01-00-01"
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetGeo.set_Value_and_Lock('atlas')
from AthenaCommon.DetFlags import DetFlags
DetFlags.detdescr.all_setOn()
DetFlags.Forward_setOff()
DetFlags.ID_setOff()

from AthenaCommon.GlobalFlags import jobproperties
jobproperties.Global.DetDescrVersion = Geometry

from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
include("CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
include("LArDetDescr/LArDetDescr_joboptions.py")

# ART File
testFile = 'Nightly_AOD_' + particleType + '.pool.root'
svcMgr.EventSelector.InputCollections = [testFile]

job = CfgMgr.AthSequencer("AthAlgSeq")
예제 #28
0
]

svcMgr.AthenaSealSvc.CheckDictionary = True
#svcMgr.AthenaSealSvc.CheckDictAtInit = True

from OutputStreamAthenaPool.OutputStreamAthenaPool import AthenaPoolOutputStream
ostream = AthenaPoolOutputStream("StreamRDO",
                                 athenaCommonFlags.PoolRDOOutput(), True)

ostream.TakeItemsFromInput = True
ostream.ForceRead = True

ostream.ItemList += [
    n.replace("/", "#") for n in svcMgr.ByteStreamAddressProviderSvc.TypeNames
]

#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
# Print some post output post config
#-------------------------------------------------------------------------------
print svcMgr

print topSequence

print DetFlags.Print()

svcMgr.MessageSvc.debugLimit = 500000000

svcMgr.InputMetaDataStore.Dump = True
###############################################################
#
# Job options file to put Calibration Hits into ntuple
#
# author: Sanya Solodkov	email:  [email protected]
#
#==============================================================
include("AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py")

include("PartPropSvc/PartPropSvc.py")

#--- Detector flags -------------------------------------------
from AthenaCommon.DetFlags import DetFlags
# - Select detectors
DetFlags.ID_setOff()
DetFlags.Calo_setOn()
DetFlags.LAr_setOn()
DetFlags.em_setOn()
DetFlags.Tile_setOn()
DetFlags.Muon_setOff()
#
DetFlags.simulate.Truth_setOn()

# select one of two setups:
DetDescrVersion = "Rome-Final"
#DetDescrVersion = "CTB"
include("AtlasGeoModel/SetGeometryVersion.py")
include("AtlasGeoModel/GeoModelInit.py")

if (DetDescrVersion == "CTB"):
    # LAr DetDescr for H8 testbeam
예제 #30
0
  print "EventMax set to",EventMax
athenaCommonFlags.EvtMax     =  EventMax
athenaCommonFlags.SkipEvents =   0

# --- disable error protection of RecExCommon
athenaCommonFlags.AllowIgnoreConfigError.set_Value_and_Lock(False)


#--------------------------------------------------------------
# Additional Detector Setup
#--------------------------------------------------------------

from AthenaCommon.DetFlags import DetFlags 

# --- switch on InnerDetector
DetFlags.ID_setOn()

# --- turn off Calo
if doCaloSeededBrem:
  DetFlags.Calo_setOn()
else:
  DetFlags.Calo_setOff()

# --- and switch off Muons
DetFlags.Muon_setOff()

#from AthenaCommon.BeamFlags import jobproperties as BeamFlags
#BeamFlags.Beam.bunchSpacing.set_Value_and_Lock(50)

#--------------------------------------------------------------
# Control
#
#ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/LOW"]
#ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/MEDIUM"]
#ByteStreamAddressProviderSvc.TypeNames += ["LArCalibDigitContainer/HIGH"]

#
# Detector description (LAr only)
#
include("LArDetDescr/LArDetDescr_H8_joboptions.py")
DetDescrCnvSvc = Service("DetDescrCnvSvc")
DetDescrCnvSvc.DoIdChecks
DetDescrCnvSvc.LArIDFileName = "IdDictParser/IdDictLArCalorimeter_H8_2004.xml"

from AthenaCommon.DetFlags import DetFlags

DetFlags.all_setOff()
DetFlags.em_setOn()

ToolSvc = Service("ToolSvc")
ToolSvc.LArRoI_Map.Print = False
ToolSvc.LArRodDecoder.FirstSample = 2

#
# CondDB settings
#
include("LArTBRec/LArTBFlags_jobOptions.py")
include("LArCondCnv/LArCondCnv_TB04_jobOptions.py")

theApp.Dlls += ["IOVDbSvc"]
ProxyProviderSvc = Service("ProxyProviderSvc")
ProxyProviderSvc.ProviderNames += ["IOVDbSvc"]
if CosmicMonitorFlags.doSim:
    # Reading G4 simulated data from Pool
    GlobalFlags.DataSource.set_geant4()
    GlobalFlags.InputFormat.set_pool()
else:
    # Reading ByteStream real data
    GlobalFlags.DataSource.set_data()
    GlobalFlags.InputFormat.set_bytestream() 

# ----------------------------------
# import DetFlags from AthenaCommon
# ----------------------------------
from AthenaCommon.DetFlags import DetFlags

DetFlags.pixel_setOff()
DetFlags.SCT_setOn()
DetFlags.TRT_setOff()

DetFlags.detdescr.pixel_setOff()
DetFlags.detdescr.SCT_setOn()
DetFlags.detdescr.TRT_setOff()

if CosmicMonitorFlags.doSim:
    DetFlags.readRDOPool.pixel_setOff()
    DetFlags.readRDOPool.SCT_setOn()
    DetFlags.readRDOPool.TRT_setOff()
else:
    DetFlags.readRDOBS.pixel_setOff()
    DetFlags.readRDOBS.SCT_setOn()
    DetFlags.readRDOBS.TRT_setOff()
예제 #33
0
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
from AthenaCommon.BeamFlags import jobproperties
from AthenaCommon.DetFlags import DetFlags
import AthenaCommon.SystemOfUnits as Units

### Set event burst cut (no cut by default but 200 for cosmics)
if jobproperties.Beam.beamType()=='cosmics':
  eventBurstCut = 200  
else:
  eventBurstCut = -1

### Set track quality cuts for collisions
if jobproperties.Beam.beamType() == "collisions":
  minTrkPtCut = 0.5 * Units.GeV
  ### at least one silicon detector must be on to require silicon hits
  if DetFlags.pixel_on() or DetFlags.SCT_on():
    minSiHitCut = 1
  else: # both silicon detectors are off, we cannot require hits
    minSiHitCut = 0
else: # no track quality cuts for cosmics or single beams
  minTrkPtCut = 0
  minSiHitCut = 0

#-------------------------------------------------------------
# Barrel Monitoring
#-------------------------------------------------------------
from TRT_Monitoring.TRT_MonitoringConf import TRT_Monitoring_Tool
InDetTRT_Monitoring_Tool = TRT_Monitoring_Tool (name                         = "TRT_Monitoring_Tool",
                                                TRTRawDataObjectName         = InDetKeys.TRT_RDOs(),
                                                NumberOfEvents               = -1,
                                                TRTTracksObjectName          = InDetKeys.UnslimmedTracks(),