Exemple #1
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"

        elif (globalflags.DataSource == 'data'):
            from RecExConfig.AutoConfiguration import GetRunNumber
            runNum = GetRunNumber()
            if (runNum < 222222):
                useCablingConditions = False
                IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_May08.dat"
                rodIDForSingleLink40 = 1300000
Exemple #2
0
def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs):
    from AthenaCommon.AppMgr import ServiceMgr
    from AthenaCommon.AppMgr import ToolSvc
    from IOVDbSvc.CondDB import conddb
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    from AthenaCommon.GlobalFlags import globalflags

    ############################################################################################
    # Set up Pixel Module data (2018 condition)
    ############################################################################################
    from AthenaCommon.AlgSequence import AthSequencer
    condSeq = AthSequencer("AthCondSeq")

    #################
    # Module status #
    #################
    useNewDeadmapFormat = False
    useNewChargeFormat = False

    if not useNewDeadmapFormat:
        if not (conddb.folderRequested("/PIXEL/PixMapOverlay")
                or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/PixMapOverlay",
                                        "/PIXEL/PixMapOverlay",
                                        className='CondAttrListCollection')

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

        PixelConfigCondAlg.UseCalibConditions = True
        PixelConfigCondAlg.UseDeadmapConditions = True
        PixelConfigCondAlg.UseDCSStateConditions = False
        PixelConfigCondAlg.UseDCSStatusConditions = False
        PixelConfigCondAlg.UseDCSHVConditions = True
        PixelConfigCondAlg.UseDCSTemperatureConditions = True
        PixelConfigCondAlg.UseTDAQConditions = False
        PixelConfigCondAlg.UseCablingConditions = False

        from AthenaCommon.BeamFlags import jobproperties
        if jobproperties.Beam.beamType == "cosmics":
            PixelConfigCondAlg.UseComTime = True
            PixelConfigCondAlg.BarrelTimeJitter = [25.0, 25.0, 25.0, 25.0]
            PixelConfigCondAlg.EndcapTimeJitter = [25.0, 25.0, 25.0]
            PixelConfigCondAlg.DBMTimeJitter = [25.0, 25.0, 25.0]
            PixelConfigCondAlg.BarrelNumberOfBCID = [8, 8, 8, 8]
            PixelConfigCondAlg.EndcapNumberOfBCID = [8, 8, 8]
            PixelConfigCondAlg.DBMNumberOfBCID = [8, 8, 8]
            PixelConfigCondAlg.BarrelTimeOffset = [100.0, 100.0, 100.0, 100.0]
            PixelConfigCondAlg.EndcapTimeOffset = [100.0, 100.0, 100.0]
            PixelConfigCondAlg.DBMTimeOffset = [100.0, 100.0, 100.0]
        else:
            PixelConfigCondAlg.UseComTime = False
            PixelConfigCondAlg.BarrelTimeJitter = [0.0, 0.0, 0.0, 0.0]
            PixelConfigCondAlg.EndcapTimeJitter = [0.0, 0.0, 0.0]
            PixelConfigCondAlg.DBMTimeJitter = [0.0, 0.0, 0.0]
            PixelConfigCondAlg.BarrelNumberOfBCID = [1, 1, 1, 1]
            PixelConfigCondAlg.EndcapNumberOfBCID = [1, 1, 1]
            PixelConfigCondAlg.DBMNumberOfBCID = [1, 1, 1]
            PixelConfigCondAlg.BarrelTimeOffset = [5.0, 5.0, 5.0, 5.0]
            PixelConfigCondAlg.EndcapTimeOffset = [5.0, 5.0, 5.0]
            PixelConfigCondAlg.DBMTimeOffset = [5.0, 5.0, 5.0]

        PixelConfigCondAlg.BunchSpace = 25.0
        PixelConfigCondAlg.FEI4BarrelHitDiscConfig = [2]

        #====================================================================================
        # Run-dependent SIMULATION(digitization) parameters:
        #====================================================================================
        # RUN2 2015/2016
        PixelConfigCondAlg.BarrelToTThreshold2016 = [-1, 5, 5, 5]
        PixelConfigCondAlg.FEI3BarrelLatency2016 = [0, 151, 256, 256]
        PixelConfigCondAlg.FEI3BarrelHitDuplication2016 = [
            False, False, False, False
        ]
        PixelConfigCondAlg.FEI3BarrelSmallHitToT2016 = [-1, -1, -1, -1]
        PixelConfigCondAlg.FEI3BarrelTimingSimTune2016 = [-1, 2015, 2015, 2015]
        PixelConfigCondAlg.BarrelCrossTalk2016 = [0.30, 0.06, 0.06, 0.06]
        PixelConfigCondAlg.BarrelNoiseOccupancy2016 = [5e-8, 5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.BarrelDisableProbability2016 = [
            9e-3, 9e-3, 9e-3, 9e-3
        ]

        PixelConfigCondAlg.EndcapToTThreshold2016 = [5, 5, 5]
        PixelConfigCondAlg.FEI3EndcapLatency2016 = [256, 256, 256]
        PixelConfigCondAlg.FEI3EndcapHitDuplication2016 = [False, False, False]
        PixelConfigCondAlg.FEI3EndcapSmallHitToT2016 = [-1, -1, -1]
        PixelConfigCondAlg.FEI3EndcapTimingSimTune2016 = [2015, 2015, 2015]
        PixelConfigCondAlg.EndcapCrossTalk2016 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.EndcapNoiseOccupancy2016 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.EndcapDisableProbability2016 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.DBMToTThreshold2016 = [-1, -1, -1]
        PixelConfigCondAlg.DBMCrossTalk2016 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.DBMNoiseOccupancy2016 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.DBMDisableProbability2016 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.IBLNoiseShape2016 = [
            0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
        ]
        PixelConfigCondAlg.BLayerNoiseShape2016 = [
            0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0
        ]
        PixelConfigCondAlg.PixelNoiseShape2016 = [
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949,
            0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0
        ]
        # Layer-2 noise shape                     [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2129, 0.4016, 0.5477, 0.6599, 0.7435, 0.8160, 0.8779, 0.9340, 0.9798, 1.0]

        # So far, Gaudi::Property does not support 2D vector.
        #PixelConfigCondAlg.EndcapNoiseShape=[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1748, 0.3409, 0.4760, 0.5850, 0.6754, 0.7538, 0.8264, 0.8962, 0.9655, 1.0],
        #                                     [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1852, 0.3528, 0.4881, 0.5961, 0.6855, 0.7640, 0.8374, 0.9068, 0.9749, 1.0],
        #                                     [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]]

        #====================================================================================
        # RUN2 2017
        PixelConfigCondAlg.BarrelToTThreshold2017 = [-1, 5, 5, 5]
        PixelConfigCondAlg.FEI3BarrelLatency2017 = [0, 151, 256, 256]
        PixelConfigCondAlg.FEI3BarrelHitDuplication2017 = [
            False, False, False, False
        ]
        PixelConfigCondAlg.FEI3BarrelSmallHitToT2017 = [-1, -1, -1, -1]
        PixelConfigCondAlg.FEI3BarrelTimingSimTune2017 = [-1, 2018, 2018, 2018]
        PixelConfigCondAlg.BarrelCrossTalk2017 = [0.30, 0.06, 0.06, 0.06]
        PixelConfigCondAlg.BarrelNoiseOccupancy2017 = [5e-8, 5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.BarrelDisableProbability2017 = [
            9e-3, 9e-3, 9e-3, 9e-3
        ]

        PixelConfigCondAlg.EndcapToTThreshold2017 = [5, 5, 5]
        PixelConfigCondAlg.FEI3EndcapLatency2017 = [256, 256, 256]
        PixelConfigCondAlg.FEI3EndcapHitDuplication2017 = [False, False, False]
        PixelConfigCondAlg.FEI3EndcapSmallHitToT2017 = [-1, -1, -1]
        PixelConfigCondAlg.FEI3EndcapTimingSimTune2017 = [2018, 2018, 2018]
        PixelConfigCondAlg.EndcapCrossTalk2017 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.EndcapNoiseOccupancy2017 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.EndcapDisableProbability2017 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.DBMToTThreshold2017 = [-1, -1, -1]
        PixelConfigCondAlg.DBMCrossTalk2017 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.DBMNoiseOccupancy2017 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.DBMDisableProbability2017 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.IBLNoiseShape2017 = [
            0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
        ]
        PixelConfigCondAlg.BLayerNoiseShape2017 = [
            0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0
        ]
        PixelConfigCondAlg.PixelNoiseShape2017 = [
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949,
            0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0
        ]

        #====================================================================================
        # RUN2 2018
        PixelConfigCondAlg.BarrelToTThreshold2018 = [-1, 3, 5, 5]
        PixelConfigCondAlg.FEI3BarrelLatency2018 = [0, 151, 256, 256]
        PixelConfigCondAlg.FEI3BarrelHitDuplication2018 = [
            False, False, False, False
        ]
        PixelConfigCondAlg.FEI3BarrelSmallHitToT2018 = [-1, -1, -1, -1]
        PixelConfigCondAlg.FEI3BarrelTimingSimTune2018 = [-1, 2018, 2018, 2018]
        PixelConfigCondAlg.BarrelCrossTalk2018 = [0.30, 0.06, 0.06, 0.06]
        PixelConfigCondAlg.BarrelNoiseOccupancy2018 = [5e-8, 5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.BarrelDisableProbability2018 = [
            9e-3, 9e-3, 9e-3, 9e-3
        ]

        PixelConfigCondAlg.EndcapToTThreshold2018 = [5, 5, 5]
        PixelConfigCondAlg.FEI3EndcapLatency2018 = [256, 256, 256]
        PixelConfigCondAlg.FEI3EndcapHitDuplication2018 = [False, False, False]
        PixelConfigCondAlg.FEI3EndcapSmallHitToT2018 = [-1, -1, -1]
        PixelConfigCondAlg.FEI3EndcapTimingSimTune2018 = [2018, 2018, 2018]
        PixelConfigCondAlg.EndcapCrossTalk2018 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.EndcapNoiseOccupancy2018 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.EndcapDisableProbability2018 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.DBMToTThreshold2018 = [-1, -1, -1]
        PixelConfigCondAlg.DBMCrossTalk2018 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.DBMNoiseOccupancy2018 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.DBMDisableProbability2018 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.IBLNoiseShape2018 = [
            0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0
        ]
        PixelConfigCondAlg.BLayerNoiseShape2018 = [
            0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0
        ]
        PixelConfigCondAlg.PixelNoiseShape2018 = [
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949,
            0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0
        ]

        #====================================================================================
        # RUN1
        PixelConfigCondAlg.BarrelToTThresholdRUN1 = [3, 3, 3]
        PixelConfigCondAlg.FEI3BarrelLatencyRUN1 = [256, 256, 256]
        PixelConfigCondAlg.FEI3BarrelHitDuplicationRUN1 = [True, True, True]
        PixelConfigCondAlg.FEI3BarrelSmallHitToTRUN1 = [7, 7, 7]
        PixelConfigCondAlg.FEI3BarrelTimingSimTuneRUN1 = [2009, 2009, 2009]
        PixelConfigCondAlg.BarrelCrossTalkRUN1 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.BarrelNoiseOccupancyRUN1 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.BarrelDisableProbabilityRUN1 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.EndcapToTThresholdRUN1 = [3, 3, 3]
        PixelConfigCondAlg.FEI3EndcapLatencyRUN1 = [256, 256, 256]
        PixelConfigCondAlg.FEI3EndcapHitDuplicationRUN1 = [True, True, True]
        PixelConfigCondAlg.FEI3EndcapSmallHitToTRUN1 = [7, 7, 7]
        PixelConfigCondAlg.FEI3EndcapTimingSimTuneRUN1 = [2009, 2009, 2009]
        PixelConfigCondAlg.EndcapCrossTalkRUN1 = [0.06, 0.06, 0.06]
        PixelConfigCondAlg.EndcapNoiseOccupancyRUN1 = [5e-8, 5e-8, 5e-8]
        PixelConfigCondAlg.EndcapDisableProbabilityRUN1 = [9e-3, 9e-3, 9e-3]

        PixelConfigCondAlg.BLayerNoiseShapeRUN1 = [
            0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0
        ]
        PixelConfigCondAlg.PixelNoiseShapeRUN1 = [
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949,
            0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0
        ]

        #====================================================================================
        # ITK
        PixelConfigCondAlg.BarrelToTThresholdITK = [3, 3, 3, 3, 3]
        PixelConfigCondAlg.BarrelCrossTalkITK = [0.06, 0.06, 0.06, 0.06, 0.06]
        PixelConfigCondAlg.BarrelNoiseOccupancyITK = [
            5e-8, 5e-8, 5e-8, 5e-8, 5e-8
        ]
        PixelConfigCondAlg.BarrelDisableProbabilityITK = [
            9e-3, 9e-3, 9e-3, 9e-3, 9e-3
        ]

        PixelConfigCondAlg.EndcapToTThresholdITK = [
            3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
        ]
        PixelConfigCondAlg.EndcapCrossTalkITK = [
            0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06,
            0.06, 0.06, 0.06
        ]
        PixelConfigCondAlg.EndcapNoiseOccupancyITK = [
            5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8,
            5e-8, 5e-8, 5e-8
        ]
        PixelConfigCondAlg.EndcapDisableProbabilityITK = [
            9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3,
            9e-3, 9e-3, 9e-3
        ]

        PixelConfigCondAlg.InnermostNoiseShapeITK = [0.0, 1.0]
        PixelConfigCondAlg.NextInnermostNoiseShapeITK = [0.0, 1.0]
        PixelConfigCondAlg.PixelNoiseShapeITK = [0.0, 1.0]

        IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_2016.dat"

        # 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 not geoFlags.isIBL():
            IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping.dat"
        else:
            # Planar IBL
            if (geoFlags.IBLLayout() == "planar"):
                if geoFlags.isDBM():
                    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"

        PixelConfigCondAlg.CablingMapFileName = IdMappingDat

        condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg")

    ############################################################################################
    # Set up Conditions DB
    ############################################################################################
    if useNewDeadmapFormat:
        if not conddb.folderRequested("/PIXEL/PixelModuleFeMask"):
            conddb.addFolder("PIXEL_OFL",
                             "/PIXEL/PixelModuleFeMask",
                             className="CondAttrListCollection")
        if not hasattr(condSeq, "PixelDeadMapCondAlg"):
            from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDeadMapCondAlg
            condSeq += PixelDeadMapCondAlg(name="PixelDeadMapCondAlg")

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

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

    if not conddb.folderRequested("/PIXEL/DCS/HV"):
        conddb.addFolder("DCS_OFL",
                         "/PIXEL/DCS/HV",
                         className="CondAttrListCollection")

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

    if not conddb.folderRequested("/PIXEL/DCS/TEMPERATURE"):
        conddb.addFolder("DCS_OFL",
                         "/PIXEL/DCS/TEMPERATURE",
                         className="CondAttrListCollection")

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

    #####################
    # 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 geoFlags.isIBL() and not conddb.folderRequested("/PIXEL/HitDiscCnfg"):
        conddb.addFolderSplitMC("PIXEL",
                                "/PIXEL/HitDiscCnfg",
                                "/PIXEL/HitDiscCnfg",
                                className="AthenaAttributeList")

    if geoFlags.isIBL() and 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")

    pixelReadKey = ''
    if (globalflags.DataSource == 'data'
            and conddb.dbdata == 'CONDBR2'):  # for data overlay
        if not conddb.folderRequested("/PIXEL/CablingMap"):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/CablingMap",
                                        "/PIXEL/CablingMap",
                                        className="AthenaAttributeList")

    if not hasattr(condSeq, 'PixelCablingCondAlg'):
        from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelCablingCondAlg
        condSeq += PixelCablingCondAlg(
            name="PixelCablingCondAlg",
            ReadKey=pixelReadKey,
            MappingFile=IdMappingDat,
            RodIDForSingleLink40=0,
            RecordInInitialize=not globalflags.isOverlay())

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

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

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

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

    #######################
    # Setup Lorentz angle #
    #######################
    if not hasattr(condSeq, "PixelSiPropertiesCondAlg"):
        from SiPropertiesTool.SiPropertiesToolConf import PixelSiPropertiesCondAlg
        condSeq += PixelSiPropertiesCondAlg(name="PixelSiPropertiesCondAlg")

    if not hasattr(ToolSvc, "PixelSiPropertiesTool"):
        from SiPropertiesTool.SiPropertiesToolConf import SiPropertiesTool
        ToolSvc += SiPropertiesTool(name="PixelSiPropertiesTool",
                                    DetectorName="Pixel",
                                    ReadKey="PixelSiliconPropertiesVector")

    if not hasattr(condSeq, "PixelSiLorentzAngleCondAlg"):
        from SiLorentzAngleTool.SiLorentzAngleToolConf import PixelSiLorentzAngleCondAlg
        condSeq += PixelSiLorentzAngleCondAlg(
            name="PixelSiLorentzAngleCondAlg",
            SiPropertiesTool=ToolSvc.PixelSiPropertiesTool,
            UseMagFieldCache=True,
            UseMagFieldDcs=True)

    if not hasattr(ToolSvc, "PixelLorentzAngleTool"):
        from SiLorentzAngleTool.SiLorentzAngleToolConf import SiLorentzAngleTool
        ToolSvc += SiLorentzAngleTool(
            name="PixelLorentzAngleTool",
            DetectorName="Pixel",
            UseMagFieldCache=True,
            SiLorentzAngleCondData="PixelSiLorentzAngleCondData")


############################################################################################
# Set up Tool/Service
############################################################################################

#####################
# Setup Cabling Svc #
#####################
    from PixelCabling.PixelCablingConf import PixelCablingSvc
    PixelCablingSvc = PixelCablingSvc()
    ServiceMgr += PixelCablingSvc
    print(PixelCablingSvc)
    kwargs.setdefault("InputObjectName", "PixelHits")

    chargeTools = []
    feSimTools = []
    if geoFlags.isSLHC():
        chargeTools += ['SensorSimPlanarTool']
        feSimTools += ['BarrelRD53SimTool']
        feSimTools += ['EndcapRD53SimTool']
    else:
        chargeTools += ['SensorSimPlanarTool']
        chargeTools += ['SensorSim3DTool']
        feSimTools += ['BarrelFEI4SimTool']
        feSimTools += ['DBMFEI4SimTool']
        feSimTools += ['BarrelFEI3SimTool']
        feSimTools += ['EndcapFEI3SimTool']
    kwargs.setdefault("ChargeTools", chargeTools)
    kwargs.setdefault("FrontEndSimTools", feSimTools)
    kwargs.setdefault("EnergyDepositionTool", "EnergyDepositionTool")
    if digitizationFlags.doXingByXingPileUp():  # PileUpTool approach
        kwargs.setdefault("FirstXing", Pixel_FirstXing())
        kwargs.setdefault("LastXing", Pixel_LastXing())
    return CfgMgr.PixelDigitizationTool(name, **kwargs)
Exemple #3
0
    def createTool(self):
        from AthenaCommon.AppMgr import ToolSvc

        #############################
        # Setup Pixel Configuration #
        #############################
        from AthenaCommon.AlgSequence import AthSequencer
        condSeq = AthSequencer("AthCondSeq")

        from IOVDbSvc.CondDB import conddb
        from AthenaCommon.GlobalFlags import globalflags
        from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
        from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags

        useNewDeadmapFormat = False
        useNewChargeFormat = False

        if not useNewDeadmapFormat:
            if not (conddb.folderRequested("/PIXEL/PixMapOverlay")
                    or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")):
                conddb.addFolderSplitOnline("PIXEL",
                                            "/PIXEL/Onl/PixMapOverlay",
                                            "/PIXEL/PixMapOverlay",
                                            className='CondAttrListCollection')

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

            useCablingConditions = False
            IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_2016.dat"
            rodIDForSingleLink40 = 0
            if (globalflags.DataSource() == 'geant4'):
                # 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"

            elif (globalflags.DataSource == 'data'):
                from RecExConfig.AutoConfiguration import GetRunNumber
                runNum = GetRunNumber()
                if (runNum < 222222):
                    useCablingConditions = False
                    IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_May08.dat"
                    rodIDForSingleLink40 = 1300000
                else:
                    useCablingConditions = True
                    rodIDForSingleLink40 = 1300000
                    # Even though we are reading from COOL, set the correct fallback map.
                    if (runNum >= 344494):
                        IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_344494.dat"
                    elif (runNum >= 314940 and runNum < 344494):
                        IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_314940.dat"
                    elif (runNum >= 289350 and runNum < 314940):  # 2016
                        IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_2016.dat"
                    elif (runNum >= 222222 and runNum < 289350):  # 2015
                        IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_Run2.dat"
                    else:
                        IdMappingDat = "PixelCabling/Pixels_Atlas_IdMapping_344494.dat"

            condSeq += PixelConfigCondAlg(
                name="PixelConfigCondAlg",
                UseDeadmapConditions=self.usePixMap,
                UseDCSStateConditions=self.useDCS,
                UseDCSStatusConditions=self.useDCS,
                UseTDAQConditions=self.
                useTDAQ,  # should be false. This is only valid in RUN-1.
                UseCalibConditions=True,
                UseCablingConditions=useCablingConditions,
                CablingMapFileName=IdMappingDat)

        #########################
        # Deadmap Setup (RUN-3) #
        #########################
        if useNewDeadmapFormat:
            if not conddb.folderRequested("/PIXEL/PixelModuleFeMask"):
                conddb.addFolder("PIXEL_OFL",
                                 "/PIXEL/PixelModuleFeMask",
                                 className="CondAttrListCollection")
            if not hasattr(condSeq, "PixelDeadMapCondAlg"):
                from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDeadMapCondAlg
                condSeq += PixelDeadMapCondAlg(name="PixelDeadMapCondAlg")

        ########################
        # DCS Conditions Setup #
        ########################
        PixelHVFolder = "/PIXEL/DCS/HV"
        PixelTempFolder = "/PIXEL/DCS/TEMPERATURE"
        PixelDBInstance = "DCS_OFL"

        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        if athenaCommonFlags.isOnline():
            PixelHVFolder = "/PIXEL/HLT/DCS/HV"
            PixelTempFolder = "/PIXEL/HLT/DCS/TEMPERATURE"
            PixelDBInstance = "PIXEL_ONL"

        if not conddb.folderRequested(PixelHVFolder):
            conddb.addFolder(PixelDBInstance,
                             PixelHVFolder,
                             className="CondAttrListCollection")
        if not conddb.folderRequested(PixelTempFolder):
            conddb.addFolder(PixelDBInstance,
                             PixelTempFolder,
                             className="CondAttrListCollection")

        if not self.onlineMode:  #this is only for testing in offline like setup
            if not conddb.folderRequested("/PIXEL/DCS/FSMSTATE"):
                conddb.addFolder("DCS_OFL",
                                 "/PIXEL/DCS/FSMSTATE",
                                 className="CondAttrListCollection")
            if not conddb.folderRequested("/PIXEL/DCS/FSMSTATUS"):
                conddb.addFolder("DCS_OFL",
                                 "/PIXEL/DCS/FSMSTATUS",
                                 className="CondAttrListCollection")

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

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

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

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

        #########################
        # TDAQ Conditions Setup #
        #########################
        if self.useTDAQ:
            PixelTDAQFolder = "/TDAQ/Resources/ATLAS/PIXEL/Modules"
            PixelTDAQInstance = "TDAQ_ONL"
            if not conddb.folderRequested(PixelTDAQFolder):
                conddb.addFolder(PixelTDAQInstance,
                                 PixelTDAQFolder,
                                 className="CondAttrListCollection")

            if not hasattr(condSeq, "PixelTDAQCondAlg"):
                from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg
                condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg",
                                            ReadKey=PixelTDAQFolder)

        ############################
        # Conditions Summary Setup #
        ############################
        # This is future replacement of the PixelConditionsSummaryTool...

        from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool
        TrigPixelConditionsSummaryTool = PixelConditionsSummaryTool(
            name=self.instanceName('PixelConditionsSummaryTool'),
            UseByteStream=self.useBS)

        if self.useDCS and not self.onlineMode:
            TrigPixelConditionsSummaryTool.IsActiveStates = ['READY', 'ON']
            TrigPixelConditionsSummaryTool.IsActiveStatus = ['OK', 'WARNING']

        self.summaryTool = TrigPixelConditionsSummaryTool

        if self._print: print(TrigPixelConditionsSummaryTool)

        #####################
        # 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.dbdata == "CONDBR2" or
            (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"):
            if not (globalflags.DataSource() == 'geant4'):
                conddb.addFolder("PIXEL",
                                 "/PIXEL/ReadoutSpeed",
                                 className="AthenaAttributeList")
            else:
                conddb.addFolderSplitMC("PIXEL",
                                        "/PIXEL/ReadoutSpeed",
                                        "/PIXEL/ReadoutSpeed",
                                        className="AthenaAttributeList")

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

        if (globalflags.DataSource == 'data'):
            if not conddb.folderRequested("/PIXEL/CablingMap"):
                conddb.addFolderSplitOnline("PIXEL",
                                            "/PIXEL/Onl/CablingMap",
                                            "/PIXEL/CablingMap",
                                            className="AthenaAttributeList")

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

        #############################
        # Offline calibration Setup #
        #############################
        if not conddb.folderRequested("/PIXEL/PixReco"):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/PixReco",
                                        "/PIXEL/PixReco",
                                        className="DetCondCFloat")

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

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

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

        ### 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",
                                        className='CondAttrListCollection')
        if not (conddb.folderRequested("/PIXEL/PixMapLong")
                or conddb.folderRequested("/PIXEL/Onl/PixMapLong")):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/PixMapLong",
                                        "/PIXEL/PixMapLong",
                                        className='CondAttrListCollection')
        if not (conddb.folderRequested("/PIXEL/NoiseMapShort")
                or conddb.folderRequested("/PIXEL/Onl/NoiseMapShort")):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/NoiseMapShort",
                                        "/PIXEL/NoiseMapShort",
                                        className='CondAttrListCollection')
        if not (conddb.folderRequested("/PIXEL/NoiseMapLong")
                or conddb.folderRequested("/PIXEL/Onl/NoiseMapLong")):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/NoiseMapLong",
                                        "/PIXEL/NoiseMapLong",
                                        className='CondAttrListCollection')
        if not (conddb.folderRequested("/PIXEL/PixMapOverlay")
                or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")):
            conddb.addFolderSplitOnline("PIXEL",
                                        "/PIXEL/Onl/PixMapOverlay",
                                        "/PIXEL/PixMapOverlay",
                                        className='CondAttrListCollection')

        #######################
        # Lorentz Angle Setup #
        #######################
        if not hasattr(condSeq, 'PixelSiPropertiesCondAlg'):
            from SiPropertiesTool.SiPropertiesToolConf import PixelSiPropertiesCondAlg
            condSeq += PixelSiPropertiesCondAlg(
                name="PixelSiPropertiesCondAlg")

        from SiPropertiesTool.SiPropertiesToolConf import SiPropertiesTool
        TrigSiPropertiesTool = SiPropertiesTool(
            name="PixelSiPropertiesTool",
            DetectorName="Pixel",
            ReadKey="PixelSiliconPropertiesVector")

        ToolSvc += TrigSiPropertiesTool

        if not hasattr(condSeq, 'PixelSiLorentzAngleCondAlg'):
            from SiLorentzAngleTool.SiLorentzAngleToolConf import PixelSiLorentzAngleCondAlg
            condSeq += PixelSiLorentzAngleCondAlg(
                name="PixelSiLorentzAngleCondAlg",
                SiPropertiesTool=TrigSiPropertiesTool,
                UseMagFieldCache=True,
                UseMagFieldDcs=(not athenaCommonFlags.isOnline()))

        from SiLorentzAngleTool.SiLorentzAngleToolConf import SiLorentzAngleTool
        TrigPixelLorentzAngleTool = SiLorentzAngleTool(
            name=self.instanceName('PixelLorentzAngleTool'),
            DetectorName="Pixel",
            SiLorentzAngleCondData="PixelSiLorentzAngleCondData")

        ToolSvc += TrigPixelLorentzAngleTool