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 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 130 of file EventIdOverrideConfig.py.

130 def EvtIdModifierSvcCfg(flags, name="EvtIdModifierSvc", **kwargs):
131  acc = ComponentAccumulator()
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")
136  elif pileUp:
137  kwargs.setdefault("SkippedEvents", flags.Exec.SkipEvents)
138  else:
139  kwargs.setdefault("EvtStoreName", "StoreGateSvc")
140 
141  Modifiers = buildListOfModifiers(flags)
142  if len(Modifiers) > 0:
143  kwargs.setdefault("Modifiers", Modifiers)
144  iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool()
145  iovDbMetaDataTool.MinMaxRunNumbers = getMinMaxRunNumbers(flags)
146  acc.addPublicTool(iovDbMetaDataTool)
147 
148  acc.addService(CompFactory.EvtIdModifierSvc(name, **kwargs), create=True, primary=True)
149  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  pDicts = flags.Input.RunAndLumiOverrideList
106  if pDicts:
107  # Behaviour for Digitization jobs using 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:
112  # Behaviour for Digitization jobs using DataRunNumber
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)
117  mini = DataRunNumber
118  maxi = DataRunNumber+1
119  elif flags.Input.RunNumbers:
120  # Behaviour for Simulation jobs
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)
125  mini = myRunNumber
126  maxi = 2147483647
127  return (mini,maxi)
128 
129 
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
max
#define max(a, b)
Definition: cfImp.cxx:41
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.EventIdOverrideConfig.buildListOfModifiers
def buildListOfModifiers(flags)
Definition: EventIdOverrideConfig.py:43
min
#define min(a, b)
Definition: cfImp.cxx:40
python.EventIdOverrideConfig.getFirstLumiBlock
def getFirstLumiBlock(flags, run)
Definition: EventIdOverrideConfig.py:89
python.EventIdOverrideConfig.EvtIdModifierSvcCfg
def EvtIdModifierSvcCfg(flags, name="EvtIdModifierSvc", **kwargs)
Definition: EventIdOverrideConfig.py:130
python.EventIdOverrideConfig.getMinMaxRunNumbers
def getMinMaxRunNumbers(flags)
Definition: EventIdOverrideConfig.py:101