Ejemplo n.º 1
0
class dummyService(CompFactory.StoreGateSvc):
    __slots__ = {
        'SomeTools': PrivateToolHandleArray([]),
        'AList': [],
        'OneTool': PrivateToolHandle(),
        'AString': '',
    }
Ejemplo n.º 2
0
class DummyAlg( Configurable.ConfigurableAlgorithm ):
   __slots__ = { 
      'DummyIntProp' : 0, # int
      'DummyBoolProp' : True, # bool
      'DummyFloatProp' : 3.141, # float
      'DummyStringProp' : 'Mellon', # string
      'DummyToolHProp' : PrivateToolHandle('DummyToolA/DummyTool1'), # GaudiHandle
      'DummyToolHArrayProp' : PrivateToolHandleArray([]), # GaudiHandleArray
      }
   def __init__(self, name = Configurable.Configurable.DefaultName, **kwargs):
      super(DummyAlg, self).__init__(name)
      for n,v in kwargs.items():
         setattr(self, n, v)
   def getDlls( self ):
      return 'AthenaCommon'
   def getType( self ):
      return 'DummyAlg'
   pass # class DummyAlg
Ejemplo n.º 3
0
 def store(self, value):
     if not isinstance(value, PrivateToolHandleArray):
         #try to convert the value to a PrivateToolHandleArray
         value = PrivateToolHandleArray(value)
     return value
