ATLAS Offline Software
Loading...
Searching...
No Matches
EvgenProdToolsConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from GeneratorConfig.Sequences import EvgenSequence, EvgenSequenceFactory
6
7
8def TestHepMCCfg(flags, name="TestHepMC", streamName="TestHepMCname", fileName="TestHepMC.root", **kwargs):
9 kwargs.setdefault("CmEnergy", flags.Beam.Energy * 2)
10
11 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Test))
12 acc.addService(CompFactory.THistSvc(name="THistSvc",
13 Output=[f"{streamName} DATAFILE='{fileName}' OPT='RECREATE'"]))
14
15 acc.addEventAlgo(CompFactory.TestHepMC(name, **kwargs))
16 return acc
17
18
19def FixHepMCCfg(flags, name="FixHepMC", **kwargs):
20 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Fix))
21 acc.addEventAlgo(CompFactory.FixHepMC(name, **kwargs))
22 return acc
23
24
25def GenWeightDeclarationCfg(flags, name="GenWeightDeclaration", **kwargs):
26 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.PreFilter))
27 acc.addService(CompFactory.HepMCWeightSvc("HepMCWeightSvc"))
28 acc.addEventAlgo(CompFactory.GenWeightDeclaration(name, **kwargs))
29 return acc
30
31
32def CountHepMCCfg(flags, name="CountHepMC", **kwargs):
33 kwargs.setdefault("InputEventInfo", "TMPEvtInfo")
34 kwargs.setdefault("OutputEventInfo", "EventInfo")
35 kwargs.setdefault("mcEventWeightsKey", "mcEventWeights")
36 kwargs.setdefault("FirstEvent", flags.Exec.FirstEvent)
37 kwargs.setdefault("CorrectHepMC", True)
38 kwargs.setdefault("CorrectEventID", True)
39
40 if flags.Input.Files:
41 kwargs.setdefault("CorrectRunNumber", True)
42 kwargs.setdefault("NewRunNumber", flags.Generator.DSID)
43
44 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Post))
45 acc.addEventAlgo(CompFactory.CountHepMC(name, **kwargs))
46 return acc
47
48
49def CopyEventWeightCfg(flags, name="CopyEventWeight", **kwargs):
50 kwargs.setdefault("mcEventWeightsKey", "TMPEvtInfo.mcEventWeights")
51
52 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Post))
53 acc.addEventAlgo(CompFactory.CopyEventWeight(name, **kwargs))
54 return acc
55
56
57def FillFilterValuesCfg(flags, name="FillFilterValues", **kwargs):
58 kwargs.setdefault("mcFilterHTKey", "TMPEvtInfo.mcFilterHT")
59
60 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Post))
61 acc.addEventAlgo(CompFactory.FillFilterValues(name, **kwargs))
62 return acc
63
64
65def SimTimeEstimateCfg(flags, name="SimTimeEstimate", **kwargs):
66 acc = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Post))
67 acc.addEventAlgo(CompFactory.SimTimeEstimate(name, **kwargs))
68 return acc
SimTimeEstimateCfg(flags, name="SimTimeEstimate", **kwargs)
CopyEventWeightCfg(flags, name="CopyEventWeight", **kwargs)
FillFilterValuesCfg(flags, name="FillFilterValues", **kwargs)
FixHepMCCfg(flags, name="FixHepMC", **kwargs)
TestHepMCCfg(flags, name="TestHepMC", streamName="TestHepMCname", fileName="TestHepMC.root", **kwargs)
GenWeightDeclarationCfg(flags, name="GenWeightDeclaration", **kwargs)
CountHepMCCfg(flags, name="CountHepMC", **kwargs)