示例#1
0
def CaloEstimatedGainToolDefault():
    from LArCabling.LArCablingAccess import LArFebRodMapping, LArCalibIdMapping
    LArFebRodMapping()
    LArCalibIdMapping()

    from TileConditions.TileInfoConfigurator import TileInfoConfigurator
    TileInfoConfigurator()

    from TileConditions.TileCondToolConf import \
        getTileCondToolEmscale, \
        getTileCondToolNoiseSample
    from TileConditions.TileConditionsConf import TileCondIdTransforms

    from LArRecUtils.LArADC2MeVCondAlgDefault import LArADC2MeVCondAlgDefault
    adc2mev = LArADC2MeVCondAlgDefault()

    from CaloTools.CaloToolsConf import CaloEstimatedGainTool
    tool = CaloEstimatedGainTool ('CaloEstimatedGainTool',
                                  ADC2MeVKey = adc2mev.LArADC2MeVKey,
                                  TileCondIdTransforms = TileCondIdTransforms(),
                                  TileCondToolEmscale = getTileCondToolEmscale(),
                                  TileCondToolNoiseSample = getTileCondToolNoiseSample())
    return tool
示例#2
0
theTileTBOldNtupleWrite = TileTBOldNtupleWrite()
theTileTBOldNtupleWrite.NtupleID = "h1000"
theTileTBOldNtupleWrite.NtupleDir = OutputDirectory
theTileTBOldNtupleWrite.PmtOrder = TilePmtOrder
theTileTBOldNtupleWrite.CalibrateEnergy = TileCalibrateEnergy

topSequence += theTileTBOldNtupleWrite

print topSequence

#=============================================================
#=== setup TileConditions
#=============================================================
from TileConditions.TileInfoConfigurator import TileInfoConfigurator

tileInfoConfigurator = TileInfoConfigurator()
tileInfoConfigurator.OutputLevel = 3

#=== set different CIS and Cesium ASCII file names for different run periods

run = str(RunNumber / 10000) + "0000"
while len(run) < 7:
    run = '0' + run
CisLookup = "Tile2004.lut"
CisLinear = "Tile" + run + ".cis"
CesiumFile = "Tile" + run + ".ces"

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

