Beispiel #1
0
    def checkInput(self):
        self.checkFileMetaData()

        log = logging.getLogger( "TriggerConfigGetter.py" )
        if "ReadPool" in self._environment or "WritePool" in self._environment:
            log.info("Flags are ignored, since 'ReadPool' or  'WritePool' is specified")
            return True

        if rec.readESD() or rec.readAOD(): # and globalflags.DataSource()=='data':  # need this for MC as well
            protectedInclude("TriggerJobOpts/TriggerConfigCheckMetadata.py")

        if rec.readRDO() and globalflags.InputFormat()=='bytestream' and globalflags.DataSource()=='data' and TriggerFlags.configForStartup()!='HLToffline':
            protectedInclude("TriggerJobOpts/TriggerConfigCheckHLTpsk.py")

        log.info("The following flags are set:")
        log.info("globalflags.InputFormat             : %s", globalflags.InputFormat())
        log.info("rec.read.*                          : RDO: %s, ESD: %s, AOD: %s, TAG: %s", rec.readRDO(), rec.readESD(), rec.readAOD(), rec.readTAG())
        log.info("rec.doWrite.*                       : ESD: %s, AOD: %s, TAG: %s", rec.doWriteESD(), rec.doWriteAOD(), rec.doWriteTAG())
        log.info("globalflags.DataSource              : %s", globalflags.DataSource())
        log.info("TriggerFlags.configForStartup       : %s", TriggerFlags.configForStartup())
        log.info("TriggerFlags.dataTakingConditions   : %s", TriggerFlags.dataTakingConditions())
        log.info("TriggerFlags.configurationSourceList: %s", TriggerFlags.configurationSourceList())

        count = len([1 for x in [rec.readRDO(),rec.readESD(),rec.readAOD()] if x ]) #readTAG is only set with another input
        if count == 0:
            log.warning("Don't know what the input format is.")
            return False
        if count >= 2:
            log.warning("More than one input format specified, please set only the appropriate one.")
            return False
        return True
Beispiel #2
0
def TileHitVecToCntTool(name="TileHitVecToCntTool", **kwargs):
    ## FIXME includes to be replaced by confGetter configuration.
    from AthenaCommon.Resilience import protectedInclude
    protectedInclude(
        "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py")
    protectedInclude("TileConditions/TileConditions_jobOptions.py")
    kwargs.setdefault("TileHitVectors", ["TileHitVec", "MBTSHits"])
    kwargs.setdefault("TileInfoName", "TileInfo")
    kwargs.setdefault("TileHitContainer", "TileHitCnt")
    kwargs.setdefault("TileHitContainer_DigiHSTruth", "TileHitCnt_DigiHSTruth")
    kwargs.setdefault("DoHSTruthReconstruction",
                      digitizationFlags.doDigiTruth())
    from AthenaCommon.DetFlags import DetFlags
    kwargs.setdefault("PileUp", DetFlags.pileup.Tile_on())

    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == 'cosmics':
        kwargs.setdefault("TriggerTimeTool", "CosmicTriggerTimeTool")
        kwargs.setdefault("HitTimeFlag", 2)
        kwargs.setdefault("UseTriggerTime", True)

    if digitizationFlags.doXingByXingPileUp():  # PileUpTool approach
        kwargs.setdefault("FirstXing", Tile_FirstXing())
        kwargs.setdefault("LastXing", Tile_LastXing())

    return CfgMgr.TileHitVecToCntTool(name, **kwargs)
def CalibSvc(name="CalibSvc", **kwargs):
    kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc())
    kwargs.setdefault("RndmEngine", "PixelDigitization")
    from AthenaCommon.BeamFlags import jobproperties
    from AthenaCommon.Resilience import protectedInclude

    protectedInclude("PixelConditionsServices/PixelCalibSvc_jobOptions.py")
    from IOVDbSvc.CondDB import conddb

    conddb.addFolderSplitMC("PIXEL", "/PIXEL/ReadoutSpeed", "/PIXEL/ReadoutSpeed")
    if jobproperties.Beam.beamType == "cosmics":
        kwargs.setdefault("UsePixMapCondDB", True)
    return CfgMgr.CalibSvc(name, **kwargs)
Beispiel #4
0
def BasicTRTDigitizationTool(name, **kwargs):

    from AthenaCommon.Resilience import protectedInclude
    protectedInclude("TRT_Digitization/TRT_Digitization_CommonOptions.py")
    kwargs.setdefault("PAI_Tool_Xe", "TRT_PAI_Process_Xe")
    kwargs.setdefault("PAI_Tool_Ar", "TRT_PAI_Process_Ar")
    kwargs.setdefault("PAI_Tool_Kr", "TRT_PAI_Process_Kr")

    from Digitization.DigitizationFlags import digitizationFlags
    #flag from Simulation/Digitization
    if not digitizationFlags.doInDetNoise.get_Value():
        kwargs.setdefault("Override_noiseInSimhits", 0)
        kwargs.setdefault("Override_noiseInUnhitStraws", 0)
    #kwargs.setdefault("Override_useMagneticFieldMap=0)
    #TRT xenon range cut
    trtRangeCut = 0.05
    if hasattr(digitizationFlags, 'TRTRangeCut'):
        trtRangeCut = digitizationFlags.TRTRangeCut.get_Value()
    kwargs.setdefault("Override_TrtRangeCutProperty", trtRangeCut)

    # Import Beam job properties
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == "cosmics":
        kwargs.setdefault("PrintDigSettings", True)
        kwargs.setdefault("Override_cosmicFlag", 0)
        kwargs.setdefault("Override_doCosmicTimingPit", 1)
        kwargs.setdefault("Override_jitterTimeOffset", 0.)
        kwargs.setdefault("Override_timeCorrection", 0)

    if digitizationFlags.doXingByXingPileUp():
        kwargs.setdefault("FirstXing", TRT_FirstXing())
        kwargs.setdefault("LastXing", TRT_LastXing())

    ##else:
    ##    from AthenaCommon.DetFlags import DetFlags
    ##    from AthenaCommon.AppMgr import ServiceMgr
    ##    from PileUpComps.PileUpCompsConf import PileUpXingFolder
    ##    if DetFlags.pileup.TRT_on():
    ##        TRTRange = PileUpXingFolder( "TRTRange" )
    ##        TRTRange.ItemList += ["TRTUncompressedHitCollection#TRTUncompressedHits"]
    ##        #this is the time of the xing in ns
    ##        TRTRange.FirstXing = TRT_FirstXing()
    ##        TRTRange.LastXing  = TRT_LastXing()
    ##        TRTRange.CacheRefreshFrequency = 1.0; #default 0 no dataproxy reset
    ##        # add TRTRange to known pileuo intervals
    ##        ServiceMgr.PileUpMergeSvc.Intervals += [TRTRange]

    kwargs.setdefault("RandomSeedOffset",
                      digitizationFlags.rndmSeedOffset1.get_Value())
    return CfgMgr.TRTDigitizationTool(name, **kwargs)
