コード例 #1
0
    name="L1CALO3CaloThinningTool",
    StreamName=streamName,
    TriggerTowerLocation="xAODTriggerTowers",
    MinCaloCellET=0.8,
    MinADC=36,
    UseRandom=True,
    MinRandom=0.01)
ToolSvc += L1CALO3CaloThinningTool
thinningTools.append(L1CALO3CaloThinningTool)

#====================================================================
# Create the derivation Kernel and setup output stream
#====================================================================
# Add the derivation job to the top AthAlgSeqeuence
# DerivationJob is COMMON TO ALL DERIVATIONS
DerivationFrameworkJob = CfgMgr.AthSequencer("L1CALO3Seq")
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation
DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel(
    "DFL1CALO3_KERN",
    AugmentationTools=augmentationTools,
    SkimmingTools=skimmingTools,
    ThinningTools=thinningTools,
    OutputLevel=DEBUG)

topSequence += DerivationFrameworkJob
print DerivationFrameworkJob
print DerivationFrameworkJob.properties()

#################
### Steer output file content
#################
コード例 #2
0
def _test_main():
    import AthenaCommon.CfgMgr as CfgMgr
    from AthenaCommon.AlgSequence import AlgSequence
    job = AlgSequence()

    import PerfMonComps.DomainsRegistry as pdr
    pdr.flag_domain('core')
    job += CfgMgr.AthSequencer('alg1')
    job += CfgMgr.AthSequencer('alg2')
    job += CfgMgr.AthSequencer('alg3')
    pdr.flag_domain('id')
    job += CfgMgr.AthSequencer('alg4')
    job += CfgMgr.AthSequencer('alg5')

    pdr.flag_domain('empty')

    pdr.flag_domain('muons')
    job += CfgMgr.AthSequencer('alg6')
    job += CfgMgr.AthSequencer('alg7')

    pdr.flag_domain('empty')
    pdr.flag_domain('id')
    job += CfgMgr.AthSequencer('alg4_0')
    job += CfgMgr.AthSequencer('alg5_0')

    pdr.flag_domain('empty')
    pdr.flag_domain('jets')
    job += CfgMgr.AthSequencer('alg8')
    job += CfgMgr.AthSequencer('alg9')

    pdr.flag_domain('empty1')
    pdr.flag_domain('empty2')

    pdr.flag_domain('sub-algs-1')
    job += CfgMgr.AthSequencer('subseq_1')
    job.subseq_1 += CfgMgr.AthSequencer('subseq1_alg1')
    
    pdr.flag_domain('empty3')
    pdr.flag_domain('sub-algs-1')
    job.subseq_1 += CfgMgr.AthSequencer('subseq1_alg2')

    pdr.flag_domain('sub-algs-2')
    job += CfgMgr.AthSequencer('subseq_2')

    pdr.flag_domain('empty3')
    pdr.flag_domain('sub-algs-2')
    job.subseq_2 += CfgMgr.AthSequencer('subseq2_alg1')
    pdr.flag_domain('sub-algs-2')
    job.subseq_2 += CfgMgr.AthSequencer('subseq2_alg2')

    pdr.flag_domain('sub-algs-1')
    job.subseq_1 += CfgMgr.AthSequencer('subseq1_alg3')

    # dummy:
    pdr.set_domain(domain_name='sub-algs-2',
                   alg_name='subseq2_alg2')
    
    ref = {
        'core' : ['alg1','alg2','alg3'],
        'id':    ['alg4','alg5','alg4_0','alg5_0'],
        'muons': ['alg6','alg7'],
        'empty': [],
        'empty1': [],
        'empty2': [],
        'jets': ['alg8','alg9'],
        'sub-algs-1': ['subseq_1'],
        'sub-algs-2': ['subseq_2'],
        }

    print("=== algs:",[c.getName() for c in job.getChildren()])
    print("=== domains:",pdr.domain_names())
    assert sorted(pdr.domain_names()) == \
           sorted(['core', 'id', 'muons',
                   #'empty', 'empty1', 'empty2',
                   'jets',
                   'sub-algs-1',
                   'sub-algs-2',
                   ])
    for d in pdr.domain_names():
        print("::: domain [%s]..." % d)
        #print(" ->",pdr.domain_start(d))
        algs = pdr.domain_algs(d)
        print("    algs:",algs)
        print("    ref: ",ref[d])
        assert algs == ref[d]

    db = pdr.a2d_db()
    db = pdr.d2a_db()
    
    print("OK")
    return 0
