Пример #1
0
def checkRequiredAlgPosition(seq, momAlg, requiredAlg):
    topSeq = AlgSequence()
    
    if requiredAlg in topSeq:
        truthInd = topSeq.getChildren().index(requiredAlg)
        if momAlg in topSeq:
            index = topSeq.getChildren().index(momAlg)
        else:
            # then it is in seq, and seq must be in topSeq
            index = topSeq.getChildren().index(seq)
        # make sure requiredAlg is before index
        if truthInd > index:
            moveAlgInSequence(requiredAlg, topSeq, index)
    else:
        # will move requiredAlg in topSeq before seq and momAlg
        # where is momAlg ?
        seqInd = topSeq.getChildren().index(seq)
        if momAlg in topSeq:
            index = topSeq.getChildren().index(momAlg)
        else:
            index = seqInd
        delattr(seq, requiredAlg.getName())
        topSeq.insert(index, requiredAlg)
Пример #2
0
import AthenaCommon.CfgMgr as CfgMgr
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from TileRecUtils.TileRecFlags import jobproperties

from TileConditions.TileInfoConfigurator import TileInfoConfigurator
tileInfoConfigurator = TileInfoConfigurator()

if tileInfoConfigurator.setupCOOLDspThreshold():
    tileDigitsThresholdFilter = CfgMgr.TileDigitsThresholdFilter()
    jobproperties.TileRecFlags.TileDigitsContainer = 'TileDigitsFiltered'
    indices = [
        i for i, alg in enumerate(topSequence.getChildren())
        if alg.getType() == 'TileRawChannelMaker'
    ]
    if len(indices):
        topSequence.insert(indices[0], tileDigitsThresholdFilter)
        if hasattr(topSequence, 'TileRChMaker'):
            topSequence.TileRChMaker.TileDigitsContainer = jobproperties.TileRecFlags.TileDigitsContainer(
            )
    else:
        topSequence += tileDigitsThresholdFilter
    tileDigitsFilterLogger.info(
        "Added TileDigitsThresholdFilter algorithm to filter Tile Digits over threshold"
    )
else:
    tileDigitsFilterLogger.warn(
        "It is impossible to get Tile DSP thresholds from COOL; No Tile Digits filtering!"
    )
Пример #3
0
from AthenaCommon.AlgSequence import AlgSequence
job=AlgSequence()

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from AthenaCommon.AppMgr import ServiceMgr

# Add top algorithms to be run
from FastCaloSimHit.FastCaloSimHitConf import FastHitConv
theFastHitConv=FastHitConv("theFastHitConv")

from AthenaCommon.DetFlags import DetFlags

list = topSequence.getSequence()
topSequence.insert(list.index('LArDigitMaker/digitmaker1'), theFastHitConv) # put FastHitConv right before
                                                                            # CaloDigi in topSequence

job.theFastHitConv.OutputLevel = ALL
job.OutputLevel = INFO


from AthenaCommon.DetFlags import DetFlags

if DetFlags.pileup.LAr_on() or DetFlags.pileup.Tile_on():
    job.theFastHitConv.doPileup = True
else:
    job.theFastHitConv.doPileup = False
    

Пример #4
0
OutputLevel = INFO
doCBNT = False
EvtMax = 5

from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()
assert (job == AlgSequence())  # this is a singleton

from HeapMon.EventNotifier import EventExecutionNotifier
een = EventExecutionNotifier('EventNotifier')
een.start_scan = 1
een.stop_scan = 4

job.insert(0, een)

#DetDescrVersion="ATLAS-GEO-02-01-00"
#PoolRDOInput = [ "RDO.pool.root" ]

# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
#include ("RecExCond/RecExCommon_flags.py")
# switch off ID, calo, or muons
#DetFlags.ID_setOff()
#DetFlags.Calo_setOff()
#DetFlags.Muon_setOff()
print job

include("jobOptions.py")
#######################################################
Пример #5
0
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from AthenaCommon.AlgSequence import AlgSequence,AthSequencer

# create electron and muon selectors
sequencer = AthSequencer("HSG5ZHMETU_Sequencer",
                         StopOverride=False)

