ATLAS Offline Software
Loading...
Searching...
No Matches
TileMuIdConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3#
4'''
5@file TileMuIdConfig.py
6@brief Python configuration of Tile look for mu algorithm for the Run III
7'''
8
9from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10from AthenaConfiguration.ComponentFactory import CompFactory
11
12def TileLookForMuAlgCfg(flags, **kwargs):
13
14 acc = ComponentAccumulator()
15
16 from TileGeoModel.TileGMConfig import TileGMCfg
17 acc.merge(TileGMCfg(flags))
18
19 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
20 acc.merge(LArGMCfg(flags))
21
22 kwargs.setdefault('name', 'TileLookForMuAlg')
23 kwargs.setdefault('TileMuTagsOutputName', 'TileMuObj')
24
25 kwargs.setdefault('CellsNames', 'AllCalo')
26
27 kwargs.setdefault('LowerTresh0MeV', 80.0)
28 kwargs.setdefault('LowerTresh1MeV', 80.0)
29 kwargs.setdefault('LowerTresh2MeV', 80.0)
30 kwargs.setdefault('LowerTreshScinMeV', 160.0)
31
32
33 # Configure energy thresholds in Tile D cells to look for muons
34 nCellsD = 13
35 UpperTresh2MeV=[2370.0, 2100.0, 900.0, 1050.0, 1050.0, 1110.0, 1590.0,
36 1110.0, 1050.0, 1050.0, 900.0, 2100.0, 2370.0]
37
38 kwargs.setdefault('UpperTresh2MeV', UpperTresh2MeV)
39 if len(kwargs['UpperTresh2MeV']) != nCellsD:
40 raise RuntimeError('Energy thresholds for %s Tile D cells are needed' % nCellsD)
41
42 # Configure energy thresholds in Tile BC cells to look for muons
43 nCellsBC = 30
44 UpperTresh1MeV=[1680.0, 1500.0, 1440.0, 1380.0, 1050.0, 390.0,
45 1110.0, 1860.0, 1890.0, 1800.0, 1860.0, 1890.0,
46 1770.0, 1980.0, 2550.0, 2550.0, 1980.0, 1770.0,
47 1890.0, 1860.0, 1800.0, 1890.0, 1860.0, 1110.0,
48 390.0, 1050.0, 1380.0, 1440.0, 1500.0, 1680.0]
49
50 kwargs.setdefault('UpperTresh1MeV', UpperTresh1MeV)
51 if len(kwargs['UpperTresh1MeV']) != nCellsBC:
52 raise RuntimeError('Energy thresholds for %s Tile BC cells are needed' % nCellsBC)
53
54 # Configure energy thresholds in Tile A cells to look for muons
55 nCellsA = 30
56 UpperTresh0MeV=[1680.0, 1380.0, 1230.0, 1140.0, 210.0, 900.0,
57 960.0, 840.0, 930.0, 840.0, 840.0, 750.0,
58 870.0, 960.0, 1350.0, 1350.0, 960.0, 870.0,
59 750.0, 840.0, 840.0, 930.0, 840.0, 960.0,
60 900.0, 210.0, 1140.0, 1230.0, 1380.0, 1680.0]
61
62 kwargs.setdefault('UpperTresh0MeV', UpperTresh0MeV)
63 if len(kwargs['UpperTresh0MeV']) != nCellsA:
64 raise RuntimeError('Energy thresholds for %s Tile A cells are needed' % nCellsA)
65
66 # Configure which Tile BC cells should be checked when looking for muons, starting from Tile D cells
67 # Numbers are splitted by 6 [number of cells to be checked, followed by Tile BC cells to be checked]
68 # For instance: starting from the 7th cell in the 3rd (D) layer
69 # check 2 Tile BC cells: the 16th and 17th in the 2nd (BC) layer etc.
70 From3to2=[5,0,1,2,3,4, 5,2,3,4,5,6, 2,6,7,0,0,0, 3,7,8,9,0,0,
71 3,9,10,11,0,0, 2,12,13,0,0,0, 2,14,15,0,0,0, 2,16,17,0,0,0,
72 3,18,19,20,0,0, 3,20,21,22,0,0, 2,22,23,0,0,0, 5,23,24,25,26,27,
73 5,25,26,27,28,29]
74
75 kwargs.setdefault('From3to2', From3to2)
76 if len(kwargs['From3to2']) != (nCellsD * 6):
77 raise RuntimeError('6x%s numbers required for Tile D -> BC cells mapping' % nCellsD)
78
79 # Configure which Tile A cells should be checked when looking for muons, starting from Tile BC cells
80 # Numbers are splitted by 6 [number of cells to be checked, followed by Tile A cells to be checked]
81 From2to1=[2,1,2,0,0,0, 3,1,2,3,0,0, 3,2,3,4,0,0, 3,3,4,5,0,0, 2,4,5,0,0,0,
82 1,5,0,0,0,0, 1,6,0,0,0,0, 1,7,0,0,0,0, 1,8,0,0,0,0, 1,9,0,0,0,0,
83 1,10,0,0,0,0, 1,11,0,0,0,0, 1,12,0,0,0,0, 1,13,0,0,0,0, 1,14,0,0,0,0,
84 1,15,0,0,0,0, 1,16,0,0,0,0, 1,17,0,0,0,0, 1,18,0,0,0,0, 1,19,0,0,0,0,
85 1,20,0,0,0,0, 1,21,0,0,0,0, 1,22,0,0,0,0, 1,23,0,0,0,0, 1,24,0,0,0,0,
86 2,24,25,0,0,0, 3,24,25,26,0,0, 3,25,26,27,0,0, 3,26,27,28,0,0, 2,27,28,0,0,0]
87
88 kwargs.setdefault('From2to1', From2to1)
89 if len(kwargs['From2to1']) != (nCellsBC * 6):
90 raise RuntimeError('6x%s numbers required for Tile BC -> A cells mapping' % nCellsBC)
91
92
93 TileLookForMuAlg=CompFactory.TileLookForMuAlg
94 acc.addEventAlgo(TileLookForMuAlg(**kwargs), primary = True)
95
96
97 from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD
98 toStore="TileMuContainer#"+kwargs["TileMuTagsOutputName"]
99 acc.merge(addToESD(flags,toStore))
100 acc.merge(addToAOD(flags,toStore))
101
102 return acc
103
104
105if __name__=='__main__':
106
107 # Setup logs
108 from AthenaCommon.Logging import log
109 from AthenaCommon.Constants import INFO
110 log.setLevel(INFO)
111
112 # Set the Athena configuration flags
113 from AthenaConfiguration.AllConfigFlags import initConfigFlags
114 from AthenaConfiguration.TestDefaults import defaultTestFiles
115 flags = initConfigFlags()
116 flags.Input.Files = defaultTestFiles.ESD
117 flags.DQ.useTrigger = False
118 flags.DQ.enableLumiAccess = False
119 flags.lock()
120
121 # Initialize configuration object, add accumulator, merge, and run.
122 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
123 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
124 cfg = MainServicesCfg(flags)
125 cfg.merge(PoolReadCfg(flags))
126
127 cfg.merge( TileLookForMuAlgCfg(flags, TileMuTagsOutputName='TileMuObjTest') )
128
129 cfg.printConfig(withDetails = True, summariseProps = True)
130 flags.dump()
131
132 cfg.store( open('TileLookForMuAlg.pkl','wb') )
133
134 sc = cfg.run(maxEvents=3)
135
136 import sys
137 # Success should be 0
138 sys.exit(not sc.isSuccess())
TileLookForMuAlgCfg(flags, **kwargs)