コード例 #3
0
pfotool = CfgMgr.CP__RetrievePFOTool('MET_PFOTool')
from AthenaCommon.AppMgr import ToolSvc
ToolSvc += pfotool

trkseltool = CfgMgr.InDet__InDetTrackSelectionTool(CutLevel="TightPrimary")
ToolSvc += trkseltool

assocAlg = CfgMgr.met__METAssocAlg('METAssocAlg',
                                   PFOTool=pfotool,
                                   TrackSelectorTool=trkseltool)

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
from GaudiSequencer.PyComps import PyEvtFilter
filterseq = CfgMgr.AthSequencer('AthFilterSeq')
#the following lines are examples, pick one...
#filterseq += PyEvtFilter(evt_list=[1980130,287866,1706011,2226793,146377,146604,1904442,1297008,1298451,1072953]) #will execute main sequence only for these eventnumbers
#filterseq += PyEvtFilter(evt_list=[1108077])
filterseq += metAlg
filterseq += assocAlg
filterseq += utilAlg
filterseq += makerAlg

if verbose:
    metAlg.OutputLevel = VERBOSE
    assocAlg.OutputLevel = VERBOSE
    makerAlg.OutputLevel = VERBOSE
    metMaker.OutputLevel = VERBOSE
    cfg_mrf.builders['Ele'].OutputLevel = VERBOSE
    cfg_mrf.builders['Gamma'].OutputLevel = VERBOSE
コード例 #4
0
def CreateCutFlowSvc(svcName="CutFlowSvc",
                     athFile=None,
                     seq=None,
                     addAlgInPlace=False,
                     addMetaDataToAllOutputFiles=True,
                     SGkey="CutBookkeepers"):
    """
    Helper to create the CutFlowSvc, extract the needed information from
    the input file, and also schedule all the needed stuff.
    """
    # Create a message logger
    from AthenaCommon.Logging import logging
    msg = logging.getLogger("Create" + svcName)

    # Get the service manager
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr

    # Determine current input stream name
    inputStreamName = GetCurrentStreamName(msg=msg, athFile=athFile)
    msg.debug("CreateCutFlowSvc: Have inputStreamName = %s" %
              (inputStreamName))

    # Create the CutFlowSvc instance(s)
    import AthenaCommon.CfgMgr as CfgMgr
    if not hasattr(svcMgr, "CutFlowSvc"): svcMgr += CfgMgr.CutFlowSvc()
    svcMgr.CutFlowSvc.InputStream = inputStreamName
    #if not hasattr(svcMgr,"FileCutFlowSvc"): svcMgr += CfgMgr.FileCutFlowSvc()
    #svcMgr.FileCutFlowSvc.InputStream   = inputStreamName

    # Make sure MetaDataSvc is ready
    if not hasattr(svcMgr, 'MetaDataSvc'):
        from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import MetaDataSvc
        svcMgr += MetaDataSvc("MetaDataSvc")

    # Add BookkeeperTools
    from EventBookkeeperTools.EventBookkeeperToolsConf import BookkeeperTool

    # Standard event bookkeepers
    inname = "CutBookkeepers"
    outname = "FileBookkeepers"
    cutflowtool = BookkeeperTool(outname,
                                 InputCollName=inname,
                                 OutputCollName=outname)
    svcMgr.ToolSvc += cutflowtool

    # Add tool to MetaDataSvc
    svcMgr.MetaDataSvc.MetaDataTools += [cutflowtool]

    # Add pdf sum of weights counts if appropriate
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.DataSource() == 'geant4':
        #from PyUtils import AthFile
        #afc = AthFile.fopen( svcMgr.EventSelector.InputCollections[0] )

        # PDF
        name = "PDFSumOfWeights"
        pdfweighttool = BookkeeperTool(name,
                                       OutputCollName=name,
                                       InputCollName=name)
        svcMgr.ToolSvc += pdfweighttool

        # Add tool to MetaDataSvc
        svcMgr.MetaDataSvc.MetaDataTools += [pdfweighttool]

    # Check if we have a sequence given
    if not seq:
        # Fetch the AthAlgSeq, i.e., one of the existing master sequences where one should attach all algorithms
        seq = CfgMgr.AthSequencer("AthAlgSeq")
        pass

    # First of all, schedule EventCounterAlg
    if not hasattr(seq, "AllExecutedEvents"):
        if not seq.isLocked():
            if addAlgInPlace:
                msg.debug(
                    "Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s"
                    % seq.getName())
                seq += CfgMgr.EventCounterAlg("AllExecutedEvents")
                pass
            else:
                # Need to schedule it after the xAODMaker::EventInfoCnvAlg such that xAOD::EventInfo is present
                index = 0
                if hasattr(seq, "xAODMaker::EventInfoCnvAlg"):
                    for alg in seq:
                        index += 1
                        if alg.getName() == "xAODMaker::EventInfoCnvAlg": break
                        pass
                    pass
                msg.debug(
                    "Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s at position %i"
                    % (seq.getName(), index))
                seq.insert(index, CfgMgr.EventCounterAlg("AllExecutedEvents"))
                pass
            pass
        else:
            msg.info(
                "Could NOT add EventCounterAlg with name AllExecutedEvents to locked sequence with name %s"
                % seq.getName())
            pass
        pass

    # If wanted, add the meta-data to all output files
    if addMetaDataToAllOutputFiles:
        msg.debug(
            "Adding CutBookkeepers the the output meta data of all output streams"
        )
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        # Explicitely add file metadata from input and from transient store,
        # but only the ones that we always create.
        MSMgr.AddMetaDataItemToAllStreams("xAOD::CutBookkeeperContainer#" +
                                          SGkey)
        MSMgr.AddMetaDataItemToAllStreams("xAOD::CutBookkeeperAuxContainer#" +
                                          SGkey + "Aux.*")
        MSMgr.AddMetaDataItemToAllStreams(
            "xAOD::CutBookkeeperContainer#Incomplete" + SGkey)
        MSMgr.AddMetaDataItemToAllStreams(
            "xAOD::CutBookkeeperAuxContainer#Incomplete" + SGkey + "Aux.*")
        SGkey = "FileBookkeepers"
        MSMgr.AddMetaDataItemToAllStreams("xAOD::CutBookkeeperContainer#" +
                                          SGkey)
        MSMgr.AddMetaDataItemToAllStreams("xAOD::CutBookkeeperAuxContainer#" +
                                          SGkey + "Aux.*")
        MSMgr.AddMetaDataItemToAllStreams(
            "xAOD::CutBookkeeperContainer#Incomplete" + SGkey)
        MSMgr.AddMetaDataItemToAllStreams(
            "xAOD::CutBookkeeperAuxContainer#Incomplete" + SGkey + "Aux.*")
        pass

    return
