Пример #1
0
def getATLAS_FieldMgrList():
    fieldMgrList = []
    from G4AtlasApps.SimFlags import simFlags
    if not simFlags.TightMuonStepping.statusOn or\
       not simFlags.TightMuonStepping():
        fieldMgrList += ['ATLASFieldManager']
    else:
        fieldMgrList += ['TightMuonsATLASFieldManager']

    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.bpipe_on():
        fieldMgrList += ['BeamPipeFieldManager']
    if DetFlags.ID_on():
        fieldMgrList += ['InDetFieldManager']
    if DetFlags.Calo_on(
    ) and simFlags.MuonFieldOnlyInCalo.statusOn and simFlags.MuonFieldOnlyInCalo(
    ):
        fieldMgrList += ['MuonsOnlyInCaloFieldManager']
    if DetFlags.Muon_on():
        fieldMgrList += ['MuonFieldManager']
    if simFlags.ForwardDetectors.statusOn:
        if DetFlags.geometry.FwdRegion_on():
            fieldMgrList += [
                'Q1FwdFieldManager', 'Q2FwdFieldManager', 'Q3FwdFieldManager',
                'D1FwdFieldManager', 'D2FwdFieldManager', 'Q4FwdFieldManager',
                'Q5FwdFieldManager', 'Q6FwdFieldManager', 'Q7FwdFieldManager',
                'Q1HKickFwdFieldManager', 'Q1VKickFwdFieldManager',
                'Q2HKickFwdFieldManager', 'Q2VKickFwdFieldManager',
                'Q3HKickFwdFieldManager', 'Q3VKickFwdFieldManager',
                'Q4VKickAFwdFieldManager', 'Q4HKickFwdFieldManager',
                'Q4VKickBFwdFieldManager', 'Q5HKickFwdFieldManager',
                'Q6VKickFwdFieldManager', 'FwdRegionFieldManager'
            ]
    return fieldMgrList
Пример #2
0
    def __init__(self, name):

        subDetectors = []
        if DetFlags.pixel_on():
            subDetectors += ["Pixel"]
        if DetFlags.SCT_on():
            subDetectors += ["SCT"]
        if DetFlags.TRT_on():
            subDetectors += ["TRT"]
        if DetFlags.Calo_on():
            subDetectors += ["Calo"]

        from ActsGeometry.ActsGeometryConf import ActsTrackingGeometrySvc
        actsTrackingGeometrySvc = ActsTrackingGeometrySvc(
            name="ActsTrackingGeometrySvc", BuildSubDetectors=subDetectors)

        from AthenaCommon.AppMgr import ServiceMgr
        ServiceMgr += actsTrackingGeometrySvc

        from ActsGeometry.ActsGeometryConf import NominalAlignmentCondAlg
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")
        if not hasattr(condSeq, "NominalAlignmentCondAlg"):
            condSeq += NominalAlignmentCondAlg(name="NominalAlignmentCondAlg")

        ActsTrackingGeometryTool.__init__(
            self, name, ActsTrackingGeometrySvc=actsTrackingGeometrySvc)
Пример #3
0
def generateSubDetectorList():
    SubDetectorList = []
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType() == 'cosmics' or \
            (simFlags.CavernBG.statusOn and not 'Signal' in simFlags.CavernBG.get_Value() ):
        if jobproperties.Beam.beamType() == 'cosmics' and hasattr(
                simFlags, "ReadTR"):
            SubDetectorList += ['CosmicShortCut']
    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.Muon_on():
        SubDetectorList += ['MUONQ02']  #FIXME rename to MUON when safe
    if DetFlags.ID_on():
        SubDetectorList += ['IDET']
    if DetFlags.Calo_on():
        SubDetectorList += ['CALO']
    if DetFlags.ID_on():  #HACK
        if DetFlags.bpipe_on():  #HACK
            SubDetectorList += ['BeamPipe']  #HACK
    if DetFlags.geometry.Lucid_on():
        SubDetectorList += ['Lucid']
    if simFlags.ForwardDetectors.statusOn:
        SubDetectorList += ['ForwardRegion']
    #if DetFlags.Muon_on(): #HACK
    #    SubDetectorList += ['MUONQ02'] #FIXME rename to MUON when safe #HACK
    #SubDetectorList += generateFwdSubDetectorList() #FIXME Fwd Detectors not supported yet.
    return SubDetectorList
def getParticlePositionFilterDynamic(name="ISF_ParticlePositionFilterDynamic", **kwargs):
    # automatically choose the best fitting filter region
    if DetFlags.Muon_on():
      return getParticlePositionFilterWorld(name, **kwargs)
    elif DetFlags.Calo_on():
      return getParticlePositionFilterCalo(name, **kwargs)
    elif DetFlags.ID_on():
      return getParticlePositionFilterID(name, **kwargs)
    else:
      return getParticlePositionFilterWorld(name, **kwargs)
Пример #5
0
def getFatrasGeometryBuilder(name="ISF_FatrasGeometryBuilder", **kwargs):
    # the geometry builder alg tool
    # switch on the Detectors
    #kwargs.setdefault("InDetTrackingGeometry"   , DetFlags.ID_on())
    #kwargs.setdefault("CaloTrackingGeometry"    , DetFlags.Calo_on())
    #kwargs.setdefault("MuonTrackingGeometry"    , DetFlags.Muon_on())
    if DetFlags.ID_on():
        kwargs.setdefault("InDetTrackingGeometryBuilder",getPublicTool('ISF_InDetTrackingGeometryBuilder'))
    if DetFlags.Calo_on():
        kwargs.setdefault("CaloTrackingGeometryBuilder" ,getPublicTool('ISF_FatrasCaloTrackingGeometryBuilder'))
    if DetFlags.Muon_on():
        kwargs.setdefault("MuonTrackingGeometryBuilder" ,getPublicTool('ISF_FatrasMuonTrackingGeometryBuilder'))

    from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__GeometryBuilder
    return Trk__GeometryBuilder(name, **kwargs )