def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs):
    from AthenaCommon import CfgGetter

    kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc())
    streamName = kwargs.setdefault("RndmEngine", "PixelDigitization")
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(streamName):
        digitizationFlags.rndmSeedList.addSeed(streamName, 10513239, 492615104)
    from AthenaCommon.BeamFlags import jobproperties
    from AthenaCommon.Resilience import protectedInclude
    from AthenaCommon.Include import include

    protectedInclude("PixelConditionsServices/SpecialPixelMapSvc_jobOptions.py")
    include.block("PixelConditionsServices/SpecialPixelMapSvc_jobOptions.py")
    protectedInclude("PixelConditionsServices/PixelDCSSvc_jobOptions.py")
    include.block("PixelConditionsServices/PixelDCSSvc_jobOptions.py")
    from AthenaCommon.AppMgr import ServiceMgr

    if not hasattr(ServiceMgr, "PixelSiPropertiesSvc"):
        from SiLorentzAngleSvc.LorentzAngleSvcSetup import lorentzAngleSvc
        from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc

        pixelSiPropertiesSvc = SiPropertiesSvc(
            name="PixelSiPropertiesSvc",
            DetectorName="Pixel",
            SiConditionsServices=lorentzAngleSvc.pixelSiliconConditionsSvc,
        )
        ServiceMgr += pixelSiPropertiesSvc
    kwargs.setdefault("InputObjectName", "PixelHits")
    kwargs.setdefault("EnableNoise", digitizationFlags.doInDetNoise.get_Value())
    # Start of special cosmics tuning:
    if jobproperties.Beam.beamType == "cosmics":
        kwargs.setdefault("CosmicsRun", True)
        kwargs.setdefault("UseComTime", True)
    else:
        # For LVL1Latency, ToTMinCut, ApplyDupli and LowTOTduplication, first component [0] is always for IBL, even for run 1 production.
        # The order is IBL, BL, L1, L2, EC, DBM
        # For IBL and DBM, values of LVL1Latency and LowToTDupli are superseded by values driven by HitDiscCnfg settings, in PixelDigitizationTool.cxx
        LVL1Latency = [16, 150, 255, 255, 255, 16]
        kwargs.setdefault("LVL1Latency", LVL1Latency)
        ToTMinCut = [0, 4, 4, 4, 4, 0]
        kwargs.setdefault("ToTMinCut", ToTMinCut)
        ApplyDupli = [True, True, True, True, True, True]
        kwargs.setdefault("ApplyDupli", ApplyDupli)
        LowTOTduplication = [0, 7, 7, 7, 7, 0]
        kwargs.setdefault("LowTOTduplication", LowTOTduplication)
    if digitizationFlags.doXingByXingPileUp():  # PileUpTool approach
        kwargs.setdefault("FirstXing", Pixel_FirstXing())
        kwargs.setdefault("LastXing", Pixel_LastXing())
    return CfgMgr.PixelDigitizationTool(name, **kwargs)