コード例 #5
0
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
# AODFix object, for checking whether it ran or not

import os
if "AthAnalysisBase" not in os.environ.get("CMTEXTRATAGS", ""):
    from AODFix.AODFix import *

# Trap for ROOT6 errors
theApp.CreateSvc += ["AthROOTErrorHandlerSvc"]

# Trigger navigation slimming
#from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimmingTool, TrigNavigationThinningTool, HLT__StreamTrigNavSlimming
#from TrigNavTools.TrigNavToolsConfig import navigationSlimming

# Sequence for the AuxStoreWrappers (for slimming)
AuxStoreWrapperSequence = CfgMgr.AthSequencer("AuxStoreWrapperSequence")

# DerivationJob is COMMON TO ALL DERIVATIONS
DerivationFrameworkJob = AlgSequence()

# Aux store wrapper for expansion-to-dynamic. This is only used now for
# a handful of container types, defined in ContainersForExpansion.py
DerivationFrameworkJob += AuxStoreWrapperSequence

# Special sequence run after the algsequence
# Being used here to reset ElementLinks
#if AODFix_willDoAODFix(): This flag doesn't work so commented for now
athOutSeq = CfgMgr.AthSequencer("AthOutSeq")
athOutSeq += CfgMgr.xAODMaker__ElementLinkResetAlg("ELReset")

from RecExConfig.InputFilePeeker import inputFileSummary
コード例 #6
0
    # Print a message what TruthParticleContainer is found
    if AODSelectFlags.truthParticleContainer() == "":
        logAODSelect_setupOptions.warning(
            "No TruthParticleContainer found even though the input file is simulation!"
        )
        pass
    else:
        logAODSelect_setupOptions.debug( "Found the TruthParticleContainer with name: %s" \
                                         % AODSelectFlags.truthParticleContainer() )
        pass
    pass

