def toolNewJetFitterVxFinderFlip(name, useBTagFlagsDefaults = True, **options):
    """Sets up a NewJetFitterVxFinderFlip tool and returns it.

    The following options have BTaggingFlags defaults:

    OutputLevel                         default: BTaggingFlags.OutputLevel
    VxPrimaryContainer                  default: InDetKeys.PrimaryVertices()
    MaxNumDeleteIterations              default: 30
    VertexProbCut                       default: 0.001
    MaxClusteringIterations             default: 30
    VertexClusteringProbabilityCut      default: 0.005
    revertFromPositiveToNegativeTags    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:
        if not 'InDetKeys' in dir():
            from InDetRecExample.InDetKeys import InDetKeys
        defaults = { 'OutputLevel'                         : BTaggingFlags.OutputLevel,
                     'VxPrimaryContainer'                  : InDetKeys.PrimaryVertices(),
                     'MaxNumDeleteIterations'              : 30,
                     'VertexProbCut'                       : 0.001,
                     'MaxClusteringIterations'             : 30,
                     'VertexClusteringProbabilityCut'      : 0.005,
                     'revertFromPositiveToNegativeTags'    : True }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    from InDetSecVxFinderTool.InDetSecVxFinderToolConf import InDet__InDetImprovedJetFitterVxFinder
    return InDet__InDetImprovedJetFitterVxFinder(**options)
Пример #2
0
def toolNewJetFitterVxFinder_SV(name,
                                suffix="",
                                useBTagFlagsDefaults=True,
                                **options):
    """Sets up a NewJetFitterVxFinder tool and returns it.

    The following options have BTaggingFlags defaults:

    OutputLevel                         default: BTaggingFlags.OutputLevel
    VxPrimaryContainer                  default: BTaggingFlags.PrimaryVertexCollectionName
    MaxNumDeleteIterations              default: 30
    VertexProbCut                       default: 0.001
    MaxClusteringIterations             default: 30
    VertexClusteringProbabilityCut      default: 0.005

    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:
        if not 'InDetKeys' in dir():
            from InDetRecExample.InDetKeys import InDetKeys
        inDetJetFitterUtils = toolInDetJetFitterUtils_SV('InDetJFUtils' +
                                                         suffix)
        improvedJetFitterRoutines = toolImprovedJetFitterRoutines(
            'ImprovedJFRoutines' + suffix)
        jetFitterMode3dTo1dFinder = toolJetFitterMode3dTo1dFinder(
            'JFMode3dTo1dFinder' + suffix)
        inDetImprovedJetFitterTrackSelectorTool = toolInDetImprovedJetFitterTrackSelectorTool(
            'InDetImprovedJFTrackSelTool' + suffix)
        jetFitterSequentialVertexFitter = toolJetFitterSequentialVertexFitter_SV(
            'JFSeqVxFitter' + suffix)
        jetFitterExtrapolator = toolJetFitterExtrapolator('JFExtrapolator' +
                                                          suffix)
        improvedJetFitterInitializationHelper = toolImprovedJetFitterInitializationHelper(
            'ImprovedJFInitHelper' + suffix)
        vertexEdmFactory = toolVxInternalEdmFactory_SV('VxInternalEdmFactory' +
                                                       suffix)
        defaults = {
            'OutputLevel': BTaggingFlags.OutputLevel,
            'VxPrimaryContainer': BTaggingFlags.PrimaryVertexCollectionName,
            'MaxNumDeleteIterations': 30,
            'VertexProbCut': 0.001,
            'MaxClusteringIterations': 30,
            'VertexClusteringProbabilityCut': 0.005,
            'VertexEdmFactory': vertexEdmFactory,
            'JetFitterInitializationHelper':
            improvedJetFitterInitializationHelper,
            'InDetJetFitterUtils': inDetJetFitterUtils,
            'Extrapolator': jetFitterExtrapolator,
            'JetFitterRoutines': improvedJetFitterRoutines,
            'TrackSelector': inDetImprovedJetFitterTrackSelectorTool,
            'Mode3dFinder': jetFitterMode3dTo1dFinder,
            'SequentialVertexFitter': jetFitterSequentialVertexFitter
        }
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name + suffix
    from InDetSecVxFinderTool.InDetSecVxFinderToolConf import InDet__InDetImprovedJetFitterVxFinder
    return InDet__InDetImprovedJetFitterVxFinder(**options)
