Esempio n. 1
0
    def configure(self):
        mlog = logging.getLogger('TileHitGetterTool::configure:')
        mlog.info('entering')

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

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

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

        theTileHitVecToCntTool = TileHitVecToCntTool()
        self._TileHitVecToCntToolHandle = theTileHitVecToCntTool

        # Configure TileHitVecToCntTool here
        # Check  TileDigitizationCosmics_jobOptions.py,
        # TileDigitization_jobOptions.py, TileSimAlgs_jobOptions.py and
        # TileTBDigitization_jobOptions.py for full configurability
        theTileHitVecToCntTool.TileHitVectors = ["TileHitVec", "MBTSHits"]
        theTileHitVecToCntTool.TileInfoName = "TileInfo"

        # sets output key
        theTileHitVecToCntTool.TileHitContainer = self.outputKey()

        # set the range of bunch crossing times that
        # TileHitVectToCntTool is interested in
        theTileHitVecToCntTool.FirstXing = -200
        theTileHitVecToCntTool.LastXing = 150

        # 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.PileUpToolsAlg.PileUpTools += [theTileHitVecToCntTool]
        return True
Esempio n. 2
0
    def configure(self):
        mlog = logging.getLogger( 'TileCosmicMuon::configure:' )
        mlog.info ('entering')        
 
        # Instantiation of the C++ algorithm
        try:        
            from TileCosmicAlgs.TileCosmicAlgsConf import TileMuonFitter                
        except Exception:
            mlog.error("could not import TileCosmicAlgs.TileMuonFitter")
            mlog.error (traceback.format_exc())
            return False

        theTileMuonFitter=TileMuonFitter()
        self._TileMuonFitter = theTileMuonFitter

        # sets output key  
        theTileMuonFitter.TileCosmicMuonKey=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")        
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileMuonFitter
        
        return True