# MET selector
from D2PDMaker.D2PDMakerConf import D2PDMissingEtSelector
sequencer += D2PDMissingEtSelector( "HSG5ZHMETU_MissingEtFilter",
                                    inputCollection      = 'MET_RefFinal',
                                    outputCollection = 'HSG5ZHMETU_NeutrinoRefFinal',
                                    minNumberPassed      = 1,
                                    missingEtMin         = 40.0*Units.GeV)
                                    #missingEtSignificanceMin = 5.0)
HSG5D3PD_Stream.RequireAlgs.append("HSG5ZHMETU_MissingEtFilter")


if False:
    # (for private production only) insert in beginning of PreD3PDSequencer
    mainSequencer = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName(),
                                StopOverride = False)

    if not hasattr( topSequence, D3PDMakerFlags.PreD3PDAlgSeqName() ):
        topSequence += mainSequencer

    mainSequencer.insert(0,sequencer)

else:
    topSequence+=sequencer
 L1CaloMan0A2.DataType            = DQMonFlags.monManDataType()
 L1CaloMan0A3.FileKey             = DQMonFlags.monManFileKey()
 L1CaloMan0A3.Environment         = DQMonFlags.monManEnvironment()
 L1CaloMan0A3.ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup()
 L1CaloMan0A3.DataType            = DQMonFlags.monManDataType()
 L1CaloMan0A4.FileKey             = DQMonFlags.monManFileKey()
 L1CaloMan0A4.Environment         = DQMonFlags.monManEnvironment()
 L1CaloMan0A4.ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup()
 L1CaloMan0A4.DataType            = DQMonFlags.monManDataType()
 # Make sure we run these before RoIBResultToAOD as it also accesses
 # TriggerTowers and JetElements
 index = 0
 for alg in topSequence: 
     if alg.getName() == 'RoIBResultToAOD': break
     index += 1
 topSequence.insert(index,   L1CaloMan0A1)
 topSequence.insert(index+1, L1CaloMan0A2)
 topSequence.insert(index+2, L1CaloMan0A3)
 topSequence.insert(index+3, L1CaloMan0A4)
 L1CaloMan0B.FileKey             = DQMonFlags.monManFileKey()
 L1CaloMan0B.Environment         = DQMonFlags.monManEnvironment()
 L1CaloMan0B.ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup()
 L1CaloMan0B.DataType            = DQMonFlags.monManDataType()
 topSequence += L1CaloMan0B
 L1CaloMan1A.FileKey             = DQMonFlags.monManFileKey()
 L1CaloMan1A.Environment         = DQMonFlags.monManEnvironment()
 L1CaloMan1A.ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup()
 L1CaloMan1A.DataType            = DQMonFlags.monManDataType()
 topSequence += L1CaloMan1A
 L1CaloMan1B.FileKey             = DQMonFlags.monManFileKey()
 L1CaloMan1B.Environment         = DQMonFlags.monManEnvironment()
Пример #7
0
from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
topSequence = AlgSequence()

from AthenaCommon.DetFlags import DetFlags
if DetFlags.pileup.any_on():
    index = 0
    for alg in topSequence:
        index += 1  #count position
        if 'PileUpToolsAlg' in alg.name():
            from AthenaCommon.CfgGetter import getPrivateTool
            alg.PileUpTools += [getPrivateTool("MergeHijingParsTool")]
            break
        if 'MergeMcEventCollection' == alg.name():
            from MCTruthSimAlgs.MCTruthSimAlgsConf import MergeHijingPars
            mergeHijingPars = MergeHijingPars()
            topSequence.insert(index, mergeHijingPars)
            break
else:
    try:
        from TruthIO.TruthIOConf import PrintHijingPars
    except:
        from TruthExamples.TruthExamplesConf import PrintHijingPars
    topSequence += PrintHijingPars()

## configure Athena for POOL persistency
streamAlgs = ['StreamHITS', 'StreamRDO', 'StreamESD', 'StreamAOD']
streamSeq = AthSequencer("AthOutSeq")
for stream in streamAlgs:
    sSoutStream = getattr(streamSeq, stream, None)
    tSoutStream = getattr(topSequence, stream, None)
    if tSoutStream is not None:
Пример #8
0
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

print "Digitization jobProperties values (after FastCaloSim setup):"
#DetFlags.Print()
#GlobalFlags.Print()
#digitization.print_JobProperties()

from AthenaCommon.AppMgr import ServiceMgr