# =============================================================================
# Create the AODSelect sequence
# =============================================================================
AODSelectSeq = CfgMgr.AthSequencer("AODSelectSeq")
topSequence += AODSelectSeq

# Add all requested filtering algorithms to the new AODSelect sequece
for _alg in AODSelectFlags.preFilterSequence():
    try:
        if _alg.getGaudiType() == 'Algorithm':
            logAODSelect_setupOptions.info(
                "Adding algorithm %s to AODSelectSeq sequence" %
                _alg.getFullJobOptName())
            AODSelectSeq += _alg
            pass
        else:
            logAODSelect_setupOptions.warning(
                "Could NOT add %s (which is of type %s) to AODSelectSeq sequence"
                % (_alg, _alg.getGaudiType()))
コード例 #7
0
def CreateCutFlowSvc( svcName="CutFlowSvc", seq=None, addMetaDataToAllOutputFiles=True ):
    """
    Helper to create the CutFlowSvc, extract the needed information from
    the input file, and also schedule all the needed stuff.
    """
    # Create a message logger
    from AthenaCommon.Logging import logging
    msg = logging.getLogger( "Create"+svcName )

    # Get the service manager
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr

    # Determine current input stream name
    inputStreamName = GetCurrentStreamName( msg=msg )
    msg.debug("CreateCutFlowSvc: Have inputStreamName = %s" % (inputStreamName) )

    # Create the CutFlowSvc instance
    import AthenaCommon.CfgMgr as CfgMgr
    if not hasattr(svcMgr,"CutFlowSvc"): svcMgr += CfgMgr.CutFlowSvc()
    svcMgr.CutFlowSvc.InputStream   = inputStreamName

    # Make sure MetaDataSvc is ready
    if not hasattr(svcMgr,'MetaDataSvc'):
      from AthenaServices.AthenaServicesConf import MetaDataSvc
      svcMgr += MetaDataSvc( "MetaDataSvc" )

    # Add BookkeeperTools
    from EventBookkeeperTools.EventBookkeeperToolsConf import BookkeeperTool

    # Standard event bookkeepers
    primary_name = "CutBookkeepers"
    cutflowtool = BookkeeperTool(primary_name + "Tool",
                                 InputCollName = primary_name,
                                 OutputCollName= primary_name)
    svcMgr.ToolSvc += cutflowtool

    # Add tool to MetaDataSvc
    svcMgr.MetaDataSvc.MetaDataTools += [cutflowtool]

    # Check if we have a sequence given
    if not seq :
        # Fetch the AthAlgSeq, i.e., one of the existing master sequences where one should attach all algorithms
        seq = CfgMgr.AthSequencer("AthAlgSeq")
        pass

    # First of all, schedule EventCounterAlg
    if not hasattr(seq,"AllExecutedEvents"):
        if not seq.isLocked():
            # Need to schedule it after the xAODMaker::EventInfoCnvAlg such that xAOD::EventInfo is present
            index = 0
            if hasattr( seq, "xAODMaker::EventInfoCnvAlg" ):
                for alg in seq:
                    index += 1
                    if alg.getName() == "xAODMaker::EventInfoCnvAlg": break
                    pass
                pass
            msg.debug("Adding EventCounterAlg with name AllExecutedEvents to sequence with name %s at position %i" % (seq.getName(),index))
            seq.insert( index, CfgMgr.EventCounterAlg("AllExecutedEvents") )
            pass
        else :
            msg.info("Could NOT add EventCounterAlg with name AllExecutedEvents to locked sequence with name %s" % seq.getName())
            pass
        pass

    # If wanted, add the meta-data to all output files
    if addMetaDataToAllOutputFiles:
        msg.debug("Adding CutBookkeepers the the output meta data of all output streams")
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        # Explicitely add file metadata from input and from transient store,
        # but only the ones that we always create.
        MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#"+primary_name )
        MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#"+primary_name+"Aux.*" )
        MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperContainer#Incomplete"+primary_name )
        MSMgr.AddMetaDataItemToAllStreams( "xAOD::CutBookkeeperAuxContainer#Incomplete"+primary_name+"Aux.*" )
        pass

    return
コード例 #8
0
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
# AODFix object, for checking whether it ran or not

import os
if "AthAnalysisBase" not in os.environ.get("CMTEXTRATAGS", ""):
    from AODFix.AODFix import *