def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs):
    from AthenaCommon import CfgGetter
    kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc())
    streamName = kwargs.setdefault("RndmEngine", "PixelDigitization")
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(streamName):
        digitizationFlags.rndmSeedList.addSeed(streamName, 10513239, 492615104 )
    from AthenaCommon.BeamFlags import jobproperties
    from AthenaCommon.Resilience import protectedInclude
    from AthenaCommon.Include import include
    from AthenaCommon.AppMgr import ServiceMgr
    from AthenaCommon.CfgGetter import getService
    protectedInclude( "PixelConditionsServices/SpecialPixelMapSvc_jobOptions.py" )
    include.block( "PixelConditionsServices/SpecialPixelMapSvc_jobOptions.py" )
    protectedInclude( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" )
    include.block( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" )
    protectedInclude("PixelConditionsServices/PixelCalibSvc_jobOptions.py")
    from IOVDbSvc.CondDB import conddb
    conddb.addFolderSplitMC("PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed")
    PixelCablingSvc = getService("PixelCablingSvc")
    ServiceMgr += PixelCablingSvc
    print  PixelCablingSvc
    if not hasattr(ServiceMgr, "PixelSiPropertiesSvc"):
      from SiLorentzAngleSvc.LorentzAngleSvcSetup import lorentzAngleSvc
      from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc
      pixelSiPropertiesSvc = SiPropertiesSvc(name = "PixelSiPropertiesSvc",DetectorName="Pixel",SiConditionsServices = lorentzAngleSvc.pixelSiliconConditionsSvc)
      ServiceMgr += pixelSiPropertiesSvc
    kwargs.setdefault("InputObjectName", "PixelHits")
    procTools = []
    chargeTools = [] #Tools in array for flexibility
    feSimTools = []
    if GeometryFlags.isSLHC():
      procTools += ['PixelRadDamDiodeCrossTalkGenerator']
      chargeTools += ['RadDamSensorSimPlanarTool']
      feSimTools += ['RadDamRD53SimTool']
    else:
      procTools += ['PixelRadDamDiodeCrossTalkGenerator']
      procTools += ['PixelRadDamChargeSmearer']
      procTools += ['PixelRadDamNoisyCellGenerator']
      procTools += ['PixelRadDamRandomDisabledCellGenerator']
      chargeTools += ['RadDamSensorSimPlanarTool']
      chargeTools += ['RadDamSensorSim3DTool']
      feSimTools += ['RadDamFEI4SimTool']
      feSimTools += ['RadDamFEI3SimTool']
    kwargs.setdefault("PixelProcessorTools", procTools)
    kwargs.setdefault("ChargeTools", chargeTools)
    kwargs.setdefault("FrontEndSimTools", feSimTools)
    kwargs.setdefault("EnergyDepositionTool", "RadDamEnergyDepositionTool")
    if digitizationFlags.doXingByXingPileUp(): # PileUpTool approach
        kwargs.setdefault("FirstXing", Pixel_FirstXing() )
        kwargs.setdefault("LastXing", Pixel_LastXing() )
    return CfgMgr.RadDam__PixelDigitizationTool(name, **kwargs)
Beispiel #7
0
from AthenaCommon.DetFlags import DetFlags
from Digitization.DigitizationFlags import digitizationFlags

from AthenaCommon.AlgSequence import AlgSequence

job = AlgSequence()
from AthenaCommon import CfgGetter
from AthenaCommon.AppMgr import ServiceMgr

##################################################################
# LArCalorimeter
##################################################################
if DetFlags.LAr_on():
    if DetFlags.digitize.LAr_on():
        job += CfgGetter.getAlgorithm("LArRawChannelBuilder",
                                      tryDefaultConfigurable=True)
        from LArROD.LArDigits import DefaultLArDigitThinner
        LArDigitThinner = DefaultLArDigitThinner(
            'LArDigitThinner')  # automatically added to topSequence
        if digitizationFlags.doDigiTruth():
            from LArROD.LArRawChannelGetter_DigiHSTruth import LArRawChannelGetter_DigiHSTruth
            LArRawChannelGetter_DigiHSTruth()
##################################################################
# TileCalorimeter
##################################################################
if DetFlags.Tile_on():
    if DetFlags.digitize.Tile_on():
        protectedInclude("TileSimAlgs/TileDigiCommon_jobOptions.py")
        protectedInclude("TileL2Algs/TileL2Algs_jobOptions.py")
##################################################################
Beispiel #8
0
#monMan.AthenaMonTools += [ AntiKt4TowerJetTool ]
monMan.AthenaMonTools += [AntiKt4TopoJetTool]
monMan.AthenaMonTools += [AntiKt6TowerJetTool]
#AntiKt4TowerJetBTaggingTool = PhysValMonBTagging("AntiKt4TowerJetBTaggingTool",
#JetContainer = "AntiKt4TowerJets", TruthParticleContainer = "Spc1MC" )

# AntiKt4TowerJetBTaggingTool.OutputLevel=1

#ToolSvc += AntiKt4TowerJetBTaggingTool
#monMan.AthenaMonTools += [ AntiKt4TowerJetBTaggingTool ]

# configuration of the met tools
# ****************************************

from AthenaCommon.Resilience import protectedInclude
protectedInclude("PhysValMon/PhysValMonMet_jobOptions.py")

# configuration of the tau tools
# ****************************************
TauRecContainerTool = PhysValMonTau("TauRecContainerTool",
                                    TauContainer="TauRecContainer",
                                    DoTrigger=TriggerOn)
TauRecContainerTool.DoOnTheFlyCheck = CounterCheck
TauRecContainerTool.WriteReference = WriteReference
ToolSvc += TauRecContainerTool
monMan.AthenaMonTools += [TauRecContainerTool]

#configuration of the topoCluster toop

from AthenaCommon.Resilience import protectedInclude
protectedInclude("HiggsValidation/HiggsValidation_montools.py")
Beispiel #9
0
topSequence += alg

#------------------------------------------------------------
# Event Data Model Monitor
#------------------------------------------------------------

if doEdmMonitor:
  from TrkValAlgs.TrkValAlgsConf import Trk__EventDataModelMonitor
  InDetEdmMonitor = Trk__EventDataModelMonitor (name = 'InDetEdmMonitor')
  topSequence += InDetEdmMonitor
  if (InDetFlags.doPrintConfigurables()):
    print          InDetEdmMonitor
## DBM TruthLinks
if (InDetFlags.doDBMstandalone() or InDetFlags.doDBM()) and InDetFlags.doTruth():
  from AthenaCommon.Resilience import protectedInclude
  protectedInclude( "McParticleAlgs/TruthParticleBuilder_jobOptions_DBM.py" )

#--------------------------------------------------------------
# Load Inner Detector reconstruction
#--------------------------------------------------------------

if not (('doWriteBS' in dir() and doWriteBS)):
  include( "InDetRecExample/InDetRec_jobOptions.py" )

#--------------------------------------------------------------
# Load Inner Detector Monitoring, use the data quality flags for steering
#--------------------------------------------------------------
if InDetFlags.doMonitoring():
  if not hasattr(ServiceMgr, 'THistSvc'):
      from GaudiSvc.GaudiSvcConf import THistSvc
      ServiceMgr += THistSvc()
Beispiel #10
0
# (there is an include.block so that it is only loaded once)
include.block("ISF_Config/AllDet_detDescr.py")
# also block alternatives
include.block("RecExCond/AllDet_detDescr.py")
include.block("RecExCommon/AllDet_detDescr.py")

from AthenaCommon.Resilience import protectedInclude
from AthenaCommon.DetFlags import DetFlags
if DetFlags.detdescr.any_on():
    from AtlasGeoModel import SetGeometryVersion
    from AtlasGeoModel import GeoModelInit
    from AtlasGeoModel import SetupRecoGeometry

    # Beam Spot service job options - just defines conditions data access
    if DetFlags.detdescr.ID_on():
        protectedInclude("InDetBeamSpotService/BeamCondSvc.py")

    import os
    if "AthSimulation_DIR" not in os.environ:
        if DetFlags.detdescr.LAr_on():
            protectedInclude("LArDetDescr/LArDetDescr_joboptions.py")

        if DetFlags.detdescr.Tile_on():
            protectedInclude("TileConditions/TileConditions_jobOptions.py")

        if DetFlags.detdescr.Muon_on():
            protectedInclude("AmdcAth/AmdcAth_jobOptions.py")

    # MagneticField Service
    if DetFlags.detdescr.BField_on():
        import MagFieldServices.SetupField
    )
    ToolSvc += BTagTrackToJetAssociatorBB

    myBTagTrackAssociation.TrackToJetAssociatorList += [BTagTrackToJetAssociatorBB]
    myBTagTrackAssociation.TrackToJetAssocNameList += ["BTagTrackToJetAssociatorBB"]
    myBTagTrackAssociation.TrackContainerNameList += ["InDetTrackParticles"]

    include("BTagging/BTagging_InDetVKalMultiVxInJetTool.py")
    myBTagSecVtx.SecVtxFinderList += [InDetVKalMultiVxInJetTool]
    myBTagSecVtx.SecVtxFinderTrackNameList += ["BTagTrackToJetAssociatorBB"]
    myBTagSecVtx.SecVtxFinderxAODBaseNameList += ["MSV"]
    myBTagSecVtx.MSVVariableFactory = MSVVariablesFactory
#
from AthenaCommon.Resilience import treatException, protectedInclude

protectedInclude("JetTagCalibration/BTagCalibrationBroker_jobOptions.py")

BTaggingFlags.CalibrationSingleFolder = True


# myJets=["AntiKt4Truth"]
# myJets=["AntiKt4TopoEM"]


# myJetCollectionForCalib = []
# myJetCollectionForCalib+= myJets
# theFolders = []
# myCalibrationChannelAliases = ['AntiKt4Truth->AntiKt4TopoEM']
# from JetTagCalibration.JetTagCalibrationConf import Analysis__CalibrationBroker
# BTagCalibrationBrokerTool = Analysis__CalibrationBroker(
#                                                          name = "BTagCalibrationBrokerTool",
Beispiel #12
0
fullItemList = ["xAOD::EventInfo#*", "xAOD::EventAuxInfo#*"]

try:
    include("EventAthenaPool/EventAthenaPoolItemList_joboptions.py")
    fullAODList += CfgItemList("EventAthenaPool",
                               items=fullItemList,
                               allowWildCard=True)
except Exception:
    treatException(
        "Could not include EventAthenaPool/EventAthenaPoolItemList_joboptions.py"
    )

# RawInfoSummaryForTag
try:
    fullItemList = []
    protectedInclude(
        "EventTagAthenaPOOL/EventTagAthenaPOOLItemList_joboptions.py")
    fullAODList += CfgItemList("EventTagAthenaPOOL",
                               items=fullItemList,
                               allowWildCard=True)
except Exception:
    treatException(
        "Could not include EventTagAthenaPOOL/EventTagAthenaPOOLItemList_joboptions.py"
    )

# MC Event Collection. Should be moved to a separate jobO
if rec.doTruth():
    McTruthAODList = [
        "xAOD::TruthEventContainer#TruthEvents",
        "xAOD::TruthEventAuxContainer#TruthEventsAux.",
        "xAOD::TruthParticleContainer#TruthParticles",
        "xAOD::TruthParticleAuxContainer#TruthParticlesAux.-caloExtension",
# use to flag domain
import PerfMonComps.DomainsRegistry as pdr

from AODFix.AODFix import *
AODFix_Init()


from CaloRec.CaloRecFlags import jobproperties
#
# functionality : electron photon identification
#
#

pdr.flag_domain('egamma')
if rec.doEgamma():
    protectedInclude( "egammaRec/egammaRec_jobOptions.py" )
AODFix_postEgammaRec()


#
# functionality : Muon combined reconstruction
#
pdr.flag_domain('muoncomb')
if rec.doMuonCombined() and DetFlags.Muon_on() and DetFlags.ID_on():
    try:
        include ("MuonCombinedRecExample/MuonCombinedRec_config.py")
    except Exception:
        treatException("Could not set up combined muon reconstruction. Switched off !")
        rec.doMuonCombined = False

#
Beispiel #14
0
                      or rec.doEgamma()):  #   or rec.readESD()
    try:
        from TrackToCalo.CaloExtensionBuilderAlgConfig import CaloExtensionBuilder
        CaloExtensionBuilder(
            "NoCut",
            500.)  #Arguments are cutLevel and minPt for track selection
    except Exception:
        treatException("Cannot include CaloExtensionBuilder !")

#
# functionality : electron photon identification
#
#
pdr.flag_domain('egamma')
if rec.doEgamma():
    protectedInclude("egammaRec/egammaRec_jobOptions.py")
AODFix_postEgammaRec()

#
# functionality : Muon combined reconstruction
#
pdr.flag_domain('muoncomb')
if rec.doMuonCombined() and DetFlags.Muon_on() and DetFlags.ID_on():
    try:
        include("MuonCombinedRecExample/MuonCombinedRec_config.py")
    except Exception:
        treatException(
            "Could not set up combined muon reconstruction. Switched off !")
        rec.doMuonCombined = False

#
def Initiate(ConfInstance=None):
  """Sets up the basic global tools required for B-Tagging. This function is idempotent; it will not run again if it has run once. It is
  typically called by other functions in this file to make sure the basic global tools exist.

  The function returns True if B-Tagging is initialized or has been before. It returns False if it B-Tagging has been switched off for various
  reasons (these are checked in the checkFlagsUsingBTaggingFlags function).

  If the B-tagging calibration broker has been registered we assume initiation has already been performed; this allows users to setup their own initiation code."""

  if ConfInstance is None:
    from BTagging.BTaggingConfiguration import getConfiguration
    ConfInstance = getConfiguration()

  if ConfInstance._Initialized:
    return True
  
  from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags
  # The Run() parameter only exists for ATLAS-R1(...) and ATLAS-R2(...) geo tags,
  # not for ATLAS-GEO(...) and ATLAS-IBL(...) ones. Hence if Run() is undefined,
  # presence of IBL is used to switch between Run1/Run2
  if (geoFlags.Run() == "RUN1" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False)):
    print ConfInstance.BTagTag()+' - INFO - Setting up Run 1 configuration'
    BTaggingFlags.JetFitterNN=True
    BTaggingFlags.SV2    =True
    BTaggingFlags.JetFitterCharm=False
    
  if ConfInstance.getTool("BTagCalibrationBrokerTool"):
    print ConfInstance.BTagTag()+' - INFO - BTagCalibrationBrokerTool already exists prior to default initialization; assuming user set up entire initialization him/herself. Note however that if parts of the initalization were not set up, and a later tool requires them, they will be set up at that point automatically with default settings.'
    ConfInstance._Initialized = True
    return True

  print ConfInstance.BTagTag()+' - INFO - Initializing default basic tools'

  if ConfInstance.checkFlagsUsingBTaggingFlags():

    #Print the flags
    BTaggingFlags.Print()

    #If debugging do a check of the tool collection structure
    if(BTaggingFlags.OutputLevel < 3):
      from BTagging.BTaggingConfiguration import checkToolCollectionStructure
      checkToolCollectionStructure()

    #Get TheTruthCollectionKey from input
    TheTruthCollectionKey = 'TruthEvents'
    BTaggingFlags.RetagJets = BTaggingFlags.Jets
    if BTaggingFlags.AutoInspectInputFile:
      from AthenaCommon.GlobalFlags import globalflags
      if globalflags.InputFormat == 'pool':
        try:
          from RecExConfig.InputFilePeeker import inputFileSummary
          BTaggingFlags.RetagJets = []
          for i in inputFileSummary['eventdata_items']:
            if i[0] == 'McEventCollection':
              # TheTruthCollectionKey = i[1] # disable taking the name from the input file?
              pass
            elif i[0] == 'JetCollection':
              jetC1 = (i[1]).replace('AODJets','')
              jetC = jetC1.replace('Jets','')
              if jetC in BTaggingFlags.Jets:
                BTaggingFlags.RetagJets += [ jetC ]
        except Exception, err:
          print ConfInstance.BTagTag()+' - WARNING - Automatic inspection of input file failed (file too old?)'

    print ConfInstance.BTagTag()+' - Using ', TheTruthCollectionKey, ' as truth key'
