ATLAS Offline Software
Loading...
Searching...
No Matches
McEventSelectorConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3from AthenaConfiguration.ComponentFactory import CompFactory
4
5def McEventSelectorCfg(flags, **kwargs):
6 cfg = ComponentAccumulator()
7
8 service = CompFactory.McCnvSvc()
9 cfg.addService(service)
10 cfg.addService(CompFactory.EvtPersistencySvc("EventPersistencySvc",
11 CnvServices=[service.getFullJobOptName()]))
12
13 if flags.Input.RunNumbers:
14 kwargs.setdefault("RunNumber", flags.Input.RunNumbers[0])
15 if flags.Input.TimeStamps:
16 kwargs.setdefault("InitialTimeStamp", flags.Input.TimeStamps[0])
17
18 if flags.Exec.FirstEvent <= 0:
19 raise ValueError("FirstEvent must be a positive, non-zero integer")
20
21 kwargs.setdefault("FirstEvent", flags.Exec.FirstEvent)
22
23 # we use 64-bit numbers by default now
24 kwargs.setdefault("EventsPerRun", int(2**63 - 1)) # sys.maxint on a 64-bit machine
25
26 evSel = CompFactory.McEventSelector("EventSelector", **kwargs)
27 cfg.addService(evSel)
28 cfg.setAppProperty("EvtSel", evSel.getFullJobOptName())
29
30 return cfg