Ejemplo n.º 4
0
def TrackingGeometrySvcCfg(flags,
                           name='AtlasTrackingGeometrySvc',
                           doMaterialValidation=False):
    """
    Sets up the Tracking Geometry Service
    """
    result = ComponentAccumulator()
    atlas_tracking_geometry_name = 'AtlasTrackingGeometry'
    atlas_geometry_builder = Trk__GeometryBuilder(
        name='AtlasGeometryBuilder',
        WorldDimension=[],
        WorldMaterialProperties=[],
        TrackingVolumeArrayCreator=CompFactory.Trk.TrackingVolumeArrayCreator(
            name="TrackingVolumeArrayCreator"),
        TrackingVolumeHelper=CompFactory.Trk.TrackingVolumeHelper(
            name="TrackingVolumeHelper"))

    envelopSvcCfg = EnvelopeDefSvcCfg(flags)
    atlas_env_def_service = envelopSvcCfg.getPrimary()
    result.merge(envelopSvcCfg)

    # Depending on the job configuration, setup the various detector builders, and add to atlas_geometry_builder
    if flags.Detector.GeometryID:
        # TODO Not sure how to handle TrkDetFlags, specifically ISF_FatrasCustomGeometry, XMLFastCustomGeometry, SLHC_Geometry
        # So, here we only setup the default InDet geometry builder!
        inDetTrackingGeometryBuilder = _getInDetTrackingGeometryBuilder(
            name='InDetTrackingGeometryBuilder',
            flags=flags,
            result=result,
            envelopeDefinitionSvc=atlas_env_def_service)

        atlas_geometry_builder.InDetTrackingGeometryBuilder = inDetTrackingGeometryBuilder

    if flags.Detector.GeometryCalo:
        Trk__CylinderVolumeCreator = CompFactory.Trk.CylinderVolumeCreator
        caloVolumeCreator = Trk__CylinderVolumeCreator("CaloVolumeCreator")
        result.addPublicTool(caloVolumeCreator)

        Trk__TrackingVolumeHelper = CompFactory.Trk.TrackingVolumeHelper
        trackingVolumeHelper = Trk__TrackingVolumeHelper(
            name='TrackingVolumeHelper')
        result.addPublicTool(trackingVolumeHelper)

        caloTrackingGeometryBuilder = _getCaloTrackingGeometryBuilder(
            name='CaloTrackingGeometryBuilder',
            flags=flags,
            result=result,
            envelopeDefinitionSvc=atlas_env_def_service,
            trackingVolumeHelper=trackingVolumeHelper)
        caloTrackingGeometryBuilder.TrackingVolumeCreator = caloVolumeCreator
        atlas_geometry_builder.CaloTrackingGeometryBuilder = caloTrackingGeometryBuilder

    if flags.Detector.GeometryMuon:
        # Copied from from MuonTrackingGeometry.ConfiguredMuonTrackingGeometry import MuonTrackingGeometryBuilder
        Muon__MuonStationTypeBuilder = CompFactory.Muon.MuonStationTypeBuilder
        muonStationTypeBuilder = Muon__MuonStationTypeBuilder(
            name='MuonStationTypeBuilder')

        Muon__MuonStationBuilder = CompFactory.Muon.MuonStationBuilder
        muonStationBuilder = Muon__MuonStationBuilder(
            name='MuonStationBuilder')
        muonStationBuilder.StationTypeBuilder = muonStationTypeBuilder

        muonInertMaterialBuilder = CompFactory.Muon.MuonInertMaterialBuilder(
            name='MuonInertMaterialBuilder')

        Muon__MuonTrackingGeometryBuilder = CompFactory.Muon.MuonTrackingGeometryBuilder
        muonTrackingGeometryBuilder = Muon__MuonTrackingGeometryBuilder(
            name='MuonTrackingGeometryBuilder',
            EnvelopeDefinitionSvc=atlas_env_def_service,
            MuonStationBuilder=muonStationBuilder,
            InertMaterialBuilder=muonInertMaterialBuilder)
        # import pdb ; pdb.set_trace()
        muonTrackingGeometryBuilder.EntryVolumeName = 'MuonSpectrometerEntrance'
        muonTrackingGeometryBuilder.ExitVolumeName = 'Muon::Containers::MuonSystem'
        # result.addPublicTool(muonTrackingGeometryBuilder)

        atlas_geometry_builder.MuonTrackingGeometryBuilder = muonTrackingGeometryBuilder

    # Now set up processors
    atlas_geometry_processors = []

    if flags.TrackingGeometry.MaterialSource == 'COOL':
        CoolDataBaseFolder = '/GLOBAL/TrackingGeo/LayerMaterialV2'  # Was from TrkDetFlags.MaterialStoreGateKey()
        # the material provider
        Trk__LayerMaterialProvider = CompFactory.Trk.LayerMaterialProvider
        atlasMaterialProvider = Trk__LayerMaterialProvider(
            'AtlasMaterialProvider', LayerMaterialMapName=CoolDataBaseFolder)
        atlas_geometry_processors += [atlasMaterialProvider]

        # Setup DBs
        result.merge(_setupCondDB(flags, CoolDataBaseFolder))
    elif flags.TrackingGeometry.MaterialSource == 'Input':
        Trk__InputLayerMaterialProvider = CompFactory.Trk.InputLayerMaterialProvider
        atlasMaterialProvider = Trk__InputLayerMaterialProvider(
            'AtlasMaterialProvider')
        atlas_geometry_processors += [atlasMaterialProvider]

    if doMaterialValidation:
        Trk__LayerMaterialInspector = CompFactory.Trk.LayerMaterialInspector
        atlasLayerMaterialInspector = Trk__LayerMaterialInspector(
            'AtlasLayerMaterialInspector')
        atlas_geometry_processors += [atlasLayerMaterialInspector]

    svc = Trk__TrackingGeometrySvc(
        name,
        GeometryBuilder=atlas_geometry_builder,
        TrackingGeometryName=atlas_tracking_geometry_name,
        GeometryProcessors=PrivateToolHandleArray(atlas_geometry_processors),
        BuildGeometryFromTagInfo=True)
    result.addService(svc, primary=True)

    return result
Ejemplo n.º 5
0
#Set the EventData2XML properties
import os

topSequence.AlgoJiveXML.AtlasRelease = os.environ["AtlasVersion"]
topSequence.AlgoJiveXML.OnlineMode = False
topSequence.AlgoJiveXML.WriteToFile = False
topSequence.AlgoJiveXML.OutputLevel = INFO

from GaudiKernel.GaudiHandles import PrivateToolHandleArray
from GaudiKernel.GaudiHandles import PublicToolHandleArray
from GaudiKernel.GaudiHandles import PublicToolHandle

#Also stream to our new server and the "external" server
from JiveXML.JiveXMLConf import JiveXML__StreamToServerTool

topSequence.AlgoJiveXML.StreamTools += PrivateToolHandleArray(
    ["JiveXML::StreamToServerTool/StreamToServerTool"])
secondStream = JiveXML__StreamToServerTool("StreamToExternalServerTool",
                                           OutputLevel=VERBOSE,
                                           StreamName="copy")