#    print ConfInstance.BTagTag()+' - Re-tagging these jet collections: ', BTaggingFlags.RetagJets

    #
    # ============ Setup basic services
    #
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if not hasattr(svcMgr, 'THistSvc'):
      from GaudiSvc.GaudiSvcConf import THistSvc
      svcMgr += THistSvc()
    if not 'topSequence' in dir():
      from AthenaCommon.AlgSequence import AlgSequence
      topSequence = AlgSequence()

    # 
    # ========== Add tools now
    #
    
    # -------------- Calibration Broker --------------
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.Resilience import treatException,protectedInclude
    if ConfInstance._name == "":
      protectedInclude("BTagging/BTagCalibBroker_jobOptions.py") # New file which includes the file from JetCalibration and also registers it via registerTool() so it will be recognized by the various addTool() functions.
      BTagCalibrationBrokerTool = ConfInstance.getTool("BTagCalibrationBrokerTool") # In case this variable is needed
    elif ConfInstance._name == "Trig":
      protectedInclude("BTagging/BTagCalibBroker_Trig_jobOptions.py")
      BTagCalibrationBrokerTool = ConfInstance.getTool("BTagCalibrationBrokerTool")
    else:
      print ConfInstance.BTagTag()+' - ERROR - Configuration instance "'+ConfInstance._name+'" has no calibration broker setup specified!'
      raise RuntimeError
    # -------------- \Calibration Broker --------------
    

    global BTagJetTruthMatching
    global BTagLeptonTruthTool
    global thisBTagLabeling
    # FF: disable cone-based labelling as this is now being done as a part of jet reconstruction
    BTagJetTruthMatching = None
    BTagLeptonTruthTool = None
    thisBTagLabeling = None

    # -- to label jets with truth information
    #from JetRec.JetRecFlags import jetFlags
    #if jetFlags.useTruth():
    #  # Jet Label
    #  if BTaggingFlags.jetTruthMatching == 'matchQuark' or BTaggingFlags.jetTruthMatching == 'jetTrackTruthMatching':
    #    BTagJetTruthMatching = addTool("BTagJetTruthMatching", 
    #                                   ToolSvc = ToolSvc, 
    #                                   Verbose = BTaggingFlags.OutputLevel < 3,
    #                                   options = {'subtype' : BTaggingFlags.jetTruthMatching},
    #                                   SuppressNonCloneWarning=True)        
    #    BTagJetTruthMatching.McEventCollection = TheTruthCollectionKey
    #  else:
    #    BTagJetTruthMatching = None
    #    print("#BTAG# - WARNING - BTaggingFlags.jetTruthMatching has unsupported value!")
    #  # Lepton Truth Match
    #  #BTagLeptonTruthTool = addTool('BTagLeptonTruthTool', ToolSvc = ToolSvc, Verbose = BTaggingFlags.OutputLevel < 3)
    #  #BTagLeptonTruthTool.McEventCollection = TheTruthCollectionKey
    #  BTagLeptonTruthTool = None # TEMPORARY: BTagLeptonTruthTool not implemented yet?
    #  # Labeling tool
    #  thisBTagLabeling = addTool("thisBTagLabeling", ToolSvc = ToolSvc, Verbose = BTaggingFlags.OutputLevel < 3,
    #                                        options = {'JetTruthMatchTool' : BTagJetTruthMatching,
    #                                                   #'LeptonTruthTool'   : BTagLeptonTruthTool}, TEMPORARY: BTagLeptonTruthTool not implemented yet?
    #                                                   },
    #                                        SuppressNonCloneWarning=True)
    #else:
    #  BTagJetTruthMatching = None
    #  BTagLeptonTruthTool  = None
    #  thisBTagLabeling = None
      # NOTE: These variables no longer serve any purpose, since any tool can be retrieved using getTool

    # -- for reference mode:
    if BTaggingFlags.Runmodus == 'reference':
      
      svcMgr.THistSvc.Output += ["RefFile DATAFILE='BTagCalibALL.root' OPT='RECREATE'"]
      #for key in BTaggingFlags.Jets:
      #  for tagger in ['JetProb','IP1D','IP2D','IP2DSpc','IP3D','IP3DSpc','SV1','SV2','SoftMu','SoftEl','JetFitterTagNN','JetFitterCOMBNN']:
      #    if BTaggingFlags.IsEnabled(tagger):
      #      RefileName = "BTaggingRef"+tagger+key+".root"
      #      svcMgr.THistSvc.Output += ["RefFile"+tagger+key+" DATAFILE='"+RefileName+"' OPT='RECREATE'"]

    ConfInstance._Initialized = True
    return True
