Example #1
0
    def __init__(self):

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from AthenaCommon.AppMgr import ToolSvc

        from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc

        # Init SCTLorentzAngleSvc
        if hasattr(svcMgr, 'SCTLorentzAngleSvc'):
            sctLorentzAngleSvc = svcMgr.SCTLorentzAngleSvc
        else:
            sctLorentzAngleSvc = SiLorentzAngleSvc(name="SCTLorentzAngleSvc",
                                                   DetectorName="SCT")
            svcMgr += sctLorentzAngleSvc

        # Init PixelSiliconConditionsSvc
        if hasattr(svcMgr, 'SCT_SiliconConditionsSvc'):
            sctSiliconConditionsSvc = svcMgr.SCT_SiliconConditionsSvc
        else:
            from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_SiliconConditionsSvc
            sctSiliconConditionsSvc = SCT_SiliconConditionsSvc()
            svcMgr += sctSiliconConditionsSvc

        from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc
        sctSiPropertiesSvc = SiPropertiesSvc(
            name="SCT_SiPropertiesSvc",
            DetectorName="SCT",
            SiConditionsServices=sctSiliconConditionsSvc)
        svcMgr += sctSiPropertiesSvc

        # Pass the silicon conditions services to the Lorentz angle service
        # Also make sure UseMagFieldTool is True as AtlasGeoModel sets this to False
        # if loaded first.
        sctLorentzAngleSvc.UseMagFieldSvc = True
        sctLorentzAngleSvc.SiConditionsServices = sctSiliconConditionsSvc
        sctLorentzAngleSvc.SiPropertiesSvc = sctSiPropertiesSvc

        self.SCTLorentzAngleSvc = sctLorentzAngleSvc
        self.sctSiliconConditionsSvc = sctSiliconConditionsSvc
        self.SCT_SiliconConditionsSvc = sctSiliconConditionsSvc
        self.sctSiPropertiesSvc = sctSiPropertiesSvc
        self.SCT_SiPropertiesSvc = sctSiPropertiesSvc

        self.SCT_SiPropertiesSvc.UseConditionsDB = True
    def initLorentzAngleSvc(self, instanceName):
        "Inititalize Lorentz angle Service"
        from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc
        SCTLorentzAngleSvc = SiLorentzAngleSvc(name=instanceName,
                                               DetectorName="SCT")
        from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_SiliconConditionsSvc
        sctSiliconConditionsSvc=\
                                  SCT_SiliconConditionsSvc(name=self.instanceName('InDetSCT_SiliconConditionsSvc'),
                                                           DCSConditionsSvc=self.dcsSvc)
        sctSiliconConditionsSvc.CheckGeoModel = False
        sctSiliconConditionsSvc.ForceUseGeoModel = False
        #sctSiliconConditionsSvc.OutputLevel=1
        self.svcMgr += sctSiliconConditionsSvc
        if self._print: print sctSiliconConditionsSvc

        SCTLorentzAngleSvc.SiConditionsServices = sctSiliconConditionsSvc
        SCTLorentzAngleSvc.UseMagFieldSvc = True  #may need also MagFieldSvc instance

        self.svcMgr += SCTLorentzAngleSvc
    def __init__(self):

        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from AthenaCommon.AppMgr import ToolSvc

        from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc

        # Init PixelLorentzAngleSvc
        if hasattr(svcMgr, 'PixelLorentzAngleSvc'):
            pixelLorentzAngleSvc = svcMgr.PixelLorentzAngleSvc
        else:
            pixelLorentzAngleSvc = SiLorentzAngleSvc(
                name="PixelLorentzAngleSvc", DetectorName="Pixel")
            svcMgr += pixelLorentzAngleSvc

        # Init PixelSiliconConditionsSvc
        if hasattr(svcMgr, 'PixelSiliconConditionsSvc'):
            pixelSiliconConditionsSvc = svcMgr.PixelSiliconConditionsSvc
        else:
            from PixelConditionsServices.PixelConditionsServicesConf import PixelSiliconConditionsSvc
            pixelSiliconConditionsSvc = PixelSiliconConditionsSvc()
            svcMgr += pixelSiliconConditionsSvc

        pixelSiliconConditionsSvc.DepletionVoltage = 10.0

        from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc
        pixelSiPropertiesSvc = SiPropertiesSvc(
            name="PixelSiPropertiesSvc",
            DetectorName="Pixel",
            SiConditionsServices=pixelSiliconConditionsSvc)
        svcMgr += pixelSiPropertiesSvc

        # Pass the silicon conditions services to the Lorentz angle service
        # Also make sure UseMagFieldTool is True as AtlasGeoModel sets this to False
        # if loaded first.
        pixelLorentzAngleSvc.UseMagFieldSvc = True
        pixelLorentzAngleSvc.SiConditionsServices = pixelSiliconConditionsSvc
        pixelLorentzAngleSvc.SiPropertiesSvc = pixelSiPropertiesSvc
        #pixelLorentzAngleSvc.CorrectionFactor = 0.900
        #Load Correction factor from database
        from IOVDbSvc.CondDB import conddb
        #conddb.addFolder("","/PIXEL/LorentzAngleScale<db>sqlite://;schema=PixelLorentzAngle_MC.db;dbname=OFLP200</db><tag>PIXELLorentzAngleScale-Simu-001</tag>")
        #conddb.addFolder("PIXEL_OFL","/PIXEL/LorentzAngleScale")

        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        if athenaCommonFlags.isOnline():
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/LorentzAngleScale",
                                        "/PIXEL/LorentzAngleScale")
        else:
            conddb.addFolder("PIXEL_OFL", "/PIXEL/LorentzAngleScale")
        pixelLorentzAngleSvc.CorrDBFolder = "/PIXEL/LorentzAngleScale"

        self.PixelLorentzAngleSvc = pixelLorentzAngleSvc
        self.pixelSiliconConditionsSvc = pixelSiliconConditionsSvc
        self.PixelSiliconConditionsSvc = pixelSiliconConditionsSvc
        self.pixelSiPropertiesSvc = pixelSiPropertiesSvc
        self.PixelSiPropertiesSvc = pixelSiPropertiesSvc

        self.PixelSiPropertiesSvc.UseConditionsDB = True