# Trap for ROOT6 errors
theApp.CreateSvc += ["AthROOTErrorHandlerSvc"]

# Trigger navigation slimming
#from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimmingTool, TrigNavigationThinningTool, HLT__StreamTrigNavSlimming
#from TrigNavTools.TrigNavToolsConfig import navigationSlimming

# Sequence for the AuxStoreWrappers (for slimming)
AuxStoreWrapperSequence = CfgMgr.AthSequencer("AuxStoreWrapperSequence")

# DerivationJob is COMMON TO ALL DERIVATIONS
DerivationFrameworkJob = AlgSequence()
DerivationFrameworkJob += AuxStoreWrapperSequence

# Special sequence run after the algsequence
# Being used here to reset ElementLinks

# Commenting out for branch at 00-03-56
#if AODFix_willDoAODFix():
#if True: # Temporary replacment for above line, while this function makes it into release 20.7
#	athOutSeq = CfgMgr.AthSequencer("AthOutSeq")
#	athOutSeq += CfgMgr.xAODMaker__ElementLinkResetAlg( "ELReset" )

from RecExConfig.InputFilePeeker import inputFileSummary
コード例 #9
0
#
# @file     TrackCaloDecorator.py
# @author   Millie McDonald <*****@*****.**> // Main author, 2015
# @author   Joakim Olsson <*****@*****.**> // Modifications and cross-checks, 2015
# @author   Lukas Adamek < *****@*****.**> // Modifications and cross-checks, 2018 / R21
# @author   Matt LeBlanc <*****@*****.**> // Modifications, 2018 / R21
# @brief    A derivation for ATLAS Run II E/p analyses. Extrapolates all tracks to calorimeter and decorates them with cluster and cell energies.
#

# include("AthAnalysisBaseComps/SuppressLogging.py") # Optional include to suppress as much athena output as possible

#====================================================================
# SETUP TOOLS
#====================================================================
from AthenaCommon import CfgMgr
DerivationFrameworkJob = CfgMgr.AthSequencer("EoverPSeq")

# Set up stream auditor
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
if not hasattr(svcMgr, 'DecisionSvc'):
    svcMgr += CfgMgr.DecisionSvc()
svcMgr.DecisionSvc.CalcStats = True

#svcMgr.MessageSvc.OutputLevel = DEBUG #Comment this out when submitting grid jobs
svcMgr.MessageSvc.defaultLimit = 9999999

#====================================================================
# SET UP STREAM
#====================================================================
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
コード例 #10
0
        FTKRefitTrackParticleCnvAlg.AddTruthLink = True
        FTKRefitTrackParticleCnvAlg.TrackTruthContainerName = "FTK_RefitTracks_TruthCollection"
        FTKRefitTrackParticleCnvAlg.PrintIDSummaryInfo = True
        topSequence += FTKRefitTrackParticleCnvAlg

        augmentation_tools = []
        from DerivationFrameworkInDet.DerivationFrameworkInDetConf import (DerivationFramework__TrackParametersForTruthParticles)

        TruthDecor = DerivationFramework__TrackParametersForTruthParticles(
           name="TruthTPDecor",
           TruthParticleContainerName="TruthParticles",
           DecorationPrefix="")
        augmentation_tools.append(TruthDecor)

        # Set up derivation framework
        from AthenaCommon import CfgMgr
        
        theFTKseq = CfgMgr.AthSequencer("FTKSeq")
        from DerivationFrameworkCore.DerivationFrameworkCoreConf import (
            DerivationFramework__CommonAugmentation)
        
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += DerivationFramework__TrackParametersForTruthParticles('TruthTPDecor')
        theFTKseq += CfgMgr.DerivationFramework__CommonAugmentation(
          "TSOS_Kernel",
          AugmentationTools=augmentation_tools,
          OutputLevel=INFO)
        topSequence += theFTKseq


コード例 #11
0
    dumpTruthInfo = dumpTruthInfo and isIdTrkDxAODSimulation

if DRAWZSel:
    dumpTriggerInfo = True

## Other settings
# Prefix for decoration, if any
prefixName = ""

## More fine-tuning available for each tool/alg below (default value shown)

#################
### Setup tools
#################
from AthenaCommon import CfgMgr
IDDerivationSequence = CfgMgr.AthSequencer("InDetDxAOD_seq")