def generateEnvelopeSensitiveDetectorList():
    SensitiveDetectorList = []
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType() == 'cosmics' and hasattr(
            simFlags, "ReadTR") and not simFlags.ReadTR.statusOn:
        SensitiveDetectorList += ['CosmicRecord']
    if not simFlags.ISFRun:
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.ID_on():
            SensitiveDetectorList += ['CaloEntryLayer']
        if DetFlags.Calo_on():
            SensitiveDetectorList += ['MuonEntryLayer']
        if DetFlags.geometry.Muon_on():
            SensitiveDetectorList += ['MuonExitLayer']
    return SensitiveDetectorList
Пример #7
0
def getEnvelopeMap():
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    from AthenaCommon.BeamFlags import jobproperties as beamProps

    # Map of volume name to output collection name
    envelopeMap = dict()
    if (hasattr(simFlags, "LArFarUpstreamMaterial")
            and simFlags.LArFarUpstreamMaterial.statusOn
            and simFlags.LArFarUpstreamMaterial.get_Value()):
        envelopeMap.update({
            'LARFARUPSTREAMMATERIAL::LARFARUPSTREAMMATERIAL':
            'LArFarUpstreamMaterialExitLayer'
        })
    if beamProps.Beam.beamType() == 'cosmics':
        ## First filter volume
        if simFlags.CosmicFilterVolumeName == "TRT_Barrel":
            envelopeMap['TRT::BarrelOuterSupport'] = 'TRTBarrelEntryLayer'
        elif simFlags.CosmicFilterVolumeName == "TRT_EC":
            envelopeMap['TRT::WheelA'] = 'TRTECAEntryLayer'
            envelopeMap['TRT::WheelB'] = 'TRTECBEntryLayer'
        elif simFlags.CosmicFilterVolumeName == "SCT_Barrel":
            envelopeMap[
                'SCT::ThShieldOuterCly'] = 'SCTBarrelEntryLayer'  # could be ThShieldInnerCly or Cyl..
        elif simFlags.CosmicFilterVolumeName == "Pixel":
            envelopeMap['Pixel::Pixel'] = 'PixelEntryLayer'
        ## If second volume requested
        if simFlags.CosmicFilterVolumeName2.statusOn:
            if simFlags.CosmicFilterVolumeName2 == "TRT_Barrel":
                envelopeMap['TRT::BarrelOuterSupport'] = 'TRTBarrelEntryLayer'
            elif simFlags.CosmicFilterVolumeName2 == "TRT_EC":
                envelopeMap['TRT::WheelA'] = 'TRTECAEntryLayer'
                envelopeMap['TRT::WheelB'] = 'TRTECBEntryLayer'
            elif simFlags.CosmicFilterVolumeName2 == "SCT_Barrel":
                envelopeMap[
                    'SCT::ThShieldOuterCly'] = 'SCTBarrelEntryLayer'  # could be ThShieldInnerCly or Cyl..
            elif simFlags.CosmicFilterVolumeName2 == "Pixel":
                envelopeMap['Pixel::Pixel'] = 'PixelEntryLayer'
    if not simFlags.ISFRun:
        if DetFlags.ID_on():
            envelopeMap['IDET::IDET'] = 'CaloEntryLayer'
        if DetFlags.Calo_on():
            envelopeMap['CALO::CALO'] = 'MuonEntryLayer'
        if DetFlags.geometry.Muon_on():
            envelopeMap['MUONQ02::MUONQ02'] = 'MuonExitLayer'
    return envelopeMap
Пример #8
0
def getCTB_RegionCreatorList():
    regionCreatorList = []
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    ## FIXME _initPR never called for SCT??
    #if DetFlags.ID_on():
    #    if DetFlags.geometry.SCT_on():
    #        regionCreatorList += ['SCTSiliconPhysicsRegionTool']
    if DetFlags.Calo_on():
        eta = simFlags.Eta.get_Value()
        if eta >= 0 and eta < 1.201:
            if DetFlags.em_on():
                regionCreatorList += ['EMBPhysicsRegionTool']
    if DetFlags.Muon_on():
        regionCreatorList += [
            'DriftWallPhysicsRegionTool', 'DriftWall1PhysicsRegionTool',
            'DriftWall2PhysicsRegionTool'
        ]
    return regionCreatorList
