コード例 #1
0
ファイル: JetCommon.py プロジェクト: zqhsfz/DoubleBTaggingDF
def moveEDAlg(seq):
    from AthenaCommon.AlgSequence import AlgSequence

    topSequence = AlgSequence()
    edalg = topSequence.EventEtDensityTester  # get the old density calculation alg
    topSequence.remove(edalg)  # remove it from topsequence
    seq += edalg  # readd it to DerivationFrameworkJob)))
コード例 #2
0
   def test3NonTransfers( self ):
      """Verify that temporary configurables leave nothing in the catalogue"""

      from AthExHelloWorld.AthExHelloWorldConf import HelloAlg

      name = 'test3NonTransfers'
      HelloWorld = HelloAlg( name )
      HelloWorld.MyInt = 666

    # adding, using, and subsequently removing to sequence should be a no-op
      seq = AlgSequence( name + 'Sequence' )
      seq += HelloWorld
      getattr(seq,name).MyDouble = 2.71828
      exec 'del seq.%s' % name
      seq.setup()

      self.assert_( name not in JobOptionsSvc.getClients() )

      del HelloWorld

    # oddity: give locals a kick to get the frame cleaned up
      locals()

    # after complete removal of the configurable, it should be history-less
      HelloWorld = HelloAlg( name )

      self.assertRaises( AttributeError, getattr, HelloWorld, 'MyInt' )
      self.assertRaises( AttributeError, getattr, HelloWorld, 'MyDouble' )
コード例 #3
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)
コード例 #4
0
#
#Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#

if 'doHLTCaloTopo' not in dir():
    doHLTCaloTopo = True
if 'doL2Egamma' not in dir():
    doL2Egamma = True
createHLTMenuExternally = True
doWriteRDOTrigger = False
doWriteBS = False

include("TriggerJobOpts/runHLT_standalone.py")

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

# ----------------------------------------------------------------
# Setup Views
# ----------------------------------------------------------------
from AthenaCommon.CFElements import stepSeq, seqOR, findAlgorithm
from DecisionHandling.DecisionHandlingConf import RoRSeqFilter
from AthenaCommon.Constants import DEBUG
from TriggerJobOpts.TriggerFlags import TriggerFlags

topSequence.remove(findAlgorithm(topSequence, "L1Decoder"))
from L1Decoder.L1DecoderConf import L1TestDecoder
topSequence += L1TestDecoder("L1TestDecoder", OutputLevel=DEBUG)

steps = seqOR("HLTTop")
topSequence += steps
    l1caloESDMon=True
else:
    # Anything else
    l1caloRawMon=True
    l1caloESDMon=True
    
if l1caloRawMon:
    
    Offline = not athenaCommonFlags.isOnline
    isData  = (globalflags.DataSource() == "data")
    isCalo  = (rec.doCalo() and rec.doLArg() and rec.doTile())
    triggerConfigService = "TrigConf::TrigConfigSvc/TrigConfigSvc"

    #================================= Monitoring configuration ======================
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    L1CaloMan0A1 = AthenaMonManager( "L1CaloMonManager0A1" )
    L1CaloMan0A2 = AthenaMonManager( "L1CaloMonManager0A2" )
    L1CaloMan0A3 = AthenaMonManager( "L1CaloMonManager0A3" )
    L1CaloMan0A4 = AthenaMonManager( "L1CaloMonManager0A4" )
    L1CaloMan0B = AthenaMonManager( "L1CaloMonManager0B" )
    L1CaloMan1A = AthenaMonManager( "L1CaloMonManager1A" )
    L1CaloMan1B = AthenaMonManager( "L1CaloMonManager1B" )
    L1CaloMan1C = AthenaMonManager( "L1CaloMonManager1C" )
    L1CaloMan2 = AthenaMonManager( "L1CaloMonManager2" )
    L1CaloMan3 = AthenaMonManager( "L1CaloMonManager3" )
    L1CaloMan4 = AthenaMonManager( "L1CaloMonManager4" )
    L1CaloMan5 = AthenaMonManager( "L1CaloMonManager5" )
    L1CaloMan6 = AthenaMonManager( "L1CaloMonManager6" )
    L1CaloMan7 = AthenaMonManager( "L1CaloMonManager7" )
    L1CaloMan8 = AthenaMonManager( "L1CaloMonManager8" )
コード例 #6
0
    def __init__(self,
                 name,
                 seq=topSequence,
                 tuplename=None,
                 preD3PDAlgSeqName=D3PDMakerFlags.PreD3PDAlgSeqName(),
                 **kwargs):

        self.__logger = logging.getLogger("MultiReaderAlg")

        # Work around initialization order issue.
        seq.__iadd__(D3PDMakerCoreComps.DummyInitAlg(name + 'DummyInit'),
                     index=0)

        # tuple name defaults to the algorithm name.
        if tuplename == None:
            tuplename = name

        # Create the algorithm Configurable.
        D3PD__MultiReaderAlg.__init__(self,
                                      name,
                                      TupleName=tuplename,
                                      **kwargs)

        # Add to the supplied sequence.
        if seq:
            # But first, add a sequence for algorithms that should run
            # before D3PD making, if it's not already there.
            preseq = AlgSequence(preD3PDAlgSeqName)
            if not hasattr(seq, preD3PDAlgSeqName):
                seq += [preseq]

            # We don't want to do filtering in the presequence.
            preseq.StopOverride = True
            # Now set up another sequence for filtering.
            # Unlike the presequence, there should be a unique one of these
            # per algorithm.  We also need to break out an additional
            # sequence to which users can add, and to wrap the whole
            # thing in a sequence to prevent a failed filter
            # decision from stopping other algorithms.
            # Like this:
            #
            #   ALG_FilterAlgorithmsWrap (StopOverride = True)
            #     ALG_FilterAlgorithmsHolder
            #       ALG_FilterAlgorithms
            #       ALG
            #     Dummy alg, to reset filter flag
            suffix = D3PDMakerFlags.FilterAlgSeqSuffix()
            wrap = AlgSequence(name + suffix + 'Wrap', StopOverride=True)
            holder = AlgSequence(name + suffix + 'Holder')
            self.filterSeq = AlgSequence(name + suffix)
            holder += self.filterSeq
            holder += self
            wrap += holder
            wrap += PyAthena.Alg(name + 'Dummy')

            seq += wrap

        # Create a unique collection getter registry tool for this tree.
        from AthenaCommon.AppMgr import ToolSvc
        self._registry = \
           D3PDMakerCoreComps.CollectionGetterRegistryTool (self.name() +
                                                   '_CollectionGetterRegistry')
        ToolSvc += self._registry

        return
コード例 #7
0
#
# $Id$
#
# File: share/xAODTestRead_jo.py
# Author: [email protected]
# Date: May 2014
# Purpose: Test reading xAOD objects data.
#

## basic job configuration (for generator)
import AthenaCommon.AtlasUnixStandardJob

## get a handle to the default top-level algorithm sequence
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

## get a handle to the ServiceManager
from AthenaCommon.AppMgr import ServiceMgr as svcMgr

## get a handle to the ApplicationManager
from AthenaCommon.AppMgr import theApp

#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
theApp.EvtMax = 20

#--------------------------------------------------------------
# Application:
#--------------------------------------------------------------
コード例 #8
0
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration

###############################################################
## Job options file for Geant4 Tile subdetector simulations
## and to put Calibration Hits into Ntuple
##=============================================================

## Algorithm sequence
from AthenaCommon.AlgSequence import AlgSequence

topSeq = AlgSequence()

## Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL)
ServiceMgr.MessageSvc.OutputLevel = 3
ServiceMgr.MessageSvc.defaultLimit = 10000000

AthenaEventLoopMgr = Service("AthenaEventLoopMgr")
AthenaEventLoopMgr.OutputLevel = 5

## AthenaCommon flags
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
#athenaCommonFlags.PoolEvgenInput = ['/afs/cern.ch/atlas/offline/ProdData/15.6.11.3/mu_E200_eta0-60-10000.evgen.pool.root']
#athenaCommonFlags.PoolHitsOutput = "Hits.pool.root"
athenaCommonFlags.EvtMax = 3

## Detector flags
from AthenaCommon.DetFlags import DetFlags

DetFlags.ID_setOff()
DetFlags.Calo_setOn()
DetFlags.LAr_setOff()
コード例 #9
0
#!/usr/bin/env python
import sys
# a simple testing macro for the MuonEfficiencyCorrections_xAOD package in athena
#
# Usage: athena -c "FNAME='<input file>'" MuonEfficiencyCorrections_xAOD_Testing_jobOptions.py

if not "FNAME" in vars() and not "FNAME" in globals():
    print 'Usage: athena -c "FNAME=\'<input file>\'" MuonEfficiencyCorrections/MuonEfficiencyCorrections_xAOD_Testing_jobOptions.py'
    sys.exit(1)

import AthenaPoolCnvSvc.ReadAthenaPool
ServiceMgr.EventSelector.InputCollections = [ FNAME ]

# Access the algorithm sequence:
from AthenaCommon.AlgSequence import AlgSequence
theJob = AlgSequence()

#the ToolHandle constructor should be given "CP::PileupReweightingTool/myTool" as its string argument
PRWTool = CfgMgr.CP__PileupReweightingTool("MyPRWTool",
                DataScaleFactor=1.0/1.09,
                DataScaleFactorUP=1., 
                DataScaleFactorDOWN=1.0/1.18,
                ConfigFiles=["/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root"],
                LumiCalcFiles=["/afs/cern.ch/atlas/project/muon/mcp/PRWFiles/ilumicalc_histograms_data15_13TeV.periodAllYear_DetStatus-v79-repro20-02_DQDefects-00-02-02_PHYS_StandardGRL_All_Good_25ns.root", "/afs/cern.ch/atlas/project/muon/mcp/PRWFiles/ilumicalc_histograms_data16_13TeV.periodAllYear_DetStatus-v83-pro20-15_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.root"])
ToolSvc += PRWTool

CustomInputDir = ""

# Add the MCP tool
from MuonEfficiencyCorrections.MuonEfficiencyCorrectionsConf import CP__MuonEfficiencyScaleFactors
tool = CP__MuonEfficiencyScaleFactors("MyMCPTool")
コード例 #10
0
def CaloExtensionBuilder(cutLevel="TightPrimary", minPT=100.0):
    try:
        from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
        from TrackToCalo.TrackToCaloConf import Trk__ParticleCaloExtensionTool
    except:
        mlog.error(
            "could not import TrackToCaloConf.Trk__ParticleCaloExtensionTool")
        mlog.error("could not import TrkExTools.AtlasExtrapolator")
        mlog.error(traceback.format_exc())
    try:
        from TrackToCalo.TrackToCaloConf import Trk__CaloExtensionBuilderAlg as CaloExtensionBuilderAlg
    except:
        mlog.error(
            "could not import TrackToCaloConf.Trk__CaloExtensionBuilderAlg")
        mlog.error(traceback.format_exc())
    try:
        from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
        from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
    except:
        mlog.error(
            "could not import InDetTrackSelectionTool.InDet__InDetTrackSelectionTool"
        )
        mlog.error(traceback.format_exc())
    try:
        from AthenaCommon.AppMgr import ToolSvc
    except:
        mlog.error("could not import ToolSvc")
        mlog.error(traceback.format_exc())
    try:
        from AthenaCommon.AlgSequence import AlgSequence
    except:
        mlog.error("could not import AlgSequence")
        mlog.error(traceback.format_exc())

    topSequence = AlgSequence()

    theAtlasExtrapolator = AtlasExtrapolator(
        name="CaloExtensionBuilderAtlasExtrapolator")
    theAtlasExtrapolator.DoCaloDynamic = False  # this turns off dynamic

    pcExtensionTool = Trk__ParticleCaloExtensionTool(
        Extrapolator=theAtlasExtrapolator)
    ToolSvc += pcExtensionTool

    CaloExtensionBuilderTool = CaloExtensionBuilderAlg(
        LastCaloExtentionTool=pcExtensionTool)

    from AthenaCommon.BeamFlags import jobproperties

    TrackSelectionToolHC = InDet__InDetTrackSelectionTool(
        name="CaloExtensionBuilderTrackSelectionTool",
        minPt=minPT,
        CutLevel=cutLevel,
        minNSiHits=7
    )  # PixelHits + SCTHits + PixelDeadSensors + SCTDeadSensors

    CaloExtensionBuilderTool.TrkSelection = TrackSelectionToolHC

    ToolSvc += CaloExtensionBuilderTool.LastCaloExtentionTool

    topSequence += CaloExtensionBuilderTool

    return True
コード例 #11
0
    logDigitization_flags.error(
        'Old-style Global "%s" defined, but will be ignored in this job! Please update your jobOptions to use the corresponding jobProperty!',
        o)

#--------------------------------------------------------------
#  Run the fast sim
#--------------------------------------------------------------

print " Now do the FastSim ....."

#--------------------------------------------------------------
# FastHitConv
#--------------------------------------------------------------

from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()

