コード例 #1
0
def getSCT_FrontEnd(name="SCT_FrontEnd", **kwargs):
    from Digitization.DigitizationFlags import digitizationFlags
    #Setup noise treament in SCT_FrontEnd
    # To set the mean noise values for the different module types
    # Default values set at 0 degrees, plus/minus ~5 enc per plus/minus degree
    kwargs.setdefault("NoiseBarrel", 1500.0)
    kwargs.setdefault("NoiseBarrel3", 1541.0)
    kwargs.setdefault("NoiseInners", 1090.0)
    kwargs.setdefault("NoiseMiddles", 1557.0)
    kwargs.setdefault("NoiseShortMiddles", 940.0)
    kwargs.setdefault("NoiseOuters", 1618.0)
    kwargs.setdefault("NOBarrel", 1.5e-5)
    kwargs.setdefault("NOBarrel3", 2.1e-5)
    kwargs.setdefault("NOInners", 5.0e-9)
    kwargs.setdefault("NOMiddles", 2.7e-5)
    kwargs.setdefault("NOShortMiddles", 2.0e-9)
    kwargs.setdefault("NOOuters", 3.5e-5)
    # If noise is turned off:
    if not digitizationFlags.doInDetNoise.get_Value():
        ###kwargs.setdefault("OnlyHitElements", True)
        print('SCT_Digitization:::: Turned off Noise in SCT_FrontEnd')
        kwargs.setdefault("NoiseOn", False)
        kwargs.setdefault("AnalogueNoiseOn", False)
    else:
        kwargs.setdefault("NoiseOn", True)
        kwargs.setdefault("AnalogueNoiseOn", True)
    # In overlay MC, only analogue noise is on. Noise hits are not added.
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay() and globalflags.DataSource == 'geant4':
        kwargs["NoiseOn"] = False
        kwargs["AnalogueNoiseOn"] = True
    # Use Calibration data from Conditions DB, still for testing purposes only
    kwargs.setdefault("UseCalibData", True)

    # Setup the ReadCalibChip folders and Svc
    from SCT_ConditionsTools.SCT_ReadCalibChipDataToolSetup import SCT_ReadCalibChipDataToolSetup
    sct_ReadCalibChipDataToolSetup = SCT_ReadCalibChipDataToolSetup()
    sct_ReadCalibChipDataToolSetup.setup()
    kwargs.setdefault("SCT_ReadCalibChipDataTool",
                      sct_ReadCalibChipDataToolSetup.getTool())
    # DataCompressionMode: 1 is level mode X1X (default), 2 is edge mode 01X, 3 is any hit mode (1XX|X1X|XX1)
    from AthenaCommon.BeamFlags import jobproperties
    if digitizationFlags.PileUpPremixing:
        kwargs.setdefault("DataCompressionMode", 3)
    elif globalflags.isOverlay() and globalflags.DataSource == 'geant4':
        kwargs.setdefault("DataCompressionMode", 2)
    elif (jobproperties.Beam.bunchSpacing() <= 50):
        kwargs.setdefault("DataCompressionMode", 1)
    else:
        kwargs.setdefault("DataCompressionMode", 3)
    # DataReadOutMode: 0 is condensed mode and 1 is expanded mode
    if globalflags.isOverlay() and globalflags.DataSource == 'geant4':
        kwargs.setdefault("DataReadOutMode", 0)
    else:
        kwargs.setdefault("DataReadOutMode", 1)
    from SCT_Digitization.SCT_DigitizationConf import SCT_FrontEnd
    return SCT_FrontEnd(name, **kwargs)
コード例 #2
0
def BunchLumisToolDefault(name="BunchLumisTool"):
    mlog = logging.getLogger(name)

    if hasattr(svcMgr.ToolSvc, name):
        # re-use previously configured tool
        mlog.info("BunchLumisToolDefault returning existing tool %s", name)
        return getattr(svcMgr.ToolSvc, name)

    # Instantiate new tool, by default configuration will do nothing
    blTool = BunchLumisTool(name)

    # Now configure based on the environment
    from IOVDbSvc.CondDB import conddb

    # Run1
    if conddb.dbdata == "COMP200":

        folder = '/TDAQ/OLC/BUNCHLUMIS'
        blTool.BunchLumisFolderName = folder

        from IOVDbSvc.CondDB import conddb
        if not conddb.folderRequested(folder):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.isOverlay():
                # Load reduced channel list for overlay jobs to try to reduce COOL access
                # Need Lucid AND, OR, HitOR, BcmH OR, BcmV OR
                conddb.addFolder(
                    'TDAQ',
                    '<channelSelection>101,102,103,201,211</channelSelection> /TDAQ/OLC/BUNCHLUMIS'
                )

            else:
                conddb.addFolder('TDAQ', folder)

            mlog.info("BunchLumisToolDefault requested %s", folder)

        # Also take care of the FillParamsTool
        fpToolName = "FillParamsTool"
        blTool.FillParamsTool = fpToolName

        # Make sure tool exists also
        if not hasattr(svcMgr.ToolSvc, fpToolName):
            from CoolLumiUtilities.FillParamsToolDefault import FillParamsToolDefault
            svcMgr.ToolSvc += FillParamsToolDefault(fpToolName)
            mlog.info("BunchLumisToolDefault added tool %s", fpToolName)

    # Run2 - do nothing
    elif conddb.dbdata == "CONDBR2":
        pass

    # Unknown, complain and do nothing
    else:
        mlog.warning(
            "BunchLumisToolDefault can't resolve conddb.dbdata = %s, assume Run2!"
            % conddb.dbdata)
        pass

    return blTool
コード例 #3
0
def getSCT_SurfaceChargesGenerator(name="SCT_SurfaceChargesGenerator",
                                   **kwargs):
    ## Set up services used by SCT_SurfaceChargesGenerator
    # Set up SCT_DCSConditiosnTool
    from SCT_ConditionsTools.SCT_DCSConditionsToolSetup import SCT_DCSConditionsToolSetup
    sct_DCSConditionsToolSetup = SCT_DCSConditionsToolSetup()
    sct_DCSConditionsToolSetup.setup()
    # Set up SCT_SiliconConditionsTool
    from SCT_ConditionsTools.SCT_SiliconConditionsToolSetup import SCT_SiliconConditionsToolSetup
    sct_SiliconConditionsToolSetup = SCT_SiliconConditionsToolSetup()
    sct_SiliconConditionsToolSetup.setDcsTool(
        sct_DCSConditionsToolSetup.getTool())
    sct_SiliconConditionsToolSetup.setup()
    # Set up SCT_SiPropertiesTool
    from SiPropertiesTool.SCT_SiPropertiesToolSetup import SCT_SiPropertiesToolSetup
    sct_SiPropertiesToolSetup = SCT_SiPropertiesToolSetup()
    sct_SiPropertiesToolSetup.setSiliconTool(
        sct_SiliconConditionsToolSetup.getTool())
    sct_SiPropertiesToolSetup.setup()
    ## Charge trapping tool - used by SCT_SurfaceChargesGenerator
    from AthenaCommon.AppMgr import ToolSvc
    ## SiLorentzAngleTool for SCT_SurfaceChargesGenerator
    from SiLorentzAngleTool.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup
    sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup()

    kwargs.setdefault("FixedTime", -999)
    kwargs.setdefault("SubtractTime", -999)
    kwargs.setdefault("SurfaceDriftTime", 10 * Units.ns)
    kwargs.setdefault("NumberOfCharges", 1)
    kwargs.setdefault("SmallStepLength", 5 * Units.micrometer)
    kwargs.setdefault("DepletionVoltage", 70)
    kwargs.setdefault("BiasVoltage", 150)
    kwargs.setdefault("SiPropertiesTool", sct_SiPropertiesToolSetup.getTool())
    kwargs.setdefault("LorentzAngleTool",
                      sctLorentzAngleToolSetup.SCTLorentzAngleTool)
    from AthenaCommon.GlobalFlags import globalflags
    kwargs.setdefault("isOverlay", globalflags.isOverlay())

    # kwargs.setdefault("doTrapping", True) # ATL-INDET-INT-2016-019

    from Digitization.DigitizationFlags import digitizationFlags
    if 'doDetailedSurfChargesGen' in digitizationFlags.experimentalDigi():
        kwargs.setdefault("ChargeDriftModel", 1)
        kwargs.setdefault("EFieldModel", 2)
        kwargs.setdefault("MagneticField", -2.0)
        kwargs.setdefault("SensorTemperature", 273.15)
        kwargs.setdefault("TransportTimeStep", 0.25)
        kwargs.setdefault("TransportTimeMax", 25.0)
        from SCT_Digitization.SCT_DigitizationConf import SCT_DetailedSurfaceChargesGenerator
        return SCT_DetailedSurfaceChargesGenerator(name, **kwargs)
    else:
        from SCT_ConditionsTools.SCT_ConditionsToolsConf import SCT_RadDamageSummaryTool
        kwargs.setdefault(
            "RadDamageSummaryTool",
            SCT_RadDamageSummaryTool(name="InDetSCT_RadDamageSummaryTool"))
        from SCT_Digitization.SCT_DigitizationConf import SCT_SurfaceChargesGenerator
        return SCT_SurfaceChargesGenerator(name, **kwargs)
コード例 #4
0
def BCM_DigitizationTool(name="BCM_DigitizationTool", **kwargs):

    from Digitization.DigitizationFlags import digitizationFlags
    kwargs.setdefault("HitCollName", "BCMHits")

    if not digitizationFlags.doInDetNoise.get_Value():
        kwargs.setdefault("ModNoise", [0., 0., 0., 0., 0., 0., 0., 0.])
    else:
        kwargs.setdefault(
            "ModNoise",
            [90.82, 90.82, 90.82, 90.82, 90.82, 90.82, 90.82, 90.82])
    kwargs.setdefault("ModSignal",
                      [450.0, 450.0, 450.0, 450.0, 450.0, 450.0, 450.0, 450.0])
    kwargs.setdefault("NinoThr",
                      [330.0, 330.0, 330.0, 330.0, 330.0, 330.0, 330.0, 330.0])
    kwargs.setdefault("EffDistanceParam", 4.0)
    kwargs.setdefault("EffSharpnessParam", 0.11)
    kwargs.setdefault("TimeDelay", 9.0)

    kwargs.setdefault("MIPDeposit", 0.33)  # BCM with diamond
    #kwargs.setdefault("MIPDeposit", 0.25) # BCM with graphite

    if digitizationFlags.doXingByXingPileUp():
        kwargs.setdefault("FirstXing", BCM_FirstXing())
        kwargs.setdefault("LastXing", BCM_LastXing())

    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay():
        from OverlayCommonAlgs.OverlayFlags import overlayFlags
        if overlayFlags.isOverlayMT():
            kwargs.setdefault("OnlyUseContainerName", False)
            kwargs.setdefault("OutputRDOKey",
                              overlayFlags.sigPrefix() + "BCM_RDOs")
            kwargs.setdefault("OutputSDOKey",
                              overlayFlags.sigPrefix() + "BCM_SDO_Map")
        else:
            kwargs.setdefault("OutputRDOKey",
                              overlayFlags.evtStore() + "+BCM_RDOs")
            kwargs.setdefault("OutputSDOKey",
                              overlayFlags.evtStore() + "+BCM_SDO_Map")
    else:
        if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(
        ):
            from OverlayCommonAlgs.OverlayFlags import overlayFlags
            kwargs.setdefault("OutputRDOKey",
                              overlayFlags.bkgPrefix() + "BCM_RDOs")
            kwargs.setdefault("OutputSDOKey",
                              overlayFlags.bkgPrefix() + "BCM_SDO_Map")
        else:
            kwargs.setdefault("OutputRDOKey", "BCM_RDOs")
            kwargs.setdefault("OutputSDOKey", "BCM_SDO_Map")

    from AthenaCommon import CfgMgr
    return CfgMgr.BCM_DigitizationTool(name, **kwargs)