Beispiel #16
0
def getLArPileUpTool(name='LArPileUpTool', **kwargs): ## useLArFloat()=True,isOverlay()=False,outputKey='LArDigitContainer_MC'):
    from AthenaCommon.Logging import logging
    mlog = logging.getLogger( 'LArPileUpToolDefault:' )
    mlog.info(" ---- in getLArPileUpTool " )
    # the LAr and Calo detector description package
    ## FIXME includes to be replaced by confGetter configuration.
    if not isOverlay():
        from AthenaCommon.Resilience import protectedInclude
        protectedInclude( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py" )
        protectedInclude( "LArDetDescr/LArDetDescr_joboptions.py" )
        protectedInclude("LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py")
    from Digitization.DigitizationFlags import digitizationFlags
    kwargs.setdefault('NoiseOnOff', digitizationFlags.doCaloNoise.get_Value() )
    kwargs.setdefault('RndmSvc', digitizationFlags.rndmSvc.get_Value() )
    digitizationFlags.rndmSeedList.addSeed("LArDigitization", 1234, 5678 )
    kwargs.setdefault('DoDigiTruthReconstruction',digitizationFlags.doDigiTruth())

    if digitizationFlags.doXingByXingPileUp():
        kwargs.setdefault('FirstXing', -751 )
        kwargs.setdefault('LastXing', 101 )

    from LArDigitization.LArDigitizationFlags import jobproperties
    # check if using high gain for Fcal or not
    if  (not jobproperties.LArDigitizationFlags.useFcalHighGain()) and (not isOverlay()):
        mlog.info("do not use high gain in Fcal digitization ")
        kwargs.setdefault('HighGainThreshFCAL', 0 )
    else:
        mlog.info("use high gain in Fcal digitization or overlay job")

    # check if using high gain for EMEC IW or not
    if (not jobproperties.LArDigitizationFlags.useEmecIwHighGain()) and (not isOverlay()):
       mlog.info("do not use high gain in EMEC IW digitization ")
       kwargs.setdefault('HighGainThreshEMECIW',0)

    kwargs.setdefault('RndmEvtOverlay', isOverlay() )
    kwargs.setdefault('DigitContainer', 'LArDigitContainer_MC' ) ##FIXME - should not be hard-coded

    # if doing MC+MC overlay
    from AthenaCommon.GlobalFlags import globalflags
    if isOverlay() and globalflags.DataSource() == 'geant4':
        kwargs.setdefault('isMcOverlay',True)

    from LArROD.LArRODFlags import larRODFlags
    kwargs.setdefault('Nsamples', larRODFlags.nSamples() )
    kwargs.setdefault('firstSample', larRODFlags.firstSample() )

    if  isOverlay() :
         kwargs.setdefault('RandomDigitContainer', 'LArDigitContainer_MC' )

    # ADC2MeVTool
    mlog.info(" ----  set LArADC2MeVToolDefault")
    kwargs.setdefault('ADC2MeVTool', 'LArADC2MeVToolDefault')

    # Tool for noise autocorrelation generation
    kwargs.setdefault('AutoCorrNoiseTool', 'LArAutoCorrNoiseToolDefault')

    # bad channel masking
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
    theLArBadChannelTool=LArBadChanTool()
    from AthenaCommon.AppMgr import ToolSvc
    ToolSvc+=theLArBadChannelTool
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
    theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
    theLArRCBMasker.TheLArBadChanTool = theLArBadChannelTool
    theLArRCBMasker.DoMasking=True
    theLArRCBMasker.ProblemsToMask=[
         "deadReadout","deadPhys"]
    ToolSvc+=theLArRCBMasker
    kwargs.setdefault('MaskingTool', theLArRCBMasker )
    kwargs.setdefault('BadChannelTool', theLArBadChannelTool )

    # CosmicTriggerTimeTool for cosmics digitization
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == "cosmics" :
        from CommissionUtils.CommissionUtilsConf import CosmicTriggerTimeTool
        theTriggerTimeTool = CosmicTriggerTimeTool()
        ToolSvc += theTriggerTimeTool
        kwargs.setdefault('UseTriggerTime', True )
        kwargs.setdefault('TriggerTimeToolName', theTriggerTimeTool )


    # pileup configuration "algorithm" way
    if not digitizationFlags.doXingByXingPileUp():
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.pileup.LAr_on() or isOverlay():
            kwargs.setdefault('PileUp', True )

    kwargs.setdefault('useLArFloat', useLArFloat() )
    if useLArFloat():
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from SGComps.SGCompsConf import AddressRemappingSvc
        AddressRemappingSvc = AddressRemappingSvc()
        svcMgr += AddressRemappingSvc
        from AthenaCommon.ConfigurableDb import getConfigurable
        svcMgr += getConfigurable( "ProxyProviderSvc" )()
        svcMgr.ProxyProviderSvc.ProviderNames += [ "AddressRemappingSvc" ]
        svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [ "LArHitContainer#LArHitEMB->LArHitFloatContainer#LArHitEMB" ,
                                                            "LArHitContainer#LArHitEMEC->LArHitFloatContainer#LArHitEMEC",
                                                            "LArHitContainer#LArHitHEC->LArHitFloatContainer#LArHitHEC",
                                                            "LArHitContainer#LArHitFCAL->LArHitFloatContainer#LArHitFCAL"]
        svcMgr.AddressRemappingSvc.ProxyDict="ActiveStoreSvc"


    return CfgMgr.LArPileUpTool(name, **kwargs)
def BasicTRTDigitizationTool(name, **kwargs):

    from AthenaCommon.Resilience import protectedInclude
    protectedInclude("TRT_Digitization/TRT_Digitization_CommonOptions.py")
    kwargs.setdefault("PAI_Tool_Xe", "TRT_PAI_Process_Xe")
    kwargs.setdefault("PAI_Tool_Ar", "TRT_PAI_Process_Ar")
    kwargs.setdefault("PAI_Tool_Kr", "TRT_PAI_Process_Kr")

    from Digitization.DigitizationFlags import digitizationFlags
    #flag from Simulation/Digitization
    if not digitizationFlags.doInDetNoise.get_Value():
        kwargs.setdefault("Override_noiseInSimhits", 0)
        kwargs.setdefault("Override_noiseInUnhitStraws", 0)
    #kwargs.setdefault("Override_useMagneticFieldMap=0)
    #TRT xenon range cut
    trtRangeCut = 0.05
    if hasattr(digitizationFlags, 'TRTRangeCut'):
        trtRangeCut = digitizationFlags.TRTRangeCut.get_Value()
    kwargs.setdefault("Override_TrtRangeCutProperty", trtRangeCut)

    # Import Beam job properties
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == "cosmics":
        kwargs.setdefault("PrintDigSettings", True)
        kwargs.setdefault("Override_cosmicFlag", 0)
        kwargs.setdefault("Override_doCosmicTimingPit", 1)
        kwargs.setdefault("Override_jitterTimeOffset", 0.)
        kwargs.setdefault("Override_timeCorrection", 0)

    #choose random number service
    kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc())
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(
            "TRT_DigitizationTool"):
        digitizationFlags.rndmSeedList.addSeed("TRT_DigitizationTool", 123456,
                                               345123)
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(
            "TRT_ElectronicsNoise"):
        digitizationFlags.rndmSeedList.addSeed("TRT_ElectronicsNoise", 123,
                                               345)
    if not digitizationFlags.rndmSeedList.checkForExistingSeed("TRT_Noise"):
        digitizationFlags.rndmSeedList.addSeed("TRT_Noise", 1234, 3456)
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(
            "TRT_ThresholdFluctuations"):
        digitizationFlags.rndmSeedList.addSeed("TRT_ThresholdFluctuations",
                                               12345, 34567)
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(
            "TRT_ProcessStraw"):
        digitizationFlags.rndmSeedList.addSeed("TRT_ProcessStraw", 123456,
                                               345678)
    if not digitizationFlags.rndmSeedList.checkForExistingSeed("TRT_PAI"):
        digitizationFlags.rndmSeedList.addSeed("TRT_PAI", 12345678, 34567890)
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(
            "TRT_FakeConditions"):
        digitizationFlags.rndmSeedList.addSeed("TRT_FakeConditions", 123456789,
                                               345678901)
    #This last one should, however, never be changed (unless you want a different layout of noisy channels etc.):

    if digitizationFlags.doXingByXingPileUp():
        kwargs.setdefault("FirstXing", TRT_FirstXing())
        kwargs.setdefault("LastXing", TRT_LastXing())

    ##else:
    ##    from AthenaCommon.DetFlags import DetFlags
    ##    from AthenaCommon.AppMgr import ServiceMgr
    ##    from PileUpComps.PileUpCompsConf import PileUpXingFolder
    ##    if DetFlags.pileup.TRT_on():
    ##        TRTRange = PileUpXingFolder( "TRTRange" )
    ##        TRTRange.ItemList += ["TRTUncompressedHitCollection#TRTUncompressedHits"]
    ##        #this is the time of the xing in ns
    ##        TRTRange.FirstXing = TRT_FirstXing()
    ##        TRTRange.LastXing  = TRT_LastXing()
    ##        TRTRange.CacheRefreshFrequency = 1.0; #default 0 no dataproxy reset
    ##        # add TRTRange to known pileuo intervals
    ##        ServiceMgr.PileUpMergeSvc.Intervals += [TRTRange]

    return CfgMgr.TRTDigitizationTool(name, **kwargs)
Beispiel #18
0
#------------------------------------------------------------
# Event Data Model Monitor
#------------------------------------------------------------

if doEdmMonitor:
    from TrkValAlgs.TrkValAlgsConf import Trk__EventDataModelMonitor
    InDetEdmMonitor = Trk__EventDataModelMonitor(name='InDetEdmMonitor')
    topSequence += InDetEdmMonitor
    if (InDetFlags.doPrintConfigurables()):
        print InDetEdmMonitor
## DBM TruthLinks
if (InDetFlags.doDBMstandalone()
        or InDetFlags.doDBM()) and InDetFlags.doTruth():
    from AthenaCommon.Resilience import protectedInclude
    protectedInclude("McParticleAlgs/TruthParticleBuilder_jobOptions_DBM.py")

#--------------------------------------------------------------
# Load Inner Detector reconstruction
#--------------------------------------------------------------

if not (('doWriteBS' in dir() and doWriteBS)):
    include("InDetRecExample/InDetRec_jobOptions.py")

#--------------------------------------------------------------
# Load Inner Detector Monitoring, use the data quality flags for steering
#--------------------------------------------------------------
if InDetFlags.doMonitoring():
    if not hasattr(ServiceMgr, 'THistSvc'):
        from GaudiSvc.GaudiSvcConf import THistSvc
        ServiceMgr += THistSvc()