# FastCaloSimPart

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
コード例 #12
0
def configureEDCorrection(tool):
    """Configure tools and algorithm for energy density correction 
     (only if doEnergyDensityCorrection = True)"""
    # Return if doEnergyDensityCorrection is false
    if not getPropertyValue(tool, 'doEnergyDensityCorrection'):
        return
    # Set OutputLevel to INFO or higher if tool has it too
    OutputLevel = min(getPropertyValue(tool, 'OutputLevel'), INFO)
    try:
        from AthenaCommon.AppMgr import ToolSvc
        from JetRec.JetRecStandard import jtm
        from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        # EMTopo (non-origin corrected) clusters
        if not hasattr(topSequence, jtm.emget.name()):
            topSequence += jtm.emget
        if not hasattr(topSequence, 'EDtpIsoCentralAlg'):
            tccc = configEventDensityTool(
                "EDtpIsoCentralTool",
                inputlabel=jtm.emget.Label,
                radius=0.5,
                AbsRapidityMin=0.0,
                AbsRapidityMax=1.5,
                OutputContainer="TopoClusterIsoCentralEventShape",
                OutputLevel=OutputLevel)
            ToolSvc += tccc
            topSequence += EventDensityAthAlg("EDtpIsoCentralAlg",
                                              EventDensityTool=tccc)

        if not hasattr(topSequence, 'EDtpIsoForwardAlg'):
            tfcc = configEventDensityTool(
                "EDtpIsoForwardTool",
                inputlabel=jtm.emget.Label,
                radius=0.5,
                AbsRapidityMin=1.5,
                AbsRapidityMax=3.0,
                OutputContainer="TopoClusterIsoForwardEventShape",
                OutputLevel=OutputLevel)
            ToolSvc += tfcc
            topSequence += EventDensityAthAlg("EDtpIsoForwardAlg",
                                              EventDensityTool=tfcc)

        if not hasattr(topSequence, 'EDtpIsoVeryForwardAlg'):
            tvfcc = configEventDensityTool(
                "EDtpIsoVeryForwardTool",
                inputlabel=jtm.emget.Label,
                radius=0.5,
                AbsRapidityMin=2.5,
                AbsRapidityMax=4.5,
                OutputContainer="TopoClusterIsoVeryForwardEventShape",
                OutputLevel=OutputLevel)
            ToolSvc += tvfcc
            topSequence += EventDensityAthAlg("EDtpIsoVeryForwardAlg",
                                              EventDensityTool=tvfcc)

        if doPFlow:
            if not hasattr(topSequence, 'EDpfIsoCentralAlg'):
                tcpf = configEventDensityTool(
                    "EDpfIsoCentralTool",
                    inputlabel=jtm.empflowget.Label,
                    radius=0.5,
                    AbsRapidityMin=0.0,
                    AbsRapidityMax=1.5,
                    OutputContainer="ParticleFlowIsoCentralEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tcpf
                topSequence += EventDensityAthAlg("EDpfIsoCentralAlg",
                                                  EventDensityTool=tcpf)

            if not hasattr(topSequence, 'EDpfIsoForwardAlg'):
                tfpf = configEventDensityTool(
                    "EDpfIsoForwardTool",
                    inputlabel=jtm.empflowget.Label,
                    radius=0.5,
                    AbsRapidityMin=1.5,
                    AbsRapidityMax=3.0,
                    OutputContainer="ParticleFlowIsoForwardEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tfpf
                topSequence += EventDensityAthAlg("EDpfIsoForwardAlg",
                                                  EventDensityTool=tfpf)

            ## Try a neutral density
            if not hasattr(topSequence, 'EDnpfIsoCentralAlg'):
                tcnpf = configEventDensityTool(
                    "EDnpfIsoCentralTool",
                    inputlabel=jtm.emnpflowget.Label,
                    radius=0.5,
                    AbsRapidityMin=0.0,
                    AbsRapidityMax=1.5,
                    OutputContainer="NeutralParticleFlowIsoCentralEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tcnpf
                topSequence += EventDensityAthAlg("EDnpfIsoCentralAlg",
                                                  EventDensityTool=tcnpf)

            if not hasattr(topSequence, 'EDnpfIsoForwardAlg'):
                tfnpf = configEventDensityTool(
                    "EDnpfIsoForwardTool",
                    inputlabel=jtm.emnpflowget.Label,
                    radius=0.5,
                    AbsRapidityMin=1.5,
                    AbsRapidityMax=3.0,
                    OutputContainer="NeutralParticleFlowIsoForwardEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tfnpf
                topSequence += EventDensityAthAlg("EDnpfIsoForwardAlg",
                                                  EventDensityTool=tfnpf)

    except Exception:
        print('\nERROR: could not get handle to ED')
        raise
コード例 #13
0

#------------------------------------------------------------------------------
def getTestMuon(input_name):

    alg = CfgMgr.Trig__TestTrigSF('%s_testTrigSF' % input_name)
    alg.inputContainerName = input_name
    alg.trigEff = muon_sf
    alg.OutputLevel = 0

    alg.outputStream = 'out'

    return alg


#------------------------------------------------------------------------------
from AthenaCommon.AlgSequence import AlgSequence
algSeq = AlgSequence()

algSeq += getTestMuon('Muons')

#------------------------------------------------------------------------------
if not hasattr(ServiceMgr, 'THistSvc'):
    from GaudiSvc.GaudiSvcConf import THistSvc
    ServiceMgr += THistSvc()

if 'outFile' not in dir():
    outFile = 'out.root'

ServiceMgr.THistSvc.Output += ["out DATAFILE='%s' OPT='RECREATE'" % outFile]
コード例 #14
0
## Job options file for Geant4 Simulations

## Algorithm sequence
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()

## Output printout level
ServiceMgr.MessageSvc.OutputLevel = INFO

from PerfMonComps.PerfMonFlags import jobproperties
jobproperties.PerfMonFlags.doMonitoring = True

## Detector flags
from AthenaCommon.DetFlags import DetFlags
DetFlags.ID_setOn()
DetFlags.LAr_setOn()
DetFlags.Tile_setOff()
DetFlags.Muon_setOff()
DetFlags.Truth_setOn()

## AthenaCommon flags
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
#athenaCommonFlags.PoolHitsOutput.set_Off()
athenaCommonFlags.PoolHitsOutput = "test.HITS.pool.root"
if 'EvtMax' not in dir():
    EvtMax = 1000
athenaCommonFlags.EvtMax = EvtMax

## Set global conditions tag
from AthenaCommon.GlobalFlags import globalflags
globalflags.ConditionsTag = "OFLCOND-RUN12-SDR-19"
コード例 #15
0
if not 'vp1InputFile' in dir(): vp1InputFiles = []

# customize the algorithm
from VP1AlgsBatch.VP1AlgsBatchConf import VP1BatchOnLatestEvent
VP1BatchOnLatestEvent.DestinationDirectory="atlasathome_test" 
VP1BatchOnLatestEvent.UseRandomVP1ConfigFile=True


from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += VP1BatchOnLatestEvent()
topSequence.TimeOut=0
コード例 #16
0
    inputAssociateToCollection='HSG5WHU_LooseElectronLinkCollection',
    deltaRMax=0.3,
    writeUserData=False)

from D2PDMaker.D2PDMakerConf import D2PDJetSelector
sequencer += D2PDJetSelector(
    "HSG5WHU_JetFilter",
    inputCollection='AntiKt4TopoEMJets',
    outputLinkCollection='HSG5WHU_JetLinkCollection',
    associationToolList=[ToolSvc.HSG5WHU_emDeltaRAssociationTool],
    outputAssociationContainerList=["HSG5WHU_jetsMatchedToElectrons"],
    numberOfAssociationsMaxCutList=[0],
    minNumberPassed=1,
    ptMin=20.0 * Units.GeV,
    etaMax=2.5)

HSG5D3PD_Stream.RequireAlgs.append("HSG5WHU_JetFilter")

if False:
    # (for private production ony) 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
コード例 #17
0
    def configure(self):
        mlog = logging.getLogger( 'LArSCL1Getter::configure:' )
        mlog.info ('entering')        

        # get handle to upstream object
        try:
            from LArL1Sim.LArSCL1Getter import LArSCL1Getter
            theLArSCL1Getter=LArSCL1Getter()
        except:
            mlog.error("could not get handle to LArSCL1Getter Quit")
            traceback.print_exc()
            return False

        if not theLArSCL1Getter.usable():
            if not self.ignoreConfigError():
                mlog.error("LArSCL1Getter unusable. Quit.")
                return False
            else:
                mlog.error("LArSCL1Getter unusable. Continue nevertheless")
                
        # Instantiation of the C++ algorithm
        try:        
            from LArL1Sim.LArL1SimConf import LArSCL1Maker                
        except:
            mlog.error("could not import LArL1Sim.LArSCL1Maker")
            traceback.print_exc()
            return False

        theLArSCL1Maker=LArSCL1Maker()
        from AthenaCommon.AppMgr import ToolSvc
        from LArRecUtils.LArAutoCorrNoiseSCToolDefault import LArAutoCorrNoiseSCToolDefault
        theLArAutoCorrNoiseSCTool = LArAutoCorrNoiseSCToolDefault()
        ToolSvc+=theLArAutoCorrNoiseSCTool
        theLArSCL1Maker.AutoCorrNoiseTool = theLArAutoCorrNoiseSCTool

        from LArRecUtils.LArADC2MeVSCToolDefault import LArADC2MeVSCToolDefault
        theLArADC2MeVSCTool = LArADC2MeVSCToolDefault()
        ToolSvc+=theLArADC2MeVSCTool
        theLArSCL1Maker.ADC2MeVTool = theLArADC2MeVSCTool

        theLArSCL1Maker.SCL1ContainerName = "LArDigitSCL1"

        self._LArSCL1Maker = theLArSCL1Maker ;

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # check if LArdigitization is run before. If yes, uses hit map from detector store produces from lardigitization
        from Digitization.DigitizationFlags import jobproperties
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.digitize.LAr_on():
            mlog.info("Using hit map from LArDigitMaker algoritm")
        else:
            mlog.info("digitmaker1 not found in topSequence, using own map in LArSCL1Maker")
            return False
        
        # now add algorithm to topSequence
        # this should always come at the end
        from IOVDbSvc.CondDB import conddb
        if ( conddb.isMC and not conddb.folderRequested('/LAR/IdentifierOfl/OnOffIdMap_SC') ) :
            conddb.addFolder("LAR_OFL","<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>/LAR/IdentifierOfl/OnOffIdMap_SC")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/fSampl') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCfSampl-000</tag>/LAR/ElecCalibMCSC/fSampl")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Pedestal') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCPedestal-000</tag>/LAR/ElecCalibMCSC/Pedestal")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Noise') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCNoise-000</tag>/LAR/ElecCalibMCSC/Noise")
        if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Shape') ) :
            conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCShape-000</tag>/LAR/ElecCalibMCSC/Shape")

        from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        if not hasattr(svcMgr,"LArFlatConditionSvc"):
           svcMgr+=LArFlatConditionSvc()
           svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ]
        svcMgr.LArFlatConditionSvc.DoSuperCells=True

        mlog.info(" now adding to topSequence")        
        topSequence += theLArSCL1Maker

        
        return True
コード例 #18
0
__doc__ = "Lock containers in ESD/AOD ItemList using the definitions from CaloRingerKeys"

import traceback

from AthenaCommon.Logging import logging
from AthenaCommon.Resilience import treatException

mlog = logging.getLogger('CaloRingerLock_joboptions')
mlog.info("Entering")

from RecExConfig.RecFlags import rec

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from CaloRingerAlgs.CaloRingerFlags import caloRingerFlags
from CaloRingerAlgs.CaloRingerKeys import CaloRingerKeysDict

# Get CaloRinger algorithm handles
from CaloRingerAlgs.CaloRingerAlgorithmBuilder import CaloRingerAlgorithmBuilder
CRAlgBuilder = CaloRingerAlgorithmBuilder()
from CaloRingerAlgs.CaloRingerMetaDataBuilder import CaloRingerMetaDataBuilder
CRMetaDataBuilder = CaloRingerMetaDataBuilder(disable=True)

if rec.doESD() and caloRingerFlags.buildCaloRingsOn() and CRAlgBuilder.usable(
):
    LastCRWriter = CRMetaDataBuilder.getLastWriterHandle()
    CRMainAlg = CRAlgBuilder.getCaloRingerAlgHandle()
    CRMetaDataWriterAlg = CRMetaDataBuilder.getMetaDataWriterHandle()
    try:
        # FIXME: It seems that the python implementation takes a lot of memory