コード例 #5
0
def BunchCrossingConfProvider(type=""):

    # Get ourselves a logger:
    from AthenaCommon.Logging import logging
    __logger = logging.getLogger("BunchCrossingConfProvider")

    # If the user requested some instance directly:
    if type != "":
        if type == "TrigConf":
            __logger.info("Forcing the usage of TrigConfBunchCrossingTool")
            from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool
            return TrigConfBunchCrossingTool()
        elif type == "LHC":
            __logger.info("Forcing the usage of LHCBunchCrossingTool")
            from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool
            return LHCBunchCrossingTool()
        elif type == "MC":
            from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool
            __logger.info("Forcing the usage of MCBunchCrossingTool")
            return MCBunchCrossingTool()
        else:
            __logger.warning("Type = " + type + " not recognized")
            __logger.warning("Will select tool type based on global flags")

    # Decide which tool to use based on the global flags:
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay():
        __logger.info("Selecting LHCBunchCrossingTool for overlay job")
        from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool
        return LHCBunchCrossingTool()
    if globalflags.DataSource() == "data":
        from RecExConfig.RecFlags import rec
        from RecExConfig.RecAlgsFlags import recAlgs
        from TriggerJobOpts.TriggerFlags import TriggerFlags
        if rec.doTrigger() or TriggerFlags.doTriggerConfigOnly(
        ) or recAlgs.doTrigger():
            from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool
            __logger.info("Selecting TrigConfBunchCrossingTool for this job")
            return TrigConfBunchCrossingTool()
        else:
            __logger.info(
                "Trigger turned off, selecting LHCBunchCrossingTool for this job"
            )
            from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool
            return LHCBunchCrossingTool()
    else:
        __logger.info("Selecting MCBunchCrossingTool for this job")
        from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool
        return MCBunchCrossingTool()
コード例 #6
0
    def __init__(self,name = Configurable.DefaultName ):
        super(TgcCablingServerConfig ,self).__init__(name)

        # make default Atlas
        # *TODO* How do we handle the case of old CSC data? Is new DetDescrVersion CSC too? EJWM
        self.Atlas = True
        if ( globalflags.DetDescrVersion().startswith('DC1') or \
             globalflags.DetDescrVersion().startswith('DC2') or \
             globalflags.DetDescrVersion().startswith('DC3')) :
            self.Atlas = False
            print "DC"

        if (muonByteStreamFlags.TgcDataType()=='m3' or \
            muonByteStreamFlags.TgcDataType()=='oldSimulation') :
            self.Atlas = False
            if (muonByteStreamFlags.TgcDataType()=='m3'):
                print "TgcDataType is set to m3"
            else:
                print "TgcDataType is set to oldSim"


        # setting the default to ATLAS cabling
        print self.Atlas;

        # Setting of the default 12-fold (ATLAS) cabling
        # New MuonTGC_CablingSvc (True) uses COOL DB and old TGCcabling12Svc (False) does not use COOL DB
        self.useMuonTGC_CablingSvc = True

        # do not use the call-back for digitization job
        self.forcedUse = True

        # if we run from RDO (overlay or other jobs) we must use the call-back, 
	# even if we have hits to digitize
        if DetFlags.haveRDO.TGC_on() and not DetFlags.digitize.TGC_on():
            self.forcedUse = False
	    
        #use the call-back in the overlay job that has no bytestream data as input
        if globalflags.isOverlay():
            self.forcedUse = False
	    
        # superseed the previos configuration if we run from Atlas data 
        if globalflags.DataSource.is_data():
            self.forcedUse = True
            self.Atlas = True

        # avoid to use call-back if input is bytestream
        if globalflags.InputFormat.is_bytestream():
            self.forcedUse = True
コード例 #7
0
def BunchCrossingConfProvider( type = "" ):

    # Get ourselves a logger:
    from AthenaCommon.Logging import logging
    __logger = logging.getLogger( "BunchCrossingConfProvider" )

    # If the user requested some instance directly:
    if type != "":
        if type == "TrigConf":
            __logger.info( "Forcing the usage of TrigConfBunchCrossingTool" )
            from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool
            return TrigConfBunchCrossingTool()
        elif type == "LHC":
            __logger.info( "Forcing the usage of LHCBunchCrossingTool" )
            from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool
            return LHCBunchCrossingTool()
        elif type == "MC":
            from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool
            __logger.info( "Forcing the usage of MCBunchCrossingTool" )
            return MCBunchCrossingTool()
        else:
            __logger.warning( "Type = " + type + " not recognized" )
            __logger.warning( "Will select tool type based on global flags" )

    # Decide which tool to use based on the global flags:
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay():
        __logger.info( "Selecting LHCBunchCrossingTool for overlay job" )
        from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool
        return LHCBunchCrossingTool()
    if globalflags.DataSource() == "data":
        from RecExConfig.RecFlags import rec
        from RecExConfig.RecAlgsFlags import recAlgs
        from TriggerJobOpts.TriggerFlags import TriggerFlags
        if rec.doTrigger() or TriggerFlags.doTriggerConfigOnly() or recAlgs.doTrigger():
            from TrigBunchCrossingTool.BunchCrossingTool import TrigConfBunchCrossingTool
            __logger.info( "Selecting TrigConfBunchCrossingTool for this job" )
            return TrigConfBunchCrossingTool()
        else:
            __logger.info( "Trigger turned off, selecting LHCBunchCrossingTool for this job" )
            from TrigBunchCrossingTool.BunchCrossingTool import LHCBunchCrossingTool
            return LHCBunchCrossingTool()
    else:
        __logger.info( "Selecting MCBunchCrossingTool for this job" )
        from TrigBunchCrossingTool.BunchCrossingTool import MCBunchCrossingTool
        return MCBunchCrossingTool()
コード例 #8
0
def isOverlay():
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay():
        return True
    # steer random overlay configuration
    from AthenaCommon.AppMgr import ServiceMgr
    if hasattr(ServiceMgr, 'PileUpMergeSvc'):
        if hasattr(ServiceMgr.PileUpMergeSvc, 'ReturnTimedData'):
            if (not ServiceMgr.PileUpMergeSvc.ReturnTimedData):
                from AthenaCommon.DetFlags import DetFlags
                checkOverlay = getattr(DetFlags, 'overlay', None)
                if checkOverlay is not None:
                    if DetFlags.overlay.LAr_on():
                        return True
                else:  #fallback for older releases
                    from OverlayCommonAlgs.OverlayFlags import overlayFlags
                    if overlayFlags.doLAr():
                        return True
    return False
コード例 #9
0
def BunchLumisCondAlgDefault():
    name = 'BunchLumisCondAlg'
    condSeq = AthSequencer('AthCondSeq')

    if hasattr(condSeq, name):
        return getattr(condSeq, name)

    # Should only be used for Run 1.
    from IOVDbSvc.CondDB import conddb
    if conddb.dbdata != 'COMP200':
        return None

    folder = '/TDAQ/OLC/BUNCHLUMIS'

    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay():
        # Load reduced channel list for overlay jobs to try to reduce COOL access
        # Need Lucid AND, OR, HitOR, BcmH OR, BcmV OR
        conddb.addFolder(
            'TDAQ',
            '<channelSelection>101,102,103,201,211</channelSelection> /TDAQ/OLC/BUNCHLUMIS',
            className='CondAttrListCollection')

    else:
        conddb.addFolder('TDAQ', folder, className='CondAttrListCollection')

    from CoolLumiUtilities.CoolLumiUtilitiesConf import \
         BunchLumisCondAlg

    from CoolLumiUtilities.FillParamsCondAlgDefault import FillParamsCondAlgDefault
    fpalg = FillParamsCondAlgDefault()

    alg = BunchLumisCondAlg(name,
                            BunchLumisFolderInputKey=folder,
                            FillParamsInputKey=fpalg.FillParamsOutputKey,
                            BunchLumisOutputKey='BunchLumisCondData')
    condSeq += alg

    return alg
コード例 #10
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration

# Always schedule beam spot conditions for digi
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
if not hasattr(condSeq, "BeamSpotCondAlg"):
    from IOVDbSvc.CondDB import conddb
    conddb.addFolderSplitOnline("INDET", "/Indet/Onl/Beampos", "/Indet/Beampos", className="AthenaAttributeList")
    from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg
    condSeq += BeamSpotCondAlg("BeamSpotCondAlg")

# Add beam spot fixer
from AthenaCommon import CfgGetter
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.GlobalFlags import globalflags
from Digitization.DigitizationFlags import digitizationFlags
from OverlayCommonAlgs.OverlayFlags import overlayFlags
if (DetFlags.pileup.any_on() or digitizationFlags.doXingByXingPileUp()) or (globalflags.isOverlay() and not overlayFlags.isOverlayMT()):
    from AthenaCommon.AlgSequence import AlgSequence
    job = AlgSequence()
    job += CfgGetter.getAlgorithm("BeamSpotFixerAlg")
コード例 #11
0
include('TrigT1CaloCalibConditions/L1CaloCalibConditionsMC_jobOptions.py')
from TrigT1CaloSim.TrigT1CaloSimRun2Config import Run2TriggerTowerMaker25ns, Run2TriggerTowerMaker50ns

from SGComps.AddressRemappingSvc import addInputRename
addInputRename('xAOD::TriggerTowerContainer', 'xAODTriggerTowers_rerun',
               'xAODTriggerTowers')

# try to determine wheter running with 25ns/50ns bunchspacing
_bunchSpacing = None
_doPC = True  # do pedestal correction?
_alg = {25: Run2TriggerTowerMaker25ns, 50: Run2TriggerTowerMaker50ns}

from PyUtils.MetaReaderPeeker import metadata

from AthenaCommon.GlobalFlags import globalflags
if globalflags.isOverlay() is True:
    _doPC = False
    from AthenaCommon import CfgMgr
    from AthenaCommon.AppMgr import ToolSvc
    if not hasattr(ToolSvc, "LumiBlockMuTool"):
        ToolSvc += CfgMgr.LumiBlockMuTool("LumiBlockMuTool")
    from TrigT1CaloSim.TrigT1CaloSimConf import LVL1__OverlayRun2TriggerTowerMaker
    job += LVL1__OverlayRun2TriggerTowerMaker('Run2TriggerTowerMaker',
                                              CellType=3,
                                              ZeroSuppress=True,
                                              DoOverlay=True)
else:
    try:
        if not 'metadata' in dir():
            raise RuntimeError('Input file summary not available.')
        # try:
