def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs):
    from Digitization.DigitizationFlags import digitizationFlags
    #FIXME: at some point we should move away from being dependent on the experimentalDigi flags.
    if 'doFastSCT_Digi' in digitizationFlags.experimentalDigi(
    ) and not 'doFastPixelDigi' in digitizationFlags.experimentalDigi():
        kwargs.setdefault("UsePixelCalibCondDB", False)
        kwargs.setdefault("PixelCalibSvc", "")
        kwargs.setdefault("PixelOfflineCalibSvc", "")
    else:
        from AthenaCommon.Include import include
        include("PixelConditionsServices/PixelDCSSvc_jobOptions.py")
        include.block("PixelConditionsServices/PixelDCSSvc_jobOptions.py")
        from AthenaCommon.AppMgr import ToolSvc
        if not hasattr(ToolSvc, "PixelRecoDbTool"):
            from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool
            ToolSvc += PixelRecoDbTool()
        ToolSvc.PixelRecoDbTool.InputSource = 1

        # setup PixelCalibDbTool in ToolSvc
        if not hasattr(ToolSvc, "PixelCalibDbTool"):
            from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool
            ToolSvc += PixelCalibDbTool()

        from IOVDbSvc.CondDB import conddb
        if not conddb.folderRequested('/PIXEL/PixCalib'):
            conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib")
        if not conddb.folderRequested('/PIXEL/ReadoutSpeed'):
            conddb.addFolder("PIXEL_OFL", "/PIXEL/ReadoutSpeed")
        from AthenaCommon.AppMgr import ServiceMgr
        if not hasattr(ServiceMgr, "PixelCalibSvc"):
            from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc
            InDetPixelCalibSvc = PixelCalibSvc()
            ServiceMgr += InDetPixelCalibSvc
        if not hasattr(ServiceMgr, "PixelSiPropertiesSvc"):
            from SiLorentzAngleSvc.LorentzAngleSvcSetup import lorentzAngleSvc
            from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc
            PixelSiPropertiesSvc = SiPropertiesSvc(
                name="PixelSiPropertiesSvc",
                DetectorName="Pixel",
                SiConditionsServices=lorentzAngleSvc.pixelSiliconConditionsSvc)
            ServiceMgr += PixelSiPropertiesSvc
        if not hasattr(ServiceMgr, "PixelOfflineCalibSvc"):
            from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc
            ServiceMgr += PixelOfflineCalibSvc()
            ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False

    from AthenaCommon import CfgMgr
    return CfgMgr.InDet__ClusterMakerTool(name, **kwargs)
Beispiel #2
0
# Get ToolSvc and ServiceMgr
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.AppMgr import ServiceMgr

# make sure ToolSvc is there...
if not "ToolSvc"         in theApp.ExtSvc and \
   not "ToolSvc/ToolSvc" in theApp.ExtSvc:
    theApp.ExtSvc += [ "ToolSvc/ToolSvc"]
    pass

from IOVDbSvc.CondDB import conddb


from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool
ToolSvc += PixelRecoDbTool()
ToolSvc.PixelRecoDbTool.InputSource = 1

from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool
ToolSvc += PixelCalibDbTool()

if not conddb.folderRequested('/PIXEL/PixCalib'):
  conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib")
if not conddb.folderRequested('/PIXEL/ReadoutSpeed'):
  conddb.addFolder("PIXEL_OFL","/PIXEL/ReadoutSpeed")
from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc
InDetPixelCalibSvc = PixelCalibSvc()
ServiceMgr += InDetPixelCalibSvc


        # is not reliable on MC.
        InDetPixelConditionsSummarySvc.UseByteStream = False
    else:
        from PixelConditionsServices.PixelConditionsServicesConf import PixelByteStreamErrorsSvc
        InDetPixelByteStreamErrorsSvc = PixelByteStreamErrorsSvc()
        if (globalflags.InputFormat != 'bytestream'):
            InDetPixelByteStreamErrorsSvc.ReadingESD = True
        InDetPixelConditionsSummarySvc.UseByteStream = True

        ServiceMgr += InDetPixelByteStreamErrorsSvc
        if (InDetFlags.doPrintConfigurables()):
            print InDetPixelByteStreamErrorsSvc

    # Load Pixel reconstruction parameters
    from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool
    ToolSvc += PixelRecoDbTool(name="PixelRecoDbTool")

    if athenaCommonFlags.isOnline():
        ToolSvc.PixelRecoDbTool.InputSource = 1
    else:
        if not conddb.folderRequested('/PIXEL/Pixreco'):
            conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco")
        ToolSvc.PixelRecoDbTool.InputSource = 2

    if not athenaCommonFlags.isOnline():
        if not conddb.folderRequested('/PIXEL/PixdEdx'):
            if (globalflags.DataSource() == 'data'):
                conddb.addFolder("PIXEL_OFL", "/PIXEL/PixdEdx")
            else:
                conddb.addFolder("PIXEL_OFL", "/PIXEL/PixdEdx")
    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
