ATLAS Offline Software
Functions
python.EventIdOverrideConfig Namespace Reference

Functions

def add_modifier (run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1)
 
def buildListOfModifiers (flags)
 
def getFirstLumiBlock (flags, run)
 
def getMinMaxRunNumbers (flags)
 
def IOVDbMetaDataToolWithRunNumberOverrideCfg (flags)
 
def EvtIdModifierSvcCfg (flags, name="EvtIdModifierSvc", **kwargs)
 

Function Documentation

◆ add_modifier()

def python.EventIdOverrideConfig.add_modifier (   run_nbr = None,
  evt_nbr = None,
  time_stamp = None,
  lbk_nbr = None,
  nevts = 1 
)

Definition at line 8 of file EventIdOverrideConfig.py.

8 def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1):
9 
10  if run_nbr is None:
11  modify_run_nbr = 0
12  run_nbr = 0
13  else:
14  modify_run_nbr = 1
15 
16  if evt_nbr is None:
17  modify_evt_nbr = 0
18  evt_nbr = 0
19  else:
20  modify_evt_nbr = 1
21 
22  if time_stamp is None:
23  modify_time_stamp = 0
24  time_stamp = 0
25  else:
26  modify_time_stamp = 1
27 
28  if lbk_nbr is None:
29  modify_lbk_nbr = 0
30  lbk_nbr = 0
31  else:
32  modify_lbk_nbr = 1
33 
34  mod_bit = int(0b0000
35  | (modify_run_nbr << 0)
36  | (modify_evt_nbr << 1)
37  | (modify_time_stamp << 2)
38  | (modify_lbk_nbr << 3))
39 
40  return [run_nbr, evt_nbr, time_stamp, lbk_nbr, nevts, mod_bit]
41 
42 

◆ buildListOfModifiers()

def python.EventIdOverrideConfig.buildListOfModifiers (   flags)

Definition at line 43 of file EventIdOverrideConfig.py.

43 def buildListOfModifiers(flags):
44  # migrated from RunDMCFlags.py
45  Modifiers = []
46  pDicts = flags.Input.RunAndLumiOverrideList
47  DataRunNumber = flags.Input.ConditionsRunNumber
48 
49  if pDicts:
50  for el in pDicts:
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"])
53  elif DataRunNumber>0:
54  assert DataRunNumber >= 0, (
55  "flags.Input.ConditionsRunNumber %d is negative. "
56  "Use a real run number from data." % DataRunNumber)
57 
58  # Using event numbers to avoid "some very large number" setting
59  totalNumber = 1000000
60  if flags.Exec.MaxEvents > 0:
61  totalNumber = flags.Exec.MaxEvents + 1
62  if flags.Exec.SkipEvents > 0:
63  totalNumber += flags.Exec.SkipEvents
64 
65  InitialTimeStamp = flags.IOVDb.RunToTimestampDict.get(DataRunNumber, 1) # TODO fix repeated configuration
66 
67  FirstLB = 1
68  Modifiers += add_modifier(run_nbr=DataRunNumber, lbk_nbr=FirstLB, time_stamp=InitialTimeStamp, nevts=totalNumber)
69  elif flags.Input.RunNumbers:
70  # Behaviour for Simulation jobs. For standard Simulation we
71  # override the run number once per job. TODO Still need to deal with the specific case of DataOverlay
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]
78 
79  # Using event numbers to avoid "some very large number" setting
80  totalNumber = 1000000
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)
86  return Modifiers
87 
88 

◆ EvtIdModifierSvcCfg()

def python.EventIdOverrideConfig.EvtIdModifierSvcCfg (   flags,
  name = "EvtIdModifierSvc",
**  kwargs 
)

Definition at line 140 of file EventIdOverrideConfig.py.

140 def EvtIdModifierSvcCfg(flags, name="EvtIdModifierSvc", **kwargs):
141  acc = ComponentAccumulator()
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")
147  elif pileUp:
148  kwargs.setdefault("SkippedEvents", flags.Exec.SkipEvents)
149  else:
150  kwargs.setdefault("EvtStoreName", "StoreGateSvc")
151 
152  Modifiers = buildListOfModifiers(flags)
153  if len(Modifiers) > 0:
154  kwargs.setdefault("Modifiers", Modifiers)
155 
157 
158  acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=True, primary=True)
159  return acc

◆ getFirstLumiBlock()

def python.EventIdOverrideConfig.getFirstLumiBlock (   flags,
  run 
)

Definition at line 89 of file EventIdOverrideConfig.py.

89 def getFirstLumiBlock(flags, run):
90  pDicts = flags.Input.RunAndLumiOverrideList
91  if pDicts:
92  allLBs = [1]
93  for el in pDicts:
94  if el["run"] == run:
95  allLBs += [el["lb"]]
96  return min(allLBs) + 0
97  else:
98  return flags.Input.LumiBlockNumbers[0]
99 
100 

◆ getMinMaxRunNumbers()

def python.EventIdOverrideConfig.getMinMaxRunNumbers (   flags)
Get a pair (firstrun,lastrun + 1) for setting ranges in IOVMetaData 

Definition at line 101 of file EventIdOverrideConfig.py.

101 def getMinMaxRunNumbers(flags):
102  """Get a pair (firstrun,lastrun + 1) for setting ranges in IOVMetaData """
103  mini = 1
104  maxi = 2147483647
105  if flags.Input.RunAndLumiOverrideList:
106  # Behaviour for Digitization jobs using 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:
111  # Behaviour for Digitization jobs using DataRunNumber
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
116  maxi = mini + 1
117  elif flags.Input.RunNumbers:
118  # Behaviour for Simulation jobs
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])
122  if flags.Input.isMC:
123  mini = flags.Input.RunNumbers[0]
124  maxi = 2147483647
125  else:
126  mini = min(flags.Input.RunNumbers) + 0
127  maxi = max(flags.Input.RunNumbers) + 1
128  return (mini, maxi)
129 
130 

◆ IOVDbMetaDataToolWithRunNumberOverrideCfg()

def python.EventIdOverrideConfig.IOVDbMetaDataToolWithRunNumberOverrideCfg (   flags)
Metadata override for overlay

Definition at line 131 of file EventIdOverrideConfig.py.

132  """Metadata override for overlay"""
133  tool = CompFactory.IOVDbMetaDataTool()
134  tool.MinMaxRunNumbers = getMinMaxRunNumbers(flags)
135  acc = ComponentAccumulator()
136  acc.addPublicTool(tool)
137  return acc
138 
139 
python.EventIdOverrideConfig.add_modifier
def add_modifier(run_nbr=None, evt_nbr=None, time_stamp=None, lbk_nbr=None, nevts=1)
Definition: EventIdOverrideConfig.py:8
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
python.EventIdOverrideConfig.buildListOfModifiers
def buildListOfModifiers(flags)
Definition: EventIdOverrideConfig.py:43
python.EventIdOverrideConfig.IOVDbMetaDataToolWithRunNumberOverrideCfg
def IOVDbMetaDataToolWithRunNumberOverrideCfg(flags)
Definition: EventIdOverrideConfig.py:131
python.EventIdOverrideConfig.getFirstLumiBlock
def getFirstLumiBlock(flags, run)
Definition: EventIdOverrideConfig.py:89
python.EventIdOverrideConfig.EvtIdModifierSvcCfg
def EvtIdModifierSvcCfg(flags, name="EvtIdModifierSvc", **kwargs)
Definition: EventIdOverrideConfig.py:140
python.EventIdOverrideConfig.getMinMaxRunNumbers
def getMinMaxRunNumbers(flags)
Definition: EventIdOverrideConfig.py:101