示例#1
0
def dumpDetFlags(filename='config.txt'):
    """Append DetFlags printout to config file"""
    # add DetFlags
    from AthenaCommon.DetFlags import DetFlags
    import sys
    confFile = open(filename, 'a')
    # redirect stdout to file
    sys.stdout, confFile = confFile, sys.stdout
    print "Detector flags:"
    DetFlags.Print()
    # put back stdout to screen
    sys.stdout, confFile = confFile, sys.stdout
    confFile.close()
示例#2
0
jobproperties.Beam.beamType.set_Value_and_Lock('cosmics')

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_setOff()
DetFlags.detdescr.Tile_setOn()
DetFlags.readRDOBS.Tile_setOn()
DetFlags.Print()

from AthenaCommon.GlobalFlags import jobproperties
if RUN2: jobproperties.Global.DetDescrVersion = "ATLAS-R2-2016-01-00-01"
else:    jobproperties.Global.DetDescrVersion = "ATLAS-R1-2012-02-00-00"
tbstat_log.info( "DetDescrVersion = %s" % (jobproperties.Global.DetDescrVersion()) )

from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
GeoModelSvc = GeoModelSvc()
GeoModelSvc.IgnoreTagDifference = True
tbstat_log.info( "GeoModelSvc.AtlasVersion = %s" % (GeoModelSvc.AtlasVersion) )