from AthenaCommon.Resilience import treatException, protectedInclude
from ParticleBuilderOptions.AODFlags import AODFlags

from AthenaCommon.GlobalFlags import globalflags

if AODFlags.JetTag:
    protectedInclude("BTagging/BTagging_jobOptions.py")

#if AODFlags.SpclMC:
#    protectedInclude( "McParticleAlgs/TruthParticleBuilder_jobOptions.py" )

# Fast Simulation AOD
if AODFlags.FastSimulation:
    try:
        include("ParticleBuilderOptions/runFastSim.py")
        from AtlfastAlgs.GlobalEventDataGetter import Atlfast__GlobalEventDataGetter
        GlobalEventDataMaker = Atlfast__GlobalEventDataGetter().AlgHandle()
        GlobalEventDataMaker.McLocation = AODFlags.McEventKeyStr()
        include("AtlfastConversionAlgs/AtlfastConversion_jobOptions.py")
        if AODFlags.MissingEtTruth or AODFlags.FastTrackParticle:
            protectedInclude("RecAthenaPool/RecAthenaPool_joboptions.py")
        if AODFlags.MissingEtTruth:
            protectedInclude(
                "ParticleBuilderOptions/MissingEtTruth_jobOptions.py")
    except Exception:
        treatException("Could not load FastSim")

    from FastSimulationConfig.FastSimulationFlags import jobproperties
    if jobproperties.FastSimulation.doAtlfastICorrection == True:
        include("AtlfastCorrectionAlgs/AtlfastCDivide.py")
Beispiel #20
0
###################
# Common Services #
###################

# ConditionsTag
from IOVDbSvc.CondDB import conddb
if len(globalflags.ConditionsTag()) != 0:
    conddb.setGlobalTag(globalflags.ConditionsTag())

# Detector geometry and magnetic field
if rec.LoadGeometry():
    include("RecExCond/AllDet_detDescr.py")

# Particle Property
protectedInclude("PartPropSvc/PartPropSvc.py")
include.block("PartPropSvc/PartPropSvc.py")

# Detector Status
if rec.doDetStatus() and not athenaCommonFlags.isOnline():
    try:
        include("DetectorStatus/DetStatusSvc_CondDB.py")
    except Exception:
        treatException("Could not load DetStatusSvc_CondDb !")
        rec.doFileMetaData = False

    if rec.doFileMetaData():
        #DR FIXME not sure about commissioing exception, filemetadata should be in filteredESD as well
        if rec.doWriteRDO() or rec.doWriteESD() or rec.doWriteAOD(
        ) or rec.doDPD():
            protectedInclude("DetectorStatus/DetStatusSvc_ToFileMetaData.py")
Beispiel #21
0
from AthenaCommon.GlobalFlags import globalflags

from AthenaCommon.Logging import logging
logRecoOutputItemList_jobOptions = logging.getLogger(
    'py:RecoOutputItemList_jobOptions')

from RecExConfig.RecFlags import rec

from AthenaCommon.KeyStore import CfgItemList

# Start with an empty list:
fullESDList = CfgItemList("EsdList")

# EventInfo stuff
fullItemList = ["xAOD::EventInfo#*", "xAOD::EventAuxInfo#*"]
protectedInclude("EventAthenaPool/EventAthenaPoolItemList_joboptions.py")
fullESDList += CfgItemList("EventAthenaPool",
                           items=fullItemList,
                           allowWildCard=True)

# DetectorStatus
#obsolete fullESDList += [ "DetStatusMap#DetectorStatus" ]

# RawInfoSummaryForTag
try:
    fullItemList = []
    protectedInclude(
        "EventTagAthenaPOOL/EventTagAthenaPOOLItemList_joboptions.py")
    fullESDList += CfgItemList("EventTagAthenaPOOL",
                               items=fullItemList,
                               allowWildCard=True)
Beispiel #22
0
excludeTracePattern.append("*/RecExConfig/RecoFunctions.py")
excludeTracePattern.append("*/DQDefects/virtual*")
#####################
# Flags (separated) #
#####################

#include ( "RecExCond/RecExCommon_flags.py" )


###################
# Common Services #
###################


# Particle Property
protectedInclude( "PartPropSvc/PartPropSvc.py" )
include.block( "PartPropSvc/PartPropSvc.py" )

#Output file TagInfo and metadata
#from AthenaCommon.AppMgr import ServiceMgr as svcMgr
#svcMgr.TagInfoMgr.ExtraTagValuePairs += ["beam_type", jobproperties.Beam.beamType()]
#svcMgr.TagInfoMgr.ExtraTagValuePairs += ["beam_energy", str(jobproperties.Beam.energy())]
#svcMgr.TagInfoMgr.ExtraTagValuePairs += ["triggerStreamOfFile", str(rec.triggerStream())]
#svcMgr.TagInfoMgr.ExtraTagValuePairs += ["project_name", str(rec.projectName())]
#if rec.AMITag()!="": svcMgr.TagInfoMgr.ExtraTagValuePairs += ["AMITag", rec.AMITag() ]
#svcMgr.TagInfoMgr.ExtraTagValuePairs += ["AtlasRelease_" + rec.OutputFileNameForRecoStep(), rec.AtlasReleaseVersion() ]



# end flag settings section
##########################################################################
Beispiel #23
0
# filterseq += CfgMgr.met__METAssocTestAlg("TestMETAssocEMTopo",
#                                          OutputLevel=VERBOSE,
#                                          FailOnInconsistency=True,
#                                          METMapSuffix="NewAntiKt4EMTopo")
# filterseq += CfgMgr.met__METAssocTestAlg("TestMETAssocEMPFlow",
#                                          OutputLevel=VERBOSE,
#                                          FailOnInconsistency=True,
#                                          METMapSuffix="NewAntiKt4EMPFlow")

write_xAOD = True
if write_xAOD:

    # The list of output containers/maps is autogenerated and stored in metFlags
    # This jO extracts them with the appropriate formatting
    from AthenaCommon.Resilience import protectedInclude
    protectedInclude(
        "METReconstruction/METReconstructionOutputAODList_jobOptions.py")

    from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
    xaodStream = MSMgr.NewPoolRootStream("StreamAOD", "xAOD3.pool.root")
    for item in MissingETAODList:
        xaodStream.AddItem(item)

    xaodStream.AddItem('xAOD::MissingETContainer#MET_Reference_Anti*')
    xaodStream.AddItem('xAOD::MissingETAuxContainer#MET_Reference_Anti*Aux.')

    xaodStream.AddItem('xAOD::TrackParticleContainer#InDetTrackParticles*')
    xaodStream.AddItem(
        'xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux.')

    # xaodStream.AddAcceptAlgs( "PVSoftTrkTail" )
theApp.EvtMax = 200
Beispiel #24
0
if DetFlags.detdescr.any_on():
    # if an detdescr flag is on, then configure appropriately the
    # StoreGateSvc/DetectorStore and the DetDescrCnvSvc
    import DetDescrCnvSvc.DetStoreConfig

    # guess geometry version from globalflags
    # see AtlasGeomodel/SetGeometryVersion.py for the possibilities
    # e.g. DetDescrVersion="Rome-Initial"

    from AtlasGeoModel import SetGeometryVersion
    from AtlasGeoModel import GeoModelInit
    from AtlasGeoModel import SetupRecoGeometry

    if DetFlags.detdescr.Tile_on() and not rec.doAODMerging():

        protectedInclude("TileConditions/TileConditions_jobOptions.py")

    if DetFlags.detdescr.Calo_on() and not rec.doAODMerging():
        protectedInclude("CaloIdCnv/CaloIdCnv_joboptions.py")
        #FIXME tile and lar not independent
        protectedInclude("TileIdCnv/TileIdCnv_jobOptions.py")

    if DetFlags.detdescr.LAr_on() and not rec.doAODMerging():
        try:
            include("LArDetDescr/LArDetDescr_joboptions.py")
        except Exception:
            DetFlags.Calo_setOff()
            treatException(
                "could not load LArDetDescr_jobOptions. Calo switched off")

    from AthenaCommon.AppMgr import ServiceMgr
