3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
5 from AthenaConfiguration.Enums
import ProductionStep
8 def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1):
22 if time_stamp
is None:
35 | (modify_run_nbr << 0)
36 | (modify_evt_nbr << 1)
37 | (modify_time_stamp << 2)
38 | (modify_lbk_nbr << 3))
40 return [run_nbr, evt_nbr, time_stamp, lbk_nbr, nevts, mod_bit]
46 pDicts = flags.Input.RunAndLumiOverrideList
47 DataRunNumber = flags.Input.ConditionsRunNumber
51 evt_nbr = el.get(
"evt_nbr",
None)
52 Modifiers +=
add_modifier(run_nbr=el[
"run"], evt_nbr=evt_nbr, time_stamp=el[
"starttstamp"], lbk_nbr=el[
"lb"], nevts=el[
"evts"])
54 assert DataRunNumber >= 0, (
55 "flags.Input.ConditionsRunNumber %d is negative. "
56 "Use a real run number from data." % DataRunNumber)
60 if flags.Exec.MaxEvents > 0:
61 totalNumber = flags.Exec.MaxEvents + 1
62 if flags.Exec.SkipEvents > 0:
63 totalNumber += flags.Exec.SkipEvents
65 InitialTimeStamp = flags.IOVDb.RunToTimestampDict.get(DataRunNumber, 1)
68 Modifiers +=
add_modifier(run_nbr=DataRunNumber, lbk_nbr=FirstLB, time_stamp=InitialTimeStamp, nevts=totalNumber)
69 elif flags.Input.RunNumbers:
72 myRunNumber = flags.Input.RunNumbers[0]
73 assert myRunNumber >= 0, (
74 "flags.Input.RunNumbers[0] %d is negative. "
75 "Use a real run number from data." % myRunNumber)
76 myFirstLB = flags.Input.LumiBlockNumbers[0]
77 myInitialTimeStamp = flags.Input.TimeStamps[0]
81 if flags.Exec.MaxEvents > 0:
82 totalNumber = flags.Exec.MaxEvents + 1
83 if flags.Exec.SkipEvents > 0:
84 totalNumber += flags.Exec.SkipEvents
85 Modifiers +=
add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber)
90 pDicts = flags.Input.RunAndLumiOverrideList
96 return min(allLBs) + 0
98 return flags.Input.LumiBlockNumbers[0]
102 """Get a pair (firstrun,lastrun + 1) for setting ranges in IOVMetaData """
105 if flags.Input.RunAndLumiOverrideList:
107 allruns = [element[
'run']
for element
in flags.Input.RunAndLumiOverrideList]
108 mini =
min(allruns) + 0
109 maxi =
max(allruns) + 1
110 elif flags.Input.ConditionsRunNumber > 0:
112 assert flags.Input.ConditionsRunNumber >= 0, (
113 "flags.Input.ConditionsRunNumber %d is negative. "
114 "Use a real run number from data." % flags.Input.ConditionsRunNumber)
115 mini = flags.Input.ConditionsRunNumber
117 elif flags.Input.RunNumbers:
119 assert flags.Input.RunNumbers[0] >= 0, (
120 "flags.Input.RunNumbers[0] %d is negative. "
121 "Use a real run number from data." % flags.Input.RunNumbers[0])
123 mini = flags.Input.RunNumbers[0]
126 mini =
min(flags.Input.RunNumbers) + 0
127 maxi =
max(flags.Input.RunNumbers) + 1
132 """Metadata override for overlay"""
133 tool = CompFactory.IOVDbMetaDataTool()
136 acc.addPublicTool(tool)
142 isMT = flags.Concurrency.NumThreads > 0
143 pileUp = flags.Common.ProductionStep
in [ProductionStep.Digitization, ProductionStep.PileUpPresampling, ProductionStep.FastChain] \
144 and flags.Digitization.PileUp
145 if pileUp
and not isMT:
146 kwargs.setdefault(
"EvtStoreName",
"OriginalEvent_SG")
148 kwargs.setdefault(
"SkippedEvents", flags.Exec.SkipEvents)
150 kwargs.setdefault(
"EvtStoreName",
"StoreGateSvc")
153 if len(Modifiers) > 0:
154 kwargs.setdefault(
"Modifiers", Modifiers)
158 acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=
True, primary=
True)