Пример #9
0
    def _do_external(self):
        """ Place to handle the external services: GeoModel, CondDB, etc.
        """
        AtlasG4Eng.G4Eng.log.info('SimSkeleton :: _do_external '+\
                                       'starting')

        #from LArH6Detectors import Det_Layouts
        from tbLArH6_calo import Det_Layouts

        from AthenaCommon.AppMgr import ServiceMgr
        from Geo2G4.Geo2G4Conf import Geo2G4Svc
        Geo2G4Svc = Geo2G4Svc()
        theApp.CreateSvc += ["Geo2G4Svc"]
        ServiceMgr += Geo2G4Svc
        # We do not use top transforms for the CTB geometry
        Geo2G4Svc.GetTopTransform = False

        #--- GeoModel stuff ----------------------------------------------------
        from AtlasGeoModel import SetGeometryVersion
        from AtlasGeoModel import GeoModelInit

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

        if (DetFlags.Calo_on()):
            # Common for the Calo
            include(
                "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
            include("CaloIdCnv/CaloIdCnv_joboptions.py")

        ## 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')
Пример #10
0
    def __init__(self, layout):
        """
        Describes the geometry.
        """

        self.AtlasForwardOuterR = 2751.
        self.AtlasOuterR1 = 13911.
        self.AtlasOuterR2 = 13911.
        self.AtlasOuterR3 = 1501.
        from G4AtlasApps.SimFlags import simFlags
        from AthenaCommon.BeamFlags import jobproperties
        from AthenaCommon.DetFlags import DetFlags
        ## Shrink the global ATLAS envelope to the activated detectors, except when running on special setups.
        if jobproperties.Beam.beamType() != 'cosmics' and not DetFlags.Muon_on() and not \
           (simFlags.CavernBG.statusOn and not 'Signal' in simFlags.CavernBG.get_Value() ):
            self.AtlasOuterR1 = 4251.
            self.AtlasOuterR2 = 4251.
            if not DetFlags.Calo_on():
                self.AtlasOuterR1 = 1150.
                self.AtlasOuterR2 = 1150.
        AtlasG4Eng.G4Eng.log.debug(
            'Creating Atlas envelope with outer radii %d, %d' %
            (self.AtlasOuterR1, self.AtlasOuterR2))

        self.atlas = PyG4Atlas.DetFacility("GenericPCON", "Atlas")
        self.atlas.df.SetPhiMin(math.radians(0))
        self.atlas.df.SetDeltaPhi(math.radians(360))
        self.atlas.df.SetNSurfaces(18)
        self.atlas.df.SetZSurface(0, -26046.)
        self.atlas.df.SetZSurface(1, -23001.)
        self.atlas.df.SetZSurface(2, -23001.)
        self.atlas.df.SetZSurface(3, -22031.)
        self.atlas.df.SetZSurface(4, -22031.)
        self.atlas.df.SetZSurface(5, -12899.)
        self.atlas.df.SetZSurface(6, -12899.)
        self.atlas.df.SetZSurface(7, -6741.)
        self.atlas.df.SetZSurface(8, -6741.)
        self.atlas.df.SetZSurface(9, 6741.)
        self.atlas.df.SetZSurface(10, 6741.)
        self.atlas.df.SetZSurface(11, 12899.)
        self.atlas.df.SetZSurface(12, 12899.)
        self.atlas.df.SetZSurface(13, 22031.)
        self.atlas.df.SetZSurface(14, 22031.)
        self.atlas.df.SetZSurface(15, 23001.)
        self.atlas.df.SetZSurface(16, 23001.)
        self.atlas.df.SetZSurface(17, 26046.)

        if simFlags.ForwardDetectors.statusOn:
            self.atlas.df.SetZSurface(0, -400000.)
            self.atlas.df.SetZSurface(17, 400000.)

        if simFlags.WorldZRange.statusOn:
            if simFlags.WorldZRange.get_Value() < 26046.:
                AtlasG4Eng.G4Eng.log.error('WorldZRange must be > 26046.')
                raise RuntimeError(
                    'atlas_common: found problems with the Z World volume range: %f'
                    % simFlags.WorldZRange.get_Value())
            self.atlas.df.SetZSurface(17,
                                      simFlags.WorldZRange.get_Value() + 100.)
            self.atlas.df.SetZSurface(16,
                                      simFlags.WorldZRange.get_Value() + 50.)
            self.atlas.df.SetZSurface(15,
                                      simFlags.WorldZRange.get_Value() + 50.)
            self.atlas.df.SetZSurface(14, simFlags.WorldZRange.get_Value())
            self.atlas.df.SetZSurface(13, simFlags.WorldZRange.get_Value())
            self.atlas.df.SetZSurface(0,
                                      -simFlags.WorldZRange.get_Value() - 100.)
            self.atlas.df.SetZSurface(1,
                                      -simFlags.WorldZRange.get_Value() - 50.)
            self.atlas.df.SetZSurface(2,
                                      -simFlags.WorldZRange.get_Value() - 50.)
            self.atlas.df.SetZSurface(3, -simFlags.WorldZRange.get_Value())
            self.atlas.df.SetZSurface(4, -simFlags.WorldZRange.get_Value())
            AtlasG4Eng.G4Eng.log.debug(
                'Increasing the Z World ATLAS envelope to %f' %
                simFlags.WorldZRange.get_Value())

        ## Set inner (all zero) and outer radii
        for i in xrange(0, 18):
            self.atlas.df.SetRinSurface(i, 0.0)
        for i in (0, 1, 16, 17):
            self.atlas.df.SetRouSurface(i, 1501.)
        for i in (2, 3, 14, 15):
            self.atlas.df.SetRouSurface(i, self.AtlasForwardOuterR)
        for i in (4, 5, 12, 13):
            self.atlas.df.SetRouSurface(i, self.AtlasOuterR2)
        for i in xrange(6, 12):
            self.atlas.df.SetRouSurface(i, self.AtlasOuterR1)

        ## World R range
        if simFlags.WorldRRange.statusOn:
            if simFlags.WorldRRange.get_Value() > max(self.AtlasOuterR1,
                                                      self.AtlasOuterR2):
                routValue = simFlags.WorldRRange.get_Value()
                for i in xrange(4, 14):
                    self.atlas.df.SetRouSurface(i, routValue)
                AtlasG4Eng.G4Eng.log.debug(
                    'Increasing the ATLAS World envelope R value to %f' %
                    routValue)
            else:
                AtlasG4Eng.G4Eng.log.error(
                    'WorldRRange must be > %f' %
                    max(self.AtlasOuterR1, self.AtlasOuterR2))
                raise RuntimeError(
                    'atlas_common: found problems with the R World volume range %f'
                    % routValue)
Пример #11
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)

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

        ## EventInfo & TruthEvent always written by default
        stream1.ForceRead = True
        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#*",
                "CSCSimHitCollection#*", "MDTSimHitCollection#*",
                "TrackRecordCollection#MuonExitLayer"
            ]
            if hasattr(simFlags, 'SimulateNewSmallWheel'):
                if simFlags.SimulateNewSmallWheel():
                    stream1.ItemList += ["GenericMuonSimHitCollection#*"]
        ## 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#*"]
