예제 #1
0
 def checkFileMetaData(self):
     log = logging.getLogger("TriggerConfigGetter.py")
     from RecExConfig.InputFilePeeker import inputFileSummary
     self.hasLBwiseHLTPrescalesAndL1ItemDef = True
     if rec.readESD() or rec.readAOD() or "ReadPool" in self._environment:
         self.hasLBwiseHLTPrescalesAndL1ItemDef = inputFileSummary[
             'metadata'].has_key(
                 '/TRIGGER/HLT/Prescales'
             )  # they were all added at the same time (Repro with 15.6.3.2 Prod)
     # protection against early runs
     if inputFileSummary.has_key(
             'run_number'
     ) and self._environment == "" and globalflags.DataSource(
     ) == 'data' and rec.readRDO() and any(
         [run < 134230 for run in inputFileSummary['run_number']]):
         self.hasLBwiseHLTPrescalesAndL1ItemDef = False
     if self.hasLBwiseHLTPrescalesAndL1ItemDef:
         log.info("Using LB-wise HLT prescales")
     else:
         log.info("Using run-wise HLT prescales")
예제 #2
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
예제 #3
0
        job.pool2ei.HaveXHlt = False

# if MC, check that trigger information is available in the metadata
if inputFileSummary['evt_type'][0] == "IS_SIMULATION":
    if 'metadata' not in inputFileSummary or '/TRIGGER/HLT/HltConfigKeys' not in inputFileSummary['metadata']:
        log.info ("Disable trigger processing for MC files with no trigger inside")
        job.pool2ei.DoTriggerInfo = False
        job.pool2ei.HaveHlt = False
        job.pool2ei.HaveXHlt = False

if job.pool2ei.DoTriggerInfo:

    # we should search for 'xAOD::TrigDecision' in eventdata_items but 'zero events' files do not
    # contain eventdata_items, so we look also for 'xAOD::TriggerMenuContainer' in metadata_items
    job.pool2ei.HaveXHlt = False
    if inputFileSummary.has_key('eventdata_items') and 'xAOD::TrigDecision' \
            in [ x[0] for x in inputFileSummary['eventdata_items'] ]:
        job.pool2ei.HaveXHlt = True
    if inputFileSummary.has_key('metadata_items') and 'xAOD::TriggerMenuContainer' \
            in [ x[0] for x in inputFileSummary['metadata_items'] ]:
        job.pool2ei.HaveXHlt = True

    from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
    trigcfg = TriggerConfigGetter("ReadPool")

    # ensure that /TRIGGER/HLT/PrescaleKey is always loaded
    # it is not loaded by TriggerConfigGetter when trigger metadata is missing
    # but it should have been loaded. We need LB-wise HLT prescale key
    if trigcfg.hasLBwiseHLTPrescalesAndL1ItemDef is False and inputFileSummary['evt_type'][0] == "IS_DATA":
        from IOVDbSvc.CondDB import conddb
        conddb.addFolderWithTag("TRIGGER", "/TRIGGER/HLT/PrescaleKey", "HEAD")
예제 #4
0
ElectronIsEMSelectorLoose = ConfiguredAsgElectronIsEMSelector("ElectronIsEMSelectorLoose",   egammaPID.ElectronIDLoosePP)
ToolSvc += ElectronIsEMSelectorLoose

#Medium
ElectronIsEMSelectorMedium = ConfiguredAsgElectronIsEMSelector("ElectronIsEMSelectorMedium", egammaPID.ElectronIDMediumPP)
ToolSvc += ElectronIsEMSelectorMedium

#Tight
ElectronIsEMSelectorTight = ConfiguredAsgElectronIsEMSelector("ElectronIsEMSelectorTight",   egammaPID.ElectronIDTightPP)
ToolSvc += ElectronIsEMSelectorTight

########### Electron Isolation options ################

from RecExConfig.InputFilePeeker import inputFileSummary
isSimulation = False
if inputFileSummary.has_key("evt_type"):
	eventTypeList = inputFileSummary.get("evt_type")
	if eventTypeList.__contains__("IS_SIMULATION") :
		print "ElectronTagTool: Detected that the input file is a simulated dataset"
		isSimulation = True
	else:
		print "ElectronTagTool: Detected that the input file is real data"
		pass

IsolationCorrectionTool          = CfgMgr.CP__IsolationCorrectionTool( "ElectronIsolationCorrectionTool" )
IsolationCorrectionTool.IsMC     = isSimulation
ToolSvc += IsolationCorrectionTool