# Add top algorithms to be run
from FastCaloSimHit.FastCaloSimHitConf import FastHitConv
theFastHitConv = FastHitConv("MyFastHitConv")
#job += FastHitConv( "MyFastHitConv" )   # 1 alg, named "FastHitConv"
topSequence.insert(0, theFastHitConv)

job.MyFastHitConv.OutputLevel = ALL
job.OutputLevel = DEBUG

print topSequence

from CaloRec.CaloCellFlags import jobproperties
jobproperties.CaloCellFlags.doFastCaloSim = True
jobproperties.CaloCellFlags.doFastCaloSimNoise = False
jobproperties.CaloCellFlags.doLArCellEmMisCalib = False

from FastCaloSimHit.FastCaloCellGetter import CaloCellGetter
theCaloCellGetter = CaloCellGetter()
#jobproperties.CaloCellFlags.doFastCaloSim = False
#theCaloCellGetter._CaloCellMakerHandle.OutputLevel = 2
Пример #9
0
OutputLevel=INFO
doCBNT=False
EvtMax = 5

from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()
assert( job == AlgSequence() )     # this is a singleton

from HeapMon.EventNotifier import EventExecutionNotifier
een =EventExecutionNotifier('EventNotifier')
een.start_scan = 1 
een.stop_scan  = 4

job.insert(0,een) 

#DetDescrVersion="ATLAS-GEO-02-01-00"
#PoolRDOInput = [ "RDO.pool.root" ]

# DetFlags modifications are best set here (uncomment RecExCommon_flags first)
#include ("RecExCond/RecExCommon_flags.py")
# switch off ID, calo, or muons
#DetFlags.ID_setOff()
#DetFlags.Calo_setOff()
#DetFlags.Muon_setOff()
print job

include ("jobOptions.py")
#######################################################
Пример #10
0
VrtSecInclusive_InDet = VrtSecInclusive("VrtSecInclusive_InDet")
VrtSecInclusive_leptons = VrtSecInclusive("VrtSecInclusive_leptons")

try:
    end_idx = [_.getName() for _ in topSequence].index('StreamESD')
except ValueError:
    try:
        end_idx = [_.getName() for _ in topSequence].index('StreamAOD')
    except ValueError:
        local_logger = logging.getLogger('VrtSecInclusive_DV_Configuration')
        local_logger.warning(
            'Neither StreamESD nor StreamAOD found, VrtSecInclusive algs will be scheduled one before end of topSequence. Probably wrong!'
        )
        end_idx = -1
        del local_logger
topSequence.insert(end_idx, VrtSecInclusive_InDet)
topSequence.insert(end_idx, VrtSecInclusive_leptons)
del end_idx

# set options for vertexing
VrtSecInclusive_InDet.do_PVvetoCut = True
VrtSecInclusive_InDet.do_d0Cut = False
VrtSecInclusive_InDet.do_z0Cut = False
VrtSecInclusive_InDet.do_d0errCut = False
VrtSecInclusive_InDet.do_z0errCut = False
VrtSecInclusive_InDet.do_d0signifCut = False
VrtSecInclusive_InDet.do_z0signifCut = False
VrtSecInclusive_InDet.doTRTPixCut = True
VrtSecInclusive_InDet.DoSAloneTRT = False
VrtSecInclusive_InDet.ImpactWrtBL = True
VrtSecInclusive_InDet.doPVcompatibilityCut = False
Пример #11
0
        # (https://its.cern.ch/jira/browse/ATLASRECTS-2769?filter=-1),
        # replace it as egamma is doing to use a C++ implementation
        pass
        # Make sure we add it before streams:
        for pos, alg in enumerate(topSequence):
            if LastCRWriter.getName() == alg.getName():
                from CaloRingerAlgs.CaloRingerLocker import CaloRingerLocker
                CRLocker = CaloRingerLocker(name = "CaloRingerLocker", \
                        doElectron = caloRingerFlags.buildElectronCaloRings(), \
                        doPhoton = caloRingerFlags.buildPhotonCaloRings(), \
                        EvtStoreName = CRMainAlg.EvtStore.getName(), \
                        MetaDataStoreName = CRMetaDataWriterAlg.MetaDataStore.getName(), \
                        CaloRingerDict = CRAlgBuilder.eventOutputs(), \
                        CaloRingerMetaDict = CRMetaDataBuilder.metaDataOutputs() \
                        )
                topSequence.insert(pos + 1, CRLocker)
                mlog.verbose(
                    "Successfully added CaloRingerLocker to TopSequence.")
                break
        else:
            treatException("Could not find CaloRingerDecorator algorithm.")
    except Exception, e:
        treatException(
            "Could not set up CaloRingerLocker. Switched off ! Reason:\n %s" %
            traceback.format_exc())

    from CaloRingerAlgs.CaloRingerLocker import CaloRingerLocker
    CaloRingerLocker.OutputLevel = RingerOutputLevel
    mlog.verbose('Changing %r output level to %s', CaloRingerLocker,
                 RingerOutputLevel)