#Have the second stream tool stream to the external server
from GaudiKernel.GaudiHandles import ServiceHandle
#secondStream.ServerService = ServiceHandle("JiveXML::ExternalONCRPCServerSvc/ExternalONCRPCServerSvc")
secondStream.ServerService = ServiceHandle(ExternalSvc)
#Then add it to the list of stream tools
topSequence.AlgoJiveXML.StreamTools += [secondStream]

###Add retrievers using data types
#topSequence.AlgoJiveXML.DataTypes += ['JiveXML::AODCaloClusterRetriever/AODCaloClusterRetriever']
#
##Add retrievers using ToolHandleArray with Configurables
#from AnalysisJiveXML.AnalysisJiveXMLConf import JiveXML__AODCaloClusterRetriever
Ejemplo n.º 6
0
    def setDefaultProperty(cls, propertyName, value):
        #  choose according to expected type
        try:
            prop = cls._properties[propertyName]
        except KeyError:
            raise AttributeError("%s does not have property %s" %
                                 (cls.__name__, propertyName))

        errorAllowedTypes = None
        cxxdefault = prop.default
        if type(cxxdefault) == type(value):
            cls._userDefaults[propertyName] = copy.copy(value)
        elif isinstance(cxxdefault, PublicToolHandle):
            if value is None:
                cls._userDefaults[propertyName] = PublicToolHandle("")
            elif type(value) == str:
                cls._userDefaults[propertyName] = PublicToolHandle(value)
            elif isinstance(value, ConfigurableAlgTool):
                cls._userDefaults[propertyName] = PublicToolHandle(
                    value.getFullName())
            elif isinstance(value, PublicToolHandle):
                cls._userDefaults[propertyName] = copy.copy(value)
            else:
                errorAllowedTypes = "str,PublicToolHandle,ConfigurableAlgTool"

        elif isinstance(cxxdefault, PublicToolHandleArray):
            if value is None:
                cls._userDefaults[propertyName] = PublicToolHandleArray()
            elif type(value) == list:
                cls._userDefaults[propertyName] = PublicToolHandleArray(value)
            elif isinstance(value, PublicToolHandleArray):
                cls._userDefaults[propertyName] = copy.copy(value)
            else:
                errorAllowedTypes = "list,PublicToolHandleArray"

        elif isinstance(cxxdefault, PrivateToolHandle):
            if value is None:
                cls._userDefaults[propertyName] = PrivateToolHandle("")
            elif type(value) == str:
                cls._userDefaults[propertyName] = PrivateToolHandle(value)
            elif isinstance(value, ConfigurableAlgTool):
                cls._userDefaults[propertyName] = copy.deepcopy(value)
            elif isinstance(value, PrivateToolHandle):
                cls._userDefaults[propertyName] = copy.copy(value)
            else:
                errorAllowedTypes = "str,PrivateToolHandle,ConfigurableAlgTool"

        elif isinstance(cxxdefault, PrivateToolHandleArray):
            if value is None:
                cls._userDefaults[propertyName] = PrivateToolHandleArray()
            elif type(value) == list:
                cls._userDefaults[propertyName] = PrivateToolHandleArray(value)
            elif isinstance(value, PrivateToolHandleArray):
                cls._userDefaults[propertyName] = copy.copy(value)
            else:
                errorAllowedTypes = "list,PrivateToolHandleArray"

        elif isinstance(cxxdefault, ServiceHandle):
            if value is None:
                cls._userDefaults[propertyName] = ServiceHandle("")
            elif type(value) == str:
                cls._userDefaults[propertyName] = ServiceHandle(value)
            elif isinstance(value, ConfigurableService):
                cls._userDefaults[propertyName] = ServiceHandle(
                    value.getFullName())
            elif isinstance(value, ServiceHandle):
                cls._userDefaults[propertyName] = copy.copy(value)
            else:
                errorAllowedTypes = "str,ServiceHandle,ConfigurableService"

        else:
            cls._userDefaults[propertyName] = value

        if errorAllowedTypes:
            raise TypeError(
                "Setting default property %s.%s with wrong type. Expected %s got %s"
                % (cls.__name__, propertyName, errorAllowedTypes,
                   type(value).__name__))