ATLAS Offline Software
Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
python.sugar.runlumi.RunLumiType Class Reference
Inheritance diagram for python.sugar.runlumi.RunLumiType:
Collaboration diagram for python.sugar.runlumi.RunLumiType:

Public Member Functions

def make (cls, *args)
 
def __repr__ (self)
 
def __str__ (self)
 
def __add__ (self, what)
 
def __sub__ (self, what)
 
def start_nextrun (self)
 
def run (self)
 
def lumi (self)
 

Static Public Attributes

bool is_time = False
 

Static Private Attributes

tuple __slots__ = ()
 

Detailed Description

Syntactic sugar for an IoV key.

This class intentionally has no constructor so that we can benefit from the
speed of the builtin long constructor. (Since we use it a lot!)

On the python side though, it is useful to have a constructor which takes 
(Run, Lumiblock). This is provided by the make() class method, which is
aliased as RunLumi.

Definition at line 19 of file runlumi.py.

Member Function Documentation

◆ __add__()

def python.sugar.runlumi.RunLumiType.__add__ (   self,
  what 
)
How to add something to an LB: in case of a numeric type, do the normal
thing. In case of a tuple, use the first element as a run number count
and the second element as a luminosity block count.


Definition at line 62 of file runlumi.py.

62  def __add__(self, what):
63  """
64  How to add something to an LB: in case of a numeric type, do the normal
65  thing. In case of a tuple, use the first element as a run number count
66  and the second element as a luminosity block count.
67  """
68  if isinstance(what, tuple):
69  nrun, nlumi = what
70  return RunLumiType((self.run + nrun << 32) + (self.lumi + nlumi))
71 
72  return RunLumiType(int.__add__(self, what))
73 

◆ __repr__()

def python.sugar.runlumi.RunLumiType.__repr__ (   self)
Pretty representation for an IoV key

Definition at line 50 of file runlumi.py.

50  def __repr__(self):
51  """
52  Pretty representation for an IoV key
53  """
54  run, lumi = self.run, self.lumi
55  if run == RUN_MAX: run = "[MAX]"
56  if lumi == LB_MAX: lumi = "[MAX]"
57  return "%5s:%5s" % (run, lumi)
58 

◆ __str__()

def python.sugar.runlumi.RunLumiType.__str__ (   self)

Definition at line 59 of file runlumi.py.

59  def __str__(self):
60  return self.__repr__()
61 

◆ __sub__()

def python.sugar.runlumi.RunLumiType.__sub__ (   self,
  what 
)

Definition at line 74 of file runlumi.py.

74  def __sub__(self, what):
75  return RunLumiType(int.__sub__(self, what))
76 

◆ lumi()

def python.sugar.runlumi.RunLumiType.lumi (   self)

Definition at line 88 of file runlumi.py.

88  def lumi(self):
89  return self & 0xFFFFFFFF
90 

◆ make()

def python.sugar.runlumi.RunLumiType.make (   cls,
args 
)
Create a RunLumiType in a smarter (but slower) way, depending on whether 
one or two args are passed.

Definition at line 35 of file runlumi.py.

35  def make(cls, *args):
36  """
37  Create a RunLumiType in a smarter (but slower) way, depending on whether
38  one or two args are passed.
39  """
40  if len(args) == 1:
41  if isinstance(args[0], tuple):
42  run, lumi = args[0]
43  return cls(run << 32 | lumi)
44  return cls(args[0])
45  elif len(args) == 2:
46  run, lumi = args
47  return cls(run << 32 | lumi)
48  raise RuntimeError("Invalid argument to RunLumiType.make")
49 

◆ run()

def python.sugar.runlumi.RunLumiType.run (   self)

Definition at line 84 of file runlumi.py.

84  def run(self):
85  return self >> 32
86 

◆ start_nextrun()

def python.sugar.runlumi.RunLumiType.start_nextrun (   self)
Return a new RunLumiType with run number += 1 and lumi = 1

Definition at line 77 of file runlumi.py.

77  def start_nextrun(self):
78  """
79  Return a new RunLumiType with run number += 1 and lumi = 1
80  """
81  return self + (1, -self.lumi) + (0, 1)
82 

Member Data Documentation

◆ __slots__

tuple python.sugar.runlumi.RunLumiType.__slots__ = ()
staticprivate

Definition at line 30 of file runlumi.py.

◆ is_time

bool python.sugar.runlumi.RunLumiType.is_time = False
static

Definition at line 32 of file runlumi.py.


The documentation for this class was generated from the following file:
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
lumiFormat.lumi
lumi
Definition: lumiFormat.py:113