ToolSvc.TileCondToolEmscale.ProxyOflCisLin = getTileCondProxy(
示例#3
0
        if (vp1Fatras and vp1FatrasTruthKey != ""):
            from FatrasExample.FatrasKeys import FatrasKeyFlags
            FatrasKeyFlags.InputMcEventCollection.set_Value(vp1FatrasTruthKey)

    if (vp1Trig):
        from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
        TriggerConfigGetter("ReadPool")

    if (vp1Calo):
        from LArConditionsCommon import LArAlignable

        #
        # Following is needed to display Tile Pulse shapes on ESD files
        #
        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()

    if (vp1Muon):
        include("AmdcAth/AmdcAth_jobOptions.py")

    include("PartPropSvc/PartPropSvc.py")

    if (vp1NoAutoConf):
        svcMgr.EventSelector.InputCollections = vp1InputFiles
    else:
        svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()

    if 'skipEvents' in dir():
        svcMgr.EventSelector.SkipEvents = skipEvents
else:
    vp1Extrapolator = False
示例#4
0
else: jobproperties.Global.DetDescrVersion = "ATLAS-GEO-20-00-02"
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
示例#5
0
    def configure(self):
        mlog = logging.getLogger( 'TileDigitsGetter::configure:' )
        mlog.info ('entering')        


        # get handle to upstream object
        try:
            from TileSimAlgs.TileDigitsGetter import TileDigitsGetter
            theTileDigitsGetter=TileDigitsGetter()
        except:
            mlog.error("could not get handle to TileDigitsGetter Quit")
            print traceback.format_exc()
            return False

        if not theTileDigitsGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("TileDigitsGetter unusable. Quit.")
                return False
            else:
                mlog.error("TileDigitsGetter unusable. Continue nevertheless")
                
        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()
        tileInfoConfigurator.setupCOOLPHYPULSE()

        # Instantiation of the C++ algorithm
        try:        
            from TileSimAlgs.TileSimAlgsConf import TileDigitsMaker                
        except:
            mlog.error("could not import TileSimAlgs.TileDigitsMaker")
            print traceback.format_exc()
            return False

        theTileDigitsMaker=TileDigitsMaker()
        self._TileDigitsMakerHandle = theTileDigitsMaker ;

        theTileDigitsMaker.TileHitContainer_DigiHSTruth="TileHitCnt_DigiHSTruth"
        from Digitization.DigitizationFlags import digitizationFlags
        theTileDigitsMaker.DoHSTruthReconstruction = digitizationFlags.doDigiTruth()
        # Configure TileDigitsMaker here
        # Check TileDigitization_jobOptions.py for full configurability
        theTileDigitsMaker.TileHitContainer="TileHitCnt"
        theTileDigitsMaker.TileInfoName="TileInfo"

        theTileDigitsMaker.CalibrationRun=False

        # Random number engine
        theTileDigitsMaker.RndmSvc=digitizationFlags.rndmSvc()
        digitizationFlags.rndmSeedList.addSeed("Tile_DigitsMaker", 4789899, 989240512)

        # Save integer numbers in digits vector if not pile-up premixing
        theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing() 

        # sets output key  
        theTileDigitsMaker.TileDigitsContainer=self.outputKey()        


        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore

        objKeyStore.addStreamESD(self.outputType(),self.outputKey())


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

        mlog.info(" now adding to topSequence")        
        # get a handle on topalg
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileDigitsMaker;
        
        return True
示例#6
0
from AthenaCommon.Logging import logging
msg = logging.getLogger( 'TileTBConditions_jobOptions.py' )

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

if not 'TileFrameLength' in dir():
    TileFrameLength = 9; # correct frame length for all testbeams
    
TileUseCOOL=False; # do not use COOL DB

msg.info("Adjusting TileInfo for %s samples" % TileFrameLength )
tileInfoConfigurator.NSamples = TileFrameLength
tileInfoConfigurator.OFPhysicsNSamples = TileFrameLength
tileInfoConfigurator.TrigSample = (TileFrameLength-1)/2

msg.info("Adjusting TileInfo to return cell noise for Fit Method")
tileInfoConfigurator.NoiseScaleIndex = 3; # Noise for Fit method

#=== set special CIS and cesium calibraton for 2004 data

if not 'Tile2004' in dir() or Tile2004: # 2004 configuration by default
    from TileConditions.TileCondProxyConf import getTileCondProxy
    ToolSvc.TileCondToolEmscale.ProxyOflCisLin = getTileCondProxy('FILE','Flt','Tile2004.cis','TileCondProxyFile_OflCisLin')
    ToolSvc.TileCondToolEmscale.ProxyOflCisNln = getTileCondProxy('FILE','Flt','Tile2004.lut','TileCondProxyFile_OflCisNln')
    ToolSvc.TileCondToolEmscale.ProxyOflCes    = getTileCondProxy('FILE','Flt','Tile2004.ces','TileCondProxyFile_OflCes')
    if not 'Tile2003Noise' in dir():
        Tile2003Noise=True

if 'Tile2003Noise' in dir() and Tile2003Noise: # special testbeam noise values
    from TileConditions.TileCondProxyConf import getTileCondProxy
示例#7
0
###############################################################
#
# Job options file : TileSamplingFraction
# Choose sampling fraction according to physics list
#
#==============================================================

from AthenaCommon.Logging import logging
msg = logging.getLogger( 'TileSamplingFraction_jobOptions.py' )

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()
        
try:
    from Digitization.DigitizationFlags import jobproperties
    physicsList = jobproperties.Digitization.physicsList()

    G4Ver = jobproperties.Digitization.SimG4VersionUsed()
    G4Ve = G4Ver.split(".")
    G4V = int(G4Ve[1])+int(G4Ve[2])/100.
    
    #default value corresponds to new multiple scatering
    #EmScaleA = 34.3

    #default value since May-2011
    EmScaleA = 34.0

    #default value for G4 9.6 since Nov-2013 (need to check G4 version as well)
    if physicsList == 'FTFP_BERT' or (physicsList == 'QGSP_BERT' and G4V > 9.05999) :
        EmScaleA = 33.9
示例#8
0
# Author: N. Gollub ([email protected])
# main job option to setup TileConditions
#
include.block("TileConditions/TileConditions_jobOptions.py")
from AthenaCommon.Logging import logging
msg = logging.getLogger('TileConditions_jobOptions.py')

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

if 'RunNumber' in dir():
    rn = RunNumber
elif '_run_number' in dir():
    rn = _run_number
else:
    rn = None

import re
from AthenaCommon.GlobalFlags import globalflags
gbltg = globalflags.DetDescrVersion()
patt = re.compile(r'-([A-Z]+.)-')
ss = patt.search(gbltg)
if (type(ss) != type(None)):
    version = ss.group(1)
    if (version == 'CSC'):
        msg.warning(
            "Old geometry tag detected %s - will not use COOL DB for TileCal calibration"
            % gbltg)
        TileUseCOOL = False
        TileFrameLength = 9
示例#9
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()
示例#10
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
示例#11
0
# Author: N. Gollub ([email protected])
# main job option to setup TileConditions
#
from __future__ import division
include.block("TileConditions/TileConditions_jobOptions.py")
from AthenaCommon.Logging import logging
msg = logging.getLogger('TileConditions_jobOptions.py')

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

if 'RunNumber' in dir():
    rn = RunNumber
elif '_run_number' in dir():
    rn = _run_number
else:
    rn = None

import re
from AthenaCommon.GlobalFlags import globalflags
gbltg = globalflags.DetDescrVersion()
patt = re.compile(r'-([A-Z]+.)-')
ss = patt.search(gbltg)
if (type(ss) != type(None)):
    version = ss.group(1)
    if (version == 'CSC'):
        msg.warning(
            "Old geometry tag detected %s - will not use COOL DB for TileCal calibration"
            % gbltg)
        TileUseCOOL = False
        TileFrameLength = 9
示例#12
0
    def configure(self):
        mlog = logging.getLogger('TileDigitsGetter::configure:')
        mlog.info('entering')

        # get handle to upstream object
        try:
            from TileSimAlgs.TileDigitsGetter import TileDigitsGetter
            theTileDigitsGetter = TileDigitsGetter()
        except Exception:
            mlog.error("could not get handle to TileDigitsGetter Quit")
            traceback.print_exc()
            return False

        if not theTileDigitsGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("TileDigitsGetter unusable. Quit.")
                return False
            else:
                mlog.error("TileDigitsGetter unusable. Continue nevertheless")

        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()
        tileInfoConfigurator.setupCOOLPHYPULSE()

        # Instantiation of the C++ algorithm
        try:
            from TileSimAlgs.TileSimAlgsConf import TileDigitsMaker
        except Exception:
            mlog.error("could not import TileSimAlgs.TileDigitsMaker")
            traceback.print_exc()
            return False

        theTileDigitsMaker = TileDigitsMaker()
        self._TileDigitsMakerHandle = theTileDigitsMaker

        from Digitization.DigitizationFlags import digitizationFlags
        theTileDigitsMaker.DoHSTruthReconstruction = digitizationFlags.doDigiTruth(
        )
        # Configure TileDigitsMaker here
        # Check TileDigitization_jobOptions.py for full configurability
        theTileDigitsMaker.TileHitContainer = "TileHitCnt"
        theTileDigitsMaker.TileHitContainer_DigiHSTruth = "TileHitCnt_DigiHSTruth"
        theTileDigitsMaker.TileInfoName = "TileInfo"

        theTileDigitsMaker.CalibrationRun = False

        # Save integer numbers in digits vector if not pile-up premixing
        theTileDigitsMaker.IntegerDigits = not digitizationFlags.PileUpPremixing(
        )

        from TileConditions.TileConditionsConf import TileCondToolNoiseSample
        theTileDigitsMaker.TileCondToolNoiseSample = TileCondToolNoiseSample(
            TileOnlineSampleNoise='')

        # sets output key
        if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(
        ):
            from OverlayCommonAlgs.OverlayFlags import overlayFlags
            theTileDigitsMaker.TileDigitsContainer = overlayFlags.bkgPrefix(
            ) + self.outputKey()
        else:
            theTileDigitsMaker.TileDigitsContainer = self.outputKey()

        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore

        objKeyStore.addStreamESD(self.outputType(), self.outputKey())

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

        mlog.info(" now adding to topSequence")
        # get a handle on topalg
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileDigitsMaker

        return True
示例#13
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
示例#14
0
include.block('TileRecAlgs/jobOptions_TileDigitsThresholdFilter.py')

from AthenaCommon.Logging import logging
tileDigitsFilterLogger = logging.getLogger(
    'jobOptions_TileDigitsThresholdFilter.py')

import AthenaCommon.CfgMgr as CfgMgr
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from TileRecUtils.TileRecFlags import jobproperties

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

if tileInfoConfigurator.setupCOOLDspThreshold():
    tileDigitsThresholdFilter = CfgMgr.TileDigitsThresholdFilter()
    jobproperties.TileRecFlags.TileDigitsContainer = 'TileDigitsFiltered'
    indices = [
        i for i, alg in enumerate(topSequence.getChildren())
        if alg.getType() == 'TileRawChannelMaker'
    ]
    if len(indices):
        topSequence.insert(indices[0], tileDigitsThresholdFilter)
        if hasattr(topSequence, 'TileRChMaker'):
            topSequence.TileRChMaker.TileDigitsContainer = jobproperties.TileRecFlags.TileDigitsContainer(
            )
    else:
        topSequence += tileDigitsThresholdFilter
    tileDigitsFilterLogger.info(
        "Added TileDigitsThresholdFilter algorithm to filter Tile Digits over threshold"
示例#15
0
include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")

# extra LAr setup
if doLAr:
    include("LArConditionsCommon/LArIdMap_comm_jobOptions.py")
    include("LArIdCnv/LArIdCnv_joboptions.py")
    svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
        "LArFebHeaderContainer/LArFebHeader"
    ]
    include("LArROD/LArFebErrorSummaryMaker_jobOptions.py")

# extra Tile setup
if doTile:
    # fix some strange bug ...
    from TileConditions.TileInfoConfigurator import TileInfoConfigurator
    tileInfoConfigurator = TileInfoConfigurator()
    tileInfoConfigurator.NSamples = 7

# reconstruct cells
from CaloRec.CaloCellGetter import CaloCellGetter
CaloCellGetter()
del rec

# setup l1calo database
from IOVDbSvc.CondDB import conddb
L1CaloDbConnection = "<dbConnection>sqlite://;schema=calib.sqlite;dbname=L1CALO</dbConnection>"
L1CaloDbTag = "<tag>HEAD</tag>"
L1CaloFolderList = []
L1CaloFolderList += ["/TRIGGER/L1Calo/Configuration/PprChanDefaults"]
L1CaloFolderList += ["/TRIGGER/L1Calo/Calibration/PprChanCalib"]
L1CaloFolderList += ["/TRIGGER/L1Calo/Calibration/PpmDeadChannels"]
示例#16
0
    def configure(self):

        mlog = logging.getLogger( 'TileRawChannelGetter::configure:' )
        mlog.info ("entering")        
        
        # Instantiation of the C++ algorithm
        try:        
            from TileRecUtils.TileRecUtilsConf import TileRawChannelMaker               
            theTileRawChannelMaker = TileRawChannelMaker("TileRChMaker_DigiHSTruth")
        except Exception:
            mlog.error("could not import TileRecUtils.TileRawChannelMaker")
            traceback.print_exc()
            return False
    
        self._TileRChMaker_DigiHSTruth = theTileRawChannelMaker

        # Configure TileInfoLoader
        from AthenaCommon.AppMgr import ServiceMgr
        if not hasattr( ServiceMgr, "TileInfoLoader" ):
            from TileConditions.TileInfoConfigurator import TileInfoConfigurator
            tileInfoConfigurator = TileInfoConfigurator()

        from TileRecUtils.TileRecFlags import jobproperties

        # 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

        NoiseFilterTools = []
        if jobproperties.TileRecFlags.noiseFilter() == 1:
            from TileRecUtils.TileRecUtilsConf import TileRawChannelNoiseFilter
            theTileRawChannelNoiseFilter = TileRawChannelNoiseFilter()
            NoiseFilterTools += [theTileRawChannelNoiseFilter]

        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():
            if jobproperties.TileRecFlags.doTileOptATLAS():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOptATLAS= TileRawChannelBuilderOpt2Filter("TileRawChannelBuilderOptATLAS_DigiHSTruth")
                except Exception:
                    mlog.error("could not get handle to TileRawChannelBuilderOpt2Filter Quit")
                    traceback.print_exc()
                    return False
                
                # setup COOL to get OFCs
                toolOfcCool = None
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    from TileConditions.TileInfoConfigurator import TileInfoConfigurator
                    tileInfoConfigurator = TileInfoConfigurator()
                    tileInfoConfigurator.setupCOOLOFC()
                    from TileConditions.TileCondToolConf import getTileCondToolOfcCool
                    toolOfcCool = getTileCondToolOfcCool('COOL')
                else:
                    from TileConditions.TileInfoConfigurator import TileInfoConfigurator
                    tileInfoConfigurator = TileInfoConfigurator()
                    tileInfoConfigurator.setupCOOLPHYPULSE()
                    tileInfoConfigurator.setupCOOLAutoCr()
                    
                #TileRawChannelBuilderOptATLAS Options:
                theTileRawChannelBuilderOptATLAS.TileRawChannelContainer = "TileRawChannelCnt_DigiHSTruth"
                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()
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderOptATLAS.TileCondToolOfc = toolOfcCool

                theTileRawChannelBuilderOptATLAS.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection()
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection() > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderOptATLAS.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection()
                    theTileRawChannelBuilderOptATLAS.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection()
                
                mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name TileRawChannelBuilderOptATLAS to the aglorithm: %s",
                          theTileRawChannelMaker.name())

                theTileRawChannelMaker.TileRawChannelBuilder += [theTileRawChannelBuilderOptATLAS]
            

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

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

            mlog.info(" now adding to topSequence")        
            from AthenaCommon.AlgSequence import AlgSequence
            topSequence = AlgSequence()
            theTileRawChannelMaker.TileDigitsContainer = "TileDigitsCnt_DigiHSTruth"

            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
                theTileRawChannelMaker.TileDigitsContainer = "NewDigitsContainer"
                topSequence += theTileRawCorrelatedNoise

            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