コード例 #12
0
    def configure(self):

        mlog = logging.getLogger( 'TileRawChannelGetter::configure:' )
        mlog.info ("entering")

        self._TileRawChannelBuilderFitFilter = None
        self._TileRawChannelBuilderFitFilterCool = None
        self._TileRawChannelBuilderMF = None
        self._TileRawChannelBuilderOF1 = None
        self._TileRawChannelBuilderOpt2Filter = None
        self._TileRawChannelBuilderOptATLAS = None
        self._TileRawChannelBuilderWienerFilter = None

        # Instantiation of the C++ algorithm
        try:        
            from TileRecUtils.TileRecUtilsConf import TileRawChannelMaker               
            theTileRawChannelMaker = TileRawChannelMaker("TileRChMaker")
        except Exception:
            mlog.error("could not import TileRecUtils.TileRawChannelMaker")
            traceback.print_exc()
            return False
    
        self._TileRChMaker = theTileRawChannelMaker

        # Configure TileInfoLoader
        from AthenaCommon.AppMgr import ServiceMgr

        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()

        from TileRecUtils.TileRecFlags import jobproperties

        # true for real data, false for MC - GlobalFlags.DataSource.is_data()
        # true for nominal ATLAS configuration - GlobalFlags.DetGeo.is_atlas()
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource() == 'data' and jobproperties.TileRecFlags.noiseFilter() < 0:
            # apply noise filter for real data (if this option was not set before)
            jobproperties.TileRecFlags.noiseFilter = 1

        if globalflags.DataSource() == 'data' and not globalflags.isOverlay():
            if jobproperties.TileRecFlags.TileRunType() == 1 :
                tileBeamElemContainer=""
            else:
                tileBeamElemContainer="TileBeamElemCnt"
            if jobproperties.TileRecFlags.readDigits():
                tileDigitsContainer="TileDigitsCnt"
            else:
                tileDigitsContainer=""
            tileRawChannelContainer="TileRawChannelCnt"
        else:
            tileBeamElemContainer=""
            tileDigitsContainer=""
            tileRawChannelContainer=""

        if not globalflags.isOverlay():
            from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault
            TileDQstatusAlgDefault (TileRawChannelContainer = tileRawChannelContainer,
                                    TileDigitsContainer = tileDigitsContainer,
                                    TileBeamElemContainer = tileBeamElemContainer)

        # set time window for amplitude correction if it was not set correctly before
        if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() <= jobproperties.TileRecFlags.TimeMinForAmpCorrection() :
            from AthenaCommon.BeamFlags import jobproperties
            mlog.info("adjusting min/max time of parabolic correction for %s", jobproperties.Beam.bunchSpacing)
            halfBS = jobproperties.Beam.bunchSpacing.get_Value()/2.
            if halfBS > 25.1:
                mlog.info("Bunch spacing is too big, keeping default limits for parabolic correction")
            else:
                jobproperties.TileRecFlags.TimeMinForAmpCorrection = -halfBS
                jobproperties.TileRecFlags.TimeMaxForAmpCorrection = halfBS

        TileFrameLength = ServiceMgr.TileInfoLoader.NSamples
        if TileFrameLength!=7:
            mlog.info("disabling reading of OFC from COOL because Nsamples!=7")
            jobproperties.TileRecFlags.OfcFromCOOL = False

        jobproperties.TileRecFlags.print_JobProperties('tree&value')
        
        # run optimal filter only if readDigits is set
        if jobproperties.TileRecFlags.readDigits():

            from AthenaCommon.AlgSequence import AlgSequence
            topSequence = AlgSequence()

            TilePulseTypes = {0 : 'PHY', 1 : 'PHY', 2 : 'LAS', 4 : 'PHY', 8 : 'CIS'}
            TilePulse = TilePulseTypes[jobproperties.TileRecFlags.TileRunType()]

            from TileConditions.TileCondToolConf import getTileCondToolOfcCool
            toolOfcCool = None
            toolOfcCoolOF1 = None

            NoiseFilterTools = []
            TileRawChannelContainerDSP = ''
            if jobproperties.TileRecFlags.noiseFilter() == 1:

                if globalflags.DataSource() == 'data':

                    # check if there are DSP thresholds in DB
                    if jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits():
                        jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits = False

                    if jobproperties.TileRecFlags.correctPedestalDifference():
                        # check if offline and there are OFCs in DB for OF1 method
                        toolOfcCoolOF1 = getTileCondToolOfcCool('COOL', TilePulse, 'OF1', 'TileCondToolOfcCoolOF1')
                        if athenaCommonFlags.isOnline() or not toolOfcCoolOF1:
                            jobproperties.TileRecFlags.correctPedestalDifference = False
                        #else:
                        #    tileInfoConfigurator.setupCOOLTIME(online = True)

                    if jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits() or jobproperties.TileRecFlags.correctPedestalDifference():
                        from TileRecUtils.TileRecUtilsConf import TileRawChannelOF1Corrector
                        theTileRawChannelOF1Corrector = TileRawChannelOF1Corrector()
                        theTileRawChannelOF1Corrector.CorrectPedestalDifference = jobproperties.TileRecFlags.correctPedestalDifference()
                        theTileRawChannelOF1Corrector.ZeroAmplitudeWithoutDigits = jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits()

                        if jobproperties.TileRecFlags.correctPedestalDifference():
                            from TileConditions.TileCondToolConf import getTileCondToolTiming
                            toolOnlineTiming = getTileCondToolTiming('COOL', TilePulse, True, 'TileCondToolOnlineTiming')
                            theTileRawChannelOF1Corrector.TileCondToolTiming = toolOnlineTiming
                            theTileRawChannelOF1Corrector.TileCondToolOfc = toolOfcCoolOF1

                        NoiseFilterTools += [theTileRawChannelOF1Corrector]


                from TileRecUtils.TileRecUtilsConf import TileRawChannelNoiseFilter
                theTileRawChannelNoiseFilter = TileRawChannelNoiseFilter()
                if not athenaCommonFlags.isOnline():
                    theTileRawChannelNoiseFilter.TileCondToolNoiseSample.TileOnlineSampleNoise = ''
                NoiseFilterTools += [theTileRawChannelNoiseFilter]

                if globalflags.DataSource() == 'data' and not globalflags.isOverlay():
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelCorrectionAlg
                    theTileRawChannelCorrectionAlg = TileRawChannelCorrectionAlg()
                    theTileRawChannelCorrectionAlg.NoiseFilterTools= NoiseFilterTools
                    TileRawChannelContainerDSP = 'TileRawChannelCntCorrected'
                    topSequence += theTileRawChannelCorrectionAlg

            if (jobproperties.TileRecFlags.doTileMF()
                or (not jobproperties.TileRecFlags.OfcFromCOOL()
                    and (jobproperties.TileRecFlags.doTileOF1()
                         or jobproperties.TileRecFlags.doTileWiener()
                         or jobproperties.TileRecFlags.doTileOpt2()
                         or jobproperties.TileRecFlags.doTileOptATLAS()))):

                tileInfoConfigurator.setupCOOLPULSE(type = TilePulse)
                tileInfoConfigurator.setupCOOLAutoCr()

            elif jobproperties.TileRecFlags.doTileFitCool():
                tileInfoConfigurator.setupCOOLPULSE(type = TilePulse)

            if jobproperties.TileRecFlags.OfcFromCOOL():
                if (jobproperties.TileRecFlags.doTileMF()
                    or jobproperties.TileRecFlags.doTileWiener()
                    or jobproperties.TileRecFlags.doTileOpt2()
                    or jobproperties.TileRecFlags.doTileOptATLAS()):

                    tileInfoConfigurator.setupCOOLOFC(type = TilePulse)
                    toolOfcCool = getTileCondToolOfcCool('COOL', TilePulse)

                if jobproperties.TileRecFlags.doTileOF1():
                    tileInfoConfigurator.setupCOOLOFC(type = TilePulse, ofcType = 'OF1')

                    if not toolOfcCoolOF1:
                        toolOfcCoolOF1 = getTileCondToolOfcCool('COOL', TilePulse, 'OF1', 'TileCondToolOfcCoolOF1')


            if jobproperties.TileRecFlags.doTileQIE():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderQIEFilter
                    theTileRawChannelBuilderQIEFilter= TileRawChannelBuilderQIEFilter()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderQIEFilter Quit")
                    traceback.print_exc()
                    return False
                    
                #TileRawChannelBuilderQIEFilter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelQIE"
                theTileRawChannelBuilderQIEFilter.TileRawChannelContainer = "TileRawChannelQIE"
                theTileRawChannelBuilderQIEFilter.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderQIEFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderQIEFilter.correctTime     = jobproperties.TileRecFlags.correctTime()
                theTileRawChannelBuilderQIEFilter.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderQIEFilter.PedestalMode = 1
                theTileRawChannelBuilderQIEFilter.DSPContainer = TileRawChannelContainerDSP
      
                mlog.info(" adding now TileRawChannelBuilderQIEFilter to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderQIEFilter]
            
            # fit with several amplitudes 
            if jobproperties.TileRecFlags.doTileManyAmps():
      
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderManyAmps
                    theTileRawChannelBuilderManyAmps= TileRawChannelBuilderManyAmps()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderManyAmps Quit")
                    traceback.print_exc()
                    return False
      
                #TileRawChannelBuilderManyAmps Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelManyAmp"
                theTileRawChannelBuilderManyAmps.TileRawChannelContainer = "TileRawChannelManyAmp"
                theTileRawChannelBuilderManyAmps.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderManyAmps.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderManyAmps.correctTime     = jobproperties.TileRecFlags.correctTime()    
                theTileRawChannelBuilderManyAmps.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderManyAmps.DSPContainer = TileRawChannelContainerDSP
                 
                mlog.info(" adding now TileRawChannelBuilderManyAmps to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderManyAmps]
      
            # flat filter - sum of 5 samples
            if jobproperties.TileRecFlags.doTileFlat():
      
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderFlatFilter
                    theTileRawChannelBuilderFlatFilter= TileRawChannelBuilderFlatFilter()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderFlatFilter Quit")
                    traceback.print_exc()
                    return False
      
                #TileRawChannelBuilderFlatFilter Options: 
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFlat"
                theTileRawChannelBuilderFlatFilter.TileRawChannelContainer = "TileRawChannelFlat"
                theTileRawChannelBuilderFlatFilter.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderFlatFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderFlatFilter.correctTime     = jobproperties.TileRecFlags.correctTime()    
                theTileRawChannelBuilderFlatFilter.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderFlatFilter.FrameLength = TileFrameLength
                theTileRawChannelBuilderFlatFilter.SignalLength = TileFrameLength - 1
                theTileRawChannelBuilderFlatFilter.DSPContainer = TileRawChannelContainerDSP
      
                mlog.info(" adding now TileRawChannelBuilderFlatFilter to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderFlatFilter]
      
            # Fit method
            if jobproperties.TileRecFlags.doTileFit() or jobproperties.TileRecFlags.doTileOverflowFit():
          
                # configure TileRawChannelMaker here
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderFitFilter
                    theTileRawChannelBuilderFitFilter= TileRawChannelBuilderFitFilter()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderFitFilter Quit")
                    traceback.print_exc()
                    return False
                
                #TileRawChannelBuilderFitFilter Options: 
                theTileRawChannelBuilderFitFilter.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderFitFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderFitFilter.correctTime     = jobproperties.TileRecFlags.correctTime()    
                theTileRawChannelBuilderFitFilter.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderFitFilter.FrameLength = TileFrameLength
                theTileRawChannelBuilderFitFilter.DSPContainer = TileRawChannelContainerDSP
                if not athenaCommonFlags.isOnline():
                    theTileRawChannelBuilderFitFilter.TileCondToolNoiseSample.TileOnlineSampleNoise = ''
                
                # add the tool to list of tool ( should use ToolHandle eventually)
                mlog.info(" adding now TileRawChannelBuilderFitFilter to the algorithm: %s", theTileRawChannelMaker.name())

                if jobproperties.TileRecFlags.doTileFit():
                    jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFit"
                    theTileRawChannelBuilderFitFilter.TileRawChannelContainer = "TileRawChannelFit"
                    theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderFitFilter]
                    self._TileRawChannelBuilderFitFilter = theTileRawChannelBuilderFitFilter
                    
                if jobproperties.TileRecFlags.doTileOverflowFit(): 
                    theTileRawChannelMaker.FitOverflow = True
                    theTileRawChannelMaker.TileRawChannelBuilderFitOverflow = theTileRawChannelBuilderFitFilter
                    mlog.info(" set up TileRawChannelBuilderFitOverflow to TileRawChannelBuilderFitFilter")
                
            # Fit method with reading from COOL
            if jobproperties.TileRecFlags.doTileFitCool():
          
                # configure TileRawChannelMaker here
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderFitFilterCool
                    theTileRawChannelBuilderFitFilterCool= TileRawChannelBuilderFitFilterCool()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderFitFilterCool Quit")
                    traceback.print_exc()
                    return False
                
                #TileRawChannelBuilderFitFilterCool Options: 
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFitCool"
                theTileRawChannelBuilderFitFilterCool.TileRawChannelContainer = "TileRawChannelFitCool"
                theTileRawChannelBuilderFitFilterCool.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderFitFilterCool.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderFitFilterCool.correctTime     = jobproperties.TileRecFlags.correctTime()    
                theTileRawChannelBuilderFitFilterCool.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderFitFilterCool.FrameLength = TileFrameLength
                theTileRawChannelBuilderFitFilterCool.DSPContainer = TileRawChannelContainerDSP
                
                # add the tool to list of tool ( should use ToolHandle eventually)
                mlog.info(" adding now TileRawChannelBuilderFitFilterCool to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderFitFilterCool]
                self._TileRawChannelBuilderFitFilterCool = theTileRawChannelBuilderFitFilterCool
                
            # matched filter 
            if jobproperties.TileRecFlags.doTileMF():
      
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderMF
                    theTileRawChannelBuilderMF= TileRawChannelBuilderMF()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderMF Quit")
                    traceback.print_exc()
                    return False
                                    
                # setup COOL to get OFCs, needed for COF to retrieve pulse shape and derivatives
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderMF.TileCondToolOfc = toolOfcCool

                #TileRawChannelBuilderMF Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelMF"
                theTileRawChannelBuilderMF.TileRawChannelContainer = "TileRawChannelMF"
                theTileRawChannelBuilderMF.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderMF.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                if jobproperties.TileRecFlags.BestPhaseFromCOOL(): # can't correct time and use best phase at the same time
                    theTileRawChannelBuilderMF.correctTime = False
                else:
                    theTileRawChannelBuilderMF.correctTime = jobproperties.TileRecFlags.correctTime()
                theTileRawChannelBuilderMF.BestPhase       = jobproperties.TileRecFlags.BestPhaseFromCOOL()
                theTileRawChannelBuilderMF.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderMF.MaxIterations = 5 # iterative mode on
                theTileRawChannelBuilderMF.AmplitudeCorrection = False
                theTileRawChannelBuilderMF.TimeFromCOF = False
                theTileRawChannelBuilderMF.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection()
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderMF.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                    theTileRawChannelBuilderMF.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()

                theTileRawChannelBuilderMF.DSPContainer = TileRawChannelContainerDSP
                mlog.info(" adding now TileRawChannelBuilderMF to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderMF]
                self._TileRawChannelBuilderMF = theTileRawChannelBuilderMF

            if jobproperties.TileRecFlags.doTileOF1():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOF1 = TileRawChannelBuilderOpt2Filter("TileRawChannelBuilderOF1")
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderOF1 Quit")
                    traceback.print_exc()
                    return False
                
                # setup COOL to get OFCs
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    if toolOfcCoolOF1:
                        theTileRawChannelBuilderOF1.TileCondToolOfc = toolOfcCoolOF1
                    else:
                        # There are no OF1 OFC in the COOL
                        # OFC will be calculated on the fly
                        tileInfoConfigurator.setupCOOLPULSE(type = TilePulse)
                        tileInfoConfigurator.setupCOOLAutoCr()

                #TileRawChannelBuilderOF1 Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelOF1"
                theTileRawChannelBuilderOF1.TileRawChannelContainer = "TileRawChannelOF1"
                theTileRawChannelBuilderOF1.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderOF1.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                if jobproperties.TileRecFlags.BestPhaseFromCOOL(): # can't correct time and use best phase at the same time
                    theTileRawChannelBuilderOF1.correctTime = False
                else:
                    theTileRawChannelBuilderOF1.correctTime = jobproperties.TileRecFlags.correctTime()
                theTileRawChannelBuilderOF1.BestPhase       = jobproperties.TileRecFlags.BestPhaseFromCOOL()
                theTileRawChannelBuilderOF1.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderOF1.OF2 = False
                theTileRawChannelBuilderOF1.PedestalMode = -1
                theTileRawChannelBuilderOF1.MaxIterations = 1 # just one iteration
                theTileRawChannelBuilderOF1.Minus1Iteration = False # assume that max sample is at t=0
                theTileRawChannelBuilderOF1.AmplitudeCorrection = jobproperties.TileRecFlags.correctAmplitude()
                theTileRawChannelBuilderOF1.TimeCorrection = False
                theTileRawChannelBuilderOF1.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection()
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderOF1.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                    theTileRawChannelBuilderOF1.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()
      
                theTileRawChannelBuilderOF1.DSPContainer = TileRawChannelContainerDSP
                mlog.info(" adding now TileRawChannelBuilderOF1 to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderOF1]
                self._TileRawChannelBuilderOF1 = theTileRawChannelBuilderOF1

            if jobproperties.TileRecFlags.doTileOpt2():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOpt2Filter= TileRawChannelBuilderOpt2Filter()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderOpt2Filter Quit")
                    traceback.print_exc()
                    return False
                
                # setup COOL to get OFCs
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderOpt2Filter.TileCondToolOfc = toolOfcCool
                    
                #TileRawChannelBuilderOpt2Filter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelOpt2"
                theTileRawChannelBuilderOpt2Filter.TileRawChannelContainer = "TileRawChannelOpt2"
                theTileRawChannelBuilderOpt2Filter.RunType = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderOpt2Filter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderOpt2Filter.correctTime     = jobproperties.TileRecFlags.correctTime()
                theTileRawChannelBuilderOpt2Filter.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderOpt2Filter.BestPhase       = False # no point to use best phase with interations
                theTileRawChannelBuilderOpt2Filter.OF2 = True
                theTileRawChannelBuilderOpt2Filter.PedestalMode = 1
                theTileRawChannelBuilderOpt2Filter.MaxIterations = 5
                theTileRawChannelBuilderOpt2Filter.Minus1Iteration = True
                theTileRawChannelBuilderOpt2Filter.AmplitudeCorrection = False # don't need correction after iterations
                theTileRawChannelBuilderOpt2Filter.TimeCorrection    = False # don't need correction after iterations
                theTileRawChannelBuilderOpt2Filter.DSPContainer = TileRawChannelContainerDSP
      
                mlog.info(" adding now TileRawChannelBuilderOpt2Filter to the algorithm: %s", theTileRawChannelMaker.name())
      
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderOpt2Filter]
                self._TileRawChannelBuilderOpt2Filter = theTileRawChannelBuilderOpt2Filter
      
      
            if jobproperties.TileRecFlags.doTileOptATLAS():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOptATLAS= TileRawChannelBuilderOpt2Filter("TileRawChannelBuilderOptATLAS")
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderOpt2Filter Quit")
                    traceback.print_exc()
                    return False
                
                # setup COOL to get OFCs
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderOptATLAS.TileCondToolOfc = toolOfcCool
                    
                #TileRawChannelBuilderOptATLAS Options:
                if globalflags.DataSource()=='data': # don't use the name which is used for reco data from DSP
                    if jobproperties.TileRecFlags.TileRawChannelContainer == "TileRawChannelCnt":
                        jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFixed"
                    theTileRawChannelBuilderOptATLAS.TileRawChannelContainer = "TileRawChannelFixed"
                else:
                    jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelCnt"
                    theTileRawChannelBuilderOptATLAS.TileRawChannelContainer = "TileRawChannelCnt"
                theTileRawChannelBuilderOptATLAS.RunType         = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderOptATLAS.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy()
                if jobproperties.TileRecFlags.BestPhaseFromCOOL(): # can't correct time and use best phase at the same time
                    theTileRawChannelBuilderOptATLAS.correctTime = False
                else:
                    theTileRawChannelBuilderOptATLAS.correctTime = jobproperties.TileRecFlags.correctTime()
                theTileRawChannelBuilderOptATLAS.BestPhase       = jobproperties.TileRecFlags.BestPhaseFromCOOL()
                theTileRawChannelBuilderOptATLAS.NoiseFilterTools= NoiseFilterTools
                theTileRawChannelBuilderOptATLAS.OF2 = True
                #theTileRawChannelBuilderOptATLAS.PedestalMode = 1 # not sure if we need this option here
                theTileRawChannelBuilderOptATLAS.MaxIterations = 1 # just one iteration
                theTileRawChannelBuilderOptATLAS.Minus1Iteration = False # assume that max sample is at t=0
                theTileRawChannelBuilderOptATLAS.AmplitudeCorrection = jobproperties.TileRecFlags.correctAmplitude()
                theTileRawChannelBuilderOptATLAS.TimeCorrection = jobproperties.TileRecFlags.correctTimeNI()
                theTileRawChannelBuilderOptATLAS.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection()
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderOptATLAS.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                    theTileRawChannelBuilderOptATLAS.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()

                theTileRawChannelBuilderOptATLAS.DSPContainer = TileRawChannelContainerDSP
                
                mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name TileRawChannelBuilderOptATLAS to the algorithm: %s",
                          theTileRawChannelMaker.name())
                
                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderOptATLAS]
                self._TileRawChannelBuilderOptATLAS = theTileRawChannelBuilderOptATLAS

            if jobproperties.TileRecFlags.doTileWiener():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderWienerFilter
                    theTileRawChannelBuilderWienerFilter= TileRawChannelBuilderWienerFilter()
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderWienerFilter Quit")
                    traceback.print_exc()
                    return False

                #TileRawChannelBuilderWienerFilter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer           = "TileRawChannelWiener"
                theTileRawChannelBuilderWienerFilter.TileRawChannelContainer = "TileRawChannelWiener"
                theTileRawChannelBuilderWienerFilter.RunType                 = jobproperties.TileRecFlags.TileRunType()
                theTileRawChannelBuilderWienerFilter.calibrateEnergy         = jobproperties.TileRecFlags.calibrateEnergy()
                theTileRawChannelBuilderWienerFilter.correctTime             = jobproperties.TileRecFlags.correctTime()
                theTileRawChannelBuilderWienerFilter.NoiseFilterTools        = NoiseFilterTools
                theTileRawChannelBuilderWienerFilter.BestPhase               = False # no point to use best phase with interations
                theTileRawChannelBuilderWienerFilter.MC                      = globalflags.DataSource()!='data'
                theTileRawChannelBuilderWienerFilter.PedestalMode            = 1
                theTileRawChannelBuilderWienerFilter.MaxIterations           = 5
                theTileRawChannelBuilderWienerFilter.Minus1Iteration         = True
                theTileRawChannelBuilderWienerFilter.AmplitudeCorrection     = False # don't need correction after iterations
                theTileRawChannelBuilderWienerFilter.TimeCorrection          = False # don't need correction after iterations
                theTileRawChannelBuilderWienerFilter.DSPContainer            = TileRawChannelContainerDSP

                ServiceMgr.TileInfoLoader.LoadWienerFilterWeights            = True

                mlog.info(" adding now TileRawChannelBuilderWienerFilter to the algorithm: %s", theTileRawChannelMaker.name())

                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderWienerFilter]
                self._TileRawChannelBuilderWienerFilter = theTileRawChannelBuilderWienerFilter
            

            # now add algorithm to topSequence
            # this should always come at the end

            mlog.info(" now adding to topSequence")        

            if jobproperties.TileRecFlags.noiseFilter() == 2:
                # Instantiation of the C++ algorithm
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawCorrelatedNoise
                    theTileRawCorrelatedNoise=TileRawCorrelatedNoise("TileRCorreNoise")
                except Exception:
                    mlog.error("could not import TileRecUtils.TileRawCorrelatedNoise")
                    traceback.print_exc()
                    return False
                #theTileRawCorrelatedNoise.UseMeanFiles = False
                #theTileRawCorrelatedNoise.PMTOrder = True
                jobproperties.TileRecFlags.TileDigitsContainer = "NewDigitsContainer"
                topSequence += theTileRawCorrelatedNoise

            jobproperties.TileRecFlags.print_JobProperties('tree&value')

            theTileRawChannelMaker.TileDigitsContainer = jobproperties.TileRecFlags.TileDigitsContainer()
            topSequence += theTileRawChannelMaker

        else:
            mlog.info(" Disable all OF methods because readDigits flag set to False ")
            jobproperties.TileRecFlags.doTileFlat = False
            jobproperties.TileRecFlags.doTileFit = False
            jobproperties.TileRecFlags.doTileFitCool = False
            jobproperties.TileRecFlags.doTileOpt2 = False
            jobproperties.TileRecFlags.doTileOptATLAS = False
            jobproperties.TileRecFlags.doTileManyAmps = False
            jobproperties.TileRecFlags.doTileMF = False
            jobproperties.TileRecFlags.doTileOF1 = False
            jobproperties.TileRecFlags.doTileWiener = False
            jobproperties.TileRecFlags.OfcFromCOOL = False
            jobproperties.TileRecFlags.print_JobProperties('tree&value')

        return True
コード例 #13
0
    from __main__ import ALLOWIGNORECONFIGERROR
    from __main__ import ALLOWDISABLE
    from __main__ import ALLOWBACKNAV

from AthenaCommon.Logging import logging
mlog = logging.getLogger('TileDigitiization')

if doTileHitToRawChannelDirect:

    from TileSimAlgs.TileRawChannelFromHitsGetter import *
    theTileRawChannelFromHitsGetter = TileRawChannelFromHitsGetter()

if doTileHitToDigit:
    # Change default parameters for TileDQstatusAlg.
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay():
        from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault
        dqstatus = TileDQstatusAlgDefault()
        dqstatus.TileBeamElemContainer = ""
        # disable reading of trigger type from BeamElem container

        from OverlayCommonAlgs.OverlayFlags import overlayFlags
        if overlayFlags.isDataOverlay():
            if overlayFlags.isOverlayMT():
                dqstatus.TileDigitsContainer = overlayFlags.bkgPrefix(
                ) + "TileDigitsCnt"
                dqstatus.TileRawChannelContainer = overlayFlags.bkgPrefix(
                ) + "TileRawChannelCnt"
            else:
                dqstatus.TileDigitsContainer = overlayFlags.dataStore(
                ) + "+TileDigitsCnt"
コード例 #14
0
###############################################################
#
# TRT Digitization
#
#==============================================================

# File updated April 2007, by Esben Klinkby <*****@*****.**>
from AthenaCommon.Resilience import protectedInclude
protectedInclude("PartPropSvc/PartPropSvc.py")
# Setup to use conditions database folder to steer digitization settings
from AthenaCommon.GlobalFlags import globalflags
if not (globalflags.isOverlay() and globalflags.DataSource == 'data'):
    from IOVDbSvc.CondDB import conddb
    conddb.addFolder("TRT_OFL", "/TRT/Cond/DigVers")
コード例 #15
0
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger('CaloCellGetter::configure:')
        mlog.info('entering')

        doStandardCellReconstruction = True
        from CaloRec.CaloCellFlags import jobproperties
        from AthenaCommon.AppMgr import ToolSvc

        if not jobproperties.CaloCellFlags.doFastCaloSim.statusOn:
            doFastCaloSim = False
            mlog.info("doFastCaloSim not set, so not using it")
        else:
            doFastCaloSim = jobproperties.CaloCellFlags.doFastCaloSim()
            if doFastCaloSim:
                mlog.info("doFastCaloSim requested")
                doStandardCellReconstruction = False
                if jobproperties.CaloCellFlags.doFastCaloSimAddCells():
                    doStandardCellReconstruction = True
                    mlog.info(
                        "doFastCaloSimAddCells requested: FastCaloSim is added to fullsim calorimeter"
                    )
                else:
                    mlog.info(
                        "doFastCaloSimAddCells not requested: Stand alone FastCaloSim is running"
                    )
            else:
                mlog.info("doFastCaloSim explicitly not requested")

        # get handle to upstream object
        # handle tile

        if doStandardCellReconstruction:
            from LArROD.LArRODFlags import larRODFlags
            from AthenaCommon.GlobalFlags import globalflags
            if larRODFlags.readDigits() and globalflags.DataSource() == 'data':
                from LArROD.LArRawChannelBuilderDefault import LArRawChannelBuilderDefault
                LArRawChannelBuilderDefault()

        # writing of thinned digits
        if jobproperties.CaloCellFlags.doLArThinnedDigits.statusOn and jobproperties.CaloCellFlags.doLArThinnedDigits(
        ):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'data':
                try:
                    from LArROD.LArDigits import DefaultLArDigitThinner
                    LArDigitThinner = DefaultLArDigitThinner(
                        'LArDigitThinner'
                    )  # automatically added to topSequence
                    LArDigitThinner.InputContainerName = "FREE"
                    LArDigitThinner.OutputContainerName = "LArDigitContainer_Thinned"
                except Exception:
                    treatException("Problem with LArDigitThinner ")

        # now configure the algorithm, part of this could be done in a separate class
        # cannot have same name
        try:
            from CaloRec.CaloRecConf import CaloCellMaker
        except Exception:
            mlog.error("could not import CaloRec.CaloCellMaker")
            print(traceback.format_exc())
            return False

        theCaloCellMaker = CaloCellMaker()
        self._CaloCellMakerHandle = theCaloCellMaker

        if doStandardCellReconstruction:
            # configure CaloCellMaker here
            # check LArCellMakerTool_jobOptions.py for full configurability
            # FIXME

            if rec.doLArg():
                from LArCabling.LArCablingAccess import LArOnOffIdMapping
                LArOnOffIdMapping()

                try:
                    from LArCellRec.LArCellRecConf import LArCellBuilderFromLArRawChannelTool
                    theLArCellBuilder = LArCellBuilderFromLArRawChannelTool()
                except Exception:
                    mlog.error(
                        "could not get handle to LArCellBuilderFromLArRawChannel Quit"
                    )
                    print(traceback.format_exc())
                    return False

                if jobproperties.CaloCellFlags.doLArCreateMissingCells():
                    theLArCellBuilder.addDeadOTX = True

                # add the tool to list of tool ( should use ToolHandle eventually)
                theCaloCellMaker += theLArCellBuilder
                theCaloCellMaker.CaloCellMakerToolNames += [theLArCellBuilder]

            if rec.doTile():

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.DataSource(
                ) == 'data' and globalflags.InputFormat() == 'bytestream':
                    try:
                        svcMgr.ByteStreamCnvSvc.ROD2ROBmap = ["-1"]
                        if "TileDigitsContainer/TileDigitsCnt" not in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                            svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                                "TileBeamElemContainer/TileBeamElemCnt",
                                "TileDigitsContainer/TileDigitsCnt",
                                "TileL2Container/TileL2Cnt",
                                "TileLaserObject/TileLaserObj",
                                "TileMuonReceiverContainer/TileMuRcvCnt"
                            ]
                    except Exception:
                        mlog.warning(
                            "Cannot add TileDigitsContainer/TileDigitsCnt et al. to bytestream list"
                        )

                    # set options for TileRawChannelMaker
                    from TileRecUtils.TileRecFlags import jobproperties
                    jobproperties.TileRecFlags.TileRunType = 1  # physics run type

                    # reading of digits can be disabled before calling CaloCellGetter
                    # if this is not done, but digits are not available in BS file
                    # reading of digits is automatically disabled at start of run
                    if jobproperties.TileRecFlags.readDigits()                \
                        and not (jobproperties.TileRecFlags.doTileFlat        \
                                 or jobproperties.TileRecFlags.doTileFit      \
                                 or jobproperties.TileRecFlags.doTileFitCool  \
                                 or jobproperties.TileRecFlags.doTileOF1      \
                                 or jobproperties.TileRecFlags.doTileOpt2     \
                                 or jobproperties.TileRecFlags.doTileOptATLAS \
                                 or jobproperties.TileRecFlags.doTileMF):

                        from AthenaCommon.BeamFlags import jobproperties
                        # run Opt filter with iterations by default, both for cosmics and collisions before 2011
                        # run Opt filter without iterations for collisions in 2011 and later
                        if 'doTileOpt2' not in dir():
                            from RecExConfig.AutoConfiguration import GetRunNumber
                            rn = GetRunNumber()
                            if not athenaCommonFlags.isOnline(
                            ) and rn > 0 and rn < 171194:
                                doTileOpt2 = True
                            elif jobproperties.Beam.beamType() == 'collisions':
                                doTileOpt2 = False  # use OF without iterations for collisions
                            else:
                                doTileOpt2 = True  # always run OF with iterations for cosmics

                        # jobproperties.TileRecFlags.calibrateEnergy=True # use pCb for RawChannels
                        # please, note that time correction and best phase are used only for collisions
                        if doTileOpt2:
                            jobproperties.TileRecFlags.doTileOpt2 = True  # run optimal filter with iterations
                            jobproperties.TileRecFlags.doTileOptATLAS = False  # disable optimal filter without iterations
                            jobproperties.TileRecFlags.correctAmplitude = False  # don't do parabolic correction
                            if jobproperties.Beam.beamType() == 'collisions':
                                jobproperties.TileRecFlags.correctTime = True  # apply time correction in physics runs
                                jobproperties.TileRecFlags.BestPhaseFromCOOL = False  # best phase is not needed for iterations
                        else:
                            jobproperties.TileRecFlags.doTileOpt2 = False  # disable optimal filter with iterations
                            jobproperties.TileRecFlags.doTileOptATLAS = True  # run optimal filter without iterations
                            jobproperties.TileRecFlags.correctAmplitude = True  # apply parabolic correction
                            if jobproperties.Beam.beamType() == 'collisions':
                                jobproperties.TileRecFlags.correctTime = False  # don't need time correction if best phase is used
                                jobproperties.TileRecFlags.BestPhaseFromCOOL = True  # use best phase stored in DB

                    try:
                        from TileRecUtils.TileRawChannelGetter import TileRawChannelGetter
                        theTileRawChannelGetter = TileRawChannelGetter(
                        )  # noqa: F841
                    except Exception:
                        mlog.error("could not load TileRawChannelGetter Quit")
                        print(traceback.format_exc())
                        return False

                    try:
                        from TileRecAlgs.TileRecAlgsConf import TileDigitsFilter
                        from AthenaCommon.AlgSequence import AlgSequence
                        topSequence = AlgSequence()
                        topSequence += TileDigitsFilter()
                    except Exception:
                        mlog.error("Could not configure TileDigitsFilter")

                from AthenaCommon.AlgSequence import AthSequencer
                condSequence = AthSequencer("AthCondSeq")
                checkDCS = hasattr(condSequence, 'TileDCSCondAlg')
                try:
                    from TileRecUtils.TileRecUtilsConf import TileCellBuilder
                    theTileCellBuilder = TileCellBuilder(CheckDCS=checkDCS)
                    from TileRecUtils.TileRecFlags import jobproperties
                    theTileCellBuilder.TileRawChannelContainer = jobproperties.TileRecFlags.TileRawChannelContainer(
                    )

                    if (jobproperties.TileRecFlags.noiseFilter() == 1
                            and jobproperties.TileRecFlags.readDigits()
                            and globalflags.DataSource() == 'data'
                            and not globalflags.isOverlay()):
                        theTileCellBuilder.TileDSPRawChannelContainer = 'TileRawChannelCntCorrected'

                    rawChannelContainer = ''
                    if globalflags.DataSource(
                    ) == 'data' and globalflags.InputFormat() == 'bytestream':
                        if jobproperties.TileRecFlags.readDigits():
                            # everything is already corrected at RawChannel level
                            theTileCellBuilder.correctTime = False
                            theTileCellBuilder.correctAmplitude = False
                        else:
                            rawChannelContainer = 'TileRawChannelCnt'
                            # by default parameters are tuned for opt.filter without iterations
                            theTileCellBuilder.correctTime = jobproperties.TileRecFlags.correctTime(
                            )
                            theTileCellBuilder.correctAmplitude = jobproperties.TileRecFlags.correctAmplitude(
                            )
                            theTileCellBuilder.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection(
                            )
                            if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                            ) <= jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                            ):
                                from AthenaCommon.BeamFlags import jobproperties
                                mlog.info(
                                    "adjusting min/max time of parabolic correction for %s",
                                    jobproperties.Beam.bunchSpacing)
                                halfBS = jobproperties.Beam.bunchSpacing.get_Value(
                                ) / 2.
                                jobproperties.TileRecFlags.TimeMinForAmpCorrection = -halfBS
                                jobproperties.TileRecFlags.TimeMaxForAmpCorrection = halfBS
                            if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                            ) > jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                            ):
                                theTileCellBuilder.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                                )
                                theTileCellBuilder.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                                )

                    theCaloCellMaker += theTileCellBuilder
                    theCaloCellMaker.CaloCellMakerToolNames += [
                        theTileCellBuilder
                    ]
                except Exception:
                    mlog.error("could not get handle to TileCellBuilder Quit")
                    print(traceback.format_exc())
                    return False

        if doFastCaloSim:
            mlog.info('configuring FastCaloSim here')

            try:
                from FastCaloSim.FastCaloSimConf import EmptyCellBuilderTool
                theEmptyCellBuilderTool = EmptyCellBuilderTool()
                theCaloCellMaker += theEmptyCellBuilderTool
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theEmptyCellBuilderTool
                ]

                print(theEmptyCellBuilderTool)
                mlog.info("configure EmptyCellBuilderTool worked")
            except Exception:
                mlog.error("could not get handle to EmptyCellBuilderTool Quit")
                print(traceback.format_exc())
                return False

            try:
                from FastCaloSim.FastCaloSimFactory import FastCaloSimFactory
                theFastShowerCellBuilderTool = FastCaloSimFactory()

                theCaloCellMaker += theFastShowerCellBuilderTool
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theFastShowerCellBuilderTool
                ]
                mlog.info("configure FastShowerCellBuilderTool worked")
            except Exception:
                mlog.error(
                    "could not get handle to FastShowerCellBuilderTool Quit")
                print(traceback.format_exc())
                return False

            doFastCaloSimNoise = jobproperties.CaloCellFlags.doFastCaloSimNoise(
            )
            if doFastCaloSimNoise:
                try:
                    from FastCaloSim.AddNoiseCellBuilderToolDefault import AddNoiseCellBuilderToolDefault
                    theAddNoiseCellBuilderTool = AddNoiseCellBuilderToolDefault(
                    )

                    print(theAddNoiseCellBuilderTool)

                    theCaloCellMaker += theAddNoiseCellBuilderTool
                    theCaloCellMaker.CaloCellMakerToolNames += [
                        theAddNoiseCellBuilderTool
                    ]
                    mlog.info("configure AddNoiseCellBuilderTool worked")
                except Exception:
                    mlog.error(
                        "could not get handle to AddNoiseCellBuilderTool Quit")
                    print(traceback.format_exc())
                    return False

        #
        # CaloCellContainerFinalizerTool : closing container and setting up iterators
        #

        from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool
        theCaloCellContainerFinalizerTool = CaloCellContainerFinalizerTool()
        theCaloCellMaker += theCaloCellContainerFinalizerTool
        theCaloCellMaker.CaloCellMakerToolNames += [
            theCaloCellContainerFinalizerTool
        ]

        #
        # Mergeing of calo cellcontainer with sparse raw channel container with improved energies
        #

        doLArMerge = False
        if globalflags.DataSource(
        ) == 'data' and jobproperties.CaloCellFlags.doLArRawChannelMerge.statusOn and jobproperties.CaloCellFlags.doLArRawChannelMerge(
        ):
            from LArROD.LArRODFlags import larRODFlags
            if larRODFlags.readDigits() and larRODFlags.keepDSPRaw():
                doLArMerge = True
        if doLArMerge:
            try:
                from LArCellRec.LArCellRecConf import LArCellMerger
                theLArCellMerger = LArCellMerger()
            except Exception:
                mlog.error("could not get handle to LArCellMerge Quit")
                print(traceback.format_exc())
                return False
            theLArCellMerger.RawChannelsName = larRODFlags.RawChannelFromDigitsContainerName(
            )
            theCaloCellMaker += theLArCellMerger
            theCaloCellMaker.CaloCellMakerToolNames += [theLArCellMerger]

        #
        # masking of noisy and sporadic noisy cells in LAr
        #

        doNoiseMask = False
        if jobproperties.CaloCellFlags.doLArNoiseMasking.statusOn and jobproperties.CaloCellFlags.doLArNoiseMasking(
        ):
            doNoiseMask = True
        doSporadicMask = False
        if jobproperties.CaloCellFlags.doLArSporadicMasking.statusOn and jobproperties.CaloCellFlags.doLArSporadicMasking(
        ):
            doSporadicMask = True

        if doNoiseMask or doSporadicMask:
            try:
                from LArCellRec.LArCellRecConf import LArCellNoiseMaskingTool
                theLArCellNoiseMaskingTool = LArCellNoiseMaskingTool()
            except Exception:
                mlog.error(
                    "could not get handle to LArCellNoiseMaskingTool Quit")
                print(traceback.format_exc())
                return False

            if doSporadicMask:
                try:
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArSporadicNoiseMasker = LArBadChannelMasker(
                        "LArSporadicNoiseMasker")
                except Exception:
                    mlog.error("could not access bad channel tool Quit")
                    print(traceback.format_exc())
                    return False
                theLArSporadicNoiseMasker.DoMasking = True
                theLArSporadicNoiseMasker.ProblemsToMask = [
                    "sporadicBurstNoise"
                ]
                #ToolSvc += theLArSporadicNoiseMasker
                theLArCellNoiseMaskingTool.MaskingSporadicTool = theLArSporadicNoiseMasker

            if doNoiseMask:
                try:
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArNoiseMasker = LArBadChannelMasker("LArNoiseMasker")
                except Exception:
                    mlog.error("could not access bad channel tool Quit")
                    print(traceback.format_exc())
                    return False
                theLArNoiseMasker.DoMasking = True
                theLArNoiseMasker.ProblemsToMask = [
                    "highNoiseHG", "highNoiseMG", "highNoiseLG", "deadReadout",
                    "deadPhys"
                ]
                #ToolSvc+=theLArNoiseMasker
                theLArCellNoiseMaskingTool.MaskingTool = theLArNoiseMasker

            theLArCellNoiseMaskingTool.maskNoise = doNoiseMask
            theLArCellNoiseMaskingTool.maskSporadic = doSporadicMask
            # quality cut for sporadic noise masking
            theLArCellNoiseMaskingTool.qualityCut = 4000
            theCaloCellMaker += theLArCellNoiseMaskingTool
            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArCellNoiseMaskingTool
            ]

        #
        #  masking of Feb problems
        #
        doBadFebMasking = False
        if jobproperties.CaloCellFlags.doLArBadFebMasking.statusOn and jobproperties.CaloCellFlags.doLArBadFebMasking(
        ):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'data':
                doBadFebMasking = True

        if doBadFebMasking:
            try:
                from LArCellRec.LArCellRecConf import LArBadFebMaskingTool
                theLArBadFebMaskingTool = LArBadFebMaskingTool()
                if (
                        rec.doExpressProcessing()
                        or athenaCommonFlags.isOnline()
                ):  # In online or express processing, EventInfo::LArError is triggered if >=4 FEB with data corrupted
                    theLArBadFebMaskingTool.minFebInError = 4
            except Exception:
                mlog.error("could not get handle to LArBadFebMaskingTool Quit")
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theLArBadFebMaskingTool

            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArBadFebMaskingTool
            ]

        #
        #  emulate gain pathologies on MC
        #
        doGainPathology = False
        if jobproperties.CaloCellFlags.doLArCellGainPathology.statusOn and jobproperties.CaloCellFlags.doLArCellGainPathology(
        ):
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'geant4':
                doGainPathology = True

        if doGainPathology:
            try:
                from LArCellRec.LArCellRecConf import LArCellGainPathology
                theLArCellGainPathology = LArCellGainPathology()
            except Exception:
                mlog.error("could not get handle to LArCellGainPatholog< Quit")
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theLArCellGainPathology

            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArCellGainPathology
            ]

        # lar miscalibration if MC only  (should be done after finalisation)

        if not jobproperties.CaloCellFlags.doLArCellEmMisCalib.statusOn:
            # the flag has not been set, so decide a reasonable default
            # this is the old global flags should use the new one as
            # soon as monitoring does
            from AthenaCommon.GlobalFlags import globalflags
            if globalflags.DataSource() == 'data':
                doLArCellEmMisCalib = False
                mlog.info(
                    "jobproperties.CaloCellFlags.doLArMisCalib not set and real data: do not apply LArCellEmMisCalibTool"
                )
            else:
                doLArCellEmMisCalib = True
                mlog.info(
                    "jobproperties.CaloCellFlags.doLArMisCalib not set and Monte Carlo: apply LArCellEmMisCalibTool"
                )
        else:
            doLArCellEmMisCalib = jobproperties.CaloCellFlags.doLArCellEmMisCalib(
            )
            if doLArCellEmMisCalib:
                mlog.info("LArCellEmMisCalibTool requested")
            else:
                mlog.info("LArCellEmMisCalibTool explicitly not requested")

        if doLArCellEmMisCalib:
            try:
                from LArCellRec.LArCellRecConf import LArCellEmMiscalib
                theLArCellEmMiscalib = LArCellEmMiscalib("LArCellEmMiscalib")
            except Exception:
                mlog.error("could not get handle to LArCellEmMisCalib Quit")
                print(traceback.format_exc())
                return False

            # examples on how to change miscalibration. Default values are 0.005 and 0.007
            #        theLArCellEmMiscalib.SigmaPerRegion = 0.005
            #        theLArCellEmMiscalib.SigmaPerCell = 0.005

            try:
                from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloIdentifier import SUBCALO
                theMisCalibTool = CaloCellContainerCorrectorTool(
                    "MisCalibTool",
                    CaloNums=[SUBCALO.LAREM],
                    CellCorrectionToolNames=[theLArCellEmMiscalib])
            except Exception:
                mlog.error("could not get handle to MisCalibTool Quit")
                print(traceback.format_exc())
                return False

            theCaloCellMaker += theMisCalibTool
            theCaloCellMaker.CaloCellMakerToolNames += [theMisCalibTool]

        #
        # Pedestal shift correction
        #
        doPedestalCorr = False
        if jobproperties.CaloCellFlags.doPedestalCorr.statusOn:
            from AthenaCommon.GlobalFlags import globalflags
            if jobproperties.CaloCellFlags.doPedestalCorr() and (
                    globalflags.DataSource() == 'data'
                    or jobproperties.CaloCellFlags.doPileupOffsetBCIDCorr):
                doPedestalCorr = True
                mlog.info("Apply cell level pedestal shift correction")

        if doPedestalCorr:
            try:
                from CaloCellCorrection.CaloCellPedestalCorrDefault import CaloCellPedestalCorrDefault
                theCaloCellPedestalCorr = CaloCellPedestalCorrDefault()
                theCaloCellMaker += theCaloCellPedestalCorr
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theCaloCellPedestalCorr
                ]
            except Exception:
                mlog.error("could not get handle to CaloCellPedestalCorr")
                print(traceback.format_exc())

        #
        # HV correction for offline reprocessing, reading HV from Cool-DCS database
        #
        doHVCorr = False
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.dcs.LAr_on():
            if jobproperties.CaloCellFlags.doLArHVCorr.statusOn:
                from AthenaCommon.GlobalFlags import globalflags
                if jobproperties.CaloCellFlags.doLArHVCorr(
                ) and globalflags.DataSource() == 'data':
                    doHVCorr = True
                    mlog.info(
                        "Redoing HV correction at cell level from COOL/DCS database"
                    )

        if doHVCorr:
            from LArCellRec.LArCellRecConf import LArCellContHVCorrTool
            theLArCellHVCorrTool = LArCellContHVCorrTool()

            #theCaloCellMaker += theHVCorrTool
            theCaloCellMaker.CaloCellMakerToolNames += [theLArCellHVCorrTool]

        #
        # correction to undo online calibration and apply new LAr electronics calibration for ADC->MeV conversion
        #
        doLArRecalibration = False
        if jobproperties.CaloCellFlags.doLArRecalibration.statusOn:
            from AthenaCommon.GlobalFlags import globalflags
            from LArConditionsCommon.LArCondFlags import larCondFlags
            if jobproperties.CaloCellFlags.doLArRecalibration(
            ) and globalflags.DataSource() == 'data' and (
                    not larCondFlags.SingleVersion()):
                doLArRecalibration = True
                mlog.info("Redoing LAr electronics calibration for ADC->MeV")

        if doLArRecalibration:

            # get tool for cell recalibration
            try:
                from LArCellRec.LArCellRecConf import LArCellRecalibration
                theLArCellRecalibration = LArCellRecalibration(
                    "LArCellRecalibration")
            except Exception:
                mlog.error("could not get handle to LArCellRecalibration Quit")
                print(traceback.format_exc())
                return False

            # get new ADC2MeVTool
            try:
                from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
                theLArADC2MeVToolDefault = LArADC2MeVToolDefault()
            except Exception:
                mlog.error(
                    "Could not get handle to LArADC2MeVToolDefault Quit")
                print(traceback.format_exc())
                return False
            ToolSvc += theLArADC2MeVToolDefault

            # get old  ADC2MeVTool
            try:
                from LArRecUtils.LArADC2MeVToolOnline import LArADC2MeVToolOnline
                theLArADC2MeVToolOnline = LArADC2MeVToolOnline()
            except Exception:
                mlog.error("Could not get handle to LArADC2MeVToolOnline Quit")
                print(traceback.format_exc())
                return False
            ToolSvc += theLArADC2MeVToolOnline

            theLArCellRecalibration.adc2MeVTool = theLArADC2MeVToolDefault
            theLArCellRecalibration.adc2MeVToolOnline = theLArADC2MeVToolOnline

            try:
                from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloIdentifier import SUBCALO
                theLArRecalibrationTool = CaloCellContainerCorrectorTool(
                    "LArRecalibrationTool",
                    CaloNums=[SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.LARFCAL],
                    CellCorrectionToolNames=[theLArCellRecalibration])
            except Exception:
                mlog.error("could not get handle to HVCorrTool Quit")
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theLArRecalibrationTool
            theCaloCellMaker.CaloCellMakerToolNames += [
                theLArRecalibrationTool
            ]

        #
        # Correction for MinBias energy shift for MC pileup reco
        #
        doMinBiasAverage = False
        if jobproperties.CaloCellFlags.doMinBiasAverage.statusOn:
            from AthenaCommon.GlobalFlags import globalflags
            from AthenaCommon.BeamFlags import jobproperties
            if jobproperties.CaloCellFlags.doMinBiasAverage(
            ) and globalflags.DataSource() == 'geant4' and (
                    not jobproperties.Beam.zeroLuminosity()):
                doMinBiasAverage = True

        if doMinBiasAverage:

            try:
                from CaloTools.CaloMBAverageToolDefault import CaloMBAverageToolDefault
                theCaloMBAverageTool = CaloMBAverageToolDefault()
            except Exception:
                mlog.error("could not get handle to CaloMBAverageTool  Quit")
                print(traceback.format_exc())
                return False
            ToolSvc += theCaloMBAverageTool

            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellMBAverageCorr
                theCaloCellMBAverageCorr = CaloCellMBAverageCorr(
                    "CaloCellMBAverageCorr")
                theCaloCellMBAverageCorr.CaloMBAverageTool = theCaloMBAverageTool
            except Exception:
                mlog.error(
                    "could not get handle to  CaloCellMBAverageCorr  Quit")
                print(traceback.format_exc())
                return False

            try:
                from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloIdentifier import SUBCALO
                theMBAverageTool = CaloCellContainerCorrectorTool(
                    "MBAverageTool",
                    CaloNums=[SUBCALO.NSUBCALO],
                    CellCorrectionToolNames=[theCaloCellMBAverageCorr])
            except Exception:
                mlog.error(
                    "could not get handle to CaloCellContainerCorrectorTool/MBAverageTool Quit"
                )
                print(traceback.format_exc())
                return False

            theCaloCellMaker += theMBAverageTool
            theCaloCellMaker.CaloCellMakerToolNames += [theMBAverageTool]

        #
        # Correction for dead cells, where we average the energy density of neighbor cells
        #
        doNeighborsAverage = False
        if jobproperties.CaloCellFlags.doDeadCellCorr.statusOn:
            if jobproperties.CaloCellFlags.doDeadCellCorr():
                doNeighborsAverage = True

        if doNeighborsAverage:
            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellNeighborsAverageCorr
                theCaloCellNeighborsAverageCorr = CaloCellNeighborsAverageCorr(
                    "CaloCellNeighborsAverageCorr")
                theCaloCellNeighborsAverageCorr.testMode = False
            except Exception:
                mlog.error(
                    "could not get handle to  CaloCellNeighborsAverageCorr  Quit"
                )
                print(traceback.format_exc())
                return False
            theCaloCellMaker += theCaloCellNeighborsAverageCorr
            theCaloCellMaker.CaloCellMakerToolNames += [
                theCaloCellNeighborsAverageCorr
            ]

        #
        # correction for missing Febs based on L1 readout
        doLArDeadOTXCorr = False
        if jobproperties.CaloCellFlags.doLArDeadOTXCorr.statusOn and jobproperties.CaloCellFlags.doLArCreateMissingCells.statusOn:
            if jobproperties.CaloCellFlags.doLArDeadOTXCorr(
            ) and jobproperties.CaloCellFlags.doLArCreateMissingCells(
            ) and doStandardCellReconstruction:
                if rec.doTrigger():
                    doLArDeadOTXCorr = True
                else:
                    if globalflags.DataSource.get_Value(
                    ) != 'geant4':  #warning only if not MC
                        mlog.warning(
                            "Trigger is switched off. Can't run deadOTX correction."
                        )

        if doLArDeadOTXCorr:

            try:
                from LArCellRec.LArCellDeadOTXCorrToolDefault import LArCellDeadOTXCorrToolDefault
                theLArCellDeadOTXCorr = LArCellDeadOTXCorrToolDefault()
            except Exception:
                mlog.error("could not get handle to LArCellDeadOTXCorr Quit")
                print(traceback.format_exc())

            theCaloCellMaker += theLArCellDeadOTXCorr
            theCaloCellMaker.CaloCellMakerToolNames += [theLArCellDeadOTXCorr]

        if jobproperties.CaloCellFlags.doCaloCellEnergyCorr(
        ) and globalflags.DataSource(
        ) == 'data' and not athenaCommonFlags.isOnline():

            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellEnergyRescaler
                theCCERescalerTool = CaloCellEnergyRescaler()
                theCCERescalerTool.Folder = "/LAR/CellCorrOfl/EnergyCorr"
                from IOVDbSvc.CondDB import conddb
                # conddb.addFolder("","/LAR/CellCorrOfl/EnergyCorr<tag>EnergyScale-00</tag><db>sqlite://;schema=escale.db;dbname=COMP200</db>")
                conddb.addFolder("LAR_OFL",
                                 "/LAR/CellCorrOfl/EnergyCorr",
                                 className="AthenaAttributeList")
                theCaloCellMaker += theCCERescalerTool
                theCaloCellMaker.CaloCellMakerToolNames += [theCCERescalerTool]
            except Exception:
                mlog.error(
                    "could not get handle to CaloCellEnergyRescaler Quit")
                print(traceback.format_exc())
                return False
            pass

        if jobproperties.CaloCellFlags.doCaloCellTimeCorr(
        ) and globalflags.DataSource(
        ) == 'data' and not athenaCommonFlags.isOnline():
            try:
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellTimeCorrTool
                theLArTimeCorr = CaloCellTimeCorrTool()
                theLArTimeCorr.Folder = "/LAR/TimeCorrectionOfl/CellTimeOffset"
                from IOVDbSvc.CondDB import conddb
                # conddb.addFolder("","/LAR/TimeCorrectionOfl/CellTimeOffset<tag>LARTimeCorrectionOflCellTimeOffset-empty</tag><db>sqlite://;schema=timecorr.db;dbname=COMP200</db>")
                conddb.addFolder("LAR_OFL",
                                 "/LAR/TimeCorrectionOfl/CellTimeOffset",
                                 className="AthenaAttributeList")
                theCaloCellMaker.CaloCellMakerToolNames += [theLArTimeCorr]

            except Exception:
                mlog.error("could not get handle to CaloCellTimeCorrTool Quit")
                print(traceback.format_exc())
                return False

            pass

        # make lots of checks (should not be necessary eventually)
        # to print the check add:

        from CaloRec.CaloRecConf import CaloCellContainerCheckerTool
        theCaloCellContainerCheckerTool = CaloCellContainerCheckerTool()
        # FIXME
        # theCaloCellContainerCheckerTool.OutputLevel=DEBUG

        theCaloCellMaker += theCaloCellContainerCheckerTool
        theCaloCellMaker.CaloCellMakerToolNames += [
            theCaloCellContainerCheckerTool
        ]

        #

        # sets output key
        theCaloCellMaker.CaloCellsOutputName = self.outputKey()

        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addStreamESD(self.outputType(), self.outputKey())

        # Also note that we produce it as a transient output.
        objKeyStore.addTransient(self.outputType(), self.outputKey())

        from TileRecUtils.TileDQstatusAlgDefault import TileDQstatusAlgDefault
        TileDQstatusAlgDefault(TileRawChannelContainer=rawChannelContainer)

        # now add algorithm to topSequence
        # this should always come at the end

        mlog.info(" now adding CaloCellMaker to topSequence")

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence += theCaloCellMaker

        return True
