ATLAS Offline Software
ISF_FastCaloSimServicesConfig.py
Go to the documentation of this file.
1 """ComponentAccumulator service configuration for ISF_FastCaloSimServices
2 
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from RngComps.RngCompsConfig import AthRNGSvcCfg
8 from ISF_Services.ISF_ServicesConfig import TruthServiceCfg
9 from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConfig import FastCaloSimCaloExtrapolationCfg
10 
11 
12 def PunchThroughClassifierCfg(flags, name="ISF_PunchThroughClassifier", **kwargs):
14  kwargs.setdefault("ScalerConfigFileName" , "FastCaloSim/MC23/TFCSparam_mpt_classScaler_v04.xml" )
15  kwargs.setdefault("NetworkConfigFileName" , "FastCaloSim/MC23/TFCSparam_mpt_classNet_v04.json" )
16  kwargs.setdefault("CalibratorConfigFileName" , "FastCaloSim/MC23/TFCSparam_mpt_classCalib_v04.xml")
17  acc.setPrivateTools(CompFactory.ISF.PunchThroughClassifier(name, **kwargs))
18  return acc
19 
20 
21 def PunchThroughToolCfg(flags, name="ISF_PunchThroughTool", **kwargs):
22  from SubDetectorEnvelopes.SubDetectorEnvelopesConfig import EnvelopeDefSvcCfg
23  acc = ComponentAccumulator()
24  if "PunchThroughClassifier" not in kwargs:
25  kwargs.setdefault("PunchThroughClassifier", acc.addPublicTool(acc.popToolsAndMerge(PunchThroughClassifierCfg(flags))))
26 
27  kwargs.setdefault("FilenameLookupTable" , "FastCaloSim/MC23/TFCSparam_mpt_v07.root")
28  kwargs.setdefault("FilenameInverseCdf" , "FastCaloSim/MC23/TFCSparam_mpt_inverseCdf_v07.xml")
29  kwargs.setdefault("FilenameInversePca" , "FastCaloSim/MC23/TFCSparam_mpt_inversePca_v07.xml")
30  kwargs.setdefault("EnergyFactor" , [ 0.98, 0.831, 0.896, 0.652, 0.717, 1., 0.877, 0.858, 0.919 ] )
31  kwargs.setdefault("DoAntiParticles" , [ 0, 1, 0, 1, 1, 0, 0, 0, 0 ] )
32  kwargs.setdefault("PunchThroughInitiators" , [ 211, 321, 311, 310, 130, 2212, 2112] )
33  kwargs.setdefault("InitiatorsMinEnergy" , [ 65536, 65536, 65536, 65536, 65536, 65536, 65536] )
34  kwargs.setdefault("InitiatorsEtaRange" , [ -3.2, 3.2 ] )
35  kwargs.setdefault("PunchThroughParticles" , [ 2212, 211, 22, 11, 13, 2112, 321, 310, 130 ] )
36  kwargs.setdefault("PunchThroughParticles" , [ 2212, 211, 22, 11, 13, 2112, 321, 310, 130 ] )
37  kwargs.setdefault("CorrelatedParticle" , [] )
38  kwargs.setdefault("FullCorrelationEnergy" , [ 100000., 100000., 100000., 100000., 0., 100000., 100000., 100000., 100000.] )
39  kwargs.setdefault("MinEnergy" , [ 938.3, 135.6, 50., 50., 105.7, 939.6, 493.7, 497.6, 497.6 ] )
40  kwargs.setdefault("MaxNumParticles" , [ -1, -1, -1, -1, -1, -1, -1, -1, -1 ] )
41  kwargs.setdefault("EnvelopeDefSvc", acc.getPrimaryAndMerge(EnvelopeDefSvcCfg(flags)).name)
42  kwargs.setdefault("BeamPipeRadius", 500.)
43  acc.setPrivateTools(CompFactory.ISF.PunchThroughTool(name, **kwargs))
44  return acc
45 
46 
47 def EmptyCellBuilderToolCfg(flags, name="ISF_EmptyCellBuilderTool", **kwargs):
48  acc = ComponentAccumulator()
49  acc.setPrivateTools(CompFactory.EmptyCellBuilderTool(name, **kwargs))
50  return acc
51 
52 
53 def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs):
54  from ISF_Algorithms.CollectionMergerConfig import CollectionMergerCfg
55 
56  acc = ComponentAccumulator()
57  mergeable_collection_suffix = "_FastCaloSim"
58  region = "CALO"
59 
60  EMB_hits_bare_collection_name = "LArHitEMB"
61  EMB_hits_merger_input_property = "LArEMBHits"
62  acc1, EMB_hits_collection_name = CollectionMergerCfg(
63  flags,
64  EMB_hits_bare_collection_name,
65  mergeable_collection_suffix,
66  EMB_hits_merger_input_property,
67  region)
68  acc.merge(acc1)
69 
70  EMEC_hits_bare_collection_name = "LArHitEMEC"
71  EMEC_hits_merger_input_property = "LArEMECHits"
72  acc2, EMEC_hits_collection_name = CollectionMergerCfg(
73  flags,
74  EMEC_hits_bare_collection_name,
75  mergeable_collection_suffix,
76  EMEC_hits_merger_input_property,
77  region)
78  acc.merge(acc2)
79 
80  FCAL_hits_bare_collection_name = "LArHitFCAL"
81  FCAL_hits_merger_input_property = "LArFCALHits"
82  acc3, FCAL_hits_collection_name = CollectionMergerCfg(
83  flags,
84  FCAL_hits_bare_collection_name,
85  mergeable_collection_suffix,
86  FCAL_hits_merger_input_property,
87  region)
88  acc.merge(acc3)
89 
90  HEC_hits_bare_collection_name = "LArHitHEC"
91  HEC_hits_merger_input_property = "LArHECHits"
92  acc4, HEC_hits_collection_name = CollectionMergerCfg(
93  flags,
94  HEC_hits_bare_collection_name,
95  mergeable_collection_suffix,
96  HEC_hits_merger_input_property,
97  region)
98  acc.merge(acc4)
99 
100  tile_hits_bare_collection_name = "TileHitVec"
101  tile_hits_merger_input_property = "TileHits"
102  acc5, tile_hits_collection_name = CollectionMergerCfg(
103  flags,
104  tile_hits_bare_collection_name,
105  mergeable_collection_suffix,
106  tile_hits_merger_input_property,
107  region)
108  acc.merge(acc5)
109 
110  kwargs.setdefault("embHitContainername", EMB_hits_collection_name)
111  kwargs.setdefault("emecHitContainername", EMEC_hits_collection_name)
112  kwargs.setdefault("fcalHitContainername", FCAL_hits_collection_name)
113  kwargs.setdefault("hecHitContainername", HEC_hits_collection_name)
114 
115  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
116  acc.merge(TileCablingSvcCfg(flags))
117 
118  from TileConditions.TileSamplingFractionConfig import TileSamplingFractionCondAlgCfg
119  acc.merge( TileSamplingFractionCondAlgCfg(flags) )
120 
121  kwargs.setdefault("tileHitContainername", tile_hits_collection_name)
122 
123  acc.setPrivateTools(CompFactory.FastHitConvertTool(name, **kwargs))
124  return acc
125 
126 
127 def CaloCellContainerFinalizerToolCfg(flags, name="ISF_CaloCellContainerFinalizerTool", **kwargs):
128  acc = ComponentAccumulator()
129  acc.setPrivateTools(CompFactory.CaloCellContainerFinalizerTool(name, **kwargs))
130  return acc
131 
132 
133 def CaloCellContainerFCSFinalizerToolCfg(flags, name="ISF_CaloCellContainerFCSFinalizerTool", **kwargs):
134  acc = ComponentAccumulator()
135  acc.setPrivateTools(CompFactory.CaloCellContainerFCSFinalizerTool(name, **kwargs))
136  return acc
137 
138 
139 def FastCaloSimV2ToolCfg(flags, name="ISF_FastCaloSimV2Tool", **kwargs):
140  acc = ComponentAccumulator()
141 
142  kwargs.setdefault("CaloCellsOutputName", flags.Sim.FastCalo.CaloCellsName)
143  kwargs.setdefault("CaloCellMakerTools_setup", [acc.addPublicTool(acc.popToolsAndMerge(EmptyCellBuilderToolCfg(flags)))])
144  kwargs.setdefault("CaloCellMakerTools_release", [acc.addPublicTool(acc.popToolsAndMerge(CaloCellContainerFCSFinalizerToolCfg(flags))),
145  acc.addPublicTool(acc.popToolsAndMerge(FastHitConvertToolCfg(flags)))])
146  kwargs.setdefault("FastCaloSimCaloExtrapolation", acc.addPublicTool(acc.popToolsAndMerge(FastCaloSimCaloExtrapolationCfg(flags))))
147  kwargs.setdefault("ParamSvc", acc.getPrimaryAndMerge(FastCaloSimV2ParamSvcCfg(flags)).name)
148  kwargs.setdefault("RandomSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
149  kwargs.setdefault("RandomStream", "FastCaloSimRnd")
150 
151  if "PunchThroughTool" not in kwargs:
152  kwargs.setdefault("PunchThroughTool", acc.popToolsAndMerge(PunchThroughToolCfg(flags)))
153 
154  if "ParticleTruthSvc" not in kwargs:
155  kwargs.setdefault("ParticleTruthSvc", acc.getPrimaryAndMerge(TruthServiceCfg(flags)).name)
156 
157  acc.setPrivateTools(CompFactory.ISF.FastCaloSimV2Tool(name, **kwargs))
158  return acc
159 
160 
161 
163 
164 def FastCaloSimV2ParamSvcCfg(flags, name="ISF_FastCaloSimV2ParamSvc", **kwargs):
165  acc = ComponentAccumulator()
166  kwargs.setdefault("ParamsInputFilename", flags.Sim.FastCalo.ParamsInputFilename)
167  kwargs.setdefault("RunOnGPU", flags.Sim.FastCalo.RunOnGPU)
168  kwargs.setdefault("ParamsInputObject", "SelPDGID")
169  acc.addService(CompFactory.ISF.FastCaloSimV2ParamSvc(name, **kwargs), primary = True)
170  return acc
171 
172 
173 def FastCaloSimV2SvcCfg(flags, name="ISF_FastCaloSimSvcV2", **kwargs):
174  acc = ComponentAccumulator()
175  kwargs.setdefault("SimulatorTool", acc.addPublicTool(acc.popToolsAndMerge(FastCaloSimV2ToolCfg(flags))))
176  kwargs.setdefault("Identifier", "FastCaloSim")
177  acc.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs), primary = True)
178  return acc
179 
180 
181 def DNNCaloSimSvcCfg(flags, name="ISF_DNNCaloSimSvc", **kwargs):
182  acc = ComponentAccumulator()
183  kwargs.setdefault("CaloCellsOutputName", flags.Sim.FastCalo.CaloCellsName)
184  kwargs.setdefault("CaloCellMakerTools_setup", [acc.addPublicTool(acc.popToolsAndMerge(EmptyCellBuilderToolCfg(flags)))])
185  kwargs.setdefault("CaloCellMakerTools_release", [acc.addPublicTool(acc.popToolsAndMerge(CaloCellContainerFinalizerToolCfg(flags))),
186  acc.addPublicTool(acc.popToolsAndMerge(FastHitConvertToolCfg(flags)))]) #DR needed ?
187  kwargs.setdefault("ParamsInputFilename", flags.Sim.FastCalo.ParamsInputFilename)
188  kwargs.setdefault("FastCaloSimCaloExtrapolation", acc.addPublicTool(acc.popToolsAndMerge(FastCaloSimCaloExtrapolationCfg(flags))))
189  kwargs.setdefault("RandomStream", "FastCaloSimRnd")
190  kwargs.setdefault("RandomSvc",
191  acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
192 
193  acc.addService(CompFactory.ISF.DNNCaloSimSvc(name, **kwargs), primary = True)
194  return acc
ISF_FastCaloSimServicesConfig.FastCaloSimV2SvcCfg
def FastCaloSimV2SvcCfg(flags, name="ISF_FastCaloSimSvcV2", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:173
ISF_FastCaloSimServicesConfig.FastHitConvertToolCfg
def FastHitConvertToolCfg(flags, name="ISF_FastHitConvertTool", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:53
ISF_FastCaloSimServicesConfig.PunchThroughToolCfg
def PunchThroughToolCfg(flags, name="ISF_PunchThroughTool", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:21
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
ISF_FastCaloSimServicesConfig.FastCaloSimV2ParamSvcCfg
def FastCaloSimV2ParamSvcCfg(flags, name="ISF_FastCaloSimV2ParamSvc", **kwargs)
Config.
Definition: ISF_FastCaloSimServicesConfig.py:164
ISF_FastCaloSimServicesConfig.DNNCaloSimSvcCfg
def DNNCaloSimSvcCfg(flags, name="ISF_DNNCaloSimSvc", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:181
python.TileSamplingFractionConfig.TileSamplingFractionCondAlgCfg
def TileSamplingFractionCondAlgCfg(flags, **kwargs)
Definition: TileSamplingFractionConfig.py:9
ISF_FastCaloSimServicesConfig.EmptyCellBuilderToolCfg
def EmptyCellBuilderToolCfg(flags, name="ISF_EmptyCellBuilderTool", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:47
ISF_FastCaloSimParametrizationConfig.FastCaloSimCaloExtrapolationCfg
def FastCaloSimCaloExtrapolationCfg(flags, name="FastCaloSimCaloExtrapolation", **kwargs)
Definition: ISF_FastCaloSimParametrizationConfig.py:65
ISF_FastCaloSimServicesConfig.CaloCellContainerFinalizerToolCfg
def CaloCellContainerFinalizerToolCfg(flags, name="ISF_CaloCellContainerFinalizerTool", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:127
ISF_ServicesConfig.TruthServiceCfg
def TruthServiceCfg(flags, **kwargs)
Definition: ISF_ServicesConfig.py:80
ISF_FastCaloSimServicesConfig.CaloCellContainerFCSFinalizerToolCfg
def CaloCellContainerFCSFinalizerToolCfg(flags, name="ISF_CaloCellContainerFCSFinalizerTool", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:133
SubDetectorEnvelopesConfig.EnvelopeDefSvcCfg
def EnvelopeDefSvcCfg(flags, name="AtlasGeometry_EnvelopeDefSvc", **kwargs)
Definition: SubDetectorEnvelopesConfig.py:15
ISF_FastCaloSimServicesConfig.FastCaloSimV2ToolCfg
def FastCaloSimV2ToolCfg(flags, name="ISF_FastCaloSimV2Tool", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:139
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11
CollectionMergerConfig.CollectionMergerCfg
def CollectionMergerCfg(flags, bare_collection_name, mergeable_collection_suffix, merger_input_property, region)
Definition: CollectionMergerConfig.py:66
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51