Esempio n. 3
0
    def _AddOPIToESD(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")

        if rec.doESD():
            from PyUtils.MetaReaderPeeker import metadata
            if 'stream' in metadata:
                stream = metadata['stream']
                log.debug("the stream found in 'metadata' is " + stream)
                if "express" in stream:
                    from TrigEDMConfig.TriggerEDM import getTypeAndKey, EDMDetails
                    type, key = getTypeAndKey(
                        "TrigOperationalInfo#HLT_EXPRESS_OPI_HLT")
                    if 'collection' in EDMDetails[type]:
                        colltype = EDMDetails[type]['collection']
                        log.info(
                            "Adding HLT_EXPRESS_OPI_HLT to ESD for stream " +
                            stream)
                        from RecExConfig.ObjKeyStore import objKeyStore
                        objKeyStore.addStreamESD(colltype, key)
                    return True
            else:
                log.warning(
                    "Could not determine stream of bytestream file, not adding HLT_EXPRESS_OPI_HLT to ESD."
                )
        return False
Esempio n. 4
0
    def configure(self):
        mlog = logging.getLogger('TileRawChannelFromHitsGetter::configure:')
        mlog.info('entering')

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

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

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

        theTileHitToRawChannel = TileHitToRawChannel()
        self._TileHitToRawChannelHandle = theTileHitToRawChannel

        # Configure TileHitToRawChannel here
        # Check TileRawChannel_jobOptions.py for full configurability
        theTileHitToRawChannel.TileHitContainer = "TileHitCnt"
        theTileHitToRawChannel.TileInfoName = "TileInfo"
        theTileHitToRawChannel.DeltaT = -1

        # sets output key
        theTileHitToRawChannel.TileRawChannelContainer = 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 += theTileHitToRawChannel

        return True
Esempio n. 5
0
    def configure(self):
        mlog = logging.getLogger('TileHitGetter::configure:')
        mlog.info('entering')

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

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

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

        theTileHitVecToCnt = TileHitVecToCnt()
        self._TileHitVecToCntHandle = theTileHitVecToCnt

        # Configure TileHitVecToCnt here
        # Check  TileDigitizationCosmics_jobOptions.py,
        # TileDigitization_jobOptions.py, TileSimAlgs_jobOptions.py and
        # TileTBDigitization_jobOptions.py for full configurability
        theTileHitVecToCnt.TileHitVectors = ["TileHitVec", "MBTSHits"]
        theTileHitVecToCnt.TileInfoName = "TileInfo"

        # sets output key
        theTileHitVecToCnt.TileHitContainer = 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 += theTileHitVecToCnt

        return True
Esempio n. 6
0
    def configure(self):
        mlog = logging.getLogger( 'TileL2FromRawChGetter::configure:' )
        mlog.info ('entering')        

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

        if not theTileL2FromRawChGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("TileL2FromRawChGetter unusable. Quit.")
                return False
            else:
                mlog.error("TileL2FromRawChGetter unusable. Continue nevertheless")
                
        # Instantiation of the C++ algorithm
        try:        
            from TileL2Algs.TileL2AlgsConf import TileRawChannelToL2                
        except Exception:
            mlog.error("could not import TileL2Algs.TileRawChannelToL2")
            traceback.print_exc()
            return False

        theTileRawChannelToL2=TileRawChannelToL2()
        self._TileRawChannelToL2Handle = theTileRawChannelToL2

        # sets output key  
        from Digitization.DigitizationFlags import digitizationFlags
        if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi():
            from OverlayCommonAlgs.OverlayFlags import overlayFlags
            theTileRawChannelToL2.TileL2Container = overlayFlags.bkgPrefix() + self.outputKey()
        else:
            theTileRawChannelToL2.TileL2Container = 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")        
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileRawChannelToL2
        
        return True
Esempio n. 7
0
    def configure(self):
        mlog = logging.getLogger('TileCellFromCellIDCGetter::configure:')
        mlog.info('entering')

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

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

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

        theTileCellIDCToCell = TileCellIDCToCell()
        self._TileCellIDCToCellHandle = theTileCellIDCToCell

        # Configure TileCellIDCToCell here
        # Check TileByteStream/ReadTileCellBS_jobOptions.py for full configurability
        theTileCellIDCToCell.TileCellIDC = "TileCellIDC"
        theTileCellIDCToCell.TileInfoName = "TileInfo"

        # sets output key
        theTileCellIDCToCell.TileCellContainer = 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")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileCellIDCToCell

        return True
Esempio n. 8
0
    def configure(self):
        mlog = logging.getLogger( 'TileTTL1FromDigitsGetter::configure:' )
        mlog.info ('entering')        

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

        if not theTileTTL1FromDigitsGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("TileTTL1FromDigitsGetter unusable. Quit.")
                return False
            else:
                mlog.error("TileTTL1FromDigitsGetter unusable. Continue nevertheless")
                
        # Instantiation of the C++ algorithm
        try:        
            from TileRecAlgs.TileRecAlgsConf import TileDigitsToTTL1                
        except:
            mlog.error("could not import TileRecAlgs.TileDigitsToTTL1")
            print traceback.format_exc()
            return False

        theTileDigitsToTTL1=TileDigitsToTTL1()
        self._TileDigitsToTTL1Handle = theTileDigitsToTTL1 ;

        # Configure TileDigitsToTTL1 here
        theTileDigitsToTTL1.TileDigitsContainer="TileDigitsCnt"
        theTileDigitsToTTL1.TileInfoName="TileInfo"

        # sets output key  
        theTileDigitsToTTL1.TileTTL1Container=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")        
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileDigitsToTTL1;
        
        return True
Esempio n. 9
0
    def configure(self):
        builder = createTruthParticlesBuilder(
            name=self._outputKey + "Builder",
            inMcEvtCollection=self._inputMcEvent,
            outTruthParticles=self._outputKey,
            selectSignalType=self._truthType)
        self._seq += builder
        mlog = logging.getLogger(self.__class__.__name__)
        mlog.info(
            " Recorded the %s ESD TruthParticle shadow collection - will be recreated on the fly "
            % (self.outputKey(), ))
        objKeyStore.addStreamESD("TruthParticleContainer", self.outputKey())

        return True
Esempio n. 10
0
    def configure(self):
        mlog = logging.getLogger( 'DetStatusMapGetter::configure :' )
        mlog.info ('entering')

                
        

        # now configure the algorithm
        try:        
            from DetectorStatus.DetectorStatusConf import DetStatusAlg               
        except Exception:
            mlog.error("could not import DetStatusAlg")
            mlog.error (traceback.format_exc())
            return False

        # sets up cond db
        # still use old include for time being
        from AthenaCommon.Include import include        
        include("DetectorStatus/DetStatusSvc_CondDB.py")


        # instantiate algorithm with default properties
        theDetStatusAlg=DetStatusAlg(Write=True)
        self._DetStatusAlgHandle = theDetStatusAlg


        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore

        # output both in ESD and AOD
        objKeyStore.addStreamESD(self.outputType(),self.outputKey())
        objKeyStore.addStreamAOD(self.outputType(),self.outputKey())        


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

        mlog.info(" now adding to topSequence")        
        from __main__ import topSequence
        topSequence += theDetStatusAlg
        
        return True
Esempio n. 11
0
    def _AddOPIToESD(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")        
        
        if rec.doESD():
            from RecExConfig.InputFilePeeker import inputFileSummary
            if inputFileSummary.has_key('bs_metadata') and inputFileSummary['bs_metadata'].has_key('Stream'):
                stream=inputFileSummary['bs_metadata']['Stream']
                log.debug("the stream found in 'bs_metadata' is "+stream)
                if "express" in stream:
                    from TrigEDMConfig.TriggerEDM import getTypeAndKey,EDMDetails
                    type,key=getTypeAndKey("TrigOperationalInfo#HLT_EXPRESS_OPI_HLT")
                    if EDMDetails[type].has_key('collection'):
                        colltype = EDMDetails[type]['collection']
                        log.info("Adding HLT_EXPRESS_OPI_HLT to ESD for stream "+stream)                        
                        from RecExConfig.ObjKeyStore import objKeyStore
                        objKeyStore.addStreamESD(colltype, key)
                    return True
            else:
                log.warning("Could not determine stream of bytestream file, not adding HLT_EXPRESS_OPI_HLT to ESD.")
        return False
from AthenaCommon.Logging import logging
mlog = logging.getLogger('RDOtoESD_Lucid: ')

from AthenaCommon.GlobalFlags import globalflags
from RecExConfig.RecFlags import rec
from RecExConfig.ObjKeyStore import objKeyStore

if rec.doESD:
    if DetFlags.readRDOPool.Lucid_on():
        include("LUCID_RawDataByteStreamCnv/LUCID_DigitRawDataCnv.py")
    if globalflags.DataSource() == 'geant4':
        objKeyStore.addStreamESD("LUCID_DigitContainer", "Lucid_Digits")
    objKeyStore.addStreamESD("LUCID_RawDataContainer", "Lucid_RawData")
Esempio n. 13
0
    def configure(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")
        from RecExConfig.ObjKeyStore import objKeyStore

        # set EDMDecodingVersion
        EDMDecodingVersion()

        # Set AODFULL for data unless it was set explicitly already
        if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource(
        ) == 'data':
            TriggerFlags.AODEDMSet = 'AODFULL'

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS())
        if TriggerFlags.readBS():
            if TriggerFlags.EDMDecodingVersion() <= 2:
                bs = ByteStreamUnpackGetterRun2()  # noqa: F841
            else:
                bs = ByteStreamUnpackGetter()  # noqa: F841

        xAODContainers = {}
        #        if not recAlgs.doTrigger():      #only convert when running on old data
        if TriggerFlags.EDMDecodingVersion() == 1:
            xaodcnvrt = xAODConversionGetter()
            xAODContainers = xaodcnvrt.xaodlist

        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
            if TriggerFlags.EDMDecodingVersion() <= 2:
                tdt = TrigDecisionGetterRun2()  # noqa: F841
            else:
                tdt = TrigDecisionGetter()  # noqa: F841

        # Temporary hack to add Run-3 navigation to ESD and AOD
        if (rec.doESD()
                or rec.doAOD()) and TriggerFlags.EDMDecodingVersion() == 3:
            # The hack with wildcards is needed for BS->ESD because we don't know the exact keys
            # of HLT navigation containers before unpacking them from the BS event.
            objKeyStore._store['streamESD'].allowWildCard(True)
            objKeyStore._store['streamAOD'].allowWildCard(True)
            objKeyStore.addManyTypesStreamESD([
                'xAOD::TrigCompositeContainer#HLTNav*',
                'xAOD::TrigCompositeAuxContainer#HLTNav*'
            ])
            objKeyStore.addManyTypesStreamAOD([
                'xAOD::TrigCompositeContainer#HLTNav*',
                'xAOD::TrigCompositeAuxContainer#HLTNav*'
            ])

        # TrigJetRec additions
        if rec.doWriteESD():
            objKeyStore.addStreamESD("JetKeyDescriptor", "JetKeyMap")
            objKeyStore.addStreamESD("JetMomentMap", "TrigJetRecMomentMap")

        if rec.doWriteAOD():
            objKeyStore.addStreamAOD("JetKeyDescriptor", "JetKeyMap")
            objKeyStore.addStreamAOD("JetMomentMap", "TrigJetRecMomentMap")

        # ID truth
        if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \
                and rec.doTruth():
            try:
                from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \
                    TrigIDTruthMaker
                topSequence += TrigIDTruthMaker()
            except Exception:
                log.warning("Couldn't set up the trigger ID truth maker")
                pass

        if rec.doESD() or rec.doAOD():
            from TrigEDMConfig.TriggerEDM import getTrigIDTruthList
            objKeyStore.addManyTypesStreamESD(
                getTrigIDTruthList(TriggerFlags.ESDEDMSet()))
            objKeyStore.addManyTypesStreamAOD(
                getTrigIDTruthList(TriggerFlags.AODEDMSet()))

        if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData():
            objKeyStore.addManyTypesStreamESD([
                'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'
            ])
            objKeyStore.addManyTypesStreamAOD([
                'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'
            ])
            log.debug(
                "HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data."
            )

        if rec.doAOD() or rec.doWriteAOD():
            # schedule the RoiDescriptorStore conversion
            # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" )
            roiWriter = RoiWriter()
            # Add fictional input to ensure data dependency in AthenaMT
            roiWriter.ExtraInputs += [("TrigBSExtractionOutput",
                                       "StoreGateSvc+TrigBSExtractionOutput")]
            topSequence += roiWriter
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDMRun2 import TriggerRoiList
            objKeyStore.addManyTypesStreamAOD(TriggerRoiList)

        #Are we adding operational info objects in ESD?
        added = self._AddOPIToESD()
        if added:
            log.debug(
                "Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data."
            )

        # ESD objects definitions
        _TriggerESDList = {}

        from TrigEDMConfig.TriggerEDM import getTriggerEDMList
        # we have to store xAOD containers in the root file, NOT AOD,
        # if the xAOD container list is not empty
        if (xAODContainers):
            _TriggerESDList.update(xAODContainers)
        else:
            _TriggerESDList.update(
                getTriggerEDMList(TriggerFlags.ESDEDMSet(),
                                  TriggerFlags.EDMDecodingVersion()))

        log.info(
            "ESD content set according to the ESDEDMSet flag: %s and EDM version %d",
            TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion())

        # AOD objects choice
        _TriggerAODList = {}

        #from TrigEDMConfig.TriggerEDM import getAODList
        _TriggerAODList.update(
            getTriggerEDMList(TriggerFlags.AODEDMSet(),
                              TriggerFlags.EDMDecodingVersion()))

        log.info(
            "AOD content set according to the AODEDMSet flag: %s and EDM version %d",
            TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion())

        log.debug("ESD EDM list: %s", _TriggerESDList)
        log.debug("AOD EDM list: %s", _TriggerAODList)

        # Highlight what is in AOD list but not in ESD list, as this can cause
        # the "different number of entries in branch" problem, when it is in the
        # AOD list but the empty container per event is not created
        # Just compares keys of dicts, which are the class names, not their string keys in StoreGate
        not_in = [
            element for element in _TriggerAODList
            if element not in _TriggerESDList
        ]
        if (len(not_in) > 0):
            log.warning("In AOD list but not in ESD list: ")
            log.warning(not_in)
        else:
            log.info("AOD list is subset of ESD list - good.")

        def _addSlimming(stream, edm):
            from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc

            edmlist = list(y.split('-')[0] for x in edm.values()
                           for y in x)  #flatten names

            svc = navigationThinningSvc({
                'name': 'HLTNav_%s' % stream,
                'mode': 'cleanup',
                'result': 'HLTResult_HLT',
                'features': edmlist
            })

            from OutputStreamAthenaPool.CreateOutputStreams import registerTrigNavThinningSvc
            registerTrigNavThinningSvc(stream, svc)

            log.info("Configured slimming of HLT for %s", stream)
            print(svc)  # noqa: ATL901
            del edmlist

        if TriggerFlags.doNavigationSlimming() and rec.readRDO(
        ) and rec.doWriteAOD():
            _addSlimming('StreamAOD',
                         _TriggerESDList)  #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")

        if TriggerFlags.doNavigationSlimming() and rec.readRDO(
        ) and rec.doWriteESD():
            _addSlimming('StreamESD', _TriggerESDList)
            log.info("configured navigation slimming for ESD output")

        objKeyStore.addManyTypesStreamESD(_TriggerESDList)
        objKeyStore.addManyTypesStreamAOD(_TriggerAODList)

        return True
Esempio n. 14
0
class SimpleCookedObjGetter(Configured):
    _outputType = "SimpleCookedObj"
    _output = {_outputType: "SimpleCookedObjBlaBlaDict"}

    def configure(self):
        mlog = logging.getLogger('Py:SimpleCookedObjGetter::configure %s:' %
                                 self.__class__)

        # work indeed
        # from __main__ import include
        # include("RecExAlgs/SimpleCookedObjMaker_jobOptions.py")

        # get handle to upstream object

        try:
            from RecExAlgs.SimpleRawObjGetter import SimpleRawObjGetter
        except ImportError, err:
            mlog.error("could not import SimpleRawObjGetter. Quit")
            return False

        theSimpleRawObjGetter = SimpleRawObjGetter()

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

        # get handle to tools

        # now configure the algorithm, part of this could be done in a separate class
        # cannot have same name
        try:
            from RecExAlgs.RecExAlgsConf import SimpleCookedObjMaker
        except ImportError:
            mlog.error("could not import SimpleCookedObjMaker. Quit")
            return False

        theSimpleCookedObjMaker = SimpleCookedObjMaker()
        self._SimpleCookedObjMakerHandle = theSimpleCookedObjMaker
        theSimpleCookedObjMaker.CookedMessage = "From SimpleCookedObjGetter.py"
        #

        # sets output key
        # these two lines are completely equivalent
        #self.SimpleCookedObjMakerHandle().CookedObjOutputName=self.outputKey()
        theSimpleCookedObjMaker.CookedObjOutputName = self.outputKey()

        # register output in objKeyStore
        # should eventually specify there that object to be written in a stream
        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addStreamESD(self.outputType(), self.outputKey())
        # if only transient store
        # objKeyStore.addTransient(self.outputType(),self.outputKey())

        # can alter upstream alg property here, not recommended
        # theSimpleRawObjGetter.SimpleRawObjMakerHandle().RawMessage= "from SimpleCookedObjGetter"

        theSimpleCookedObjMaker.RawObjNames = [
            theSimpleRawObjGetter.outputKey()
        ]

        # 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()
        topSequence += self.SimpleCookedObjMakerHandle()

        return True
Esempio n. 15
0
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger( 'LArNoisyROSummaryGetter::configure:' )
        mlog.info ('entering')        

        # get handle to upstream CaloCell object
        import traceback
        try:
            from CaloRec.CaloCellGetter import CaloCellGetter
            theCaloCellGetter = CaloCellGetter()
        except:
            mlog.error("could not get handle to CaloCell Quit")
            traceback.print_exc()
            return False
        if not theCaloCellGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("CaloCellGetter unusable. Quit.")
                return False
            else:
                mlog.error("CaloCellGetter unusable. Continue nevertheless")
         
        LArOnOffIdMapping() # Set up cabling cond algo
  
        # now configure the algorithm
        # cannot have same name
        try:        
            from LArCellRec.LArCellRecConf import LArNoisyROAlg,LArNoisyROTool
        except:
            mlog.error("could not import LArNoisyROAlg or LArNoisyROTool")
            traceback.print_exc()
            return False

        theLArNoisyROTool=LArNoisyROTool(CellQualityCut=larNoisyROFlags.CellQualityCut(),
                                         BadChanPerFEB=larNoisyROFlags.BadChanPerFEB(),
                                         BadFEBCut=larNoisyROFlags.BadFEBCut(),
                                         MNBLooseCut=larNoisyROFlags.MNBLooseCut(),
                                         MNBTightCut=larNoisyROFlags.MNBTightCut(),
                                         MNBTight_PsVetoCut=larNoisyROFlags.MNBTight_PsVetoCut()
                                         )


        theLArNoisyROAlg=LArNoisyROAlg()
        theLArNoisyROAlg.Tool=theLArNoisyROTool

        self._LArNoisyROMakerHandle = theLArNoisyROAlg
        theLArNoisyROAlg.OutputKey=self.outputKey()        
        
        if globalflags.DataSource()=='geant4':
           theLArNoisyROAlg.isMC = True

        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addStreamESD(self.outputType(),self.outputKey())
        objKeyStore.addTransient(self.outputType(),self.outputKey())
        
        # now add algorithm to topSequence
        # this should always come at the end

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence += theLArNoisyROAlg
        
        return True
Esempio n. 16
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
Esempio n. 17
0
from TrigFTKTrackConverter.TrigFTKTrackConverterConf import TrigFTKClusterConverterTool
ClusterConvTool = TrigFTKClusterConverterTool(UsePixelCalibSvc=False)

ToolSvc += ClusterConvTool

print "Output file", OutputNTUP_FTKIPFile
wrapper = FTKRegionalWrapper(OutputLevel=DEBUG,
                             PMapPath=pmap_path,
                             RMapPath=rmap_path,
                             OutFileName=OutputNTUP_FTKIPFile,
                             WriteClustersToESD=True,
                             SaveHits=True,
                             Clustering=True,
                             TrigFTKClusterConverterTool=ClusterConvTool)
wrapper.IBLMode = 1
wrapper.HitInputTool = FTKSGInput
wrapper.Clustering = True
theJob += wrapper

from RecExConfig.ObjKeyStore import objKeyStore
objKeyStore.addStreamESD("InDet::SCT_ClusterContainer", "FTK_SCT_Cluster")
objKeyStore.addStreamESD("InDet::PixelClusterContainer", "FTK_Pixel_Clusters")
objKeyStore.addStreamESD("Trk::PRD_MultiTruthCollection",
                         "PRD_MultiTruthSCT_FTK")
objKeyStore.addStreamESD("PRD_MultiTruthCollection", "PRD_MultiTruthSCT_FTK")
objKeyStore.addStreamESD("PRD_MultiTruthCollection", "PRD_MultiTruthPixel_FTK")

print theJob
###############################################################
Esempio n. 18
0
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger('CaloCellGetter::configure:')
        mlog.info('entering')

        doStandardCellReconstruction = True
        from CaloRec.CaloCellFlags import jobproperties

        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:
            # handle LAr
            import traceback
            try:
                from LArROD.LArRODFlags import larRODFlags
                from AthenaCommon.GlobalFlags import globalflags
                if larRODFlags.readDigits() and globalflags.DataSource(
                ) == 'data':
                    from AthenaCommon.KeyStore import CfgItemList
                    CfgItemList("KeyStore_inputFile").removeItem(
                        "LArRawChannelContainer#LArRawChannels")
                if (not larRODFlags.readDigits()
                    ) and globalflags.InputFormat() == 'bytestream':
                    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
                    try:
                        if not "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                            svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                                "LArRawChannelContainer/LArRawChannels"
                            ]
                    except:
                        mlog.warning(
                            "Cannot remove LArRawChannelContainer/LArRawChannels from bytestream list"
                        )
                from LArROD.LArRawChannelGetter import LArRawChannelGetter
                theLArRawChannelGetter = LArRawChannelGetter()
            except:
                mlog.error("could not get handle to LArRawChannel Quit")
                print traceback.format_exc()
                return False

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

        # 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:
            mlog.error("could not import CaloRec.CaloCellMaker")
            print traceback.format_exc()
            return False

        theCaloCellMaker = CaloCellMaker()
        self._CaloCellMakerHandle = theCaloCellMaker

        from AthenaCommon.AppMgr import ToolSvc

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

            from RecExConfig.RecFlags import rec

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

                if jobproperties.CaloCellFlags.doLArCreateMissingCells():
                    # bad channel tools
                    try:
                        from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
                        theLArBadChannelTool = LArBadChanTool()
                    except:
                        mlog.error("could not access bad channel tool Quit")
                        print traceback.format_exc()
                        return False
                    ToolSvc += theLArBadChannelTool
                    theLArCellBuilder.addDeadOTX = True
                    theLArCellBuilder.badChannelTool = theLArBadChannelTool

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

            if rec.doTile():

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.DataSource(
                ) == 'data' and globalflags.InputFormat() == 'bytestream':
                    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
                    try:
                        svcMgr.ByteStreamCnvSvc.ROD2ROBmap = ["-1"]
                        if not "TileDigitsContainer/TileDigitsCnt" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                            svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
                                "TileBeamElemContainer/TileBeamElemCnt",
                                "TileDigitsContainer/TileDigitsCnt",
                                "TileL2Container/TileL2Cnt",
                                "TileLaserObject/TileLaserObj",
                                "TileMuonReceiverContainer/TileMuRcvCnt"
                            ]
                    except:
                        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.doTileOpt      \
                                 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 not 'doTileOpt2' in dir():
                            from RecExConfig.AutoConfiguration import GetRunNumber
                            rn = GetRunNumber()
                            if 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()
                    except:
                        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:
                        mlog.error("Could not configure TileDigitsFilter")

                try:
                    from TileRecUtils.TileRecUtilsConf import TileCellBuilder
                    theTileCellBuilder = TileCellBuilder()
                    from TileRecUtils.TileRecFlags import jobproperties
                    theTileCellBuilder.TileRawChannelContainer = jobproperties.TileRecFlags.TileRawChannelContainer(
                    )

                    if not hasattr(ToolSvc, "TileBeamInfoProvider"):
                        from TileRecUtils.TileRecUtilsConf import TileBeamInfoProvider
                        ToolSvc += TileBeamInfoProvider()

                    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:
                            ToolSvc.TileBeamInfoProvider.TileRawChannelContainer = "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(
                                )

                    ToolSvc += theTileCellBuilder
                    theCaloCellMaker.CaloCellMakerToolNames += [
                        theTileCellBuilder
                    ]
                except:
                    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()
                ToolSvc += theEmptyCellBuilderTool
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theEmptyCellBuilderTool
                ]

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

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

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

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

                    from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault
                    theCaloNoiseTool = CaloNoiseToolDefault()
                    from AthenaCommon.AppMgr import ToolSvc
                    ToolSvc += theCaloNoiseTool

                    theAddNoiseCellBuilderTool.CaloNoiseTool = theCaloNoiseTool.getFullName(
                    )

                    print theAddNoiseCellBuilderTool

                    ToolSvc += theAddNoiseCellBuilderTool
                    theCaloCellMaker.CaloCellMakerToolNames += [
                        theAddNoiseCellBuilderTool
                    ]
                    mlog.info("configure AddNoiseCellBuilderTool worked")
                except:
                    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()
        ToolSvc += 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:
                mlog.error("could not get handle to LArCellMerge Quit")
                print traceback.format_exc()
                return False
            theLArCellMerger.RawChannelsName = larRODFlags.RawChannelFromDigitsContainerName(
            )
            ToolSvc += 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:
                mlog.error(
                    "could not get handle to LArCellNoiseMaskingTool Quit")
                print traceback.format_exc()
                return False

            # bad channel tools
            try:
                from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
                theLArBadChannelTool = LArBadChanTool()
            except:
                mlog.error("could not access bad channel tool Quit")
                print traceback.format_exc()
                return False
            ToolSvc += theLArBadChannelTool

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

            if doNoiseMask:
                try:
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArNoiseMasker = LArBadChannelMasker("LArNoiseMasker")
                except:
                    mlog.error("could not access bad channel tool Quit")
                    print traceback.format_exc()
                    return False
                theLArNoiseMasker.TheLArBadChanTool = theLArBadChannelTool
                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
            ToolSvc += 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:
                mlog.error("could not get handle to LArBadFebMaskingTool Quit")
                print traceback.format_exc()
                return False
            ToolSvc += theLArBadFebMaskingTool

            # bad channel tools
            try:
                from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
                theLArBadChannelTool = LArBadChanTool()
            except:
                mlog.error("could not access bad channel tool Quit")
                print traceback.format_exc()
                return False
            ToolSvc += theLArBadChannelTool

            theLArBadFebMaskingTool.badChannelTool = theLArBadChannelTool
            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:
                mlog.error("could not get handle to LArCellGainPatholog< Quit")
                print traceback.format_exc()
                return False
            ToolSvc += 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:
                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;

            ToolSvc += theLArCellEmMiscalib

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

            ToolSvc += 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")

        import os
        if doPedestalCorr:
            try:
                from CaloCellCorrection.CaloCellPedestalCorrDefault import CaloCellPedestalCorrDefault
                theCaloCellPedestalCorr = CaloCellPedestalCorrDefault()
                ToolSvc += theCaloCellPedestalCorr
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theCaloCellPedestalCorr
                ]
            except:
                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.LArCellHVCorrDefault import LArCellHVCorrDefault
            theLArCellHVCorr = LArCellHVCorrDefault()

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

        #
        # 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:
                mlog.error("could not get handle to LArCellRecalibration Quit")
                print traceback.format_exc()
                return False
            ToolSvc += theLArCellRecalibration

            # get new ADC2MeVTool
            try:
                from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
                theLArADC2MeVToolDefault = LArADC2MeVToolDefault()
            except:
                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:
                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:
                mlog.error("could not get handle to HVCorrTool Quit")
                print traceback.format_exc()
                return False
            ToolSvc += 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:
                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:
                mlog.error(
                    "could not get handle to  CaloCellMBAverageCorr  Quit")
                print traceback.format_exc()
                return False
            ToolSvc += theCaloCellMBAverageCorr

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

            ToolSvc += 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:
                mlog.error(
                    "could not get handle to  CaloCellNeighborsAverageCorr  Quit"
                )
                print traceback.format_exc()
                return False
            ToolSvc += 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:
                    mlog.warning(
                        "Trigger is switched off. Can't run deadOTX correction."
                    )

        if doLArDeadOTXCorr:

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

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

        doCaloEnergyRescaler = False
        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"
                ToolSvc += theCCERescalerTool
                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")
                ToolSvc += theCCERescalerTool
                theCaloCellMaker.CaloCellMakerToolNames += [theCCERescalerTool]
            except:
                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 CaloRec.CaloRecConf import CaloCellContainerCorrectorTool
                from CaloCellCorrection.CaloCellCorrectionConf import CaloCellTimeCorrTool
                theLArTimeCorr = CaloCellTimeCorrTool()
                theLArTimeCorr.Folder = "/LAR/TimeCorrectionOfl/CellTimeOffset"
                ToolSvc += theLArTimeCorr
                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")
                theCaloTimeCorrTool = CaloCellContainerCorrectorTool(
                    "LArTimeCorrTool",
                    CellCorrectionToolNames=[theLArTimeCorr])
                ToolSvc += theCaloTimeCorrTool
                theCaloCellMaker.CaloCellMakerToolNames += [
                    theCaloTimeCorrTool
                ]

            except:
                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

        ToolSvc += 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())

        # 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
    def configure(self):
        mlog = logging.getLogger('CaloTowerCmbGetter::configure :')
        mlog.info('scheduled to output %s', self.output())

        # get handle to upstream object
        # handle tile

        # handle LAr
        theCaloCellGetter = self.getInputGetter\
                            (jp.CaloRecFlags.clusterCellGetterName())

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

        self._CaloTowerAlgorithmHandle = theCaloTowerAlgorithm

        # configure CaloTowerAlgorithm here

        try:
            from TileRecUtils.TileRecUtilsConf import TileTowerBuilderTool
            theTileTowerBuilderTool = TileTowerBuilderTool("TileCmbTwrBldr")
        except:
            mlog.error("could not get handle to TileTowerBuilderTool Quit")
            print traceback.format_exc()
            return False

        # add the tool to list of tool ( should use ToolHandle eventually)
        theCaloTowerAlgorithm.TowerBuilderTools += [
            theTileTowerBuilderTool.getFullName()
        ]

        try:
            from LArRecUtils.LArRecUtilsConf import LArTowerBuilderTool, LArFCalTowerBuilderTool
            theLArTowerBuilderTool = LArTowerBuilderTool("LArCmbTwrBldr")
            theLArFCalTowerBuilderTool = LArFCalTowerBuilderTool(
                "LArFCalCmbTwrBldr")
        except:
            mlog.error(
                "could not get handle to LArTowerBuilderTool or LArFCalTowerBuilderTool. Quit"
            )
            print traceback.format_exc()
            return False

        theCaloTowerAlgorithm.TowerBuilderTools += [
            theLArTowerBuilderTool.getFullName()
        ]
        theCaloTowerAlgorithm.TowerBuilderTools += [
            theLArFCalTowerBuilderTool.getFullName()
        ]

        theCaloTowerAlgorithm.NumberOfPhiTowers = 64
        theCaloTowerAlgorithm.NumberOfEtaTowers = 100
        theCaloTowerAlgorithm.EtaMin = -5.0
        theCaloTowerAlgorithm.EtaMax = 5.0

        theLArTowerBuilderTool.CellContainerName = theCaloCellGetter.outputKey(
        )
        theLArTowerBuilderTool.IncludedCalos = ["LAREM", "LARHEC"]

        theLArFCalTowerBuilderTool.CellContainerName = theCaloCellGetter.outputKey(
        )
        theLArFCalTowerBuilderTool.MinimumEt = 0 * MeV

        theTileTowerBuilderTool.CellContainerName = theCaloCellGetter.outputKey(
        )
        theTileTowerBuilderTool.DumpTowers = False
        theTileTowerBuilderTool.DumpWeightMap = False

        # add tool to alg . From now on theCaloClusterBuilderSW will point
        # on a COPY of the tool, so property cannot be further modified !
        theCaloTowerAlgorithm += theLArTowerBuilderTool
        theCaloTowerAlgorithm += theLArFCalTowerBuilderTool
        theCaloTowerAlgorithm += theTileTowerBuilderTool

        # FIXME TowerSpy missing

        #

        # sets output key
        theCaloTowerAlgorithm.TowerContainerName = 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")

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence += theCaloTowerAlgorithm

        return True
