TrigMultiTrkComboHypoConfig.py 4.91 KB
Newer Older
1
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2

3
from AthenaConfiguration.ComponentFactory import CompFactory
4
5
from TrigBphysHypo.TrigBphysHypoConf import TrigMultiTrkComboHypo, TrigMultiTrkComboHypoTool
from TrigBphysHypo.TrigMultiTrkComboHypoMonitoringConfig import TrigMultiTrkComboHypoMonitoring, TrigMultiTrkComboHypoToolMonitoring
6
7

from AthenaCommon.Logging import logging
8
9
log = logging.getLogger('TrigMultiTrkComboHypoConfig')

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
trigMultiTrkComboHypoToolDict = {
    'bJpsimumu'     : { 'massRange' : (2500.,  4300.), 'chi2' : 20. },
    'bJpsi'         : { 'massRange' : (2500.,  4300.), 'chi2' : 20. },
    'bJpsimumul2io' : { 'massRange' : (2500.,  4300.), 'chi2' : 20. },
    'bUpsimumu'     : { 'massRange' : (8000., 12000.), 'chi2' : 20. },
    'bUpsi'         : { 'massRange' : (8000., 12000.), 'chi2' : 20. },
    'bDimu'         : { 'massRange' : (1500., 14000.), 'chi2' : 20. },
    'bDimu2700'     : { 'massRange' : ( 100.,  2700.), 'chi2' : 20. },
    'bDimu6000'     : { 'massRange' : ( 100.,  6000.), 'chi2' : 20. },
    'bBmumu'        : { 'massRange' : (4000.,  8500.), 'chi2' : 20. },
    'bPhi'          : { 'massRange' : ( 940.,  1100.), 'chi2' : 10. },
    'bTau'          : { 'massRange' : (   0.,  2700.), 'chi2' : 50. },
}


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def DimuL2ComboHypoCfg(name):
    log.debug('DimuL2ComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
        trigSequenceName = 'Dimu',
        trigLevel = 'L2',
        trackCollection='HLT_IDTrack_Muon_FTF')
    return hypo

def DimuEFComboHypoCfg(name):
    from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muonNames
    log.debug('DimuEFComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
        trigSequenceName = 'Dimu',
        trigLevel = 'EF',
        muonCollection = muonNames().getNames('RoI').EFCBName)
    return hypo

def TrigMultiTrkComboHypoToolFromDict(chainDict):
    config = TrigMultiTrkComboHypoConfig()
    tool = config.ConfigurationComboHypoTool(chainDict)
49
50
    return tool

51
class TrigMultiTrkComboHypoConfig(object):
52

53
    def ConfigurationComboHypo(self, trigSequenceName='Dimu', trigLevel='L2', trackCollection='', muonCollection=''):
54
55
56
57
58

        trigLevelDict = {'L2':0, 'EF':1}

        try:
            value = trigLevelDict[trigLevel]
59
            log.debug('TrigMultiTrkComboHypo.trigLevel = %s ', value)
60
        except KeyError:
61
            raise Exception('TrigMultiTrkComboHypo.trigLevel should be L2 or EF, but %s provided.', trigLevel)
62

63
        from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
64
        from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter
65
        VertexFitter = CompFactory.Trk__TrkVKalVrtFitter(
66
67
68
            name = 'TrigBphysFitter_'+trigSequenceName+trigLevel,
            FirstMeasuredPoint = False,
            MakeExtendedVertex = False,
69
            Extrapolator = AtlasExtrapolator())
70
71

        from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__VertexPointEstimator
72
        VertexPointEstimator = CompFactory.InDet__VertexPointEstimator(
73
74
75
76
77
78
            name = 'VertexPointEstimator_'+trigSequenceName+trigLevel,
            MinDeltaR = [-10000., -10000., -10000.],
            MaxDeltaR = [ 10000.,  10000.,  10000.],
            MaxPhi    = [ 10000.,  10000.,  10000.],
            MaxChi2OfVtxEstimation = 2000.)

79
        tool = CompFactory.TrigMultiTrkComboHypo(
80
            name = trigSequenceName+trigLevel+'ComboHypo',
81
82
83
84
            trigLevel = trigLevel,
            nTracks = 2,
            massRanges = [ (100., 20000.) ],
            TrackCollectionKey = trackCollection,
85
86
87
            MuonCollectionKey = muonCollection,
            VertexFitter = VertexFitter,
            VertexPointEstimator = VertexPointEstimator,
88
89
90
91
92
            CheckMultiplicityMap = False,
            MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+trigSequenceName+trigLevel))

        if trigLevel == 'EF':
            tool.TrigBphysCollectionKey = 'HLT_'+trigSequenceName+trigLevel
93
94
95

        return tool

96
    def ConfigurationComboHypoTool(self, chainDict):
97

98
        tool = CompFactory.TrigMultiTrkComboHypoTool(chainDict['chainName'])
99

100
101
102
103
104
105
106
107
108
109
        try:
            topo = chainDict['topo'][0]
            value = trigMultiTrkComboHypoToolDict[topo]
            tool.massRange = value['massRange']
            tool.chi2 = value['chi2']
            tool.totalCharge = 0
        except LookupError:
            raise Exception('TrigMultiTrkComboHypo misconfigured for \'%s\': topo \'%s\' is not supported.', chainDict['chainName'], topo)

        if 'nocut' in chainDict['topo']:
110
111
            tool.AcceptAll = True

112
113
        if 'noos' in chainDict['topo']:
            tool.totalCharge = -100 # negative number to indicate no charge cut
114

115
116
117
        if 'Lxy0' in chainDict['topo']:
            tool.LxyCut = 0.0

118
        tool.MonTool = TrigMultiTrkComboHypoToolMonitoring('MonTool')
119
        return tool