Пример #12
0
  def __init__(self):
    from AthenaCommon.Include import include
    from AthenaCommon.AppMgr import ToolSvc

    ##################################################################################
    # The FatrasTrackingGeometry Svc fragment
    #
    # usage: 
    #   include('TrkDetDescrSvc/FatrasTrackingGeometrySvc.py')
    #
    #    + for the navigator, set the TrackingGeometryName to:
    #      FatrasTrackingGeometrySvc.trackingGeometryName()
    #
    ##################################################################################
    # import the DetFlags for the setting
    from AthenaCommon.DetFlags import DetFlags

    #################################################################################
    # Material for the Geometry
    #
    # if only ID is switched on different COOLDB Folders
    #    and different Tag is used
    # 
    #################################################################################

    from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
    
    if TrkDetFlags.ConfigurationOutputLevel() < 3 :
      print '[ Configuration : start ] *** FatrasTrackingGeometry ********************************'
      print '[ TrackingGeometrySvc ]'

    # check whether the material retrieval is ment to be from COOL
    if TrkDetFlags.MaterialFromCool() :
        # the tag names
        CoolDataBaseFolder = TrkDetFlags.MaterialStoreGateKey()
        AtlasMaterialTag = TrkDetFlags.MaterialTagBase()+str(TrkDetFlags.MaterialVersion())+'_'

        if TrkDetFlags.ConfigurationOutputLevel() < 3 :
           print '[ TrackingGeometrySvc ] Associating DB folder : ',CoolDataBaseFolder
           print '[ TrackingGeometrySvc ]     base material tag : ',AtlasMaterialTag

        # we need the conditions interface
        from IOVDbSvc.CondDB import conddb
        # use a local database
        if TrkDetFlags.MaterialDatabaseLocal():
            # specify the local database
            DataBasePath  = TrkDetFlags.MaterialDatabaseLocalPath() 
            DataBaseName  = TrkDetFlags.MaterialDatabaseLocalName()
            MagicTag      = TrkDetFlags.MaterialMagicTag()
            DataBaseConnection = '<dbConnection>sqlite://X;schema='+DataBasePath+DataBaseName+';dbname=OFLP200</dbConnection>'
            conddb.blockFolder('/GLOBAL/TrackingGeo/LayerMaterial')
            conddb.addFolderWithTag('',DataBaseConnection+CoolDataBaseFolder,AtlasMaterialTag+MagicTag,force=True)
            if TrkDetFlags.ConfigurationOutputLevel() < 3 :
                print '[ TrackingGeometrySvc ] Using Local Database: '+DataBaseConnection        
            # make sure that the pool files are in the catalog
            #from PoolSvc.PoolSvcConf import PoolSvc
            #PoolSvc.ReadCatalog += [ DataBasePath+'PoolFileCatalog.xml' ]                
        elif TrkDetFlags.SLHC_Geometry() :
            # set the folder to the SLHC location
            CoolDataBaseFolder = '/GLOBAL/TrackingGeo/SLHC_LayerMaterial'
            ctag = AtlasMaterialTag+TrkDetFlags.MaterialMagicTag()
            cfoldertag = CoolDataBaseFolder+' <tag>'+ctag+'</tag>'
            conddb.addFolderSplitMC('GLOBAL',cfoldertag,cfoldertag)
        else :
            # load the right folders (preparation for calo inclusion)
            cfolder = CoolDataBaseFolder +'<tag>TagInfoMajor/'+AtlasMaterialTag+'/GeoAtlas</tag>'
            conddb.addFolderSplitMC('GLOBAL',cfolder,cfolder)

    #################################################################################
    # The Geometry Builder
    #################################################################################

    # the name to register the Geometry
    FatrasTrackingGeometryName = 'FatrasTrackingGeometry'

    # the geometry builder alg tool
    from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__GeometryBuilder
    FatrasGeometryBuilder = Trk__GeometryBuilder(name = 'FatrasGeometryBuilder')
    # switch on the Detectors
    FatrasGeometryBuilder.InDetTrackingGeometry  = DetFlags.ID_on()
    FatrasGeometryBuilder.CaloTrackingGeometry   = DetFlags.Calo_on()
    FatrasGeometryBuilder.MuonTrackingGeometry   = DetFlags.Muon_on() # avoid double building of MTG
    # register it to tool svc
    ToolSvc += FatrasGeometryBuilder

    # (ID) 
    if DetFlags.ID_on() :
      # get hand on the ID Tracking Geometry Builder
      if not TrkDetFlags.SLHC_Geometry() :
        from InDetTrackingGeometry.ConfiguredInDetTrackingGeometryBuilder import ConfiguredInDetTrackingGeometryBuilder as IDGeometryBuilder
      else :
        from InDetTrackingGeometry.ConfiguredSLHC_InDetTrackingGeometryBuilder import ConfiguredSLHC_InDetTrackingGeometryBuilder as IDGeometryBuilder
      if not TrkDetFlags.SLHC_Geometry() :   
        self.__InDetTrackingGeometryBuilder__ = IDGeometryBuilder(name ='InDetTrackingGeometryBuilder',
                                                         namePrefix = 'Fatras',
                                                         setLayerAssociation = False,
                                                         buildTrtStrawLayers = True)
        self.__InDetTrackingGeometryBuilder__.VolumeEnclosureOuterR = 1148.
      else :   
        self.__InDetTrackingGeometryBuilder__ = IDGeometryBuilder(name ='InDetTrackingGeometryBuilder',
                                                         namePrefix = 'Fatras',
                                                         setLayerAssociation = False)
        self.__InDetTrackingGeometryBuilder__.VolumeEnclosureOuterR = 1148.

      # make a public tool out of it
      ToolSvc += self.__InDetTrackingGeometryBuilder__
      # and give it to the Geometry Builder
      FatrasGeometryBuilder.InDetTrackingGeometryBuilder = self.__InDetTrackingGeometryBuilder__
      # 
    # (Calo)
    if DetFlags.Calo_on():
       from CaloTrackingGeometry.ConfiguredCaloTrackingGeometryBuilder import ConfiguredCaloTrackingGeometryBuilder as ConfiguredCaloGeo
       CaloTrackingGeometryBuilder = ConfiguredCaloGeo(name = 'FatrasCaloTrackingGeometryBuilder')
       CaloTrackingGeometryBuilder.RecordLayerIndexCaloSampleMap = True
       # make a publid tool
       ToolSvc += CaloTrackingGeometryBuilder
       # and give it to the Geometry Builder
       FatrasGeometryBuilder.CaloTrackingGeometryBuilder = CaloTrackingGeometryBuilder

    # (Muon)  
    if DetFlags.Muon_on():
       from MuonTrackingGeometry.ConfiguredMuonTrackingGeometry import MuonTrackingGeometryBuilder
       FatrasMuonTrackingGeometryBuilder = MuonTrackingGeometryBuilder(name = 'FatrasMuonTrackingGeometryBuilder')
       FatrasMuonTrackingGeometryBuilder.BarrelZ = 6783.  
       FatrasMuonTrackingGeometryBuilder.InnerBarrelRadius = 4255.  
       ToolSvc += FatrasMuonTrackingGeometryBuilder
       # and give it to the Geometry Builder
       FatrasGeometryBuilder.MuonTrackingGeometryBuilder = FatrasMuonTrackingGeometryBuilder      
  

    # then get the tuning parameters
    from FatrasExample.FatrasTuning import FatrasTuningFlags
    if FatrasTuningFlags.MaterialDistortionsX0.statusOn and \
       FatrasTuningFlags.MaterialDistortionsRho.statusOn :
      from TrkDetDescrSvc.TrkDetDescrSvcConf import CalibrationTrackingGeometrySvc as GeometrySvc
    else :  
      from TrkDetDescrSvc.TrkDetDescrSvcConf import TrackingGeometrySvc as GeometrySvc
    FatrasTrackingGeometrySvc = GeometrySvc(name = 'FatrasTrackingGeometrySvc')

    # register the Builder 
    FatrasTrackingGeometrySvc.GeometryBuilder = FatrasGeometryBuilder
    # and register the name under which the geometry is registered
    FatrasTrackingGeometrySvc.TrackingGeometryName = FatrasTrackingGeometryName
    # global scaling of the material if necessary
    FatrasTrackingGeometrySvc.GlobalScaleFactor = FatrasTuningFlags.MaterialScalor()
    # some flags - only works when ID is on
    FatrasTrackingGeometrySvc.AssignMaterialFromCOOL   = True
    FatrasTrackingGeometrySvc.BuildGeometryFromTagInfo = True
    # Material scaling & distortion
    if FatrasTuningFlags.MaterialDistortionsX0.statusOn and \
       FatrasTuningFlags.MaterialDistortionsRho.statusOn :
       FatrasTrackingGeometrySvc.RandomDistortions          = True
       FatrasTrackingGeometrySvc.DistortionsRadiationLength = FatrasTuningFlags.MaterialDistortionsX0() 
       FatrasTrackingGeometrySvc.DistortionsDensity         = FatrasTuningFlags.MaterialDistortionsRho()
       from FatrasExample.FatrasValidation import FatrasValidationFlags
       FatrasTrackingGeometrySvc.RecordDistortions          = FatrasValidationFlags.MaterialDistortions()
       FatrasTrackingGeometrySvc.DistortionOutputFolder     = '/'+FatrasValidationFlags.ValidationStream()+'/MaterialDistortions'
    # switch to the rigth CoolDB folder 
    FatrasTrackingGeometrySvc.InputLayerMaterialSetName = CoolDataBaseFolder

    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    svcMgr += FatrasTrackingGeometrySvc

    print '* [ Configuration : start ] *** FatrasTrackingGeometry ********************************'
    print '* [ FatrasTrackingGeometrySvc   ]'
    print FatrasTrackingGeometrySvc
    print '* [ GeometryBuilder       ]'
    print FatrasGeometryBuilder
    print '* [ Configuration : end   ] *** FatrasTrackingGeometry ********************************'

    ##################################################################################    

    self.__geoSvc__ = FatrasTrackingGeometrySvc