LooseTrackOnlyIsoTool            = CfgMgr.CP__IsolationSelectionTool( "ElectronLooseTrackOnlyIsolationSelectionTool" )
LooseTrackOnlyIsoTool.ElectronWP = "LooseTrackOnly"
ToolSvc += LooseTrackOnlyIsoTool
예제 #5
0
include.block("TriggerTier0/TriggerConfigCheckHLTpsk.py")

from AthenaCommon.Logging import logging
mlog = logging.getLogger('TriggerConfigCheckHLTpsk')  ## get the logger

runNumbers = []
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if len(athenaCommonFlags.BSRDOInput()) > 0:
    from RecExConfig.InputFilePeeker import inputFileSummary
    if inputFileSummary.has_key(
            'run_number'
    ):  # online monitoring does not provide a run_number in the inputFileSummary (hence the rest of this program will be skipped)
        runNumbers = inputFileSummary['run_number']

if len(runNumbers) > 0:

    #from RecExConfig.RecAlgsFlags import recAlgs
    #from RecExConfig.RecFlags import rec
    from TriggerJobOpts.TriggerFlags import TriggerFlags

    ### Loop over the input files and find if a problematic one is there.
    ### If so, turn off the trigger.
    from PyCool import cool
    from CoolConvUtilities.AtlCoolLib import indirectOpen
    import PyUtils.AthFile as AthFile

    # get connection to COOL and find the HLT ps key

    from IOVDbSvc.CondDB import conddb
    coolDbConn = indirectOpen("COOLONL_TRIGGER/%s" % conddb.dbdata,
                              oracle=True)
