ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_Core
ISF_Algorithms
python
CollectionMergerConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
4
from
AthenaConfiguration.ComponentFactory
import
CompFactory
5
from
AthenaCommon.Logging
import
logging
6
from
AthenaConfiguration.AccumulatorCache
import
AccumulatorCache
7
8
9
@AccumulatorCache
10
def
ISFCollectionMergerCfg
(flags,name="ISF_CollectionMerger", **kwargs):
11
12
hardscatterSG=
""
13
from
AthenaConfiguration.Enums
import
Project
14
if
flags.Sim.DoFullChain:
15
if
flags.Common.Project
is
Project.Athena:
16
if
flags.Digitization.PileUp:
17
hardscatterSG =
"OriginalEvent_SG+"
18
else
:
19
msg = logging.getLogger(name)
20
msg.warning(
"Fast Chain running only supported in the Athena project."
)
21
if
flags.Detector.EnableBCM:
22
kwargs.setdefault(
"OutputBCMHits"
, hardscatterSG+
"BCMHits"
)
23
kwargs.setdefault(
"OutputBLMHits"
, hardscatterSG+
"BLMHits"
)
24
if
flags.Detector.EnablePixel:
25
kwargs.setdefault(
"OutputPixelHits"
, hardscatterSG+
"PixelHits"
)
26
if
flags.Detector.EnableSCT:
27
kwargs.setdefault(
"OutputSCTHits"
, hardscatterSG+
"SCT_Hits"
)
28
if
flags.Detector.EnableTRT:
29
kwargs.setdefault(
"OutputTRTUncompressedHits"
, hardscatterSG+
"TRTUncompressedHits"
)
30
31
if
flags.Detector.EnableITkPixel:
32
kwargs.setdefault(
"OutputITkPixelHits"
, hardscatterSG+
"ITkPixelHits"
)
33
if
flags.Detector.EnableITkStrip:
34
kwargs.setdefault(
"OutputITkStripHits"
, hardscatterSG+
"ITkStripHits"
)
35
if
flags.Detector.EnablePLR:
36
kwargs.setdefault(
"OutputPLRHits"
, hardscatterSG+
"PLR_Hits"
)
37
if
flags.Detector.EnableHGTD:
38
kwargs.setdefault(
"OutputHGTDHits"
, hardscatterSG+
"HGTD_Hits"
)
39
40
if
flags.Detector.EnableLAr:
41
kwargs.setdefault(
"OutputLArEMBHits"
, hardscatterSG+
"LArHitEMB"
)
42
kwargs.setdefault(
"OutputLArEMECHits"
, hardscatterSG+
"LArHitEMEC"
)
43
kwargs.setdefault(
"OutputLArFCALHits"
, hardscatterSG+
"LArHitFCAL"
)
44
kwargs.setdefault(
"OutputLArHECHits"
, hardscatterSG+
"LArHitHEC"
)
45
46
if
flags.Detector.EnableTile:
47
kwargs.setdefault(
"OutputTileHits"
, hardscatterSG+
"TileHitVec"
)
48
if
flags.Detector.EnableMBTS:
49
kwargs.setdefault(
"OutputMBTSHits"
, hardscatterSG+
"MBTSHits"
)
50
51
if
flags.Detector.EnableCSC:
52
kwargs.setdefault(
"OutputCSCHits"
, hardscatterSG+
"CSC_Hits"
)
53
if
flags.Detector.EnableMDT:
54
kwargs.setdefault(
"OutputMDTHits"
, hardscatterSG+
"MDT_Hits"
)
55
if
flags.Detector.EnableRPC:
56
kwargs.setdefault(
"OutputRPCHits"
, hardscatterSG+
"RPC_Hits"
)
57
if
flags.Detector.EnableTGC:
58
kwargs.setdefault(
"OutputTGCHits"
, hardscatterSG+
"TGC_Hits"
)
59
if
flags.Detector.EnablesTGC:
60
kwargs.setdefault(
"OutputsTGCHits"
, hardscatterSG+
"sTGC_Hits"
)
61
if
flags.Detector.EnableMM:
62
kwargs.setdefault(
"OutputMMHits"
, hardscatterSG+
"MM_Hits"
)
63
return
CompFactory.ISF.CollectionMerger(name, **kwargs)
64
65
66
def
CollectionMergerCfg
(flags,
67
bare_collection_name,
68
mergeable_collection_suffix,
69
merger_input_property,
70
region):
71
"""Generates and returns a collection name that is also registered to
72
the ISF CollectionMerger algorithm.
73
74
:param bare_collection_name: name of the collection if no merging
75
is taking place.
76
:param mergeable_collection_suffix: suffix to the collection in
77
case merging is taking place.
78
:param merger_input_property: name of the Input* property in the
79
CollectionMerger algorithm to add the
80
mergeable collection to."""
81
82
result = ComponentAccumulator()
83
from
SimulationConfig.SimEnums
import
LArParameterization
84
if
(flags.Sim.ISFRun
or
flags.Sim.LArParameterization
is
LArParameterization.FastCaloSim)
and
flags.Sim.ISF.HITSMergingRequired.get(region,
True
):
85
mergeable_collection = f
'{bare_collection_name}{mergeable_collection_suffix}'
86
87
from
ISF_Algorithms.CollectionMergerConfig
import
ISFCollectionMergerCfg
88
algo =
ISFCollectionMergerCfg
(flags)
89
if
flags.Sim.ISF.ReSimulation:
90
result.addEventAlgo(algo,
'SimSequence'
)
# TODO ideally this would be configurable
91
else
:
92
result.addEventAlgo(algo)
93
94
input_attribute_name = f
'Input{merger_input_property}'
95
merger_input_collections = getattr(algo, input_attribute_name)
96
if
mergeable_collection
not
in
merger_input_collections:
97
merger_input_collections.append(mergeable_collection)
98
else
:
99
mergeable_collection = bare_collection_name
100
return
result, mergeable_collection
CollectionMergerConfig.CollectionMergerCfg
CollectionMergerCfg(flags, bare_collection_name, mergeable_collection_suffix, merger_input_property, region)
Definition
CollectionMergerConfig.py:70
CollectionMergerConfig.ISFCollectionMergerCfg
ISFCollectionMergerCfg(flags, name="ISF_CollectionMerger", **kwargs)
Definition
CollectionMergerConfig.py:10
Generated on
for ATLAS Offline Software by
1.17.0