Example #1
0
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit

#=============================================================
#=== set global tag
#=============================================================
from IOVDbSvc.CondDB import conddb
if RUN2: conddb.setGlobalTag("CONDBR2-BLKPA-2015-09")
else: conddb.setGlobalTag("COMCOND-BLKPA-RUN1-06")

#========================================================
#from TileConditions.TileCoolMgr import tileCoolMgr
#========================================================
from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()
tileInfoConfigurator.setupCOOL()
tileInfoConfigurator.setupCOOLOFC()
tileInfoConfigurator.setupCOOLPHYPULSE()
tileInfoConfigurator.setupCOOLAutoCr()

#============================================================
#=== configure TileCondToolOfc
#============================================================
from TileConditions.TileConditionsConf import TileCondToolOfc
tileCondToolOfc = TileCondToolOfc()
tileCondToolOfc.nSamples = 7  # default = 7
tileCondToolOfc.OptFilterDeltaCorrelation = False  # False - use matrix from DB
tileCondToolOfc.CacheSize = 0  # (max phases per channel) 0 - no cache (default)
#tileCondToolOfc.OutputLevel = INFO
tileCondToolOfc.OutputLevel = DEBUG
Example #2
0
def CaloNoiseToolDefault(flag='',name='CaloNoiseToolDefault'):

    # check if tool already exists
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if hasattr(svcMgr.ToolSvc, name):
        # re-use previously configured (public) tool
        return getattr(svcMgr.ToolSvc, name)

    mlog = logging.getLogger( 'CaloNoiseToolDefault' )

    if flag=='db' :
       _useDB = True
    elif flag=='tool' :
       _useDB = False
    else :
       # will put here logic to select according to global flag
       from AthenaCommon.GlobalFlags import globalflags
       from AthenaCommon.BeamFlags import jobproperties
       if globalflags.DataSource()=='data' and globalflags.DetGeo()!='ctbh6' and globalflags.DetGeo()!='ctbh8':
           _useDB = True
       elif globalflags.DataSource()=='geant4' and jobproperties.Beam.zeroLuminosity():
           _useDB = True
       else:
          # now uses also calonoisetoolDB for MC with pileup.. requires a new global tag for pileup reco to have the noise properly read
           _useDB = True

    if _useDB :
        mlog.info(" Using CaloNoiseToolDB" )
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource()=='data':
            from CaloTools.CaloNoiseToolDBData import CaloNoiseToolDBData
            theTool = CaloNoiseToolDBData(name)
        else:
            from CaloTools.CaloNoiseToolDBMC import CaloNoiseToolDBMC
            theTool = CaloNoiseToolDBMC(name)
        return theTool
    else :
        mlog.info("Using CaloNoiseTool")
        from CaloTools.CaloToolsConf import CaloNoiseTool
        # Tile configuration
        from AthenaCommon.DetFlags      import DetFlags
        if DetFlags.Tile_on():
            from TileConditions.TileInfoConfigurator import TileInfoConfigurator
            tileInfoConfigurator = TileInfoConfigurator()
            tileInfoConfigurator.setupCOOL()
            UseTile = True
        else:
            UseTile = False
        
        # CaloNoiseTool configuration
        WorkMode=1
        WithOF=True
        TileInfoName="TileInfo"
        # get public tool LArADC2MeVTool
        from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
        theADC2MeVTool = LArADC2MeVToolDefault()
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += theADC2MeVTool
        # get public tool LArOFCTool
        from LArRecUtils.LArOFCToolDefault import LArOFCToolDefault
        theOFCTool = LArOFCToolDefault()
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += theOFCTool
        from AthenaCommon.BeamFlags import jobproperties
        if jobproperties.Beam.zeroLuminosity(): 
            ReturnNoise="electronicNoise"
            NMinBias=0
            deltaBunch=1
        else:
            ReturnNoise="totalNoise"
            NMinBias=jobproperties.Beam.numberOfCollisions()
            deltaBunch=int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5)
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource()=='data':
            IsMC = False
            UseSymmetry= False
        else:
            IsMC = True
            UseSymmetry= True

        from LArROD.LArRODFlags import larRODFlags
        theTool = CaloNoiseTool(name,
                          WorkMode = WorkMode,
                          WithOF = WithOF,
                          UseTile = UseTile,
                          TileInfoName = TileInfoName,
                          LArADC2MeVTool = theADC2MeVTool,
                          LArOFCTool = theOFCTool,
                          ReturnNoise = ReturnNoise,
                          NMinBias = NMinBias,
                          deltaBunch = deltaBunch,
                          IsMC = IsMC,
                          UseSymmetry = UseSymmetry,
                          firstSample=larRODFlags.firstSample())
        return theTool