from RecExConfig.RecFlags import rec
if RUN2: rec.projectName = "data15_tilecomm"
示例#3
0
def signalMetaDataCheck(metadatadict):
    import re
    simkeys = metadatadict.keys()
    logDigitizationReadMetadata.info(
        "Checking Digitization properties against Signal Simulation MetaData..."
    )
    ## Check the PhysicsList set agrees with that used in the simulation
    if not skipCheck('PhysicsList'):
        if 'PhysicsList' in simkeys:
            from Digitization.DigitizationFlags import digitizationFlags
            if re.match(metadatadict['PhysicsList'],
                        digitizationFlags.physicsList.get_Value()):
                logDigitizationReadMetadata.debug(
                    "Digitization properties matches Signal Simulation MetaData. [PhysicsList = %s]",
                    metadatadict['PhysicsList'])
            else:
                logDigitizationReadMetadata.warning(
                    "Digitization properties PhysicsList does not match the PhysicsList used in the Simulation step! Assume the PhysicsList from the Simulation step is correct!"
                )
                digitizationFlags.physicsList = metadatadict['PhysicsList']
                logDigitizationReadMetadata.info(
                    "Set digitizationFlags.physicsList = %s",
                    digitizationFlags.physicsList.get_Value())
        else:
            logDigitizationReadMetadata.error(
                "PhysicsList key not found in Simulation MetaData!")

    ## Check the DetDescrVersion set agrees with that used in the simulation
    if not skipCheck('SimLayout'):
        if 'SimLayout' in simkeys:
            from AthenaCommon.GlobalFlags import globalflags
            if re.match(metadatadict['SimLayout'],
                        globalflags.DetDescrVersion.get_Value()):
                logDigitizationReadMetadata.debug(
                    "Digitization properties matches Signal Simulation MetaData. [DetDescrVersion = %s]",
                    globalflags.DetDescrVersion.get_Value())
            else:
                logDigitizationReadMetadata.warning(
                    "Input DetDescrVersion does not match the value used in the Simulation step!"
                )
                from AthenaCommon.AppMgr import ServiceMgr
                ## FIXME - should not be relying on GeoModelSvc being initialized at this point.
                if hasattr(
                        ServiceMgr, "GeoModelSvc"
                ) and ServiceMgr.GeoModelSvc.IgnoreTagDifference == True:
                    logDigitizationReadMetadata.warning(
                        "Global jobproperties: [DetDescrVersion = %s], Signal Simulation MetaData: [SimLayout = %s]",
                        globalflags.DetDescrVersion.get_Value(),
                        metadatadict['SimLayout'])
                    logDigitizationReadMetadata.warning(
                        "Ignore Tag Difference Requested - doing nothing.")
                else:
                    logDigitizationReadMetadata.warning(
                        "Assume the value from the Simulation step is correct!"
                    )
                    ## needs to be done this way as Digi_tf locks it
                    if globalflags.DetDescrVersion.is_locked():
                        globalflags.DetDescrVersion.unlock()
                    globalflags.DetDescrVersion.set_Value_and_Lock(
                        metadatadict['SimLayout'])
                    logDigitizationReadMetadata.warning(
                        "Set globalflags.DetDescrVersion = %s",
                        globalflags.DetDescrVersion.get_Value())
        else:
            logDigitizationReadMetadata.error(
                "SimLayout key not found in Simulation MetaData!")

    ## Check the Conditions Tag set against that used in the simulation
    if not skipCheck('IOVDbGlobalTag'):
        if 'IOVDbGlobalTag' in simkeys:
            from Digitization.DigitizationFlags import digitizationFlags
            if (digitizationFlags.IOVDbGlobalTag.statusOn):
                logDigitizationReadMetadata.info(
                    "Digitization properties: [IOVDbGlobalTag = %s], Signal Simulation MetaData: [IOVDbGlobalTag = %s]",
                    digitizationFlags.IOVDbGlobalTag.get_Value(),
                    metadatadict['IOVDbGlobalTag'])
            else:
                digitizationFlags.IOVDbGlobalTag = metadatadict[
                    'IOVDbGlobalTag']
                logDigitizationReadMetadata.debug(
                    "Set Digitization properties to match Signal Simulation Metadata: [IOVDbGlobalTag = %s]",
                    digitizationFlags.IOVDbGlobalTag.get_Value())
        else:
            logDigitizationReadMetadata.error(
                "IOVDbGlobalTag key not found in Simulation MetaData!")

    ## Set the TRTRangeCut digitizationFlag based on what was used during the simulation.
    if not skipCheck('TRTRangeCut'):
        if 'TRTRangeCut' in simkeys:
            from Digitization.DigitizationFlags import digitizationFlags
            if hasattr(digitizationFlags, 'TRTRangeCut'):
                digitizationFlags.TRTRangeCut = metadatadict['TRTRangeCut']
                logDigitizationReadMetadata.debug(
                    "Set Digitization properties to match Signal Simulation Metadata: [TRTRangeCut = %s]",
                    digitizationFlags.TRTRangeCut.get_Value())
        else:
            logDigitizationReadMetadata.warning(
                "TRTRangeCut key not found in Simulation MetaData!")

    ## Record the G4Version used in the simulation, so that Digitization Algorithms can use this information
    if not skipCheck('G4Version'):
        if 'G4Version' in simkeys:
            from Digitization.DigitizationFlags import digitizationFlags
            digitizationFlags.SimG4VersionUsed = metadatadict['G4Version']
            logDigitizationReadMetadata.debug(
                "digitizationFlags.SimG4VersionUsed = Value from Sim Metadata = %s ",
                digitizationFlags.SimG4VersionUsed.get_Value())
        else:
            logDigitizationReadMetadata.error(
                "G4Version key not found in Simulation MetaData!")

    ## Check which sub-detectors were simulated

    ## Digitization will only digitize detectors which have been simulated.
    ## If users want to digitize an un simulated detector this will be an expert
    ## action which will require hacking the python code.
    from AthenaCommon.DetFlags import DetFlags
    if not skipCheck('SimulatedDetectors'):
        if 'SimulatedDetectors' in simkeys:
            logDigitizationReadMetadata.debug(
                "Switching off subdetectors which were not simulated")
            possibleSubDetectors = [
                'pixel', 'SCT', 'TRT', 'BCM', 'HGTD', 'Lucid', 'ZDC', 'ALFA',
                'AFP', 'FwdRegion', 'LAr', 'Tile', 'MDT', 'CSC', 'TGC', 'RPC',
                'Micromegas', 'sTGC', 'Truth'
            ]
            switchedOffSubDetectors = []
            for subdet in possibleSubDetectors:
                if not subdet in metadatadict['SimulatedDetectors']:
                    attrname = subdet + "_setOff"
                    checkfn = getattr(DetFlags, attrname, None)
                    if checkfn is not None:
                        cmd = 'DetFlags.%s_setOff()' % subdet
                        logDigitizationReadMetadata.debug(cmd)
                        checkfn()
                    switchedOffSubDetectors += [subdet]
            if switchedOffSubDetectors:
                logDigitizationReadMetadata.info(
                    "Ensured %s sub-detectors which were not simulated were switched off: %s",
                    len(switchedOffSubDetectors), switchedOffSubDetectors)
            else:
                logDigitizationReadMetadata.info(
                    "All sub-detectors were simulated, so none needed to be switched off in digitization."
                )
            DetFlags.Print()

    ## Any other checks here
    logDigitizationReadMetadata.info(
        "Completed checks of Digitization properties against Signal Simulation MetaData."
    )