コード例 #16
0
def getSCT_FrontEnd(name="SCT_FrontEnd", **kwargs):
    from Digitization.DigitizationFlags import digitizationFlags
    #Setup noise treament in SCT_FrontEnd
    # To set the mean noise values for the different module types
    # Default values set at 0 degrees, plus/minus ~5 enc per plus/minus degree
    kwargs.setdefault("NoiseBarrel", 1500.0)
    kwargs.setdefault("NoiseBarrel3", 1541.0)
    kwargs.setdefault("NoiseInners", 1090.0)
    kwargs.setdefault("NoiseMiddles", 1557.0)
    kwargs.setdefault("NoiseShortMiddles", 940.0)
    kwargs.setdefault("NoiseOuters", 1618.0)
    kwargs.setdefault("NOBarrel", 1.5e-5)
    kwargs.setdefault("NOBarrel3", 2.1e-5)
    kwargs.setdefault("NOInners", 5.0e-9)
    kwargs.setdefault("NOMiddles", 2.7e-5)
    kwargs.setdefault("NOShortMiddles", 2.0e-9)
    kwargs.setdefault("NOOuters", 3.5e-5)
    # If noise is turned off:
    if not digitizationFlags.doInDetNoise.get_Value():
        ###kwargs.setdefault("OnlyHitElements", True)
        print 'SCT_Digitization:::: Turned off Noise in SCT_FrontEnd'
        kwargs.setdefault("NoiseOn", False)
        kwargs.setdefault("AnalogueNoiseOn", False)
    else:
        kwargs.setdefault("NoiseOn", True)
        kwargs.setdefault("AnalogueNoiseOn", True)
    # In overlay MC, only analogue noise is on. Noise hits are not added.
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.isOverlay() and globalflags.DataSource == 'geant4':
        kwargs["NoiseOn"] = False
        kwargs["AnalogueNoiseOn"] = True
    # Use Calibration data from Conditions DB, still for testing purposes only
    kwargs.setdefault("UseCalibData", True)
    # Setup the ReadCalibChip folders and Svc
    from IOVDbSvc.CondDB import conddb
    if not conddb.folderRequested('/SCT/DAQ/Calibration/ChipGain'):
        conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Calibration/ChipGain",
                                "/SCT/DAQ/Calibration/ChipGain")
    if not conddb.folderRequested('/SCT/DAQ/Calibration/ChipNoise'):
        conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Calibration/ChipNoise",
                                "/SCT/DAQ/Calibration/ChipNoise")
    from AthenaCommon.AppMgr import ServiceMgr
    if not hasattr(ServiceMgr, "InDetSCT_ReadCalibChipDataSvc"):
        from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibChipDataSvc
        InDetSCT_ReadCalibChipDataSvc = SCT_ReadCalibChipDataSvc(
            name="InDetSCT_ReadCalibChipDataSvc")
        ServiceMgr += InDetSCT_ReadCalibChipDataSvc
    # DataCompressionMode: 1 is level mode x1x (default), 2 is edge mode 01x, 3 is expanded any hit xxx
    from AthenaCommon.BeamFlags import jobproperties
    if digitizationFlags.PileUpPremixing:
        kwargs.setdefault("DataCompressionMode", 3)
    elif globalflags.isOverlay() and globalflags.DataSource == 'geant4':
        kwargs.setdefault("DataCompressionMode", 2)
    elif (jobproperties.Beam.bunchSpacing() <= 50):
        kwargs.setdefault("DataCompressionMode", 1)
    else:
        kwargs.setdefault("DataCompressionMode", 3)
    # DataReadOutMode: 0 is condensed mode and 1 is expanded mode
    if globalflags.isOverlay() and globalflags.DataSource == 'geant4':
        kwargs.setdefault("DataReadOutMode", 0)
    else:
        kwargs.setdefault("DataReadOutMode", 1)
    from SCT_Digitization.SCT_DigitizationConf import SCT_FrontEnd
    return SCT_FrontEnd(name, **kwargs)