def getSCT_DetectorTool(name="SCT_DetectorTool", **kwargs):
    kwargs.setdefault("DetectorName", "SCT")
    kwargs.setdefault("InitialLayout", False)
    kwargs.setdefault("Alignable", True)
    kwargs.setdefault("RDBAccessSvc", "RDBAccessSvc")
    kwargs.setdefault("GeometryDBSvc", "InDetGeometryDBSvc")
    kwargs.setdefault("GeoModelSvc", "GeoModelSvc")
    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.digitize.SCT_on() or DetFlags.haveRDO.SCT_on(
    ) or DetFlags.haveRIO.SCT_on():
        # SCTLorentzAngleSvc needed for digi and reco
        from AthenaCommon.AppMgr import ServiceMgr
        if not hasattr(ServiceMgr, 'SCTLorentzAngleSvc'):
            from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc
            SCTLorentzAngleSvc = SiLorentzAngleSvc(name="SCTLorentzAngleSvc",
                                                   SiConditionsServices=None,
                                                   UseMagFieldSvc=False,
                                                   DetectorName="SCT")
            ServiceMgr += SCTLorentzAngleSvc
        kwargs.setdefault("LorentzAngleSvc", "SCTLorentzAngleSvc")
    else:
        # SCTLorentzAngleSvc not needed for simulation
        kwargs.setdefault("LorentzAngleSvc", "")
    return CfgMgr.SCT_DetectorTool(name, **kwargs)