示例#17
0
from AthenaCommon.Logging import logging
msg = logging.getLogger('TileTBConditions_jobOptions.py')

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

if not 'TileFrameLength' in dir():
    TileFrameLength = 9
    # correct frame length for all testbeams

TileUseCOOL = False
# do not use COOL DB

msg.info("Adjusting TileInfo for %s samples" % TileFrameLength)
tileInfoConfigurator.NSamples = TileFrameLength
tileInfoConfigurator.TrigSample = (TileFrameLength - 1) / 2

msg.info("Adjusting TileInfo to return cell noise for Fit Method")
tileInfoConfigurator.NoiseScaleIndex = 3
# Noise for Fit method

#=== set special CIS and cesium calibraton for 2004 data

if not 'Tile2004' in dir() or Tile2004:  # 2004 configuration by default
    from TileConditions.TileCondProxyConf import getTileCondProxy
    ToolSvc.TileCondToolEmscale.ProxyOflCisLin = getTileCondProxy(
        'FILE', 'Flt', 'Tile2004.cis', 'TileCondProxyFile_OflCisLin')
    ToolSvc.TileCondToolEmscale.ProxyOflCisNln = getTileCondProxy(
        'FILE', 'Flt', 'Tile2004.lut', 'TileCondProxyFile_OflCisNln')
    ToolSvc.TileCondToolEmscale.ProxyOflCes = getTileCondProxy(
        'FILE', 'Flt', 'Tile2004.ces', 'TileCondProxyFile_OflCes')
示例#18
0
###############################################################
#
# Job options file : TileSamplingFraction
# Choose sampling fraction according to physics list
#
#==============================================================

from AthenaCommon.Logging import logging
msg = logging.getLogger('TileSamplingFraction_jobOptions.py')

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

try:
    from Digitization.DigitizationFlags import jobproperties
    physicsList = jobproperties.Digitization.physicsList()

    G4Ver = jobproperties.Digitization.SimG4VersionUsed()
    G4Ve = G4Ver.split(".")
    G4V = int(G4Ve[1]) + int(G4Ve[2]) / 100.

    #default value corresponds to new multiple scatering
    #EmScaleA = 34.3

    #default value since May-2011
    EmScaleA = 34.0

    #default value for G4 9.6 since Nov-2013 (need to check G4 version as well)
    if physicsList == 'FTFP_BERT' or (physicsList == 'QGSP_BERT'
                                      and G4V > 9.05999):
        EmScaleA = 33.9