#Setup charge->ToT back-conversion to restore ToT info as well
from PixelCalibAlgs.PixelCalibAlgsConf import PixelChargeToTConversion
PixelChargeToTConversionSetter = PixelChargeToTConversion(
    name="PixelChargeToTConversionSetter")
IDDerivationSequence += PixelChargeToTConversionSetter
if (printIdTrkDxAODConf):
    print(PixelChargeToTConversionSetter)
    print(PixelChargeToTConversionSetter.properties())

DRAW_ZMUMU_SkimmingTool = None
if DRAWZSel:
    sel_muon1 = 'Muons.pt > 25*GeV && Muons.ptcone40/Muons.pt < 0.3 && Muons.passesIDCuts && (Muons.quality <= 2)'
    sel_muon2 = 'Muons.pt > 20*GeV && Muons.ptcone40/Muons.pt < 0.3 && Muons.passesIDCuts && (Muons.quality <= 2)'
    draw_zmumu = '( count (  DRZmumuMass > 70*GeV   &&  DRZmumuMass < 110*GeV ) >= 1 )'
コード例 #12
0
## This handels multiple output streams
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr

##======================================================================
## Write the used options to the log file
##======================================================================
if rec.OutputLevel() <= DEBUG:
    muonDPDStream_msg.info('Values of all PerfDESDM_TileMu flags:')
    print primDESDMTileMu
    pass

# ======================================================================
# Create a sub-sequence where all needed algorithms will run in
# ======================================================================
import AthenaCommon.CfgMgr as CfgMgr
desdTileMuonSequence = CfgMgr.AthSequencer('DESDM_TILEMU_Sequence',
                                          StopOverride = True )
topSequence += desdTileMuonSequence

##======================================================================
## Define the skimming for the DESDM_TILEMU output stream
##======================================================================
from PrimaryDPDMaker.LogicalFilterCombiner import LogicalFilterCombiner
from PrimaryDPDMaker.PrimaryDPDMakerConf   import PrimaryDPDPrescaler
        
from RecExConfig.ObjKeyStore import objKeyStore
muonDPDStream_msg.debug("Items in objKeyStore[transient]: %s" %  
    objKeyStore['transient'].list() )

# ----------------------------------------------------------------------
# String based reduction
# ----------------------------------------------------------------------
コード例 #13
0
ファイル: applyST.py プロジェクト: mattcleigh/Masters
# List of containers to convert to AuxContainerBase with AuxDyn variables.
# Change list if you change ApplySUSYTools inputs.

auxList = [
    "PrimaryVerticesAux.", "AntiKt4EMTopoJetsAux.", "ElectronsAux.",
    "MuonsAux.", "BTagging_AntiKt4EMTopoAux.", "AntiKt4TruthJetsAux.",
    "InDetTrackParticlesAux.", "GSFTrackParticlesAux.",
    "MuonSpectrometerTrackParticlesAux.", "MET_TrackAux.", "TauJetsAux.",
    "PhotonsAux.", "GSFConversionVerticesAux."
]

# Get the configuration manager
from AthenaCommon import CfgMgr

# Get a handle to the main athsequencer, for adding things to later!
AST99Job = CfgMgr.AthSequencer("AthAlgSeq")

# Add a tool for thinning derivations
AST99Job += CfgMgr.xAODMaker__AuxStoreWrapper("AST99AuxStoreWrapperAlg",
                                              SGKeys=auxList,
                                              OutputLevel=INFO)

###################################
# Create Output Stream and Thinning
###################################

from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
xAODStreamName = "AST99Stream"
AST99Stream = MSMgr.NewPoolRootStream(xAODStreamName, xAODFileName)

from AthenaServices.Configurables import ThinningSvc
コード例 #14
0
from AthenaCommon.GlobalFlags import jobproperties
#jobproperties.Global.DetDescrVersion="ATLAS-R2-2015-02-01-00" # For MC15a single pion logE0p2to2000 samples
jobproperties.Global.DetDescrVersion = "ATLAS-R2-2015-03-01-00"  # For MC15a single pion/electron/gamma samples

# from AthenaCommon.GlobalFlags import globalflags
# globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2015-02-01-00")

# Suggestion from Peter Loch to turn off local cluster calibration
from CaloRec.CaloTopoClusterFlags import jobproperties
jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib.set_Value_and_Lock(
    False)
from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter

