Example #1
0
#=============================================================
#=== 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

from TileConditions.TileCondToolConf import *
#                                        ('LAS' or 'PHY' or 'CISPULSE100')
Example #2
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
Example #3
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
Example #4
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