コード例 #19
0
    def configure(self):

        mlog = logging.getLogger('TileRawChannelGetter::configure:')
        mlog.info("entering")

        # Instantiation of the C++ algorithm
        try:
            from TileRecUtils.TileRecUtilsConf import TileRawChannelMaker
            theTileRawChannelMaker = TileRawChannelMaker("TileRChMaker")
        except:
            mlog.error("could not import TileRecUtils.TileRawChannelMaker")
            print traceback.format_exc()
            return False

        self._TileRChMaker = theTileRawChannelMaker

        # Configure TileInfoLoader
        from AthenaCommon.AppMgr import ServiceMgr

        from TileConditions.TileInfoConfigurator import TileInfoConfigurator
        tileInfoConfigurator = TileInfoConfigurator()

        # register output in objKeyStore
        from RecExConfig.ObjKeyStore import objKeyStore

        from AthenaCommon.AppMgr import ToolSvc

        from TileRecUtils.TileRecFlags import jobproperties
        from TileRecUtils.TileRecUtilsConf import TileBeamInfoProvider
        theTileBeamInfoProvider = TileBeamInfoProvider()
        if hasattr(ServiceMgr, "TileDCSSvc"):
            theTileBeamInfoProvider.CheckDCS = True

        # true for real data, false for MC - GlobalFlags.DataSource.is_data()
        # true for nominal ATLAS configuration - GlobalFlags.DetGeo.is_atlas()
        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource() == 'data':
            # apply noise filter for real data (if this option was not set before)
            if jobproperties.TileRecFlags.noiseFilter() < 0:
                jobproperties.TileRecFlags.noiseFilter = 1

            if jobproperties.TileRecFlags.TileRunType() == 1:
                theTileBeamInfoProvider.TileBeamElemContainer = ""
            else:
                theTileBeamInfoProvider.TileBeamElemContainer = "TileBeamElemCnt"
            if jobproperties.TileRecFlags.readDigits():
                theTileBeamInfoProvider.TileDigitsContainer = "TileDigitsCnt"
            else:
                theTileBeamInfoProvider.TileDigitsContainer = ""
            theTileBeamInfoProvider.TileRawChannelContainer = "TileRawChannelCnt"
        else:
            theTileBeamInfoProvider.TileBeamElemContainer = ""
            theTileBeamInfoProvider.TileDigitsContainer = ""
            theTileBeamInfoProvider.TileRawChannelContainer = ""

        # set time window for amplitude correction if it was not set correctly before
        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.
            if halfBS > 25.1:
                mlog.info(
                    "Bunch spacing is too big, keeping default limits for parabolic correction"
                )
            else:
                jobproperties.TileRecFlags.TimeMinForAmpCorrection = -halfBS
                jobproperties.TileRecFlags.TimeMaxForAmpCorrection = halfBS

        ToolSvc += theTileBeamInfoProvider

        NoiseFilterTools = []
        if jobproperties.TileRecFlags.noiseFilter() == 1:

            if globalflags.DataSource() == 'data':

                # check if there are DSP thresholds in DB
                if jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits(
                ) and not tileInfoConfigurator.setupCOOLDspThreshold():
                    jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits = False

                if jobproperties.TileRecFlags.correctPedestalDifference():
                    # check if offline and there are OFCs in DB for OF1 method
                    if athenaCommonFlags.isOnline(
                    ) or not tileInfoConfigurator.setupCOOLOFC(ofcType='OF1'):
                        jobproperties.TileRecFlags.correctPedestalDifference = False
                    else:
                        tileInfoConfigurator.setupCOOLTIME(online=True)

                if jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits(
                ) or jobproperties.TileRecFlags.correctPedestalDifference():
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelOF1Corrector
                    theTileRawChannelOF1Corrector = TileRawChannelOF1Corrector(
                    )
                    theTileRawChannelOF1Corrector.CorrectPedestalDifference = jobproperties.TileRecFlags.correctPedestalDifference(
                    )
                    theTileRawChannelOF1Corrector.ZeroAmplitudeWithoutDigits = jobproperties.TileRecFlags.zeroAmplitudeWithoutDigits(
                    )

                    ToolSvc += theTileRawChannelOF1Corrector
                    NoiseFilterTools += [theTileRawChannelOF1Corrector]

            from TileRecUtils.TileRecUtilsConf import TileRawChannelNoiseFilter
            theTileRawChannelNoiseFilter = TileRawChannelNoiseFilter()
            ToolSvc += theTileRawChannelNoiseFilter
            NoiseFilterTools += [theTileRawChannelNoiseFilter]

        TileFrameLength = ServiceMgr.TileInfoLoader.NSamples
        if TileFrameLength != 7:
            mlog.info("disabling reading of OFC from COOL because Nsamples!=7")
            jobproperties.TileRecFlags.OfcFromCOOL = False

        jobproperties.TileRecFlags.print_JobProperties('tree&value')

        # run optimal filter only if readDigits is set
        if jobproperties.TileRecFlags.readDigits():

            TilePulseTypes = {0: 'PHY', 1: 'PHY', 2: 'LAS', 4: 'PHY', 8: 'CIS'}
            TilePulse = TilePulseTypes[
                jobproperties.TileRecFlags.TileRunType()]

            if (jobproperties.TileRecFlags.doTileMF()
                    or (not jobproperties.TileRecFlags.OfcFromCOOL() and
                        (jobproperties.TileRecFlags.doTileOF1()
                         or jobproperties.TileRecFlags.doTileOpt2()
                         or jobproperties.TileRecFlags.doTileOptATLAS()))):

                tileInfoConfigurator.setupCOOLPULSE(type=TilePulse)
                tileInfoConfigurator.setupCOOLAutoCr()

            elif jobproperties.TileRecFlags.doTileFitCool():
                tileInfoConfigurator.setupCOOLPULSE(type=TilePulse)

            if jobproperties.TileRecFlags.OfcFromCOOL():
                if (jobproperties.TileRecFlags.doTileMF()
                        or jobproperties.TileRecFlags.doTileOpt2()
                        or jobproperties.TileRecFlags.doTileOptATLAS()):

                    tileInfoConfigurator.setupCOOLOFC(type=TilePulse)

                if jobproperties.TileRecFlags.doTileOF1():
                    tileInfoConfigurator.setupCOOLOFC(type=TilePulse,
                                                      ofcType='OF1')

            if jobproperties.TileRecFlags.doTileQIE():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderQIEFilter
                    theTileRawChannelBuilderQIEFilter = TileRawChannelBuilderQIEFilter(
                    )
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderQIEFilter Quit"
                    )
                    print traceback.format_exc()
                    return False

                #TileRawChannelBuilderQIEFilter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelQIE"
                theTileRawChannelBuilderQIEFilter.TileRawChannelContainer = "TileRawChannelQIE"
                theTileRawChannelBuilderQIEFilter.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderQIEFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderQIEFilter.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderQIEFilter.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderQIEFilter.PedestalMode = 1

                mlog.info(
                    " adding now TileRawChannelBuilderQIEFilter to ToolSvc")
                ToolSvc += theTileRawChannelBuilderQIEFilter

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderQIEFilter
                ]

            # fit with several amplitudes
            if jobproperties.TileRecFlags.doTileManyAmps():

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

                #TileRawChannelBuilderManyAmps Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelManyAmp"
                theTileRawChannelBuilderManyAmps.TileRawChannelContainer = "TileRawChannelManyAmp"
                theTileRawChannelBuilderManyAmps.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderManyAmps.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderManyAmps.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderManyAmps.NoiseFilterTools = NoiseFilterTools

                mlog.info(
                    " adding now TileRawChannelBuilderManyAmps to ToolSvc")
                ToolSvc += theTileRawChannelBuilderManyAmps

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderManyAmps
                ]

            # flat filter - sum of 5 samples
            if jobproperties.TileRecFlags.doTileFlat():

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

                #TileRawChannelBuilderFlatFilter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFlat"
                theTileRawChannelBuilderFlatFilter.TileRawChannelContainer = "TileRawChannelFlat"
                theTileRawChannelBuilderFlatFilter.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderFlatFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderFlatFilter.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderFlatFilter.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderFlatFilter.FrameLength = TileFrameLength
                theTileRawChannelBuilderFlatFilter.SignalLength = TileFrameLength - 1

                mlog.info(
                    " adding now TileRawChannelBuilderFlatFilter to ToolSvc")
                ToolSvc += theTileRawChannelBuilderFlatFilter

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderFlatFilter
                ]

            # Fit method
            if jobproperties.TileRecFlags.doTileFit(
            ) or jobproperties.TileRecFlags.doTileOverflowFit():

                # configure TileRawChannelMaker here
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderFitFilter
                    theTileRawChannelBuilderFitFilter = TileRawChannelBuilderFitFilter(
                    )
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderFitFilter Quit"
                    )
                    print traceback.format_exc()
                    return False

                #TileRawChannelBuilderFitFilter Options:
                theTileRawChannelBuilderFitFilter.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderFitFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderFitFilter.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderFitFilter.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderFitFilter.FrameLength = TileFrameLength

                # add the tool to list of tool ( should use ToolHandle eventually)
                mlog.info(
                    " adding now TileRawChannelBuilderFitFilter to ToolSvc")
                ToolSvc += theTileRawChannelBuilderFitFilter

                if jobproperties.TileRecFlags.doTileFit():
                    jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFit"
                    theTileRawChannelBuilderFitFilter.TileRawChannelContainer = "TileRawChannelFit"
                    theTileRawChannelMaker.TileRawChannelBuilder += [
                        ToolSvc.TileRawChannelBuilderFitFilter
                    ]

                if jobproperties.TileRecFlags.doTileOverflowFit():
                    theTileRawChannelMaker.FitOverflow = True
                    theTileRawChannelMaker.TileRawChannelBuilderFitOverflow = ToolSvc.TileRawChannelBuilderFitFilter
                    mlog.info(
                        " set up TileRawChannelBuilderFitOverflow to TileRawChannelBuilderFitFilter"
                    )

            # Fit method with reading from COOL
            if jobproperties.TileRecFlags.doTileFitCool():

                # configure TileRawChannelMaker here
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderFitFilterCool
                    theTileRawChannelBuilderFitFilterCool = TileRawChannelBuilderFitFilterCool(
                    )
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderFitFilterCool Quit"
                    )
                    print traceback.format_exc()
                    return False

                #TileRawChannelBuilderFitFilterCool Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFitCool"
                theTileRawChannelBuilderFitFilterCool.TileRawChannelContainer = "TileRawChannelFitCool"
                theTileRawChannelBuilderFitFilterCool.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderFitFilterCool.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderFitFilterCool.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderFitFilterCool.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderFitFilterCool.FrameLength = TileFrameLength

                # add the tool to list of tool ( should use ToolHandle eventually)
                mlog.info(
                    " adding now TileRawChannelBuilderFitFilterCool to ToolSvc"
                )
                ToolSvc += theTileRawChannelBuilderFitFilterCool

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderFitFilterCool
                ]

            # matched filter
            if jobproperties.TileRecFlags.doTileMF():

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

                # setup COOL to get OFCs, needed for COF to retrieve pulse shape and derivatives
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderMF.TileCondToolOfc = ToolSvc.TileCondToolOfcCool

                #TileRawChannelBuilderMF Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelMF"
                theTileRawChannelBuilderMF.TileRawChannelContainer = "TileRawChannelMF"
                theTileRawChannelBuilderMF.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderMF.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                if jobproperties.TileRecFlags.BestPhaseFromCOOL(
                ):  # can't correct time and use best phase at the same time
                    theTileRawChannelBuilderMF.correctTime = False
                else:
                    theTileRawChannelBuilderMF.correctTime = jobproperties.TileRecFlags.correctTime(
                    )
                theTileRawChannelBuilderMF.BestPhase = jobproperties.TileRecFlags.BestPhaseFromCOOL(
                )
                theTileRawChannelBuilderMF.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderMF.MaxIterations = 5
                # iterative mode on
                theTileRawChannelBuilderMF.AmplitudeCorrection = False
                theTileRawChannelBuilderMF.TimeFromCOF = False
                theTileRawChannelBuilderMF.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection(
                )
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                ) > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderMF.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                    )
                    theTileRawChannelBuilderMF.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                    )

                mlog.info(" adding now TileRawChannelBuilderMF to ToolSvc")
                ToolSvc += theTileRawChannelBuilderMF

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderMF
                ]

            if jobproperties.TileRecFlags.doTileOpt():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOptFilter
                    theTileRawChannelBuilderOptFilter = TileRawChannelBuilderOptFilter(
                    )
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderOptFilter Quit"
                    )
                    print traceback.format_exc()
                    return False

                #TileRawChannelBuilderOptFilter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelOpt"
                theTileRawChannelBuilderOptFilter.TileRawChannelContainer = "TileRawChannelOpt"
                theTileRawChannelBuilderOptFilter.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderOptFilter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderOptFilter.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderOptFilter.OF2 = True
                theTileRawChannelBuilderOptFilter.PedestalMode = 1
                theTileRawChannelBuilderOptFilter.MaxIterations = 5
                theTileRawChannelBuilderOptFilter.Minus1Iteration = True
                theTileRawChannelBuilderOptFilter.AmplitudeCorrection = False
                # don't need correction after iterations
                theTileRawChannelBuilderOptFilter.TimeCorrection = False  # don't need correction after iterations

                ServiceMgr.TileInfoLoader.LoadOptFilterWeights = True

                mlog.info(
                    " adding now TileRawChannelBuilderOptFilter to ToolSvc")
                ToolSvc += theTileRawChannelBuilderOptFilter

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderOptFilter
                ]

            if jobproperties.TileRecFlags.doTileOF1():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOF1 = TileRawChannelBuilderOpt2Filter(
                        "TileRawChannelBuilderOF1")
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderOF1 Quit"
                    )
                    print traceback.format_exc()
                    return False

                # setup COOL to get OFCs
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    if hasattr(ToolSvc, 'TileCondToolOfcCoolOF1'):
                        theTileRawChannelBuilderOF1.TileCondToolOfc = ToolSvc.TileCondToolOfcCoolOF1
                    else:
                        # There are no OF1 OFC in the COOL
                        # OFC will be calculated on the fly
                        tileInfoConfigurator.setupCOOLPULSE(type=TilePulse)
                        tileInfoConfigurator.setupCOOLAutoCr()

                #TileRawChannelBuilderOF1 Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelOF1"
                theTileRawChannelBuilderOF1.TileRawChannelContainer = "TileRawChannelOF1"
                theTileRawChannelBuilderOF1.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderOF1.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                if jobproperties.TileRecFlags.BestPhaseFromCOOL(
                ):  # can't correct time and use best phase at the same time
                    theTileRawChannelBuilderOF1.correctTime = False
                else:
                    theTileRawChannelBuilderOF1.correctTime = jobproperties.TileRecFlags.correctTime(
                    )
                theTileRawChannelBuilderOF1.BestPhase = jobproperties.TileRecFlags.BestPhaseFromCOOL(
                )
                theTileRawChannelBuilderOF1.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderOF1.OF2 = False
                theTileRawChannelBuilderOF1.PedestalMode = -1
                theTileRawChannelBuilderOF1.MaxIterations = 1
                # just one iteration
                theTileRawChannelBuilderOF1.Minus1Iteration = False
                # assume that max sample is at t=0
                theTileRawChannelBuilderOF1.AmplitudeCorrection = jobproperties.TileRecFlags.correctAmplitude(
                )
                theTileRawChannelBuilderOF1.TimeCorrection = False
                theTileRawChannelBuilderOF1.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection(
                )
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                ) > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderOF1.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                    )
                    theTileRawChannelBuilderOF1.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                    )

                mlog.info(" adding now TileRawChannelBuilderOF1 to ToolSvc")
                ToolSvc += theTileRawChannelBuilderOF1

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderOF1
                ]

            if jobproperties.TileRecFlags.doTileOpt2():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOpt2Filter = TileRawChannelBuilderOpt2Filter(
                    )
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderOpt2Filter Quit"
                    )
                    print traceback.format_exc()
                    return False

                # setup COOL to get OFCs
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderOpt2Filter.TileCondToolOfc = ToolSvc.TileCondToolOfcCool

                #TileRawChannelBuilderOpt2Filter Options:
                jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelOpt2"
                theTileRawChannelBuilderOpt2Filter.TileRawChannelContainer = "TileRawChannelOpt2"
                theTileRawChannelBuilderOpt2Filter.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderOpt2Filter.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                theTileRawChannelBuilderOpt2Filter.correctTime = jobproperties.TileRecFlags.correctTime(
                )
                theTileRawChannelBuilderOpt2Filter.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderOpt2Filter.BestPhase = False
                # no point to use best phase with interations
                theTileRawChannelBuilderOpt2Filter.OF2 = True
                theTileRawChannelBuilderOpt2Filter.PedestalMode = 1
                theTileRawChannelBuilderOpt2Filter.MaxIterations = 5
                theTileRawChannelBuilderOpt2Filter.Minus1Iteration = True
                theTileRawChannelBuilderOpt2Filter.AmplitudeCorrection = False
                # don't need correction after iterations
                theTileRawChannelBuilderOpt2Filter.TimeCorrection = False
                # don't need correction after iterations

                mlog.info(
                    " adding now TileRawChannelBuilderOpt2Filter to ToolSvc")
                ToolSvc += theTileRawChannelBuilderOpt2Filter

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderOpt2Filter
                ]

            if jobproperties.TileRecFlags.doTileOptATLAS():
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawChannelBuilderOpt2Filter
                    theTileRawChannelBuilderOptATLAS = TileRawChannelBuilderOpt2Filter(
                        "TileRawChannelBuilderOptATLAS")
                except:
                    mlog.error(
                        "could not get handle to TileRawChannelBuilderOpt2Filter Quit"
                    )
                    print traceback.format_exc()
                    return False

                # setup COOL to get OFCs
                if jobproperties.TileRecFlags.OfcFromCOOL():
                    theTileRawChannelBuilderOptATLAS.TileCondToolOfc = ToolSvc.TileCondToolOfcCool

                #TileRawChannelBuilderOptATLAS Options:
                if globalflags.DataSource(
                ) == 'data':  # don't use the name which is used for reco data from DSP
                    if jobproperties.TileRecFlags.TileRawChannelContainer == "TileRawChannelCnt":
                        jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelFixed"
                    theTileRawChannelBuilderOptATLAS.TileRawChannelContainer = "TileRawChannelFixed"
                else:
                    jobproperties.TileRecFlags.TileRawChannelContainer = "TileRawChannelCnt"
                    theTileRawChannelBuilderOptATLAS.TileRawChannelContainer = "TileRawChannelCnt"
                theTileRawChannelBuilderOptATLAS.RunType = jobproperties.TileRecFlags.TileRunType(
                )
                theTileRawChannelBuilderOptATLAS.calibrateEnergy = jobproperties.TileRecFlags.calibrateEnergy(
                )
                if jobproperties.TileRecFlags.BestPhaseFromCOOL(
                ):  # can't correct time and use best phase at the same time
                    theTileRawChannelBuilderOptATLAS.correctTime = False
                else:
                    theTileRawChannelBuilderOptATLAS.correctTime = jobproperties.TileRecFlags.correctTime(
                    )
                theTileRawChannelBuilderOptATLAS.BestPhase = jobproperties.TileRecFlags.BestPhaseFromCOOL(
                )
                theTileRawChannelBuilderOptATLAS.NoiseFilterTools = NoiseFilterTools
                theTileRawChannelBuilderOptATLAS.OF2 = True
                #theTileRawChannelBuilderOptATLAS.PedestalMode = 1; # not sure if we need this option here
                theTileRawChannelBuilderOptATLAS.MaxIterations = 1
                # just one iteration
                theTileRawChannelBuilderOptATLAS.Minus1Iteration = False
                # assume that max sample is at t=0
                theTileRawChannelBuilderOptATLAS.AmplitudeCorrection = jobproperties.TileRecFlags.correctAmplitude(
                )
                theTileRawChannelBuilderOptATLAS.TimeCorrection = jobproperties.TileRecFlags.correctTimeNI(
                )
                theTileRawChannelBuilderOptATLAS.AmpMinForAmpCorrection = jobproperties.TileRecFlags.AmpMinForAmpCorrection(
                )
                if jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                ) > jobproperties.TileRecFlags.TimeMinForAmpCorrection():
                    theTileRawChannelBuilderOptATLAS.TimeMinForAmpCorrection = jobproperties.TileRecFlags.TimeMinForAmpCorrection(
                    )
                    theTileRawChannelBuilderOptATLAS.TimeMaxForAmpCorrection = jobproperties.TileRecFlags.TimeMaxForAmpCorrection(
                    )

                mlog.info(
                    " adding now TileRawChannelBuilderOpt2Filter with name TileRawChannelBuilderOptATLAS to ToolSvc"
                )
                ToolSvc += theTileRawChannelBuilderOptATLAS

                theTileRawChannelMaker.TileRawChannelBuilder += [
                    ToolSvc.TileRawChannelBuilderOptATLAS
                ]

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

            if jobproperties.TileRecFlags.noiseFilter() == 2:
                # Instantiation of the C++ algorithm
                try:
                    from TileRecUtils.TileRecUtilsConf import TileRawCorrelatedNoise
                    theTileRawCorrelatedNoise = TileRawCorrelatedNoise(
                        "TileRCorreNoise")
                except:
                    mlog.error(
                        "could not import TileRecUtils.TileRawCorrelatedNoise")
                    print traceback.format_exc()
                    return False
                #theTileRawCorrelatedNoise.UseMeanFiles = False
                #theTileRawCorrelatedNoise.PMTOrder = True
                jobproperties.TileRecFlags.TileDigitsContainer = "NewDigitsContainer"
                topSequence += theTileRawCorrelatedNoise

            jobproperties.TileRecFlags.print_JobProperties('tree&value')

            theTileRawChannelMaker.TileDigitsContainer = jobproperties.TileRecFlags.TileDigitsContainer(
            )
            topSequence += theTileRawChannelMaker

        else:
            mlog.info(
                " Disable all OF methods because readDigits flag set to False "
            )
            jobproperties.TileRecFlags.doTileFlat = False
            jobproperties.TileRecFlags.doTileFit = False
            jobproperties.TileRecFlags.doTileFitCool = False
            jobproperties.TileRecFlags.doTileOpt = False
            jobproperties.TileRecFlags.doTileOpt2 = False
            jobproperties.TileRecFlags.doTileOptATLAS = False
            jobproperties.TileRecFlags.doTileManyAmps = False
            jobproperties.TileRecFlags.doTileMF = False
            jobproperties.TileRecFlags.doTileOF1 = False
            jobproperties.TileRecFlags.OfcFromCOOL = False
            jobproperties.TileRecFlags.print_JobProperties('tree&value')

        return True