Пример #13
0
def getATLAS_RegionCreatorList():
    regionCreatorList = []
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())

    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.DetFlags import DetFlags
    if simFlags.SimulateCavern.get_Value():
        regionCreatorList += [
            'SX1PhysicsRegionTool', 'BedrockPhysicsRegionTool',
            'CavernShaftsConcretePhysicsRegionTool'
        ]
        #regionCreatorList += ['CavernShaftsAirPhysicsRegionTool'] # Not used currently
    if DetFlags.ID_on():
        if DetFlags.pixel_on():
            regionCreatorList += ['PixelPhysicsRegionTool']
        if DetFlags.SCT_on():
            regionCreatorList += ['SCTPhysicsRegionTool']
        if DetFlags.TRT_on() and not isUpgrade:
            regionCreatorList += ['TRTPhysicsRegionTool']
            if isRUN2:
                regionCreatorList += ['TRT_ArPhysicsRegionTool'
                                      ]  #'TRT_KrPhysicsRegionTool'
        # FIXME dislike the ordering here, but try to maintain the same ordering as in the old configuration.
        if DetFlags.bpipe_on():
            if simFlags.BeamPipeSimMode.statusOn and simFlags.BeamPipeSimMode(
            ) != "Normal":
                regionCreatorList += ['BeampipeFwdCutPhysicsRegionTool']
            if simFlags.ForwardDetectors.statusOn and simFlags.ForwardDetectors(
            ) == 2:
                regionCreatorList += ['FWDBeamLinePhysicsRegionTool']
    if DetFlags.Calo_on():
        if DetFlags.geometry.LAr_on():
            ## Shower parameterization overrides the calibration hit flag
            if simFlags.LArParameterization.statusOn and simFlags.LArParameterization() > 0 \
                    and simFlags.CalibrationRun.statusOn and simFlags.CalibrationRun.get_Value() in ['LAr','LAr+Tile','DeadLAr']:
                print(
                    'You requested both calibration hits and frozen showers / parameterization in the LAr.'
                )
                print(
                    '  Such a configuration is not allowed, and would give junk calibration hits where the showers are modified.'
                )
                print(
                    '  Please try again with a different value of either simFlags.LArParameterization ('
                    + str(simFlags.LArParameterization()) +
                    ') or simFlags.CalibrationRun (' +
                    str(simFlags.CalibrationRun.get_Value()) + ')')
                raise RuntimeError('Configuration not allowed')
            if simFlags.LArParameterization() > 0:
                regionCreatorList += [
                    'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool',
                    'HECPhysicsRegionTool', 'FCALPhysicsRegionTool'
                ]
                # FIXME 'EMBPhysicsRegionTool' used for parametrization also - do we need a second instance??
                regionCreatorList += [
                    'EMECParaPhysicsRegionTool', 'FCALParaPhysicsRegionTool',
                    'FCAL2ParaPhysicsRegionTool'
                ]
                if simFlags.LArParameterization.get_Value() > 1:
                    regionCreatorList += [
                        'PreSampLArPhysicsRegionTool',
                        'DeadMaterialPhysicsRegionTool'
                    ]
            elif simFlags.LArParameterization(
            ) is None or simFlags.LArParameterization() == 0:
                regionCreatorList += [
                    'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool',
                    'HECPhysicsRegionTool', 'FCALPhysicsRegionTool'
                ]
    ## FIXME _initPR never called for FwdRegion??
    #if simFlags.ForwardDetectors.statusOn:
    #    if DetFlags.geometry.FwdRegion_on():
    #        regionCreatorList += ['FwdRegionPhysicsRegionTool']
    if DetFlags.Muon_on():
        regionCreatorList += [
            'DriftWallPhysicsRegionTool', 'DriftWall1PhysicsRegionTool',
            'DriftWall2PhysicsRegionTool'
        ]
        if simFlags.CavernBG.statusOn and simFlags.CavernBG.get_Value(
        ) != 'Read' and not (simFlags.RecordFlux.statusOn
                             and simFlags.RecordFlux()):
            regionCreatorList += ['MuonSystemFastPhysicsRegionTool']
    return regionCreatorList
