ATLAS Offline Software
Functions
PileUpProfile_muRange Namespace Reference

Functions

def setupProfile (flags, scaleTaskLength=1)
 

Function Documentation

◆ setupProfile()

def PileUpProfile_muRange.setupProfile (   flags,
  scaleTaskLength = 1 
)

Definition at line 6 of file PileUpProfile_muRange.py.

6 def setupProfile(flags, scaleTaskLength=1):
7  logger = logging.getLogger("PileUp")
8  customProfile = flags.Digitization.PU.CustomProfile
9  # customProfile={'run':195847, 'startmu':15.0, 'endmu':25.0, 'stepmu':1.0, 'startlb':1, 'timestamp':1328039085}
10 
11  def _evts(x):
12  return int(scaleTaskLength * x)
13 
14  try:
15  logger.info('Setting-up custom pile-up range with user-selected run(s) %s', customProfile.get('run', -1))
16  except AttributeError:
17  logger.error("Set ConfigFlags.Digitization.PU.CustomProfile=\'{\"run\":1234,...}\' in preExec!")
18  raise ValueError("Invalid ConfigFlags.Digitization.PU.CustomProfile provided. Run number is missing.")
19  keys=['run', 'startmu', 'endmu', 'stepmu', 'startlb', 'timestamp']
20  for key in customProfile.keys():
21  if key not in keys:
22  raise ValueError("Invalid ConfigFlags.Digitization.PU.CustomProfile provided, key: %s. Valid keys are: %s" % (key, keys))
23 
24  startMu = customProfile.get('startmu', 0.0)
25  endMu = customProfile.get('endmu', 10.0)
26  stepMu = customProfile.get('stepmu', 1.0)
27  numberOfSteps = int(((endMu - startMu) / stepMu) + 1.0)
28  if numberOfSteps < 2:
29  raise RuntimeError("Step size too large!")
30 
31  stepsWithExtraEvent = 5000 % numberOfSteps
32  eventsPerStep = (5000 - (5000 % numberOfSteps)) / numberOfSteps
33  if _evts(eventsPerStep) < 2: raise RuntimeError("Step size too small!")
34 
35  runList = customProfile.get('run', 195847)
36  if not isinstance(runList, list): runList = [runList]
37  timestampList = customProfile.get('timestamp', 1328039085)
38  if not isinstance(timestampList, list): timestampList = [timestampList]
39  startlbList = customProfile.get('startlb', 1)
40  if not isinstance(startlbList, list): startlbList = [startlbList]
41 
42  profile = []
43  for currentRun, currentTimestamp, currentStartlb in zip(runList, timestampList, startlbList):
44  for step in range(numberOfSteps):
45  events = eventsPerStep + 1 if step < stepsWithExtraEvent else eventsPerStep
46  mu = float(startMu + (step * stepMu))
47  profile += [{'run': currentRun, 'lb': currentStartlb + step, 'starttstamp': currentTimestamp,
48  'evts': _evts(events), 'mu': mu}]
49  return profile
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PileUpProfile_muRange.setupProfile
def setupProfile(flags, scaleTaskLength=1)
Definition: PileUpProfile_muRange.py:6
readCCLHist.float
float
Definition: readCCLHist.py:83