# Setup MLTreeMaker algorithm
from AthenaCommon import CfgMgr
algSeq = CfgMgr.AthSequencer("AthAlgSeq")
algSeq += CfgMgr.MLTreeMaker(name="MLTreeMaker",
                             TrackContainer="InDetTrackParticles",
                             CaloClusterContainer="CaloCalTopoClusters",
                             Prefix="CALO",
                             ClusterEmin=1.0,
                             ClusterEmax=200.0,
                             EventCleaning=False,
                             Tracking=False,
                             Pileup=False,
                             EventTree=False,
                             ClusterTree=True,
                             OutputLevel=DEBUG)
algSeq.MLTreeMaker.RootStreamName = "OutputStream"

# Setup stream auditor
コード例 #15
0
from InDetPrepRawDataToxAOD.InDetPrepRawDataToxAODConf import SCT_RawDataToxAOD

xAOD_SCT_RawDataToxAOD = SCT_RawDataToxAOD(name="SCTxAOD_SCT_RawDataToxAOD")
xAOD_SCT_RawDataToxAOD.OutputLevel = INFO
if printSctDxAODConf:
    msg.info(xAOD_SCT_RawDataToxAOD)
    msg.info(xAOD_SCT_RawDataToxAOD.properties())

#################
### Setup derivation framework
#################
from AthenaCommon import CfgMgr

# DerivationJob is COMMON TO ALL DERIVATIONS
DerivationFrameworkJob = CfgMgr.AthSequencer("SCTxAOD_Seq")

# Set up stream auditor
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
if not hasattr(svcMgr, 'DecisionSvc'):
    svcMgr += CfgMgr.DecisionSvc()
svcMgr.DecisionSvc.CalcStats = True

# Add the TSOS augmentation tool to the derivation framework
augmentationTools = []