Example #3
0
from AthenaCommon.AppMgr import ToolSvc  #if not already imported
from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool, LArBadChannelMasker

ToolSvc += LArBadChanTool("MyBadChanTool")
ToolSvc.MyBadChanTool.ReadFromASCII = False  #Not necessary if you have already produced a database file
ToolSvc.MyBadChanTool.ComplementaryCoolFolder = "/LAR/BadChannels/BadChannelsOnl"
#ToolSvc.MyBadChanTool.OutputLevel=VERBOSE
#ToolSvc.MyBadChanTool.OutputLevel=DEBUG

#The masker tool name must be "LArBadChannelMasker", the same as retrieved in LArCellCont.cxx
ToolSvc += LArBadChannelMasker("LArBadChannelMasker")
ToolSvc.LArBadChannelMasker.ProblemsToMask = [
    "unstable", "short", "highNoiseHG", "highNoiseMG", "highNoiseLG",
    "problematicForUnknownReason"
]  #See LArBadChanBitPacking.cxx for the list of strings that can be used.
ToolSvc.LArBadChannelMasker.DoMasking = True  #Masking can easily be turned on and off here.
#ToolSvc.LArBadChannelMasker.OutputLevel=DEBUG
ToolSvc.LArBadChannelMasker.TheLArBadChanTool = ToolSvc.MyBadChanTool  #Tell the Masker to use the LArBadChanTool that was just configured.

#IOVDbSvc=theApp.service('IOVDbSvc')
#if ( svcMgr.IOVDbSvc.GlobalTag!="COMCOND-002-00" and svcMgr.IOVDbSvc.GlobalTag!="COMCOND-003-00" and svcMgr.IOVDbSvc.GlobalTag!="COMCOND-004-00" and svcMgr.IOVDbSvc.GlobalTag!="COMCOND-005-00" ):
#else:
if not conddb.folderRequested('/LAR/BadChannels/BadChannels'):
    conddb.addFolder(LArDB, "/LAR/BadChannels/BadChannels")
conddb.addFolder(LArDB, "/LAR/BadChannels/BadChannelsOnl")

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tIC = TileInfoConfigurator()
tIC.setupCOOL()
Example #4
0
            or ('TileRampRun' in dir()) and (TileRampRun)):
        TilePulse = "CIS"
    elif ('TileLasRun' in dir()) and (TileLasRun):
        TilePulse = "LAS"
        if ('TilePhysTiming' in dir()) and (TilePhysTiming):
            TileGapTiming = "GAP"
    else:
        TilePulse = "PHY"
    if not 'TileUseCOOLOFC' in dir():
        TileUseCOOLOFC = True
        # read OFC from COOL
    if not 'TileUseCOOLPULSE' in dir() or not TileUseCOOLOFC:
        TileUseCOOLPULSE = True
        # read pulse from COOL

    tileInfoConfigurator.setupCOOL(type=(TileGapTiming + TilePulse))

    if TileUseDCS:
        tileInfoConfigurator.setupCOOLDCS()
else:
    msg.warning("COOL is not used for TileCal conditions data")
    TileUseCOOLOFC = False
    tileInfoConfigurator.setupCOOLPHYPULSE()
    tileInfoConfigurator.setupCOOLAutoCr()

    from AthenaCommon.AppMgr import ToolSvc
    from TileConditions.TileCondProxyConf import getTileCondProxy
    from TileConditions.TileConditionsConf import TileBadChanTool

    if not 'TileBchList' in dir():
        TileBchList = 'TileNoBad.oflBch'