Beispiel #5
0
def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs):
    from Digitization.DigitizationFlags import digitizationFlags

    #################################
    # Config pixel conditions setup #
    #################################
    from IOVDbSvc.CondDB import conddb
    from AthenaCommon.AlgSequence import AthSequencer
    condSeq = AthSequencer("AthCondSeq")
    #################
    # Module status #
    #################
    useNewChargeFormat  = False

    if not hasattr(condSeq, "PixelConfigCondAlg"):
        from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg

        IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat"
        rodIDForSingleLink40=0
        # ITk:
        if geoFlags.isSLHC():
            IdMappingDat = "ITk_Atlas_IdMapping.dat"
            if "BrlIncl4.0_ref" == commonGeoFlags.GeoType():
                IdMappingDat = "ITk_Atlas_IdMapping_InclBrl4.dat"
            elif "IBrlExt4.0ref" == commonGeoFlags.GeoType():
                IdMappingDat = "ITk_Atlas_IdMapping_IExtBrl4.dat"
            elif "BrlExt4.0_ref" == commonGeoFlags.GeoType():
                IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl4.dat"
            elif "BrlExt3.2_ref" == commonGeoFlags.GeoType():
                IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl32.dat"
        elif (geoFlags.isIBL() == False):
            IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping.dat"
        else:
            # Planar IBL
            if (geoFlags.IBLLayout() == "planar"):
                if (geoFlags.isDBM() == True):
                    IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL_DBM.dat"
                else:
                    IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL.dat"
            # Hybrid IBL plus DBM
            elif (geoFlags.IBLLayout() == "3D"):
                IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat"
        
        condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", 
                                      UseDeadmapConditions=False,
                                      UseDCSStateConditions=False,
                                      UseDCSStatusConditions=False,
                                      UseTDAQConditions=False,
                                      UseCalibConditions=True,
                                      UseCablingConditions=False,
                                      CablingMapFileName=IdMappingDat)

    #FIXME: at some point we should move away from being dependent on the experimentalDigi flags.
    if 'doFastSCT_Digi' in digitizationFlags.experimentalDigi() and not 'doFastPixelDigi' in digitizationFlags.experimentalDigi():
        PixelConfigCondAlg.UseCalibConditions=False
    else:
        #####################
        # Calibration Setup #
        #####################
        if not useNewChargeFormat:
            if not conddb.folderRequested("/PIXEL/PixCalib"):
                conddb.addFolderSplitOnline("PIXEL", "/PIXEL/Onl/PixCalib", "/PIXEL/PixCalib", className="CondAttrListCollection")
            if not hasattr(condSeq, 'PixelChargeCalibCondAlg'):
                from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg
                condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib")
        else:
            if not conddb.folderRequested("/PIXEL/ChargeCalibration"):
                conddb.addFolder("PIXEL_OFL", "/PIXEL/ChargeCalibration", className="CondAttrListCollection")
            if not hasattr(condSeq, 'PixelChargeLUTCalibCondAlg'):
                from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeLUTCalibCondAlg
                condSeq += PixelChargeLUTCalibCondAlg(name="PixelChargeLUTCalibCondAlg", ReadKey="/PIXEL/ChargeCalibration")

        #####################
        # Cabling map Setup #
        #####################
        if (conddb.dbmc=="OFLP200" and geoFlags.isIBL()==True) and not conddb.folderRequested("/PIXEL/HitDiscCnfg"):
            conddb.addFolderSplitMC("PIXEL","/PIXEL/HitDiscCnfg","/PIXEL/HitDiscCnfg", className="AthenaAttributeList")

            if not hasattr(condSeq, 'PixelHitDiscCnfgAlg'):
                from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelHitDiscCnfgAlg
                condSeq += PixelHitDiscCnfgAlg(name="PixelHitDiscCnfgAlg")

        if not conddb.folderRequested("/PIXEL/ReadoutSpeed"):
            conddb.addFolderSplitMC("PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed", className="AthenaAttributeList")

        if not hasattr(condSeq, 'PixelReadoutSpeedAlg'):
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelReadoutSpeedAlg
            condSeq += PixelReadoutSpeedAlg(name="PixelReadoutSpeedAlg")

        if not hasattr(condSeq, 'PixelCablingCondAlg'):
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelCablingCondAlg
            condSeq += PixelCablingCondAlg(name="PixelCablingCondAlg",
                                           MappingFile=IdMappingDat,
                                           RodIDForSingleLink40=rodIDForSingleLink40)

        if not conddb.folderRequested('/PIXEL/PixdEdx'):
            conddb.addFolder("PIXEL_OFL", "/PIXEL/PixdEdx", className="AthenaAttributeList")

        if not conddb.folderRequested("/PIXEL/PixReco"):
            conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco", className="DetCondCFloat")

        if not conddb.folderRequested("/Indet/PixelDist"):
            conddb.addFolder("INDET", "/Indet/PixelDist", className="DetCondCFloat")

        if not hasattr(condSeq, 'PixelOfflineCalibCondAlg'):
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelOfflineCalibCondAlg
            condSeq += PixelOfflineCalibCondAlg(name="PixelOfflineCalibCondAlg", ReadKey="/PIXEL/PixReco")
            PixelOfflineCalibCondAlg.InputSource = 2

        if not hasattr(ToolSvc, "PixelLorentzAngleTool"):
            from SiLorentzAngleTool.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup
            pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup()

        if not hasattr(condSeq, 'PixelDistortionAlg'):
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDistortionAlg
            condSeq += PixelDistortionAlg(name="PixelDistortionAlg")

        if not hasattr(condSeq, 'PixeldEdxAlg'):
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixeldEdxAlg
            condSeq += PixeldEdxAlg(name="PixeldEdxAlg")
            PixeldEdxAlg.ReadFromCOOL = True

        from AthenaCommon.AppMgr import ToolSvc
        if not hasattr(ToolSvc, "PixelRecoDbTool"):
            from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool
            ToolSvc += PixelRecoDbTool()
        ToolSvc.PixelRecoDbTool.InputSource = 1

    from AthenaCommon import CfgMgr
    return CfgMgr.InDet__ClusterMakerTool(name,**kwargs)