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 pDicts = flags.Input.RunAndLumiOverrideList
108 allruns = [element[
'run']
for element
in pDicts]
109 mini =
min(allruns) + 0
110 maxi =
max(allruns) + 1
111 elif flags.Input.ConditionsRunNumber>0:
113 DataRunNumber = flags.Input.ConditionsRunNumber
114 assert DataRunNumber >= 0, (
115 "flags.Input.ConditionsRunNumber %d is negative. "
116 "Use a real run number from data." % DataRunNumber)
118 maxi = DataRunNumber+1
119 elif flags.Input.RunNumbers:
121 myRunNumber = flags.Input.RunNumbers[0]
122 assert myRunNumber >= 0, (
123 "flags.Input.RunNumbers[0] %d is negative. "
124 "Use a real run number from data." % myRunNumber)
132 isMT = flags.Concurrency.NumThreads > 0
133 pileUp = flags.Common.ProductionStep
in [ProductionStep.Digitization, ProductionStep.PileUpPresampling, ProductionStep.FastChain]
and flags.Digitization.PileUp
and not flags.Overlay.FastChain
134 if pileUp
and not isMT:
135 kwargs.setdefault(
"EvtStoreName",
"OriginalEvent_SG")
137 kwargs.setdefault(
"SkippedEvents", flags.Exec.SkipEvents)
139 kwargs.setdefault(
"EvtStoreName",
"StoreGateSvc")
142 if len(Modifiers) > 0:
143 kwargs.setdefault(
"Modifiers", Modifiers)
144 iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
146 acc.addPublicTool(iovDbMetaDataTool)
148 acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=
True, primary=
True)