示例#4
0
    def _do_jobproperties(self):
        """
        Place to handle JobProperties.
        """

        ## Import extra flags if it hasn't already been done
        from G4AtlasApps.SimFlags import simFlags
        if "atlas_flags" not in simFlags.extra_flags:
            simFlags.load_atlas_flags()
        if jobproperties.Beam.beamType(
        ) == "cosmics" and "cosmics_flags" not in simFlags.extra_flags:
            simFlags.load_cosmics_flags()

        AtlasG4Eng.G4Eng.log.verbose(
            'AtlasSimSkeleton._do_jobproperties :: starting')

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

        from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
        if not MuonGeometryFlags.hasCSC(): DetFlags.CSC_setOff()
        if not MuonGeometryFlags.hasSTGC(): DetFlags.sTGC_setOff()
        if not MuonGeometryFlags.hasMM(): DetFlags.Micromegas_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()
        DetFlags.readRDOBS.all_setOff()
        DetFlags.readRIOBS.all_setOff()
        DetFlags.readRIOPool.all_setOff()
        DetFlags.writeRIOPool.all_setOff()
        DetFlags.writeRDOPool.all_setOff()

        ## 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()

        # Switch off GeoModel Release in the case of parameterization
        if simFlags.LArParameterization.get_Value(
        ) > 0 and simFlags.ReleaseGeoModel():
            AtlasG4Eng.G4Eng.log.info(
                'AtlasSimSkeleton._do_jobproperties :: Running parameterization - switching off GeoModel release!'
            )
            simFlags.ReleaseGeoModel = False

        ## 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(
            )

        ## Enable floating point exception handling
        ## FIXME! This seems to cause the jobs to crash in the FpeControlSvc, so commenting this out for now...
        #from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        #athenaCommonFlags.RuntimeStrictness = 'abort'
        #AtlasG4Eng.G4Eng.log.debug('AtlasSimSkeleton._do_jobproperties :: Enabled floating point exceptions')

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

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

        # Lock the job properties if not running ISF.
        if not simFlags.ISFRun:
            jobproperties.lock_JobProperties()
        AtlasG4Eng.G4Eng.log.verbose(
            'AtlasSimSkeleton._do_jobproperties :: done')
示例#5
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
示例#6
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')
示例#7
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')
示例#8
0
# svcMgr += CondSvc()

doExtrap = False

ExtrapolationEngine=""
if (doExtrap):
  import MagFieldServices.SetupField
  from AthenaCommon.DetFlags import DetFlags
  DetFlags.geometry.ID_setOn()
  DetFlags.detdescr.ID_setOn()
  DetFlags.geometry.Calo_setOn()
  DetFlags.detdescr.Calo_setOn()
  DetFlags.geometry.Muon_setOn()
  DetFlags.detdescr.Muon_setOn()
  # from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
  print "DetFlags:", DetFlags.Print()
  from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
  AtlasTrackingGeometrySvc  = svcMgr.AtlasTrackingGeometrySvc
  print AtlasTrackingGeometrySvc

  from AtlasGeoModel import SetGeometryVersion
  from AtlasGeoModel import GeoModelInit

  # from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
  # VP1ExtraPolatorName='VP1Extrapolator';
  # VP1Extrapolator = AtlasExtrapolator(name=VP1ExtraPolatorName)

  from TrkExEngine.AtlasExtrapolationEngine import AtlasExtrapolationEngine
  ExtrapolationEngine = AtlasExtrapolationEngine(name='Extrapolation', nameprefix='Atlas', ToolOutputLevel=INFO)
  print ExtrapolationEngine
  ToolSvc += ExtrapolationEngine