Пример #14
0
job += CfgGetter.getAlgorithm(digitizationFlags.digiSteeringConf.get_Value(), tryDefaultConfigurable=True)
if 'doFastPixelDigi' in digitizationFlags.experimentalDigi() or 'doFastSCT_Digi' in digitizationFlags.experimentalDigi() or 'doFastTRT_Digi' in digitizationFlags.experimentalDigi():
    print "WARNING  Setting doFastPixelDigi ,doFastSCT_Digi or doFastTRT_Digi in digitizationFlags.experimentalDigi no longer overrides digitizationFlags.digiSteeringConf."
elif 'doSplitDigi' in digitizationFlags.experimentalDigi():
    print "WARNING  Setting doSplitDigi in digitizationFlags.experimentalDigi no longer overrides digitizationFlags.digiSteeringConf. Use --digiSteeringConf 'Split' on the command-line instead."


# MC Truth info
#if DetFlags.Truth_on():
#    include( "Digitization/TruthDigitization.py" )

# Forward Detectors
#if DetFlags.Forward_on():
#    include( "Digitization/FwdDetDigitization.py" )

# Inner Detector
if DetFlags.ID_on():
    include( "Digitization/InDetDigitization.py" )

# Calorimeters
if DetFlags.Calo_on():
    include( "Digitization/CaloDigitization.py" )

# Muon Digitization
if DetFlags.Muon_on():
    include( "Digitization/MuonDigitization.py" )

# LVL1 trigger simulation
#if DetFlags.digitize.LVL1_on():
include( "Digitization/LVL1Digitization.py" )
Пример #15
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')
Пример #16
0
def getHITSStreamItemList():
    hitsItemList=[]
    ## EventInfo & TruthEvent always written by default
    hitsItemList = ["EventInfo#*",
                    "McEventCollection#TruthEvent",
                    "JetCollection#*"]
    from G4AtlasApps.SimFlags import simFlags
    if simFlags.SimulationFlavour() is not None and 'ongLived' in simFlags.SimulationFlavour(): # to catch LongLived and longLived
        hitsItemList += ["McEventCollection#GEN_EVENT"]
    from PyJobTransforms.trfUtils import releaseIsOlderThan
    if releaseIsOlderThan(20,0):
        #Hack to maintain compatibility of G4AtlasApps trunk with
        #19.2.X.Y after EDM changes in release 20.0.0.
        hitsItemList += ["xAOD::JetContainer_v1#*",
                         "xAOD::JetAuxContainer_v1#*"]
    else:
        hitsItemList += ["xAOD::JetContainer#*",
                           "xAOD::JetAuxContainer#*"]
    ## Detectors
    from AthenaCommon.DetFlags import DetFlags
    ## Inner Detector
    if DetFlags.ID_on():
        hitsItemList += ["SiHitCollection#*",
                         "TRTUncompressedHitCollection#*",
                         "TrackRecordCollection#CaloEntryLayer"]
    ## Calo
    if DetFlags.Calo_on():
        hitsItemList += ["CaloCalibrationHitContainer#*",
                         "LArHitContainer#*",
                         "TileHitVector#*",
                         #"SimpleScintillatorHitCollection#*",
                         "TrackRecordCollection#MuonEntryLayer"]
    ## Muon
    if DetFlags.Muon_on():
        hitsItemList += ["RPCSimHitCollection#*",
                         "TGCSimHitCollection#*",
                         "CSCSimHitCollection#*",
                         "MDTSimHitCollection#*",
                         "TrackRecordCollection#MuonExitLayer"]
    ## FwdRegion
    if DetFlags.FwdRegion_on():
        hitsItemList += ["SimulationHitCollection#*"]

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

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

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

    ## Ancillary scintillators
    #hitsItemList += ["ScintillatorHitCollection#*"]

    ## TimingAlg
    hitsItemList +=["RecoTimingObj#EVNTtoHITS_timings"]

    if simFlags.RecordStepInfo.get_Value():
        hitsItemList +=["ISF_FCS_Parametrization::FCS_StepInfoCollection#MergedEventSteps"]

    ## add xAOD::TrackParticles output collection Parametric Simulation
    if simFlags.SimulationFlavour == "ParametricSimulation":
        hitsItemList +=["xAOD::TrackParticleContainer#*",
                            "xAOD::TrackParticleAuxContainer#*"]
    ## 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):
            hitsItemList += ["TrackRecordCollection#CosmicRecord", "TrackRecordCollection#CosmicPerigee"]
    else:
        ## CTB-specific
        if layout.startswith("ctb"):
            if simFlags.LArFarUpstreamMaterial.statusOn and simFlags.LArFarUpstreamMaterial.get_Value():
                hitsItemList.append("TrackRecordCollection#LArFarUpstreamMaterialExitLayer")
        ## Persistency of test-beam layout
        if layout.startswith('ctb') or layout.startswith('tb_Tile2000_'):
            hitsItemList += ["TBElementContainer#*"]
    return hitsItemList