コード例 #20
0
def __navSlimming(c, **kw):
    from TriggerD3PDMaker.TrigNavSlimming import TrigNavSlimming
    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())
    TrigNavSlimming(sequence=preseq)
    return
コード例 #21
0
    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 Exception:
            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 Exception:
            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 Exception:
            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()        


        # 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
コード例 #22
0
# This fragment turns on the FixHepMC algorithm
from AthenaCommon.AlgSequence import AlgSequence
topAlg = AlgSequence()
print "Running FixHepMC"
if not hasattr(topAlg, "FixHepMC"):
    # TODO: what if it exists but at the wrong point in the sequence? Move to the end?
    from EvgenProdTools.EvgenProdToolsConf import FixHepMC
    topAlg += FixHepMC()
コード例 #23
0
include.block("PhysicsD3PDMaker/PhotonSelector.py")

from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags

from D2PDMaker.D2PDMakerConf import D2PDPhotonSelector

from AthenaCommon.AlgSequence import AlgSequence
preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

preseq += D2PDPhotonSelector("SMWZ_HighPtPhotonFilter",
                             inputCollection='PhotonAODCollection',
                             outputCollection='HighPtPhotons',
                             photonVetoAuthorList=[128],
                             photonID=egammaPID.PhotonIDLoose,
                             etMin=10.0 * Units.GeV)
コード例 #24
0
def AddZmumuTPRecoAnalysis(doEtaSlices=False,
                           writeNtuple=False,
                           doClosure=False,
                           doDRSys=False,
                           doValid=False,
                           DoProbeMatchPlots=True,
                           ProduceEfficiencies=False):

    from AthenaCommon.AlgSequence import AlgSequence
    from AthenaCommon.AppMgr import ToolSvc
    job = AlgSequence()

    MuonContainerToUse = "Muons"
    #if hasattr(job, "MuonQualityUpdater"):
    #MuonContainerToUse = "UpdatedMuons"

    ###########################################################################################
    ## Add the Zmm TP algorithm using ID tracks as probes and matching to muons
    #AddConfiguredZmumuTPAlg(name_suffix = "IDProbes",
    #ProbeKind = "ID",
    #MatchContainer = MuonContainerToUse,
    #doID = False, doCB = True, doLoose=True, doMedium = True,
    #doTight=True, doStandalone = False, doCaloTag = True, doIndividualAuthors = doValid,
    #doEtaSlices=doEtaSlices, writeNtuple = writeNtuple,doClosure=doClosure, doDRSys = doDRSys)

    #########################################################################################
    #Add the Zmm TP algorithm using CaloTag muons as probes and matching to muons
    AddConfiguredZmumuTPAlg(name_suffix="CaloProbes",
                            ProbeKind="CaloTag",
                            MatchContainer=MuonContainerToUse,
                            doID=False,
                            doCB=True,
                            doLoose=True,
                            doMedium=True,
                            doTight=True,
                            doHighPt=True,
                            doStandalone=False,
                            doCaloTag=False,
                            doIndividualAuthors=doValid,
                            doEtaSlices=doEtaSlices,
                            writeNtuple=writeNtuple,
                            doClosure=doClosure,
                            doDRSys=doDRSys,
                            DoProbeMatchPlots=DoProbeMatchPlots,
                            ProduceEfficiencies=ProduceEfficiencies)

    ##########################################################################################
    # Add the Zmm TP algorithm using MS muons as probes and matching to ID tracks
    # AddConfiguredZmumuTPAlg(name_suffix = "MSTrackPartProbes_ID",
    #                         ProbeKind = "MSTrackPart",
    #                         MatchContainer = "InDetTrackParticles",
    #                         doID = True, doCB = False, doLoose=False, doMedium = False,
    #                         doTight=False, doHighPt=True,
    #                         doStandalone = False, doCaloTag = False,
    #                         doEtaSlices=doEtaSlices, writeNtuple = writeNtuple,doClosure=doClosure, doDRSys = doDRSys)

    ##########################################################################################
    # Add the Zmm TP algorithm using MS muons as probes and matching to ID tracks
    AddConfiguredZmumuTPAlg(name_suffix="MSProbes_ID",
                            ProbeKind="MS",
                            MatchContainer="InDetTrackParticles",
                            doID=True,
                            doCB=False,
                            doLoose=False,
                            doMedium=False,
                            doTight=False,
                            doHighPt=False,
                            doStandalone=False,
                            doCaloTag=False,
                            doIndividualAuthors=False,
                            doEtaSlices=doEtaSlices,
                            writeNtuple=writeNtuple,
                            doClosure=doClosure,
                            doDRSys=doDRSys,
                            DoProbeMatchPlots=DoProbeMatchPlots,
                            ProduceEfficiencies=ProduceEfficiencies)

    ##########################################################################################
    # Add the Zmm TP algorithm using MS muons as probes and matching to CaloTag muons
    AddConfiguredZmumuTPAlg(name_suffix="MSProbes_Muon",
                            ProbeKind="MS",
                            MatchContainer=MuonContainerToUse,
                            doID=False,
                            doCB=False,
                            doLoose=False,
                            doMedium=False,
                            doTight=False,
                            doHighPt=False,
                            doStandalone=False,
                            doCaloTag=True,
                            doIndividualAuthors=False,
                            doEtaSlices=doEtaSlices,
                            writeNtuple=writeNtuple,
                            doClosure=doClosure,
                            doDRSys=doDRSys,
                            DoProbeMatchPlots=DoProbeMatchPlots,
                            ProduceEfficiencies=ProduceEfficiencies)

    # Only add truth probes if we are running on MC!
    from AthenaCommon.GlobalFlags import globalflags
    if not globalflags.DataSource() == 'data':
        ##########################################################################################
        # Add the Zmm TP algorithm using Truth probes for Muons
        AddConfiguredZmumuTPAlg(name_suffix="TruthProbes_Muon",
                                ProbeKind="Truth",
                                MatchContainer=MuonContainerToUse,
                                doID=False,
                                doCB=True,
                                doLoose=True,
                                doMedium=True,
                                doTight=True,
                                doHighPt=True,
                                doStandalone=False,
                                doCaloTag=True,
                                doIndividualAuthors=doValid,
                                doEtaSlices=doEtaSlices,
                                writeNtuple=writeNtuple,
                                doClosure=False,
                                doDRSys=False,
                                DoProbeMatchPlots=DoProbeMatchPlots,
                                ProduceEfficiencies=ProduceEfficiencies)

        ##########################################################################################
        # Add the Zmm TP algorithm using Truth probes for Tracks
        AddConfiguredZmumuTPAlg(name_suffix="TruthProbes_ID",
                                ProbeKind="Truth",
                                MatchContainer="InDetTrackParticles",
                                doID=True,
                                doCB=False,
                                doLoose=False,
                                doMedium=False,
                                doTight=False,
                                doHighPt=False,
                                doStandalone=False,
                                doCaloTag=False,
                                doIndividualAuthors=False,
                                doEtaSlices=doEtaSlices,
                                writeNtuple=writeNtuple,
                                doClosure=False,
                                doDRSys=False,
                                DoProbeMatchPlots=DoProbeMatchPlots,
                                ProduceEfficiencies=ProduceEfficiencies)
