def toolIP3DTrigHybridTag(name, useBTagFlagsDefaults=True, **options): """Sets up a IP3DTrigHybridTag tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel Runmodus default: BTaggingFlags.Runmodus referenceType default: BTaggingFlags.ReferenceType impactParameterView default: "3D" trackGradePartitions default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] RejectBadTracks default: False originalTPCollectionName default: BTaggingFlags.TrackParticleCollectionName jetCollectionList default: BTaggingFlags.Jets unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs) UseCHypo default: True SecVxFinderName default: "SV1" jetPtMinRef default: BTaggingFlags.JetPtMinRef 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.""" if useBTagFlagsDefaults: grades = [ "0HitIn0HitNInExp2", "0HitIn0HitNInExpIn", "0HitIn0HitNInExpNIn", "0HitIn0HitNIn", "0HitInExp", "0HitIn", "0HitNInExp", "0HitNIn", "InANDNInShared", "PixShared", "SctShared", "InANDNInSplit", "PixSplit", "Good" ] if btagrun1: grades = [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] defaults = { 'OutputLevel': BTaggingFlags.OutputLevel, 'Runmodus': BTaggingFlags.Runmodus, 'referenceType': BTaggingFlags.ReferenceType, 'jetPtMinRef': BTaggingFlags.JetPtMinRef, 'impactParameterView': '3D', 'trackGradePartitions': grades, 'RejectBadTracks': True, 'originalTPCollectionName': BTaggingFlags.TrackParticleCollectionName, 'jetCollectionList': BTaggingFlags.Jets, # 'SecVxFinderNameForV0Removal' : "InDetVKalVxInJetTool", # 'SecVxFinderNameForIPSign' : "InDetVKalVxInJetTool", 'unbiasIPEstimation': False, #'trackAssociation' : "Tracks" } 'UseCHypo': True, 'SecVxFinderName': 'SV1', 'storeTrackParameters': True, 'storeTrackParticles': True, 'storeIpValues': True } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from JetTagTools.JetTagToolsConf import Analysis__IPTag return Analysis__IPTag(**options)
def toolIP2DSpcPosTag(name, useBTagFlagsDefaults = True, **options): """Sets up a IP2DSpcPosTag tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel Runmodus default: BTaggingFlags.Runmodus referenceType default: BTaggingFlags.ReferenceType impactParameterView default: "2D" trackGradePartitions default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] RejectBadTracks default: False originalTPCollectionName default: BTaggingFlags.TrackParticleCollectionName jetCollectionList default: BTaggingFlags.Jets jetWithInfoPlus default: BTaggingFlags.JetsWithInfoPlus SecVxFinderNameForV0Removal default: "InDetVKalVxInJetTool" SecVxFinderNameForIPSign default: "InDetVKalVxInJetTool" unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs) writeInfoPlus default: False SignWithSvx default: True flipIPSign default: False usePosIP default: True useNegIP default: False trackAssociation default: "Tracks" 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.""" if useBTagFlagsDefaults: defaults = { 'OutputLevel' : BTaggingFlags.OutputLevel, 'Runmodus' : BTaggingFlags.Runmodus, 'referenceType' : BTaggingFlags.ReferenceType, 'impactParameterView' : '2D', 'trackGradePartitions' : [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ], 'RejectBadTracks' : True, 'originalTPCollectionName' : BTaggingFlags.TrackParticleCollectionName, 'jetCollectionList' : BTaggingFlags.Jets, 'jetWithInfoPlus' : BTaggingFlags.JetsWithInfoPlus, 'SecVxFinderNameForV0Removal' : "InDetVKalVxInJetTool", 'SecVxFinderNameForIPSign' : "InDetVKalVxInJetTool", 'unbiasIPEstimation' : False, 'writeInfoPlus' : False, 'SignWithSvx' : True, 'flipIPSign' : False, 'usePosIP' : True, 'useNegIP' : False, 'trackAssociation' : "Tracks" } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from JetTagTools.JetTagToolsConf import Analysis__IPTag return Analysis__IPTag(**options)
def toolIP2DTag(name, useBTagFlagsDefaults=True, **options): """Sets up a IP2DTag tool and returns it. The following options have BTaggingFlags defaults: OutputLevel default: BTaggingFlags.OutputLevel Runmodus default: BTaggingFlags.Runmodus referenceType default: BTaggingFlags.ReferenceType impactParameterView default: "2D" trackGradePartitions default: [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] RejectBadTracks default: False originalTPCollectionName default: BTaggingFlags.TrackParticleCollectionName jetCollectionList default: BTaggingFlags.Jets unbiasIPEstimation default: False (switch to true (better!) when creating new PDFs) SecVxFinderName default: "SV1" UseCHypo 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.""" if useBTagFlagsDefaults: grades = [ "0HitIn0HitNInExp2", "0HitIn0HitNInExpIn", "0HitIn0HitNInExpNIn", "0HitIn0HitNIn", "0HitInExp", "0HitIn", "0HitNInExp", "0HitNIn", "InANDNInShared", "PixShared", "SctShared", "InANDNInSplit", "PixSplit", "Good" ] if btagrun1: grades = [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ] from BTagging.BTaggingConfiguration_CommonTools import toolBTagTrackToVertexIPEstimator as toolBTagTrackToVertexIPEstimator trackToVertexIPEstimator = toolBTagTrackToVertexIPEstimator( 'TrkToVxIPEstimator') svForIPTool = toolSVForIPTool_IP2D('SVForIPTool') trackGradeFactory = toolIP2DDetailedTrackGradeFactory( 'IP2DDetailedTrackGradeFactory') trackSelectorTool = toolIP2DTrackSelector('IP2DTrackSelector') likelihood = toolIP2DNewLikelihoodTool('IP2DNewLikelihoodTool') defaults = { 'OutputLevel': BTaggingFlags.OutputLevel, 'Runmodus': BTaggingFlags.Runmodus, 'referenceType': BTaggingFlags.ReferenceType, 'jetPtMinRef': BTaggingFlags.JetPtMinRef, 'impactParameterView': '2D', 'trackGradePartitions': grades, 'RejectBadTracks': True, 'originalTPCollectionName': BTaggingFlags.TrackParticleCollectionName, 'jetCollectionList': BTaggingFlags.Jets, 'unbiasIPEstimation': False, 'UseCHypo': True, 'SecVxFinderName': 'SV1', 'storeTrackParticles': True, 'storeTrackParameters': True, 'storeIpValues': False, 'LikelihoodTool': likelihood, 'trackSelectorTool': trackSelectorTool, 'SVForIPTool': svForIPTool, 'trackGradeFactory': trackGradeFactory, 'TrackToVertexIPEstimator': trackToVertexIPEstimator, } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name from JetTagTools.JetTagToolsConf import Analysis__IPTag return Analysis__IPTag(**options)
from JetTagTools.JetTagToolsConf import Analysis__IPTag IP3DSpcPosTagTool = Analysis__IPTag( name="IP3DSpcPosTag", Runmodus=BTaggingFlags.Runmodus, referenceType=BTaggingFlags.ReferenceType, impactParameterView="3D", OutputLevel=BTaggingFlags.OutputLevel, LikelihoodTool=IP3DSpcPosNewLikelihood, trackSelectorTool=IP3DSpcPosTrackSelector, trackToVertexTool=BTagTrackToVertexTool, # trackGradePartitions = [ "Good", "Shared" ], trackGradePartitions=[ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ], RejectBadTracks=False, usePosIP=True, useNegIP=False, flipIPSign=False, SignWithSvx=True, writeInfoPlus=False, originalTPCollectionName=BTaggingFlags.TrackParticleCollectionName, jetCollectionList=BTaggingFlags.Jets, jetWithInfoPlus=BTaggingFlags.JetsWithInfoPlus, SecVxFinderNameForV0Removal="InDetVKalVxInJetTool", SecVxFinderNameForIPSign="InDetVKalVxInJetTool", SVForIPTool=SVForIPTool_IP3DSpcPos, # trackGradeFactory = IP3DSpcPosBasicTrackGradeFactory, trackGradeFactory=IP3DSpcPosDetailedTrackGradeFactory, TrackToVertexIPEstimator=BTagTrackToVertexIPEstimator, unbiasIPEstimation=False #switch to true (better!) when creating new PDFs ) ToolSvc += IP3DSpcPosTagTool
def add_ipfordg(ToolSvc, calibration_tool, BTaggingFlags, track_to_vertex_tool, track_to_vertex_ip_estimator, do_neg=False): # each tagger needs own instance, can't be shared! from JetTagTools.JetTagToolsConf import Analysis__NewLikelihoodTool likelihood_tool = Analysis__NewLikelihoodTool( name="IPFordGNegProbTool" if do_neg else "IPFordGProbTool", OutputLevel=BTaggingFlags.OutputLevel, taggerName="IP3D", calibrationTool=calibration_tool, ) ToolSvc += likelihood_tool if BTaggingFlags.OutputLevel < 3: print likelihood_tool # each tagger needs own instance, can't be shared! ( -> not sure here ... ask Laurent, JB) from JetTagTools.JetTagToolsConf import Analysis__TrackSelector track_selector = Analysis__TrackSelector( useBLayerHitPrediction=True, name="IPFordGNegTrackSel" if do_neg else "IPFordGTrackSel", trackToVertexTool=track_to_vertex_tool, OutputLevel=BTaggingFlags.OutputLevel) ToolSvc += track_selector if BTaggingFlags.OutputLevel < 3: print track_selector from JetTagTools.JetTagToolsConf import Analysis__SVForIPTool sv_for_ip_tool = Analysis__SVForIPTool( name="SVForIPTool_IPFordGNeg" if do_neg else "SVForIPTool_IPFordG", OutputLevel=BTaggingFlags.OutputLevel) ToolSvc += sv_for_ip_tool if BTaggingFlags.OutputLevel < 3: print sv_for_ip_tool from JetTagTools.JetTagToolsConf import ( Analysis__DetailedTrackGradeFactory) detailed_track_grade_factory = Analysis__DetailedTrackGradeFactory( name="IPFordGNegDetailedTGF" if do_neg else "IPFordGNegDetailedTGF", OutputLevel=BTaggingFlags.OutputLevel, hitBLayerGrade=True, TrackSummaryTool=None, useDetailSharedHitInfo=True, useSharedHitInfo=True) ToolSvc += detailed_track_grade_factory if BTaggingFlags.OutputLevel < 3: print basic_track_grade_factory print detailed_track_grade_factory if do_neg: flip_args = dict( usePosIP=True, useNegIP=False, flipIPSign=True, ) vx_tool_name = "InDetVKalVxInJetToolFordGNeg" else: flip_args = dict() vx_tool_name = "InDetVKalVxInJetToolFordG" from InDetVKalVxInJetTool.InDetVKalVxInJetToolConf import ( InDet__InDetVKalVxInJetTool) vx_in_jet_tool = InDet__InDetVKalVxInJetTool( name=vx_tool_name, TrackSummaryTool=None, #Do not need it in b-tagging OutputLevel=BTaggingFlags.OutputLevel) ToolSvc += vx_in_jet_tool from JetTagTools.JetTagToolsConf import Analysis__IPTag ip3d_tool = Analysis__IPTag( # IPTag strips the Tag of the end of the name and uses the rest as # the TagInfo object name name="IPFordGNegTag" if do_neg else "IPFordGTag", Runmodus=BTaggingFlags.Runmodus, referenceType=BTaggingFlags.ReferenceType, impactParameterView="3D", OutputLevel=BTaggingFlags.OutputLevel, LikelihoodTool=likelihood_tool, trackSelectorTool=track_selector, trackToVertexTool=track_to_vertex_tool, trackGradePartitions=[ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ], RejectBadTracks=False, writeInfoPlus=False, originalTPCollectionName=BTaggingFlags.TrackParticleCollectionName, jetCollectionList=BTaggingFlags.Jets, jetWithInfoPlus=BTaggingFlags.JetsWithInfoPlus, SecVxFinderNameForV0Removal=vx_tool_name, SecVxFinderNameForIPSign=vx_tool_name, SVForIPTool=sv_for_ip_tool, trackGradeFactory=detailed_track_grade_factory, TrackToVertexIPEstimator=track_to_vertex_ip_estimator, UseCHypo=True, #switch to true (better!) when creating new PDFs unbiasIPEstimation=False, **flip_args) # Ford's cuts track_selector.nHitBLayer = 0 track_selector.nHitPix = 1 # track_selector.d0Max=2.0 # track_selector.z0Max=2.5 # InDetVKalVxNegInJetTool.CutPixelHits=1 vx_in_jet_tool.CutPixelHits = 1 if BTaggingFlags.OutputLevel < 3: print vx_in_jet_tool ToolSvc += ip3d_tool if BTaggingFlags.OutputLevel < 3: print ip3d_tool return ip3d_tool
ToolSvc += IP1DBasicTrackGradeFactory if BTaggingFlags.OutputLevel < 3: print IP1DBasicTrackGradeFactory from JetTagTools.JetTagToolsConf import Analysis__IPTag IP1DTagTool = Analysis__IPTag( name = "IP1DTag", Runmodus = BTaggingFlags.Runmodus, referenceType = BTaggingFlags.ReferenceType, impactParameterView = "1D", OutputLevel = BTaggingFlags.OutputLevel, LikelihoodTool = IP1DNewLikelihood, trackSelectorTool = IP1DTrackSelector, trackToVertexTool = BTagTrackToVertexTool, trackGradePartitions = [ "Good", "Shared" ], RejectBadTracks = False, originalTPCollectionName = BTaggingFlags.TrackParticleCollectionName, jetCollectionList = BTaggingFlags.Jets, jetWithInfoPlus = BTaggingFlags.JetsWithInfoPlus, SecVxFinderNameForV0Removal = "InDetVKalVxInJetTool", SecVxFinderNameForIPSign = "InDetVKalVxInJetTool", SVForIPTool = SVForIPTool_IP1D, trackGradeFactory = IP1DBasicTrackGradeFactory, TrackToVertexIPEstimator = BTagTrackToVertexIPEstimator, unbiasIPEstimation = False #switch to true (better!) when creating new PDFs ) ToolSvc += IP1DTagTool if BTaggingFlags.OutputLevel < 3: print IP1DTagTool
from JetTagTools.JetTagToolsConf import Analysis__IPTag IP2DTagTool = Analysis__IPTag( name = "IP2DTag", Runmodus = BTaggingFlags.Runmodus, referenceType = BTaggingFlags.ReferenceType, impactParameterView = "2D", OutputLevel = BTaggingFlags.OutputLevel, LikelihoodTool = IP2DNewLikelihood, trackSelectorTool = IP2DTrackSelector, #trackToVertexTool = BTagTrackToVertexTool, # trackGradePartitions = [ "Good", "Shared" ], trackGradePartitions = [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ], RejectBadTracks = False, originalTPCollectionName = BTaggingFlags.TrackParticleCollectionName, jetCollectionList = BTaggingFlags.Jets, #jetWithInfoPlus = BTaggingFlags.JetsWithInfoPlus, #SecVxFinderNameForV0Removal = "InDetVKalVxInJetTool", SecVxFinderName = "SV1", SVForIPTool = SVForIPTool_IP2D, # trackGradeFactory = IP2DBasicTrackGradeFactory, trackGradeFactory = IP2DDetailedTrackGradeFactory, TrackToVertexIPEstimator = BTagTrackToVertexIPEstimator, UseCHypo=True, xAODBaseName="IP2D", unbiasIPEstimation = False #switch to true (better!) when creating new PDFs ) ToolSvc += IP2DTagTool if BTaggingFlags.OutputLevel < 3: print IP2DTagTool