Esempio n. 20
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
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger('LArNoisyROSummaryGetter::configure:')
        mlog.info('entering')

        # get handle to upstream CaloCell object
        import traceback
        try:
            from CaloRec.CaloCellGetter import CaloCellGetter
            theCaloCellGetter = CaloCellGetter()
        except:
            mlog.error("could not get handle to CaloCell Quit")
            print traceback.format_exc()
            return False
        if not theCaloCellGetter.usable():
            if not self.ignoreConfigError():
                mlog.error("CaloCellGetter unusable. Quit.")
                return False
            else:
                mlog.error("CaloCellGetter unusable. Continue nevertheless")

        # now configure the algorithm
        # cannot have same name
        try:
            from LArCellRec.LArCellRecConf import LArNoisyROAlg, LArNoisyROTool
        except:
            mlog.error("could not import LArNoisyROAlg or LArNoisyROTool")
            print traceback.format_exc()
            return False

        from AthenaCommon.AppMgr import ToolSvc
        # Noise and MNB Febs from COOL only for data
        from AthenaCommon.GlobalFlags import globalflags
        from IOVDbSvc.CondDB import conddb
        if globalflags.DataSource.get_Value() != 'geant4' and (
                'COMP200' not in conddb.GetInstance()):
            from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
            theBadFebTool = LArBadChanTool("KnownBADFEBsTool")
            theBadFebTool.CoolMissingFEBsFolder = "/LAR/BadChannels/KnownBADFEBs"
            ToolSvc += theBadFebTool
            theMNBFebTool = LArBadChanTool("KnownMNBFEBsTool")
            theMNBFebTool.CoolMissingFEBsFolder = "/LAR/BadChannels/KnownMNBFEBs"
            ToolSvc += theMNBFebTool
            theLArNoisyROTool = LArNoisyROTool(
                PrintSummary=True,
                CellQualityCut=larNoisyROFlags.CellQualityCut(),
                BadChanPerFEB=larNoisyROFlags.BadChanPerFEB(),
                BadFEBCut=larNoisyROFlags.BadFEBCut(),
                MNBLooseCut=larNoisyROFlags.MNBLooseCut(),
                MNBTightCut=larNoisyROFlags.MNBTightCut(),
                MNBTight_PsVetoCut=larNoisyROFlags.MNBTight_PsVetoCut(),
                KnownBADFEBsTool=theBadFebTool,
                KnownMNBFEBsTool=theMNBFebTool)
        else:
            theLArNoisyROTool = LArNoisyROTool(
                PrintSummary=True,
                CellQualityCut=larNoisyROFlags.CellQualityCut(),
                BadChanPerFEB=larNoisyROFlags.BadChanPerFEB(),
                BadFEBCut=larNoisyROFlags.BadFEBCut(),
            )
        pass

        theLArNoisyROAlg = LArNoisyROAlg()
        theLArNoisyROAlg.Tool = theLArNoisyROTool

        self._LArNoisyROMakerHandle = theLArNoisyROAlg
        theLArNoisyROAlg.OutputKey = 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

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence += theLArNoisyROAlg

        return True