Beispiel #25
0
def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs):
    from AthenaCommon import CfgGetter
    kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc())
    streamName = kwargs.setdefault("RndmEngine", "PixelDigitization")
    if not digitizationFlags.rndmSeedList.checkForExistingSeed(streamName):
        digitizationFlags.rndmSeedList.addSeed(streamName, 10513239, 492615104 )
    from AthenaCommon.BeamFlags import jobproperties
    from AthenaCommon.Resilience import protectedInclude
    from AthenaCommon.Include import include
    from AthenaCommon.AppMgr import ServiceMgr
    protectedInclude( "PixelConditionsServices/SpecialPixelMapSvc_jobOptions.py" )
    include.block( "PixelConditionsServices/SpecialPixelMapSvc_jobOptions.py" )
    protectedInclude( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" )
    include.block( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" )
    protectedInclude("PixelConditionsServices/PixelCalibSvc_jobOptions.py")
    from IOVDbSvc.CondDB import conddb
    conddb.addFolderSplitMC("PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed")
    kwargs.setdefault("PixelCablingSvc","PixelCablingSvc")
    if not hasattr(ServiceMgr, "PixelSiPropertiesSvc"):
        from SiLorentzAngleSvc.LorentzAngleSvcSetup import lorentzAngleSvc
        from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc
        pixelSiPropertiesSvc = SiPropertiesSvc(name = "PixelSiPropertiesSvc",DetectorName="Pixel",SiConditionsServices = lorentzAngleSvc.pixelSiliconConditionsSvc)
        ServiceMgr += pixelSiPropertiesSvc
    kwargs.setdefault("InputObjectName", "PixelHits")
    pixTools = []
    pixTools += ['PixelDiodeCrossTalkGenerator']
    pixTools += ['PixelChargeSmearer']
    if digitizationFlags.doInDetNoise.get_Value():
        pixTools += ['PixelNoisyCellGenerator']
    pixTools += ['PixelGangedMerger']
    pixTools += ['SpecialPixelGenerator']
    pixTools += ['PixelRandomDisabledCellGenerator']
    pixTools += ['PixelCellDiscriminator']
    kwargs.setdefault("PixelTools", pixTools)
    # Start of special cosmics tuning:
    if jobproperties.Beam.beamType == "cosmics" :
        kwargs.setdefault("UseComTime", True)
    if GeometryFlags.isSLHC():
        LVL1Latency = [255, 255, 255, 255, 255, 16, 255]
        ToTMinCut = [0, 0, 0, 0, 0, 0, 0]
        ApplyDupli = [False, False, False, False, False, False, False]
        LowTOTduplication = [0, 0, 0, 0, 0, 0, 0]
        kwargs.setdefault("LVL1Latency", LVL1Latency)
        kwargs.setdefault("ToTMinCut", ToTMinCut)
        kwargs.setdefault("ApplyDupli", ApplyDupli)
        kwargs.setdefault("LowTOTduplication", LowTOTduplication)
    else:
        # For LVL1Latency, ToTMinCut, ApplyDupli and LowTOTduplication, first component [0] is always for IBL, even for run 1 production.
        # The order is IBL, BL, L1, L2, EC, DBM
        # For IBL and DBM, values of LVL1Latency and LowToTDupli are superseded by values driven by HitDiscCnfg settings, in PixelDigitizationTool.cxx
        LVL1Latency = [16, 150, 255, 255, 255, 16]
        ToTMinCut = [0, 6, 6, 6, 6, 0]
        ApplyDupli = [True, False, False, False, False, False]
        LowTOTduplication = [0, 7, 7, 7, 7, 0]
        kwargs.setdefault("LVL1Latency", LVL1Latency)
        kwargs.setdefault("ToTMinCut", ToTMinCut)
        kwargs.setdefault("ApplyDupli", ApplyDupli)
        kwargs.setdefault("LowTOTduplication", LowTOTduplication)
    if digitizationFlags.doXingByXingPileUp(): # PileUpTool approach
        kwargs.setdefault("FirstXing", Pixel_FirstXing() )
        kwargs.setdefault("LastXing", Pixel_LastXing() )
    return CfgMgr.PixelDigitizationTool(name, **kwargs)
Beispiel #26
0
include.block("ISF_Config/AllDet_detDescr.py")
# also block alternatives
include.block("RecExCond/AllDet_detDescr.py")
include.block("RecExCommon/AllDet_detDescr.py")

from AthenaCommon.Resilience import protectedInclude
from AthenaCommon.DetFlags import DetFlags
if DetFlags.detdescr.any_on():
    from AtlasGeoModel import SetGeometryVersion
    from AtlasGeoModel import GeoModelInit
    from AtlasGeoModel import SetupRecoGeometry

    import os
    if "AthSimulation_DIR" not in os.environ:
        if DetFlags.detdescr.LAr_on():
            protectedInclude("LArDetDescr/LArDetDescr_joboptions.py")

        if DetFlags.detdescr.Tile_on():
            protectedInclude("TileConditions/TileConditions_jobOptions.py")

        if DetFlags.detdescr.Muon_on():
            protectedInclude("AmdcAth/AmdcAth_jobOptions.py")

    from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
    if not MuonGeometryFlags.hasCSC():
        DetFlags.CSC_setOff()

    # MagneticField Service
    if DetFlags.detdescr.BField_on():
        import MagFieldServices.SetupField
Beispiel #27
0
#==============================================================
from AthenaCommon.Resilience import protectedInclude
from AthenaCommon.DetFlags import DetFlags
from Digitization.DigitizationFlags import digitizationFlags
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from AthenaCommon.Logging import logging  # loads logger
log = logging.getLogger( "LVL1Digitization" )

#--------------------------------------------------------------
# set up simulation of LVL1 Trigger inputs
# (a prerequisite for LVL1 simulation)
#--------------------------------------------------------------
if DetFlags.simulateLVL1.LAr_on():
    protectedInclude( "LArL1Sim/LArL1Sim_G4_jobOptions.py" )
    # Noise
    if not digitizationFlags.doCaloNoise.get_Value():
        topSequence.LArTTL1Maker.NoiseOnOff= False #(default:True)
    # PileUp
    if DetFlags.pileup.LAr_on(): #DetFlags.pileup.LVL1_on():
        topSequence.LArTTL1Maker.PileUp = True
    else:
        topSequence.LArTTL1Maker.PileUp = False

if DetFlags.simulateLVL1.Tile_on():
    protectedInclude( "TileSimAlgs/TileTTL1_jobOptions.py" )
    protectedInclude( "TileSimAlgs/TileMuonReceiver_jobOptions.py" )

if DetFlags.digitize.LVL1_on():
Beispiel #28
0
from AthenaCommon.Resilience import treatException, protectedInclude
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.Logging import logging

logCBNT_config = logging.getLogger('CBNT_config')

protectedInclude("CBNT_Athena/CBNT_AthenaAware_jobOptions.py")

# in case it ws forgotten
theApp.HistogramPersistency = "ROOT"

# run/event number
protectedInclude("CBNT_Athena/CBNT_EventInfo_jobOptions.py")

from AthenaCommon.GlobalFlags import globalflags
from RecExConfig.RecFlags import rec
from RecExConfig.RecAlgsFlags import recAlgs

if rec.Commissioning:
    CBNTAthenaAware = True

if rec.doTruth():
    protectedInclude("RecExCommon/CBNT_Truth_jobOptions.py")

    if not (globalflags.DetDescrVersion()[0:3] == "DC1"
            or globalflags.DetDescrVersion()[0:3] == "DC2"):
        protectedInclude("MCTruthAlgs/CBNT_TrackRecord.py")

if (DetFlags.haveRIO.ID_on() or rec.readESD() or rec.readAOD()):
    # no CBNT for ID anymore (use track validation ntuple)
    if jobproperties.Beam.beamType() == "collisions":
Beispiel #29
0
include.block ( "EventOverlayJobTransforms/BeamOverlay_jobOptions.py" )

from AthenaCommon.DetFlags import DetFlags

from AthenaCommon.Resilience import treatException,protectedInclude

if DetFlags.overlay.BCM_on():
    protectedInclude( "InDetBCM_EventAthenaPool/InDetBCM_EventAthenaPool_joboptions.py" )
    from AthenaCommon.AlgSequence import AlgSequence
    job = AlgSequence()
    from AthenaCommon import CfgGetter
    job += CfgGetter.getAlgorithm("BCM_OverlayDigitization")


Beispiel #30
0
from AthenaCommon.GlobalFlags import globalflags
from RecExConfig.RecFlags import rec
from RecExConfig.RecAlgsFlags import recAlgs

from AthenaCommon.Resilience import treatException, protectedInclude

# use to flag domain
import PerfMonComps.DomainsRegistry as pdr

from AODFix.AODFix import *
AODFix_Init()

#First do Calo-Reco
pdr.flag_domain('calo')
protectedInclude("CaloRec/CaloRec_jobOptions.py")
AODFix_postCaloRec()

#then run ID reco:

pdr.flag_domain('id')
if DetFlags.detdescr.ID_on():
    protectedInclude("InDetRecExample/InDetRec_jobOptions.py")
    AODFix_postInDetRec()

# functionality : FTK reconstruction
if DetFlags.detdescr.FTK_on():
    protectedInclude("FTK_RecExample/FTKRec_jobOptions.py")

# functionality : Muon reconstruction
pdr.flag_domain('muon')
Beispiel #31
0
def Initiate(ConfInstance=None):
  """Sets up the basic global tools required for B-Tagging. This function is idempotent; it will not run again if it has run once. It is
  typically called by other functions in this file to make sure the basic global tools exist.

  The function returns True if B-Tagging is initialized or has been before. It returns False if it B-Tagging has been switched off for various
  reasons (these are checked in the checkFlagsUsingBTaggingFlags function).

  If the B-tagging calibration broker has been registered we assume initiation has already been performed; this allows users to setup their own initiation code."""

  if ConfInstance is None:
    from BTagging.BTaggingConfiguration import getConfiguration
    ConfInstance = getConfiguration()

  if ConfInstance._Initialized:
    return True

  from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
  from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
  from IOVDbSvc.CondDB import conddb
  # Declare the COOL folder to the CondInputLoader
  btagrun1=False
  if conddb.dbdata == 'COMP200':
    btagrun1=True
  elif conddb.isMC:
    # The Run() parameter only exists for ATLAS-R1(...) and ATLAS-R2(...) geo tags,
    # not for ATLAS-GEO(...) and ATLAS-IBL(...) ones. Hence if Run() is undefined,
    # presence of IBL is used to switch between Run1/Run2
    btagrun1 = (commonGeoFlags.Run() == "RUN1" or (commonGeoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False))
  if (btagrun1):
    print (ConfInstance.BTagTag()+' - INFO - Setting up Run 1 configuration')
    BTaggingFlags.JetFitterNN=True
    BTaggingFlags.SV2    =True
    BTaggingFlags.JetVertexCharge=False
    BTaggingFlags.SoftMu=False
    BTaggingFlags.MV2c10mu=False
    BTaggingFlags.MV2c10rnn=False
    BTaggingFlags.MV2cl100=False
    BTaggingFlags.RNNIP=False
    BTaggingFlags.DL1=False
    BTaggingFlags.DL1mu=False
    BTaggingFlags.DL1rnn=False
  else:
    print (ConfInstance.BTagTag()+' - INFO - Setting up Run 2 configuration')

  if ConfInstance._name == "Trig":
    BTaggingFlags.MV2c20=True

  print (ConfInstance.BTagTag()+' - INFO - Initializing default basic tools')

  if ConfInstance.checkFlagsUsingBTaggingFlags():

    #Print the flags
    BTaggingFlags.Print()

    #If debugging do a check of the tool collection structure
    if(BTaggingFlags.OutputLevel < 3):
      from BTagging.BTaggingConfiguration import checkToolCollectionStructure
      checkToolCollectionStructure()

    #Get TheTruthCollectionKey from input
    TheTruthCollectionKey = 'TruthEvents'
    BTaggingFlags.RetagJets = BTaggingFlags.Jets
    if BTaggingFlags.AutoInspectInputFile:
      from AthenaCommon.GlobalFlags import globalflags
      if globalflags.InputFormat == 'pool':
        try:
          from RecExConfig.InputFilePeeker import inputFileSummary
          BTaggingFlags.RetagJets = []
          for i in inputFileSummary['eventdata_items']:
            if i[0] == 'McEventCollection':
              # TheTruthCollectionKey = i[1] # disable taking the name from the input file?
              pass
            elif i[0] == 'JetCollection':
              jetC1 = (i[1]).replace('AODJets','')
              jetC = jetC1.replace('Jets','')
              if jetC in BTaggingFlags.Jets:
                BTaggingFlags.RetagJets += [ jetC ]
        except Exception:
          print (ConfInstance.BTagTag()+' - WARNING - Automatic inspection of input file failed (file too old?)')
          import traceback
          traceback.print_exc()

    print (ConfInstance.BTagTag()+' - Using ', TheTruthCollectionKey, ' as truth key')
#    print (ConfInstance.BTagTag()+' - Re-tagging these jet collections: ', BTaggingFlags.RetagJets)

    #
    # ============ Setup basic services
    #
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    if not hasattr(svcMgr, 'THistSvc'):
      from GaudiSvc.GaudiSvcConf import THistSvc
      svcMgr += THistSvc()
    if not 'topSequence' in dir():
      from AthenaCommon.AlgSequence import AlgSequence
      topSequence = AlgSequence()


    #Create and add our condition algorithm to the Condition Sequencer

    SetupConditionAlgorithm(ConfInstance)

    #
    # ========== Add tools now
    #

    # -------------- Calibration Broker --------------
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.Resilience import treatException,protectedInclude
    if ConfInstance._name == "" or ConfInstance._name == "Trig":
      # No calibration broker setup - The condition algorithm is used
      pass
    elif ConfInstance._name == "AODFix":
      protectedInclude("BTagging/BTagCalibBroker_AODFix_jobOptions.py")
      BTagCalibrationBrokerTool = ConfInstance.getTool("BTagCalibrationBrokerTool")
    else:
      print (ConfInstance.BTagTag()+' - ERROR - Configuration instance "'+ConfInstance._name+'" has no calibration broker setup specified!')
      raise RuntimeError
    # -------------- \Calibration Broker --------------

    # -- for reference mode:
    if BTaggingFlags.Runmodus == 'reference':

      svcMgr.THistSvc.Output += ["RefFile DATAFILE='BTagCalibALL.root' OPT='RECREATE'"]

    ConfInstance._Initialized = True
    return True
  else:
    print (ConfInstance.BTagTag()+' - WARNING - Tool initialization requested but B-Tagging is not possible for the current dataset.')
    return False
Beispiel #32
0
from AthenaCommon.AppMgr import theAuditorSvc
from AthenaCommon.ConfigurableDb import getConfigurable
#theAuditorSvc += getConfigurable("ChronoAuditor")()
#theAuditorSvc += getConfigurable("MemStatAuditor")()
theAuditorSvc += getConfigurable("NameAuditor")()

#--------------------------------------------------------------
#run perfmon
#--------------------------------------------------------------
from PerfMonComps.PerfMonFlags import jobproperties

jobproperties.PerfMonFlags.OutputFile = "ntuple.root"
# by default, PerfMon is disabled: enable it
# see https://twiki.cern.ch/twiki/bin/view/Atlas/PerfMonComps
jobproperties.PerfMonFlags.doMonitoring = True
protectedInclude("PerfMonComps/PerfMonSvc_jobOptions.py")
#instead of doMonitoring may also do
#jobproperties.PerfMonFlags.doFastMon = True

#use a wide name field to "see" the tools in use
svcMgr.MessageSvc.Format = "% F%32W%S%7W%R%T %0W%M"
svcMgr.MessageSvc.enableSuppression = False

#remove some of POOL annoying warnings
svcMgr.PoolSvc.AttemptCatalogPatch = True
#--------------------------------------------------------------
#print configuration flags
#--------------------------------------------------------------
jobproperties.print_JobProperties()
from AthenaCommon.AlgSequence import AlgSequence
Beispiel #33
0
###############################################################
#
# TRT Digitization
#
#==============================================================

# File updated April 2007, by Esben Klinkby <*****@*****.**>
from AthenaCommon.Resilience import protectedInclude

protectedInclude("PartPropSvc/PartPropSvc.py")
protectedInclude("TRT_PAI_Process/TRT_PAI_Process.py")
# Setup to use conditions database folder to steer digitization settings
from AthenaCommon.GlobalFlags import globalflags
if not (globalflags.isOverlay() and globalflags.DataSource == 'data'):
    from IOVDbSvc.CondDB import conddb
    conddb.addFolder("TRT_OFL", "/TRT/Cond/DigVers")