コード例 #25
0
    def setupCOOLReading(self, TrigCoolDbConnection):
        log = logging.getLogger("TriggerConfigGetter.py")
        if 'ds' in self.ConfigSrcList:
            log.info(
                'DSConfigSvc enabled, will setup IOVDbSvc to access configuration meta data'
            )
        if self.writeESDAOD:
            log.info(
                'ESD/AOD writing enabled, will setup IOVDbSvc to access configuration meta data'
            )
        usePresetConnection = (TrigCoolDbConnection != "")

        ## if we process MC from an XML file the dbConnection needs to
        ## be set to a local SQlite file

        # when reading from the COOL database (either form
        # ORACLE/SQlite) we need an algorithm that triggers the
        # copying
        #
        # In addition for MC the IOV has to be adjusted since in COOL the config data is written with IOV=infinity
        if self.readRDO:

            # setup the IOV Changer
            from AthenaCommon.AlgSequence import AlgSequence
            from TrigConfigSvc.TrigConfigSvcConf import TrigConf__TrigConfDataIOVChanger as TrigConfDataIOVChanger
            topAlgs = AlgSequence()
            TrigConfDataIOVChanger = TrigConfDataIOVChanger(
                'TrigConfDataIOVChanger')
            topAlgs += TrigConfDataIOVChanger
            if self.makeTempCool:
                TrigConfDataIOVChanger.AdjustIOV = True

        if TrigCoolDbConnection == '':
            log.info(
                "COOL DBConnection: not set, will use default conditions database"
            )
            TrigCoolDbConnection = 'TRIGGER'
            addNewFolders = TriggerFlags.configForStartup(
            ) == "HLTonline" and self.readRDO
        else:  # for sqlite COOL: temp (usually /tmp/hltMenu.xxx.db) or predefined (e.g. trigconf.db)
            log.info("COOL DBConnection: " + TrigCoolDbConnection)
            addNewFolders = ((TriggerFlags.configForStartup() == "HLToffline"
                              or TriggerFlags.configForStartup() == "HLTonline"
                              or globalflags.DataSource() != 'data')
                             and self.readRDO)  # bytestream or MC RDO

        # add folders for reading
        from IOVDbSvc.CondDB import conddb
        folders = []
        if self.hltFolders: folders += ["HLT/Menu", "HLT/HltConfigKeys"]
        if self.l1Folders:
            folders += ["LVL1/Lvl1ConfigKey", "LVL1/Menu", "LVL1/Prescales"]
        if globalflags.DataSource() == 'data':
            if self.l1Folders:
                folders += [
                    "LVL1/BunchGroupKey", "LVL1/BunchGroupDescription",
                    "LVL1/BunchGroupContent"
                ]
        if self.hasLBwiseHLTPrescalesAndL1ItemDef:
            if self.hltFolders: folders += ["HLT/Prescales", "HLT/PrescaleKey"]
            if self.l1Folders: folders += ["LVL1/ItemDef"]

        log.info("Adding folders to IOVDbSvc")

        if addNewFolders:
            # Need thresholds folders but only for Tier0 BS->ESD
            log.info("Also adding new folders to IOVDbSvc")
            if self.hltFolders: folders += ["HLT/Groups"]
            if self.l1Folders: folders += ["LVL1/Thresholds"]

        for f in folders:
            log.info("     /TRIGGER/%s" % f)
            conddb.addFolderWithTag(TrigCoolDbConnection, "/TRIGGER/%s" % f,
                                    "HEAD")