Esempio n. 22
0
    def configure(self):
        mlog = logging.getLogger('CaloTopoTowerGetter::configure :')
        mlog.info('scheduled to output %s', self.output())

        # get handle to upstream CaloCells
        theCaloCellGetter = self.getInputGetter\
                            (jp.CaloRecFlags.clusterCellGetterName())

        # ----- get handle to upstream tower objects
        try:
            from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter
            theCaloTowerCmbGetter = CaloTowerCmbGetter()
        except Exception:
            mlog.error("could not get handle to CaloTowerCmbGetter Quit")
            print(traceback.format_exc())
            return False

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

        # ------ get handle to upstream topo cluster object
        try:
            from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter
            theCaloClusterTopoGetter = CaloClusterTopoGetter()
        except Exception:
            mlog.error("could not get handle to CaloClusterTopoGetter  Quit")
            print(traceback.format_exc())
            return False

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

        # ------ get handle to upstream topo cluster object
        try:
            from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter
            CaloClusterTopoGetter()
            from CaloRec.CaloCell2ClusterMapperGetters import CaloCell2TopoClusterMapperGetter
            theCaloCell2TopoClusterMapperGetter = CaloCell2TopoClusterMapperGetter(
            )
        except Exception:
            mlog.error(
                "could not get handle to CaloCell2TopoClusterMapperGetter  Quit"
            )
            print(traceback.format_exc())
            return False

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

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

        self._CaloTopoTowerAlgorithmHandle = theCaloTopoTowerAlgorithm

        # configure CaloTopoTowerAlgorithm here
        try:
            from CaloUtils.CaloUtilsConf import CaloTopoTowerBuilderTool
            theCaloTopoTowerBuilderTool = CaloTopoTowerBuilderTool(
                "TopoTowerTwrBldr")
        except Exception:
            mlog.error("could not get handle to CaloTopoTowerBuilderTool Quit")
            print(traceback.format_exc())
            return False

        theCaloTopoTowerAlgorithm.TowerBuilderTools += [
            theCaloTopoTowerBuilderTool.getFullName()
        ]

        ########################
        # extra cuts which can be applied at the topo tower level
        # set input keys
        theCaloTopoTowerAlgorithm.InputTowerContainerName = theCaloTowerCmbGetter.outputKey(
        )
        theCaloTopoTowerAlgorithm.ClusterContainerName = theCaloClusterTopoGetter.outputKey(
        )
        theCaloTopoTowerAlgorithm.CellContainerName = theCaloCellGetter.outputKey(
        )
        theCaloTopoTowerAlgorithm.Cell2ClusterMapName = theCaloCell2TopoClusterMapperGetter.outputKey(
        )

        # sets output key
        theCaloTopoTowerAlgorithm.OutputTowerContainerName = self.outputKey()

        theCaloTopoTowerAlgorithm.MinimumCellEnergy = -1000000000.0
        theCaloTopoTowerAlgorithm.MinimumClusterEnergy = -1000000000.0
        theCaloTopoTowerAlgorithm.CellEnergySignificance = -1.

        # noise tool
        theCaloTopoTowerAlgorithm.UseCaloNoiseTool = False

        ########################

        # add tool to alg . From now on theCaloClusterBuilderSW will point
        # on a COPY of the tool, so property cannot be further modified !

        theCaloTopoTowerAlgorithm += theCaloTopoTowerBuilderTool

        # 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")

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        topSequence += theCaloTopoTowerAlgorithm

        return True
