def AddMuonSelectionTool(): from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, "TagProbeMuonSelectionTool"): from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool ToolSvc += CP__MuonSelectionTool("TagProbeMuonSelectionTool") ToolSvc.TagProbeMuonSelectionTool.MaxEta = 99. # don't cut on eta in this tool
def toolMuonSelectorTool(name, useBTagFlagsDefaults = True, **options): """Sets up the CP MuonSelector tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel MaxEta default: 2.7""" if useBTagFlagsDefaults: defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, 'MaxEta' : 2.7 , } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool return CP__MuonSelectionTool(**options)
name="DRZmumuMassTool", ContainerName="Muons", ObjectRequirements=sel_muon1, SecondObjectRequirements=sel_muon2, MassHypothesis=105.66, SecondMassHypothesis=105.66, StoreGateEntryName="DRZmumuMass") ToolSvc += DRZmumuMassTool from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool dimuonMassSkimmingTool = DerivationFramework__xAODStringSkimmingTool( name="DRAW_ZMUMU_DiMuonMass_SkimmingTool", expression=dimuonMassString) ToolSvc += dimuonMassSkimmingTool # Muon selector tool from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool goodMuonTool = CP__MuonSelectionTool(name="DRAW_ZMUMU_MuonsSelector") goodMuonTool.MaxEta = 3. goodMuonTool.MuQuality = 3 # turn of the momentum correction which is not needed for IDHits cut and Preselection goodMuonTool.TurnOffMomCorr = True ToolSvc += goodMuonTool print goodMuonTool from PrimaryDPDMaker.PrimaryDPDMakerConf import DerivationFramework__DRAW_ZMUMUSkimmingTool goodMuonSkimmingTool = DerivationFramework__DRAW_ZMUMUSkimmingTool( name="DRAW_ZMUMU_GoodMuon_SkimmingTool", MuonContainerKey="Muons", MuonSelectorTool=goodMuonTool, MinimumNumberOfMuons=1, MuonPtCut=20.0) ToolSvc += goodMuonSkimmingTool
if jobproperties.Beam.beamType() == 'cosmics' or jobproperties.Beam.beamType() == 'singlebeam': CosmicsCommissioning = True theMuonCollection = [ "MuidMuonCollection" ] from AthenaCommon.AppMgr import ToolSvc ########### Muon Selection tool ################ from MuonMomentumCorrections.MuonMomentumCorrectionsConf import CP__MuonCalibrationAndSmearingTool MuonCorrectionTool = CP__MuonCalibrationAndSmearingTool("MuonCorrectionTool") ToolSvc += MuonCorrectionTool ########### Muon Selection tool ################ from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool MuonSelectionTool = CP__MuonSelectionTool("MuonSelectionTool", MaxEta = 2.7) ToolSvc += MuonSelectionTool ########### Muon Isolation options ################ from IsolationSelection.IsolationSelectionConf import CP__IsolationSelectionTool LooseTrackOnlyIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonLooseTrackOnlyIsolationSelectionTool" ) LooseTrackOnlyIsoTool.MuonWP = "LooseTrackOnly" ToolSvc += LooseTrackOnlyIsoTool LooseIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonLooseIsolationSelectionTool" ) LooseIsoTool.MuonWP = "Loose" ToolSvc += LooseIsoTool TightIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonTightIsolationSelectionTool" ) TightIsoTool.MuonWP = "Tight" ToolSvc += TightIsoTool GradientIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonGradientIsolationSelectionTool" )
from AthenaCommon import CfgMgr DFCommonMuonsTrtCutOff = DFCommonMuonsConfig.TrtCutOff #==================================================================== # MCP GROUP TOOLS #==================================================================== #==================================================================== # AUGMENTATION TOOLS #==================================================================== from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper DFCommonMuonToolWrapperTools = [] ### IDHits DFCommonMuonsSelector = CP__MuonSelectionTool(name = "DFCommonMuonsSelector") DFCommonMuonsSelector.MaxEta = 3. DFCommonMuonsSelector.MuQuality = 3 # turn of the momentum correction which is not needed for IDHits cut and Preselection DFCommonMuonsSelector.TurnOffMomCorr = True if DFCommonMuonsTrtCutOff is not None: DFCommonMuonsSelector.TrtCutOff = DFCommonMuonsTrtCutOff ToolSvc += DFCommonMuonsSelector print (DFCommonMuonsSelector) DFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "DFCommonMuonToolWrapper", AsgSelectionTool = DFCommonMuonsSelector, CutType = "IDHits", StoreGateEntryName = "DFCommonGoodMuon", ContainerName = "Muons") ToolSvc += DFCommonMuonToolWrapper
import EventKernel.ParticleDataType CosmicsCommissioning = False theMuonCollection = ["Muons"] MuonMETContainerName = "Muons_TAG_skim" from AthenaCommon import CfgMgr from AthenaCommon.BeamFlags import jobproperties if jobproperties.Beam.beamType() == 'cosmics' or jobproperties.Beam.beamType( ) == 'singlebeam': CosmicsCommissioning = True theMuonCollection = ["MuidMuonCollection"] from AthenaCommon.AppMgr import ToolSvc from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool MuonSelectionTool = CP__MuonSelectionTool("MuonSelectionTool") MuonSelectionTool.MaxEta = 2.7 ToolSvc += MuonSelectionTool ########### Muon Isolation options ################ from IsolationSelection.IsolationSelectionConf import CP__IsolationSelectionTool LooseTrackOnlyIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonLooseTrackOnlyIsolationSelectionTool") LooseTrackOnlyIsoTool.MuonWP = "LooseTrackOnly" ToolSvc += LooseTrackOnlyIsoTool LooseIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonLooseIsolationSelectionTool") LooseIsoTool.MuonWP = "Loose" ToolSvc += LooseIsoTool TightIsoTool = CfgMgr.CP__IsolationSelectionTool( "MuonTightIsolationSelectionTool")
jps.AthenaCommonFlags.HistOutputs = [ "MuonAnalysis:AnalysisOutput.root" ] #register output files like this. MYSTREAM is used in the code athAlgSeq += CfgMgr.CP__CalibratedMuonsProvider(Input="Muons", Output="CalibratedMuons") athAlgSeq += CfgMgr.XAMPP__MuonAnalysisAlg( ) #adds an instance of your alg to the main alg sequence # Create a MuonSelectionTool if we do not yet have one from AthenaCommon.AppMgr import ToolSvc #ToolSvc += CfgMgr.Trig__MatchingTool("MyMatchingTool",OutputLevel=DEBUG) ToolSvc += CfgMgr.Trig__MatchingTool("MyMatchingTool") if not hasattr(ToolSvc, "MyMuonSelectionTool"): from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool ToolSvc += CP__MuonSelectionTool("MyMuonSelectionTool") ToolSvc.MyMuonSelectionTool.MaxEta = 2.5 ToolSvc.MyMuonSelectionTool.MuQuality = 1 ToolSvc.MyMuonSelectionTool.TrtCutOff = True """if not hasattr(ToolSvc,"MyMuonTagSelectionTool"): from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool ToolSvc += CP__MuonSelectionTool("MyMuonTagSelectionTool") ToolSvc.MyMuonTagSelectionTool.MaxEta = 2.4 ToolSvc.MyMuonTagSelectionTool.MuQuality = 0 ToolSvc.MyMuonTagSelectionTool.TrtCutOff = True """ if not hasattr(ToolSvc, "MyInDetSelectionTool"): from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool ToolSvc += InDet__InDetTrackSelectionTool("MyInDetSelectionTool") ToolSvc.MyInDetSelectionTool.CutLevel = "TightPrimary" ToolSvc.MyInDetSelectionTool.maxZ0 = 10.
from __future__ import print_function #******************************************************************** # MuonsCommon.py # Schedules all tools needed for muon object selection and writes # results into SG. These may then be accessed along the train #******************************************************************** from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob from AthenaCommon.AppMgr import ToolSvc #==================================================================== # MCP GROUP TOOLS #==================================================================== from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool EXOTDFCommonMuonsSelector = CP__MuonSelectionTool(name = "EXOTDFCommonMuonsSelector") EXOTDFCommonMuonsSelector.MaxEta = 2.8 ToolSvc += EXOTDFCommonMuonsSelector print (EXOTDFCommonMuonsSelector) #==================================================================== # AUGMENTATION TOOLS #==================================================================== from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper EXOTDFCommonMuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name = "EXOTDFCommonMuonToolWrapper", AsgSelectionTool = EXOTDFCommonMuonsSelector, CutType = "IDHits", StoreGateEntryName = "EXOTDFCommonGoodMuon", ContainerName = "Muons") ToolSvc += EXOTDFCommonMuonToolWrapper print (EXOTDFCommonMuonToolWrapper)
# CPToolsExample.py # This an example job options script showing how to set up a # derivation of the data using the derivation framework with xAOD # input. # It requires the reductionConf flag TEST5 in Reco_tf.py #==================================================================== # Set up common services and job object. # This should appear in ALL derivation job options from DerivationFrameworkCore.DerivationFrameworkMaster import * #==================================================================== # CP GROUP TOOLS #==================================================================== from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool TEST5MuonTool = CP__MuonSelectionTool(name="TEST5MuonTool") ToolSvc += TEST5MuonTool print TEST5MuonTool #==================================================================== # AUGMENTATION TOOLS #==================================================================== from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper TEST5MuonToolWrapper = DerivationFramework__AsgSelectionToolWrapper( name="TEST5MuonToolWrapper", AsgSelectionTool=TEST5MuonTool, CutType="IDHits", StoreGateEntryName="TEST5GoodMuons", ContainerName="Muons") ToolSvc += TEST5MuonToolWrapper print TEST5MuonToolWrapper
OutputLevel = WARNING, ) if not DQMonFlags.useTrigger(): print "MuonTrigTrackDQA_options.py: trigger decision tool not found: don't run trigger-aware monitoring" else: MuonGenericTracksMon_L1Trig.TriggerChain = "L1_MU4, L1_MU6, L1_MU10, L1_MU11, L1_MU15, L1_MU20, L1_2MU4, L1_2MU6, L1_2MU10" MuonGenericTracksMon_L1Trig.MuonTriggerChainName = "" MuonGenericTracksMon_L1Trig.TrigDecisionTool = monTrigDecTool ToolSvc += MuonGenericTracksMon_L1Trig muTrackMonMan.AthenaMonTools.append(MuonGenericTracksMon_L1Trig) #for Muon Quality Selection if not hasattr(ToolSvc,"MuonSelectorTool"): from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool ToolSvc += CP__MuonSelectionTool("MuonSelectorTool", OutputLevel = ERROR) ToolSvc.MuonSelectorTool.MaxEta = 2.5 #for Muon Resonance Selection from MuonResonanceTools.MuonResonanceToolsConf import MuonResonanceSelectionTool from MuonResonanceTools.MuonResonanceToolsConf import MuonResonancePairingTool ToolSvc += MuonResonanceSelectionTool("ZmumuResonanceSelectionTool") ToolSvc += MuonResonancePairingTool("ZmumuResonancePairingTool") ToolSvc.ZmumuResonanceSelectionTool.OutputLevel = ERROR ToolSvc.ZmumuResonanceSelectionTool.PtCut = 20000.0 ToolSvc.ZmumuResonanceSelectionTool.EtaCut = 2.5 ToolSvc.ZmumuResonanceSelectionTool.IsoCaloCut = 0.2 ToolSvc.ZmumuResonanceSelectionTool.IsoTrkCut = 0.2 ToolSvc.ZmumuResonanceSelectionTool.z0Cut = 100 #to overwrite Z0 cut ToolSvc.ZmumuResonanceSelectionTool.Max_d0 = 100
#Create efficiency and correction tools from MuonEfficiencyCorrections.MuonEfficiencyCorrectionsConf import CP__MuonEfficiencyScaleFactors SFtool = CP__MuonEfficiencyScaleFactors("MCPTool") SFtool.WorkingPoint = "CBandST" SFtool.DataPeriod = "2012" SFtool.OutputLevel = INFO from MuonMomentumCorrections.MuonMomentumCorrectionsConf import CP__MuonCalibrationAndSmearingTool CalibrationTool = CP__MuonCalibrationAndSmearingTool() CalibrationTool.Year = 'Data12' CalibrationTool.Release = 'Rel17.2Sum13' CalibrationTool.OutputLevel = INFO from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool SelectionTool = CP__MuonSelectionTool() SelectionTool.OutputLevel = INFO from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool TriggerTool = Trig__TrigDecisionTool("TrigDecTool") ToolSvc += TriggerTool TriggerTool.TrigDecisionKey = "xTrigDecision" TriggerTool.OutputLevel = INFO from TrigMuonMatching.TrigMuonMatchingConf import Trig__TrigMuonMatching MatchingTool = Trig__TrigMuonMatching("TrigMatchTool") MatchingTool.dRmin = 0.1 MatchingTool.LVL1dRmin = 0.2 MatchingTool.TriggerTool = TriggerTool MatchingTool.OutputLevel = INFO
#if isBeam==True and (DQMonFlags.monManEnvironment == 'tier0ESD' or DQMonFlags.monManEnvironment == 'online' or DQMonFlags.monManEnvironment == 'tier0' or DQMonFlags.monManEnvironment == 'tier0Raw' ) and rec.doInDet(): if isBeam == True and (DQMonFlags.monManEnvironment != 'tier0Raw' ) and rec.doInDet() and DQMonFlags.useTrigger(): topSequence += AthenaMonManager("GlobalMonPhysicsManager") ManagedAthenaGlobalPhysMon = topSequence.GlobalMonPhysicsManager ManagedAthenaGlobalPhysMon.FileKey = DQMonFlags.monManFileKey() ManagedAthenaGlobalPhysMon.ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup( ) ManagedAthenaGlobalPhysMon.DataType = DQMonFlags.monManDataType() ManagedAthenaGlobalPhysMon.Environment = DQMonFlags.monManEnvironment() from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool ToolSvc += CP__MuonSelectionTool("DQTMuonSelectionTool", MaxEta=2.4, MuQuality=1) ToolSvc += CfgMgr.CP__IsolationSelectionTool("DQTIsoGradientTool", MuonWP="LooseTrackOnly", ElectronWP="LooseTrackOnly") from TrigMuonMatching.TrigMuonMatchingConf import Trig__TrigMuonMatching ToolSvc += Trig__TrigMuonMatching("MatchingTool") from DataQualityTools.DataQualityToolsConf import DQTGlobalWZFinderTool MyDQTGlobalWZFinderTool = DQTGlobalWZFinderTool( name='DQTGlobalWZFinderTool', doTrigger=rec.doTrigger(), JetCollectionName=JetCollectionKey, MuonPtCut=27, MuonMaxEta=ToolSvc.DQTMuonSelectionTool.MaxEta, MuonSelectionTool=ToolSvc.DQTMuonSelectionTool,