def __init__(self, name="L1MuctpiTool"): LVL1MUCTPI__L1MuctpiTool.__init__(self, name) # Create a logger: from AthenaCommon.Logging import logging logger = logging.getLogger("L1MuctpiTool") # Set properties of the LUT overlap handling: self.OverlapStrategyName = "LUT" self.DumpLUT = False self.LUTXMLFile = "UNDEFINED" self.RunPeriod = "UNDEFINED" self.FlaggingMode = False self.MultiplicityStrategyName = "INCLUSIVE" # Decide which LUT to use, based on which run we are simulating: from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags if (geoFlags.Run() == "RUN1") or ((geoFlags.Run() == "UNDEFINED") and (geoFlags.isIBL() == False)): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" self.RunPeriod = "RUN1" logger.info( "Configuring MuCTPI simulation with Run 1 configuration file:") logger.info( " TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002.xml" ) logger.info(" with a RunPeriod=RUN1") elif (geoFlags.Run() == "RUN2") or ((geoFlags.Run() == "UNDEFINED") and (geoFlags.isIBL() == True)): self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" self.RunPeriod = "RUN2" logger.info( "Configuring MuCTPI simulation with Run 2 configuration file:") logger.info( " TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" ) logger.info(" with a RunPeriod=RUN2") else: self.LUTXMLFile = "TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" self.RunPeriod = "RUN2" logger.warning( "Couldn't determine which run to simulate, using Run 2 configuration file:" ) logger.warning( " TrigConfMuctpi/data10_7TeV.periodI.physics_Muons.MuCTPI_LUT.NoBEOverlaps_composedEF.v002_modifiedBB.xml" ) logger.warning(" with a RunPeriod=RUN2") pass # Set properties for NIM outputs ot L1Topo conversion from RoI to eta/phi self.GeometryXMLFile = "TrigConfMuctpi/TestMioctGeometry_2016_05_30_CS_2600573263.xml" # Turn on the NIM output creation by default: self.DoNIMOutput = True # The bit settings were extracted from here: # https://savannah.cern.ch/bugs/?90300#comment14 self.NIMBarrelBit = 29 self.NIMEndcapBit = 30
def toolInDetVKalMultiVxInJetTool(name, useBTagFlagsDefaults = True, **options): """Sets up a InDetVKalMultiVxInJetTool tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel getNegativeTail default: False ConeForTag default: 1.0 MultiVertex default: True input: name: The name of the tool (should be unique). useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. **options: Python dictionary with options for the tool. output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however that this tool also needs to be added to the main B-tagging tool.""" if useBTagFlagsDefaults: defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, 'getNegativeTail' : False, 'ExistIBL' : geoFlags.isIBL(), 'ConeForTag' : 1.0, 'MultiVertex' : True } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool return InDet__InDetVKalVxInJetTool(**options)
def toolInDetVKalVxNegativeTagInJetTool(name, useBTagFlagsDefaults = True, **options): """Sets up a InDetVKalVxNegativeTagInJetTool tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel getNegativeTag default: True CutA0 default: 2.0 (new tuned cuts for SV0 (Sara)) CutZVrt default: 2.0 CutPixelHits default: 2 input: name: The name of the tool (should be unique). useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. **options: Python dictionary with options for the tool. output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however that this tool also needs to be added to the main B-tagging tool.""" if useBTagFlagsDefaults: defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, 'ExistIBL' : geoFlags.isIBL(), # 'TrackSummaryTool' : None, 'getNegativeTag' : True, 'CutA0' : 2.0, 'CutZVrt' : 2.0, 'CutPixelHits' : 2 } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool return InDet__InDetVKalVxInJetTool(**options)
def getIDETEnvelope(name="IDET", **kwargs): from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags isUpgrade = geoFlags.Run() == "RUN3" or geoFlags.Run() == "RUN4" or ( geoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC()) isRUN2 = geoFlags.Run() == "RUN2" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL()) isRUN1 = not (isRUN2 or isUpgrade) kwargs.setdefault("DetectorName", "IDET") innerRadius = 37. * mm # RUN1 default if isRUN2: innerRadius = 28.9 * mm #29.15*mm if isUpgrade: innerRadius = 32.15 * mm kwargs.setdefault("InnerRadius", innerRadius) kwargs.setdefault("OuterRadius", 1.148 * m) kwargs.setdefault("dZ", 347.5 * cm) SubDetectorList = [] from AthenaCommon.DetFlags import DetFlags if DetFlags.geometry.pixel_on(): SubDetectorList += ['Pixel'] if DetFlags.geometry.SCT_on(): SubDetectorList += ['SCT'] if DetFlags.geometry.TRT_on() and not isUpgrade: SubDetectorList += ['TRT'] SubDetectorList += ['IDetServicesMat'] kwargs.setdefault("SubDetectors", SubDetectorList) return CfgMgr.CylindricalEnvelope(name, **kwargs)
def generateInDetSensitiveDetectorList(): SensitiveDetectorList = [] from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags isUpgrade = geoFlags.Run() == "RUN3" or geoFlags.Run() == "RUN4" or ( geoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC()) isRUN2 = geoFlags.Run() == "RUN2" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL()) isRUN1 = not (isRUN2 or isUpgrade) from AthenaCommon.DetFlags import DetFlags if (isRUN1 or isRUN2) and DetFlags.simulate.BCM_on(): SensitiveDetectorList += ['BCMSensorSD'] #if isRUN2 and DetFlags.simulation.DBM_on(): # SensitiveDetectorList += [ 'DBMSensorSD' ] if DetFlags.simulate.pixel_on(): if isRUN1 or isRUN2: SensitiveDetectorList += ['BLMSensorSD'] SensitiveDetectorList += ['PixelSensorSD'] if DetFlags.simulate.SCT_on(): if isUpgrade: SensitiveDetectorList += ['SLHC_SctSensorSD'] else: SensitiveDetectorList += ['SctSensorSD'] if DetFlags.simulate.TRT_on() and not isUpgrade: SensitiveDetectorList += ['TRTSensitiveDetector'] return SensitiveDetectorList
def toolInDetVKalVxNegativeTagInJetTool(name, useBTagFlagsDefaults=True, **options): """Sets up a InDetVKalVxNegativeTagInJetTool tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel getNegativeTag default: True CutA0 default: 2.0 (new tuned cuts for SV0 (Sara)) CutZVrt default: 2.0 CutPixelHits default: 2 input: name: The name of the tool (should be unique). useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. **options: Python dictionary with options for the tool. output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however that this tool also needs to be added to the main B-tagging tool.""" if useBTagFlagsDefaults: defaults = { 'OutputLevel': BTaggingFlags.OutputLevel, 'ExistIBL': geoFlags.isIBL(), # 'TrackSummaryTool' : None, 'getNegativeTag': True, 'CutA0': 2.0, 'CutZVrt': 2.0, 'CutPixelHits': 2 } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool return InDet__InDetVKalVxInJetTool(**options)
def getPixelPhysicsRegionTool(name='PixelPhysicsRegionTool', **kwargs): kwargs.setdefault("RegionName", 'Pixel') volumeList = ['Pixel::siLog', 'Pixel::siBLayLog'] from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags if geoFlags.Run() == "RUN2" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL()): volumeList += ['Pixel::dbmDiamondLog'] kwargs.setdefault("VolumeList", volumeList) kwargs.setdefault("ElectronCut", 0.05) kwargs.setdefault("PositronCut", 0.05) kwargs.setdefault("GammaCut", 0.05) return CfgMgr.RegionCreator(name, **kwargs)
def toolInDetVKalVxInJetTool(name, useBTagFlagsDefaults = True, **options): """Sets up a InDetVKalVxInJetTool tool and returns it. The following options have BTaggingFlags defaults: TrackSummaryTool default: None (not needed for b-tagging) OutputLevel default: BTaggingFlags.OutputLevel input: name: The name of the tool (should be unique). useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. **options: Python dictionary with options for the tool. output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however that this tool also needs to be added to the main B-tagging tool.""" if useBTagFlagsDefaults: defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, 'ExistIBL' : geoFlags.isIBL(), # 'TrackSummaryTool' : None } } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool return InDet__InDetVKalVxInJetTool(**options)
def toolInDetVKalVxInJetTool(name, useBTagFlagsDefaults=True, **options): """Sets up a InDetVKalVxInJetTool tool and returns it. The following options have BTaggingFlags defaults: TrackSummaryTool default: None (not needed for b-tagging) OutputLevel default: BTaggingFlags.OutputLevel input: name: The name of the tool (should be unique). useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. **options: Python dictionary with options for the tool. output: The actual tool, which can then by added to ToolSvc via ToolSvc += output. Note however that this tool also needs to be added to the main B-tagging tool.""" if useBTagFlagsDefaults: defaults = { 'OutputLevel': BTaggingFlags.OutputLevel, 'ExistIBL': geoFlags.isIBL(), # 'TrackSummaryTool' : None } } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import InDet__InDetVKalVxInJetTool return InDet__InDetVKalVxInJetTool(**options)
rec.doApplyAODFix.set_Value_and_Lock(False) include("RecExCommon/RecExCommon_topOptions.py") from AthenaCommon.AlgSequence import AlgSequence algSeq = AlgSequence() ### GEO Business from AthenaCommon.GlobalFlags import globalflags print "detDescr from global flags= " + str(globalflags.DetDescrVersion) from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags print "geoFlags.Run() = " + geoFlags.Run() print "geoFlags.isIBL() = " + str(geoFlags.isIBL()) ############################################################### ### THIS is the full retagging configuration ### this is if you want to re-tag with another calibration file from BTagging.BTaggingConfiguration import getConfiguration from BTagging.BTaggingFlags import BTaggingFlags #### if the new file is already in the datatbase: simple edit the name #BTaggingFlags.CalibrationTag = 'BTagCalibRUN12-08-18' #### if you want to use your own calibration file use this part below if RETAG & (LocalCalibSuffix != 'WHATEVER'): BTaggingFlags.CalibrationFromLocalReplica = True BTaggingFlags.TrigCalibrationFolderRoot = '/GLOBAL/TrigBTagCalib/' BTaggingFlags.TrigCalibrationTag = LocalCalibSuffix #### if you want to use the real actual calibration
#############rec.doApplyAODFix.set_Value_and_Lock(False) include("RecExCommon/RecExCommon_topOptions.py") from AthenaCommon.AlgSequence import AlgSequence algSeq = AlgSequence() ########################################################################################################################################################## ########################################################################################################################################################## ### GEO Business from AthenaCommon.GlobalFlags import globalflags print "detDescr from global flags= "+str(globalflags.DetDescrVersion) from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags print "geoFlags.Run() = "+geoFlags.Run() print "geoFlags.isIBL() = "+str( geoFlags.isIBL() ) ########################################################################################################################################################## ########################################################################################################################################################## ### VD: this is if you want to re-tag with another calibration file from BTagging.BTaggingFlags import BTaggingFlags #### if the new file is already in the datatbase: simple edit the name #BTaggingFlags.CalibrationTag = 'BTagCalibRUN12-08-07' #### if you want to use your own calibration file use this part below #BTaggingFlags.CalibrationFromLocalReplica = True #BTaggingFlags.CalibrationFolderRoot = '/GLOBAL/BTagCalib/' #BTaggingFlags.CalibrationTag = 'Run2DC14' ## '0801C' ##'k0002'
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # Configuration functions for IP2DNegTag # Author: Wouter van den Wollenberg (2013-2014) from BTagging.BTaggingFlags import BTaggingFlags from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags from IOVDbSvc.CondDB import conddb btagrun1 = False if conddb.dbdata == 'COMP200': btagrun1 = True elif conddb.isMC: btagrun1 = (geoFlags.Run() == "RUN1" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False)) metaIP2DNegTag = { 'IsATagger': True, 'xAODBaseName': 'IP2DNeg', 'DependsOn': [ 'AtlasExtrapolator', 'BTagTrackToVertexTool', 'InDetVKalVxInJetTool', 'BTagFullLinearizedTrackFactory', 'BTagTrackToVertexIPEstimator', 'IP2DNegNewLikelihoodTool', 'IP2DNegTrackSelector', 'SVForIPTool_IP2DNeg', 'IP2DNegBasicTrackGradeFactory', 'IP2DNegDetailedTrackGradeFactory' ], 'PassByPointer': { 'SVForIPTool': 'SVForIPTool_IP2DNeg', 'trackSelectorTool': 'IP2DNegTrackSelector', 'trackGradeFactory': 'IP2DNegDetailedTrackGradeFactory', # 'trackToVertexTool' : 'BTagTrackToVertexTool',
# Configuration functions for IP2DTag # Author: Wouter van den Wollenberg (2013-2014) from BTagging.BTaggingFlags import BTaggingFlags from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags btagrun1 = (geoFlags.Run() == "RUN1" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False)) metaIP2DTag = { 'IsATagger' : True, 'xAODBaseName' : 'IP2D', 'DependsOn' : ['AtlasExtrapolator', 'BTagTrackToVertexTool', 'InDetVKalVxInJetTool', 'BTagFullLinearizedTrackFactory', 'BTagTrackToVertexIPEstimator', 'IP2DDetailedTrackGradeFactory', 'IP2DBasicTrackGradeFactory', 'SVForIPTool_IP2D', 'IP2DTrackSelector', 'IP2DNewLikelihoodTool'], 'PassByPointer' : {'SVForIPTool' : 'SVForIPTool_IP2D', 'trackSelectorTool' : 'IP2DTrackSelector', 'trackGradeFactory' : 'IP2DDetailedTrackGradeFactory', # 'trackToVertexTool' : 'BTagTrackToVertexTool', 'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator', 'LikelihoodTool' : 'IP2DNewLikelihoodTool'}, # 'PassByName' : {'SecVxFinderNameForV0Removal' : 'InDetVKalVxInJetTool', # 'SecVxFinderNameForIPSign' : 'InDetVKalVxInJetTool'}, # 'PassTracksAs' : 'trackAssociation', 'PassTracksAs' : 'trackAssociationName', 'JetCollectionList' : 'jetCollectionList', 'ToolCollection' : 'IP2DTag' }
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration # Configuration functions for IP2DTag # Author: Wouter van den Wollenberg (2013-2014) from BTagging.BTaggingFlags import BTaggingFlags from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags from IOVDbSvc.CondDB import conddb btagrun1=False if conddb.dbdata == 'COMP200': btagrun1=True elif conddb.isMC: btagrun1 = (geoFlags.Run() == "RUN1" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL() == False)) metaIP2DTag = { 'IsATagger' : True, 'xAODBaseName' : 'IP2D', 'DependsOn' : ['AtlasExtrapolator', 'BTagTrackToVertexTool', 'InDetVKalVxInJetTool', 'BTagFullLinearizedTrackFactory', 'BTagTrackToVertexIPEstimator', 'IP2DDetailedTrackGradeFactory', 'IP2DBasicTrackGradeFactory', 'SVForIPTool_IP2D', 'IP2DTrackSelector', 'IP2DNewLikelihoodTool'], 'PassByPointer' : {'SVForIPTool' : 'SVForIPTool_IP2D', 'trackSelectorTool' : 'IP2DTrackSelector', 'trackGradeFactory' : 'IP2DDetailedTrackGradeFactory', # 'trackToVertexTool' : 'BTagTrackToVertexTool', 'TrackToVertexIPEstimator' : 'BTagTrackToVertexIPEstimator', 'LikelihoodTool' : 'IP2DNewLikelihoodTool'},
def getATLAS_RegionCreatorList(): regionCreatorList = [] from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags isUpgrade = geoFlags.Run() == "RUN3" or geoFlags.Run() == "RUN4" or ( geoFlags.Run() == "UNDEFINED" and geoFlags.isSLHC()) isRUN2 = geoFlags.Run() == "RUN2" or (geoFlags.Run() == "UNDEFINED" and geoFlags.isIBL()) from G4AtlasApps.SimFlags import simFlags from AthenaCommon.DetFlags import DetFlags from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType() == 'cosmics' or \ (simFlags.CavernBG.statusOn and not 'Signal' in simFlags.CavernBG.get_Value() ): regionCreatorList += [ 'SX1PhysicsRegionTool', 'BedrockPhysicsRegionTool', 'CavernShaftsConcretePhysicsRegionTool' ] #regionCreatorList += ['CavernShaftsAirPhysicsRegionTool'] # Not used currently if DetFlags.ID_on(): if DetFlags.pixel_on(): regionCreatorList += ['PixelPhysicsRegionTool'] if DetFlags.SCT_on(): regionCreatorList += ['SCTPhysicsRegionTool'] if DetFlags.TRT_on() and not isUpgrade: regionCreatorList += ['TRTPhysicsRegionTool'] if isRUN2: regionCreatorList += ['TRT_ArPhysicsRegionTool' ] #'TRT_KrPhysicsRegionTool' # FIXME dislike the ordering here, but try to maintain the same ordering as in the old configuration. if DetFlags.bpipe_on(): if simFlags.BeamPipeSimMode.statusOn and simFlags.BeamPipeSimMode( ) != "Normal": regionCreatorList += ['BeampipeFwdCutPhysicsRegionTool'] if simFlags.ForwardDetectors.statusOn and simFlags.ForwardDetectors( ) == 2: regionCreatorList += ['FWDBeamLinePhysicsRegionTool'] if DetFlags.Calo_on(): if DetFlags.geometry.LAr_on(): ## Shower parameterization overrides the calibration hit flag if simFlags.LArParameterization.statusOn and simFlags.LArParameterization() > 0 \ and simFlags.CalibrationRun.statusOn and simFlags.CalibrationRun.get_Value() in ['LAr','LAr+Tile','DeadLAr']: print 'You requested both calibration hits and frozen showers / parameterization in the LAr.' print ' Such a configuration is not allowed, and would give junk calibration hits where the showers are modified.' print ' Please try again with a different value of either simFlags.LArParameterization (' + str( simFlags.LArParameterization( )) + ') or simFlags.CalibrationRun (' + str( simFlags.CalibrationRun.get_Value()) + ')' raise RuntimeError('Configuration not allowed') if simFlags.LArParameterization() > 0: regionCreatorList += [ 'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool', 'HECPhysicsRegionTool', 'FCALPhysicsRegionTool' ] # FIXME 'EMBPhysicsRegionTool' used for parametrization also - do we need a second instance?? regionCreatorList += [ 'EMECParaPhysicsRegionTool', 'FCALParaPhysicsRegionTool', 'FCAL2ParaPhysicsRegionTool' ] if simFlags.LArParameterization.get_Value() > 1: regionCreatorList += [ 'PreSampLArPhysicsRegionTool', 'DeadMaterialPhysicsRegionTool' ] elif simFlags.LArParameterization( ) is None or simFlags.LArParameterization() == 0: regionCreatorList += [ 'EMBPhysicsRegionTool', 'EMECPhysicsRegionTool', 'HECPhysicsRegionTool', 'FCALPhysicsRegionTool' ] ## FIXME _initPR never called for FwdRegion?? #if simFlags.ForwardDetectors.statusOn: # if DetFlags.geometry.FwdRegion_on(): # regionCreatorList += ['FwdRegionPhysicsRegionTool'] if DetFlags.Muon_on(): regionCreatorList += [ 'DriftWallPhysicsRegionTool', 'DriftWall1PhysicsRegionTool', 'DriftWall2PhysicsRegionTool' ] if simFlags.CavernBG.statusOn and simFlags.CavernBG.get_Value( ) != 'Read' and not (simFlags.RecordFlux.statusOn and simFlags.RecordFlux()): regionCreatorList += ['MuonSystemFastPhysicsRegionTool'] return regionCreatorList
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