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 18 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 61 of file runlumi.py.

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

◆ __repr__()

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

Definition at line 49 of file runlumi.py.

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

◆ __str__()

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

Definition at line 58 of file runlumi.py.

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

◆ __sub__()

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

Definition at line 73 of file runlumi.py.

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

◆ lumi()

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

Definition at line 87 of file runlumi.py.

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

◆ 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 34 of file runlumi.py.

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

◆ run()

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

Definition at line 83 of file runlumi.py.

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

◆ start_nextrun()

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

Definition at line 76 of file runlumi.py.

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

Member Data Documentation

◆ __slots__

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

Definition at line 29 of file runlumi.py.

◆ is_time

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

Definition at line 31 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:106