Пример #3
0
def get_jet_fitter_vx_finder(
  vx_finder_name, 
  init_helper, 
  routines, 
  utils, 
  extrapolator, 
  track_selector, 
  mode3dfinder, 
  seq_vx_fitter, 
  vxp_container, 
  b_tag_tool, 
  output_level = 3, 
  cut_factor = None, 
  output_threshold = 3): 
  
  """builds a replacement for NewJetFitterVxFinder"""
  
  from AthenaCommon.AppMgr import ToolSvc

  # --- looser cuts
  loose_cuts = dict(
    cutCompatibilityPrimaryVertexForPositiveLifetimeTracks = 0.2, 
    cutCompatibilityPrimaryVertexForNegativeLifetimeTracks = 0.1, 
    VertexClusteringProbabilityCut = 0.01, 
    twoVertexProbabilityCut = 0.05, 
    cutCompatibilityPrimaryVertexSingleTrackForBFirstSelection = 0.2, 
    cutCompatibilityPrimaryVertexBothTracksForBFirstSelection = 0.05, 
    cutPtBothTracksForBFirstSelection = 400.0, 
    cutPtSingleTrackForBSecondSelection = 500.0, 
    )

  # --- looserer cuts
  if cut_factor: 
    for cut in loose_cuts.keys(): 
      if 'Pt' in cut: 
        continue 
      loose_cuts[cut] *= cut_factor
  else: 
    loose_cuts = dict(
      VertexClusteringProbabilityCut = 0.005, 
      )

  from InDetSecVxFinderTool.InDetSecVxFinderToolConf import (
    InDet__InDetImprovedJetFitterVxFinder ) 

  VxFinder = InDet__InDetImprovedJetFitterVxFinder( 
    name = vx_finder_name, 
    JetFitterInitializationHelper = init_helper,
    JetFitterRoutines = routines,
    InDetJetFitterUtils = utils,
    Extrapolator = extrapolator,
    TrackSelector = track_selector,
    Mode3dFinder = mode3dfinder,
    SequentialVertexFitter = seq_vx_fitter,
    # VxPrimaryContainer="VxPrimaryCandidateAOD",
    VxPrimaryContainer = vxp_container,
    OutputLevel = output_level,
    MaxNumDeleteIterations = 30,
    VertexProbCut = 0.001,
    MaxClusteringIterations = 30,
    **loose_cuts
    )

  ToolSvc += VxFinder
  if output_level < output_threshold:
    print VxFinder
        
  b_tag_tool.SecVtxFinderList+= [ VxFinder ]
  b_tag_tool.SecVtxFinderTrackNameList+=["Tracks"]

  return VxFinder
    if BTaggingFlags.OutputLevel < 3:
      print NewInDetJetFitterUtils

    if not 'InDetKeys' in dir():
      from InDetRecExample.InDetKeys import InDetKeys
#??    InDetKeys.lock_JobProperties()

from InDetSecVxFinderTool.InDetSecVxFinderToolConf import InDet__InDetImprovedJetFitterVxFinder
NewJetFitterVxFinderFlip = InDet__InDetImprovedJetFitterVxFinder( name = "NewJetFitterVxFinderFlip",
                                                                 JetFitterInitializationHelper = NewJetFitterInitializationHelper,
                                                                 JetFitterRoutines = NewJetFitterRoutines,
                                                                 InDetJetFitterUtils=NewInDetJetFitterUtils,
                                                                 Extrapolator=JetFitterExtrapolator,
                                                                 TrackSelector = NewInDetJetFitterTrackSelectorTool,
                                                                 Mode3dFinder=mode3dfinder,
                                                                 SequentialVertexFitter=sequentialVtxFitter,
                                                                 #VxPrimaryContainer="VxPrimaryCandidateAOD",
                                                                 VxPrimaryContainer=InDetKeys.PrimaryVertices(),
                                                                 OutputLevel = BTaggingFlags.OutputLevel,
                                                                 MaxNumDeleteIterations = 30,
                                                                 VertexProbCut = 0.001,
                                                                 MaxClusteringIterations = 30,
                                                                 VertexClusteringProbabilityCut = 0.005,
                                                                 revertFromPositiveToNegativeTags=True)



ToolSvc += NewJetFitterVxFinderFlip
if BTaggingFlags.OutputLevel < 3:
  print NewJetFitterVxFinderFlip

#JetFitterVxFinder.MaxTracksToFitAtOnce = 3000
if not 'InDetKeys' in dir():
    from InDetRecExample.InDetKeys import InDetKeys
#??    InDetKeys.lock_JobProperties()




from InDetSecVxFinderTool.InDetSecVxFinderToolConf import InDet__InDetImprovedJetFitterVxFinder
NewJetFitterVxFinder = InDet__InDetImprovedJetFitterVxFinder( name = "NewJetFitterVxFinder",
                                                              JetFitterInitializationHelper = NewJetFitterInitializationHelper,
                                                              JetFitterRoutines = NewJetFitterRoutines,
                                                              InDetJetFitterUtils=NewInDetJetFitterUtils,
                                                              Extrapolator=JetFitterExtrapolator,
                                                              TrackSelector = NewInDetJetFitterTrackSelectorTool,
                                                              Mode3dFinder=mode3dfinder,
                                                              SequentialVertexFitter=sequentialVtxFitter,
                                                              VxPrimaryContainer="PrimaryVertices",
#                                                              VxPrimaryContainer=InDetKeys.PrimaryVertices(),
                                                              VertexEdmFactory=InDetVxIntEdmCnv,
                                                              OutputLevel = BTaggingFlags.OutputLevel,
                                                              MaxNumDeleteIterations = 30,
                                                              VertexProbCut = 0.001,
                                                              MaxClusteringIterations = 30,
                                                              VertexClusteringProbabilityCut = 0.005)



ToolSvc += NewJetFitterVxFinder
if BTaggingFlags.OutputLevel < 3:
  print NewJetFitterVxFinder

#JetFitterVxFinder.MaxTracksToFitAtOnce = 3000