Esempio n. 23
0
    def configure(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")
        from RecExConfig.ObjKeyStore import objKeyStore

        # set EDMDecodingVersion
        EDMDecodingVersion()

        # Set AODFULL for data unless it was set explicitly already
        if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource()=='data':
            TriggerFlags.AODEDMSet = 'AODFULL'
            
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        log.info("BS unpacking (TF.readBS): %d" % TriggerFlags.readBS() )
        if TriggerFlags.readBS():
            bs = ByteStreamUnpackGetter()

        xAODContainers = {}
#        if not recAlgs.doTrigger():      #only convert when running on old data
        if TriggerFlags.EDMDecodingVersion()==1:
            xaodcnvrt = xAODConversionGetter()
            xAODContainers = xaodcnvrt.xaodlist

        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
            tdt = TrigDecisionGetter()

        # TrigJetRec additions
        if rec.doWriteESD():
            objKeyStore.addStreamESD("JetKeyDescriptor","JetKeyMap")
            objKeyStore.addStreamESD("JetMomentMap","TrigJetRecMomentMap")

        if rec.doWriteAOD():
            objKeyStore.addStreamAOD("JetKeyDescriptor","JetKeyMap")
            objKeyStore.addStreamAOD("JetMomentMap","TrigJetRecMomentMap")
                    
        # ID truth
        if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \
                and rec.doTruth():
            try:
                from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \
                    TrigIDTruthMaker
                topSequence += TrigIDTruthMaker()
            except Exception:
                log.warning( "Couldn't set up the trigger ID truth maker" )
                pass

        if rec.doESD() or rec.doAOD():
            from TrigEDMConfig.TriggerEDM import getTrigIDTruthList
            objKeyStore.addManyTypesStreamESD(getTrigIDTruthList(TriggerFlags.ESDEDMSet()))
            objKeyStore.addManyTypesStreamAOD(getTrigIDTruthList(TriggerFlags.AODEDMSet()))

        if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData():
            objKeyStore.addManyTypesStreamESD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                                               'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'])
            objKeyStore.addManyTypesStreamAOD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                                               'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'])
            log.debug("HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data.")

        if rec.doAOD() or rec.doWriteAOD():
            # schedule the RoiDescriptorStore conversion
            # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" )
            topSequence += RoiWriter()
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDM import TriggerRoiList
            objKeyStore.addManyTypesStreamAOD( TriggerRoiList )

        #Are we adding operational info objects in ESD?
        added=self._AddOPIToESD()
        if added:
            log.debug("Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data.")
        


        # ESD objects definitions
        _TriggerESDList = {}

        from TrigEDMConfig.TriggerEDM import getTriggerEDMList 
        # we have to store xAOD containers in the root file, NOT AOD,
        # if the xAOD container list is not empty
        if(xAODContainers):
            _TriggerESDList.update( xAODContainers )
        else:
            _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(),  TriggerFlags.EDMDecodingVersion()) ) 
        
        log.info("ESD content set according to the ESDEDMSet flag: %s and EDM version %d" % (TriggerFlags.ESDEDMSet() ,TriggerFlags.EDMDecodingVersion()) )

        # AOD objects choice
        _TriggerAODList = {}
        
        #from TrigEDMConfig.TriggerEDM import getAODList    
        _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(),  TriggerFlags.EDMDecodingVersion()) ) 

        log.info("AOD content set according to the AODEDMSet flag: %s and EDM version %d" % (TriggerFlags.AODEDMSet(),TriggerFlags.EDMDecodingVersion()) )

        log.debug("ESD EDM list: %s", _TriggerESDList)
        log.debug("AOD EDM list: %s", _TriggerAODList)
        
        # Highlight what is in AOD list but not in ESD list, as this can cause
        # the "different number of entries in branch" problem, when it is in the
        # AOD list but the empty container per event is not created
        # Just compares keys of dicts, which are the class names, not their string keys in StoreGate
        not_in = [ element for element in  _TriggerAODList if element not in _TriggerESDList ]
        if (len(not_in)>0):
            log.warning("In AOD list but not in ESD list: ")
            log.warning(not_in)
        else:
            log.info("AOD list is subset of ESD list - good.")


        def _addSlimming(stream, thinningSvc, edm):
            from AthenaCommon.AlgSequence import AlgSequence 
            topSequence = AlgSequence()
            from TrigNavTools.TrigNavToolsConf import HLT__StreamTrigNavSlimming, HLT__TrigNavigationSlimming
            from TrigNavTools.TrigNavToolsConfig import navigationSlimming

            edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names
          
            # from HLT result drop unrecorded features
            # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream)
            slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream)
            tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', 
                                                          'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT',
                                                          'features':edmlist})
            #tHLT.SlimmingTool.OutputLevel=DEBUG
            tHLT.ActInPlace=True
            slimmerHLT.ThinningTool = tHLT
            print slimmerHLT.ThinningTool
            topSequence += slimmerHLT
            log.info("Configured slimming of HLT")
            del edmlist


        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from AthenaServices.Configurables import ThinningSvc, createThinningSvc
        
        _doSlimming = True
        if _doSlimming and rec.readRDO() and rec.doWriteAOD():
            if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs
                svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD'])             
            _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")
            
        if _doSlimming and rec.readRDO() and rec.doWriteESD(): #rec.doWriteESD() and not rec.readESD(): 
            if not  hasattr(svcMgr, 'ESDThinningSvc'):
                svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs
            _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList )                
            log.info("configured navigation slimming for ESD output")              
            



        objKeyStore.addManyTypesStreamESD( _TriggerESDList )                        
        objKeyStore.addManyTypesStreamAOD( _TriggerAODList )        
            
        return True