예제 #6
0
def ConfigureInputType():
    from RecExConfig.InputFilePeeker import inputFileSummary
    from AthenaCommon.GlobalFlags import globalflags
    streamsName = []
    if inputFileSummary['file_type'] == 'bs':
        #byte stream
        logAutoConfiguration.info("Input BS detected")
        globalflags.InputFormat = 'bytestream'
        rec.readRDO = True
        rec.readESD = False
        rec.readAOD = False
        rec.doAOD = False
        rec.doESD = True
        rec.doWriteAOD = False
        logAutoConfiguration.info(
            "BS format: setting globalflags.InputFormat=%s " %
            globalflags.InputFormat())
        logAutoConfiguration.info("BS format: setting rec.readRDO=%s " %
                                  rec.readRDO())
        logAutoConfiguration.info("BS format: setting rec.doAOD=%s " %
                                  rec.doAOD())
        logAutoConfiguration.info("BS format: setting rec.doESD=%s " %
                                  rec.doESD())
        logAutoConfiguration.info("BS format: setting rec.doWriteAOD=%s " %
                                  rec.doWriteAOD())
    else:
        globalflags.InputFormat = 'pool'
        #Get streamsName
        streamsName = []
        if inputFileSummary.has_key('stream_names'):
            streamsName = inputFileSummary['stream_names']
        if streamsName == None:
            streamsName = []
        logAutoConfiguration.info("Extracted streams %s from input file " %
                                  streamsName)

        if len(streamsName) == 0:
            logAutoConfiguration.warning(
                "ConfigureInputType: no stream in input file.")
        elif len(streamsName) > 1:
            logAutoConfiguration.warning(
                "ConfigureInputType: more than one stream: %s in input file. Default action. Consider the highest one."
            )
        else:
            rec.mergingStreamName = streamsName[0]

    from RecExConfig.RecoFunctions import OverlapLists
    try:
        from PrimaryDPDMaker.PrimaryDPDFlags import listRAWtoDPD, listESDtoDPD, listAODtoDPD
    except:
        logAutoConfiguration.warning(
            "Unable to import PrimaryDPDFlags. OK for ATN tests below AtlasAnalysis, otherwise suspicious."
        )
        listRAWtoDPD = []
        listESDtoDPD = []
        listAODtoDPD = []

    ## these lines have been added to guarantee the backward compatibility for the old DPD naming convention cosmics
    try:
        from PrimaryDPDMaker.PrimaryDPDFlags import listBackwardCompatibleAODtoDPD, listBackwardCompatibleESDtoDPD
        listESDtoDPD.extend(listBackwardCompatibleESDtoDPD)
        listAODtoDPD.extend(listBackwardCompatibleAODtoDPD)
    except:
        logAutoConfiguration.warning(
            "Primary DPDMake does not support the old naming convention!!")
    ##

    if inputFileSummary['TagStreamsRef'] != None:
        logAutoConfiguration.info("Input TAG detected")
        rec.readTAG = True
        logAutoConfiguration.info("Auto configured rec.readTAG=%s " %
                                  rec.readTAG())

    from RecExConfig.RecoFunctions import ItemInListStartsWith
    if ItemInListStartsWith("StreamAOD", streamsName) or ItemInListStartsWith(
            'StreamDAOD', streamsName) or ItemInListStartsWith(
                'StreamD2AOD', streamsName) or OverlapLists(
                    streamsName, listAODtoDPD) or ItemInListStartsWith(
                        'DAOD', streamsName) or ItemInListStartsWith(
                            'D2AOD', streamsName):
        logAutoConfiguration.info("Input AOD detected")
        rec.readRDO = False
        rec.readESD = False
        rec.readAOD = True
        rec.doAOD = False
        rec.doESD = False
        logAutoConfiguration.info("setting rec.readAOD=%s " % rec.readAOD())
    elif ItemInListStartsWith(
            "StreamESD", streamsName) or ItemInListStartsWith(
                'StreamDESD', streamsName) or ItemInListStartsWith(
                    'StreamD2ESD', streamsName) or OverlapLists(
                        streamsName, listESDtoDPD) or ItemInListStartsWith(
                            'DESD', streamsName) or ItemInListStartsWith(
                                'D2ESD', streamsName):
        logAutoConfiguration.info("Input ESD detected")
        rec.readRDO = False
        rec.readESD = True
        rec.readAOD = False
        rec.doAOD = True
        rec.doESD = False
        logAutoConfiguration.info("setting rec.readESD=%s " % rec.readESD())
        logAutoConfiguration.info("setting rec.doAOD=%s " % rec.doAOD())
    elif ItemInListStartsWith("Stream1", streamsName) or ItemInListStartsWith(
            "StreamRDO", streamsName) or OverlapLists(streamsName,
                                                      listRAWtoDPD):
        logAutoConfiguration.info("Input RDO detected")
        rec.readRDO = True
        rec.readESD = False
        rec.readAOD = False
        rec.doAOD = False
        rec.doESD = True
        logAutoConfiguration.info("setting rec.readRDO=%s " % rec.readRDO())
        logAutoConfiguration.info("setting rec.doESD=%s " % rec.doESD())
    elif ItemInListStartsWith("StreamEVGEN", streamsName):
        logAutoConfiguration.info("Input EVGEN detected")
        rec.readRDO = False
        rec.readESD = False
        rec.readAOD = False
        rec.doAOD = False
        rec.doESD = False
        logAutoConfiguration.info(
            "setting all unlocked rec.readXXX and rec.doXXX to False")
    elif ItemInListStartsWith("StreamHITS", streamsName):
        logAutoConfiguration.info("Input StreamHITS detected")
    elif inputFileSummary['file_type'] != 'bs':
        raise RuntimeError("ConfigureInputType cannot handle streamsName==%s" %
                           streamsName)
    return
예제 #7
0
if "FileNameVec" not in dir():
    if 'FileName' not in dir() or FileName=="":
        FileNameVec=['']
    else:
        FileNameVec=[FileName]

if 'EvtMax' in dir():
    athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax)

athenaCommonFlags.FilesInput.set_Value_and_Lock(FileNameVec)
athenaCommonFlags.PoolESDInput.set_Value_and_Lock(FileNameVec)

from RecExConfig.InputFilePeeker import inputFileSummary

if not 'RunNumber' in dir():
    if inputFileSummary.has_key('run_number'): RunNumber = inputFileSummary['run_number'][0]
    else:                                            RunNumber = 000000


rec.AutoConfiguration=['everything']
rec.readESD.set_Value_and_Lock(True)
rec.readAOD.set_Value_and_Lock(False)
rec.doHist.set_Value_and_Lock(False)
rec.doCBNT.set_Value_and_Lock(False)
rec.doWriteTAGCOM.set_Value_and_Lock(False)
rec.doWriteTAG.set_Value_and_Lock(False)
rec.doWriteAOD.set_Value_and_Lock(False)
rec.doAOD.set_Value_and_Lock(False)
rec.doMonitoring.set_Value_and_Lock(False)
rec.doPerfMon.set_Value_and_Lock(False)
rec.doDetailedPerfMon.set_Value_and_Lock(False)