コード例 #26
0
def AddConfiguredZmumuTPAlg(
        name_suffix="myProbes",
        ProbeKind="CaloTag",  # options: "CaloTag","MS", "Truth", "ID"
        MatchContainer="Muons",
        doID=False,
        doCB=True,
        doLoose=True,
        doMedium=True,
        doTight=True,
        doHighPt=True,
        doStandalone=False,
        doCaloTag=False,
        doIndividualAuthors=False,
        doEtaSlices=False,
        writeNtuple=False,
        doClosure=False,
        doDRSys=False,
        DoProbeMatchPlots=True,
        ProduceEfficiencies=False):

    from AthenaCommon.AlgSequence import AlgSequence
    from AthenaCommon.AppMgr import ToolSvc
    job = AlgSequence()

    MuonContainerToUse = "Muons"
    #if hasattr(job, "MuonQualityUpdater"):
    #MuonContainerToUse = "UpdatedMuons"

    ProbeContainer = MuonContainerToUse

    if ProbeKind == "MSTrackPart":
        ProbeContainer = "ExtrapolatedMuonTrackParticles"
        ProbeKind = "MS"

    if ProbeKind == "ID":
        ProbeContainer = "InDetTrackParticles"
    if ProbeKind == "Truth":
        ProbeContainer = "MuonTruthParticles"

    theAlg = CommonMuonTPConfig.AddTagProbeAlg(name="ZmumuTPAlg_%s" %
                                               name_suffix,
                                               ProbeCont=ProbeContainer,
                                               MatchCont=MatchContainer)
    theAlg.TopLevelFolderName = "ZmumuTPReco"

    #AddMuonSelectionTool()

    # add a plotting tool
    #PlotTool = AddPlottingTool(name="ZmumuTPPlottingTool_%s"%name_suffix,EffiFlag=name_suffix)

    # add four TP selection tools (iso and antiiso OC and SC)
    SelectionTools = []
    SelectionTools += [
        CommonMuonTPConfig.AddZmumuTPSelectionTool(
            name="ZmumuTPSelectionTool_OC_%s" % name_suffix,
            EffiFlag="%s_OC" % name_suffix,
            ProbeType=ProbeKind)
    ]
    SelectionTools += [
        CommonMuonTPConfig.AddZmumuTPSelectionTool(
            name="ZmumuTPSelectionTool_SC_%s" % name_suffix,
            EffiFlag="%s_SC" % name_suffix,
            ProbeType=ProbeKind,
            SameSign=True)
    ]
    SelectionTools += [
        CommonMuonTPConfig.AddZmumuTPSelectionTool(
            name="ZmumuTPSelectionTool_OCAntiIso_%s" % name_suffix,
            EffiFlag="%s_OCAntiIso" % name_suffix,
            ProbeType=ProbeKind,
            AntiIso=True)
    ]
    SelectionTools += [
        CommonMuonTPConfig.AddZmumuTPSelectionTool(
            name="ZmumuTPSelectionTool_SCAntiIso_%s" % name_suffix,
            EffiFlag="%s_SCAntiIso" % name_suffix,
            ProbeType=ProbeKind,
            SameSign=True,
            AntiIso=True)
    ]

    PlotTools = []
    # add plotting tools in slices
    if doEtaSlices:
        Slices = {
            "All": (0.0, 10.0),
            "noCrack": (0.1, 10.0),
            "Crack": (0.0, 0.1),
            "Barrel": (0.1, 1.1),
            "Transition": (1.1, 1.3),
            "Endcap": (1.3, 2.0),
            "CSC": (2.0, 2.7)
        }

        for etaslice, interval in Slices.iteritems():
            PlotTool = CommonMuonTPConfig.AddPlottingTool(
                name="ZmumuTPPlottingTool_%s_%s" % (name_suffix, etaslice),
                EffiFlag=name_suffix + "_" + etaslice,
                applySF=False,
                DoProbeMatchPlots=DoProbeMatchPlots,
                ProduceEfficiencies=ProduceEfficiencies)
            PlotTool.ProbeAbsEtaMin = interval[0]
            PlotTool.ProbeAbsEtaMax = interval[1]
            PlotTools.append(PlotTool)
            if doClosure:
                PlotToolCL = CommonMuonTPConfig.AddPlottingTool(
                    name="ZmumuTPPlottingToolClosure_%s_%s" %
                    (name_suffix, etaslice),
                    EffiFlag=name_suffix + "_" + etaslice + "_Closure",
                    applySF=True,
                    DoProbeMatchPlots=DoProbeMatchPlots,
                    ProduceEfficiencies=ProduceEfficiencies)
                PlotToolCL.ProbeAbsEtaMin = interval[0]
                PlotToolCL.ProbeAbsEtaMax = interval[1]
                PlotTools.append(PlotToolCL)

    else:
        PlotTools = [
            CommonMuonTPConfig.AddPlottingTool(
                name="ZmumuTPPlottingTool_%s_All" % name_suffix,
                EffiFlag=name_suffix + "_All",
                applySF=False,
                DoProbeMatchPlots=DoProbeMatchPlots,
                ProduceEfficiencies=ProduceEfficiencies)
        ]
        if doClosure:
            PlotTools.append(
                CommonMuonTPConfig.AddPlottingTool(
                    name="ZmumuTPPlottingToolClosure_%s_All" % name_suffix,
                    EffiFlag=name_suffix + "_All_Closure",
                    applySF=True,
                    DoProbeMatchPlots=DoProbeMatchPlots,
                    ProduceEfficiencies=ProduceEfficiencies))

    # Config the plot tools
    for thetool in PlotTools:
        thetool.doZmumuKinematicPlots = False
        thetool.doFineEtaPhiPlots = True
        thetool.doDetectorRegionPlots = True

    # add any desired matching tools
    MATCH_DR = 0.05

    MatchingTools = []
    if doCB:
        thistoolCB = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_CB" % name_suffix,
            EffiFlag="CombinedMuons")
        thistoolCB.MatchToCB = True
        thistoolCB.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Medium")
        thistoolCB.ApplyScaleFactors = doClosure
        thistoolCB.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolCB]
        if doDRSys:
            thistoolCB_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_CB_dRDown" % name_suffix,
                EffiFlag="CombinedMuons_dRDown")
            thistoolCB_dRDown.IsNominal = False
            thistoolCB_dRDown.MatchToCB = True
            thistoolCB_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Medium")
            #thistoolCB_dRDown.ApplyScaleFactors = True
            thistoolCB_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolCB_dRDown]

            thistoolCB_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_CB_dRUp" % name_suffix,
                EffiFlag="CombinedMuons_dRUp")
            thistoolCB_dRUp.MatchToCB = True
            thistoolCB_dRUp.IsNominal = False
            thistoolCB_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Medium")
            #thistoolCB_dRUp.ApplyScaleFactors = True
            thistoolCB_dRUp.MaximumDrCut = 2. * MATCH_DR
            MatchingTools += [thistoolCB_dRUp]

    if doLoose:
        thistoolLoose = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_Loose" % name_suffix,
            EffiFlag="LooseMuons")
        thistoolLoose.MatchToLoose = True
        thistoolLoose.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Loose")
        thistoolLoose.ApplyScaleFactors = doClosure
        #thistoolLoose.ApplyScaleFactors = True
        thistoolLoose.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolLoose]
        if doDRSys:
            thistoolLoose_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Loose_dRDown" % name_suffix,
                EffiFlag="LooseMuons_dRDown")
            thistoolLoose_dRDown.MatchToLoose = True
            thistoolLoose_dRDown.IsNominal = False
            thistoolLoose_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Loose")
            #thistoolLoose_dRDown.ApplyScaleFactors = True
            thistoolLoose_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolLoose_dRDown]

            thistoolLoose_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Loose_dRUp" % name_suffix,
                EffiFlag="LooseMuons_dRUp")
            thistoolLoose_dRUp.MatchToLoose = True
            thistoolLoose_dRUp.IsNominal = False
            thistoolLoose_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Loose")
            #thistoolLoose_dRUp.ApplyScaleFactors = True
            thistoolLoose_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolLoose_dRUp]

        # also run a version without CaloTag
        thistoolLoose_noCaloTag = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_Loose_noCaloTag" % name_suffix,
            EffiFlag="LooseMuons_noCaloTag")
        thistoolLoose_noCaloTag.MatchToLoose_noCaloTag = True
        thistoolLoose_noCaloTag.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Loose")
        thistoolLoose_noCaloTag.ApplyScaleFactors = doClosure
        #thistoolLoose_noCaloTag.ApplyScaleFactors = True
        thistoolLoose_noCaloTag.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolLoose_noCaloTag]
        if doDRSys:
            thistoolLoose_noCaloTag_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Loose_noCaloTag_dRDown" %
                name_suffix,
                EffiFlag="LooseMuons_noCaloTag_dRDown")
            thistoolLoose_noCaloTag_dRDown.MatchToLoose_noCaloTag = True
            thistoolLoose_noCaloTag_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Loose")
            #thistoolLoose_noCaloTag_dRDown.ApplyScaleFactors = True
            thistoolLoose_noCaloTag_dRDown.IsNominal = False
            thistoolLoose_noCaloTag_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolLoose_noCaloTag_dRDown]

            thistoolLoose_noCaloTag_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Loose_noCaloTag_dRUp" %
                name_suffix,
                EffiFlag="LooseMuons_noCaloTag_dRUp")
            thistoolLoose_noCaloTag_dRUp.MatchToLoose_noCaloTag = True
            thistoolLoose_noCaloTag_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Loose")
            #thistoolLoose_noCaloTag_dRUp.ApplyScaleFactors = True
            thistoolLoose_noCaloTag_dRUp.IsNominal = False
            thistoolLoose_noCaloTag_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolLoose_noCaloTag_dRUp]

    if doMedium:
        thistoolMed = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_Medium" % name_suffix,
            EffiFlag="MediumMuons")
        thistoolMed.MatchToMedium = True
        thistoolMed.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Medium")
        thistoolMed.ApplyScaleFactors = doClosure
        thistoolMed.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMed]
        if doDRSys:
            thistoolMed_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Medium_dRDown" % name_suffix,
                EffiFlag="MediumMuons_dRDown")
            thistoolMed_dRDown.MatchToMedium = True
            thistoolMed_dRDown.IsNominal = False
            thistoolMed_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Medium")
            #thistoolMed_dRDown.ApplyScaleFactors = True
            thistoolMed_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolMed_dRDown]

            thistoolMed_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Medium_dRUp" % name_suffix,
                EffiFlag="MediumMuons_dRUp")
            thistoolMed_dRUp.MatchToMedium = True
            thistoolMed_dRUp.IsNominal = False
            thistoolMed_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Medium")
            #thistoolMed_dRUp.ApplyScaleFactors = True
            thistoolMed_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolMed_dRUp]

        thistoolMed_PtrMatch = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_PtrMatch_%s_Medium" % name_suffix,
            EffiFlag="MediumMuons_PtrMatching")
        thistoolMed_PtrMatch.MatchToMedium = True
        thistoolMed_PtrMatch.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Medium")
        thistoolMed_PtrMatch.ApplyScaleFactors = doClosure
        #thistoolMed_PtrMatch.ApplyScaleFactors = True
        thistoolMed_PtrMatch.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMed_PtrMatch]

    if doTight:
        thistoolTight = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_Tight" % name_suffix,
            EffiFlag="TightMuons")
        thistoolTight.MatchToTight = True
        thistoolTight.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Tight")
        thistoolTight.ApplyScaleFactors = doClosure
        #thistoolTight.ApplyScaleFactors = True
        thistoolTight.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolTight]
        if doDRSys:
            thistoolTight_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Tight_dRDown" % name_suffix,
                EffiFlag="TightMuons_dRDown")
            thistoolTight_dRDown.MatchToTight = True
            thistoolTight_dRDown.IsNominal = False
            thistoolTight_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Tight")
            #thistoolTight_dRDown.ApplyScaleFactors = True
            thistoolTight_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolTight_dRDown]

            thistoolTight_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_Tight_dRUp" % name_suffix,
                EffiFlag="TightMuons_dRUp")
            thistoolTight_dRUp.MatchToTight = True
            thistoolTight_dRUp.IsNominal = False
            thistoolTight_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Tight")
            #thistoolTight_dRUp.ApplyScaleFactors = True
            thistoolTight_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolTight_dRUp]

    if doHighPt:
        thistoolHighPt = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_HighPt" % name_suffix,
            EffiFlag="HighPtMuons")
        thistoolHighPt.MatchToHighPt = True
        thistoolHighPt.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Tight")  # UPDATE when SF available for high pt
        thistoolHighPt.ApplyScaleFactors = doClosure
        #thistoolHighPt.ApplyScaleFactors = True
        thistoolHighPt.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolHighPt]
        if doDRSys:
            thistoolHighPt_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_HighPt_dRDown" % name_suffix,
                EffiFlag="HighPtMuons_dRDown")
            thistoolHighPt_dRDown.MatchToHighPt = True
            thistoolHighPt_dRDown.IsNominal = False
            thistoolHighPt_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "HighPt")  # UPDATE when SF available for high pt
            #thistoolHighPt_dRDown.ApplyScaleFactors = True
            thistoolHighPt_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolHighPt_dRDown]

            thistoolHighPt_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_HighPt_dRUp" % name_suffix,
                EffiFlag="HighPtMuons_dRUp")
            thistoolHighPt_dRUp.MatchToHighPt = True
            thistoolHighPt_dRUp.IsNominal = False
            thistoolHighPt_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Tight")  # UPDATE when SF available for high pt
            #thistoolHighPt_dRUp.ApplyScaleFactors = True
            thistoolHighPt_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolHighPt_dRUp]

    if doStandalone:
        thistoolSA = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_SA" % name_suffix,
            EffiFlag="StandaloneMuons")
        thistoolSA.MatchToAnyMS = True
        thistoolSA.IDhitCut = False
        thistoolSA.ApplyScaleFactors = doClosure
        thistoolSA.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolSA]
        if doDRSys:
            thistoolSA_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_SA_dRDown" % name_suffix,
                EffiFlag="StandaloneMuons_dRDown")
            thistoolSA_dRDown.MatchToAnyMS = True
            thistoolSA_dRDown.IDhitCut = False
            thistoolSA_dRDown.IsNominal = False
            thistoolSA_dRDown.ApplyScaleFactors = doClosure
            thistoolSA_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolSA_dRDown]

            thistoolSA_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_SA_dRUp" % name_suffix,
                EffiFlag="StandaloneMuons_dRUp")
            thistoolSA_dRUp.MatchToAnyMS = True
            thistoolSA_dRUp.IDhitCut = False
            thistoolSA_dRUp.IsNominal = False
            thistoolSA_dRUp.ApplyScaleFactors = doClosure
            thistoolSA_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolSA_dRUp]

    if doCaloTag:
        thistoolCT = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_CT" % name_suffix,
            EffiFlag="CaloTaggedMuons")
        thistoolCT.MatchToCaloTag = True
        thistoolCT.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
            "Loose")
        thistoolCT.ApplyScaleFactors = doClosure
        #thistoolCT.ApplyScaleFactors = True
        thistoolCT.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolCT]
        if doDRSys:
            thistoolCT_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_CT_dRDown" % name_suffix,
                EffiFlag="CaloTaggedMuons_dRDown")
            thistoolCT_dRDown.MatchToCaloTag = True
            thistoolCT_dRDown.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Loose")
            #thistoolCT_dRDown.ApplyScaleFactors = True
            thistoolCT_dRDown.IsNominal = False
            thistoolCT_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolCT_dRDown]

            thistoolCT_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_CT_dRUp" % name_suffix,
                EffiFlag="CaloTaggedMuons_dRUp")
            thistoolCT_dRUp.MatchToCaloTag = True
            thistoolCT_dRUp.ScaleFactorTool = CommonMuonTPConfig.AddMuonEfficiencyScaleFactors(
                "Loose")
            #thistoolCT_dRUp.ApplyScaleFactors = True
            thistoolCT_dRUp.IsNominal = False
            thistoolCT_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolCT_dRUp]

    if doID:
        thistoolID = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_ID" % name_suffix,
            EffiFlag="IDTracks")
        thistoolID.MatchToID = True
        thistoolID.ApplyScaleFactors = doClosure
        thistoolID.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolID]
        if doDRSys:
            thistoolID_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_ID_dRUp" % name_suffix,
                EffiFlag="IDTracks_dRUp")
            thistoolID_dRUp.MatchToID = True
            thistoolID_dRUp.ApplyScaleFactors = doClosure
            thistoolID_dRUp.MaximumDrCut = 2 * MATCH_DR
            thistoolID_dRUp.IsNominal = False
            MatchingTools += [thistoolID_dRUp]

            thistoolID_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_ID_dRDown" % name_suffix,
                EffiFlag="IDTracks_dRDown")
            thistoolID_dRDown.MatchToID = True
            thistoolID_dRDown.ApplyScaleFactors = doClosure
            thistoolID_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            thistoolID_dRDown.IsNominal = False
            MatchingTools += [thistoolID_dRDown]

        #thistoolID_noMCPcuts = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(name="ZmumuTPEfficiencyTool_%s_ID_noMCP"%name_suffix,EffiFlag="IDTracks_noMCP")
        #thistoolID_noMCPcuts.MatchToID = True
        #thistoolID_noMCPcuts.IDhitCut = False
        #thistoolID_noMCPcuts.ApplyScaleFactors = doClosure
        #thistoolID_noMCPcuts.MaximumDrCut = MATCH_DR
        #MatchingTools += [thistoolID_noMCPcuts]
        #if doDRSys:
        #thistoolID_noMCPcuts_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(name="ZmumuTPEfficiencyTool_%s_ID_noMCP_dRUp"%name_suffix,EffiFlag="IDTracks_noMCP_dRUp")
        #thistoolID_noMCPcuts_dRUp.MatchToID = True
        #thistoolID_noMCPcuts_dRUp.ApplyScaleFactors = doClosure
        #thistoolID_noMCPcuts_dRUp.MaximumDrCut = 2 * MATCH_DR
        #MatchingTools += [thistoolID_noMCPcuts_dRUp]

        #thistoolID_noMCPcuts_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(name="ZmumuTPEfficiencyTool_%s_ID_noMCP_dRDown"%name_suffix,EffiFlag="IDTracks_noMCP_dRDown")
        #thistoolID_noMCPcuts_dRDown.MatchToID = True
        #thistoolID_noMCPcuts_dRDown.ApplyScaleFactors = doClosure
        #thistoolID_noMCPcuts_dRDown.MaximumDrCut = 0.5 * MATCH_DR
        #MatchingTools += [thistoolID_noMCPcuts_dRDown]

    if doIndividualAuthors:
        thistoolMuidCB = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_MuidCB" % name_suffix,
            EffiFlag="MuidCB")
        thistoolMuidCB.MatchToMuidCB = True
        thistoolMuidCB.ApplyScaleFactors = doClosure
        thistoolMuidCB.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMuidCB]
        if doDRSys:
            thistoolMuidCB_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuidCB_dRDown" % name_suffix,
                EffiFlag="MuidCB_dRDown")
            thistoolMuidCB_dRDown.MatchToMuidCB = True
            thistoolMuidCB_dRDown.ApplyScaleFactors = doClosure
            thistoolMuidCB_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            thistoolMuidCB_dRDown.IsNominal = False
            MatchingTools += [thistoolMuidCB_dRDown]

            thistoolMuidCB_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuidCB_dRUp" % name_suffix,
                EffiFlag="MuidCB_dRUp")
            thistoolMuidCB_dRUp.MatchToMuidCB = True
            thistoolMuidCB_dRUp.ApplyScaleFactors = doClosure
            thistoolMuidCB_dRUp.MaximumDrCut = 2 * MATCH_DR
            thistoolMuidCB_dRUp.IsNominal = False
            MatchingTools += [thistoolMuidCB_dRUp]

        thistoolSTACO = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_STACO" % name_suffix,
            EffiFlag="STACO")
        thistoolSTACO.MatchToSTACO = True
        thistoolSTACO.ApplyScaleFactors = doClosure
        thistoolSTACO.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolSTACO]
        if doDRSys:
            thistoolSTACO_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_STACO_dRDown" % name_suffix,
                EffiFlag="STACO_dRDown")
            thistoolSTACO_dRDown.MatchToSTACO = True
            thistoolSTACO_dRDown.ApplyScaleFactors = doClosure
            thistoolSTACO_dRDown.IsNominal = False
            thistoolSTACO_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolSTACO_dRDown]

            thistoolSTACO_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_STACO_dRUp" % name_suffix,
                EffiFlag="STACO_dRUp")
            thistoolSTACO_dRUp.MatchToSTACO = True
            thistoolSTACO_dRUp.ApplyScaleFactors = doClosure
            thistoolSTACO_dRUp.IsNominal = False
            thistoolSTACO_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolSTACO_dRUp]

        thistoolMuTag = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_MuTag" % name_suffix,
            EffiFlag="MuTag")
        thistoolMuTag.MatchToMuTag = True
        thistoolMuTag.ApplyScaleFactors = doClosure
        thistoolMuTag.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMuTag]
        if doDRSys:
            thistoolMuTag_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuTag_dRDown" % name_suffix,
                EffiFlag="MuTag_dRDown")
            thistoolMuTag_dRDown.MatchToMuTag = True
            thistoolMuTag_dRDown.ApplyScaleFactors = doClosure
            thistoolMuTag_dRDown.IsNominal = False
            thistoolMuTag_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolMuTag_dRDown]

            thistoolMuTag_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuTag_dRUp" % name_suffix,
                EffiFlag="MuTag_dRUp")
            thistoolMuTag_dRUp.MatchToMuTag = True
            thistoolMuTag_dRUp.ApplyScaleFactors = doClosure
            thistoolMuTag_dRUp.IsNominal = False
            thistoolMuTag_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolMuTag_dRUp]

        thistoolMuTagIMO = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_MuTagIMO" % name_suffix,
            EffiFlag="MuTagIMO")
        thistoolMuTagIMO.MatchToMuTagIMO = True
        thistoolMuTagIMO.ApplyScaleFactors = doClosure
        thistoolMuTagIMO.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMuTagIMO]
        if doDRSys:
            thistoolMuTagIMO_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuTagIMO_dRDown" % name_suffix,
                EffiFlag="MuTagIMO_dRDown")
            thistoolMuTagIMO_dRDown.MatchToMuTagIMO = True
            thistoolMuTagIMO_dRDown.ApplyScaleFactors = doClosure
            thistoolMuTagIMO_dRDown.IsNominal = False
            thistoolMuTagIMO_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolMuTagIMO_dRDown]

            thistoolMuTagIMO_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuTagIMO_dRUp" % name_suffix,
                EffiFlag="MuTagIMO_dRUp")
            thistoolMuTagIMO_dRUp.MatchToMuTagIMO = True
            thistoolMuTagIMO_dRUp.ApplyScaleFactors = doClosure
            thistoolMuTagIMO_dRUp.IsNominal = False
            thistoolMuTagIMO_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolMuTagIMO_dRUp]

        thistoolMuidSA = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_MuidSA" % name_suffix,
            EffiFlag="MuidSA")
        thistoolMuidSA.MatchToMuidSA = True
        thistoolMuidSA.ApplyScaleFactors = doClosure
        thistoolMuidSA.IDhitCut = False
        thistoolMuidSA.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMuidSA]
        if doDRSys:
            thistoolMuidSA_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuidSA_dRDown" % name_suffix,
                EffiFlag="MuidSA_dRDown")
            thistoolMuidSA_dRDown.MatchToMuidSA = True
            thistoolMuidSA_dRDown.ApplyScaleFactors = doClosure
            thistoolMuidSA_dRDown.IsNominal = False
            thistoolMuidSA_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolMuidSA_dRDown]

            thistoolMuidSA_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuidSA_dRUp" % name_suffix,
                EffiFlag="MuidSA_dRUp")
            thistoolMuidSA_dRUp.MatchToMuidSA = True
            thistoolMuidSA_dRUp.ApplyScaleFactors = doClosure
            thistoolMuidSA_dRUp.IsNominal = False
            thistoolMuidSA_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolMuidSA_dRUp]

        thistoolMuGirl = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
            name="ZmumuTPEfficiencyTool_%s_MuidGirl" % name_suffix,
            EffiFlag="MuGirl")
        thistoolMuGirl.MatchToMuGirl = True
        thistoolMuGirl.ApplyScaleFactors = doClosure
        thistoolMuGirl.MaximumDrCut = MATCH_DR
        MatchingTools += [thistoolMuGirl]
        if doDRSys:
            thistoolMuGirl_dRDown = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuidGirl_dRDown" % name_suffix,
                EffiFlag="MuGirl_dRDown")
            thistoolMuGirl_dRDown.MatchToMuGirl = True
            thistoolMuGirl_dRDown.ApplyScaleFactors = doClosure
            thistoolMuGirl_dRDown.IsNominal = False
            thistoolMuGirl_dRDown.MaximumDrCut = 0.5 * MATCH_DR
            MatchingTools += [thistoolMuGirl_dRDown]

            thistoolMuGirl_dRUp = CommonMuonTPConfig.AddMuonRecoTPEfficiencyTool(
                name="ZmumuTPEfficiencyTool_%s_MuidGirl_dRUp" % name_suffix,
                EffiFlag="MuGirl_dRUp")
            thistoolMuGirl_dRUp.MatchToMuGirl = True
            thistoolMuGirl_dRUp.IsNominal = False
            thistoolMuGirl_dRUp.ApplyScaleFactors = doClosure
            thistoolMuGirl_dRUp.MaximumDrCut = 2 * MATCH_DR
            MatchingTools += [thistoolMuGirl_dRUp]

    ntuples = []
    if writeNtuple:
        ntuples.append(
            CommonMuonTPConfig.AddTreeTool(name="ZmumuTPTreeTool_%s" %
                                           name_suffix,
                                           EffiFlag="Trees",
                                           WriteSFInfo=doClosure))

    # create the TP tool itself
    TheTPTool = CommonMuonTPConfig.AddMuonTPTool(name="ZmumuTPTool_%s" %
                                                 name_suffix,
                                                 EffiFlag=name_suffix)
    TheTPTool.MuonTPSelectionTools = SelectionTools
    TheTPTool.PlottingTools = PlotTools
    TheTPTool.MuonTPEfficiencyTools = MatchingTools
    TheTPTool.TreeTools = ntuples
    theAlg.MuonTPTools += [TheTPTool]
