Пример #1
0
def InDetVKalVxInJetToolCfg(name,
                            MSV=False,
                            useBTagFlagsDefaults=True,
                            **options):
    """Sets up a InDetVKalVxInJetTool tool and returns it.

    The following options have BTaggingFlags defaults:

    TrackSummaryTool                    default: None (not needed for b-tagging)

    input:             name: The name of the tool (should be unique).
      useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however
    that this tool also needs to be added to the main B-tagging tool."""
    acc = ComponentAccumulator()
    if useBTagFlagsDefaults:
        if MSV:
            defaults = {
                'getNegativeTail': False,
                'ExistIBL': geoFlags.isIBL(),
                'ConeForTag': 1.0,
                'MultiVertex': True,
            }
        else:
            defaults = {
                'ExistIBL': geoFlags.isIBL(),
            }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    acc.setPrivateTools(InDet__InDetVKalVxInJetTool(**options))

    return acc
Пример #2
0
def getIDETEnvelope(name="IDET", **kwargs):
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())
    #isRUN1 = not (isRUN2 or isUpgrade)

    kwargs.setdefault("DetectorName", "IDET")
    innerRadius = 37. * mm  # RUN1 default
    if isRUN2:
        innerRadius = 28.9 * mm  #29.15*mm
    if isUpgrade:
        innerRadius = 32.15 * mm
    kwargs.setdefault("InnerRadius", innerRadius)
    kwargs.setdefault("OuterRadius", 1.148 * m)
    kwargs.setdefault("dZ", 347.5 * cm)
    SubDetectorList = []
    from AthenaCommon.DetFlags import DetFlags
    if DetFlags.geometry.pixel_on():
        SubDetectorList += ['Pixel']
    if DetFlags.geometry.SCT_on():
        SubDetectorList += ['SCT']
    if DetFlags.geometry.TRT_on() and not isUpgrade:
        SubDetectorList += ['TRT']
    SubDetectorList += ['IDetServicesMat']
    kwargs.setdefault("SubDetectors", SubDetectorList)
    return CfgMgr.CylindricalEnvelope(name, **kwargs)
Пример #3
0
def toolInDetVKalVxNegativeTagInJetTool(name, useBTagFlagsDefaults = True, **options):
    """Sets up a InDetVKalVxNegativeTagInJetTool tool and returns it.

    The following options have BTaggingFlags defaults:

    OutputLevel                         default: BTaggingFlags.OutputLevel
    getNegativeTag                      default: True
    CutA0                               default: 2.0 (new tuned cuts for SV0 (Sara))
    CutZVrt                             default: 2.0
    CutPixelHits                        default: 2

    input:             name: The name of the tool (should be unique).
      useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however
    that this tool also needs to be added to the main B-tagging tool."""
    if useBTagFlagsDefaults:
        defaults = { 'OutputLevel'      : BTaggingFlags.OutputLevel,
                     'ExistIBL'         : geoFlags.isIBL(),
#                     'TrackSummaryTool' : None,
                     'getNegativeTag'   : True,
                     'CutA0'            : 2.0,
                     'CutZVrt'          : 2.0,
                     'CutPixelHits'     : 2 }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool
    return InDet__InDetVKalVxInJetTool(**options)
Пример #4
0
def generateInDetSensitiveDetectorList():
    SensitiveDetectorList = []

    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())
    isRUN1 = not (isRUN2 or isUpgrade)

    from AthenaCommon.DetFlags import DetFlags
    #if isRUN2 and DetFlags.simulation.DBM_on():
    #    SensitiveDetectorList += [ 'DBMSensorSD' ]
    if DetFlags.simulate.pixel_on():
        if isRUN1 or isRUN2:
            if DetFlags.simulate.BCM_on():
                SensitiveDetectorList += ['BCMSensorSD']
                SensitiveDetectorList += ['BLMSensorSD']
        SensitiveDetectorList += ['PixelSensorSD']
    if DetFlags.simulate.SCT_on():
        if isUpgrade:
            SensitiveDetectorList += ['SLHC_SctSensorSD']
        else:
            SensitiveDetectorList += ['SctSensorSD']
    if DetFlags.simulate.TRT_on() and not isUpgrade:
        SensitiveDetectorList += ['TRTSensitiveDetector']
    return SensitiveDetectorList