Esempio n. 24
0
    def configure(self):
        mlog = logging.getLogger('TileMuGetter::configure:')
        mlog.info('entering')

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

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

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

        theTileLookForMuAlg = TileLookForMuAlg()
        self._TileLookForMuAlgHandle = theTileLookForMuAlg

        # Configure TileLookForMuAlg here
        # As in TileMuId_cosmics_jobOptions.py, check also
        # jobOptions_TileMuId.py and TileMuId_jobOptions.py
        #========== TILELOOKFORMUALG ==
        theTileLookForMuAlg.CellsNames = "AllCalo"

        #=== thresholds in MeV ====================
        #  upper values are calculated considering muon with pt<=9GeV/c
        theTileLookForMuAlg.LowerTresh0MeV = 80.0
        theTileLookForMuAlg.LowerTresh1MeV = 80.0
        theTileLookForMuAlg.LowerTresh2MeV = 80.0
        theTileLookForMuAlg.LowerTreshScinMeV = 160.0
        #scintillators  in eta=+-1.1 implemented as +-A5
        # but eff/fakes still to be studied and settings to be optimized
        # tmp fix for cosmics (no rejection vs fake is needed )
        theTileLookForMuAlg.UpperTresh2MeV = [
            2370.0, 2100.0, 900.0, 1050.0, 1050.0, 1110.0, 1590.0, 1110.0,
            1050.0, 1050.0, 900.0, 2100.0, 2370.0
        ]
        theTileLookForMuAlg.UpperTresh1MeV = [
            1680.0, 1500.0, 1440.0, 1380.0, 1050.0, 390.0, 1110.0, 1860.0,
            1890.0, 1800.0, 1860.0, 1890.0, 1770.0, 1980.0, 2550.0, 2550.0,
            1980.0, 1770.0, 1890.0, 1860.0, 1800.0, 1890.0, 1860.0, 1110.0,
            390.0, 1050.0, 1380.0, 1440.0, 1500.0, 1680.0
        ]
        theTileLookForMuAlg.UpperTresh0MeV = [
            1680.0, 1380.0, 1230.0, 1140.0, 210.0, 900.0, 960.0, 840.0, 930.0,
            840.0, 840.0, 750.0, 870.0, 960.0, 1350.0, 1350.0, 960.0, 870.0,
            750.0, 840.0, 840.0, 930.0, 840.0, 960.0, 900.0, 210.0, 1140.0,
            1230.0, 1380.0, 1680.0
        ]
        #======================== patterns for the  muon search============
        # 13*6 and 30*6 values:
        #  for instance:  starting from the 7th cell in the 3rd layer
        #  check the 16th  and 17th in the 2nd layer etc.
        theTileLookForMuAlg.From3to2 = [
            5, 0, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 2, 6, 7, 0, 0, 0, 3, 7, 8, 9,
            0, 0, 3, 9, 10, 11, 0, 0, 2, 12, 13, 0, 0, 0, 2, 14, 15, 0, 0, 0,
            2, 16, 17, 0, 0, 0, 3, 18, 19, 20, 0, 0, 3, 20, 21, 22, 0, 0, 2,
            22, 23, 0, 0, 0, 5, 23, 24, 25, 26, 27, 5, 25, 26, 27, 28, 29
        ]
        theTileLookForMuAlg.From2to1 = [
            2, 1, 2, 0, 0, 0, 3, 1, 2, 3, 0, 0, 3, 2, 3, 4, 0, 0, 3, 3, 4, 5,
            0, 0, 2, 4, 5, 0, 0, 0, 1, 5, 0, 0, 0, 0, 1, 6, 0, 0, 0, 0, 1, 7,
            0, 0, 0, 0, 1, 8, 0, 0, 0, 0, 1, 9, 0, 0, 0, 0, 1, 10, 0, 0, 0, 0,
            1, 11, 0, 0, 0, 0, 1, 12, 0, 0, 0, 0, 1, 13, 0, 0, 0, 0, 1, 14, 0,
            0, 0, 0, 1, 15, 0, 0, 0, 0, 1, 16, 0, 0, 0, 0, 1, 17, 0, 0, 0, 0,
            1, 18, 0, 0, 0, 0, 1, 19, 0, 0, 0, 0, 1, 20, 0, 0, 0, 0, 1, 21, 0,
            0, 0, 0, 1, 22, 0, 0, 0, 0, 1, 23, 0, 0, 0, 0, 1, 24, 0, 0, 0, 0,
            2, 24, 25, 0, 0, 0, 3, 24, 25, 26, 0, 0, 3, 25, 26, 27, 0, 0, 3,
            26, 27, 28, 0, 0, 2, 27, 28, 0, 0, 0
        ]

        # sets output key
        theTileLookForMuAlg.TileMuTagsOutputName = 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")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTileLookForMuAlg

        return True