from InDetRecExample.InDetJobProperties import InDetFlags
from InDetRecExample import TrackingCommon
if not InDetFlags.disableTracking():
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackStateOnSurfaceDecorator
    DFTSOS = DerivationFramework__TrackStateOnSurfaceDecorator(
コード例 #16
0
    globalflags.DataSource = 'geant4'

globalflags.DetDescrVersion = inputFileSummary['geometry']

from AthenaCommon.DetFlags import DetFlags
DetFlags.detdescr.all_setOff()
#DetFlags.detdescr.Calo_setOn()
if hasattr(DetFlags, 'BField_on'): DetFlags.BField_setOn()
include('RecExCond/AllDet_detDescr.py')
from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from GaudiSequencer.PyComps import PyEvtFilter
filterseq = CfgMgr.AthSequencer("AthFilterSeq")
#the following lines are examples, pick one...
# filterseq += PyEvtFilter("PVSoftTrkTail", evt_list=[
#         # 106239409,
#         # 103677144,
#         # 210091212,
#         # 647377331,
#         # 649083254,
#         # 679943194,
#         # 676957592,
#         # 931088975,
#         # 930867220,
#         # 932105457,
#         # 932761543,
#         # 500249532,
#         # 498552012,
コード例 #17
0
ToolSvc += pfotool

trkseltool = CfgMgr.InDet__InDetTrackSelectionTool(CutLevel="TightPrimary")
ToolSvc += trkseltool

assocAlg = CfgMgr.met__METAssocAlg('METAssocAlg',
                                   PFOTool=pfotool,
                                   TrackSelectorTool=trkseltool)

from AthenaCommon.AlgSequence import AlgSequence

topSequence = AlgSequence()
from GaudiSequencer.PyComps import PyEvtFilter

masterSeq = CfgMgr.AthSequencer('AthMasterSeq')
#the following lines are examples, pick one...
#masterSeq += PyEvtFilter(evt_list=[1980130,287866,1706011,2226793,146377,146604,1904442,1297008,1298451,1072953]) #will execute main sequence only for these eventnumbers
#masterSeq += PyEvtFilter(evt_list=[1108077])
masterSeq += metAlg
masterSeq += assocAlg
masterSeq += utilAlg
masterSeq += makerAlg

if verbose:
    metAlg.OutputLevel = VERBOSE
    assocAlg.OutputLevel = VERBOSE
    makerAlg.OutputLevel = VERBOSE
    metMaker.OutputLevel = VERBOSE
    cfg_mrf.builders['Ele'].OutputLevel = VERBOSE
    cfg_mrf.builders['Gamma'].OutputLevel = VERBOSE
コード例 #18
0
# ============================================================================
# Check if xAOD muon collection is available
# ============================================================================
from RecExConfig.ObjKeyStore import objKeyStore
hasMuons = False

if objKeyStore.isInInput("xAOD::MuonContainer", "Muons") \
       or objKeyStore['transient'].has_item("xAOD::MuonContainer#Muons"):
    hasMuons = True
    pass

# ============================================================================
# Create a sub-sequence where all needed algorithms will run in
# ============================================================================
import AthenaCommon.CfgMgr as CfgMgr
desdAlignmentTriggerMuonSequence = CfgMgr.AthSequencer('DESDM_MSPERF_Sequence',
                                                       StopOverride=True)
topSequence += desdAlignmentTriggerMuonSequence

##============================================================================
## Define the skimming (event selection) for the DESDM_MSPERF output stream
##============================================================================
#include( "MuonIsolationTools/MuonIsolationTool_jobOptions.py" )

from PrimaryDPDMaker.LogicalFilterCombiner import LogicalFilterCombiner
from PrimaryDPDMaker.PrimaryDPDMakerConf import PrimaryDPDPrescaler

from RecExConfig.ObjKeyStore import objKeyStore
muonDPDStream_msg.debug("Items in objKeyStore[transient]: %s" %
                        objKeyStore['transient'].list())
#print "Items in objKeyStore[transient]:", objKeyStore['transient'].list()
コード例 #19
0

# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
# This way RecExCommon just needs to import the properties without doing anything else!
# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!

#--------------------------------------------------------------
# load master joboptions file
#--------------------------------------------------------------

include ("RecExCommon/RecExCommon_topOptions.py")

from AthenaCommon import CfgMgr

# DerivationJob is COMMON TO ALL DERIVATIONS
DerivationFrameworkJob = CfgMgr.AthSequencer("MySeq2")

# Set up stream auditor
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
if not hasattr(svcMgr, 'DecisionSvc'):
        svcMgr += CfgMgr.DecisionSvc()
svcMgr.DecisionSvc.CalcStats = True


# Add the track dressing alg
streamName = "TESTSTREAM_"

from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParametersForTruthParticles
TruthDecor = DerivationFramework__TrackParametersForTruthParticles( name = "TruthTPDecor",
                                                                    DecorationPrefix = streamName)
ToolSvc +=TruthDecor
コード例 #20
0
thin_trt = "(TRT_DriftCircles.bec != -2) && (TRT_DriftCircles.layer > 5)"
IDNCBThinningTool_trt = DerivationFramework__TrackMeasurementThinning(
    name="IDNCBTRTThinningTool",
    ThinningService="IDNCBThinningSvc",
    SelectionString=thin_trt,
    TrackMeasurementValidationKey="TRT_DriftCircles",
    ApplyAnd=False)
ToolSvc += IDNCBThinningTool_trt
thinningTools.append(IDNCBThinningTool_trt)

#====================================================================
# Create the derivation Kernel and setup output stream
#====================================================================
# Add the derivation job to the top AthAlgSeqeuence
# DerivationJob is COMMON TO ALL DERIVATIONS
DerivationFrameworkJob = CfgMgr.AthSequencer("IDNCBSeq")
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation
DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel(
    "DFIDNCB_KERN",
    AugmentationTools=augmentationTools,
    SkimmingTools=skimmingTools,
    ThinningTools=thinningTools,
    OutputLevel=INFO)

topSequence += DerivationFrameworkJob
if (printIdTrkDxAODConf):
    print DerivationFrameworkJob
    print DerivationFrameworkJob.properties()

#################
### Steer output file content
コード例 #21
0
from RecExConfig.RecFlags import rec

from glob import glob
filelist = glob(
    "/atlas/data1/userdata/khoo/Data16/AOD_r21/data16_13TeV.00302347.express_express.recon.AOD.r9112/*"
)

athenaCommonFlags.FilesInput = filelist
ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput()

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from GaudiSequencer.PyComps import PyEvtFilter
masterSeq = CfgMgr.AthSequencer("AthMasterSeq")
#the following lines are examples, pick one...
masterSeq += PyEvtFilter("PVSoftTrkTail",
                         evt_list=[
                             106239409,
                             103677144,
                             210091212,
                             647377331,
                             649083254,
                             679943194,
                             676957592,
                             931088975,
                             930867220,
                             932105457,
                             932761543,
                             500249532,