Пример #5
0
def toolInDetVKalMultiVxInJetTool(name, useBTagFlagsDefaults = True, **options):
    """Sets up a InDetVKalMultiVxInJetTool tool and returns it.

    The following options have BTaggingFlags defaults:

    OutputLevel                         default: BTaggingFlags.OutputLevel
    getNegativeTail                     default: False
    ConeForTag                          default: 1.0
    MultiVertex                         default: True

    input:             name: The name of the tool (should be unique).
      useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however
    that this tool also needs to be added to the main B-tagging tool."""
    if useBTagFlagsDefaults:
        defaults = { 'OutputLevel'     : BTaggingFlags.OutputLevel,
                     'getNegativeTail' : False,
                     'ExistIBL'        : geoFlags.isIBL(),
                     'ConeForTag'      : 1.0,
                     'MultiVertex'     : True }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool
    return InDet__InDetVKalVxInJetTool(**options)
Пример #6
0
def getPixelPhysicsRegionTool(name='PixelPhysicsRegionTool', **kwargs):
    kwargs.setdefault("RegionName", 'Pixel')
    volumeList = ['Pixel::siLog', 'Pixel::siBLayLog']
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    if (commonGeoFlags.Run() in [
            "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL()):
        volumeList += ['Pixel::dbmDiamondLog']
    kwargs.setdefault("VolumeList", volumeList)
    kwargs.setdefault("ElectronCut", 0.05)
    kwargs.setdefault("PositronCut", 0.05)
    kwargs.setdefault("GammaCut", 0.05)
    return CfgMgr.RegionCreator(name, **kwargs)
Пример #7
0
def toolInDetVKalVxInJetTool_Trig(name, useBTagFlagsDefaults=True, **options):
    """Sets up a InDetVKalVxInJetTool tool and returns it.

    The following options have BTaggingFlags defaults:

    TrackSummaryTool                    default: None (not needed for b-tagging)
    OutputLevel                         default: BTaggingFlags.OutputLevel

    input:             name: The name of the tool (should be unique).
      useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however
    that this tool also needs to be added to the main B-tagging tool."""
    if useBTagFlagsDefaults:
        defaults = {
            'OutputLevel': BTaggingFlags.OutputLevel,
            'ExistIBL': geoFlags.isIBL(),
        }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool
    return InDet__InDetVKalVxInJetTool(**options)
Пример #8
0
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration

# Configuration functions for IP2DTag
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags
from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
from IOVDbSvc.CondDB import conddb
btagrun1 = False
if conddb.dbdata == 'COMP200':
    btagrun1 = True
elif conddb.isMC:
    btagrun1 = (commonGeoFlags.Run() == "RUN1"
                or (commonGeoFlags.Run() == "UNDEFINED"
                    and geoFlags.isIBL() == False))

metaIP2DTag = {
    'IsATagger': True,
    'xAODBaseName': 'IP2D',
    'DependsOn': [  #'AtlasExtrapolator',
        #'BTagTrackToVertexTool',
        #'InDetVKalVxInJetTool',
        #'BTagFullLinearizedTrackFactory',
        #'BTagTrackToVertexIPEstimator',
        #'IP2DDetailedTrackGradeFactory',
        #'IP2DBasicTrackGradeFactory',
        #'SVForIPTool_IP2D',
        #'IP2DTrackSelector',
        #'IP2DNewLikelihoodTool'
    ],
    'PassByPointer': {  #'SVForIPTool'                : 'SVForIPTool_IP2D',
Пример #9
0
def getATLAS_RegionCreatorList():
    regionCreatorList = []
    from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
    from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
    isUpgrade = commonGeoFlags.Run() == "RUN4" or (
        commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC())
    isRUN2 = (commonGeoFlags.Run() in [
        "RUN2", "RUN3"
    ]) or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL())

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

        LVL1MUCTPI__L1MuctpiTool.__init__(self, name)

        # Create a logger:
        from AthenaCommon.Logging import logging
        logger = logging.getLogger("L1MuctpiTool")

        # Set properties of the LUT overlap handling:
        self.OverlapStrategyName = "LUT"
        self.DumpLUT = False
        self.LUTXMLFile = "UNDEFINED"
        self.RunPeriod = "UNDEFINED"
        self.FlaggingMode = False
        self.MultiplicityStrategyName = "INCLUSIVE"

        # Decide which LUT to use, based on which run we are simulating:
        from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
        from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
        if (commonGeoFlags.Run()
                == "RUN1") or ((commonGeoFlags.Run() == "UNDEFINED") and
                               (geoFlags.isIBL() is False)):
            self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml"
            self.RunPeriod = "RUN1"
            logger.info(
                "Configuring MuCTPI simulation with Run 1 configuration file:")
            logger.info(
                "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml"
            )
            logger.info("  with a RunPeriod=RUN1")
        elif (commonGeoFlags.Run()
              == "RUN2") or ((commonGeoFlags.Run() == "UNDEFINED") and
                             (geoFlags.isIBL() is True)):
            self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            self.RunPeriod = "RUN2"
            logger.info(
                "Configuring MuCTPI simulation with Run 2 configuration file:")
            logger.info(
                "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            )
            logger.info("  with a RunPeriod=RUN2")
        else:
            self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            self.RunPeriod = "RUN2"
            logger.warning(
                "Couldn't determine which run to simulate, using Run 2 configuration file:"
            )
            logger.warning(
                "  TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml"
            )
            logger.warning("  with a RunPeriod=RUN2")

            pass

        # Set properties for NIM outputs ot L1Topo conversion from RoI to eta/phi
        self.GeometryXMLFile = "TrigConfMuctpi/TestMioctGeometry_2016_05_30_CS_2600573263.xml"

        # Turn on the NIM output creation by default:
        self.DoNIMOutput = True
        # The bit settings were extracted from here:
        #   https://savannah.cern.ch/bugs/?90300#comment14
        self.NIMBarrelBit = 29
        self.NIMEndcapBit = 30
Пример #11
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)
Пример #12
0
        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()
Пример #13
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
Пример #14
0
 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()
Пример #15
0
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# FLS: copied the original IP3DTag.py and rename every occurrence of IP3D -> IP3DTrighHybrid

# Configuration functions for IP3DTrigHybridTag
# Author: Wouter van den Wollenberg (2013-2014)
from BTagging.BTaggingFlags import BTaggingFlags

from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
from IOVDbSvc.CondDB import conddb
btagrun1=False
if conddb.dbdata == 'COMP200':
    btagrun1=True
elif conddb.isMC:
    btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False))

metaIP3DTrigHybridTag = {'IsATagger': True,
                         'xAODBaseName': 'IP3DTrigHybrid',
                         'DependsOn': ['AtlasExtrapolator',
                                       'BTagTrackToVertexTool',
                                       'InDetVKalVxInJetTool',
                                       'BTagFullLinearizedTrackFactory',
                                       'BTagTrackToVertexIPEstimator',
                                       'IP3DTrigHybridNewLikelihoodTool',
                                       'IP3DTrigHybridTrackSelector',
                                       'TrigHybridInDetTrackSelector',
                                       'TrigHybridSpecialTrackAssociator',
                                       'SVForIPTool_IP3DTrigHybrid',
                                       'IP3DTrigHybridBasicTrackGradeFactory',
                                       'IP3DTrigHybridDetailedTrackGradeFactory'],
                         'PassByPointer': {'SVForIPTool': 'SVForIPTool_IP3DTrigHybrid',
Пример #16
0
def Initiate(ConfInstance=None):
  """Sets up the basic global tools required for B-Tagging. This function is idempotent; it will not run again if it has run once. It is
  typically called by other functions in this file to make sure the basic global tools exist.

  The function returns True if B-Tagging is initialized or has been before. It returns False if it B-Tagging has been switched off for various
  reasons (these are checked in the checkFlagsUsingBTaggingFlags function).

  If the B-tagging calibration broker has been registered we assume initiation has already been performed; this allows users to setup their own initiation code."""

  if ConfInstance is None:
    from BTagging.BTaggingConfiguration import getConfiguration
    ConfInstance = getConfiguration()

  if ConfInstance._Initialized:
    return True

  from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
  from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
  from IOVDbSvc.CondDB import conddb
  # Declare the COOL folder to the CondInputLoader
  btagrun1=False
  if conddb.dbdata == 'COMP200':
    btagrun1=True
  elif conddb.isMC:
    # The Run() parameter only exists for ATLAS-R1(...) and ATLAS-R2(...) geo tags,
    # not for ATLAS-GEO(...) and ATLAS-IBL(...) ones. Hence if Run() is undefined,
    # presence of IBL is used to switch between Run1/Run2
    btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False))
  if (btagrun1):
    print (ConfInstance.BTagTag()+' - INFO - Setting up Run 1 configuration')
    BTaggingFlags.JetFitterNN=True
    BTaggingFlags.SV2    =True
    BTaggingFlags.JetVertexCharge=False
    BTaggingFlags.SoftMu=False
    BTaggingFlags.MV2c10mu=False
    BTaggingFlags.MV2c10rnn=False
    BTaggingFlags.MV2cl100=False
    BTaggingFlags.RNNIP=False
    BTaggingFlags.DL1=False
    BTaggingFlags.DL1mu=False
    BTaggingFlags.DL1rnn=False
  else:
    print (ConfInstance.BTagTag()+' - INFO - Setting up Run 2 configuration')

  if ConfInstance._name == "Trig":
    BTaggingFlags.MV2c20=True

  print (ConfInstance.BTagTag()+' - INFO - Initializing default basic tools')

  if ConfInstance.checkFlagsUsingBTaggingFlags():

    #Print the flags
    BTaggingFlags.Print()

    #If debugging do a check of the tool collection structure
    if(BTaggingFlags.OutputLevel < 3):
      from BTagging.BTaggingConfiguration import checkToolCollectionStructure
      checkToolCollectionStructure()

    #Get TheTruthCollectionKey from input
    TheTruthCollectionKey = 'TruthEvents'
    BTaggingFlags.RetagJets = BTaggingFlags.Jets
    if BTaggingFlags.AutoInspectInputFile:
      from AthenaCommon.GlobalFlags import globalflags
      if globalflags.InputFormat == 'pool':
        try:
          from RecExConfig.InputFilePeeker import inputFileSummary
          BTaggingFlags.RetagJets = []
          for i in inputFileSummary['eventdata_items']:
            if i[0] == 'McEventCollection':
              # TheTruthCollectionKey = i[1] # disable taking the name from the input file?
              pass
            elif i[0] == 'JetCollection':
              jetC1 = (i[1]).replace('AODJets','')
              jetC = jetC1.replace('Jets','')
              if jetC in BTaggingFlags.Jets:
                BTaggingFlags.RetagJets += [ jetC ]
        except Exception:
          print (ConfInstance.BTagTag()+' - WARNING - Automatic inspection of input file failed (file too old?)')
          import traceback
          traceback.print_exc()

    print (ConfInstance.BTagTag()+' - Using ', TheTruthCollectionKey, ' as truth key')
#    print (ConfInstance.BTagTag()+' - Re-tagging these jet collections: ', BTaggingFlags.RetagJets)

    #
    # ============ Setup basic services
    #
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if not hasattr(svcMgr, 'THistSvc'):
      from GaudiSvc.GaudiSvcConf import THistSvc
      svcMgr += THistSvc()
    if not 'topSequence' in dir():
      from AthenaCommon.AlgSequence import AlgSequence
      topSequence = AlgSequence()


    #Create and add our condition algorithm to the Condition Sequencer

    SetupConditionAlgorithm(ConfInstance)

    #
    # ========== Add tools now
    #

    # -------------- Calibration Broker --------------
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.Resilience import treatException,protectedInclude
    if ConfInstance._name == "" or ConfInstance._name == "Trig":
      # No calibration broker setup - The condition algorithm is used
      pass
    elif ConfInstance._name == "AODFix":
      protectedInclude("BTagging/BTagCalibBroker_AODFix_jobOptions.py")
      BTagCalibrationBrokerTool = ConfInstance.getTool("BTagCalibrationBrokerTool")
    else:
      print (ConfInstance.BTagTag()+' - ERROR - Configuration instance "'+ConfInstance._name+'" has no calibration broker setup specified!')
      raise RuntimeError
    # -------------- \Calibration Broker --------------

    # -- for reference mode:
    if BTaggingFlags.Runmodus == 'reference':

      svcMgr.THistSvc.Output += ["RefFile DATAFILE='BTagCalibALL.root' OPT='RECREATE'"]

    ConfInstance._Initialized = True
    return True
  else:
    print (ConfInstance.BTagTag()+' - WARNING - Tool initialization requested but B-Tagging is not possible for the current dataset.')
    return False