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

3
from AthenaConfiguration.ComponentFactory import CompFactory
4
from TrigBphysHypo.TrigMultiTrkComboHypoMonitoringConfig import TrigMultiTrkComboHypoMonitoring, TrigMultiTrkComboHypoToolMonitoring
5
6

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

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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. },
}


24
def StreamerDimuL2ComboHypoCfg(name):
25
26
27
28
    log.debug('DimuL2ComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
29
        isStreamer = True,
30
31
32
33
34
        trigSequenceName = 'Dimu',
        trigLevel = 'L2',
        trackCollection='HLT_IDTrack_Muon_FTF')
    return hypo

35
36
37
38
39
40
41
42
43
44
def StreamerDimuL2IOComboHypoCfg(name):
    log.debug('DimuL2IOComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
        isStreamer = True,
        trigSequenceName = 'Dimu',
        trigLevel = 'L2IO')
    return hypo

45
46
47
48
49
def DimuEFComboHypoCfg(name):
    log.debug('DimuEFComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
50
        isStreamer = False,
51
52
        trigSequenceName = 'Dimu',
        trigLevel = 'EF',
53
54
55
56
57
58
59
60
61
62
63
64
65
        outputTrigBphysCollection = 'HLT_DimuEF')
    return hypo

def StreamerDimuEFComboHypoCfg(name):
    log.debug('StreamerDimuEFComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
        isStreamer = True,
        trigSequenceName = 'StreamerDimu',
        trigLevel = 'EF')
    hypo.chi2 = 20.
    hypo.massRanges = [ (100., 6000.) ]
66
67
68
69
70
    return hypo

def TrigMultiTrkComboHypoToolFromDict(chainDict):
    config = TrigMultiTrkComboHypoConfig()
    tool = config.ConfigurationComboHypoTool(chainDict)
71
72
    return tool

73
class TrigMultiTrkComboHypoConfig(object):
74

75
    def ConfigurationComboHypo(self, isStreamer='False', trigSequenceName='Dimu', trigLevel='L2', trackCollection='', outputTrigBphysCollection='TrigBphysContainer'):
76

77
        trigLevelDict = {'L2':0, 'L2IO':1, 'EF':2}
78
79
80

        try:
            value = trigLevelDict[trigLevel]
81
            log.debug('TrigMultiTrkComboHypo.trigLevel = %s ', value)
82
        except KeyError:
83
84
85
            raise Exception('TrigMultiTrkComboHypo.trigLevel should be L2, L2IO or EF, but %s provided.', trigLevel)

        baseName = 'Streamer'+trigSequenceName+trigLevel if isStreamer else trigSequenceName+trigLevel
86

87
        from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
88
        VertexFitter = CompFactory.Trk__TrkVKalVrtFitter(
89
            name = 'TrigBphysFitter_'+baseName,
90
91
            FirstMeasuredPoint = False,
            MakeExtendedVertex = False,
92
            Extrapolator = AtlasExtrapolator())
93

94
        VertexPointEstimator = CompFactory.InDet__VertexPointEstimator(
95
            name = 'VertexPointEstimator_'+baseName,
96
97
98
99
100
            MinDeltaR = [-10000., -10000., -10000.],
            MaxDeltaR = [ 10000.,  10000.,  10000.],
            MaxPhi    = [ 10000.,  10000.,  10000.],
            MaxChi2OfVtxEstimation = 2000.)

101
        tool = CompFactory.TrigMultiTrkComboHypo(
102
103
            name = baseName+'ComboHypo',
            isStreamer = isStreamer,
104
105
106
107
            trigLevel = trigLevel,
            nTracks = 2,
            massRanges = [ (100., 20000.) ],
            TrackCollectionKey = trackCollection,
108
            TrigBphysCollectionKey = outputTrigBphysCollection,
109
110
            VertexFitter = VertexFitter,
            VertexPointEstimator = VertexPointEstimator,
111
            CheckMultiplicityMap = False,
112
            MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+baseName))
113
114
115

        return tool

116
    def ConfigurationComboHypoTool(self, chainDict):
117

118
        tool = CompFactory.TrigMultiTrkComboHypoTool(chainDict['chainName'])
119

120
121
122
123
124
125
126
127
128
129
        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']:
130
131
            tool.AcceptAll = True

132
133
        if 'noos' in chainDict['topo']:
            tool.totalCharge = -100 # negative number to indicate no charge cut
134

135
136
137
        if 'Lxy0' in chainDict['topo']:
            tool.LxyCut = 0.0

138
        tool.MonTool = TrigMultiTrkComboHypoToolMonitoring('MonTool')
139
        return tool