Esempio n. 25
0
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger('CaloCellGetter_DigiHSTruth::configure:')
        mlog.info('entering')

        doStandardCellReconstruction = True
        from CaloRec.CaloCellFlags import jobproperties

        # get handle to upstream object
        # handle tile

        if doStandardCellReconstruction:
            from LArROD.LArRODFlags import larRODFlags

        # 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("CaloCellMaker_DigiHSTruth")
        self._CaloCellMakerHandle = theCaloCellMaker

        from AthenaCommon.AppMgr import ToolSvc

        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(
                        "LArCellBuilder_DigiHSTruth")
                    theLArCellBuilder.RawChannelsName = "LArRawChannels_DigiHSTruth"
                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():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileCellBuilder
                    theTileCellBuilder = TileCellBuilder(
                        "TileCellBuilder_DigiHSTruth")
                    theTileCellBuilder.TileRawChannelContainer = "TileRawChannelCnt_DigiHSTruth"
                    theTileCellBuilder.E4prContainer = "E4prContainer2_DigiHSTruth"
                    theTileCellBuilder.MBTSContainer = "MBTSContainer2_DigiHSTruth"
                    theTileCellBuilder.TileDSPRawChannelContainer = "TileRawChannelCnt_DigiHSTruth"

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

        #
        # CaloCellContainerFinalizerTool : closing container and setting up iterators
        #

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

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

        doLArMerge = False
        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 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(
        ):
            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
            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

            ToolSvc += theLArCellEmMiscalib

            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:
            if jobproperties.CaloCellFlags.doPedestalCorr() and (
                    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())

        #
        # Correction for MinBias energy shift for MC pileup reco
        #
        doMinBiasAverage = False
        if jobproperties.CaloCellFlags.doMinBiasAverage.statusOn:
            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
            ToolSvc += theCaloCellMBAverageCorr

            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:
                    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]

        # 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()

        # 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