Пример #17
0
    def __init__(self, name='AtlasTrackingGeometrySvc'):

        if TrkDetFlags.ConfigurationOutputLevel() < 3:
            print('[ Configuration : start ] *** ' + name +
                  ' ********************************')
            print('[ TrackingGeometrySvc ]')

        from AthenaCommon.AppMgr import ToolSvc

        #################################################################################
        # The Geometry Builder
        #################################################################################

        # the name to register the Geometry
        AtlasTrackingGeometryName = 'AtlasTrackingGeometry'

        # the geometry builder alg tool
        from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__GeometryBuilder
        AtlasGeometryBuilder = Trk__GeometryBuilder(
            name='AtlasGeometryBuilder')
        # switch the building outputlevel on
        AtlasGeometryBuilder.OutputLevel = TrkDetFlags.ConfigurationOutputLevel(
        )

        # the envelope definition service
        from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,\
           getService,getServiceClone,getAlgorithm,getAlgorithmClone
        AtlasEnvelopeSvc = getService('AtlasGeometry_EnvelopeDefSvc')

        # (ID)
        if DetFlags.ID_on():
            # get hand on the ID Tracking Geometry Builder
            if TrkDetFlags.ISF_FatrasCustomGeometry():
                if hasattr(ToolSvc,
                           TrkDetFlags.ISF_FatrasCustomGeometryBuilderName()):
                    InDetTrackingGeometryBuilder = getattr(
                        ToolSvc,
                        TrkDetFlags.ISF_FatrasCustomGeometryBuilderName())
            elif TrkDetFlags.XMLFastCustomGeometry():
                if hasattr(ToolSvc,
                           TrkDetFlags.InDetTrackingGeometryBuilderName()):
                    InDetTrackingGeometryBuilder = getattr(
                        ToolSvc,
                        TrkDetFlags.InDetTrackingGeometryBuilderName())
            else:
                if not TrkDetFlags.SLHC_Geometry(
                ) and not TrkDetFlags.InDetStagedGeometryBuilder():
                    from InDetTrackingGeometry.ConfiguredInDetTrackingGeometryBuilder import ConfiguredInDetTrackingGeometryBuilder as IDGeometryBuilder
                elif not TrkDetFlags.SLHC_Geometry():
                    from InDetTrackingGeometry.ConfiguredStagedTrackingGeometryBuilder import ConfiguredStagedTrackingGeometryBuilder as IDGeometryBuilder
                else:
                    from InDetTrackingGeometry.ConfiguredSLHC_InDetTrackingGeometryBuilder import ConfiguredSLHC_InDetTrackingGeometryBuilder as IDGeometryBuilder
                InDetTrackingGeometryBuilder = IDGeometryBuilder(
                    name='InDetTrackingGeometryBuilder')

            InDetTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc
            InDetTrackingGeometryBuilder.OutputLevel = TrkDetFlags.InDetBuildingOutputLevel(
            )
            # and give it to the Geometry Builder
            AtlasGeometryBuilder.InDetTrackingGeometryBuilder = InDetTrackingGeometryBuilder
            #
        # (Calo)
        if DetFlags.Calo_on():
            from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__CylinderVolumeCreator
            CaloVolumeCreator = Trk__CylinderVolumeCreator("CaloVolumeCreator")
            CaloVolumeCreator.OutputLevel = TrkDetFlags.CaloBuildingOutputLevel(
            )
            ToolSvc += CaloVolumeCreator

            from CaloTrackingGeometry.ConfiguredCaloTrackingGeometryBuilder import ConfiguredCaloTrackingGeometryBuilder as ConfiguredCaloGeo
            CaloTrackingGeometryBuilder = ConfiguredCaloGeo(
                name='CaloTrackingGeometryBuilder')
            CaloTrackingGeometryBuilder.TrackingVolumeCreator = CaloVolumeCreator
            CaloTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc
            CaloTrackingGeometryBuilder.OutputLevel = TrkDetFlags.CaloBuildingOutputLevel(
            )
            CaloTrackingGeometryBuilder.GeometryName = 'Calo'
            # and give it to the Geometry Builder
            AtlasGeometryBuilder.CaloTrackingGeometryBuilder = CaloTrackingGeometryBuilder

        # (Muon)
        if DetFlags.Muon_on():
            from MuonTrackingGeometry.ConfiguredMuonTrackingGeometry import MuonTrackingGeometryBuilder
            MuonTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc
            # and give it to the Geometry Builder
            AtlasGeometryBuilder.MuonTrackingGeometryBuilder = MuonTrackingGeometryBuilder

        # processors
        AtlasGeometryProcessors = []

        # check whether the material retrieval is ment to be from COOL
        if TrkDetFlags.MaterialSource() is 'COOL':
            # the material provider
            from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__LayerMaterialProvider as LayerMaterialProvider
            AtlasMaterialProvider = LayerMaterialProvider(
                'AtlasMaterialProvider')
            AtlasMaterialProvider.OutputLevel = TrkDetFlags.ConfigurationOutputLevel(
            )
            AtlasMaterialProvider.LayerMaterialMapName = TrkDetFlags.MaterialStoreGateKey(
            )

            AtlasGeometryProcessors += [AtlasMaterialProvider]

            # the tag names
            CoolDataBaseFolder = TrkDetFlags.MaterialStoreGateKey()
            AtlasMaterialTag = TrkDetFlags.MaterialTagBase() + str(
                TrkDetFlags.MaterialVersion(
                )) + TrkDetFlags.MaterialSubVersion() + '_'

            if TrkDetFlags.ConfigurationOutputLevel() < 3:
                print('[ TrackingGeometrySvc ] Associating DB folder : ',
                      CoolDataBaseFolder)

            # we need the conditions interface
            from IOVDbSvc.CondDB import conddb
            # use a local database
            if TrkDetFlags.MaterialDatabaseLocal():
                # specify the local database
                DataBasePath = TrkDetFlags.MaterialDatabaseLocalPath()
                DataBaseName = TrkDetFlags.MaterialDatabaseLocalName()
                MagicTag = TrkDetFlags.MaterialMagicTag()
                DataBaseConnection = '<dbConnection>sqlite://X;schema=' + DataBasePath + DataBaseName + ';dbname=OFLP200</dbConnection>'
                conddb.blockFolder('/GLOBAL/TrackingGeo/LayerMaterialV2')
                conddb.addFolderWithTag('',
                                        DataBaseConnection +
                                        CoolDataBaseFolder,
                                        AtlasMaterialTag + MagicTag,
                                        force=True)
                if TrkDetFlags.ConfigurationOutputLevel() < 3:
                    print('[ TrackingGeometrySvc ] Using Local Database: ' +
                          DataBaseConnection)
                # make sure that the pool files are in the catalog
            elif TrkDetFlags.SLHC_Geometry():
                # set the folder to the SLHC location
                CoolDataBaseFolder = '/GLOBAL/TrackingGeo/LayerMaterialITK'
                ctag = AtlasMaterialTag + TrkDetFlags.MaterialMagicTag()
                cfoldertag = CoolDataBaseFolder + ' <tag>' + ctag + '</tag>'
                conddb.addFolderSplitMC('GLOBAL', cfoldertag, cfoldertag)
            else:
                print('[ TrackingGeometrySvc ]     base material tag : ',
                      AtlasMaterialTag)
                cfolder = CoolDataBaseFolder + '<tag>TagInfoMajor/' + AtlasMaterialTag + '/GeoAtlas</tag>'
                print('[ TrackingGeometrySvc ]     translated to COOL: ',
                      cfolder)
                # load the right folders (preparation for calo inclusion)
                conddb.addFolderSplitMC('GLOBAL', cfolder, cfolder)

        elif TrkDetFlags.MaterialSource() is 'Input':
            # the material provider
            from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__InputLayerMaterialProvider
            AtlasMaterialProvider = Trk__InputLayerMaterialProvider(
                'AtlasMaterialProvider')
            AtlasMaterialProvider.OutputLevel = TrkDetFlags.ConfigurationOutputLevel(
            )
            AtlasGeometryProcessors += [AtlasMaterialProvider]

        # material validation
        if TrkDetFlags.MaterialValidation():
            # load the material inspector
            from TrkDetDescrTestTools.TrkDetDescrTestToolsConf import Trk__LayerMaterialInspector
            AtlasLayerMaterialInspector = Trk__LayerMaterialInspector(
                'AtlasLayerMaterialInspector')
            AtlasLayerMaterialInspector.OutputLevel = TrkDetFlags.ConfigurationOutputLevel(
            )

            AtlasGeometryProcessors += [AtlasLayerMaterialInspector]

        # call the base class constructor : sets the tools
        Trk__TrackingGeometrySvc.__init__(self,name,\
                                          GeometryBuilder = AtlasGeometryBuilder,\
                                          TrackingGeometryName = AtlasTrackingGeometryName,\
                                          GeometryProcessors = AtlasGeometryProcessors, \
                                          BuildGeometryFromTagInfo = True,\
                                          OutputLevel = TrkDetFlags.ConfigurationOutputLevel())

        # screen output of the configuration
        if TrkDetFlags.ConfigurationOutputLevel() < 3:
            print(self)
            print('* [ GeometryBuilder       ]')
            print(AtlasGeometryBuilder)
            print('* [ Configuration : end   ] ***' + name +
                  '********************************')