Пример #12
0
#Customisation
CustomCuts = [[3.0, 400, 'TightPrimary'], [3.0, 500, 'TightPrimary'],
              [3.0, 800, 'TightPrimary'], [3.0, 1200, 'TightPrimary'],
              [3.0, 1000, 'Loose'], [1.5, 1000, 'TightPrimary'],
              [5.0, 1000, 'TightPrimary']]
for icut in CustomCuts:

    CustomType = icut[2] + 'z0' + str(int(10 * icut[0])) + 'Pt' + str(
        icut[1]) + 'MeV'
    print 'Building track isolation tool for type ', CustomType
    TrackIsolationCustom = xAOD__TrackIsolationTool(name='TrackIsolationTool' +
                                                    CustomType)
    TrackIsolationCustom.TrackSelectionTool.maxZ0SinTheta = float(icut[0])
    TrackIsolationCustom.TrackSelectionTool.minPt = float(icut[1])
    TrackIsolationCustom.TrackSelectionTool.CutLevel = icut[2]
    ToolSvc += TrackIsolationCustom
    isoBuilderCustom = IsolationBuilder(
        name="IsolationBuilder" + CustomType,
        CaloCellIsolationTool=None,
        CaloTopoIsolationTool=None,
        PFlowIsolationTool=None,
        TrackIsolationTool=TrackIsolationCustom,
        EgIsoTypes=[[]] if not rec.doEgamma() else ptconeList,
        MuIsoTypes=[[]] if not rec.doMuon() else ptconeList,
        CustomConfgurationName=CustomType,
        OutputLevel=3)
    topSequence.insert(index, isoBuilderCustom)