def getPixelDetectorTool(name="PixelDetectorTool", **kwargs):
    from AtlasGeoModel.InDetGMJobProperties import GeometryFlags
    if GeometryFlags.isSLHC():
        kwargs.setdefault("ServiceBuilderTool", "InDetServMatBuilderToolSLHC")
    else:
        kwargs.setdefault("ServiceBuilderTool", "")
    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.digitize.pixel_on() or DetFlags.haveRDO.pixel_on(
    ) or DetFlags.haveRIO.pixel_on():
        # PixelLorentzAngleSvc needed for digi and reco
        from AthenaCommon.AppMgr import ServiceMgr
        if not hasattr(ServiceMgr, 'PixelLorentzAngleSvc'):
            from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc
            PixelLorentzAngleSvc = SiLorentzAngleSvc(
                name="PixelLorentzAngleSvc",
                SiConditionsServices=None,
                UseMagFieldSvc=False,
                DetectorName="Pixel")
            ServiceMgr += PixelLorentzAngleSvc
        kwargs.setdefault("LorentzAngleSvc", "PixelLorentzAngleSvc")
    else:
        # PixelLorentzAngleSvc not needed for simulation
        kwargs.setdefault("LorentzAngleSvc", "")
    return CfgMgr.PixelDetectorTool(name, **kwargs)
    def createSvc(self):
        from AthenaCommon.AppMgr import ToolSvc, ServiceMgr, theApp
        from IOVDbSvc.CondDB import conddb

        from PixelConditionsServices.PixelConditionsServicesConf import PixelConditionsSummarySvc as pixSummarySvc
        PixelConditionsSummarySvc = \
            pixSummarySvc(name=self.instanceName('PixelConditionsSummarySvc'),
                          UseDCS = self.useDCS,
                          UseByteStream=self.useBS,
                          #UseSpecialPixelMap= not self.onlineMode,
                          UseSpecialPixelMap=True,
                          UseTDAQ=self.useTDAQ
                          )
        #active states used by dcs (if on)
        if self.useDCS and not self.onlineMode:
            PixelConditionsSummarySvc.IsActiveStates = ['READY', 'ON']
            PixelConditionsSummarySvc.IsActiveStatus = ['OK', 'WARNING']

        ServiceMgr += PixelConditionsSummarySvc

        if self._print: print PixelConditionsSummarySvc

        # #create another instance of the PixelConditionsSummarySvc w/o BS
        # #   service to be used with RegionSelector
        # InDetTrigRSPixelConditionsSummarySvc = pixSummarySvc(name='InDetTrigRSPixelConditionsSummarySvc',
        #                                                      UseDCS = self.useDCS,
        #                                                      UseByteStream=self.useBS
        #                                                      UseSpecialPixelMap= True,
        #                                                      )
        # ServiceMgr += InDetTrigRSPixelConditionsSummarySvc
        # if self._print: print InDetTrigRSPixelConditionsSummarySvc

        if not self.onlineMode:
            from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc
            PixelCalibSvc = PixelCalibSvc(
                name=self.instanceName('PixelCalibSvc'))

            if not conddb.folderRequested("/PIXEL/PixCalib"):
                conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib")

            if self._print: print PixelCalibSvc

            #only when inputsource=1
            #if not conddb.folderRequested("/PIXEL/PixReco"):
            #  conddb.addFolder("PIXEL_OFL","/PIXEL/PixReco")

        if not conddb.folderRequested("/PIXEL/PixReco"):
            conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/PixReco",
                                        "/PIXEL/PixReco")

        #Configure PixelRecoDbTool
        from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool
        PixelRecoDbTool = PixelRecoDbTool(
            name=self.instanceName('PixelRecoDbTool'))
        ToolSvc += PixelRecoDbTool
        PixelRecoDbTool.InputSource = 2
        # if self.onlineMode:
        #   PixelRecoDbTool.InputSource = 1      #after change of run1 conditions
        # else:
        #   PixelRecoDbTool.InputSource = 2

        if self._print: print PixelRecoDbTool

        #use corresponding PixelRecoDBTool
        from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc
        PixelOfflineCalibSvc = PixelOfflineCalibSvc(
            self.instanceName('PixelOfflineCalibSvc'))
        PixelOfflineCalibSvc.PixelRecoDbTool = PixelRecoDbTool
        ServiceMgr += PixelOfflineCalibSvc

        if self._print: print PixelOfflineCalibSvc

        ### configure the special pixel map service
        if not (conddb.folderRequested("/PIXEL/PixMapShort")
                or conddb.folderRequested("/PIXEL/Onl/PixMapShort")):
            conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/PixMapShort",
                                        "/PIXEL/PixMapShort")
        if not (conddb.folderRequested("/PIXEL/PixMapLong")
                or conddb.folderRequested("/PIXEL/Onl/PixMapLong")):
            conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/PixMapLong",
                                        "/PIXEL/PixMapLong")
        if not (conddb.folderRequested("/PIXEL/NoiseMapShort")
                or conddb.folderRequested("/PIXEL/Onl/NoiseMapShort")):
            conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/NoiseMapShort",
                                        "/PIXEL/NoiseMapShort")
        if not (conddb.folderRequested("/PIXEL/NoiseMapLong")
                or conddb.folderRequested("/PIXEL/Onl/NoiseMapLong")):
            conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/NoiseMapLong",
                                        "/PIXEL/NoiseMapLong")
        if not (conddb.folderRequested("/PIXEL/PixMapOverlay")
                or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")):
            conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/PixMapOverlay",
                                        "/PIXEL/PixMapOverlay")

        from PixelConditionsServices.PixelConditionsServicesConf import SpecialPixelMapSvc

        SpecialPixelMapSvc = SpecialPixelMapSvc(name='SpecialPixelMapSvc')
        ServiceMgr += SpecialPixelMapSvc

        SpecialPixelMapSvc.DBFolders = [
            "/PIXEL/PixMapShort", "/PIXEL/PixMapLong"
        ]
        SpecialPixelMapSvc.SpecialPixelMapKeys = [
            "SpecialPixelMap", "SpecialPixelMapLong"
        ]

        SpecialPixelMapSvc.DBFolders += [
            "/PIXEL/NoiseMapShort", "/PIXEL/NoiseMapLong"
        ]
        SpecialPixelMapSvc.SpecialPixelMapKeys += [
            "NoiseMapShort", "NoiseMapLong"
        ]

        SpecialPixelMapSvc.OverlayKey = "PixMapOverlay"
        SpecialPixelMapSvc.OverlayFolder = "/PIXEL/PixMapOverlay"

        ServiceMgr += SpecialPixelMapSvc
        #theApp.CreateSvc += [ 'SpecialPixelMapSvc/%s' % self.instanceName('SpecialPixelMapSvc') ]

        if self._print: print SpecialPixelMapSvc

        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        from AthenaCommon.GlobalFlags import globalflags
        if self.useDCS or self.onlineMode:
            #sim
            if globalflags.DataSource() == 'geant4' or (
                    not athenaCommonFlags.isOnline()):
                if not conddb.folderRequested('/PIXEL/DCS/TEMPERATURE'):
                    conddb.addFolder("DCS_OFL", "/PIXEL/DCS/TEMPERATURE")
                if not conddb.folderRequested('/PIXEL/DCS/HV'):
                    conddb.addFolder("DCS_OFL", "/PIXEL/DCS/HV")
                if not conddb.folderRequested('/PIXEL/DCS/FSMSTATUS'):
                    conddb.addFolder("DCS_OFL", "/PIXEL/DCS/FSMSTATUS")
                if not conddb.folderRequested('/PIXEL/DCS/FSMSTATE'):
                    conddb.addFolder("DCS_OFL", "/PIXEL/DCS/FSMSTATE")
            else:
                if not conddb.folderRequested('/PIXEL/HLT/DCS/TEMPERATURE'):
                    conddb.addFolder("PIXEL_ONL", "/PIXEL/HLT/DCS/TEMPERATURE")
                    #conddb.addFolder("PIXEL","/PIXEL/HLT/DCS/TEMPERATURE <tag>PixDCSTemp-UPD1-00</tag>")
                if not conddb.folderRequested('/PIXEL/HLT/DCS/HV'):
                    conddb.addFolder("PIXEL_ONL", "/PIXEL/HLT/DCS/HV")
                    #conddb.addFolder("PIXEL","/PIXEL/HLT/DCS/HV <tag>PixDCSHV-UPD1-00</tag>")

            from PixelConditionsServices.PixelConditionsServicesConf import PixelDCSSvc
            InDetPixelDCSSvc = PixelDCSSvc(
                name='TrigPixelDCSSvc',
                RegisterCallback=True,
                TemperatureFolder="/PIXEL/DCS/TEMPERATURE",
                HVFolder="/PIXEL/DCS/HV",
                FSMStatusFolder="/PIXEL/DCS/FSMSTATUS",
                FSMStateFolder="/PIXEL/DCS/FSMSTATE",
                TemperatureFieldName="temperature",
                HVFieldName="HV",
                FSMStatusFieldName="FSM_status",
                FSMStateFieldName="FSM_state",
                UseFSMStatus=False,
                UseFSMState=False)

            if globalflags.DataSource() == 'data':
                if (not athenaCommonFlags.isOnline()):
                    InDetPixelDCSSvc.TemperatureFolder = "/PIXEL/DCS/TEMPERATURE"
                    InDetPixelDCSSvc.HVFolder = "/PIXEL/DCS/HV"
                else:
                    InDetPixelDCSSvc.TemperatureFolder = "/PIXEL/HLT/DCS/TEMPERATURE"
                    InDetPixelDCSSvc.HVFolder = "/PIXEL/HLT/DCS/HV"

            ServiceMgr += InDetPixelDCSSvc

        if self.useDCS or self.onlineMode:
            if self._print: print InDetPixelDCSSvc

        #this needs also updates how LorentzAngleSvc is accessed ()
        from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc
        PixelLorentzAngleSvc = SiLorentzAngleSvc(name='PixelLorentzAngleSvc')
        from PixelConditionsServices.PixelConditionsServicesConf import PixelSiliconConditionsSvc
        pixelSiliconConditionsSvc = PixelSiliconConditionsSvc(
            name=self.instanceName('PixelSiliconConditionsSvc'),
            PixelDCSSvc='TrigPixelDCSSvc')
        pixelSiliconConditionsSvc.ForceUseGeoModel = False
        pixelSiliconConditionsSvc.UseDBForHV = True
        pixelSiliconConditionsSvc.UseDBForTemperature = True
        ServiceMgr += pixelSiliconConditionsSvc

        PixelLorentzAngleSvc.SiConditionsServices = pixelSiliconConditionsSvc
        PixelLorentzAngleSvc.UseMagFieldSvc = True  #may need also MagFieldSvc instance

        #if self.useDCS or self.onlineMode:
        #if (globalflags.DataSource() == 'data'):
        #else:
        #pixelSiliconConditionsSvc.ForceUseGeoModel = True
        #PixelLorentzAngleSvc.pixelForceUseGeoModel()
        if self._print:
            print pixelSiliconConditionsSvc
            print PixelLorentzAngleSvc