Пример #18
0
#################################################################################
# Material for the Geometry
#
# if only ID is switched on different COOLDB Folders
#    and different Tag is used
# 
#################################################################################
# import the DetFlags for the setting
from AthenaCommon.DetFlags import DetFlags

CoolDataBaseFolder = '/Indet/TrackingGeo/LayerMaterial'
AtlasMaterialTag   = 'InDetLayerMat_v5_'

# set the CaloTrkGeo if not set --- Calorimeter in Beta Test
if not 'CaloTrkGeo' in dir():
   CaloTrkGeo=DetFlags.Calo_on()

# set the MuonTrkGeo if not set --- Muon System in Prototype state
if not 'MuonTrkGeo' in dir():
   MuonTrkGeo = DetFlags.Muon_on()

# the steering for the CaloEnergyLoss tool
if not 'doCaloTrkEloss' in dir():
  doCaloTrkEloss = False
  
if CaloTrkGeo:
   CoolDataBaseFolder = '/GLOBAL/TrackingGeo/LayerMaterial'
   AtlasMaterialTag   = 'AtlasLayerMat_v5_'

# load the right folders (preparation for calo inclusion)
from IOVDbSvc.CondDB import conddb
Пример #19
0
def getATLAS(name="Atlas", **kwargs):
    kwargs.setdefault("DetectorName", "Atlas")
    kwargs.setdefault("NSurfaces", 18)
    from G4AtlasApps.SimFlags import simFlags
    from AthenaCommon.BeamFlags import jobproperties
    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 jobproperties.Beam.beamType() != 'cosmics' and not DetFlags.Muon_on() and not \
       (simFlags.CavernBG.statusOn and not 'Signal' in simFlags.CavernBG.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.:
            AtlasG4Eng.G4Eng.log.error('')
            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)