コード例 #17
0
def getSCT_SurfaceChargesGenerator(name="SCT_SurfaceChargesGenerator",
                                   **kwargs):
    ## Set up services used by SCT_SurfaceChargesGenerator
    ## TODO remove all this stuff and see if PixelDigitization works without it.
    # Setup the DCS folders and Svc used in the sctSiliconConditionsSvc
    from IOVDbSvc.CondDB import conddb
    if not conddb.folderRequested('/SCT/DCS/CHANSTAT'):
        conddb.addFolder("DCS_OFL", "/SCT/DCS/CHANSTAT")
    if not conddb.folderRequested('/SCT/DCS/MODTEMP'):
        conddb.addFolder("DCS_OFL", "/SCT/DCS/MODTEMP")
    if not conddb.folderRequested('/SCT/DCS/HV'):
        conddb.addFolder("DCS_OFL", "/SCT/DCS/HV")
    ## SCT_DCSConditionsSvc - used by SCT_SurfaceChargesGenerator
    from AthenaCommon.AppMgr import ServiceMgr
    if not hasattr(ServiceMgr, "InDetSCT_DCSConditionsSvc"):
        from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_DCSConditionsSvc
        InDetSCT_DCSConditionsSvc = SCT_DCSConditionsSvc(
            name="InDetSCT_DCSConditionsSvc")
        ServiceMgr += InDetSCT_DCSConditionsSvc
    ## SCT_SiPropertiesSvc - used by SCT_SurfaceChargesGenerator
    if not hasattr(ServiceMgr, "SCT_SiPropertiesSvc"):
        # Lorentz Angle Service
        from SiLorentzAngleSvc.LorentzAngleSvcSetup import lorentzAngleSvc
        # Silicon conditions service (set up by LorentzAngleSvcSetup)
        sctSiliconConditionsSvc = ServiceMgr.SCT_SiliconConditionsSvc
        # Silicon properties service
        from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc
        sctSiPropertiesSvc = SiPropertiesSvc(
            name="SCT_SiPropertiesSvc",
            DetectorName="SCT",
            SiConditionsServices=sctSiliconConditionsSvc)
        ServiceMgr += sctSiPropertiesSvc
    ## Charge trapping service - used by SCT_SurfaceChargesGenerator
    if not hasattr(ServiceMgr, "InDetSCT_RadDamageSummarySvc"):
        from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_RadDamageSummarySvc
        InDetSCT_RadDamageSummarySvc = SCT_RadDamageSummarySvc(
            name="InDetSCT_RadDamageSummarySvc")
        ServiceMgr += InDetSCT_RadDamageSummarySvc
    ## END OF JUNK

    kwargs.setdefault("FixedTime", -999)
    kwargs.setdefault("SubtractTime", -999)
    kwargs.setdefault("SurfaceDriftTime", 10)
    kwargs.setdefault("NumberOfCharges", 1)
    kwargs.setdefault("SmallStepLength", 5)
    kwargs.setdefault("DepletionVoltage", 70)
    kwargs.setdefault("BiasVoltage", 150)
    from AthenaCommon.GlobalFlags import globalflags
    kwargs.setdefault("isOverlay", globalflags.isOverlay())

    from Digitization.DigitizationFlags import digitizationFlags
    if 'doDetailedSurfChargesGen' in digitizationFlags.experimentalDigi():
        kwargs.setdefault("ChargeDriftModel", 1)
        kwargs.setdefault("EFieldModel", 2)
        kwargs.setdefault("MagneticField", -2.0)
        kwargs.setdefault("SensorTemperature", 273.15)
        kwargs.setdefault("TransportTimeStep", 0.25)
        kwargs.setdefault("TransportTimeMax", 25.0)
        from SCT_Digitization.SCT_DigitizationConf import SCT_DetailedSurfaceChargesGenerator
        return SCT_DetailedSurfaceChargesGenerator(name, **kwargs)
    else:
        from SCT_Digitization.SCT_DigitizationConf import SCT_SurfaceChargesGenerator
        return SCT_SurfaceChargesGenerator(name, **kwargs)