##  --postInclude 'RecJobTransforms/UseFrontier.py' RAWtoESD:'IsolationAlgs/CustomTrackIsoGetter.py'
Пример #13
0
def addTruthJetsIfNotExising(truth_jets_name) :
    '''
    Add algorithm to create the truth jets collection unless the
    collection exists already, or a truth jet finder is already running
    '''
    from RecExConfig.AutoConfiguration import IsInInputFile

    # the jet collection name does not exist in the input file
    # add a jet finder algorithm in front of the monitoring if the algorithm
    # does not yet exist.
    if not IsInInputFile('xAOD::JetContainer',truth_jets_name) :
        try :
            from RecExConfig.InputFilePeeker import inputFileSummary
            print 'DEBUG addTruthJetsIfNotExising %s not in %s [file_type=%s]' % ( truth_jets_name, inputFileSummary['eventdata_itemsDic'], inputFileSummary['file_type']  )
            if truth_jets_name in inputFileSummary['eventdata_itemsDic'] :
                return
        except :
            pass

        # Access the algorithm sequence:
        from AthenaCommon.AlgSequence import AlgSequence,AthSequencer 
        topSequence = AlgSequence()

        # extract the jet finder type and main parameter
        import re
        extract_alg=re.search('^([^0-9]+)([0-9]+)TruthJets',truth_jets_name)
        if extract_alg != None :
            alg_type=extract_alg.group(1)
            alg_param_str=extract_alg.group(2)
        else :
            alg_type='AntiKt'
            alg_param_str=4

        jet_finder_alg_name = "jetalg"+alg_type+alg_param_str+'TruthJets'

        # add the jet finder unless it exists already in the alg sequence
        from InDetPhysValDecoration import findAlg,findMonMan
        alg_pos=findAlg([jet_finder_alg_name])
        if alg_pos == None :
            from JetRec.JetRecStandard import jtm
            mon_man_index=findMonMan()

            # configure truth jet finding ?
            from JetRec.JetRecFlags import jetFlags
            jetFlags.useTruth = True
            jetFlags.useTracks = False
            jetFlags.truthFlavorTags = ["BHadronsInitial", "BHadronsFinal", "BQuarksFinal",
                                        "CHadronsInitial", "CHadronsFinal", "CQuarksFinal",
                                        "TausFinal",
                                        "Partons",
                                        ]

            # tool to create truth jet finding inputs
            truth_part_copy_name='truthpartcopy'
            dir(jtm)
            create_truth_jet_input=None
            if not hasattr(jtm,truth_part_copy_name) :

                from MCTruthClassifier.MCTruthClassifierConfig import firstSimCreatedBarcode
                from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier
                truth_classifier_name='JetMCTruthClassifier'
                if not hasattr(jtm,truth_classifier_name) :
                    from AthenaCommon.AppMgr import ToolSvc
                    if not hasattr(ToolSvc,truth_classifier_name) :
                        truthClassifier = MCTruthClassifier(name = truth_classifier_name,
                                                            barcodeG4Shift = firstSimCreatedBarcode(),
                                                            ParticleCaloExtensionTool="")
                    else :
                        truthClassifier = getattr(ToolSvc,truth_classifier_name)
                        truthClassifier.barcodeG4Shift = firstSimCreatedBarcode()
                    jtm += truthClassifier
                else :
                    truthClassifier = getattr(jtm,truth_classifier_name)
                    truthClassifier.barcodeG4Shift = firstSimCreatedBarcode()

                from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles
                create_truth_jet_input=CopyTruthJetParticles(truth_part_copy_name, OutputName="JetInputTruthParticles",
                                             MCTruthClassifier=truthClassifier)
                jtm +=create_truth_jet_input
            else :
                create_truth_jet_input=getattr(jtm,truth_part_copy_name)

            jet_finder_tool = jtm.addJetFinder(truth_jets_name,
                                               alg_type,
                                               float(alg_param_str)/10.,
                                               "truth",
                                               ptmin=5000)


            jet_tools=[]
            from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles
            jet_tools += scheduleCopyTruthParticles()
            jet_tools += [create_truth_jet_input]
            jet_tools += jtm.jetrecs

            # add the jet finder in front of the monitoring
            from JetRec.JetRecConf import JetAlgorithm
            from JetRec.JetRecConf import JetToolRunner
            jtm += JetToolRunner("jetrun",
                                 Tools=jet_tools,
                                 EventShapeTools=[],
                                 # OutputLevel = 1,
                                 Timer=jetFlags.timeJetToolRunner()
                                 )

            # jet_finder_alg = JetAlgorithm(jet_finder_alg_name, jet_tools)
            jet_finder_alg = JetAlgorithm(jet_finder_alg_name)
            # jet_finder_alg.OutputLevel = 1
            jet_finder_alg.Tools = [jtm.jetrun]

            if mon_man_index != None :
                topSequence.insert(mon_man_index,jet_finder_alg)
            else  :
                topSequence += jet_finder_alg
Пример #14
0
import JetD3PDMaker
import TrackD3PDMaker
from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation
from D3PDMakerCoreComps.ContainedVectorMultiAssociation import ContainedVectorMultiAssociation
from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject

# Ensure that TauCommonDetailsMerger is run.
from TauTools.TauToolsConf import TauCommonDetailsMerger
merg = TauCommonDetailsMerger("TauCommonDetailsMerger")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
if not merg in topSequence:
    # Make sure it goes before the d3pd algorithm.
    topSequence.insert(-1, merg)

#-----------------------------------------------------------------------------
# Tau D3PDObject Maker
#-----------------------------------------------------------------------------
TauD3PDObject = make_SGDataVector_D3PDObject("Analysis::TauJetContainer",
                                             D3PDMakerFlags.TauSGKey(), "tau_",
                                             "QcdTauD3PDObject")

#-----------------------------------------------------------------------------
# Blocks
#-----------------------------------------------------------------------------
TauD3PDObject.defineBlock(0,
                          'Kinematics',
                          EventCommonD3PDMaker.FourMomFillerTool,
                          WriteEt=True,