Esempio n. 26
0
#-----------------------------------------------------------------------------
# TAG
#-----------------------------------------------------------------------------

# for LAr EC timing stuff...
if rec.doLArg():
    include("LArCellRec/LArCollisionTime_jobOptions.py")

#Configure Algorithm to fill the tags
from EventTagRawAlgs.EventTagRawAlgsConf import *
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
risftwriter = RawInfoSummaryForTagWriter()

if rec.doInDet():
    risftwriter.IDTrackKey = InDetKeys.Tracks()

#MBTS threshold
risftwriter.MBTS_Threshold = (60.0 / 222.0)

topSequence += risftwriter

# store the object in the ESD
from RecExConfig.ObjKeyStore import objKeyStore
objKeyStore.addStreamESD("RawInfoSummaryForTag", "RawInfoSummaryForTag")
objKeyStore.addStreamAOD("RawInfoSummaryForTag", "RawInfoSummaryForTag")
Esempio n. 27
0
#InDetESDList+=["Rec::TrackParticleContainer#FTK_TrackParticle"]
#InDetESDList+=["TrackCollection#FTK_Trk_Tracks"]
#InDetESDList+=["TrigInDetTrackCollection#FTK_LVL2_Tracks"]
#InDetESDList+=["TrackCollection#FTKConv_Trk_Tracks"]
#
#from InDetRecExample.InDetKeys import InDetKeys
#fullESDList+= CfgItemList(
#             "InDetEsd",
#             items = InDetESDList
#             )

include("RecExCond/RecExCommon_flags.py")

from RecExConfig.ObjKeyStore import objKeyStore
# FTK Add track containers
objKeyStore.addStreamESD("Rec::TrackParticleContainer", "FTK_TrackParticles")
objKeyStore.addStreamESD("TrackCollection", "FTK_Trk_Tracks")
objKeyStore.addStreamESD("TrigInDetTrackCollection", "FTK_LVL2_Tracks")
objKeyStore.addStreamESD("Rec::TrackParticleContainer",
                         "FTK_TrackParticles_Refit")
objKeyStore.addStreamESD("TrackCollection", "FTK_Trk_Tracks_Refit")
objKeyStore.addStreamESD("TrigInDetTrackCollection", "FTK_LVL2_Tracks_Refit")
# Truth related collections
objKeyStore.addStreamESD("PRD_MultiTruthCollection", "PRD_MultiTruthPixel_FTK")
objKeyStore.addStreamESD("PRD_MultiTruthCollection", "PRD_MultiTruthSCT_FTK")
objKeyStore.addStreamESD("DetailedTrackTruthCollection",
                         "FTK_Trk_Tracks_RefitDetailedTruthCollection")
objKeyStore.addStreamESD("TrackTruthCollection",
                         "FTK_Trk_Tracks_RefitTruthCollection")
objKeyStore.addStreamESD("InDet::PixelClusterContainer", "FTK_Pixel_Clusters")
objKeyStore.addStreamESD("InDet::SCT_ClusterContainer", "FTK_SCT_Cluster")
Esempio n. 28
0
    def configure(self):
        mlog = logging.getLogger('TileTTL1FromHitsGetter::configure:')
        mlog.info('entering')

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

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

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

        theTileHitToTTL1 = TileHitToTTL1()
        self._TileHitToTTL1 = theTileHitToTTL1

        # Configure TileHitToTTL1 here
        # Check TileTTL1_jobOptions.py for full configurability
        theTileHitToTTL1.TileHitContainer = "TileHitCnt"
        theTileHitToTTL1.TileInfoName = "TileInfo"

        # sets output key
        from Digitization.DigitizationFlags import digitizationFlags
        if digitizationFlags.PileUpPremixing and 'OverlayMT' in digitizationFlags.experimentalDigi(
        ):
            from OverlayCommonAlgs.OverlayFlags import overlayFlags
            theTileHitToTTL1.TileTTL1Container = overlayFlags.bkgPrefix(
            ) + self.outputKey()
            theTileHitToTTL1.TileMBTSTTL1Container = overlayFlags.bkgPrefix(
            ) + "TileTTL1MBTS"
        else:
            theTileHitToTTL1.TileTTL1Container = self.outputKey()
            theTileHitToTTL1.TileMBTSTTL1Container = "TileTTL1MBTS"

        # 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 += theTileHitToTTL1

        return True