コード例 #18
0
    def setDefaults(self):
        # check on problematic global tags with no association of cabling map folders exist; in this case we use the old cabling
        problematic_tags_mdtrpc = [
            'COMCOND-00[0-6]', 'COMCOND-HLT[A-C]-00[0-1]',
            'COMCOND-MONC-00[0-1]', 'COMCOND-ES1C-00[0-1]',
            'COMCOND-REPC-00[0-4]', 'OFLCOND-CSC', 'OFLCOND-FDR'
        ]
        problematic_tags_tgc = [
            'COMCOND-00[0-5]', 'COMCOND-006-00', 'CMCCOND-CSC',
            'OFLCOND-FDR-02-0[4-6]', 'OFLCOND-FDR-02-10'
        ]

        # MDT
        #        if globalflags.InputFormat.is_bytestream() and globalflags.DataSource() == 'geant4':
        #            setDefault(self.MdtCablingMode, 'old')
        #        else:
        #            if any(re.match(tag,globalflags.ConditionsTag()) for tag in problematic_tags_mdtrpc):
        #                setDefault(self.MdtCablingMode, 'old')
        #            else:
        #                if globalflags.DataSource() == 'data' or DetFlags.digitize.MDT_on():
        #                    setDefault(self.MdtCablingMode, 'new')
        #                else:
        #                    setDefault(self.MdtCablingMode, 'auto')

        # RPC
        if globalflags.InputFormat.is_bytestream() and globalflags.DataSource(
        ) == 'geant4':
            setDefault(self.RpcCablingMode, 'sim')
        else:
            if any(
                    re.match(tag, globalflags.ConditionsTag())
                    for tag in problematic_tags_mdtrpc):
                setDefault(self.RpcCablingMode, 'old')
            else:
                if globalflags.DataSource(
                ) == 'data' or DetFlags.digitize.RPC_on():
                    setDefault(self.RpcCablingMode, 'new')
                else:
                    setDefault(self.RpcCablingMode, 'auto')


