Пример #1
0
def getRunNumberRangeForOutputMetadata():
    myRunNumber = 0
    myEndRunNumber = 2147483647 # the max run number
    from Digitization.DigitizationFlags import digitizationFlags
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    if not digitizationFlags.simRunNumber.statusOn and not athenaCommonFlags.DoFullChain:
        #---------------------------------------------------
        # Always Check for RunNumber in the first Input file
        #---------------------------------------------------
        from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
        myRunNumber = digitizationFlags.getHitFileRunNumber(athenaCommonFlags.PoolHitsInput.get_Value()[0])

    if ModifyingEventIdBySvc():
        logDigitizationWriteMetadata.info('Setting the  Digitization MetaData IOV from the IOVDbMetaDataTool')
        from AthenaCommon.AppMgr import ServiceMgr
        myRunNumber=ServiceMgr.ToolSvc.IOVDbMetaDataTool.MinMaxRunNumbers[0]
        myEndRunNumber=ServiceMgr.ToolSvc.IOVDbMetaDataTool.MinMaxRunNumbers[1]
    else :
        if myRunNumber > 0 :
            logDigitizationWriteMetadata.info('Found Run Number %s in hits file metadata.', str(myRunNumber) )
            myEndRunNumber = myRunNumber+1 # got a reasonable run number so set end run to be the next run after this one.
        else :
            logDigitizationWriteMetadata.info('Found unexpected Run Number %s in hits file metadata. Not overriding RunNumber to match hits file for this job.', str(myRunNumber) )
            myRunNumber = 0
    return myRunNumber, myEndRunNumber
def readInputFileMetadata():
    logOverlayPoolReadMetadata.info(
        "Checking for Signal Simulation MetaData...")
    import re
    import PyUtils.AthFile as af
    af.server.load_cache('digitization-afcache.ascii')

    #--------------------------------------------------
    # Check for the Run Number in the first Input file
    #--------------------------------------------------
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    from Digitization.DigitizationFlags import digitizationFlags
    digitizationFlags.simRunNumber = int(
        digitizationFlags.getHitFileRunNumber(
            athenaCommonFlags.PoolHitsInput.get_Value()[0]))

    sigsimdict, sigtaginfodict, result = buildDict(
        "Signal",
        athenaCommonFlags.PoolHitsInput.get_Value()[0])
    if result:
        signalMetaDataCheck(sigsimdict)

        ## Check Pileup Simulation Parameters match those used for signal files
        result = True
        longpileuptype = "pre-mixed pile-up"
        logOverlayPoolReadMetadata.info(
            "Checking %s MetaData against Signal Simulation MetaData...",
            longpileuptype)
        pileupsimdict, pileuptaginfodict, result = buildDict(
            longpileuptype,
            athenaCommonFlags.PoolRDOInput.get_Value()[0])
        if not result:
            logOverlayPoolReadMetadata.warning(
                "Failed to Create %s Simulation MetaData Dictionary from file %s.",
                longpileuptype, pileupfile)
        else:
            if pileupMetaDataCheck(sigsimdict, pileupsimdict):
                logOverlayPoolReadMetadata.info(
                    "Pre-mixed RDO File Simulation MetaData matches Signal Simulation MetaData."
                )
            if tagInfoMetaDataCheck(sigtaginfodict, pileuptaginfodict):
                logOverlayPoolReadMetadata.info(
                    "Pre-mixed RDO File TagInfo MetaData matches Signal TagInfo MetaData."
                )
        ## All checks completed here
        logOverlayPoolReadMetadata.info(
            "Completed all checks against Signal Simulation MetaData.")
    else:
        logOverlayPoolReadMetadata.info(
            "Failed to Create Signal MetaData Dictionaries from file %s",
            athenaCommonFlags.PoolHitsInput.get_Value()[0])

    ## control where metadata can be used
    del sigsimdict
    del sigtaginfodict
    del pileupsimdict
    del pileuptaginfodict
Пример #3
0
def readHITSFileMetadata():
    logDigitizationReadMetadata.info("Checking for Signal Simulation MetaData...")
    import PyUtils.AthFile as af
    af.server.load_cache('digitization-afcache.ascii')

    #--------------------------------------------------
    # Check for the Run Number in the first Input file
    #--------------------------------------------------
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    from Digitization.DigitizationFlags import digitizationFlags
    if digitizationFlags.dataRunNumber.statusOn :
        #if we're overriding the run number we need to keep track
        # of the HIT file run number - may as well read it here
        digitizationFlags.simRunNumber = int(digitizationFlags.getHitFileRunNumber(athenaCommonFlags.PoolHitsInput.get_Value()[0]))

    metadatadict,result = buildDict("Signal", athenaCommonFlags.PoolHitsInput.get_Value()[0])
    if result :
        signalMetaDataCheck(metadatadict)

        ## Check Pileup Simulation Parameters match those used for signal files
        from Digitization.DigitizationFlags import digitizationFlags
        pileuptype=""
        if digitizationFlags.doLowPtMinBias() and (not skipCheck('LowPtMinBias')):
            pileuptype="LowPtMinBias"
            if pileupMetaDataCheck(pileuptype, digitizationFlags.LowPtMinBiasInputCols.get_Value()[0],metadatadict):
                logDigitizationReadMetadata.info("Low Pt Minimum Bias Simulation MetaData matches Signal Simulation MetaData.")
        if digitizationFlags.doHighPtMinBias() and (not skipCheck('HighPtMinBias')):
            pileuptype="HighPtMinBias"
            if pileupMetaDataCheck(pileuptype, digitizationFlags.HighPtMinBiasInputCols.get_Value()[0],metadatadict):
                logDigitizationReadMetadata.info("High Pt Minimum Bias Simulation MetaData matches Signal Simulation MetaData.")
        if digitizationFlags.doCavern() and (not skipCheck('cavern')):
            pileuptype="cavern"
            ## For MC11 the cavern background will use a different physics
            ## list to the signal samples, so it is necessary to override
            ## the requirement that the PhysicsLists match.
            if 'cavern_PhysicsList' not in digitizationFlags.overrideMetadata.get_Value():
                digitizationFlags.overrideMetadata += ['cavern_PhysicsList']
            if pileupMetaDataCheck(pileuptype, digitizationFlags.cavernInputCols.get_Value()[0],metadatadict):
                logDigitizationReadMetadata.info("Cavern Background Simulation MetaData matches Signal Simulation MetaData.")
        if digitizationFlags.doBeamGas() and (not skipCheck('beamgas')):
            pileuptype="beamgas"
            if pileupMetaDataCheck(pileuptype, digitizationFlags.beamGasInputCols.get_Value()[0],metadatadict):
                logDigitizationReadMetadata.info("Beam Gas Simulation MetaData matches Signal Simulation MetaData.")
        if digitizationFlags.doBeamHalo() and (not skipCheck('beamhalo')):
            pileuptype="beamhalo"
            if pileupMetaDataCheck(pileuptype, digitizationFlags.beamHaloInputCols.get_Value()[0],metadatadict):
                logDigitizationReadMetadata.info("Beam Halo Simulation MetaData matches Signal Simulation MetaData.")
        ## All checks completed here
        logDigitizationReadMetadata.info("Completed all checks against Signal Simulation MetaData.")
    else:
        logDigitizationReadMetadata.info("Failed to Create Simulation MetaData Dictionary from file %s", athenaCommonFlags.PoolHitsInput.get_Value()[0])

    del metadatadict ## control where metadata can be used