コード例 #27
0
        stagetool = FileStagerTool(sampleFile=sampleFile)

    ## Configure copy command used by the stager; default is 'lcg-cp -v --vo altas -t 1200'.
    stagetool.CpCommand = "wrapper_lcg-cp"
    stagetool.CpArguments = []
    #stagetool.OutfilePrefix = "file:"
    #stagetool.checkGridProxy = True
    #stagetool.LogfileDir = "./"

    #################################################################################################
    # Configure the FileStager -- no need to change these lines
    #################################################################################################

    ## get Reference to existing Athena job
    from AthenaCommon.AlgSequence import AlgSequence
    thejob = AlgSequence()

    ## check if collection names begin with "gridcopy"
    print "FileStager() : doStaging ?", stagetool.DoStaging()

    ## Import file stager algorithm
    from FileStager.FileStagerConf import FileStagerAlg

    ## filestageralg needs to be the first algorithm added to the thejob.
    if stagetool.DoStaging():
        thejob += FileStagerAlg('FileStager')
        thejob.FileStager.InputCollections = stagetool.GetSampleList()
        #thejob.FileStager.PipeLength = 2
        #thejob.FileStager.VerboseStager = True
        #thejob.FileStager.KeepLogfiles = True
        thejob.FileStager.LogfileDir = stagetool.LogfileDir
コード例 #28
0
# File for feeding Reco_tf.py vertexing options for the searches
# looking for displaced vertices in the SUSY and Exotics groups.
# The options here are needed both when running on RAW and ESD inputs.
# Must run after the large-radius tracking to use large-d0 tracks.

## get a handle on the top sequence of algorithms -import AlgSequence
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

# instantiate the vertexing alg
from VrtSecInclusive.VrtSecInclusive import VrtSecInclusive
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
コード例 #29
0
# special setup for event generation
include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")

# remember output level I set

evgenMsgLevel = INFO

# other includes needed by the physics file
include("PartPropSvc/PartPropSvc.py")

from AthenaServices.AthenaServicesConf import AtRndmGenSvc
svcMgr += AtRndmGenSvc()

# get a handle on topalg
from AthenaCommon.AlgSequence import AlgSequence
topAlg = AlgSequence("TopAlg")

svcMgr.MessageSvc.OutputLevel = evgenMsgLevel
#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
atRndmGenSvc = svcMgr.AtRndmGenSvc
AtRndmGenSvc.Seeds = [
    "PYTHIA 330020611 841000366", "PYTHIA_INIT 824021 3247532"
]

from Pythia_i.Pythia_iConf import Pythia
topAlg += Pythia()

from TruthExamples.TruthExamplesConf import PrintMC
topAlg += PrintMC()
コード例 #30
0
ファイル: A4DumpAlg.py プロジェクト: JohannesEbke/A4Maker
    def __init__( self,
                  name,
                  seq = topSequence,
                  tuplename = None,
                  preD3PDAlgSeqName = D3PDMakerFlags.PreD3PDAlgSeqName(),
                  orig_stream = None,
                  **kwargs ):

        self.__orig_stream = orig_stream
        self.__logger = logging.getLogger( "A4DumpAlg" )

        # Work around initialization order issue.
        seq.__iadd__( D3PDMakerCoreComps.DummyInitAlg( name + 'DummyInit' ),
                      index = 0 )

        # tuple name defaults to the algorithm name.
        if tuplename == None:
            tuplename = name

        # Create the algorithm Configurable.
        D3PD__A4DumpAlg.__init__ ( self, name,
                                        TupleName = tuplename,
                                        **kwargs )

        # Add to the supplied sequence.
        if seq:
            # But first, add a sequence for algorithms that should run
            # before D3PD making, if it's not already there.
            preseq = AlgSequence( preD3PDAlgSeqName )
            if not hasattr( seq, preD3PDAlgSeqName ):
                seq += [ preseq ]

            # We don't want to do filtering in the presequence.
            preseq.StopOverride = True
            # Now set up another sequence for filtering.
            # Unlike the presequence, there should be a unique one of these
            # per algorithm.  We also need to break out an additional
            # sequence to which users can add, and to wrap the whole
            # thing in a sequence to prevent a failed filter
            # decision from stopping other algorithms.
            # Like this:
            #
            #   ALG_FilterAlgorithmsWrap (StopOverride = True)
            #     ALG_FilterAlgorithmsHolder
            #       ALG_FilterAlgorithms
            #       ALG
            #     Dummy alg, to reset filter flag
            suffix = D3PDMakerFlags.FilterAlgSeqSuffix()
            wrap = AlgSequence( name + suffix + 'Wrap',
                                StopOverride = True )
            holder = AlgSequence( name + suffix + 'Holder' )
            self.filterSeq = AlgSequence( name + suffix )
            holder += self.filterSeq
            holder += self
            wrap += holder
            wrap += PyAthena.Alg( name + 'Dummy' )
           
            seq += wrap

        # Create a unique collection getter registry tool for this tree.
        from AthenaCommon.AppMgr import ToolSvc
        self._registry = \
           D3PDMakerCoreComps.CollectionGetterRegistryTool (self.name() +
                                                   '_CollectionGetterRegistry')
        ToolSvc += self._registry

        return
コード例 #31
0
ファイル: heapmon_jobo.py プロジェクト: atlas-control/control
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")
#######################################################
コード例 #32
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
コード例 #33
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:
            mlog.error(
                "could not get handle to TileRawChannelFromHitsGetter Quit")
            print traceback.format_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:
            mlog.error("could not import TileSimAlgs.TileHitToRawChannel")
            print traceback.format_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())

        # Random number engine
        from Digitization.DigitizationFlags import digitizationFlags
        digitizationFlags.rndmSeedList.addSeed("Tile_DigitsMaker", 4789899,
                                               989240512)

        # 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
コード例 #34
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration

from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.AlgSequence import AlgSequence
from RecExConfig.RecFlags import rec

# Import the xAOD isolation parameters.
from xAODPrimitives.xAODIso import xAODIso as isoPar
ptconeList = [[isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20]]

## Put the new algs before egamma locker... (so right after default IsolationBuilder)
theAlgBeforeWhereToPutIsoAlg = 'egLocker'
topSequence = AlgSequence()
index = -1
if not hasattr(topSequence, theAlgBeforeWhereToPutIsoAlg):
    theAlgBeforeWhereToPutIsoAlg = 'StreamESD'
if not hasattr(topSequence, theAlgBeforeWhereToPutIsoAlg):
    theAlgBeforeWhereToPutIsoAlg = 'StreamAOD'
if not hasattr(topSequence, theAlgBeforeWhereToPutIsoAlg):
    print 'no egLocker, no output stream ! put the new algs at the end of the sequence'
    index = len(topSequence)
else:
    for i, comp in enumerate(topSequence):
        print i, comp
        if comp.getName() == theAlgBeforeWhereToPutIsoAlg:
            index = i
            break
    print 'index of algo ', theAlgBeforeWhereToPutIsoAlg, ' = ', index, ', putting custom track isol algs just after...'

from IsolationAlgs.IsolationAlgsConf import IsolationBuilder
from IsolationTool.IsolationToolConf import xAOD__TrackIsolationTool
コード例 #35
0
    def __init__(self, StreamName, FileName, TreeName=None, asAlg=False):
        """Constructor for the D3PD stream object.

           Arguments:
              StreamName: Logical name of the D3PD stream. Note that beside
                          using it to define the stream in THistSvc, this
                          name is also used as the name of the TTree in the
                          output file in case one is not specified explicitly.
              FileName: Name of the file to write the D3PD TTree into.
              TreeName: Name of the TTree in the output file. If it's not
                        specified, the stream name is used as the tree name.
              asAlg: If set to True, the D3PD::MakerAlg algorithm is added
                     to the job as a regular algorithm. When set to False
                     (default), the D3PD algorithm is added to the application
                     manager as an output stream.
        """
        # Initialize the base class:
        AugmentedStreamBase.__init__(self, StreamName)

        # Check if the user specified a tree name or not:
        if TreeName == None:
            TreeName = StreamName

        # Remember the file and tree names just for bookkeeping:
        self.fileName = FileName
        self.treeName = TreeName

        # We need to add some stuff to the main algorithm sequence:
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # Create a sequence where the pre-D3PD-making algorithms are run:
        from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
        preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName(),
                             StopOverride=True)
        if not hasattr(topSequence, D3PDMakerFlags.PreD3PDAlgSeqName()):
            topSequence += [preseq]
            pass

        # Add the AANT algorithm for making it possible to back navigate
        # from D3PD events:
        ParentStreamName = StreamName.split(':')[0]
        if StreamName.count(':') != 0:
            if StreamName.count(':') == 1:
                StreamName = StreamName.split(':')[1]
            else:
                raise AttributeError("Stream name '%s' can't be used!" %
                                     StreamName)
        if not hasattr(topSequence, ParentStreamName + "AANTStream"):
            try:
                from AnalysisTools.AnalysisToolsConf import AANTupleStream
                topSequence += AANTupleStream(ParentStreamName + "AANTStream",
                                              ExtraRefNames=[
                                                  'StreamRDO', 'StreamRAW',
                                                  'StreamESD', 'StreamAOD'
                                              ],
                                              OutputName=FileName,
                                              WriteInputDataHeader=True,
                                              StreamName=ParentStreamName)
                pass
            except ImportError:
                print self.Name, ": INFO didn't find AnalysisTools.AnalysisToolsConf in release."
                pass
            pass

        # Make sure that THistSvc exists.
        from AthenaCommon.AppMgr import ServiceMgr
        if not hasattr(ServiceMgr, 'THistSvc'):
            from GaudiSvc.GaudiSvcConf import THistSvc
            ServiceMgr += THistSvc()

        # Check if the requested stream is already defined in THistSvc:
        streamExists = False
        for s in ServiceMgr.THistSvc.Output:
            stream = s.split()[0]
            if stream == StreamName:
                streamExists = True
                break

        # Add the stream if it's not defined yet:
        if not streamExists:
            ServiceMgr.THistSvc.Output += [
                "%s DATAFILE='%s' OPT='RECREATE' CL='%i'" %
                (StreamName, FileName, D3PDMakerFlags.CompressionLevel())
            ]

        # Finally, create the D3PD::MakerAlg algorithm and add it to the job.
        # Note that here we're specifying that the D3PDMaker code should use
        # ROOT output.
        #
        # If we're adding as an algorithm directly, then pass the parent sequence
        # into MakerAlg(...). MakerAlg(...) will then add itself to the sequence
        # and also set up the accompanying filter sequence. Otherwise, we add it
        # as a stream; in that case we set up backwards compatibility for
        # 'filterSeq'.
        try:
            import D3PDMakerCoreComps
            if asAlg:
                theseq = topSequence
            else:
                theseq = None
                pass
            self.Stream = D3PDMakerCoreComps.MakerAlg(
                StreamName + "D3PDMaker",
                seq=theseq,
                file=FileName,
                stream=ParentStreamName,
                tuplename=TreeName,
                D3PDSvc="D3PD::RootD3PDSvc")

            if not asAlg:
                from AthenaCommon.AppMgr import theApp
                theApp.addOutputStream(self.Stream)
                # Backwards compatibility for the filter algoirthm:
                self.filterSeq = _RootStreamFilterHelper(self, topSequence)
                pass
            pass
        except ImportError:
            print self.Name, ": INFO didn't find D3PDMakerCoreComps in release."
            pass

        return