#        if globalflags.DataSource() == 'data':
#            # 2010Jan7th - move to new cabling also when the trigger (i.e. LVL1 emul. or HLT algorithms) is on
#            #if doTrigger==True  or any(re.match(tag,globalflags.ConditionsTag()) for tag in problematic_tags_mdtrpc):
#            if any(re.match(tag,globalflags.ConditionsTag()) for tag in problematic_tags_mdtrpc):
#                setDefault(self.RpcCablingMode, 'old')  # default is old when using trigger
##                if doTrigger:
##                    logMuon.info("RPC cabling: Setting to OLD because of trigger settings")
##                else:
#                logMuon.info("RPC cabling: Setting to OLD because of condition data tags not including RPC cabling maps")
#            else:
#                setDefault(self.RpcCablingMode, 'new')
#                logMuon.info("RPC cabling: Setting to NEW")
#        else:
#            setDefault(self.RpcCablingMode, 'sim')
#            logMuon.info("RPC cabling: Setting to SIM")

#TGC
        setDefault(self.TgcCablingMode, 'auto')

        # do not use the call-back for digitization job
        #use the call-back in the overlay job that has no bytestream data as input
        # and avoid access to Db for problematic tags

        if DetFlags.digitize.TGC_on() and not globalflags.isOverlay():
            if any(
                    re.match(tag, globalflags.ConditionsTag())
                    for tag in problematic_tags_tgc):
                setDefault(self.TgcCablingMode, 'old 12-fold')
            else:
                setDefault(self.TgcCablingMode, '12-fold')

        # avoid to use call-back if input is bytestream or data and avoid access to Db for problematic tags
        if globalflags.DataSource.is_data(
        ) or globalflags.InputFormat.is_bytestream():
            if any(
                    re.match(tag, globalflags.ConditionsTag())
                    for tag in problematic_tags_tgc):
                setDefault(self.TgcCablingMode, 'old 12-fold')
            else:
                setDefault(self.TgcCablingMode, '12-fold')

        # call-back works for RDO files only and avoid access to Db for problematic tags
        if self.TgcCablingMode() == 'auto' and not DetFlags.haveRDO.TGC_on():
            if any(
                    re.match(tag, globalflags.ConditionsTag())
                    for tag in problematic_tags_tgc):
                setDefault(self.TgcCablingMode, 'old 12-fold')
            else:
                setDefault(self.TgcCablingMode, '12-fold')
コード例 #19
0
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
from OverlayCommonAlgs.OverlayFlags import overlayFlags

from MuonRecExample.MuonRecFlags import muonRecFlags

muonRecFlags.doCSCs.set_Value_and_Lock(True)

from LArConditionsCommon.LArCondFlags import larCondFlags

larCondFlags.LArCoolChannelSelection.set_Value_and_Lock("")
larCondFlags.useShape.set_Value_and_Lock(True)
larCondFlags.OFCShapeFolder.set_Value_and_Lock("")

globalflags.isOverlay.set_Value_and_Lock(True)
isRealData = globalflags.isOverlay()

from AthenaCommon.BeamFlags import jobproperties

jobproperties.Beam.beamType.set_Value_and_Lock("collisions")

import AthenaCommon.AtlasUnixStandardJob

for cf in runArgs.jobConfig:
    include(cf)

#==============================================================
# Job definition parameters:
#==============================================================
from AthenaCommon.GlobalFlags import GlobalFlags
from AthenaCommon.GlobalFlags import globalflags
コード例 #20
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)