TrigMultiTrkComboHypoConfig.py 6.9 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
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. },
21
    'bBeeM6000'     : { 'massRange' : ( 100.,  6000.), 'chi2' : 20. },
22
23
24
}


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

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

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

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

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

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
51
        isStreamer = False,
52
53
        trigSequenceName = 'Dimu',
        trigLevel = 'EF',
54
55
56
57
58
59
60
61
62
63
64
65
66
        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.) ]
67
68
    return hypo

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def StreamerDiElecFastComboHypoCfg(name):
    log.debug('StreamerDiElecFastComboHypoCfg.name = %s ', name)

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
        isStreamer = True,
        trigSequenceName = 'DiElecFast',
        trigLevel = 'L2',
        doElectrons = True,
        trackCollection='HLT_IDTrack_Electron_FTF')
    return hypo

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

    config = TrigMultiTrkComboHypoConfig()
    hypo = config.ConfigurationComboHypo(
        isStreamer = False,
        trigSequenceName = 'DiElecPrecision',
        trigLevel = 'EF',
        doElectrons = True,
        outputTrigBphysCollection = 'HLT_DiElecPrecision')
    return hypo


94
95
96
def TrigMultiTrkComboHypoToolFromDict(chainDict):
    config = TrigMultiTrkComboHypoConfig()
    tool = config.ConfigurationComboHypoTool(chainDict)
97
98
    return tool

99
class TrigMultiTrkComboHypoConfig(object):
100

101
    def ConfigurationComboHypo(self, isStreamer='False', trigSequenceName='Dimu', trigLevel='L2', trackCollection='', outputTrigBphysCollection='TrigBphysContainer', doElectrons = False):
102

103
        trigLevelDict = {'L2':0, 'L2IO':1, 'EF':2}
104
105
106

        try:
            value = trigLevelDict[trigLevel]
107
            log.debug('TrigMultiTrkComboHypo.trigLevel = %s ', value)
108
        except KeyError:
109
110
111
            raise Exception('TrigMultiTrkComboHypo.trigLevel should be L2, L2IO or EF, but %s provided.', trigLevel)

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

113
        from TrkExTools.AtlasExtrapolator import AtlasExtrapolator
114
        VertexFitter = CompFactory.Trk__TrkVKalVrtFitter(
115
            name = 'TrigBphysFitter_'+baseName,
116
117
            FirstMeasuredPoint = False,
            MakeExtendedVertex = False,
118
            Extrapolator = AtlasExtrapolator())
119

120
        VertexPointEstimator = CompFactory.InDet__VertexPointEstimator(
121
            name = 'VertexPointEstimator_'+baseName,
122
123
124
125
126
            MinDeltaR = [-10000., -10000., -10000.],
            MaxDeltaR = [ 10000.,  10000.,  10000.],
            MaxPhi    = [ 10000.,  10000.,  10000.],
            MaxChi2OfVtxEstimation = 2000.)

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
        if doElectrons:
            trackMasses = [0.511,0.511]
            tool = CompFactory.TrigMultiTrkComboHypo(
              name = baseName+'ComboHypo',
              isStreamer = isStreamer,
              doElectrons = True,
              trigLevel = trigLevel,
              nTracks = 2,
              trackMasses = trackMasses,
              massRanges = [ (100., 20000.) ],
              TrackCollectionKey = trackCollection,
              TrigBphysCollectionKey = outputTrigBphysCollection,
              VertexFitter = VertexFitter,
              VertexPointEstimator = VertexPointEstimator,
              CheckMultiplicityMap = False,
              MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+baseName))
Adam Edward Barton's avatar
Adam Edward Barton committed
143
            return tool
144

145
        tool = CompFactory.TrigMultiTrkComboHypo(
146
147
            name = baseName+'ComboHypo',
            isStreamer = isStreamer,
148
149
150
151
            trigLevel = trigLevel,
            nTracks = 2,
            massRanges = [ (100., 20000.) ],
            TrackCollectionKey = trackCollection,
152
            TrigBphysCollectionKey = outputTrigBphysCollection,
153
154
            VertexFitter = VertexFitter,
            VertexPointEstimator = VertexPointEstimator,
155
            CheckMultiplicityMap = False,
156
            MonTool = TrigMultiTrkComboHypoMonitoring('TrigMultiTrkComboHypoMonitoring_'+baseName))
157
158
159

        return tool

160
    def ConfigurationComboHypoTool(self, chainDict):
161

162
        tool = CompFactory.TrigMultiTrkComboHypoTool(chainDict['chainName'])
163

164
165
166
167
168
169
170
171
172
173
        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']:
174
175
            tool.AcceptAll = True

176
177
        if 'noos' in chainDict['topo']:
            tool.totalCharge = -100 # negative number to indicate no charge cut
178

179
180
181
        if 'Lxy0' in chainDict['topo']:
            tool.LxyCut = 0.0

182
        tool.MonTool = TrigMultiTrkComboHypoToolMonitoring('MonTool')
183
        return tool