コード例 #36
0
def MCPphysicsD3PD(file,
                   tuplename='physics',
                   seq=topSequence,
                   D3PDSvc='D3PD::RootD3PDSvc',
                   streamNameRoot=None,
                   **kw):

    # define track and cluster filters

    filter1 = makeTrackFilterAlg(TracksName=D3PDMakerFlags.TrackSGKey(),
                                 OutputTracksName='GoodTracks',
                                 ptCut=0.,
                                 nSCTPix=4)

    filter2 = makeTrackFilterAlg(TracksName=D3PDMakerFlags.TrackSGKey(),
                                 OutputTracksName='HighPtTracks',
                                 ptCut=5000.,
                                 nSCTPix=4)

    filter3 = makeClusterFilter(InputName=D3PDMakerFlags.ClusterSGKey(),
                                OutputName='HighPtClusters',
                                ptCut=10000.)

    # FIXME (Maarten) : I need to give the container name explicitly apparently
    filter4 = makeClusterFilter(InputName='EMTopoCluster430',
                                OutputName='HighPtEMClusters',
                                ptCut=10000.)

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())
    preseq += filter1
    preseq += filter2
    preseq += filter3
    preseq += filter4

    # now configure the D3PD

    alg = MSMgr.NewRootStream(StreamName=streamNameRoot,
                              FileName=file,
                              TreeName=tuplename)

    alg += EventInfoD3PDObject(**_args(10, 'EventInfo', kw))
    alg += LArCollisionTimeD3PDObject(**_args(10, 'LArCollisionTime', kw))

    # Eta rings of energy
    # FIXME brian crashing aod running
    if not rec.readAOD:
        from CaloD3PDMaker.RapgapD3PDObject import EtaRingsNonTileD3PDObject
        from CaloD3PDMaker.RapgapD3PDObject import EtaRingsD3PDObject

        alg += EtaRingsNonTileD3PDObject(**_args(0, 'EtaRings', kw))
        alg += EtaRingsD3PDObject(**_args(0, 'EtaRings', kw))

    # Electron/Photon blocks

#    alg += ElectronD3PDObject         (**_args (10, 'Electron', kw,
#                                                exclude = ['EMTrackFitDetails','EgammaJetSignedIPAndPTRelKin']))

    alg += PhotonD3PDObject(**_args(10, 'Photon', kw))

    # Muon blocks

    alg += MuonD3PDObject(**_args(
        10,
        'Muons',
        kw,
        sgkey='Muons',
        prefix='mu_',
        include=[
            "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex", "L2CBInfoIndex",
            "L1InfoIndex"
        ],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))
    alg += MuonD3PDObject(**_args(
        10,
        'MuidMuon',
        kw,
        sgkey='MuidMuonCollection',
        prefix='mu_muid_',
        include=[
            "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex", "L2CBInfoIndex",
            "L1InfoIndex"
        ],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))
    alg += MuonD3PDObject(**_args(
        10,
        'StacoMuon',
        kw,
        sgkey='StacoMuonCollection',
        prefix='mu_staco_',
        include=[
            "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex", "L2CBInfoIndex",
            "L1InfoIndex"
        ],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))
    alg += MuonD3PDObject(**_args(
        0, 'CaloMuon', kw, sgkey='CaloMuonCollection', prefix='mu_calo_'))

    # Tau block

    #    alg += TauD3PDObject              (**_args ( 1, 'Tau', kw))

    # Jet blocks

    alg += JetD3PDObject(
        **_args(3,
                'AK4TopoEMJet',
                kw,
                sgkey='AntiKt4TopoEMJets',
                prefix='jet_akt4topoem_',
                include=['BTag', 'TrueFlavorComponents', 'BTagComponents'],
                allowMissing=True))
    alg += JetD3PDObject(
        **_args(3,
                'AK6TopoEMJet',
                kw,
                sgkey='AntiKt6TopoEMJets',
                prefix='jet_akt6topoem_',
                include=['BTag', 'TrueFlavorComponents', 'BTagComponents'],
                allowMissing=True))

    from TopInputsD3PDMaker.HforD3PDObject import HforD3PDObject
    alg += HforD3PDObject(**_args(0, 'HforInfo', kw))

    # MET blocks
    # a whole mess to remove x,y components separately for all flavours

    alg += MissingETD3PDObject(**_args(
        10,
        'MissingET',
        kw,
        exclude=[
            'MET_Base', 'MET_Base0', 'MET_Truth_Int', 'MET_RefFinal_Comps',
            'MET_Calib_Comps', 'MET_CellOut_Comps', 'MET_CorrTopo_Comps',
            'MET_Cryo_Comps', 'MET_CryoCone_Comps', 'MET_Final_Comps',
            'MET_LocHadTopo_Comps', 'MET_LocHadTopoObj_Comps',
            'MET_Muid_Comps', 'MET_Muid_Spectro_Comps', 'MET_Muid_Track_Comps',
            'MET_MuonBoy_Comps', 'MET_MuonBoy_Spectro_Comps',
            'MET_MuonBoy_Track_Comps', 'MET_MuonMuid_Comps', 'MET_Muon_Comps',
            'MET_Muon_Isol_Muid_Comps', 'MET_Muon_Isol_Staco_Comps',
            'MET_Muon_NonIsol_Muid_Comps', 'MET_Muon_NonIsol_Staco_Comps',
            'MET_Muon_Total_Muid_Comps', 'MET_Muon_Total_Staco_Comps',
            'MET_RefEle_Comps', 'MET_RefEle_em_Comps', 'MET_RefGamma_Comps',
            'MET_RefGamma_em_Comps', 'MET_RefJet_Comps', 'MET_RefJet_em_Comps',
            'MET_RefMuon_Comps', 'MET_RefMuon_Muid_Comps',
            'MET_RefMuon_Staco_Comps', 'MET_RefMuon_Track_Muid_Comps',
            'MET_RefMuon_Track_Staco_Comps', 'MET_RefMuon_Track_em_Comps',
            'MET_RefMuon_Track_Comps', 'MET_RefMuon_em_Comps',
            'MET_RefTau_Comps', 'MET_RefTau_em_Comps', 'MET_SoftJets_Comps',
            'MET_SoftJets_em_Comps', 'MET_Topo_Comps', 'MET_TopoObj_Comps',
            'MET_Track_Comps', 'MET_Composition'
        ],
        allowMissing=True))

    # HadronicRecoil blocks

    #    alg += ElectronD3PDObject(0,  sgkey = "HR_selectedElectrons", prefix = "hr_el_")
    #    alg += MuonD3PDObject( 0,     sgkey = "HR_selectedMuons",     prefix = "hr_mu_" )
    #    alg += MissingETD3PDObject(0, sgkey = "RoughRecoil",          prefix = "hr_roughRecoil")
    #    alg += MissingETD3PDObject(0, sgkey = "ueCorrection",         prefix = "hr_ueCorrection")

    # track and cluster blocks

    # ... all clusters, very low LOD

    alg += ClusterD3PDObject(
        **_args(0, 'Clusters1', kw, exclude='SamplingBasics'))

    # ... higher LOD for pt>10 GeV

    alg += ClusterD3PDObject(
        **_args(2, 'Clusters2', kw, sgkey='HighPtClusters', prefix='clpt10_'))

    alg += ClusterD3PDObject(**_args(
        3, 'Clusters3', kw, sgkey='HighPtEMClusters', prefix='emclpt10_'))

    # ... good tracks only (nSCT>3; no pt cut)

    alg += TrackParticleD3PDObject(**_args(
        3, 'Tracks1', kw, sgkey='GoodTracks', label='trk', prefix='trk_'))

    # ... high-pt tracks (nSCT>3; pt>5 GeV)

    from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags as highPtFlags
    highPtFlags.doTruth = True
    highPtFlags.storeDiagonalCovarianceAsErrors = True
    highPtFlags.storeHitTruthMatching = True
    highPtFlags.storePixelHitsOnTrack = False
    highPtFlags.storePixelHolesOnTrack = False
    highPtFlags.storePixelOutliersOnTrack = False
    highPtFlags.storeSCTHitsOnTrack = False
    highPtFlags.storeSCTHolesOnTrack = False
    highPtFlags.storeSCTOutliersOnTrack = False
    highPtFlags.storeTRTHitsOnTrack = False
    highPtFlags.storeTRTHolesOnTrack = False
    highPtFlags.storeTRTOutliersOnTrack = False
    highPtFlags.storeTrackFitQuality = True
    highPtFlags.storeTrackMomentum = True
    highPtFlags.storeTrackSummary = True
    highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
    highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
    highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3

    from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject

    HighPtTrackParticleD3PDObject = TrackD3PDObject(
        _label='trkpt5',
        _prefix='trkpt5_',
        _sgkey='HighPtTracks',
        typeName='Rec::TrackParticleContainer',
        flags=highPtFlags)

    alg += HighPtTrackParticleD3PDObject(**_args(3,
                                                 'Tracks2',
                                                 kw,
                                                 sgkey='HighPtTracks',
                                                 label='trkpt5',
                                                 prefix='trkpt5_'))

    # Primary vertex block - May be missing in single-beam data.

    alg += PrimaryVertexD3PDObject(**_args(1,
                                           'PrimaryVertex',
                                           kw,
                                           allowMissing=True,
                                           sgkey=D3PDMakerFlags.VertexSGKey(),
                                           prefix='vxp_'))

    # MBTS

    alg += MBTSD3PDObject(**_args(10, 'MBTS', kw))
    alg += MBTSTimeD3PDObject(**_args(10, 'MBTSTime', kw))
    alg += MBTSTriggerBitsD3PDObject(**_args(10, 'MBTSTriggerBits', kw))
    #alg += CollisionDecisionD3PDObject(**_args (10, 'CollisionDecision', kw))

    # Truth

    if rec.doTruth():

        from TruthD3PDMaker.TruthParticleD3PDObject import TruthParticleD3PDObject
        from MuonD3PDMaker.TruthMuonD3PDObject import TruthMuonD3PDObject

        alg += TruthMuonD3PDObject(**_args(2, 'TruthMuon', kw))
        alg += GenEventD3PDObject(**_args(1, 'GenEvent', kw))
        alg += TruthParticleD3PDObject(**_args(1, 'TruthParticle', kw))

        # TruthJets
        alg += JetD3PDObject(**_args(1,
                                     'AK4TruthJet',
                                     kw,
                                     sgkey='AntiKt4TruthJets',
                                     prefix='jet_antikt4truth_'))
        alg += JetD3PDObject(**_args(1,
                                     'AK6TruthJet',
                                     kw,
                                     sgkey='AntiKt6TruthJets',
                                     prefix='jet_antikt6truth_'))
        alg += JetD3PDObject(**_args(1,
                                     'AK4TruthJetALL',
                                     kw,
                                     sgkey='AntiKt4TruthJets_ALL',
                                     prefix='jet_antikt4truthALL_'))
        alg += JetD3PDObject(**_args(1,
                                     'AK6TruthJetALL',
                                     kw,
                                     sgkey='AntiKt6TruthJets_ALL',
                                     prefix='jet_antikt6truthALL_'))
        alg += JetD3PDObject(**_args(1,
                                     'AK4TruthJetWZ',
                                     kw,
                                     sgkey='AntiKt4TruthJets_WZ',
                                     prefix='jet_antikt4truthWZ_'))
        alg += JetD3PDObject(**_args(1,
                                     'AK6TruthJetWZ',
                                     kw,
                                     sgkey='AntiKt6TruthJets_WZ',
                                     prefix='jet_antikt6truthWZ_'))

    if not rec.doTruth():
        alg += BeamSpotD3PDObject(10)

    # Trigger

    if D3PDMakerFlags.DoTrigger():

        # Trigger Decision + metadata

        alg += TrigDecisionD3PDObject(**_args(10, 'TrigDecision', kw))
        addTrigConfMetadata(alg)

        # Bunch group info

        alg += BGCodeD3PDObject(**_args(2, 'BGCode', kw))

        # Egamma and Mu

        TrigEgammaD3PDObjects(alg, 0)
        #        TrigMuonD3PDObjects( alg, 0)

        # Esum

        alg += EnergySumROID3PDObject(
            **_args(2, 'EnergySumROI', kw, prefix="trig_L1_esum_"))

        # The LVL2 information:

        alg += TrigMETD3PDObject(**_args(
            2, 'TrigMETL2', kw, prefix="trig_L2_met_",
            sgkey="HLT_T2MissingET"))
        # The EF information:

        alg += TrigMETD3PDObject(**_args(2,
                                         'TrigMETEF',
                                         kw,
                                         prefix="trig_EF_met_",
                                         sgkey="HLT_TrigEFMissingET"))

# Event metadata

    alg.MetadataTools += [LBMetadataConfig()]

    if D3PDMakerFlags.FilterCollCand():
        from CaloD3PDMaker.CollisionFilterAlg import CollisionFilterAlg
        alg.filterSeq += CollisionFilterAlg(tuplename + '_CollCandFilter')

    return alg