Example #7
0
    if ( DetFlags.detdescr.SCT_on() ):

        if GeometryFlags.isSLHC():
            #SLHC specific code
            if "GMX" == GeometryFlags.StripGeoType():
                from SCT_GeoModelXml.SCT_GeoModelXmlConf import SCT_GMX_DetectorTool
                sctSLHCTool = SCT_GMX_DetectorTool()
            else:
                from SCT_SLHC_GeoModel.SCT_SLHC_GeoModelConf import SCT_SLHC_DetectorTool
                sctSLHCTool = SCT_SLHC_DetectorTool()
                sctSLHCTool.ServiceBuilderTool = InDetServMatBuilderToolSLHC
            GeoModelSvc.DetectorTools += [ sctSLHCTool ]
            if not hasattr(svcMgr,'SCTLorentzAngleSvc'):
                from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc
                SCTLorentzAngleSvc = SiLorentzAngleSvc(name = "SCTLorentzAngleSvc",
                                                       SiConditionsServices = None,
                                                       UseMagFieldSvc = False,
                                                       DetectorName = "SCT")
                svcMgr+=SCTLorentzAngleSvc
        else:
            # Current atlas specific code
            from AthenaCommon import CfgGetter
            GeoModelSvc.DetectorTools += [ CfgGetter.getPrivateTool("SCT_DetectorTool", checkType=True) ]

        GeoModelSvc.DetectorTools['SCT_DetectorTool'].useDynamicAlignFolders = GeometryFlags.useDynamicAlignFolders()

    if ( DetFlags.detdescr.TRT_on() ):
        from TRT_GeoModel.TRT_GeoModelConf import TRT_DetectorTool
        trtDetectorTool = TRT_DetectorTool()
        if ( DetFlags.simulate.TRT_on() ):
            trtDetectorTool.DoXenonArgonMixture = True
            trtDetectorTool.DoKryptonMixture = True